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 bitcoin = require('bitcoinjs-lib') | |
var fs = require("fs") | |
function randomString(length, chars) { | |
var result = ''; | |
for (var i = length; i > 0; --i) result += chars[Math.floor(Math.random() * chars.length)]; | |
return result; | |
} |
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 bitcoin = require('bitcoinjs-lib') | |
var fs = require("fs") | |
function randomString(length, chars) { | |
var result = ''; | |
for (var i = length; i > 0; --i) result += chars[Math.floor(Math.random() * chars.length)]; | |
return result; | |
} | |
function makePair(params) { |
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 bitcoin = require('bitcoinjs-lib'); | |
var request = require('request'); | |
function getUnspent(address) { | |
var url ='https://bitcoin.toshi.io/api/v0/addresses/'+address+'/unspent_outputs'; | |
request(url, function (error, response, body) { | |
if (!error && response.statusCode == 200) { | |
var body = JSON.parse(body); | |
var total = 0; | |
var transactions = []; |
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 the libraries we need to make this magic happen | |
var bitcoin = require(‘bitcoinjs-lib’); | |
var request = require(‘request’); | |
var blockchain = require(‘blockchain.info’); | |
var blockexplorer = require(‘blockchain.info/blockexplorer’); | |
// Export this module so you can easily call it from your main application | |
exports.opReturn = function (message, fromKey, toAddress) { | |
// Create a new promise that can only resolve or reject | |
return new Promise(function(resolve, reject) { |
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
// SORTS ELEMENTS OF AN ARRAY | |
// http://jsbin.com/rutumeh/edit?js,console | |
var sortBy = (function () { | |
var _toString = Object.prototype.toString, | |
//the default parser function | |
_parser = function (x) { return x; }, | |
//gets the item to be sorted |
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
function getImage(url){ | |
return new Promise(function(resolve, reject){ | |
var img = new Image() | |
img.onload = function(){ | |
resolve(url) | |
} | |
img.onerror = function(){ | |
reject(url) | |
} | |
img.src = url |
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
$.getScript("../scripts/Sha256.js"); | |
$.getScript("../scripts/BigInt.js"); | |
// ----------------- FUNCTIONS------------------// | |
function check(address) { | |
var decoded = base58_decode(address); | |
if (decoded.length != 25) return false; | |
var cksum = decoded.substr(decoded.length - 4); | |
var rest = decoded.substr(0, decoded.length - 4); |
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
map $sent_http_content_type $expires { | |
default off; | |
text/html epoch; | |
text/css max; | |
application/javascript max; | |
~image/ max; | |
} | |
server { | |
listen 443 ssl http2 default_server; |
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
## Make sure we are up to date and install nginx | |
sudo apt-get update | |
sudo apt-get install nginx | |
## Once completed lets check the version | |
sudo nginx -v | |
## OK let’s configure nginx | |
sudo nano /etc/nginx/sites-available/default |
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
_getPreciseLocation() { | |
return new Promise((resolve, reject) => { | |
if (navigator.geolocation) { | |
navigator.geolocation.getCurrentPosition((position) => { | |
if(position){ | |
resolve([position.coords.latitude, position.coords.longitude]); | |
} else { | |
reject(Error("We didnt get a location")) | |
} | |
}); |
OlderNewer