Skip to content

Instantly share code, notes, and snippets.

View rf's full-sized avatar

Russ Frank rf

  • Oden Technologies
  • Brooklyn, NY
View GitHub Profile
var marked = require('marked');
console.dir(marked.lexer("this is a paragraph: `test`\n\nsecondary paragraph: `test2`"));
// [ { type: 'paragraph', text: 'this is a paragraph: `test`\n\n' },
// { type: 'paragraph', text: 'secondary paragraph: `test2`' },
// links: {} ]
/* Another popular pager, most, detects when stdout
* is not a tty and turns into cat. This makes sense. */
if (!isatty(STDOUT_FILENO))
return bb_cat(argv);
<?php
# Run an HTTP POST on the specified url, sending json.
function post ($url, $data) {
$ch = curl_init();
$json = json_encode($data);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@rf
rf / gist:1813857
Created February 13, 2012 05:12 — forked from parshap/gist:1813827
irc - async example
// Get a list of rooms...
socket.on('list rooms', function(data){
client.smembers('rooms', function(err, rooms){
var remaining = rooms.length,
array = []
async.forEach(rooms, function (room, done) {
client.hgetall('room_' + room, function (e, result) {
array.push(result);
done();
var dataset = [Row_4, Row_5, (function () { if (class_tf.value === 'Other') return srRow_6; }())];
////////////////////////////////////////////////////////////////////////
var dataset = [];
dataset.push(Row_4);
dataset.push(Row_5);
// assuming json string is in `data`
var sections = {},
sectionsArray = [],
section;
try {
data = JSON.parse(data);
data.forEach(function (item) {
if (!sections[item.avatar_id]) {
// we haven't created this section yet
sections[item.avatar_id] = Ti.UI.createTableViewSection();
ios-ipa : os-sanity clean clean-src update-rev fonts iphone-images ipad-images
@echo "Executing Titanium build script for iPhone .."
@mkdir -p build/iphone/build/iphone/
@$(PYTHON) $(IOS_BUILDER) distribute $(IOS_VER) "`pwd`/build/iphone"\
$(IOS_ID) $(APP_NAME) $(MOBILEPROVISION) \
$(DEVIDENT) "`pwd`/build/" universal | egrep -v '[DEBUG]'
/usr/bin/xcrun -sdk iphoneos PackageApplication -v \
"build/iphone/build/iphone/build/Release-iphoneos/$(APP_NAME).app" \
-o "`pwd`/build/$(APP_NAME).ipa" \
--sign $(DISTRIB_PROFILE) \
@$(PYTHON) $(IOS_BUILDER) distribute $(IOS_VER) "`pwd`/build/iphone"\
$(IOS_ID) $(APP_NAME) $(MOBILEPROVISION) \
$(DEVIDENT) "`pwd`/build/" universal | egrep -v '[DEBUG]'