Skip to content

Instantly share code, notes, and snippets.

View rudolph9's full-sized avatar

Kurt Robert Rudolph rudolph9

  • Portland, OR, USA
View GitHub Profile
@rudolph9
rudolph9 / gist:908a23019ad471ef86d3
Last active August 29, 2015 14:06
A good example of javascript prototypal functions.
> Node = function(){};
[Function]
> Node.pro
Node.propertyIsEnumerable
Node.prototype
> Node.prototype.foo = {bar: 'hello world'};
{ bar: 'hello world' }
> node = new Node();
@rudolph9
rudolph9 / example.js
Created April 26, 2018 00:41
showing awit is not synchronous
class Foo {
constructor(foo) {
this.foo = foo
}
async execUntilStop(callback) {
const timeoutLoopCallback = () => {
if (this.stopExec) return;
callback({ data: 'data' });
setTimeout(timeoutLoopCallback, 10);
@rudolph9
rudolph9 / wait.js
Last active July 8, 2018 01:57
A simple wait function that returns and promise and puts the waiting macro task queue
const wait = callback => new Promise((resolve, reject) => {
const end = () => {
try {
if (callback()) {
resolve(true);
} else {
setImmediate(end);
}
} catch (error) {
reject(error);
@rudolph9
rudolph9 / table.mkdn
Created June 14, 2019 20:31 — forked from ngs/table.mkdn
Unicode character table

A

Description Entity Preview
A With Acute, Latin Capital Letter Á Á
A With Acute, Latin Small Letter á á
A With Breve, Latin Small Letter ă ă
A With Caron, Latin Small Letter ǎ ǎ
A With Circumflex, Latin Capital Letter  Â
A With Circumflex, Latin Small Letter â â
@rudolph9
rudolph9 / README.md
Last active February 4, 2023 00:32
Cue Web Assembly

Cue Web Assembly

Followed tutorial here: https://github.com/golang/go/wiki/WebAssembly

Setup

  1. install compatible version of golang. Test with go1.12.8
  2. get cue: go get -u cuelang.org/go/cue NOTE: this installs the packages files, not the cmd
  3. get the wasm exec_file cp "$(go env GOROOT)/misc/wasm/wasm_exec.js
@rudolph9
rudolph9 / .gitignore
Last active September 6, 2019 23:32
go-ipfs-api_wasm_app
bin
@rudolph9
rudolph9 / STDOUT
Last active October 17, 2019 23:57
Cuelang rspec like testing package
$ cue eval ttest.cue
FooBar: string
test: {
subject: _
describe: {
"One big definition": {
subject: string
it: {
"should work for invalid": {
assert: {
@rudolph9
rudolph9 / Marlowe.hs
Last active October 28, 2019 19:23
Marlowe Smart Contract
{-# LANGUAGE OverloadedStrings #-}
module Swap where
import Language.Marlowe
main :: IO ()
main = print . pretty $ contract
{- Simply swap two payments between parties -}
contract :: Contract
@rudolph9
rudolph9 / Marlowe.hs
Last active October 28, 2019 19:29
Marlowe Smart Contract
{-# LANGUAGE OverloadedStrings #-}
module Swap where
import Language.Marlowe
main :: IO ()
main = print . pretty $ contract
{- Simply swap two payments between parties -}
contract :: Contract
https://beacon.exergy.dev/?swarmKey=%2Fkey%2Fswarm%2Fpsk%2F1.0.0%2F%0A%2Fbase16%2F%0A69802e05a4ce11ade9f0fe3d55595b24a9d03ad6522848478ebf52f479cfbbb7&bootstrapNode=%2Fdns4%2Fbootstrap-node.jx-staging.xrg.pw%2Ftcp%2F443%2Fwss%2Fipfs%2FQmdnmJmwKSGLDYp494ApKM2DYfrU7BuPVKPCqzKoWRFbDd