Skip to content

Instantly share code, notes, and snippets.

@aslam
aslam / match_maker.rb
Created September 5, 2012 19:07
Retina India - Seshpath MatchMaker
class MatchMaker
# This method matches the volunteers with the request criteria and notifies them through
# email and sms. Volunteers can accept this request by clicking on a link sent in the email
# or sending an sms to <NO>.
#
# The student can freeze on a volunteer by clicking on a link provided next to the volunteer
# details and close this request.
#
# Then the actual searching starts by building the criteria for search. Various search scopes
# are merged together to form complete search criteria which is passed on to Oracle to do the
<% if @home_visit.errors.any? %>
/* Hide the flash notice div */
$("#flash_notice").addClass('hidden')
/* Update the html of the div phone-call-errors with the new one */
$("#home_visit_errors").html("<%= escape_javascript(errors_for(@home_visit).html_safe) %>");
/* show the div phone-call-errors */
$("#home_visit_errors").removeClass('hidden');
<% else %>
@aslam
aslam / Gemfile
Created March 21, 2012 11:13 — forked from Epictetus/Gemfile
Rails 3.2.1 Gemfile for Heroku with haml, rspec and backbone.js
source 'https://rubygems.org'
gem 'rails', '3.2.1'
gem 'haml-rails'
gem 'rails-backbone'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :development, :test do
@aslam
aslam / sti_helpers.rb
Created November 22, 2011 12:15 — forked from shakerlxxv/sti_helpers.rb
To smooth out the use of STI for Rails models
#-------------------------------------------------------------------------------
# This module is meant to be included in the Base class of an STI model
# hierarchy.
#
# Heavily inspired by a couple key blog posts
# http://code.alexreisner.com/articles/single-table-inheritance-in-rails.html
# http://coderrr.wordpress.com/2008/04/22/building-the-right-class-with-sti-in-rails/#comment-1826
#
# Thanks to Alex and coderrr!
#-------------------------------------------------------------------------------
@aslam
aslam / rails_3_1_rc4_changes.md
Created November 4, 2011 07:47 — forked from ryanb/rails_3_1_rc4_changes.md
The Changelogs for Rails 3.1 Beta 1

Railties 3.1 RC4

  • The new rake task assets:clean removes precompiled assets. [fxn]

  • Application and plugin generation run bundle install unless --skip-gemfile or --skip-bundle. [fxn]

  • Fixed database tasks for jdbc* adapters #jruby [Rashmi Yadav]

  • Template generation for jdbcpostgresql #jruby [Vishnu Atrai]

@aslam
aslam / gist:1241785
Created September 26, 2011 07:28 — forked from padolsey/gist:527683
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@aslam
aslam / _form.html.erb
Created September 18, 2011 09:36 — forked from vjm/_form.html.erb
CRUD Devise Example
<%= form_for(@user) do |f| %>
<% if @user.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
<ul>
<% @user.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
@aslam
aslam / about.md
Created August 9, 2011 14:22 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@aslam
aslam / random-number.rb
Created August 9, 2011 10:37
Create random numbers easily in Rails
# The output is double the input value
ActiveSupport::SecureRandom.hex(3)
@aslam
aslam / rails_3_1_beta_1_changes.md
Created May 13, 2011 14:06 — forked from ryanb/rails_3_1_rc4_changes.md
The Changelogs for Rails 3.1 Beta 1

Railties 3.1 Beta 1

  • The -j option of the application generator accepts an arbitrary string. If passed "foo", the gem "foo-rails" is added to the Gemfile, and the application JavaScript manifest requires "foo" and "foo_ujs". As of this writing "prototype-rails" and "jquery-rails" exist and provide those files via the asset pipeline. Default is "jquery". [fxn]

  • jQuery is no longer vendored, it is provided from now on by the jquery-rails gem. [fxn]

  • Prototype and Scriptaculous are no longer vendored, they are provided from now on by the prototype-rails gem. [fxn]

  • The scaffold controller will now produce SCSS file if Sass is available [Prem Sichanugrist]