Hijacked from Christian Neukirchen's Ruby Style Guide
These are guides, not rules. There are always reasons to not do something, but if you can stay on this road for as long as possible, at least Gus will be happy.
- Use common sense.
- Be consistent.
#!/usr/bin/ruby | |
# encoding: utf-8 | |
# Bitlyize by Brett Terpstra 2014 | |
# Shortens all URLs in input and automatically adds Amazon and iTunes affiliate codes | |
# A single bitly link passed to this script will return the long url | |
# This script was designed for use in an OS X System Service, but runs | |
# as a CLI and can be included as a Ruby library in other scripts | |
# | |
# The bitly_username and bitly_key variables are required | |
# Optionally configure the custom domain, and itunes and amazon affiliate variables |
// look ma, no jquery | |
// assuming that you have | |
// <a data-komments-permalink="/foobar">comments count goes here</a> | |
// somewhere in your HTML | |
function _kmtsLoaded(){ | |
var links = [].slice.apply(document.querySelectorAll("a[data-komments-permalink]")); | |
links.forEach(function(link){ |
# https://github.com/sporkmonger/addressable/ | |
require 'addressable/template' | |
# http://dev.twitter.com/doc/get/statuses/followers | |
template = Addressable::Template.new 'http://{host=twitter.com}' + | |
'/statuses/followers{-prefix|/|id}.{format=json}' + | |
'?{-join|&|user_id,screen_name,cursor}' | |
template.expand(:id => 'mislav') | |
# => http://twitter.com/statuses/followers/mislav.json? |
Hijacked from Christian Neukirchen's Ruby Style Guide
These are guides, not rules. There are always reasons to not do something, but if you can stay on this road for as long as possible, at least Gus will be happy.
// Based on http://snipt.net/boriscy/datetime-jquery-formtastic/ | |
$.tools.dateinput.localize("ja", { | |
months: '1月,2月,3月,4月,5月,6月,7月,8月,9月,10月,11月,12月', | |
shortMonths: '1月,2月,3月,4月,5月,6月,7月,8月,9月,10月,11月,12月', | |
days: '日曜日,月曜日,火曜日,水曜日,木曜日,金曜日,土曜日', | |
shortDays: '日,月,火,水,木,金,土' | |
}); | |
$.tools.dateinput.conf.format = 'yyyy-mm-dd'; |
$(function() { | |
$('div.content').live('showoff:show', function(evt) { | |
var bg_img = $('img[alt=background]', evt.target); | |
var old_bg = ''; | |
if (bg_img.size() > 0) { | |
var src = bg_img.attr('src'); | |
bg_img.hide(); | |
// Set new background on body | |
old_bg = $('body').css('background-image'); | |
$('body') |
function __git_dirty { | |
git diff --quiet HEAD &>/dev/null | |
[ $? == 1 ] && echo "!" | |
} | |
function __git_branch { | |
__git_ps1 "(%s)" | |
} | |
function __my_rvm_ruby_version { |
/* | |
As of version 1.1.2, Propane will load and execute the contents of | |
~Library/Application Support/Propane/unsupported/caveatPatchor.js | |
immediately following the execution of its own enhancer.js file. | |
You can use this mechanism to add your own customizations to Campfire | |
in Propane. | |
Below you'll find two customization examples. |
require 'net/dns/resolver' | |
# Custom Domain | |
# | |
# Require net-dns gem | |
# | |
# A Rack middleware to to resolve the custom domain to original subdomain | |
# for your multi telent application. | |
# | |
# It's all transperant to your application, it performs cname lookup and |