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
.palette-container { | |
display: flex; | |
margin: 20px; | |
} | |
.color-name { | |
font-size: 12pt; | |
font-weight: bold; | |
margin: 20px; |
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
// Credits: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions | |
function escapeRegExp(string) { | |
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string | |
} |
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
// Depends on LoDash chunk function | |
import { chunk } from 'lodash'; | |
const hexToRgba = (hex = '000000', alpha = 1) => { | |
const hexChunkSize = hex.length / 3; | |
const rgb = _.chunk(Array.from(hex.replace('#', '')), hexChunkSize) | |
.map((chunk) => chunk.join('')) | |
.map((hex) => parseInt(hex, 16)) | |
.join(','); |
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
import { delay } from 'lodash'; | |
const UI_DELAY = 250; // milliseconds | |
export function uidelay(wait = UI_DELAY) { | |
return function(target, method, descriptor, ...args) { | |
const original = descriptor.value; | |
return Object.assign(descriptor, { | |
value() { | |
delay(() => original.call(this), wait, ...args); |
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
#!/bin/bash | |
for file in $(find src -name "*.js");do git mv $file ${file/.js/.ts}; done |
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
These are the snippets I use in Sublime Text. |
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
{ | |
"proto": { | |
"prefix": "proto", | |
"body": "${1:class_name}.prototype.${2:method_name} = function ${2:method_name}(${3:first_argument}){\n\t${0:// body...}\n};\n", | |
"description": "Prototype" | |
}, | |
"befinj": { | |
"prefix": "befinj", | |
"body": "beforeEach(inject((${1:name}) => {\n ${2:}\n}));", | |
"description": "beforeEach inject" |
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
(+new Date() + Math.floor(Math.random() * 999999)).toString(16) |