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 Bit(a, b) { | |
this.a = a; | |
this.b = b; | |
} | |
function construct() { | |
var args = Array.prototype.splice.call(arguments, 0); | |
var fn = args.shift(); | |
function F() { |
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 'net/http' | |
# WARNING do not use this; it works but is very limited | |
def resolve url | |
res = Net::HTTP.get_response URI(url) | |
if res.code == '301' then res['location'] | |
else url.to_s | |
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
require 'faraday_middleware' | |
require 'hashie/mash' | |
# Public: GeoIP service using freegeoip.net | |
# | |
# See https://github.com/fiorix/freegeoip#readme | |
# | |
# Examples | |
# | |
# res = GeoipService.new.call '173.194.64.19' |
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 | |
require 'tempfile' | |
require 'fileutils' | |
# Signals | |
trap("SIGINT") { exit } | |
# Setup | |
TARGET_FOLDER = ARGV[0] | |
TARGET_URL = ARGV[1] |
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
# Save this file in ~/Library/Application Support/Sublime Text 2/Packages/User | |
import sublime, sublime_plugin | |
class DefaultSyntaxCommand(sublime_plugin.EventListener): | |
def on_new(self, view): | |
view.set_syntax_file('JavaScript/JavaScript.tmLanguage') |
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
# Run this file with `RAILS_ENV=production rackup -p 3000 -s thin` | |
# Be sure to have rails and thin installed. | |
require "rubygems" | |
require "rails" | |
# Let's load only action controller. If you want | |
# to use active record, just require it as well. | |
require "action_controller/railtie" | |
class MyApp < Rails::Application |
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
# Toss this in your ~/.irbrc file for a convenient way | |
# to peruse Ruby source code in TextMate. This | |
# only works in Ruby 1.9! | |
# | |
# Use it in irb like so: | |
# | |
# >> require 'active_record' | |
# >> ActiveRecord::Base.source_for_method(:create) | |
class Object |
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
Copyright (c) 2011 Jed Schmidt, http://jed.is | |
Permission is hereby granted, free of charge, to any person obtaining | |
a copy of this software and associated documentation files (the | |
"Software"), to deal in the Software without restriction, including | |
without limitation the rights to use, copy, modify, merge, publish, | |
distribute, sublicense, and/or sell copies of the Software, and to | |
permit persons to whom the Software is furnished to do so, subject to | |
the following conditions: | |
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
def tip(msg); puts; puts msg; puts "-"*100; end | |
# | |
# 30 Ruby 1.9 Tips, Tricks & Features: | |
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/ | |
# | |
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2" | |
tip "Ruby 1.9 supports named captures in regular expressions!" |
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 | |
# Install ImageMagick on Snow Leopard: by kain, improved by mislav and samsoffes | |
# http://www.icoretech.org/2009/08/install-imagemagick-in-leopard-snow-leopard/ | |
# Work with 64bit kernel mode | |
set -e | |
PREFIX=/usr/local | |
# Passenger users: amend your Apache global configuration with the following directive | |
# SetEnv PATH /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin |
NewerOlder