Skip to content

Instantly share code, notes, and snippets.

View stan's full-sized avatar
💭
¯\_(ツ)_/¯

stan

💭
¯\_(ツ)_/¯
View GitHub Profile
@stan
stan / url_dsl.rb
Created December 15, 2009 01:50 — forked from defunkt/url_dsl.rb
require 'open-uri'
# url dsl -- the ultimate url dsl!
#
# You just can't beat this:
#
# $ irb -r url_dsl
# >> include URLDSL
# => Object
# >> http://github.com/defunkt.json
@stan
stan / remote.py
Created December 27, 2009 18:09 — forked from aht/remote.py
#!/usr/bin/env python
import getpass
import os
import sys
## Application specific
SDK_DIR = '/usr/local/google_appengine'
APP_DIR = '/home/username/src/app'
APPID = 'something-awesome'
@stan
stan / license
Created January 27, 2010 10:29 — forked from defunkt/license
#!/bin/sh -e
# Usage: license
# Prints an MIT license appropriate for totin' around.
#
# $ license > COPYING
year=`date "+%Y"`
cat <<EOF
Copyright (c) $year Chris Wanstrath
Permission is hereby granted, free of charge, to any person obtaining
@stan
stan / Gemfile
Created January 27, 2010 10:30 — forked from rmanalan/.gems
gem 'rack-contrib', :git => 'git://github.com/rack/rack-contrib.git'
gem 'rack-rewrite'
@stan
stan / README.md
Created January 29, 2010 05:08 — forked from ucnv/README.md

This script is also available at .

## solving Railscast #190 with "Scraper"
## http://github.com/mislav/scraper
## http://railscasts.com/episodes/190-screen-scraping-with-nokogiri
require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'scraper'
class Walmart < Scraper
# Run rake db:size to get a print of your database size in bytes.
# Run rake db:tables:size to get the sizes for individual tables
# Works for MySQL and PostgreSQL. Not tested elsewhere.
namespace :db do
desc 'Print data size for entire database'
task :size => :environment do
database_name = ActiveRecord::Base.connection.instance_variable_get("@config")[:database]
adapter = ActiveRecord::Base.connection.adapter_name.downcase
# Recursively add a .gitignore file to all directories
# in the working directory which are empty and don't
# start with a dot. Helpful for tracking empty dirs
# in a git repository.
for i in $(find . -type d -regex ``./[^.].*'' -empty); do touch $i"/.gitignore"; done;
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.swig505.redis</string>
<key>Program</key>
<string>/usr/local/redis/redis-server</string>
<key>ProgramArguments</key>
<array>
// once the google maps is loaded, put a Raphael canvas on top of it
// be sure to apply margin:0 to the body in this case
var point = new GLatLng(46.065375, 5.448974);
var pixel = map.fromLatLngToContainerPixel(point);
var paper = Raphael(0, 0, 400, 300);
var circle = paper.circle(pixel.x, pixel.y, 10);
circle.attr("fill", "#f00");
circle.attr("stroke", "#fff");