TC
TC

Targets 1

June 26, 2017

Read More

Ribbons 2

June 26, 2017

Read More

Ribbons 1

June 13, 2017

Read More

Querying Postgresql Arrays

June 21, 2016

This checks whether a string exists in an array of text called tags:
select * from table_with_tags_array where 'does this exist?' = ANY (tags);

Read More

ES6 Protip: Computed Property Names

Not Even CoffeeScript Has This™️

March 14, 2016

JavaScript is looking seriously good these days with ES6 (aka ES2015). One of my favorite (oft-overlooked!) new features is computed property names for objects. Take a look below and try it out here.

function getDynamicKey(myString) { return `We built this key on Rock and ${}!`; } const myObj = { myKey: 1, [getDynamicKey('Roll')]:  . . .

Read More

Rate Limiting in Go and JavaScript

Am I doin' it rite?

September 02, 2015

Let's say you want to rate limit calls to a user's function (e.g. only call a function once every second). Here's a simple way to do that in JavaScript:

var userFunc = function(){ console.log('hey'); }; var limit = function(fn, pauseTime){ var waitTime = 0; return function() { setTimeout(fn, waitTime); waitTime = waitTime . . .

Read More

Merge Sort in JavaScript

April 08, 2015
var array = [45, 23, 78, 64, 300, 1, 10, 22, 64, 423, 45]; var mergeSort = function(arr){ //array with one or less elements is already sorted if (arr.length < 2){ return arr; } //break up "unsorted" arrays var midIndex = Math.floor(arr.length/2); var left = arr.slice(0, midIndex); var right = arr.slice(midIndex, arr.length); var . . .

Read More

Archive
  Subscribe by Email and Never Miss a Post