This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> 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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var facebook = require('facebook') | |
facebook.appid = '175681919257376' | |
facebook.permissions = [ 'read_requests', 'publish_stream' ] | |
var onPosted = function(e) { | |
if (e.success) { | |
alert("Posted to facebook!") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// returns itself | |
var self = function(object) { | |
return object | |
} | |
var get = function(name) { | |
// returns a property of an object | |
return function(object) { | |
return object[name] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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 --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'}" } |