Skip to content

Instantly share code, notes, and snippets.

View jamesmoriarty's full-sized avatar
🔮
0xc0000005

James Moriarty jamesmoriarty

🔮
0xc0000005
View GitHub Profile
@bguthrie
bguthrie / libxml_active_resource.rb
Created January 31, 2009 23:28
A patch for ActiveResource that allows it to use LibXML to parse documents. Use to speed up ARes.
require 'libxml'
module LibXML
module XML
module Conversions
module Document
def to_hash
root.to_hash
end
end
# an example Monit configuration file for collectiveidea's fork of delayed_job.
# See: http://stackoverflow.com/questions/1226302/how-to-monitor-delayedjob-with-monit/1285611
#
# To use:
# 1. replace {app_name} and {environment} as appropriate
# 2. copy to your repository under config/delayed_job.monitrc
# 3. add this to your /etc/monit/monitrc:
#
# include /var/www/apps/{app_name}/current/config/*.monitrc
# 4. reload monit when you deploy to pick up any changes to your monitrc files: sudo monit reload
@jarib
jarib / file.rb
Created January 19, 2010 11:13
FFI wrapper for CreateProcess()
require "rubygems"
require "ffi"
module WinProcess
extend FFI::Library
ffi_lib "kernel32"
ffi_convention :stdcall
class Error < StandardError
#!/custom/ree/bin/ruby
# USAGE:
#
# echo "|/path/to/core_helper.rb %p %s %u %g" > /proc/sys/kernel/core_pattern
#
require 'etc'
require 'net/smtp'
From 36f25bf11b9e61b6361c829534dea2de0cf08acd Mon Sep 17 00:00:00 2001
From: Chris Hapgood <cch1@hapgoods.com>
Date: Mon, 11 Oct 2010 09:42:05 -0400
Subject: [PATCH] Let respond_to do the heavy action cache lifting
In determining the best content type for a response, let respond_to consider
available content types using existing logic. Work hard to ensure that
cached content has an extension to indicate its content type.
---
.../lib/action_controller/caching/actions.rb | 73 ++++++++++----------
@tpope
tpope / .gitattributes
Created October 24, 2010 20:38
Fewer conflicts in your Rails apps
Gemfile.lock merge=bundlelock
db/schema.rb merge=railsschema
@jjb
jjb / gist:950975
Created May 1, 2011 23:16
Using whenever with capistrano and bundler in multiple environments
We couldn’t find that file to show.
@erichurst
erichurst / database.yml.example mysql2
Created May 9, 2011 02:58
Rails 3 database.yml examples
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8
@bradleypriest
bradleypriest / arel_scopes.rb
Created September 18, 2011 08:27
Arel Scopes
module ArelScopes
extend ActiveSupport::Concern
module ClassMethods
# Create chainable arel scopes
# Example:
# class Post
# arel_scope :published, lambda { arel_table[:published_at].gteq(Time.now) }
# arel_scope :written_by, lambda { |user| arel_table[:author_id].eq(user.id) }
@chitchcock
chitchcock / 20111011_SteveYeggeGooglePlatformRant.md
Created October 12, 2011 15:53
Stevey's Google Platforms Rant

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real