Coinbase has the best wallets around! Please use this link cause I get $5 referal bonus.
This file contains hidden or 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
//constructs a naive Bayes binary classifier | |
public NaiveBayes(double in[][], boolean out[]){ | |
int inputs = in[0].length ; | |
//initialize sums and sums of squares for each class | |
double[] poss = new double[inputs], poss2 = new double[inputs]; | |
double[] negs = new double[inputs], negs2 = new double[inputs]; | |
//calculate amount of each class, sums, and sums of squares | |
for(int k=0;k<in.length;k++){//for each data point | |
if(out[k]){ | |
positives++;//keep track of total positives |
This file contains hidden or 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
#!/usr/bin/env ruby | |
# Find the index(es) in an array of integers where sums above and below are equal | |
def solution(a) | |
sum = a.reduce(:+) | |
return -1 unless sum | |
return 0 if sum - a[0] == 0 |
Here we demonstrate:
This file contains hidden or 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
# Warning: Operates on binary files - make sure to have all files in git to revert them! | |
# remove trailing whitespace recursively in a repo | |
find . -type f -not -iwholename '*.git*' | xargs sed -i -r 's/[ ]+$//' # [] contains a space and a tab | |
# convert tabs to spaces: | |
find . -type f -not -iwholename '*.git*' | xargs sed -i -r 's/ / /g' # s/1/2/g ... 1 is a tab, 2 is two spaces | |
# revert binary files | |
git diff | grep Binary | sed 's/^Binary files a\///' | sed 's/ and .*$//' | xargs git checkout |
This file contains hidden or 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 twtxt = require('twitter-text') | |
// Input / output user facing elements | |
var explanation = document.createElement('div') | |
var input = document.createElement('input') | |
var output = document.createElement('div') | |
document.body.appendChild(explanation) | |
document.body.appendChild(input) | |
document.body.appendChild(output) |
This file contains hidden or 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 twtxt = require('twitter-text') | |
// Input / output user facing elements | |
var explanation = document.createElement('div') | |
var input = document.createElement('input') | |
var output = document.createElement('div') | |
document.body.appendChild(explanation) | |
document.body.appendChild(input) | |
document.body.appendChild(output) |
This file contains hidden or 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
<style type='text/css'> html, body { margin: 0; padding: 0; border: 0; } </style> |
This file contains hidden or 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 something | |
require('twitter-text') |
This file contains hidden or 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
#!/usr/bin/env coffee | |
argf = new (require './argf.js')() | |
md5 = require 'md5' | |
HASH = '12345678123456781234567812345678' | |
argf.forEach (line)-> | |
if md5.digest_s(line.replace('\\n', '\n')) is HASH | |
console.log line |