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/sh | |
# | |
# In your git repo: | |
# 1. save this file as: .git/hooks/pre-commit | |
# 2. chmod 755 .git/hooks/pre-commit | |
# | |
# An hook script to normalize what is about to be committed. | |
# Called by "git commit" with no arguments. | |
# Removes trailing whitespace if it exists from files. | |
# Replaces multiple blank lines with single blank line in files. |
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
require 'rubygems' | |
require 'hpricot' | |
require 'open-uri' | |
require 'activesupport' | |
require 'morph' | |
Hpricot.buffer_size = 2621444 | |
@@step_off = 1 | |
def open_doc url |
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
require 'rubygems'; require 'pottery'; require 'mechanize'; require 'hpricot'; require 'open-uri'; require 'active_support' | |
class SoulMate | |
include Pottery | |
class << self | |
def find age='29', postcode='N1' | |
ids = find_ids age.to_s, postcode | |
ids.collect do |id| | |
soul_mate = restore(id.to_s) | |
unless soul_mate | |
begin |
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
if ARGV.empty? | |
puts 'usage: ruby setup_project.rb [project_name] [git_user]' | |
return | |
end | |
require 'fileutils' | |
project = ARGV[0] | |
git_user = ARGV.size > 1 ? ARGV[1] : 'default_user_name' | |
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
if ARGV.empty? | |
puts 'usage: ruby setup_project.rb [project_name] [git_user]' | |
return | |
end | |
def cmd text | |
puts text | |
result = `#{text}` | |
puts result | |
result |
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
file 'Gemfile', %{ | |
# directory "vendor/rails", :glob => "{*/,}*.gemspec" | |
# git "git://github.com/rails/arel.git" | |
# git "git://github.com/rails/rack.git" | |
clear_sources | |
bundle_path "vendor/bundler_gems" | |
source 'http://gemcutter.org' | |
source 'http://gems.github.com' | |
disable_system_gems |
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
module Wikipedia | |
class Client | |
# see http://en.wikipedia.org/w/api.php | |
BASE_URL = "http://:domain/:path?action=:action&format=json" | |
attr_accessor :follow_redirects | |
def initialize | |
self.follow_redirects = true | |
end |
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
{"orientation":"horizontal","item":[{"label":"7% logged in at least once","sublabel":"users created from 2015-10-01","axis":{"point":[0,20,40,60,80,100]},"range":{"red":{"start":0,"end":20},"amber":{"start":21,"end":80},"green":{"start":81,"end":100}},"measure":{"current":{"start":0,"end":7},"projected":{"start":0,"end":0}},"comparative":{"point":0}},{"label":"0% of acquired users completed \u003e 80%","sublabel":"users created from 2015-10-01","axis":{"point":[0,20,40,60,80,100]},"range":{"red":{"start":0,"end":20},"amber":{"start":21,"end":80},"green":{"start":81,"end":100}},"measure":{"current":{"start":0,"end":0},"projected":{"start":0,"end":0}},"comparative":{"point":0}}]} |
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
<?xml version='1.0' encoding='UTF-8'?> <kml xmlns='http://www.opengis.net/kml/2.2'> <Document><Placemark><name>Albstadt</name> <Point> <coordinates>9.02131,48.2131</coordinates> </Point> </Placemark><Placemark><name>Ansbach</name> <Point> <coordinates>10.55753,49.31221</coordinates> </Point> </Placemark><Placemark><name>Aschaffenburg</name> <Point> <coordinates>9.11325,49.97952</coordinates> </Point> </Placemark><Placemark><name>Augsburg</name> <Point> <coordinates>10.88681,48.35421</coordinates> </Point> </Placemark><Placemark><name>Aken</name> <Point> <coordinates>12.03793,51.85043</coordinates> </Point> </Placemark><Placemark><name>Bayreuth</name> <Point> <coordinates>11.569,49.95091</coordinates> </Point> </Placemark><Placemark><name>Berlin-Biesdorf</name> <Point> <coordinates>13.54106,52.51607</coordinates> </Point> </Placemark><Placemark><name>Bielefeld</name> <Point> <coordinates>8.55198,52.0509</coordinates> </Point> </Placemark><Placemark><name>Bochum</name> <Point> <coordinates>7.28218,51.49559</coo |
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
quote do: String.downcase("THIS") | |
# {{:., [], [{:__aliases__, [alias: false], [:String]}, :downcase]}, [], ["THIS"]} | |
quote do: String.downcase("THIS") |> inspect | |
# {:|>, [context: Elixir, import: Kernel], | |
# [{{:., [], [{:__aliases__, [alias: false], [:String]}, :downcase]}, [], | |
# ["THIS"]}, {:inspect, [], Elixir}]} | |
(quote do: String.downcase("THIS")) |> inspect | |
# "{{:., [], [{:__aliases__, [alias: false], [:String]}, :downcase]}, [], [\"THIS\"]}" |
OlderNewer