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 | |
# copy or symlink this file to .git/hooks/ | |
# automatically strip spaces from the end of lines and add newlines to the end of files as necessary | |
filetypes = %w( | |
builder | |
conf | |
css | |
erb | |
haml |
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
class SubCity < ActiveRecord::Base | |
belongs_to :city | |
delegate :map, to: :sub_cities, prefix: true | |
end | |
# later | |
city.sub_cities_map(&: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
delegate :names, to: :sub_cities, prefix: true | |
# undefined method `names' for #<ActiveRecord::Relation> | |
delegate :name, to: :sub_cities, prefix: true | |
# => "SubCity" | |
delegate :name, to: :sub_city, prefix: true | |
delegate :names, to: :sub_city, prefix: true | |
# undefined local variable or method `sub_city' for #<City> |
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
# sub_city.rb | |
class SubCity < ActiveRecord::Base | |
belongs_to :city | |
def sub_cities_names | |
sub_cities.map(&:name) | |
end | |
end | |
# city.rb | |
class City < ActiveRecord::Base |
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
<html> | |
<head> | |
<meta http-equiv="Expires" content="Mon, 01 Jan 1900 00:00:00 GMT"> | |
<meta http-equiv="Pragma" content="no-cache"> | |
<script type='text/javascript'> | |
<!-- | |
if (window.parent != window) { | |
document.location = "http://mail.tapjoy.com/"; | |
} | |
//--> |
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 | |
require 'active_support' | |
gzips = { | |
:java => [31, -117, 8, 0, 0, 0, 0, 0, 0, 0, -77, 41, 74, 45, 44, 77, 45, 46, -79, -77, 41, -120, -49, 76, -79, 51, 50, 48, -78, -80, -47, 7, 51, 109, -118, -13, 75, -117, -110, 83, -29, 75, 42, 11, 82, -19, 12, 108, -12, -111, -71, 54, -6, 48, 109, 0, -21, -40, -25, -121, 64, 0, 0, 0], | |
:ruby => [31, -117, 8, 0, 32, 45, 19, 80, 0, 3, -77, 41, 74, 45, 44, 77, 45, 46, -79, -77, 41, -120, -49, 76, -79, 51, 50, 48, -78, -80, -47, 7, 51, 109, -118, -13, 75, -117, -110, 83, -29, 75, 42, 11, 82, -19, 12, 108, -12, -111, -71, 54, -6, 48, 109, 0, -21, -40, -25, -121, 64, 0, 0, 0], | |
} | |
def formatted_put(text, comment) | |
text = text.join(' ') if text.is_a? Array |
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 | |
require 'rubygems' | |
require 'time' | |
require 'csv' | |
require './hist' | |
votes = {} | |
def old_vote?(votes, name, time) | |
votes[name] && votes[name][:time] > time |
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
# App Version = 2.0; Tell user to upgrade to latest version | |
# Found at: http://hurl.it/hurls/14d678ab1729dbec83529e0e7021f54dcf0f0cc9/23c1b3701e97366d2c389f18a64cb199adbc06e1 | |
$ curl -X post www.kiteboard.me/api/api/call.xml --data app_id=4f73f48b4f15a90001000001\&data[app_version]=2.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
git_info() { | |
# colors | |
local RESET="\033[0m" | |
local GRAY="\033[1;30m" | |
local RED="\033[1;31m" | |
local GREEN="\033[1;32m" | |
local BLUE="\033[1;34m" | |
local PINK="\033[1;35m" | |
local CYAN="\033[1;36m" |
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 | |
files=$(git diff-index --name-status --cached HEAD | grep -v ^D | cut -c3-) | |
if [ "$files" != "" ] | |
then | |
for f in $files | |
do | |
# Only examine known text files | |
if [[ "$f" =~ [.](conf|css|erb|html|haml|scss|css|js|json|log|properties|rb|ru|txt|xml|yml)$ ]] | |
then |