Skip to content

Instantly share code, notes, and snippets.

View mcgingras's full-sized avatar
🗻
snowy peak

Michael Gingras mcgingras

🗻
snowy peak
View GitHub Profile
@mcgingras
mcgingras / tic-tac-toe.js
Created April 19, 2023 03:17
Terminal Tic Tac Toe (tttt)
const prompt = require("prompt");
prompt.start();
const state = [
[" ", " ", " "],
[" ", " ", " "],
[" ", " ", " "],
];
const printBoard = (state) => {
@mcgingras
mcgingras / fp.ml
Last active November 3, 2021 21:52
The Beauty of Functional Programming
(* syntactically defining cons as list concat *)
let cons a b = a::b
(* sum without foldr *)
let rec sum lst =
match lst with
| [] -> 0
| h::t -> h + sum t
(* general case, foldr *)
@mcgingras
mcgingras / ok.sol
Created March 5, 2021 04:00
Someone Else Mint This NFT
// psuedocode baby
validator = 0xabcd....
function mint(msg, attributes) {
signer = decode(msg, attributes)
require(signer === validator)
mintNFT(attributes)
}
@mcgingras
mcgingras / keybase.md
Last active April 6, 2020 12:56
keybase.md

Keybase proof

I hereby claim:

  • I am mcgingras on github.
  • I am mcg79 (https://keybase.io/mcg79) on keybase.
  • I have a public key ASAojBAlmfLJmo9SN_lJLpXMCt-lfLtM8-YB62ZI605LrAo

To claim this, I am signing this object:

class Test {
constructor(arr){
console.log(arr);
this.arr = arr;
}
addHello(i){
this.arr[i] = 'hello';
}
}
@mcgingras
mcgingras / README.md
Created November 22, 2019 22:51
SCRIPT-8
@mcgingras
mcgingras / README.md
Created November 12, 2019 17:05
SCRIPT-8
@mcgingras
mcgingras / test.js
Last active March 27, 2018 22:57
LN error
'use strict';
const grpc = require('grpc');
const fs = require("fs");
// Lnd cert is at ~/.lnd/tls.cert on Linux and
// ~/Library/Application Support/Lnd/tls.cert on Mac
const lndCert = fs.readFileSync('/Users/mcgingras/Library/Application Support/LND/tls.cert');
const adminMacaroon = fs.readFileSync('/Users/mcgingras/Library/Application Support/LND/admin.macaroon');
const meta = new grpc.Metadata();
@mcgingras
mcgingras / deploy.js
Created January 19, 2018 16:33
Web3 v1.0 + testrpc: deploying a contract
const fs = require('fs');
const solc = require('solc');
const Web3 = require('web3');
// make sure you have a testrpc instance running on port 8545 (default)
const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
web3.eth.getAccounts()
.then((accounts) => {
@mcgingras
mcgingras / Izer.sol
Created August 1, 2017 01:39
Oraclize rucursive call errors....
// Izer.sol
//
// Michael Gingras
//
// 7.30.17
pragma solidity ^0.4.11;
import "./usingOraclize.sol";