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 'daemons' | |
dir = File.expand_path(File.join(File.dirname(__FILE__), '..')) | |
daemon_options = { | |
:multiple => false, | |
:dir_mode => :normal, | |
:dir => File.join(dir, 'tmp', 'pids'), | |
:backtrace => true |
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 | |
# -*- ruby -*- | |
require 'rubygems' | |
require 'daemon_spawn' | |
RAILS_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')) | |
class DelayedJobWorker < DaemonSpawn::Base | |
def start(args) | |
ENV['RAILS_ENV'] ||= args.first || 'development' |
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
# Simple script to send you email when someone unfollows you on twitter. | |
# | |
# Replace email on line 24 with the email you want to receive notifications at, and | |
# twitter handle on line 23 with your own (or whomever you want to track unfollows for). | |
# | |
# Set up a crontab to check however often you like. If someone follows and then unfollows you | |
# very quickly (within the interval), you won't get an email. | |
# | |
# Requires that you can send mail from the command line of the environment where | |
# you're running the script using mailx, e.g. `echo "body" | mailx -s "subject" foo@bar.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/perl -w | |
use strict; | |
use Plack::Builder; | |
use Plack::Request; | |
use Plack::Response; | |
use Text::MicroTemplate qw( render_mt ); | |
use WWW::TypePad; | |
# These should be set to the Consumer Key and Consumer Secret |
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
// Handles JavaScript history management and callbacks. To use, register a | |
// regexp that matches the history hash with its corresponding callback. | |
dc.history = { | |
// The interval at which the window location is polled. | |
URL_CHECK_INTERVAL : 500, | |
// We need to use an iFrame to save history if we're in an old version of IE. | |
USE_IFRAME : jQuery.browser.msie && jQuery.browser.version < 8, |
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 'oauth_util.rb' | |
require 'net/http' | |
o = OauthUtil.new | |
o.consumer_key = 'examplek9SGJUTUpocjZ5QjBJmQ9WVdrOVVFNHdSR2x1TkhFbWNHbzlNQS0tJnM9Y29uc3VtkZXJzZWNyZXQmeD0yYg--'; | |
o.consumer_secret = 'exampled88d4109c63e778dsadcdd5c1875814977'; | |
url = 'http://query.yahooapis.com/v1/yql?q=select%20*%20from%20social.updates.search%20where%20query%3D%22search%20terms%22&diagnostics=true'; |
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
// Highly experimental async google ads. | |
propublica.views.googleAds = propublica.Deferrable.extend({ | |
cssClass: "ad", | |
init : function(){ | |
this._super(); | |
}, | |
render : function(){ | |
// Add google attributes | |
var accepted = "author,scope,project,type".split(","); |
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
javascripts | |
|____app | |
| |____app.js | |
| |____models | |
| | |____article_content.js | |
| | |____ee_cookie.js | |
| | |____page_cookie.js | |
| | |____tracking_cookie.js | |
| |____views | |
| | |____beacons |
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 Stat < ActiveRecord::Base | |
validates_presence_of :url, :hits | |
validate_on_create :log_hits? | |
validate :url_format | |
named_scope :aggregate, :order => "hits DESC", :select => ["sum(hits) as hits, url, title"], :group => :url | |
def title | |
t = read_attribute(:title) | |
if t.nil? | |
begin |
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
backend app1 { | |
.host = "1.1.1.1"; | |
.port = "80"; | |
} | |
backend app2 { | |
.host = "2.2.2.2"; | |
.port = "80"; | |
} |
OlderNewer