This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .wrapper { | |
| display: grid; | |
| height: 100vh; | |
| grid-template-columns: 8rem 1fr; | |
| > aside { | |
| display: flex; | |
| } | |
| @include mq($until: $mobile-xl) { | |
| grid-template-columns: auto 1fr; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .wrapper { | |
| > aside { | |
| display: none; | |
| } | |
| @include mq($from: $mobile-xl) { | |
| display: grid; | |
| height: 100vh; | |
| grid-template-columns: 8rem 1fr; | |
| > aside { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| spyOn(_, 'debounce').and.callFake(func => { | |
| return () => { | |
| func.apply(this, arguments); | |
| }; | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Alarm extends Component { | |
| constructor() { | |
| super(); | |
| this.state = { | |
| isAlarmNow: false, | |
| alarmTime: false, | |
| timeLeft: 0, | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Graph { | |
| constructor() { | |
| this._storage = {}; | |
| } | |
| addNode(node) { | |
| this._storage[node] = node; | |
| } | |
| contains(node) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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] = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
NewerOlder