Skip to content

Instantly share code, notes, and snippets.

View timkendall's full-sized 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
const state = { currentBalance: { value: 0 } }
const closingStates = {
id: 'investment-closure',
type: 'parallel',
states: {
noFundingSource: {
initial: 'none',
states: {

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
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"
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)
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')