Skip to content

Instantly share code, notes, and snippets.

View nickbclifford's full-sized avatar

Nick Clifford nickbclifford

View GitHub Profile
@nickbclifford
nickbclifford / hm_inference.ml
Last active May 22, 2023 21:37
A basic implementation of the Hindley-Milner inference algorithm. Engagement for CMSC 22100 final project.
(*
exp ::=
id |
(exp) | -- ambiguity
exp exp | -- application
\id -> exp | -- abstraction
let id = exp in exp -- binding
*)
type id = string
#include <stdio.h>
int* get_ptr() {
int x = 7;
return &x;
}
int main(void) {
int* my_ptr = get_ptr();
printf("%d\n", *my_ptr);
@nickbclifford
nickbclifford / .eslintrc.json
Last active July 18, 2020 19:35
ESLint minimal example
{
"extends": "@mymicds",
"parserOptions": {
"project": "./tsconfig.json"
}
}

Keybase proof

I hereby claim:

  • I am nickbclifford on github.
  • I am nickbclifford (https://keybase.io/nickbclifford) on keybase.
  • I have a public key ASBnl0waVQaJcxp-OpoEv9IJfpRSqoTBtqVnBNxmip8Tzwo

To claim this, I am signing this object:

require "big"
require "http/client"
require "json"
def send_contract_call(to address, data)
JSON.parse(HTTP::Client.post("localhost:8545", body: {
"jsonrpc" => "2.0",
"method" => "eth_call",
"params" => [{
"to" => address,
@nickbclifford
nickbclifford / auto-deploying.md
Last active May 15, 2023 09:02
How to automatically deploy code to a server using Travis CI

Auto-Deploying via Travis CI

Because Travis CI can automatically execute scripts after successfully (or unsuccessfully!) executing tests, it is an obvious choice for a deployment tool. In order to deploy to a Git repository on a remote server, the process generally is as follows:

  • Set up SSH keys
  • Add the server's copy of the repository as a Git remote
  • Push to the remote
  • SSH into the server and execute any installation/compilation/miscellaneous commands

Before even touching .travis.yml...

Users

@nickbclifford
nickbclifford / dominos.js
Last active February 18, 2017 17:34
Domino's Pizza JavaScript challenge
function say(firstStr) {
// gotta love currying!
return function(secondStr) {
function hyphenSeparate(str) {
return str.replace(/[.,'"?!]/g, '') // remove punctuation
.split('') // split into array of chars
.reduce((a, v) => a + '-' + v); // concatenate with hyphens in between
}
return hyphenSeparate(firstStr) + ' ' + hyphenSeparate(secondStr);
}