- most of my new code is on bitbucket
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
This is a perfect use for git... |
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
test |
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
em httpclient | |
POST /messages/create HTTP/1.1 | |
Content-length: 125 | |
Host: localhost:3333 | |
Authorization: Basic cGVuZ3VpbjpwbTMwMDI= | |
User-agent: Ruby EventMachine | |
Content-type: application/x-www-form-urlencoded | |
firefox |
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
# Run: curl https://gist.github.com/raw/719970/locale_diff.rb | ruby - en fi | |
require 'rubygems' | |
require 'yaml' | |
l1 = ARGV[0] | |
l2 = ARGV[1] | |
first = YAML.load_file(l1 + ".yml") | |
second = YAML.load_file(l2 + ".yml") | |
def diff(root, compared, structure = []) |
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
function MorseNode(ac, rate) { | |
// ac is an audio context. | |
this._oscillator = ac.createOscillator(); | |
this._gain = ac.createGain(); | |
this._gain.gain.value = 0; | |
this._oscillator.frequency.value = 750; | |
this._oscillator.connect(this._gain); |
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
caches_action :show => { :ttl => 10.minutes, :if => Proc.new {|c| c.current_user.nil? || !c.current_user.logged_in?} } | |
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
<h1>This is a page with a report on it:</h1> | |
<h2>Long Running Report</h2> | |
<% future_cache("long running report for user #{current_user.id}", {:ttl => 1.day, :callback => current_user.deliver_report_finished_email}) do %> | |
<% render :partial => 'report', :collection => current_user.reports.big %> | |
<% else %> | |
<strong> This report is being generated, you will receive an email when it's complete</strong> | |
<% 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
module RiddleLogger | |
def self.included(base) | |
base.send :include, InstanceMethods | |
base.alias_method_chain :query_message, :logging | |
end | |
module InstanceMethods | |
def query_message_with_logging(search, index, comments = '') |
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
>> r.send(:index_delta) | |
Sphinx 0.9.8-release (r1371) | |
Copyright (c) 2001-2008, Andrew Aksyonoff | |
using config file '/home/mmmurf/hellocreature/config/development.sphinx.conf'... | |
indexing index 'recipient_delta'... | |
collected 9999 docs, 0.3 MB | |
collected 0 attr values | |
sorted 0.0 Mvalues, 100.0% done | |
sorted 0.0 Mhits, 100.0% done |
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
def self.without_updates_and_deltas | |
de, ue = @@deltas_enabled, @@updates_enabled | |
@@deltas_enabled = @@updates_enabled = false | |
yield | |
@@deltas_enabled, @@updates_enabled = de, ue | |
end |
OlderNewer