Skip to content

Instantly share code, notes, and snippets.

View entp's full-sized avatar

ENTP entp

View GitHub Profile
<!-- for some reason this isn't receiving my style! -->
<pee class="tl-body viewsource"><%= foo.bar %></pre>
# /path/to/seinfeld/app/config.ru
require 'rubygems'
require 'rack'
require 'sinatra'
Sinatra::Application.default_options.update(
:run => false,
:env => :production,
# nfi why this is needed, shouldn't it pick up the pwd???
:views => '/path/to/seinfeld/app/views',
module TokenGenerator
@@chars = (('a'..'z').to_a + ('0'..'9').to_a) - %w(i o 0 1 l 0)
@@char_size = @@chars.size
extend self
def generate_simple
(1..8).collect { |a| @@chars[rand(@@char_size)] }.join
end
end
<% @changes.select(&:diffable?).each do |change| -%>
<% begin -%>
<%= diff_for change %>
<% rescue -%>
?
<% end -%>
<% end -%>
# fuck you for judging me! LOL
class << ActiveRecord::Base
def second(options = {})
first(options.update(:offset => 1))
end
def third(options = {})
first(options.update(:offset => 2))
end
end
class << ActiveRecord::Base
def none?(*args)
!exists?(*args)
end
end
module MyApp
class TestCase < Test::Unit::TestCase
def self.transaction(&block)
Sequel::Model.db.transaction &block
end
def transaction(&block)
self.class.transaction(&block)
end
gem 'activesupport', '~> 2.1.1'
gem 'sequel', '~> 2.7'
gem 'activemerchant', '~> 1.4'
%w(array/extract_options hash/keys hash/indifferent_access).each { |lib| require "active_support/core_ext/#{lib}" }
class Array #:nodoc:
include ActiveSupport::CoreExtensions::Array::ExtractOptions
end
class Hash #:nodoc:
module ThinkingSphinx
def self.index_documents_in_testing
ThinkingSphinx::Deltas::Job.cancel_thinking_sphinx_jobs
config = ThinkingSphinx::Configuration.instance
config.build
FileUtils.mkdir_p config.searchd_file_path
cmd = "#{config.bin_path}indexer --config #{config.config_file} --all"
cmd << " --rotate" if ThinkingSphinx.sphinx_running?
~vp(master)> cat ~/.gitconfig
...SNIP...
[alias]
datetag = !git tag `date \"+%Y%m%d%H%M\"`
update = pull --rebase
commdiff = log --pretty=oneline --left-right
...SNIP...
~vp(master)> git commdiff master...staging
>bb569b9a8c70a61ecffd4def3ac5e460848e0f36 Merge branch 'master' into staging
>f95b7db13fb48b3b5e1c2c484d00909a89f468d5 bulk edit on search page is no longer experimental