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
require 'rubygems' | |
require 'pathname' | |
require 'rails/all' | |
class SmallNSexy < Rails::Application | |
config.session_store :cookie_store, :key => '_omg_session' | |
config.secret_token = '1319d8ccf1b9bfbdefcb6aa380a044ce' | |
# ^ because -> http://twitter.com/wycats/status/13898343700 | |
class Page |
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
A = [8, -21, 8, 2].zip(self.inspect.scan(/./)).map { |a,b| (b[0] - a).chr }.join | |
B = <<-B | |
011010000111010001110100011100000011101000101111001011110110011101101001011101 | |
000110100001110101011000100010111001100011011011110110110100101111011000100111 | |
001001111001011000010110111001110111011011110110111101100100011100110010111101 | |
101011011010010111010001110100011110010010111101110010011000010111011100101111 | |
011011010110000101110011011101000110010101110010001011110110001001101001011011 | |
10001011110110101101101001011101000111010001111001 | |
B | |
require %w[6f70656e2d757269].pack('H*') |
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
p(%|#{<<-''}|[?\0...-0x0_2]<<% == <<%< ><<%&#{?../ 0.0_0 }&) | |
A Big Number Divided By Zero | |
ruby &= { :spirit => :creative } | |
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
get '/' do | |
dc = Dalli::Client.new('localhost:11211') | |
@info = dc.fetch("info-#{userid}-#{repoid}") do | |
HTTParty.get("#{base_uri}/repos/show/#{userid}/#{repoid}")) | |
end | |
@collaborators = dc.fetch("collaborators-#{userid}-#{repoid}") do | |
HTTParty.get("#{base_uri}/repos/show/#{userid}/#{repoid}/collaborators")) | |
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
// before | |
mainWindow.menu("File", function(err, file) { | |
if(err) throw err; | |
file.openMenu(function(err, menu) { | |
if(err) throw err; | |
menu.item("Open", function(err, item) { | |
if(err) throw err; | |
item.click(function(err) { | |
if(err) throw err; | |
mainWindow.getChild(type('Window'), function(err, dialog) { |
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
http = require 'http' | |
server = http.createServer (req, res) -> | |
res.writeHead 200, {'Content-Type': 'text/plain'} | |
res.end 'Hello World\n' | |
server.listen 8124, "127.0.0.1", () -> | |
console.log 'Server running at http://127.0.0.1:8124/' |
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
# logger = require('logger').create() | |
# logger.info("blah") | |
# => [2011-3-3T20:24:4.810 info (5021)] blah | |
# logger.debug("boom") | |
# => | |
# logger.level = Logger.levels.debug | |
# logger.debug(function() { return "booom" }) | |
# => [2011-3-3T20:24:4.810 error (5021)] booom | |
class Logger | |
constructor: (options) -> |
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/ruby | |
require 'svn/client' | |
require 'tempfile' | |
# (1) get the data | |
file = 'tmp.marshal' | |
dat = nil | |
begin | |
open file, 'rb' do |fp| | |
dat = Marshal.load fp |
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 ruby | |
# | |
# A quick script to dump an overview of all the open issues in all my github projects | |
# | |
require 'octokit' | |
require 'awesome_print' | |
require 'rainbow' |
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 ruby | |
# -*- coding: utf-8 -*- | |
require 'fiber' | |
module Lazy | |
module Enumerable | |
def lazy(method = :each) | |
Lazy::Enumerator.new do | |
if block_given? | |
Fiber.yield yield while true |
OlderNewer