Skip to content

Instantly share code, notes, and snippets.

View reejosamuel's full-sized avatar

Reejo Samuel reejosamuel

View GitHub Profile
@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
@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 / 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 / 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 / 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 / breakpoint
Created August 15, 2016 11:54
Setup up breakpoint on a method call
breakpoint set -n openURL
breakpoint set -S openURL:
@reejosamuel
reejosamuel / ReejoUIScrollView.swift
Created December 6, 2016 08:08
UITableView on a UIScrollView, passing gestures to swipe cell in UITableView
//
// CAPSScrollView.swift
// Pods
//
// Created by Reejo Samuel on 12/6/16.
//
//
import Foundation
import UIKit
/*
See LICENSE folder for this sample’s licensing information.
Abstract:
`ImageCacheManager` serves as a simple image cache for caching media artwork from a remote server.
*/
import UIKit
class ImageCacheManager {
@reejosamuel
reejosamuel / release-checklist.md
Last active October 3, 2017 10:27
In the early days of iOS, A realease checklist was very handy

Prerelease checklist

Type Action
App name insert content
Version insert content
Date of submission insert content

This form is to document the testing that has been done on each app

@reejosamuel
reejosamuel / SimpleStringCache.swift
Last active October 14, 2017 11:58
Implementing a simple string cache
class StringCache: NSCache<NSString, String> {
static let shared = ImageCache()
func set(_ text: String, for keyString: String) {
self.setObject(text, forKey: keyString as NSString)
}
func textFrom(_ keyString: String?) -> String? {
guard let keyString = keyString else {