Skip to content

Instantly share code, notes, and snippets.

@nivertech
nivertech / README.md
Created February 20, 2012 03:49 — forked from bergie/README.md
MQTT pub/sub example

This is a simple example of the MQTT protocol with Node.js. The client code has also been tested with a combination of C++ servers and clients.

@nivertech
nivertech / hack.sh
Created March 31, 2012 14:30 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@nivertech
nivertech / gist:2294140
Created April 3, 2012 17:52
CoffeeScript setTimeout problem

When you need to use scalar arguments after function arguments use one of the following approaches:

delayed_ping = (client) ->
  log "delayed_ping"
  setTimeout (c) -> 
               log 'ping'
               c.pingreq {}
             , KEEP_ALIVE_SEC*1000
@nivertech
nivertech / dartfirststate_de_us.sql
Created April 27, 2012 14:20 — forked from mheadd/dartfirststate_de_us.sql
A SQL script for importing GFTS data from the State of Delaware into a MySQL database.
-- -------------------------------------------------------------------------------------------------------
-- A SQL script for importing GFTS data from the State of Delaware into a MySQL database.
--
-- Copyright 2010 Mark J. Headd
-- http://www.voiceingov.org
--
-- This file is free software; you can redistribute it and/or modify it under the terms of the
-- GNU Library General Public License as published by the Free Software Foundation; either version 2 of the
-- License, or (at your option) any later version.
-- This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
@nivertech
nivertech / dartfirststate_de_us.sql
Created April 27, 2012 14:21 — forked from mheadd/dartfirststate_de_us.sql
A SQL script for importing GFTS data from the State of Delaware into a MySQL database.
-- -------------------------------------------------------------------------------------------------------
-- A SQL script for importing GFTS data from the State of Delaware into a MySQL database.
--
-- Copyright 2010 Mark J. Headd
-- http://www.voiceingov.org
--
-- This file is free software; you can redistribute it and/or modify it under the terms of the
-- GNU Library General Public License as published by the Free Software Foundation; either version 2 of the
-- License, or (at your option) any later version.
-- This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
@nivertech
nivertech / dartfirststate_de_us_procs.sql
Created April 27, 2012 14:22 — forked from mheadd/dartfirststate_de_us_procs.sql
Stored Procedures for querying GFTS data from the State of Delaware in a MySQL database.
-- ----------------------------------------------------------------------------------------------------
-- Stored Procedures for querying GFTS data from the State of Delaware in a MySQL database.
--
-- Copyright 2010 Mark J. Headd
-- http://www.voiceingov.org
--
-- This file is free software; you can redistribute it and/or modify it under the terms of the
-- GNU Library General Public License as published by the Free Software Foundation; either version 2 of the
-- License, or (at your option) any later version.
-- This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
@nivertech
nivertech / parse_erlang.erl
Created April 29, 2012 07:09 — forked from maxlapshin/parse_erlang.erl
Parse erlang config file loaded into binary
parse(Text) when is_binary(Text) ->
parse(binary_to_list(Text));
parse(Text) when is_list(Text) ->
parse(Text, [], 0, []).
parse(Text, Env, Line, Acc) ->
case erl_scan:tokens([], Text, Line) of
{done, {ok, Scanned, NewLine}, Rest} ->
{ok, Parsed} = erl_parse:parse_exprs(Scanned),
@nivertech
nivertech / underscoreR.coffee
Created May 7, 2012 07:43 — forked from jimtla/underscoreR.coffee
Add CoffeeScript friendly argument order to Underscore.js
# Five lines of code that will make your underscore + CoffeeScript use cleaner.
# Creates an underscore function for each function in to_reverse with R (short for Reversed) appended to the name.
# The R version moves the function argument (first argument in normal underscore) to the end,
# so you can write:
$(window).scroll _.throttleR 500, ->
console.log "This print's at most every 500ms"
# Instead of:
$(window).scroll _.throttle ->
console.log "This prints at most every 500ms too"
@nivertech
nivertech / subman.sql
Created May 8, 2012 12:12 — forked from joelreymont/subman.sql
Mix SQL from a real project
CREATE TABLE Subman_Publisher
(
id string AUTO PRIMARY KEY, -- auto-generated, uuid
stacks set of string REFERENCES Subman_Stack, -- primary key ref
subscription_count int
);
CREATE TABLE Subman_Stack
(
@nivertech
nivertech / README.md
Created May 11, 2012 09:58 — forked from bergie/README.md
MQTT pub/sub example

This is a simple example of the MQTT protocol with Node.js. The client code has also been tested with a combination of C++ servers and clients.