This file contains 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
Number.prototype.upto = function upto(end) { | |
var start = this; | |
function NumberIterator() { | |
this.current = start; | |
} | |
NumberIterator.prototype.next = function next() { | |
if (this.current > end) { | |
throw StopIteration; | |
} else { | |
return this.current++; |
This file contains 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
// https://developer.mozilla.org/En/Using_audio_and_video_in_Firefox#Media_events | |
// https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIDOMHTMLMediaElement | |
var Sounds = { | |
sounds: {}, | |
errors: [null, "ABORTED", "NETWORK", "DECODE", "SRC_NOT_SUPPORTED"], | |
register: function register(sounds) { | |
var errors = this.errors; | |
for (var i = 0, l = sounds.length; i < l; i++) { |
This file contains 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
let self = require('self'), file = require('file'), url = require('url'); | |
let contextMenu = require('context-menu'); | |
let sym = gensym(), containerID = 'word-cloud-' + sym; | |
let item = contextMenu.Item({ | |
label: "Show Word Cloud", | |
onClick: function(context, item) { | |
let win = context.window, corpus = generateCorpus(win); | |
let scores = score(corpus), sorted = plist(scores); | |
sorted.sort(byScore); |
This file contains 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
framework 'cocoa' | |
class HelloFS | |
PATH = '/hello.txt' | |
def contentsOfDirectoryAtPath(path, error: error) | |
[PATH.lastPathComponent] | |
end | |
def contentsAtPath(path) |
This file contains 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
#!/bin/sh | |
# Run this script with sudo | |
launchctl unload /System/Library/LaunchDaemons/org.cups.cupsd.plist | |
cp /etc/cups/cupsd.conf /etc/cups/cupsd.conf.cse | |
cat >> /etc/cups/cupsd.conf <<EOF | |
# Show shared printers on the UW CSE network. | |
BrowseRemoteProtocols cups |
This file contains 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
module Env | |
MACRUBY_FRAMEWORK_BIN = 'MacRuby.framework/Versions/Current/usr/bin/macruby' | |
MACRUBY_CANDIDATES = [ | |
"/System/Library/PrivateFrameworks/#{MACRUBY_FRAMEWORK_BIN}", | |
"/Library/Frameworks/#{MACRUBY_FRAMEWORK_BIN}" | |
] | |
def self.find_macruby | |
MACRUBY_CANDIDATES.each do |path| | |
return path if File.exist?(path) |
This file contains 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
#!/usr/bin/env macruby | |
framework 'CoreFoundation' | |
class Range | |
def to_core_range | |
location = self.begin | |
length = (self.exclude_end? ? self.end : self.end.succ) - location | |
CFRange.new(location, length) | |
end |
This file contains 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
this.Generator && (function(g, global) { | |
var __send = g.prototype.send; | |
g.prototype.send = function send(value) { | |
var result = __send.call(this, value); | |
if (result.done) { | |
throw new StopIteration(); | |
} | |
return result.value; | |
}; | |
This file contains 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
<?php | |
class Context { | |
private $args = array(); | |
private $func = NULL; | |
public function __construct() { | |
$args = func_get_args(); | |
$func = array_pop($args); |
OlderNewer