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
include ActionView::Helpers::TagHelper, ActionView::Helpers::TextHelper, WhiteListHelper | |
module ActiveRecord | |
class Base | |
def self.sanitize(attr_name, options = {}) | |
define_method "#{attr_name}=" do |val| | |
write_attribute attr_name, val | |
html = '' |
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 ActiveRecord | |
class Base | |
# FIXME - WE SHOULD NOT PUT THESE INSIDE AR:B | |
include ActionView::Helpers::TagHelper, ActionView::Helpers::TextHelper, WhiteListHelper | |
def self.sanitize(attr_name, options = {}) | |
define_method "#{attr_name}=" do |val| | |
write_attribute attr_name, val | |
html = '' |
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
# by bryan helmkamp with slight modification by chris wanstrath | |
# from http://www.brynary.com/2008/8/3/our-git-deployment-workflow | |
# I DO NOT RECOMMEND USING THIS WORKFLOW - IT DESTROYS HISTORY! - jesse andrews | |
module GitCommands | |
extend self | |
def diff_staging | |
`git fetch` |
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/ruby | |
require 'rubygems' | |
require 'git' | |
log = "~/gitlog.txt" | |
tmp = "/tmp/gitlog" | |
commit = Git.open('.').log.first | |
message = [ | |
commit.date.strftime('%D %H:%M'), |
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 'open-uri' | |
require 'rexml/document' | |
require 'rexml/xpath' | |
url = 'http://rpm.newrelic.com/accounts.xml?include=application_health' | |
headers = {'x-license-key' => 'YOUR LICENSE KEY'} | |
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' | |
links = Hash.new(0) | |
# get 50 pages of results from backtweet | |
(1..50).each do |n| | |
fn = "backtype-#{n}.html" | |
unless File.exist?(fn) |
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 Main (main) where | |
import XMonad | |
import System.Exit | |
import qualified Data.Map as M | |
import Graphics.X11.Xlib | |
import XMonad.Prompt | |
import XMonad.Prompt.Shell | |
import XMonad.Prompt.XMonad | |
import XMonad.Prompt.RunOrRaise |
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 ActiveRecord::Base | |
named_scope :created, lambda { |date_range| | |
case date_range | |
when Range | |
{:conditions => ["date(created_at) in (?)", date_range]} | |
when Date | |
{:conditions => ["date(created_at) = ?", date_range]} | |
else | |
{:conditions => '1=1'} | |
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
AWS::S3::Bucket.create('uso_paranoid') | |
Dir[$uso['paranoid']+'/*/*.json'].each do |fn| | |
next if File.stat(fn).ctime > Time.now() - 5 | |
key = fn[$uso['paranoid'].size+1..-1] | |
puts "sending: #{key}" | |
resp = AWS::S3::S3Object.store(key, open(fn), 'uso_paranoid', | |
:access => :private, |
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
########################################################################### | |
# Slow Perlbal statistics gatherer | |
# - based on Perlbal's Stats module | |
########################################################################### | |
package Perlbal::Plugin::Slow; | |
use strict; | |
use warnings; | |
no warnings qw(deprecated); |
OlderNewer