Skip to content

Instantly share code, notes, and snippets.

function x(arg1){
function y(arg2){
do stuff
}
}(z) // <------where does z get subbed in?
var board = [0,0,0,0,0,0,0,0,0];
//record move
function recordMove(boardIndex, inputSymbol){
board[boardIndex] = inputSymbol;
$('#b'+boardIndex).val(inputSymbol);
};
//return the board index on click
var crypto = require("crypto");
var randArr = new Uint8Array(32) //create a typed array of 32 bytes (256 bits)
crypto.randomBytes(32, function(ex, buf) {
if (ex) throw ex;
randArr.push(buf);
console.log('Have %d bytes of random data: %s', buf.length, buf);
});
var makeQueue = function() {
// Hey! Rewrite in the new style. Your code will wind up looking very similar,
// but try not not reference your old code in writing the new style.
var instance = {};
instance.storage = {};
instance.index = 0;
instance.pointer = 0;
var csv = require("fast-csv");
var fs = require("fs");
var totalReceived = 10000;
var address = process.argv[2];
var command = process.argv[3];
var fileName = "hello2312";
var currentdate = new Date();
$(document).ready(function(){
var yearArray = [];
$.ajax({
type: 'GET',
url: 'http://data.sfgov.org/resource/yitu-d5am.json',
dataType: 'json',
success: function(json){
for(var i=0; i< json.length; i++){
yearArray.push(json[i].release_year)
}
tx = new bitcoin.Transaction()
// Add the input (who is paying) of the form [previous transaction hash, index of the output to use]
tx.addInput("aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31", 0) <---- Where do i get the previous transaction hash??
// Add the output (who to pay to) of the form [payee's address, amount in satoshis]
tx.addOutput("1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK", 15000)
@JackTanRoo
JackTanRoo / gist:1e77dc0371a1b0ff45b9
Created August 24, 2014 06:40
how should i generate the array of random numbers in Node, without access to window.crypto?
//helloblock tutorial
var privateKey = "cND8kTK2zSJf1bTqaz5nZ2Pdqtv43kQNcwJ1Dp5XWtbRokJNS97N"
var ecKey = new bitcoin.ECKey(privateKey)
// .ECKey() now either takes an array of randomly generated numbers or a bigDecimal as parameter
// from bitcoinjs tutorial
@JackTanRoo
JackTanRoo / gist:7acb553d8bbb633a9057
Created August 24, 2014 23:37
sending testnet coins from one address to another. Problem: dont know how to generate ecKey using new bitcoinjs api
var bitcoin = require('bitcoinjs-lib')
var helloblock = require('helloblock-js')({
network: 'testnet',
debug: true
})
//source btc account testnet
var sourcePrivateKeyWIF = '91fKWDmVZz7y7SyM5fLUBTuK2eUSYd7wxkwujQ7YLbNxNQU4LiW'; //balance 0.051 BTC
var sourceBTCAddress = 'migNkRq9gLmdPhgFfBBUiWaZf17uFE87yq';
var bitcoin = require('bitcoinjs-lib')
var helloblock = require('helloblock-js')({
network: 'testnet',
debug: true
})
//source btc account testnet
var sourcePrivateKeyWIF = '91fKWDmVZz7y7SyM5fLUBTuK2eUSYd7wxkwujQ7YLbNxNQU4LiW'; //balance 0.036 BTC
var sourceECKey = new bitcoin.ECKey.fromWIF(sourcePrivateKeyWIF);