Skip to content

Instantly share code, notes, and snippets.

View jsmestad's full-sized avatar
👾

Justin Smestad jsmestad

👾
View GitHub Profile
@mnutt
mnutt / Instrument Anything in Rails 3.md
Created September 6, 2010 06:50
How to use Rails 3.0's new notification system to inject custom log events

Instrument Anything in Rails 3

With Rails 3.0 released a few weeks ago I've migrated a few apps and I'm constantly finding useful new improvements. One such improvement is the ability to log anything in the same way that Rails internally logs ActiveRecord and ActionView. By default Rails 3 logs look slightly spiffier than those produced by Rails 2.3: (notice the second line has been cleaned up)

Started GET "/" for 127.0.0.1 at Mon Sep 06 01:07:11 -0400 2010
  Processing by HomeController#index as HTML
  User Load (0.2ms)  SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1
  CACHE (0.0ms)  SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1

Rendered layouts/_nav.html.erb (363.4ms)

node['filesystem']['/dev/disk0s2']['percent_used'] =~ /^(\d+)%$/
percent_used = $1.to_i
if percent_used > 90
include_recipe "raid::grow"
end
@jacob414
jacob414 / backbone-tutorial.js
Created November 18, 2010 12:54
Minimal example of data handling in Backbone.js
/* Scaled-down Backbone.js demonstration
* By Jacob Oscarson (http://twitter.com/jacob414), 2010
* MIT Licenced, see http://www.opensource.org/licenses/mit-license.php */
$(function() {
window.ulog = function(msg) { $('#log').append($('<div>'+msg+'</div>')); }
// Faking a little bit of Backbone.sync functionallity
Backbone.sync = function(method, model, succeeded) {
ulog('<strong>'+method + ":</strong> " + model.get('label'));
if(typeof model.cid != 'undefined') {
!app_name
*.info -/var/log/app_name/rails.log
& @<%= log_server_ip %>
& ~
@jacquescrocker
jacquescrocker / assets.yml
Created December 5, 2010 02:36
my barista config
# config/assets.yml
# I include these assets in my layout via jammit's helpers
# include_javascripts :all
# include_stylesheets :all
# learn more about jammit here: http://documentcloud.github.com/jammit/
compress_assets: off
package_path: "assets-compiled"
@tmm1
tmm1 / README.md
Created February 10, 2011 05:33
no longer requires any proxies! just replace your enhancers.js. also see https://gist.github.com/821736
@funny-falcon
funny-falcon / patch-1.9.2-gc.patch
Created March 5, 2011 11:11
GC tunning simple patch ruby 1.9.2 p180
diff --git a/gc.c b/gc.c
--- a/gc.c
+++ b/gc.c
@@ -77,6 +77,41 @@ void *alloca ();
#ifndef GC_MALLOC_LIMIT
#define GC_MALLOC_LIMIT 8000000
#endif
+#define HEAP_MIN_SLOTS 10000
+#define FREE_MIN 4096
+
@shinzui
shinzui / tmux.conf
Created March 12, 2011 01:08 — forked from bryanl/tmux.conf
tmux.conf
# ~/.tmux.conf
#
# See the following files:
#
# /opt/local/share/doc/tmux/t-williams.conf
# /opt/local/share/doc/tmux/screen-keys.conf
# /opt/local/share/doc/tmux/vim-keys.conf
#
# URLs to read:
#
bash -c '
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
yum install -q -y sudo gcc gcc-c++ automake autoconf make readline-devel.x86_64 libffi-devel.x86_64 libyaml-devel.x86_64 zlib-devel.x86_64 openssl-devel.x86_64 wget
# This may not be necessary for you
yum remove -q -y ruby-libs ec2-ami-tools
wget http://someurl.domain.com/ruby-1.9.2p180_x86_64.rpm -O /tmp/ruby-1.9.2p180_x86_64.rpm
yum localinstall --nogpgcheck -q -y /tmp/ruby-1.9.2p180_x86_64.rpm
@mrrooijen
mrrooijen / gist:913056
Created April 11, 2011 04:27
My Heroku Asset Packager setup
# Gemfile
gem 'jammit-s3', :git => 'git://github.com/meskyanichi/jammit-s3.git'
# config/assets.yml
s3_bucket: mybucket
s3_access_key_id: <%= ENV['AWS_ACCESS_KEY_ID'] %>
s3_secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %>
s3_permission: public_read
embed_assets: on