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 "matrix" | |
#First, you construct an adjacency matrix. An adjacency matrix is just a matrix of what is linking to what. | |
#[0, 1, 1, 1, 1, 0, 1] | |
#[1, 0, 0, 0, 0, 0, 0] | |
#[1, 1, 0, 0, 0, 0, 0] | |
#[0, 1, 1, 0, 1, 0, 0] | |
#[1, 0, 1, 1, 0, 1, 0] | |
#[1, 0, 0, 0, 1, 0, 0] |
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 play | |
`osascript -e 'tell application "iTunes" to play'` | |
end | |
def pause | |
`osascript -e 'tell application "iTunes" to pause'` | |
end | |
pause | |
(1..50).to_a.reverse.each do |n| |
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 'colored' | |
class RegExAvailableDomains | |
def initialize(regex, show_output) | |
@regex = regex | |
@show_output = show_output | |
@matching_words = [] | |
@available_domains = [] | |
find |
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
define(['graph_editor/register_core'], function(registerCore) { | |
var Edge = function(options) { | |
this._initEdge(options); | |
}; | |
Edge.prototype = { | |
_initEdge: function(options) { |
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
RunLoop(document.querySelector("canvas"), function(context, tick) { | |
context.fillRect(Math.sin(tick/5)*20 + 100, 20, 40, 40); | |
}).play(); |
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> | |
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' /> | |
<style> | |
body { margin:0; padding:0; } | |
#map { position:absolute; top:0; bottom:0; width:100%; } | |
.marker-properties { | |
border-collapse:collapse; |
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 bitcoin = require('bitcoinjs-lib'); | |
document.getElementById("generate-wallet").addEventListener("click", function(event) { | |
var seedString = document.getElementById("brainwallet-seed").value; | |
seed = bitcoin.crypto.sha256(seedString); | |
wallet = new bitcoin.Wallet(seed, bitcoin.networks.testnet); | |
address = wallet.generateAddress(); | |
document.getElementById("wallet-address").innerHTML = address; |
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 bitstore = require("bitstore"); | |
document.getElementById("generate-bitstore-client").addEventListener("click", function(event) { | |
var signMessage = function (message, cb) { | |
var key = wallet.getPrivateKey(0); | |
var network = bitcoin.networks.testnet; | |
cb(null, bitcoin.Message.sign(key, message, network).toString('base64')); | |
}; |
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 dragDrop = require('drag-drop'); | |
dragDrop('#drop', function (files) { | |
files.forEach(function (droppedFile) { | |
file = droppedFile; | |
bitstoreClient.files.put(file, function (err, res) { | |
var receipt = res.body; | |
hash_sha1 = receipt.hash_sha1; | |
hash_btih = receipt.hash_btih; | |
uri = receipt.uri; |
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 xhr = require('xhr'); | |
document.getElementById("get-wallet").addEventListener("click", function(event) { | |
xhr("https://www.blockai.com/chain/testnet/addresses/" + address, function(err, res, body) { | |
var data = JSON.parse(body); | |
var balance = data.balance; | |
document.getElementById("balance").innerHTML = balance; | |
}); | |
OlderNewer