This file contains hidden or 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
$.getJSON('http://api.flickr.com/services/rest/?method=flickr.places.getInfo&api_key=get_your_own&woe_id=44418&format=json&jsoncallback=?', function(data) { | |
if(data.place.has_shapedata == 1) { | |
var bounds = new GLatLngBounds(); | |
$.each(data.place.shapedata.polylines.polyline, function(index,polyline) { | |
thepoints = []; | |
$.each(polyline._content.split(/ /), function(pindex, point) { | |
lat = parseFloat(point.split(/,/)[0]); | |
lng = parseFloat(point.split(/,/)[1]); | |
thepoints[pindex] = new GLatLng(lat, lng); | |
}); |
This file contains hidden or 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 'rubygems' | |
require 'mash' | |
require 'hashie' | |
gem 'activesupport', '2.3.5' | |
require 'active_support' | |
require "benchmark" | |
include Benchmark |
This file contains hidden or 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
# Profile | |
result = RubyProf.profile do | |
Twitter::API::User.show('revans') | |
end | |
# Print a graph profile to text | |
printer = RubyProf::GraphHtmlPrinter.new(result) | |
printer.print(File.open(File.join(File.dirname(__FILE__), 'benchmarks/marks.html'), 'w+'), :min_percent=>0) |
This file contains hidden or 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 | |
### BEGIN INIT INFO | |
# Provides: mongodb | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the mongodb data-store | |
# Description: starts mongodb using start-stop-daemon |
This file contains hidden or 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 | |
# | |
# init.d script with LSB support. | |
# | |
# Copyright (c) 2007 Javier Fernandez-Sanguino <[email protected]> | |
# | |
# This is free software; you may redistribute it and/or modify | |
# it under the terms of the GNU General Public License as | |
# published by the Free Software Foundation; either version 2, | |
# or (at your option) any later version. |
This file contains hidden or 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 | |
switch () { | |
rvm $1 | |
$(switch_textmate_rvm_version) | |
local v=$(rvm_version) | |
echo "Switch to Ruby version: "$v | |
} | |
rvm_default () { |
This file contains hidden or 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
#---------------------------------------------------------------------------- | |
# Git Setup | |
#---------------------------------------------------------------------------- | |
file '.gitignore', <<-FILE | |
.DS_Store | |
log/*.log | |
tmp/**/* | |
config/database.yml | |
db/*.sqlite3 | |
public/uploads/* |
This file contains hidden or 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
class GemBackup | |
class << self | |
def to_file(dir) | |
File.open(File.join(dir, 'gem_list_backup.txt'), 'w') { |f| f << `gem list` } | |
end | |
def install(file) | |
@gems = File.read(file) |
This file contains hidden or 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
# Ruby 1.9.2 | |
class Numeric | |
def second | |
self * 1 | |
end | |
alias_method :seconds, :second | |
This file contains hidden or 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 rails_jquery { | |
curl -o public/javascripts/rails.js http://github.com/rails/jquery-ujs/raw/master/src/rails.js | |
} | |
function jquery_install { | |
curl -o public/javascripts/jquery.js http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js | |
} | |
function jquery_ui_install { | |
curl -o public/javascripts/jquery_ui.js http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js |