Skip to content

Instantly share code, notes, and snippets.

View BNRTimeBlock.h
CGFloat BNRTimeBlock (void (^block)(void));
View "parent child" data
curl -s -XPOST localhost:9200/_bulk?pretty=true --data-binary '
{ "index" : { "_index" : "parent_child", "_type" : "store", "_id" : "store1" } }
{ "name" : "auchan", "owner" : "chris" }
{ "index" : { "_index" : "parent_child", "_type" : "department", "_id" : "department1", "parent" : "store1" } }
{ "name" : "toys", "numberOfProducts" : 150 }
{ "index" : { "_index" : "parent_child", "_type" : "product", "_id" : "product1", "parent" : "department1", "routing" : "store1" } }
{ "name" : "gun", "trademark" : "tiger", "price" : 9, "store_id" : "store1" }
'
View gist:9127491
Pod::Spec.new do |m|
m.name = 'MapBox'
m.version = '0.5.2'
m.summary = 'Open source alternative to MapKit.'
m.description = 'Open source alternative to MapKit supporting custom tile sources, offline use, and complete cache control.'
m.homepage = 'http://mapbox.com/mobile'
m.license = 'BSD'
m.author = { 'Justin R. Miller' => 'justin@mapbox.com' }
View whiteboardCleaner.md

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2

Results

View AMPNavigationBar.m
// .h
@interface AMPNavigationBar : UINavigationBar
@property (nonatomic, assign) CGFloat extraColorLayerOpacity UI_APPEARANCE_SELECTOR;
@end
// .m
View redis_install_centos.txt
BTW yum has last Redis too, remi repository at least.
$ sudo -i
$ yum list redis
$ redis.x86_64 2.6.13-1.el6.remi remi
But today we want compile redis from source (see http://redis.io/download)
$ yum install make gcc tcl
$ cd /usr/local/src
View redis-server
#!/bin/sh
#
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/redis.pid
View gist:73043a4c519c1e4ce5f7
newrelic-add-repo:
cmd.run:
- name: echo deb http://apt.newrelic.com/debian/ newrelic non-free >> /etc/apt/sources.list.d/newrelic.list
- unless: grep "deb http://apt.newrelic.com/debian/ newrelic non-free" /etc/apt/sources.list.d/newrelic.list
newrelic-trust-repo:
cmd.run:
- name: wget -O- https://download.newrelic.com/548C16BF.gpg | apt-key add -
- unless: apt-key list | grep "New Relic"
View build_ota.sh
#!/bin/sh
# This script was written by Jay Graves for the 360iDev Conference.
# You can find the full slides available at http://skabber.com/
# This script requires Xcode and s3cmd http://s3tools.org/s3cmd
# You will need your own Amazon S3 account to upload files.
# Put your distribution certificates and keys in the System Keychain
# otherwise you will need to use security unlock-keychain
TARGET=GroupA
PlistBuddy=/usr/libexec/PlistBuddy
View Overlay_iOS_app_version_on_icon_README.md

Usage

Requirements

Install the two dependencies, ImageMagick and Ghostscript.

$ brew install imagemagick
$ brew install ghostscript