Skip to content

Instantly share code, notes, and snippets.

View dtinth's full-sized avatar
🎶
𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪

Thai Pangsakulyanont dtinth

🎶
𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪𒐪
  • @bemusic                 @creatorsgarten                 @eventpop                 @showdownspace                 @spacetme                @wonderfulsoftware                
  • Krungthepmahanakhonamonrattanakosinmahintharayutthayamahadilokphopnoppharatratchathaniburiromudomratchaniwetmahasathanamonphimanawatansathitsakkathattiyawitsanukamprasit (Bangkok), Thailand
  • YouTube @dtinth
View GitHub Profile
> var chai = require('chai')
> chai.use(require('chai-as-promised'))
> var q = require('q')
> chai.should()
> var r = q.resolve(555).should.eventually.equal(3)
> var e
> r.fail(function(err) { e = err })
> e
{ message: 'expected 555 to equal 3',
actual:
@dtinth
dtinth / app.js
Created May 8, 2013 04:58
Testing Titanium
var facebook = require('facebook')
facebook.appid = '175681919257376'
facebook.permissions = [ 'read_requests', 'publish_stream' ]
var onPosted = function(e) {
if (e.success) {
alert("Posted to facebook!")
<!DOCTYPE html>
<html>
<body>
<iframe name="hello" id="hello" frameborder="0" style="width:0;height:0;position:absolute;left:-1000px"></iframe>
<input type="button" id="button" value="submit">
<script>
document.getElementById('button').addEventListener('click', function() {
// returns itself
var self = function(object) {
return object
}
var get = function(name) {
// returns a property of an object
return function(object) {
return object[name]
@dtinth
dtinth / customcommand.vim
Last active December 18, 2015 04:39
Vim Custom Command
" put me in your vimrc
" bind run command
map <leader>r :call RunCustomCommand()<cr>
map <leader>s :call SetCustomCommand()<cr>
let g:silent_custom_command = 0
function! RunCustomCommand()
up
if g:silent_custom_command
execute 'silent !' . s:customcommand
else
@dtinth
dtinth / code.html
Last active December 18, 2015 04:49
How To Synchroscope
<!-- synchroscope stuff -->
<script src="https://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/md5.js"></script><!-- optional -->
<script src="https://synchroscope.herokuapp.com/socket.io/socket.io.js"></script>
<script src="https://synchroscope.herokuapp.com/sync.js"></script>
<!-- end synchroscope stuff -->
require 'pty'
require 'io/console'
STDIN.raw do
File.open('keylog.txt', 'a') do |log|
PTY.spawn('vim wtf') do |r, w, pid|
w.winsize = STDIN.winsize
rs = { STDIN => w, r => STDOUT }
rs.compare_by_identity
loop do
@dtinth
dtinth / chain.js
Created June 13, 2013 14:37
Synchronous Chain Utility
function chain(obj, ctx) {
var result
if (ctx === undefined) ctx = {}
function next(fn) {
if (fn == null) return result
if (result === undefined) result = fn.call(obj, ctx)
return next
}
return next
# FizzBuzz in Lambda Calculus LiveScript
#
# Based on the problem from Chapter 6 of
# Understanding Computation: From Simple Machines to Impossible Programs
# by Tom Stuart
# http://computationbook.com/
#
# Only these things are allowed:
# - Creating functions
@dtinth
dtinth / lawn_code.rb
Created July 15, 2013 08:24
(Codejam 2013) One Statement Lawnmower in Ruby
require 'matrix' and gets.to_i.times { |i| puts "Case ##{i+1}: #{(m = Matrix[*Array.new(gets.split.map(&:to_i)[0]) { gets.split.map(&:to_i) }]).enum_for(:each_with_index).all? { |c,i,j| [m.row(i).max, m.column(j).max].min == c } ? 'YES' : 'NO'}" }