Skip to content

Instantly share code, notes, and snippets.

View revans's full-sized avatar
🤠
Building Businesses

Robert Evans revans

🤠
Building Businesses
View GitHub Profile
@revans
revans / gist:300764
Created February 10, 2010 19:45 — forked from mattb/gist:25502
$.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);
});
require 'rubygems'
require 'mash'
require 'hashie'
gem 'activesupport', '2.3.5'
require 'active_support'
require "benchmark"
include Benchmark
# 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)
#! /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
#!/bin/sh
#
# init.d script with LSB support.
#
# Copyright (c) 2007 Javier Fernandez-Sanguino <jfs@debian.org>
#
# 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.
#!/bin/bash
switch () {
rvm $1
$(switch_textmate_rvm_version)
local v=$(rvm_version)
echo "Switch to Ruby version: "$v
}
rvm_default () {
#----------------------------------------------------------------------------
# Git Setup
#----------------------------------------------------------------------------
file '.gitignore', <<-FILE
.DS_Store
log/*.log
tmp/**/*
config/database.yml
db/*.sqlite3
public/uploads/*
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)
# Ruby 1.9.2
class Numeric
def second
self * 1
end
alias_method :seconds, :second
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