Skip to content

Instantly share code, notes, and snippets.

Nicolas Carlo nicoespeon

Block or report user

Report or block nicoespeon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nicoespeon
nicoespeon / result.csv
Last active Jul 5, 2019
Pubweb Social Analysis
View result.csv
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
"contributor";"path";"size"
"Benoit Zohar";"modules/checkout/";19690
"Michael Vial";"modules/results/";13207
"Victor Mus";"modules/search/";6587
"Nicolas Carlo";"modules/route/";5485
"Benoit Zohar";"modules/purchase/";5121
"Nicole Ho";"modules/purchase-confirmation/";4936
"Nicolas Carlo";"modules/partner/";4606
"Nicole Ho";"modules/header/";4437
"Benoit Zohar";"modules/help/";4319
@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
@nicoespeon
nicoespeon / observables-second-shot.js
Last active Mar 23, 2017
Blog - Using Observables to make our app work with barcode scanners
View observables-second-shot.js
const MAX_INTERVAL_BETWEEN_EVENTS_IN_MS = 50
const keyCode$ = Rx.Observable.fromEvent(document, "keypress")
.pluck('keyCode')
const keyCodesBuffer$ = keyCode$
// --(43)-(64)----(32)-----(65)-(77)-(13)--->
.buffer(keyCode$.debounce(MAX_INTERVAL_BETWEEN_EVENTS_IN_MS))
// --([43,64])----([32])-----([65,77,13])--->
@nicoespeon
nicoespeon / observables-third-shot.js
Last active Mar 23, 2017
Blog - Using Observables to make our app work with barcode scanners
View observables-third-shot.js
const ENTER_KEY_CODE = 13
const MAX_INTERVAL_BETWEEN_EVENTS_IN_MS = 50
const keyCode$ = Rx.Observable.fromEvent(document, "keypress")
.pluck('keyCode')
const keyCodesBuffer$ = keyCode$
.buffer(keyCode$.debounce(MAX_INTERVAL_BETWEEN_EVENTS_IN_MS))
.filter(isFromScan)
@nicoespeon
nicoespeon / observables-fourth-shot.js
Last active Mar 23, 2017
Blog - Using Observables to make our app work with barcode scanners
View observables-fourth-shot.js
const ENTER_KEY_CODE = 13
const MAX_INTERVAL_BETWEEN_EVENTS_IN_MS = 50
const keyCode$ = Rx.Observable.fromEvent(document, "keypress")
.pluck('keyCode')
const keyCodesBuffer$ = keyCode$
.buffer(keyCode$.debounce(MAX_INTERVAL_BETWEEN_EVENTS_IN_MS))
.filter(isFromScan)
@nicoespeon
nicoespeon / observables-first-shot.js
Last active Mar 22, 2017
Blog - Using Observables to make our app work with barcode scanners
View observables-first-shot.js
const keyCode$ = Rx.Observable.fromEvent(document, "keypress")
// ---(ev)--(ev)--------(ev)--->
.pluck('keyCode')
// ---(43)--(51)--------(13)--->
@nicoespeon
nicoespeon / imperative-first-shot.js
Last active Mar 21, 2017
Blog - Using Observables to make our app work with barcode scanners
View imperative-first-shot.js
const ENTER_KEY_CODE = 13
let keyCodesBuffer = []
document.addEventListener("keypress", (event) => {
const keyCode = event.keyCode
if(keyCode === ENTER_KEY_CODE) {
fillInputWithKeyCodesBuffer()
cleanBuffer()
} else {
@nicoespeon
nicoespeon / imperative-second-shot.js
Last active Mar 21, 2017
Blog - Using Observables to make our app work with barcode scanners
View imperative-second-shot.js
const ENTER_KEY_CODE = 13
const MAX_INTERVAL_BETWEEN_EVENTS_IN_MS = 50
let keyCodesBuffer = []
document.addEventListener("keypress", (event) => {
const keyCode = event.keyCode
if(keyCode === ENTER_KEY_CODE) {
fillInputWithKeyCodesBuffer()
cleanBuffer()
@nicoespeon
nicoespeon / imperative-third-shot.js
Created Mar 21, 2017
Blog - Using Observables to make our app work with barcode scanners
View imperative-third-shot.js
const ENTER_KEY_CODE = 13
const MAX_INTERVAL_BETWEEN_EVENTS_IN_MS = 50
let keyCodesBuffer = []
let cleanBufferTimeout
document.addEventListener("keypress", (event) => {
const keyCode = event.keyCode
stopCleanBufferTimeout()
if(keyCode === ENTER_KEY_CODE) {
@nicoespeon
nicoespeon / ExportToCsv.js
Last active Dec 4, 2016
Blog - How I implemented a download button with Cycle.js - ExportToCsv driver
View ExportToCsv.js
import R from 'ramda';
// Export a driver to be used in our Cycle.js app.
// It takes an `input$` stream that contains `data` to be download.
function exportToCSVDriver(input$) {
// `data` should be formatted as an Array of Arrays (= lines of CSV).
// -> `[["name1", "city1", "other info"], ["name2", "city2", "more info"]]`
input$.subscribe((data) => {
// Parse data to create a CSV file.
// See: http://stackoverflow.com/questions/14964035/how-to-export-javascript-array-info-to-csv-on-client-side
You can’t perform that action at this time.