Skip to content

Instantly share code, notes, and snippets.

View shyam-habarakada's full-sized avatar

Shyam Habarakada shyam-habarakada

  • Smartsheet, 10Kft
  • Seattle, WA
View GitHub Profile
# Requires the presence of a failover node that will get activated when the site is in maintenance mode, and will be disabled when the site is live.
namespace :deploy do
namespace :web do
desc <<-DESC
Disable via Cloud Load Balancers
DESC
task :lbdisable do
@shyam-habarakada
shyam-habarakada / bash-rc-update.sh
Created March 20, 2012 15:08
bash-rc-update.sh
function color_my_prompt {
local __user_and_host="\[\033[00;30m\]\u@digitalone"
local __cur_location="\[\033[00;31m\]\w"
local __git_branch_color="\[\033[32m\]"
local __git_branch='`git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /`'
local __prompt_tail="\[\033[35m\]$"
local __last_color="\[\033[00m\]"
export PS1="$__user_and_host $__cur_location $__git_branch_color$__git_branch$__prompt_tail$__last_color "
}
if [ "$color_prompt" = yes ]; then
@shyam-habarakada
shyam-habarakada / rails-3.2-issue--Gemfile.rb
Created January 23, 2012 22:13
rails-3.2-issue--Gemfile
source 'http://rubygems.org'
gem 'rails', '3.2.0'
gem 'rake', '0.9.2.2'
gem 'mysql2', '0.2.6'
# Gems used only for assets and not required in production by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
@shyam-habarakada
shyam-habarakada / rails-3.2-errors.md
Created January 23, 2012 20:51
rails 3.2 errors

Getting the error undefined method `accept' for nil:NilClass in my controller. This is on the development environment running on OSX with mysql. Below is the full stack trace and also my bundle/gem setup information.

$ ruby --version
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]

RAILS FRAMEWORK TRACE

@shyam-habarakada
shyam-habarakada / rails-model-before-save-fixtures.rb
Created November 13, 2011 17:23
rails models with before_save callbacks and fixtures
# == Schema Information
#
# Table name: users
#
# id :integer(4) not null, primary key
# first_name :string(255)
# last_name :string(255)
# email :string(255)
# thumbnail :string(255)
# user_type_id :integer(4)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en">
<head>
<title>LDVC Seadragon Prototype</title>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<style type="text/css">
// Encounter is a managed object, and has a dynamic property called patient. of kind Patient.
// Patient is a managed object as well, and has a dynamic property id.
[objectManager.router routeClass:[Encounter class]
toResourcePath:@"/patients/:patient.id/encounters"
forMethod:RKRequestMethodPOST];
// Routing isn't resolving as expected.
@shyam-habarakada
shyam-habarakada / rest-kit-mapping-options.js
Created September 13, 2011 23:02
rest-kit-mapping-options
/*
* RestKit QUESTION
*
* What is the correct way to map the following server response variants, and
* is there a preferred option?
*
* Also, keeping in mind that these responses can represent nested objects that need to
* be mapped to corresponding object hierarchies on the client side. I can give more
* examples of that if needed.
*
@shyam-habarakada
shyam-habarakada / date-time-encoding-error-with-rabl
Created September 12, 2011 19:03
date-time-encoding-error-with-rabl
OkJson::Error in Posts#index
Showing /Users/shyam/dev/apx-server/app/views/posts/index.rabl where line #1 raised:
cannot encode ActiveSupport::TimeWithZone: Fri, 09 Sep 2011 21:47:05 UTC +00:00
Extracted source (around line #1):
1: collection @posts
2:
3: extends "posts/show"