Skip to content

Instantly share code, notes, and snippets.

@diversemix
diversemix / file-search.js
Created September 22, 2018 10:32
File search example with Promise and with Async
fs = require('fs')
/*
* Wrap old-style callback with promise explicitly created...
*/
const readfolderPromise = (folder) => {
if (folder === undefined) {
folder = process.cwd()
}
console.log(folder)
@s10wen
s10wen / sass-nesting.md
Last active September 22, 2016 15:51
Sass Nesting using &
  1. Nesting:
.anElement {

  &_aBlock {
    …
  }

  &_anotherBlock {
 …
@elijahmanor
elijahmanor / pros-cons-npmscripts-vs-gulp.md
Last active February 20, 2022 12:46
Pros and Cons of `npm scripts` vs Gulp

Comparison of npm scripts vs Gulp

npm scripts

Pros

  • npm scripts are low-level and leverage the actual library you want to use (example: "lint": "eslint ./")
  • package.json is a central place to see what scripts are available (also npm run will list all scripts)
  • When things get too complicated you can always defer to another file (example: "complex-script": "babel-node tools/complex-script.js")
  • npm scripts are more powerful than one might first think (pre/post hooks, passing arguments, config variables, chaining, piping, etc...)
@williewillus
williewillus / primer.md
Last active December 20, 2020 08:13
1.8.9 to 1.9 quick primer
@gaearon
gaearon / slim-redux.js
Last active May 5, 2024 15:14
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
@btm
btm / gist:7cb421f5fe7d1003083a
Created March 18, 2015 22:00
Chef Postmortem Template
# INCIDENT DATE - INCIDENT TYPE
## Meeting
#### Waiving meetings
In some cases the IC might determine that a PM meeting for the incident isn't needed.
If the IC decides to waive the meeting please replace the `Meeting` section with a
note indicating the meeting has been waived (example: `Meeting waived: Paul Mooring`)
@seanmtracey
seanmtracey / ES6 Version
Last active December 22, 2015 21:59
Random color generation for all DOM elements so you can see where that pesky whitespace is coming from.
m=Math.random,v=255;Array.from(document.querySelectorAll("*")).forEach(e=>{e.style.background=`rgb(${m()*v|0},${m()*v|0},${m()*v|0})`})
@mrmrs
mrmrs / html-css-nav
Created June 7, 2013 00:34
.vimrc mappings for super easy front-end file management. When your cursor is over a class name, press fj to step to the first definition of that class in your css/sass. Subsequently press cn to step through the quick-fix list results. These can obviously be mapped to anything you want. I like this combo personally.
map fj :execute "vimgrep /" . expand("<cword>") . "/j **" <Bar> cnext<CR>
map cn :cn<CR>