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
# blog post: http://blog.slashpoundbang.com/post/2605632137/changing-from-utc-offset-to-time-zone-identifier-in | |
identifier = { | |
-11 => 'Samoa',#International Date Line West, Midway Island | |
-10 => 'Hawaii', | |
-9 => 'Alaska', | |
-8 => 'Pacific Time (US & Canada)',#Tijuana | |
-7 => 'Mountain Time (US & Canada)',#Arizona, Chihuahua, Mazatlan | |
-6 => 'Central Time (US & Canada)',#Central America, Guadalajara, Mexico City, Monterrey, Saskatchewan | |
-5 => 'Eastern Time (US & Canada)',#Bogota, Indiana (East), Lima, Quito |
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
# blog post: http://blog.slashpoundbang.com/post/2613268281/changing-from-tz-database-identifiers-to-rails-friendly | |
{ | |
"Australia/Adelaide" => "Adelaide", | |
"Australia/Broken_Hill" => "Adelaide", | |
"America/Anchorage" => "Alaska", | |
"America/Juneau" => "Alaska", | |
"America/Nome" => "Alaska", | |
"America/Yakutat" => "Alaska", | |
"Pacific/Gambier" => "Alaska", | |
"Asia/Almaty" => "Almaty", |
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
# blog post: http://blog.slashpoundbang.com/post/2592867566/disqus-the-missing-manual | |
require 'net/http' | |
require 'open-uri' | |
# The list of files to download | |
files = { | |
# used in production | |
'build' => { | |
# Disqus translations |
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
blog post: http://blog.slashpoundbang.com/post/2592867566/disqus-the-missing-manual | |
http://mediacdn.disqus.com/1295633860/build/lang/ar.js | |
http://mediacdn.disqus.com/1295633860/build/lang/af.js | |
http://mediacdn.disqus.com/1295633860/build/lang/bg.js | |
http://mediacdn.disqus.com/1295633860/build/lang/zh.js | |
http://mediacdn.disqus.com/1295633860/build/lang/zh_HANT.js | |
http://mediacdn.disqus.com/1295633860/build/lang/cs.js | |
http://mediacdn.disqus.com/1295633860/build/lang/da.js | |
http://mediacdn.disqus.com/1295633860/build/lang/nl.js |
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
# blog post: http://blog.slashpoundbang.com/post/3230523402/use-the-dokdok-api-from-ruby | |
require 'base64' | |
require 'openssl' | |
require 'httparty' | |
class DokDok | |
include HTTParty | |
base_uri 'api.dokdok.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
# blog post: http://blog.slashpoundbang.com/post/3385815540/how-to-generate-an-opml-file-with-ruby | |
require 'open-uri' | |
require 'builder' | |
require 'truffle-hog' | |
require 'nokogiri' | |
# CHANGE ME | |
urls = %w(http://example.com/ http://example.org/) |
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
# snippet from HackMTL 2010 | |
require 'httparty' | |
YELLOW_API_KEY = 'demo' | |
class String | |
# Transliterates French accents | |
def transliterate | |
{ /[àâ]/ => 'a', |
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
# snippet from HackMTL 2010 | |
require 'httparty' | |
OPEN_CALAIS_KEY = 'demo' | |
class Calais | |
include HTTParty | |
base_uri 'api.opencalais.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
// blog post: http://blog.slashpoundbang.com/post/4047203519/mixins-for-underscore-js | |
_.mixin({ | |
// @param array obj An array of two-element arrays, where the first element is | |
// the key and the second element is the value. | |
// @returns object A JavaScript object declaring key-value pairs. | |
toObj: function (obj) { | |
return _.reduce(obj, function (memo, array) { | |
memo[array[0]] = array[1]; | |
return memo; |
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
# blog post: http://blog.slashpoundbang.com/post/6087617126/how-to-add-yourself-to-your-own-twitter-list | |
#!/usr/bin/env ruby | |
require 'twitter' | |
# Replace the four strings below with your own values. | |
Twitter.configure do |config| | |
config.consumer_key = 'CONSUMER_KEY' | |
config.consumer_secret = 'CONSUMER_SECRET' | |
config.oauth_token = 'OAUTH_TOKEN' | |
config.oauth_token_secret = 'OAUTH_TOKEN_SECRET' |