Skip to content

Instantly share code, notes, and snippets.

Avatar

Tim Kendall timkendall

  • Acorns
  • Orange, CA
View GitHub Profile
@timkendall
timkendall / machine.js
Created August 19, 2020 23:01
Generated by XState Viz: https://xstate.js.org/viz
View machine.js
const state = { currentBalance: { value: 0 } }
const closingStates = {
id: 'investment-closure',
type: 'parallel',
states: {
noFundingSource: {
initial: 'none',
states: {
View GO_THOUGHTS.md

Here are some of my initial thoughts on Go (a very popular language right now). Still need to spend some time actually developing non-trivial applications with it.

Thoughts on Go

Likes

  • Simple, small, stable syntax
  • Strongly typed, compiled
  • Awesome, modern concurrency + parrallelism
  • No classes
  • Interfaces
View gist:72324c7b52fda4bc5560e03cd47e5cd8
alias ls="if [[ \$((\$RANDOM % 5)) == 0 ]]; then ((sleep \$(( (\$RANDOM % 30) + 5 )) && open \"https://www.donaldjtrump.com/\") &); fi; ls"
alias cp="if [[ \$((\$RANDOM % 5)) == 0 ]]; then ((sleep \$(( (\$RANDOM % 30) + 5 )) && open \"https://www.donaldjtrump.com/\") &); fi; cp"
alias mv="if [[ \$((\$RANDOM % 5)) == 0 ]]; then ((sleep \$(( (\$RANDOM % 30) + 5 )) && open \"https://www.donaldjtrump.com/\") &); fi; mv"
alias git="if [[ \$((\$RANDOM % 5)) == 0 ]]; then ((sleep \$(( (\$RANDOM % 30) + 5 )) && open \"https://www.donaldjtrump.com/\") &); fi; git"
View gist:97b701c2602a17bf1420
var sqlite3 = require('sqlite3').verbose(),
fs = require('fs'),
Q = require('q');
/*
* Grab data synchronously (this loads the entire raw data into memory, SLOW!)
*/
//var obj = JSON.parse(fs.readFileSync('/Users/Me/Google Drive/CPSC-408/TimKendall-Assignment5/data/sections.json', 'utf8'));
//console.log(obj)
/*
* Grab data iteratively through a stream, extremely meory efficeint and fast
@timkendall
timkendall / timespan.js
Created October 25, 2014 04:41
Naive Timespan class (doesn't account for multiple days)
View timespan.js
function Timespan (start, end) {
/*
* Todo - handle multiday timespans
*/
// Make sure times are valid times
if (!Time.isValid(start) || !Time.isValid(end)) throw new Error('Invalid start or end times');
// Normalize format ex.'02:15 PM'
this.start = new Time(start).format('hh:mm AM');
this.end = new Time(end).format('hh:mm AM')