Skip to content

Instantly share code, notes, and snippets.

View robrobbins's full-sized avatar

robrobbins robrobbins

  • Coinlist
  • Phoenix, AZ.
  • 08:20 (UTC -07:00)
View GitHub Profile

Keybase proof

I hereby claim:

  • I am robrobbins on github.
  • I am rob_rob (https://keybase.io/rob_rob) on keybase.
  • I have a public key ASAIs8J_tUdkGlaD-vRvrUXlIeU7_I8zusrD7IPx1VoQdgo

To claim this, I am signing this object:

{
"blocks": [
{
"blockHeight": 195739,
"canonical": true,
"creator": "B62qpsikYYhTaAXw8XdgGhQtLsnecHF89LZdW2bGTa4aj4mePWPHxPe",
"creatorAccount": {
"publicKey": "B62qpsikYYhTaAXw8XdgGhQtLsnecHF89LZdW2bGTa4aj4mePWPHxPe"
},
"dateTime": "Tue, 08 Nov 2022 15:42:00 GMT",
@robrobbins
robrobbins / user.js
Last active March 19, 2020 19:13
a user state machine that should transition to either "registered" or "guest" via a guard...
// User may be in one of:
// * idle: no user. no registration or access attempts
// * guest: a present user, not registered or registration/access failed
// * registered: existing user
// * processing: a register/access fetch machine is in flight
const machine = Machine({
id: 'user',
initial: 'idle',
context: {
id: undefined,
@robrobbins
robrobbins / machine.js
Created February 11, 2020 17:50
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@robrobbins
robrobbins / main.rs
Created January 28, 2020 15:39
Rust guessing game
use rand::{thread_rng, Rng};
use std::cmp::Ordering;
use std::io;
fn main() {
let secret = get_secret();
let mut guesses = 1;
loop {
let guess = get_guess(&guesses);
display_guess(&guess);
@robrobbins
robrobbins / test_net_interactive_session.py
Last active June 15, 2019 22:02
Using the Computable.py library with IPython for an Ethereum TestNet Session
# NOTE: In this example we expect that you have a locally running geth (full) node broadcasting to a (private) test network.
# That being the case, we assume you have started geth with the correct commands and have access to a `geth.ipc`
# you'll need a web3.py instance first as computable.py works with it
import web3
from web3 import Web3
# the assumption of a test network means PoA
from web3.middleware import geth_poa_middleware
# tells web3 what to connect to and how
provider = web3.IPCProvider('path_to_your/geth.ipc')
/**
* This script gives you the zone info key representing your device's time zone setting.
*
* @name jsTimezoneDetect
* @version 1.0.5
* @author Jon Nylander
* @license MIT License - http://www.opensource.org/licenses/mit-license.php
*
* For usage and examples, visit:
* http://pellepim.bitbucket.org/jstz/
@robrobbins
robrobbins / google_conversion
Created March 4, 2014 23:18
A callable version of the Google Adwords conversion script that doesn't use document.write
window.google_conversion_function = function () {
var g = this;
var h = parseFloat("0.06"),
k = isNaN(h) || 1 < h || 0 > h ? 0 : h;
var l = function (a, c) {
for (var d in a) Object.prototype.hasOwnProperty.call(a, d) && c.call(null, a[d], d, a)
};
var m, n, p, q, r = function () {
return g.navigator ? g.navigator.userAgent : null
};
@robrobbins
robrobbins / gist:7268431
Last active December 27, 2015 04:39
My jshintrc
{
// JSHint Default Configuration File (as on JSHint website)
// See http://jshint.com/docs/ for more details
"maxerr" : 50, // {int} Maximum error before stopping
// Enforcing
"bitwise" : false, // true: Prohibit bitwise operators (&, |, ^, etc.)
"camelcase" : false, // true: Identifiers must be in camelCase
"curly" : false, // true: Require {} for every new block or scope
@robrobbins
robrobbins / levenshtein.js
Created December 26, 2011 07:06
A (node|common).js module implementation of the Levenshtein Distance Algorithm
// module for calculating the Levenshtein distance between 2 strings
// a matrix to hold the distances
var d = [],
// reusable lengths of the passed in words
lenOne, lenTwo,
// counters
i,j,
// temp equality check
eq;