Skip to content

Instantly share code, notes, and snippets.

View jenjwong's full-sized avatar

Jen Wong jenjwong

  • Vancouver
View GitHub Profile
@jenjwong
jenjwong / osx_bootstrap.sh
Created October 25, 2019 06:00 — forked from codeinthehole/osx_bootstrap.sh
Script to install stuff I want on a new OSX machine
#!/usr/bin/env bash
#
# Bootstrap script for setting up a new OSX machine
#
# This should be idempotent so it can be run multiple times.
#
# Some apps don't have a cask and so still need to be installed by hand. These
# include:
#
# - Twitter (app store)
.wrapper {
display: grid;
height: 100vh;
grid-template-columns: 8rem 1fr;
> aside {
display: flex;
}
@include mq($until: $mobile-xl) {
grid-template-columns: auto 1fr;
.wrapper {
> aside {
display: none;
}
@include mq($from: $mobile-xl) {
display: grid;
height: 100vh;
grid-template-columns: 8rem 1fr;
> aside {
@jenjwong
jenjwong / debounce jasmine test
Created February 1, 2018 22:46
debounce jasmine test
spyOn(_, 'debounce').and.callFake(func => {
return () => {
func.apply(this, arguments);
};
});
@jenjwong
jenjwong / dynamic toy problems
Created April 10, 2017 18:49
Given an array, find the contiguous subarray with the largest sum
// Given an array, find the contiguous subarray with the largest sum.
// In the array below, the largest sum subarray starts at index 3 and ends at 6 and the largest sum is 12.
// [-4, 2, -5, 1, 2, 3, 6, -5, -100] => [1, 2, 3, 6]
// [-1, -55, -1, -1, -1] => -1 (single value)
//
// input: [] array numbers
// output: sum
// constraints: linear
// memory: constant
class Alarm extends Component {
constructor() {
super();
this.state = {
isAlarmNow: false,
alarmTime: false,
timeLeft: 0,
}
}
class Graph {
constructor() {
this._storage = {};
}
addNode(node) {
this._storage[node] = node;
}
contains(node) {
var rps = function(numRounds) {
var round = [];
var allRounds = [];
var options = ['rock', 'paper', 'sisccors'];
var genRound = function() {
if (round.length === numRounds) {
allRounds.push(round.slice());
return;
}
class Hashtable {
constructor() {
this._storage = [];
this._storageLimit = 8;
}
insert(key, value) {
let hash = getHash(key, this._storageLimit);
this._storage[hash] ? this._storage[hash] = this._storage[hash] :
this._storage[hash] = [];
class LinkedList {
constructor() {
//keeps track of first item in the list
this.head = null;
//keeps track of the last item in the list
this.tail = null;
}
addToTail(value) {
//make a new node instance