Skip to content

Instantly share code, notes, and snippets.

View aaronyo's full-sized avatar

Aaron Boyd aaronyo

  • Nomic
  • Bend, Oregon
View GitHub Profile

Errors in synchronous js code are pretty straightforward and not unlike errors or exceptions in other languages. They can be thrown and caught, and when they are created they get a stack trace.

var fnInner = function() {
    throw new Error("busted");
};

var fnOuter = function() {
    fnInner();
};
@aaronyo
aaronyo / databases.rake
Last active December 19, 2015 00:29 — forked from wbailey/databases.rake
Standalone migrations for postgres with foreign key support.
require 'yaml'
require 'logger'
require 'active_record'
require 'foreigner'
namespace :db do
def create_database config
options = {:charset => 'utf8'}
create_db = lambda do |config|
MEMBER ACTIVITY ONLY
handle | id | messages | pings | contributors | readers | members
--------------------+------+----------+-------+--------------+---------+---------
burnerslv | 1234 | 349 | 19 | 19 | 27 | 31
theunderground | 1306 | 334 | 36 | 22 | 32 | 35
lvmusic | 1301 | 186 | 17 | 19 | 38 | 46
DowntownChic | 1297 | 113 | 24 | 10 | 17 | 21
PublicArts | 1303 | 107 | 9 | 17 | 27 | 34
lvtech | 1300 | 75 | 8 | 13 | 26 | 31
function app (profile, appContent) {
return (
$t(
'content',
style(
size('100%'),
flex({'flex-direction': 'column'}),
{
'background-color': 'white',
'font-family': 'ProximaNovaBold',
@aaronyo
aaronyo / pipe-compose-typescript.ts
Created October 14, 2019 05:39
Pipe, compose and the trouble with typescript generics... conclusion: pipe is better than compose in typescript
import fp from 'lodash/fp';
function compose<TS extends any[], R>(
f1: (...args: TS) => R,
): (...args: TS) => R;
function compose<TS extends any[], R1, R2>(
f1: (a: R1) => R2,
f2: (...args: TS) => R1,
): (...args: TS) => R2;