Skip to content

Instantly share code, notes, and snippets.

View reejosamuel's full-sized avatar

Reejo Samuel reejosamuel

View GitHub Profile
@reejosamuel
reejosamuel / parse_rails_timestamp.js
Created July 23, 2016 18:58
Parse the default timestamp from rails in javascript
function parseRailsTime(iso8601) {
var s = $.trim(iso8601);
s = s.replace(/\.\d+/,""); // remove milliseconds
s = s.replace(/-/,"/").replace(/-/,"/");
s = s.replace(/T/," ").replace(/Z/," UTC");
s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400
s = s.replace(/([\+\-]\d\d)$/," $100"); // +09 -> +0900
return new Date(s);
}
@reejosamuel
reejosamuel / tmux.md
Created June 15, 2016 14:10 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@reejosamuel
reejosamuel / incr_build_num.sh
Last active April 20, 2016 09:44
Auto Increment Build Number in iOS
#
# Set the build number to the current git commit count.
# If we're using the Dev scheme, then we'll suffix the build
# number with the current branch name, to make collisions
# far less likely across feature branches.
# Based on: http://w3facility.info/question/how-do-i-force-xcode-to-rebuild-the-info-plist-file-in-my-project-every-time-i-build-the-project/
#
# Updated with dSYM handling from http://yellowfeather.co.uk/blog/auto-incrementing-build-number-in-xcode-revisited/
#
@reejosamuel
reejosamuel / pop_animation.swift
Last active March 26, 2017 16:41
Pop animatable properties
item.repeatForever = true
item.springSpeed = 5
item.springBounciness = 2
item.dynamicsFriction = 0
item.dynamicsMass = 1
item.dynamicsTension = 40
@reejosamuel
reejosamuel / .irbrc
Created January 18, 2013 18:09
.irbrc with some personal preferences
IRB.conf[:PROMPT_MODE] = :SIMPLE
IRB.conf[:SAVE_HISTORY] = 1000
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb_history"
if defined? Bundler
Gem.post_reset_hooks.reject! { |hook| hook.source_location.first =~ %r{/bundler/} }
Gem::Specification.reset
load 'rubygems/custom_require.rb'
end