View npm-audit.js
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 { exec } = require('child_process') | |
const { promisify } = require('util') | |
const chalk = require('chalk') | |
// See: https://docs.npmjs.com/about-audit-reports#severity | |
const SEVERITY_LEVELS = ['low', 'moderate', 'high', 'critical'] | |
const SEVERITY_THRESHOLD = 'critical' | |
const run = promisify(exec) | |
// Get the output of a command. If the command exits with a non-zero code, try |
View bling.js
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
/* bling.js */ | |
window.$ = document.querySelectorAll.bind(document); | |
Node.prototype.on = window.on = function (name, fn) { | |
this.addEventListener(name, fn); | |
}; | |
NodeList.prototype.__proto__ = Array.prototype; |
View SassMeister-input.scss
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
// ---- | |
// Sass (v3.4.21) | |
// Compass (v1.0.3) | |
// ---- | |
/// Map of breakpoints | |
/// @type Map | |
$breakpoints: ( | |
'small': '(min-width: 860px)', | |
'medium': '(min-width: 1000px)', |
View theme.scss
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
/// This function is exactly like `map-get` except it goes deeper. | |
/// You pass the map as first argument and then an unlimited number of keys to be accessed. | |
/// If a key cannot be reached, the function aborts and returns `null`. | |
@function map-deep-get($map, $keys...) { | |
@each $key in $keys { | |
$map: map-get($map, $key); | |
@if (type-of($map) == 'null') { @return $map; } | |
} |
View en.yml
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
# _data/en.yml | |
header: | |
title: "Hello world!" |
View MyCoolComponent.js
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
import React from 'react'; | |
import MyCoolTextarea from '../MyCoolTextarea'; | |
import MyCoolCounter from '../MyCoolCounter'; | |
const MyCoolComponent = React.createClass({ | |
// Define a method on the parent component describing what should happen when | |
// the textarea gets updated. At this point, the only thing needed is to store | |
// the length of the textarea’s content in a state on the parent component. | |
// |
View doc-parser.js
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
// Here is a very simple Node.js script to perform GET HTTP requests to a | |
// collection of similar pages (see `URLS`) in order to extract some information | |
// from the (virtual) DOM. For instance, you could parse an array of pages and | |
// grab the title of each of them. | |
// | |
// The script then writes the resulting data (an array as well, of course) in a | |
// JSON file (see `DEST_FILE`). It will also cache the requested HTML documents | |
// in a cache file (see `CACHE_FILE`) in order to avoid having to perform all | |
// the HTTP requests when only the collected data changes (see `parseData`). |
View SassMeister-input.scss
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
// ---- | |
// libsass (v3.2.5) | |
// ---- | |
/// Performs right-to-left function composition. | |
/// The rightmost function may have any arity; | |
/// the remaining functions must be unary. | |
/// | |
/// @see http://ramdajs.com/docs/#compose Ramda Compose | |
/// |
View SassMeister-input.scss
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
// ---- | |
// libsass (v3.2.5) | |
// ---- | |
/// Replace `$search` with `$replace` in `$string` | |
/// @author Hugo Giraudel | |
/// @link http://sassmeister.com/gist/1b4f2da5527830088e4d Original gist | |
/// @param {String} $string - Initial string | |
/// @param {String} $search - Substring to replace | |
/// @param {String} $replace ('') - New value |
View SassMeister-input.scss
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
// ---- | |
// libsass (v3.2.5) | |
// ---- | |
@function uniq($list) { | |
$uniq-list: (); | |
@each $item in $list { | |
@if not index($uniq-list, $item) { | |
$uniq-list: append($uniq-list, $item, list-separator($list)); |
NewerOlder