Skip to content

Instantly share code, notes, and snippets.

@nivertech
nivertech / gist:2707751
Created May 16, 2012 05:35
Things I'd Like to Open Source Soon (iOS)

Having worked with iOS almost exclusively the past year, there's a few things that I commonly reuse that may be of use to you. If any of this is of interest to you, let me know. I'm trying to prioritize what I'll release first.

  • BBRefreshWebView - A pattern for applying pull-to-refresh functionality to a UIWebView. The goal here is to make it feel as native as possible. Inspired by the Facebook app for iOS.

  • Backlight - Backlight aims to make location tracking more battery-efficient by triggering location tracking only while the user is moving. If an idle period is detected, accurate location tracking is disabled and only re-started if the user moves a significant distance.

  • BBAutoLoadCellView - A way to implement infinite scroll in table views. If the user scrolls to the bottom (or top), a refresh event is triggered and a UIActivityIndicator is displayed.

  • BBChatTableView - iMessage-style chat interface. This is something that I've re-implemented time and time again, there's some tedious aspects that

@nivertech
nivertech / enable_java_plugin.sh
Created October 19, 2012 20:22
Enable Java Plugin
#!/usr/bin/env sh
sudo mkdir -p /Library/Internet\ Plug-Ins/disabled &&
sudo mv /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin /Library/Internet\ Plug-Ins/disabled &&
sudo ln -s /System/Library/Java/Support/Deploy.bundle/Contents/Resources/JavaPlugin2_NPAPI.plugin /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
@nivertech
nivertech / printer.py
Created November 1, 2012 11:48 — forked from ralight/printer.py
Print incoming MQTT messages with a maximum width of 32 characters.
#!/usr/bin/python
import mosquitto
import textwrap
def on_message(mosq, obj, msg):
for s in textwrap.wrap(msg.payload, width=32):
print(s)
mqttc = mosquitto.Mosquitto()
@nivertech
nivertech / gist:4014593
Created November 5, 2012 00:44 — forked from davatron5000/gist:2254924
Static Site Generators

Backstory: I decided to crowdsource static site generator recommendations, so the following are actual real world suggested-to-me results. I then took those and sorted them by language/server and, just for a decent relative metric, their Github Watcher count. If you want a heap of other projects (including other languages like Haskell and Python) Nanoc has the mother of all site generator lists. If you recommend another one, by all means add a comment.

Ruby

@nivertech
nivertech / gist:4202797
Created December 4, 2012 11:17
Erlang dependencies
sudo apt-get install ec2-ami-tools ec2-api-tools git-core gcc g++ ncurses-dev build-essential m4 autoconf openssl libssl-dev unixodbc-dev flex xsltproc fop libssl-dev imagemagick expect git-svn unzip dstat uuid-dev chkconfig
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
wget https://github.com/elasticsearch/elasticsearch/archive/v0.20.1.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
sudo mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
"""
Automated installation of ejabberd with a postgresql backend inspired by this
article: http://www.planeterlang.org/en/planet/article/How_to_install_ejabberd_2.0.0_with_PostgreSQL_support/
"""
from fabric.api import run, sudo
EJABBERD_VERSION = '2.0.5'
EJABBERD_SOURCE_HOME = '~/dev/xmpp/oss'
POSTGRES_PSQL_PASSWORD = 'user'
rebar.config--
{sub_dirs, ["rel"]}.
{require_otp_vsn, "R13B04|R14"}.
{cover_enabled, true}.
{erl_opts, [debug_info, fail_on_warning]}.
{deps, [
#!/usr/bin/env python
#install the follow first:
#sudo easy_install pip
#sudo pip install -U boto
#sudo pip install configparser
$ brew update
$ cd `brew --prefix`
# Use erlang formula for Erlang R15B01
$ git checkout 6b8d25f Library/Formula/erlang.rb
$ brew install erlang
# Reset formula
$ git reset HEAD Library/Formula/erlang.rb
$ git checkout -- Library/Formula/erlang.rb