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
/* Original is in LESS and can be found here: https://gist.github.com/gefangenimnetz/3ef3e18364edf105c5af */ | |
@mixin material-shadow($level:1){ | |
@if $level == 1 { | |
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); | |
} | |
@else if $level == 2 { | |
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23); | |
} |
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 range(start, end, step) { | |
let result = []; | |
if (step === undefined && start < end) { | |
step = 1 | |
} else if (step === undefined && start > end) { | |
step = -1; | |
} | |
if (step < 0) { | |
for (let i = start; i>= end; i += step) { | |
result.push(i); |
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 reverseArray(array) { | |
let result = []; | |
for (let i = array.length - 1; i >= 0; i--) { | |
result.push(array[i]); | |
} | |
return result; | |
} | |
function reverseArrayInPlace(array) { | |
for (let i = 0; i < Math.floor(array.length / 2); i++) { |
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 arrayToList(array) { | |
let list = null; | |
for (let i = array.length - 1; i >= 0; i--) { | |
list = { value: array[i], rest: list }; | |
} | |
return list; | |
} | |
function listToArray(list) { | |
let result = []; |
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 deepEqual(a, b) { | |
// if ((typeof a === 'object' && typeof a !== null) && (typeof b === 'object' && typeof b !== null)) { | |
// if (Object.getOwnPropertyNames(a).length === Object.getOwnPropertyNames(b).length) { | |
// for (const propA in a) { | |
// console.log('First loop:' + a[propA]); | |
// for (const propB in b) { | |
// // return deepEqual(propA, propB); | |
// console.log('Second loop:' + b[propB]); | |
// } |
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 average(array) { | |
function plus(a, b) { return a + b; } | |
return array.reduce(plus) / array.length; | |
} | |
var byName = {}; | |
ancestry.forEach(function(person) { | |
byName[person.name] = person; | |
}); |
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 every(arr, f) { | |
for (let i = 0; i < arr.length; i++) { | |
if (!f(arr[i])) return false; | |
} | |
return true; | |
} | |
function some(arr, f) { | |
for (let i = 0; i < arr.length; i++) { | |
if (f(arr[i])) return true; |
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 combineStrings() { | |
let result = ''; | |
if (arguments.length > 0) { | |
const args = [...arguments]; | |
const maxLength = args.map(item => item.length).reduce((a, b) => Math.max(a, b)); | |
for (let i = 0; i < maxLength; i++) { | |
args.forEach(item => { | |
result += item.charAt(i); | |
}); | |
} |
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
const str = "SERR PBQR PNZC"; | |
function rot13(string) { | |
return string.split('') | |
.map(word => { | |
return word.split('') | |
.map(letter => { | |
const letterCode = letter.charCodeAt(0); | |
if (! (letterCode >= 65 && letterCode <= 90)) return letter; | |
if (letterCode <= 77) return String.fromCharCode(letterCode + 13); |
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
autoconf | |
libtool | |
ruby | |
automake | |
libyaml | |
sqlite | |
boost | |
lua | |
thefuck | |
cctools |
OlderNewer