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 "open3" | |
commands = <<-EOS | |
echo 'foo' | |
cd /tmp | |
ls -1 | |
EOS |
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 "open3" | |
class SSH | |
def initialize(server) | |
@server = server | |
end | |
def start | |
Open3.popen3("ssh -T #{@server}") do |stdin, stdout, stderr| | |
threads = [] |
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 "sinatra/base" | |
require "haml" | |
class Foo | |
include Sinatra::Templates | |
def self.views; end | |
def self.caller_locations; [["Foo", 1]]; end | |
def bar |
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 "sinatra/base" | |
require "haml" | |
class Foo | |
include Sinatra::Templates | |
def self.views; end | |
def self.caller_locations; [["Foo", 1]]; end | |
def bar |
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/bash | |
if [ -z "$1" ]; then | |
cat /dev/stdin > /tmp/pbcopy | |
pbcopy /tmp/pbcopy | |
cat /dev/null > /tmp/pbcopy | |
else | |
arch -i386 osascript -e 'tell application "System Events"' -e "set the clipboard to (read posix file \"$1\" as text)" -e 'end tell'; | |
fi |
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 "sinatra" | |
get("/") { "Hello world" } | |
if $0 == __FILE__ | |
require "rack/test" | |
require "webrat" | |
require "test/unit" | |
Webrat.configure do |config| |
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 "open3" | |
module Sh | |
def sh(cmd) | |
out, err, status = nil | |
Open3.popen3(cmd) do |_in, _out, _err, _wait_thr| | |
out = _out.read.sub(/\n$/, "") | |
err = _err.read.sub(/\n$/, "") | |
status = _wait_thr.value.exitstatus |
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 Test | |
module Sessions | |
%w{get post put delete head}.each do |verb| | |
eval <<-EOS | |
def #{verb}(uri, params = {}, env = {}, &block) | |
inject_session(env) | |
super(uri, params, env, &block) | |
end | |
EOS | |
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 "monitor" | |
require "bench" | |
@monitor = Monitor.new | |
@mutex = Mutex.new | |
block = lambda { 1 + 1 } | |
def just_call(&block) | |
yield |
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
# How to migrate your Redis database to Ohm 0.1 RC1 | |
require "ohm" | |
require "ohm/utils/upgrade" | |
Ohm.connect :port => 6380 # or load your application environment | |
# Provide the names of the models you need to upgrade. | |
Ohm::Utils::Upgrade.new([:User, :Post, :Comment]).run |