Skip to content

Instantly share code, notes, and snippets.

View KittyGiraudel's full-sized avatar
🐈

Kitty Giraudel KittyGiraudel

🐈
View GitHub Profile
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
@KittyGiraudel
KittyGiraudel / bling.js
Last active September 29, 2019 03:33 — forked from paulirish/bling.js
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
};
NodeList.prototype.__proto__ = Array.prototype;
@KittyGiraudel
KittyGiraudel / SassMeister-input.scss
Created February 8, 2016 14:47
Generated by SassMeister.com.
// ----
// Sass (v3.4.21)
// Compass (v1.0.3)
// ----
/// Map of breakpoints
/// @type Map
$breakpoints: (
'small': '(min-width: 860px)',
'medium': '(min-width: 1000px)',
/// 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; }
}
@KittyGiraudel
KittyGiraudel / en.yml
Last active February 24, 2018 10:46
Here is an easy way to handle i18n in a Jekyll website.
# _data/en.yml
header:
title: "Hello world!"
@KittyGiraudel
KittyGiraudel / MyCoolComponent.js
Last active January 1, 2021 07:24
A simple textarea + counter component, fully commented for React beginners. :)
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.
//
// 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`).
@KittyGiraudel
KittyGiraudel / SassMeister-input.scss
Created November 16, 2015 14:58
Generated by SassMeister.com.
// ----
// 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
///
@KittyGiraudel
KittyGiraudel / SassMeister-input.scss
Last active September 15, 2015 09:12
Generated by SassMeister.com.
// ----
// 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
@KittyGiraudel
KittyGiraudel / SassMeister-input.scss
Created September 8, 2015 11:50
Generated by SassMeister.com.
// ----
// 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));