Skip to content

Instantly share code, notes, and snippets.

@rahim
rahim / reduce-jpgs-to-500px.sh
Created November 3, 2011 05:02
Reduce all JPEGs in folder to 500px wide and 75% quality using ImageMagick's mogrify
#!/bin/bash
mogrify -strip -type optimize -filter Cubic -resize 500x -quality 75% *.jpg
$('#password_prompt_form').submit ->
$.post(this.action, { passcode: $('#passcode').val() }, (data) ->
$('#passcode_response').html(data))
false
$('#password_prompt_form').submit(function() {
$.post(this.action, { passcode: $('#passcode').val() }, function(data)){
$('#passcode_response').html(data);
});
return false;
});
@rahim
rahim / for_bashrc_remote.sh
Created June 7, 2012 16:15
Open sublime on windows (+cygwin) from remote with same dir
#!/bin/bash
# placed in .bashrc
function sb {
# TODO: do something to deal with paths that don't match shared workspace
# perhaps open in vim? or prompt to open in vim?
local FULLPATH=`readlink -f $1`
local HOMEPATH=~ #/home/AHC/rahim.packirsaibo
local HOMECHAR='~'
@rahim
rahim / robot.js
Created December 6, 2012 14:31
bob
function Robot(robot) {
this.rng = new RandomNumberGenerator();
}
// well, we need to do something...
// whenever our robot is idle, this method gets called.
Robot.prototype.onIdle = function(ev) {
var robot;
robot = ev.robot;
robot.ahead(this.rng.nextRandomNumber()*700);
@rahim
rahim / gist:7677939
Last active December 29, 2015 13:29
diff --git i/app/scripts/app.coffee w/app/scripts/app.coffee
index 802853c..633c952 100644
--- i/app/scripts/app.coffee
+++ w/app/scripts/app.coffee
@@ -1,5 +1,5 @@
angular.module('ampRetirementSimulatorApp', ['ngRoute', 'ngAnimate', 'ngSanitize', 'ui.bootstrap', 'ui.slider', 'highcharts-ng', 'ampCommon'])
- .config ($routeProvider, $locationProvider, FlowProvider, CommentaryProvider) ->
+ .config ($routeProvider, $locationProvider, FlowProvider, CommentaryProvider, colors) ->
# Enabling HTML5 mode gives us clean URLs in modern browsers
# but we find that it breaks when the app is served from

Keybase proof

I hereby claim:

  • I am rahim on github.
  • I am rahim (https://keybase.io/rahim) on keybase.
  • I have a public key whose fingerprint is 050A 50F9 D69A 1598 7B09 03BD 15CC 6A0C 4F0B 9167

To claim this, I am signing this object:

gem install nokogiri -v '1.6.4.1' -V -- --use-system-libraries --with-xml2-include=/usr/local/Cellar/libxml2/2.9.2/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.2/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.28
@rahim
rahim / gist:f657a9dc75f1dc82a772
Created March 6, 2015 10:15
ISO8601 millisecond handling in Ruby 2.1.5
2.1.5 (main):0 > Time.now.strftime('%Y-%m-%d %H:%M:%S.%L')
=> "2015-03-06 10:09:12.974"
2.1.5 (main):0 > str = Time.now.strftime('%Y-%m-%d %H:%M:%S.%L')
=> "2015-03-06 10:09:26.497"
2.1.5 (main):0 > Time.parse(str)
=> 2015-03-06 10:09:26 +0000
2.1.5 (main):0 > t = Time.parse(str)
=> 2015-03-06 10:09:26 +0000
2.1.5 (main):0 > t.strftime('%Y-%m-%d %H:%M:%S.%L')
=> "2015-03-06 10:09:26.497"