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
# prevents complicated rewrites from somehow screwing up my RailsBaseURI | |
<IfModule mod_rewrite.c> | |
# RewriteEngine on | |
RewriteCond %{REQUEST_URI} ^/my-uri-prefix* [NC] | |
RewriteRule ^(.*)$ - [L,QSA] | |
</IfModule> | |
<IfModule passenger_module> | |
RailsBaseURI /my-uri-prefix | |
</IfModule> |
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
/* | |
bookmark: javascript:void(function(){var%20urls=['http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js','http://gist.github.com/raw/222540/52236ed6fd9f706c7c1f8c654427b53861f21945/twitter-member-lists.js'];for(n%20in%20urls){var%20s=document.createElement('script');s.src=urls[n];document.getElementsByTagName('head')[0].appendChild(s);}}()) | |
*/ | |
jQuery.getJSON(window.location + "/lists/memberships.json?callback=?", function(json) { | |
var list_names = jQuery.map(json.lists, function(obj) { return obj.name; }); | |
jQuery('h2.thumb').after("<code>" + list_names.join(", ") + "</code>"); | |
}); |
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 on_google_map_ready(callback_fn) { | |
function call_when_found(name, fn) { | |
var x = function() { | |
if (window[name]) { | |
log("FOUND", name); | |
fn(); | |
} else { | |
log("NOT found", name, new Date()); | |
setTimeout(x, 500); | |
} |
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
# wrt http://stackoverflow.com/questions/1066340/how-to-use-long-id-in-rails-applications | |
# and http://rubyforge.org/tracker/index.php?func=detail&aid=24387&group_id=4550&atid=17562 | |
bash$ rake db:migrate | |
(in /Users/choonkeat/test/testbigint) | |
== CreateMessages: migrating ================================================= | |
-- create_table(:messages) | |
-> 0.0966s | |
== CreateMessages: migrated (0.0967s) ======================================== |
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
Choonkeat-Home:trynodejs(master) choonkeat$ cat watch.js | |
sys = require("sys"); | |
process.watchFile("watched_dir", function () { | |
sys.puts("\n[watched_dir changed]") | |
}); | |
process.watchFile("watched_dir/watched_file.txt", function () { | |
sys.puts("\n[watched_file.txt changed]") | |
}); | |
Choonkeat-Home:trynodejs(master) choonkeat$ node watch.js & | |
[1] 79417 |
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/env ruby | |
if ARGV.empty? | |
$stderr.puts <<-EOM | |
ExpressionEngine (1.x) MYSQL DUMP Localizer | |
1. Reads MYSQL DUMP of ExpressionEngine website from STDIN | |
2. Replaces ALL HOSTNAME & PATH data (config) with LOCAL SETTINGS | |
3. Output corrected MYSQL DYMP file. |
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
/* | |
Minimum tinymce config for MS-Word sanity | |
Based on http://tinymce.moxiecode.com/examples/example_05.php | |
*/ | |
tinyMCE.init({ | |
setup : function(ed) { | |
ed.onPostProcess.add(function(ed, o) { | |
if (o.get) { | |
// cleaning up white spaces, remove unnecessary tags | |
// p, span, em should have no attributes (unlike img or a) |
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 | |
# | |
# Display xml/json as pretty json | |
# | |
require 'rubygems' | |
data = ARGV.first ? IO.read(ARGV.shift) : STDIN.read | |
while data | |
begin | |
require 'json' | |
x = JSON.load(data) |
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=$1 | |
to=$2 | |
find . -iname "$from*" | sed "s/$from/\{$from,$to\}/g" | sed 's/^/mv /g' | bash |
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
# Usage: ssh root@server "`cat rambo.puppet`" | |
# | |
# dependencies | |
which yum 2> /dev/null && yum -y install facter puppet # it is that simple | |
which apt-get 2> /dev/null && apt-get -y install wget ruby ruby1.8 libruby1.8 && apt-get -y autoremove | |
which facter && which puppet && exit 0 # proceed if not installed | |
which ruby || exit 1 # abort if without ruby | |
# | |
# let's go | |
mkdir install-puppet |