Skip to content

Instantly share code, notes, and snippets.

View denmarkin's full-sized avatar

Den Markin denmarkin

  • Rev.com, Inc
  • Carlsbad, CA
View GitHub Profile
@denmarkin
denmarkin / _ahah_render.php
Created December 24, 2010 21:31
Extended version of http://www.nicklewis.org/node/967 recipe for partial nested form update
// Lastly, here's a help function pulled from Nick Lewis's blog to alter the form
// see: http://www.nicklewis.org/node/967
// Nested fields are implemented by denmarkin.
// Usage example: $output .= _ahah_render($form, array('block_settings', 'module_block_'.$delta, 'custom_fields'));
function _ahah_render($fields, $name) {
$form_state = array('submitted' => FALSE);
$form_build_id = $_POST['form_build_id'];
// Add the new element to the stored form. Without adding the element to the
@denmarkin
denmarkin / deploy.rb
Created January 9, 2011 13:52
Example capistrano receipe with bells and whistles. See for details/supported features: http://denmarkin.tumblr.com/post/2667677553/capistrano-receipe-with-bells-and-wistles
set :application, "myapp"
# github stuff
set :repository, "git@github.com:exampleAcc/myapp.git"
set :scm, :git
set :scm_username, "github_id"
set :scm_passphrase, "github_password"
set :branch, "dev"
set :git_enable_submodules, 1
!!! 5
/[if lt IE 7] <html lang="en" class="no-js ie6">
/[if IE 7 ] <html lang="en" class="no-js ie7">
/[if IE 8 ] <html lang="en" class="no-js ie8">
/[if IE 9 ] <html lang="en" class="no-js ie9">
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
%head
%meta{:charset => "utf-8"}/
/
Always force latest IE rendering engine (even in intranet) &amp; Chrome Frame
@denmarkin
denmarkin / will_paginate_array_helper.rb
Created February 8, 2011 21:48
How to extend array to support .paginate with will_paginate
# See http://rubydoc.info/gems/will_paginate/2.3.15/WillPaginate/Collection.create
# See https://github.com/mislav/will_paginate/blob/master/lib/will_paginate/array.rb
# Do in application_helper.rb or application_controller.rb (or somewhere else application-wide)
require 'will_paginate/collection'
Array.class_eval do
def paginate(options = {})
raise ArgumentError, "parameter hash expected (got #{options.inspect})" unless Hash === options
WillPaginate::Collection.create(
options[:page] || 1,
@denmarkin
denmarkin / .ackrc
Created February 9, 2011 18:01
~/.ackrc for web-developers. I'm using AckMate
--type-add=ruby=.haml,.rake,.feature
--type-add=objc=.pch
--type-set=xcode=.pbxproj,.pbxuser,.perspectivev3
--type-set=ragel=.rl
--type-set=nib=.xib
--type-set=plist=.plist
--type-set=tmstuff=.tmproj,.tm_build_errors
--type-set=ignorables=.log,.tmp,.pdf
--noignorables
--nonib
@denmarkin
denmarkin / deploy.rb
Created February 9, 2011 20:07 — forked from mdominiak/deploy.rb
simple deploy recipe for passenger
set :application, "new-vegas"
set :repository, "git@github.com:mdominiak/new-vegas.git"
set :scm, :git
set :host, "newvegas.vault106.com"
set :user, "deploy"
set :use_sudo, false
set :deploy_to, "/home/deploy/new-vegas/production"
role :web, host
### RAILS SHORTCUT GLORY
#
# printf "\033[0m0 All attributes off\033[0m\n"
# printf "\033[1m1 Bold\033[0m\n"
# printf "\033[4m4 Underline\033[0m\n"
# printf "\033[5m5 Blink\033[0m\n"
# printf "\033[7m7 Invert\033[0m\n"
# printf "\033[8m8 Hide\033[0m8 = Hide\n"
# printf "\033[30m30 Black\033[0m30 = Black\n"
@denmarkin
denmarkin / 37singals REE GC environment
Created February 23, 2011 20:51 — forked from bryanl/37singals REE GC environment
37singals REE GC environmen
RUBY_HEAP_MIN_SLOTS=600000
RUBY_GC_MALLOC_LIMIT=59000000
RUBY_HEAP_FREE_MIN=100000
@denmarkin
denmarkin / Twitter REE GC environment settings
Created February 23, 2011 20:52 — forked from bryanl/Twitter REE GC environment settings
Twitter REE GC environment settings
RUBY_HEAP_MIN_SLOTS=500000
RUBY_HEAP_SLOTS_INCREMENT=250000
RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
RUBY_GC_MALLOC_LIMIT=50000000
@denmarkin
denmarkin / delayed_job.monitrc
Created March 11, 2011 19:31
real-world monit recipes
# See: http://stackoverflow.com/questions/1226302/how-to-monitor-delayedjob-with-monit/1285611
check process delayed_job with pidfile /full/path/to/app/shared/pids/delayed_job.pid
start program = "/bin/su - deploy_username -c 'cd /full/path/to/app/current/; RAILS_ENV=production script/delayed_job start'"
stop program = "/bin/su - deploy_username -c 'cd /full/path/to/app/current/; RAILS_ENV=production script/delayed_job stop'"