Skip to content

Instantly share code, notes, and snippets.

Hugo Giraudel HugoGiraudel

View GitHub Profile
@HugoGiraudel
HugoGiraudel / bling.js
Last active Oct 19, 2018 — 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;
@HugoGiraudel
HugoGiraudel / SassMeister-input.scss
Created Feb 8, 2016
Generated by SassMeister.com.
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; }
}
@HugoGiraudel
HugoGiraudel / 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
header:
title: "Hello world!"
@HugoGiraudel
HugoGiraudel / MyCoolComponent.js
Last active Nov 15, 2018
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`).
@HugoGiraudel
HugoGiraudel / SassMeister-input.scss
Created Nov 16, 2015
Generated by SassMeister.com.
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 http://ramdajs.com/docs/#compose Ramda Compose
///
@HugoGiraudel
HugoGiraudel / SassMeister-input.scss
Last active Sep 15, 2015
Generated by SassMeister.com.
View SassMeister-input.scss
// ----
// 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
@HugoGiraudel
HugoGiraudel / SassMeister-input.scss
Created Sep 8, 2015
Generated by SassMeister.com.
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));
@HugoGiraudel
HugoGiraudel / SassMeister-input.scss
Last active Feb 16, 2016
Generated by SassMeister.com.
View SassMeister-input.scss
// ----
// Sass (v3.4.14)
// Compass (v1.0.3)
// ----
////
/// Font-face importer (FFI)
/// @author Hugo Giraudel
////
You can’t perform that action at this time.