Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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
<% 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 / gist:f27929409f5ee6a2a8e2
Last active October 7, 2015 14:23 — forked from nateberkopec/gist:dbc942f18359891fbc0b
Script to turn videos in to GIFs
#/usr/bin/env bash
rm -rf ./.pngs
rm -rf ./.gifs
mkdir .pngs
mkdir .gifs
ffmpeg -i $1 -r 10 ./.pngs/out%04d.png
sips -s format gif ./.pngs/*.png --out ./.gifs
gifsicle ./.gifs/*.gif --optimize=3 --delay=3 --loopcount --resize 720x405 --colors=255 > $1.gif
gifsicle --unoptimize $1.gif | gifsicle --dither --colors 48 --resize-fit-width 512 -O2 `seq -f "#%g" 0 2 213` -o $1.optimized.gif
rm -rf $1.gif
@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
@aslam
aslam / deploy.rake
Created September 10, 2012 13:56 — forked from shreyas-satish/deploy.rake
Rake task for deployment
require 'jammit'
namespace :deploy do
def run(*cmd)
system(*cmd)
raise "Command #{cmd.inspect} failed!" unless $?.success?
end
task :prod do
nuxt:build Building... +0ms
[AXIOS] Base URL: https://now-staging.hl.com/ , Browser: https://now-staging.hl.com/
nuxt:build App root: /Users/aslam/Work/hl-student-web +0ms
nuxt:build Generating /Users/aslam/Work/hl-student-web/.nuxt files... +0ms
nuxt:build Generating files... +5ms
nuxt:build Generating routes... +17ms
nuxt:build Building files... +26ms
WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration.module.rules[2].use should be one of these:
non-empty string | function | object { loader?, options?, query? } | function | [non-empty string | function | object { loader?, options?, query? }]
{
"name": "hl-student-web",
"version": "1.0.0",
"description": "Web Client",
"author": "Syed Aslam",
"engines": {
"node": "6.11.0",
"npm": ">=3.10.10",
"yarn": ">=0.27.5"
},
module.exports = {
/*
** Router config
*/
router: {
middleware: ['namespace', 'check-auth']
},
/*
** Headers of the page
*/