Skip to content

Instantly share code, notes, and snippets.

.g {
/* Portrait */
background: #8e9eab; /* fallback for old browsers */
background: linear-gradient(to right, #eef2f3, #8e9eab); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
}
function wrapChildrenInSets(parentNode = null, setsOf = 2) {
if (!parentNode) return;
const children = [...parentNode.children];
const divSets = [];
const divsPerSet = setsOf;
const numSets = Math.ceil(children.length / divsPerSet);
for (let index = 0; index < numSets; index++) {
function findByPropertyValue(object, propName, propValue) {
if (object[propName] === propValue) {
return object;
}
var result, property;
for (property in object) {
if (
object.hasOwnProperty(property) &&
typeof object[property] === "object" &&
object[property] !== null
export EDITOR=/usr/local/bin/code
export PATH=/usr/local/git/bin:$PATH
# ulimit -n 65536 65536
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
# PS1='\[\e[01;37m\][\u@\h \w] \t $\[\e[0m\] '
# cool prompt
@jq-87
jq-87 / tryFn.js
Created February 13, 2019 19:03
safely get an object property
const tryFn = (fn, fallback = null) => {
try {
return fn()
} catch (error) {
return fallback
}
}
const favoriteBook = tryFn(() => favorites.reading.book[0])
(function(w, d, s) {
var f = d.getElementsByTagName(s)[0],
j = d.createElement(s);
j.async = true;
j.src = '//mysite.com/myscript.js';
f.parentNode.insertBefore(j, f);
})(window, document, 'script');
@jq-87
jq-87 / scss.json
Created September 29, 2017 18:16
SCSS vscode snippet
{
"Sass Breakpoint": {
"prefix": "bp",
"body": [
"@include bp($1){",
"\t$2",
"}"
],
"description": "Breakpoint mixin"
},
@jq-87
jq-87 / vscode_keybinding.json
Created September 21, 2017 15:15
VScode custom key shortcuts
[
{
"key": "cmd+1",
"command": "workbench.action.openEditorAtIndex1"
},
{
"key": "ctrl+1",
"command": "-workbench.action.openEditorAtIndex1"
},
{
{
"vscode_custom_css.imports": [],
"editor.fontFamily": "Monaco",
"editor.lineHeight": 24,
"editor.fontLigatures": true,
"explorer.decorations.badges": false,
"window.zoomLevel": 1,
"editor.fontSize": 14,
"editor.tabCompletion": true,
"editor.minimap.showSlider": "always",
function ready(fn) {
if (document.attachEvent ? document.readyState === "complete" : document.readyState !== "loading"){
fn();
} else {
document.addEventListener('DOMContentLoaded', fn);
}
}