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
class Node | |
attr_accessor :next, :data | |
def push(str) | |
n = Node.new | |
n.data = str | |
node = self | |
next_node = nil | |
while node.next |
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
function LargeInt(str){ | |
this.length = 0; | |
if (str){ | |
Array.prototype.push.apply(this, String(str).split('')); | |
} | |
} | |
LargeInt.prototype = { | |
splice: Array.prototype.splice, | |
minus: function(subtrahend){ | |
subtrahend = new LargeInt(subtrahend); |
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
class Foo | |
def bar | |
if block_given? | |
yield | |
else | |
puts "Foo#bar: please give me a block :(" | |
end | |
end | |
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
class Object | |
def metaclass | |
class << self; self; end | |
end | |
def self.stub_method_chain chain, &blk | |
chain = chain.split('.') if chain.is_a? String | |
metaclass.instance_eval do | |
define_method chain.first do |*values| | |
Object.new.tap do |o| |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv=Content-type content="text/html; charset=utf-8"> | |
<title></title> | |
</head> | |
<body> | |
<form> | |
<input type="text" id="fileDrag" placeholder="Drag file here"> | |
</form> |
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
ruby -e "require 'rubygems';require 'sinatra';set :port, 9999;set :public, Dir.pwd" |
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
(function($){ | |
$.fn.blockingEvent = function(eventType, eventHandler){ | |
var eventId = '_active_'+eventType; | |
this.bind(eventType, function(e){ | |
e.preventDefault(); | |
$this = $(this); | |
if ($this.data(eventId)){ | |
return false; | |
} | |
$this.data(eventId, true); |
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
Process: Rosie [73166] | |
Path: [REDACTED]/build/Debug/Rosie.app/Contents/MacOS/Rosie | |
Identifier: com.tractionco.Rosie | |
Version: 0.1 (0.1) | |
Code Type: X86-64 (Native) | |
Parent Process: launchd [163] | |
Date/Time: 2011-04-08 10:36:27.248 -0700 | |
OS Version: Mac OS X 10.6.7 (10J869) | |
Report Version: 6 |
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
# BEGIN WordPress | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
# Make the admin still accessible from /wp-admin | |
RewriteCond %{REQUEST_URI} ^/wp-admin/?(.*) | |
RewriteRule .* wp/wp-admin/$1 [L,R=301] | |
# Base is the URL path of the home directory | |
RewriteBase / | |
RewriteRule ^$ wp/index.php [L] | |
# Skip real files and directories |
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
sinatra-memcached doesn't work with heroku | |
because memcache-client doesn't work with heroku | |
okay, let's rewrite sinatra-memcached to work with dalli, heroku's recommended memcached client | |
hmm, dalli isn't working on my local install so i can't really test it | |
why is it failing to connect to localhost? | |
hmm, dalli requires memcached 1.4+, let's make sure i'm running that | |
huh, 1.2.8, that's weird because i just installed memcached | |
`brew info memcached` says it should be in /usr/local/bin, right... | |
and yet `which memcached` says /usr/bin. uh... wtf | |
ok, let's just symlink the new memcached into /usr/bin, why the fuck not |