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 "set" | |
module RakeTask | |
CALLED = Set.new | |
NAMESPACES = [] | |
TASKS = Hash.new { |h, k| h[k] = Struct.new(:blocks, :deps).new([], []) } | |
def self.call(name) | |
return if CALLED.include?(name) | |
raise "Unknown task: #{name.inspect}" unless TASKS.key?(name) |
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
/** * @author chuck */ | |
Tumblr = { | |
addUsername: function(username) { Application.prefs.setValue('tumblr_user_username', username); }, | |
addPassword: function(password) { Application.prefs.setValue('tumblr_user_password', password); }, | |
addGroup: function(group) { Application.prefs.setValue('tumblr_group', group); }, | |
getUsername: function() { return Application.prefs.get('tumblr_user_username').value; }, | |
getPassword: function() { return Application.prefs.get('tumblr_user_password').value; }, | |
getGroup: function() { return Application.prefs.get('tumblr_group').value; }, | |
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
## Concerned With by Rick Olson | |
class << ActiveRecord::Base | |
def concerned_with(*concerns) | |
concerns.each do |concern| | |
require_dependency "#{name.underscore}/#{concern}" | |
end | |
end | |
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
require 'blather/client' | |
class Echo < Blather::Client | |
def receive_message(msg) | |
send_data msg.reply! if msg.type == :chat | |
end | |
end | |
Blather.run 'echo@jabber.local', 'echo', Echo.new |
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 | |
$:.unshift File.join(File.dirname(__FILE__), %w[.. lib]) | |
require 'blather/client' | |
if ARGV.length != 2 | |
puts "Run with ./echo.rb user@server/resource password" | |
exit 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
class Foo | |
def bar | |
end | |
private | |
def baz | |
end | |
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
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "☠" | |
} | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" | |
} | |
function proml { | |
local BLUE="\[\033[0;34m\]" | |
local RED="\[\033[0;31m\]" |
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($) { | |
$.fn.tweet = function(o){ | |
var s = { | |
username: ["seaofclouds"], // [string] required, unless you want to display our tweets. :) it can be an array, just do ["username1","username2","etc"] | |
avatar_size: null, // [integer] height and width of avatar if displayed (48px max) | |
count: 3, // [integer] how many tweets to display? | |
intro_text: null, // [string] do you want text BEFORE your your tweets? | |
outro_text: null, // [string] do you want text AFTER your tweets? | |
join_text: null, // [string] optional text in between date and tweet, try setting to "auto" |
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
# using active record you can easily hit this common performance issue | |
# | |
class Parent | |
has_many :children | |
end | |
class Child | |
belongs_to :parent | |
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
class ImageModelsController < ApplicationController | |
before_filter :find_image_model, :only => [:update] | |
def update | |
if @image_model.update_attributes(params[:image_model]) | |
@image_model.image.reprocess! | |
end | |
end | |
protected |
OlderNewer