This file contains hidden or 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 | |
unless filename = ARGV.first | |
abort "usage: #{__FILE__} file [http://host] [theme]" | |
end | |
host = ARGV[1] || "http://wp33.dev" | |
theme = ARGV[2] || "twentyten" | |
text = File.read(filename) | |
text.gsub! /'siteurl','.*',/, "'siteurl','#{host}'," |
This file contains hidden or 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 "minitest/autorun" | |
module Enumerable | |
def collect(&block) | |
each_with_object([]) { |i, obj| obj << block.call(i) } | |
end | |
def detect(&block) | |
# each_with_object(nil) { |i, obj| obj ||= block.call(i) ? i : nil } | |
inject(nil) { |obj, i| obj ||= block.call(i) ? i : nil; obj } |
This file contains hidden or 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
# e.g. - "AC 10 01 3D" => "172.16.1.61" | |
def hex2ip(hex) | |
hex.split(" ").map { |i| i.to_i(16) }.join(".") | |
end |
This file contains hidden or 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 "open-uri" | |
require "cgi" | |
require "json" | |
SEARCH_API = URI "http://api.thriftdb.com/api.hnsearch.com/items/_search" | |
START_DATE = "2012-01-01" | |
END_DATE = "2012-12-31" | |
TOP_LIMIT = 10 | |
def get(type, sortby) |
This file contains hidden or 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 PagesController < ApplicationController | |
exposes :weather | |
def index | |
@weather = Rails.cache.fetch "weather", expires_in: 5.minutes do | |
Weather.lookup 68164 | |
end | |
render | |
end |
This file contains hidden or 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
[ext2/1/ext 1 (0,20)] [straight_topics_core`, `infix_topics_core] apple @sphinx_internal_class_name (Topic) |
This file contains hidden or 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
version 5 | |
FIREHOL_LOG_PREFIX="firehol: " | |
interface any world | |
policy drop | |
server "ssh icmp http https" accept | |
client all accept |
This file contains hidden or 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 | |
if remote = `git remote -v`.lines.find { |l| l.match /bitbucket/ } | |
remote.match /(bitbucket\.org\/.*?)\.git/ | |
system "open https://#{$1}" | |
else | |
puts "No BitBucket remote :(" | |
end |
This file contains hidden or 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 "bundler" | |
require_relative "lib/importer" | |
Bundler.setup | |
desc "Import from Trello board" | |
task :import do | |
Importer.new(File.dirname(__FILE__)).import ENV["ISSUE"] | |
end |