Skip to content

Instantly share code, notes, and snippets.

PT Mono
Anonymous Pro
Comic Neue
DejaVu Sans Mono
Fantasque Sans Mono
Source Code Pro
Ubuntu Mono
@krishicks
krishicks / gist:10729924
Last active August 29, 2015 13:59
Roll back MapsOpener 1.3 to 1.2.2.

MapsOpener 1.3 does not work on iOS 6 devices, an issue known by @hbangws.

@hbangws have asked me to add to this a disclaimer that they do not condone downgrading. Proceed at your own peril.

While they work on a fix, rolling back to the previous version of MapsOpener is possible with the following steps.

Please be sure you know what you're doing on the device before attempting to roll back MapsOpener manually. It will require you to copy packages on to the device, SSH into the device, and install the packages via the console. This guide assumes you have a computer with ssh, scp, and curl (or wget), and are familiar with the dpkg package manager. If any of this makes you uncomfortable, close this tab and step away slowly. Perhaps go grab a coffee, and think of what unspeakable horrors you just avoided.

  1. Install the “SSH Connect” package using Cydia.
  2. Uninstall MapsOpener, Opener, and RocketBootstrap using Cydia.
@krishicks
krishicks / gist:8379549
Last active January 2, 2016 23:59
Photo gear for sale
Strobist/Lighting:
Profoto D1 250 Air Monobloc
Profoto Air remote
Paul C Buff Vagabond Mini lithium battery
Two 10' heavy duty light stands w/sandbags
Elinchrom Rotalux 70cm Deep Octa
Elinchrom Profoto speedring adapter
LumiQuest SoftBox III
Manfrotto 496RC2 ball head with quick release
LumoPro compact 7' light stand
if has("gui_running")
colorscheme github "Tomorrow-Night
else
colorscheme github "molokai
endif
set nohls
set guifont=Inconsolata-g:h18
set backupdir=~/tmp
set ruler
@krishicks
krishicks / chunkify.rb
Last active December 11, 2015 21:19
chunkify
def chunkify enum, out, limit, &block
enum.inject([]) do |acc, e|
size = (acc+[e]).join(",").size
if size > limit
out += yield(acc)
acc = [e]
elsif e == enum.last
out += yield(acc + [e])
else
@krishicks
krishicks / constantize.rb
Created September 30, 2011 14:34
active_support_inflector => ActiveSupport::Inflector
require 'active_support/inflector'
constantize = lambda { |str|
result = ""
str.split("_").inject("") { |acc, klass|
begin
try = acc + klass.classify
try.constantize
@krishicks
krishicks / .gitconfig
Last active September 26, 2015 14:37
.gitconfig
[core]
whitespace = indent-with-non-tab tab-in-indent trailing-space -blank-at-eof
[grep]
line-number = true
[help]
autocorrect = 1
[alias]
st = status
di = diff
co = checkout
@krishicks
krishicks / bit_rover.rb
Created July 27, 2011 02:11
yet another mars rover solution, this time using bit shifting and a hash that maps between squares of two and x,y coordinates
# lines 3..14 create a hash with squares of 2 pointing at their
# associated x,y coordinates as well as the inverse
width = 5
left = []
width.times { |i| left += [i] * (width + 1) } # [0,0,0,0,0,1,1,1,1,1..]
right = [*0..width] * width # [0,1,2,3,4,5,0,1,2,3,4,5..]
tuples = right.zip left # [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [0, 1], [1, 1]..
@krishicks
krishicks / gist:1073563
Created July 9, 2011 12:52
Double-polymorphic has_many through modeling in Rails
class Article < ActiveRecord::Base
has_many :content_relationships, as: :origin, dependent: :destroy
has_many :related_articles, through: :content_relationships, source: :related_content, source_type: "Article"
has_many :related_videos, through: :content_relationships, source: :related_content, source_type: "Video"
end
class Video < ActiveRecord::Base
has_many :content_relationships, as: :origin, dependent: :destroy
#!/usr/bin/ruby
class RoverRemote
def initialize(cmds)
parse(cmds)
end
def parse(cmds)
cmds.split("\n").each do |cmd|
case cmd