Skip to content

Instantly share code, notes, and snippets.

Avatar

Nicolas Carlo nicoespeon

View GitHub Profile
@nicoespeon
nicoespeon / dabblet.css
Created Apr 11, 2013
dabblet use example
View dabblet.css
.block {
text-align: justify;
background-color: #DDD;
border: 2px black solid;
border-radius: 10px;
}
.lightbox {
width: 90px;
@nicoespeon
nicoespeon / compressor.rb
Last active Dec 16, 2015 — forked from mytharcher/compressor.rb
A jekyll plugin for compressing HTML, JavaScript files when rendering.
View compressor.rb
#
# File compressor plugin for jekyll
# =================================
#
# By [mytharcher](https://github.com/mytharcher)
# 2012-05-20
#
# Updated by [nicoespeon](https://github.com/nicoespeon)
# 2013-04-12
#
View dabblet.css
@-keyframes reveal {
0% {
left: 0;
}
100% {
left: 100%;
}
}
.container {
position: relative;
@nicoespeon
nicoespeon / category_pagination.rb
Last active Apr 27, 2017
Per category pagination Jekyll 1.5.1
View category_pagination.rb
# Per-category pagination. Useful for multilingual blogs =)
# It will react, regarding your configuration in `config.yml`:
#
# paginate_per_category: true|false - activate this pagination or keep the
# default one
# default_category: "en" - determine the default category if you
# wish the root pagination to be this one
module Jekyll
module Generators
class Pagination < Generator
View side-effects-fp.js
/**
* Tu ne peux pas ne pas avoir d’effets de bord, sinon il ne se passe absolument rien.
*
* En revanche, la prog fonctionnelle préconise de limiter ça au maximum.
*
* Du coup c’est possible de le faire, mais généralement l’effet de bord qui log est isolé à un seul endroit (= une fonction impure).
*
* Il est assez simple de transformer une fonction impure en fonction pure : il suffit de l’englober dans une closure.
**/
function impure$ () {
@nicoespeon
nicoespeon / plopfile.js
Last active Mar 23, 2016
Blog - Plop — a micro-generator to ease your daily life - setGenerator
View plopfile.js
module.exports = ( plop ) => {
// We declare a new generator called "module"
plop.setGenerator( "module", {
// Succintly describes what generator does.
description: "Create a new module",
// Get inputs from the user.
// That's Inquirer.js doing the job behind the hood.
@nicoespeon
nicoespeon / plopfile.js
Last active Mar 23, 2016
Blog - Plop — a micro-generator to ease your daily life - prompts
View plopfile.js
import {trimRight, isEmpty} from "lodash";
const ensurePlural = ( text ) => trimRight( text, "s" ) + "s";
const isNotEmptyFor = ( name ) => {
return ( value ) => {
if ( isEmpty( value ) ) return name + " is required";
return true;
}
}
@nicoespeon
nicoespeon / plopfile.js
Last active Mar 23, 2016
Blog - Plop — a micro-generator to ease your daily life - concrete example
View plopfile.js
const modulePath = "app/modules/{{camelCase name}}.js";
module.exports = ( plop ) => {
plop.setGenerator( "model", {
// …
actions: [
// Add a new model + tests boilerplate.
@nicoespeon
nicoespeon / model.js
Last active Mar 23, 2016
Blog - Plop — a micro-generator to ease your daily life - plop-template
View model.js
/**
* TODO - Describe what your model does.
*
* @class {{pascalCase name}}.Model
* @module {{pascalCase name}}
* @constructor
*/
import {Model} from "backbone";
export default Model.extend( {
@nicoespeon
nicoespeon / calendars.model.js
Last active Mar 23, 2016
Blog - Plop — a micro-generator to ease your daily life - calendars.model result
View calendars.model.js
/**
* TODO - Describe what your model does.
*
* @class Calendars.Model
* @module Calendars
* @constructor
*/
import {Model} from "backbone";
export default Model.extend( {
You can’t perform that action at this time.