Skip to content

Instantly share code, notes, and snippets.


Kitty Giraudel KittyGiraudel

View GitHub Profile
View npm-audit.js
const { exec } = require('child_process')
const { promisify } = require('util')
const chalk = require('chalk')
// See:
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 / bling.js
Last active Sep 29, 2019 — forked from paulirish/bling.js
bling dot js
View bling.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 / SassMeister-input.scss
Created Feb 8, 2016
Generated by
View SassMeister-input.scss
// ----
// 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 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 / en.yml
Last active Feb 24, 2018
Here is an easy way to handle i18n in a Jekyll website.
View en.yml
# _data/en.yml
title: "Hello world!"
KittyGiraudel / MyCoolComponent.js
Last active Jan 1, 2021
A simple textarea + counter component, fully commented for React beginners. :)
View MyCoolComponent.js
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
// 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 / SassMeister-input.scss
Created Nov 16, 2015
Generated by
View SassMeister-input.scss
// ----
// libsass (v3.2.5)
// ----
/// Performs right-to-left function composition.
/// The rightmost function may have any arity;
/// the remaining functions must be unary.
/// @see Ramda Compose
KittyGiraudel / SassMeister-input.scss
Last active Sep 15, 2015
Generated by
View SassMeister-input.scss
// ----
// libsass (v3.2.5)
// ----
/// Replace `$search` with `$replace` in `$string`
/// @author Hugo Giraudel
/// @link Original gist
/// @param {String} $string - Initial string
/// @param {String} $search - Substring to replace
/// @param {String} $replace ('') - New value
KittyGiraudel / SassMeister-input.scss
Created Sep 8, 2015
Generated by
View SassMeister-input.scss
// ----
// 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));