Skip to content

Instantly share code, notes, and snippets.

@bonpixel
bonpixel / log.js
Created August 19, 2015 16:50
console.log with line number
console.log('message', 'Line:' + (function(){
var orig = Error.prepareStackTrace;
Error.prepareStackTrace = function(_, stack){ return stack; };
var err = new Error;
Error.captureStackTrace(err, arguments.callee);
var stack = err.stack;
Error.prepareStackTrace = orig;
return stack;
})()[1].getLineNumber());
@bonpixel
bonpixel / metricsServer.js
Created March 27, 2015 21:12
Simple Metrics Server for Node-Measure
var config = require('../config/config');
var http = require('http');
var Measured = require('measured');
module.exports = (function(){
var metricsServer = {
// Create default collection of collections
collections : {
gauges: new Measured.createCollection('gauges'),
@bonpixel
bonpixel / flatten.js
Last active October 10, 2015 15:39
Recursion Example
/**
* A Little example of recursion
**/
(function(){
var flatten = function(toFlatten){
var flatArr = [],
result,
tmp;
@bonpixel
bonpixel / challenge.rb
Created January 22, 2015 22:06
A little challenge...
#!/usr/bin/env ruby
require 'net/http'
require 'json'
def http_get_request(url)
puts "http_get: #{url}"
response = Net::HTTP.get(URI(url))
if response['You should try JSON']
http_get_request(url.sub 'challenge?id', 'challenge.json?id')
@bonpixel
bonpixel / keybase.md
Created September 17, 2014 19:30
Keybase IO verification

Keybase proof

I hereby claim:

  • I am bonpixel on github.
  • I am bryannichols (https://keybase.io/bryannichols) on keybase.
  • I have a public key whose fingerprint is 91E2 2AD4 C7F8 DE98 6574 0CC2 5D55 84F9 1433 084D

To claim this, I am signing this object:

@bonpixel
bonpixel / index.jade
Created July 17, 2014 17:07
A Pen by Bryan Nichols.
#ecmads-container
.page-encrypt.pageContainer
.tabflag
.inner
.wrap
span.icon 
h2.text Encrypt
div.subpane
.results
/* I always forget this so I'm making it a gist */
pre {
white-space: pre; /* CSS 2.0 */
white-space: pre-wrap; /* CSS 2.1 */
white-space: pre-line; /* CSS 3.0 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: -moz-pre-wrap; /* Mozilla */
white-space: -hp-pre-wrap; /* HP Printers */
@bonpixel
bonpixel / An-Anonymous-Pen.markdown
Created February 6, 2014 19:03
A Pen by A Non Ymous.