brew unlink yarn
brew install https://gist.githubusercontent.com/tongrhj/5604a804cc133bf54753343737d19141/raw/cac5605d352fe97848140c6d933f96f31e987122/yarn.rb
This file contains 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
* http://simplicable.com/new/accidental-complexity-vs-essential-complexity | |
* The Imposter's Handbook | |
* Grokking Algorithms |
This file contains 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
=begin | |
Given a 2-dimensional matrix mat[M][N] of size M X N containing only the values 0 and 1, modify it such that if a matrix cell mat[i][j] is 1 then all the cells of ith row and jth column are set to 1 as well. | |
Example 1 | |
The matrix | |
1 0 | |
0 0 | |
should be changed to following |
This file contains 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
function isEmail (str) { | |
return str ? /^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/.test(str) : false | |
} | |
const test = require('ava') | |
const sinon = require('sinon') | |
test('validate#isEmail returns true if unicode emails', t => { | |
t.true(isEmail('💩+तфâ.πüñó1@ӕ.昭字')) | |
}) |
This file contains 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
security find-generic-password -D 'AirPort network password' -wa 'INSERT SSID NAME HERE' |
This file contains 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
<div><span style="font-size: 12px; color: #999999; line-height: 125%;">* {% if offer.expiry_date %}{% assign expiry_timestamp = (offer.expiry_date | date: '%s') %}{% assign now_timestamp = (now | date: '%s') %}{% assign seconds_apart = (expiry_timestamp | minus: now_timestamp) %}{% assign days_apart = (seconds_apart | divided_by: 86400 ) %}Current offer expires on {{ offer.expiry_date | date: '%-d %b %Y' }}<strong>{% if 2 <= days_apart <= 6 %} ({{ days_apart}} days left){% elsif days_apart == 1 %} (tomorrow){% else %} (today){% endif %}</strong>.{% endif %} Offers may change from time to time.</span> | |
</div> |
This file contains 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
// Practice Exercise to Accompany Egghead Course by Dan Abramov Getting Started with Redux | |
const alphabets = Array.from('abcdefghijklmnopqrstuvwxyz') | |
const abcSnake = (state = ['a'], action) => { | |
deepFreeze(state) | |
switch (action.type) { | |
case 'APPEND': | |
return appendToSnake(state) |
This file contains 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 matrix = [[1,0,0], [0,0,0]] | |
function bomber(i, j) { | |
var selectedCell = matrix[i][j] | |
if (selectedCell != 1) return | |
matrix.forEach((elem, idx, array) => { | |
console.log(elem) | |
elem.splice(j, 1, 1) | |
}) | |
var arrayLength = matrix[i].length |
This file contains 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
// bake your code here | |
importPackage(java.io); | |
importPackage(java.lang); | |
var stdin = new BufferedReader(new InputStreamReader(System['in'])); | |
var numberOfPackets = parseInt(stdin.readLine(), 10); | |
while (numberOfPackets >= 1) { | |
var totalCandies = 0; | |
var candyPackets = []; | |
var numberOfMoves = 0; |
NewerOlder