Skip to content

Instantly share code, notes, and snippets.

View technoweenie's full-sized avatar
👾
beep boop

technoweenie

👾
beep boop
View GitHub Profile
# access these directory shortcuts
# with ~rails, ~beast, etc
p=~/p
w=~/w
rails=~/p/rails/git
todo=~/Documents/todo
# Input stuff.
bindkey -e
class Status < ActiveRecord::Base
can_search do
scoped_by :user
scoped_by :created, :scope => :date_range
end
# user_id can be an integer or nil
def self.filter(user_id, filter, options = {})
# filter can be :daily, :monthly, etc,
# see DateRangeScope in can_serach plugin
diff --git a/vendor/plugins/thinking-sphinx/lib/thinking_sphinx/active_record/delta.rb b/vendor/plugins/thinking-sphinx/lib/thinking_sphinx/active_record/delta.rb
index 88da2bd..20c4570 100644
--- a/vendor/plugins/thinking-sphinx/lib/thinking_sphinx/active_record/delta.rb
+++ b/vendor/plugins/thinking-sphinx/lib/thinking_sphinx/active_record/delta.rb
@@ -85,7 +85,9 @@ module ThinkingSphinx
{self.id => 1}
) if self.in_core_index?
- system "indexer --config #{config.config_file} --rotate #{self.class.indexes.first.name}_delta"
+ cmd = "indexer --config #{config.config_file} --rotate #{self.class.indexes.first.name}_delta"
@technoweenie
technoweenie / gist:9345
Created September 8, 2008 00:15 — forked from kneath/gist:9337
// Beginning of a Ubiquty script for use with xtt
CmdUtils.CreateCommand({
name: "xtt",
takes: {status: noun_arb_text},
preview: function(previewBlock, statusText) {
var previewTemplate = "Updates your XTT status to: <br/>" +
"<b>${status}</b><br /><br />";
var previewData = {
/*
=============
ai_walk
The monster is walking it's beat
=============
*/
void ai_walk (edict_t *self, float dist)
{
M_MoveToGoal (self, dist);
def nuke_terminator(pid)
Process.kill("KILL", pid) rescue nil
Process.wait(pid) rescue nil
end
# OR
def nuke_terminator(pid)
Process.kill("KILL", pid)
Process.wait(pid)
>> class Oo
>> def O *args
>> raise *args
>> end
>> end
=> nil
>> class Object
>> def o
>> Oo.new
>> end
task :write_memcache_config, :roles => :app, :except => {:no_release => true, :no_symlink => true} do
get("#{shared_path}/config/memcached.yml.tmpl", 'memcached.yml.tmpl')
template = IO.read "memcached.yml.tmpl"
File.unlink "memcached.yml.tmpl"
put template.sub(/%NAMESPACE%/, "lh#{File.basename latest_release}"), "#{release_path}/config/memcached.yml", :mode => 0644
end
task :lh_custom, :roles => :app, :except => {:no_release => true, :no_symlink => true} do
write_memcache_config
# other custom crap
class ActiveRecord::Base
@@cache_store = nil
def self.cache_store
@@cache_store ||= ActionController::Base.cache_store
end
def self.caches(method_name, key = nil, options = {}, &block)
if key.is_a?(Hash)
options = key
key = nil
class << Addressable::URI
# ActionController::Routing passes an unsafe char regex to URI.escape. However,
# Addressable::URI.escape has the correct unsafe char regexes for each url part.
def escape(uri, whatever)
encode(uri)
end
end