- run
user-data.sh
- run
install-ruby.sh
.
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 | |
# | |
# This script generates RESTful scaffolds from your pre-existing models. | |
# Copyright 2008 Kyle Maxwell, available under the MIT licence. | |
# | |
require "rubygems" | |
require "active_support" | |
content = File.read(File.dirname(__FILE__) + "/db/schema.rb").split("create_table") |
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 'sass' | |
configure do | |
Tilt.register 'scss', Tilt::SassTemplate | |
set :scss, :syntax => :scss | |
end | |
get '/stylesheets/:file.css' do |file| | |
content_type 'text/css', :charset => 'utf-8' |
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 | |
# This script installs to /usr/local only. To install elsewhere you can just | |
# untar https://github.com/mxcl/homebrew/tarball/master anywhere you like. | |
module Tty extend self | |
def blue; bold 34; end | |
def white; bold 39; end | |
def red; underline 31; end | |
def reset; escape 0; end | |
def bold n; escape "1;#{n}" 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
# bts: If I'm writing a plugin, I'd typically like to have a namespace to add | |
# my own classes, so I would skip this option: | |
# Qu.plugin(:autoretry) do |*errors| | |
# options = {:limit => 3}.merge!(errors.extract_options!) | |
# errors << Exception if errors.empty? | |
# before :failure do |job, e| | |
# if errors.any? {|error| error === e } | |
# job.data[:retries] += 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
require 'ffi' | |
module XmlEscaper | |
extend FFI::Library | |
ffi_lib 'xml2' | |
UTF8 = Encoding.find('UTF-8') | |
def self.escape(string) | |
char_ptr = self.xmlEncodeSpecialChars(nil, string) | |
encoded = char_ptr.read_string |
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
router.proxyRequest req, res, | |
host: proxyHost | |
port: proxyPort | |
# becomes: | |
router.proxyRequest req, res, | |
host: proxyHost | |
port: proxyPort | |
responseHeaderTransform: (headers) -> |
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
% jruby -J-Djruby.backtrace.style=raw popen.rb | |
using r... | |
using r+... | |
IOError: Bad file descriptor | |
getStackTrace at java/lang/Thread.java:1567 | |
getBacktraceData at org/jruby/runtime/backtrace/TraceType.java:171 | |
getBacktrace at org/jruby/runtime/backtrace/TraceType.java:39 | |
prepareBacktrace at org/jruby/RubyException.java:215 | |
preRaise at org/jruby/exceptions/RaiseException.java:214 | |
preRaise at org/jruby/exceptions/RaiseException.java:195 |
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
(defn topo-sort | |
"Provided a map of values to their dependencies, returns a seq of the values | |
sorted topologically. | |
Adapted from code by cgrande at: | |
https://groups.google.com/forum/#!topic/clojure/-sypb2Djhio" | |
[deps] | |
(mapcat #(for [[u vs] % | |
:when (empty? vs)] | |
u) | |
(take-while seq |
I hereby claim:
- I am bts on github.
- I am bts (https://keybase.io/bts) on keybase.
- I have a public key whose fingerprint is C21B 6375 05AC 06EF EEF8 E0F3 7FBA 4DDD 7EC8 97F4
To claim this, I am signing this object: