This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// format and parse (turning snakecase into camelcase and vice versa) | |
var S = require('string') | |
var _ = require('underscore') | |
var format = function(attrs) { | |
return _.reduce(attrs, function(memo, val, key) { | |
memo[S(key).underscore().s] = val | |
console.log(memo) | |
return memo; | |
}, {}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"format_on_save": true, | |
"max_preserve_newlines": 2, | |
"space_in_paren": false | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"sync" | |
"sync/atomic" | |
"time" | |
) | |
type Empty struct { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// There is a bug https://github.com/cryptocoinjs/btc-transaction/pull/5 | |
// Below works: | |
// couple of points: | |
// change the key of scriptPubkey and scriptSig to 'script'. This is something I intend to change | |
// The bug is at parsing the values. (the values should not be a number and its should be a string) | |
// e.g. '2000000' rather than 2000000 | |
var binConv = require( "binstring" ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Buffer = require('buffer').Buffer | |
// compare equivalence 0 is true 1 is false | |
Buffer.prototype.compare = function(buf) { | |
if (!Buffer.isBuffer(buf)) { | |
buf = new Buffer(buf) | |
} | |
if (this.length !== buf.length) { | |
return 1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try | |
syntax enable | |
set background=dark | |
let g:solarized_termcolors = 256 | |
let g:solarized_visibility = "high" | |
let g:solarized_contrast = "high" | |
colorscheme solarized | |
map <C-h> :tabp<cr> | |
map <C-l> :tabn<cr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def classic_roman(int) | |
# initialise variable | |
num = int | |
num = num.to_f | |
output = [] | |
# initialise keys | |
numeral_to_value = { | |
1 => "I", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
def map | |
100000.times do | |
[10, 20, 30, 40, 50, 60, 70, 80, 90, 100].map do |int| | |
int.to_s | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To create references to children of node .child() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css"> | |
<link rel="stylesheet" href="main.css"> | |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800"> | |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900"> | |
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css"> | |
</head> |
NewerOlder