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
############ | |
############ this doesn't work with anthing above rails 2.0.4 | |
############ | |
cd `mktemp -d` | |
rails ext_js_test | |
wget extjs.com/deploy/ext-2.2.zip | |
unzip ext-2.2.zip | |
mv ext-2.2 ext_js_test/public/ext | |
cd ext_js_test | |
script/plugin install http://rug-b.rubyforge.org/svn/ext_scaffold/ |
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
# C includes must happen outside a VCL function | |
# see http://varnish-cache.org/wiki/VCLExampleSyslog | |
C{ | |
#include <stdlib.h> | |
#include <time.h> | |
#include <stdio.h> | |
}C | |
sub vcl_recv { | |
if (req.url ~ "^/random$" ) { |
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
fn="test.sqlite" | |
exit(1) if File.exist?(fn) | |
require 'rubygems' | |
require 'sqlite3' | |
db=SQLite3::Database.new(fn) | |
db.execute("CREATE TABLE testable (t1 INTEGER PRIMARY KEY, data TEXT, num DOUBLE, time DATE)") | |
db.execute(%^INSERT INTO testable (data,num,time) VALUES ('This is sample data',#{rand},"#{Time.now}")^) | |
puts db.execute("SELECT * FROM testable") |
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
# this find command lists all text files excluding files (e.g. binary files) that shouldn't be touched. | |
# you might want to add more file name extensions for your project if [1] outputs extensions of files | |
# that you don't want to have processed | |
# | |
# the commands below were tested on Ubuntu, your milage may vary on Mac OS (please leave a comment if so) | |
find . -regextype posix-extended -type f -size +0 ! -iregex '.*/\.(svn|git)/.*' ! -iregex '.*\.(gif|png|jpe?g|ico|psd|ai|jar|db|odt|pdf|swf|rtf|zip|eps|sqlite3?|mo|air|mp3|wav|otf|eot|ttf|woff)$' | |
# append this to add missing newline at EOF | |
-print0 | xargs -0 printf "e %s\nw\n" | ed -s; |
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 interactive script decodes the _session cookie contents of the Rails | |
# Session Store. It can be useful when debugging session-related problems. | |
# Be aware that Firefox doesn't update the cookie contents on every request when | |
# you keep the according dialog open. If you have to debug HTTP regularly, I can | |
# recommend the Charles Web Debugging Proxy (http://www.charlesproxy.com/) | |
puts("Loading...") | |
Signal.trap("INT") { puts "\n" ; exit } |
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
# from: vestal_versions (1.0.2, 0.8.3) | |
# to: gem install --no-ri --no-rdoc vestal_versions -v=1.0.2 | |
gem list | sed -r 's/([a-zA-Z0-9_-]+) \(([0-9\.]+)[,\)](.*)/gem install --no-ri --no-rdoc \1 -v=\2/' |
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
∞ 221e | |
∕ 2215 (useful for slashes in filenames) | |
★ 2605 | |
☆ 2606 | |
☹ 2639 | |
☺ 263a | |
☻ 263b | |
⌣ 2323 | |
ツ 30c4 |
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
# use the 127.0.0.2 address of the loopback interface so that it doesn't interfere with other servers on localhost | |
echo '127.0.0.2 blog.facebook.com static.ak.connect.facebook.com www.facebook.com facebook.com static.ak.fbcdn.net connect.facebook.net creative.ak.facebook.com ads.ak.facebook.com ads.ak.facebook.com.edgesuite.net' | sudo tee -a /etc/hosts | |
# run a tiny ruby/rack app with unicorn to reply with an empty HTTP 200 response on all requests | |
sudo unicorn -D -l 127.0.0.2:80 -e 'lambda { |env| [ 200, {"Content-Type" => "text/plain"}, "" ] }' |
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
$ cat Gemfile | |
source :rubygems | |
gem "sinatra" | |
$ cat config.ru | |
require 'rubygems' | |
require 'bundler' | |
Bundler.require |
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 prg { | |
WIDE="" | |
if [ "$1" == "-w" ] | |
then | |
WIDE="www" | |
shift | |
fi | |
processes=$(pgrep -- "$1") | |
if [ ! -z "${processes}" ] |
OlderNewer