Skip to content

Instantly share code, notes, and snippets.

@naholyr
naholyr / jeu.sh
Last active August 29, 2015 14:11
gnome-terminal --zoom=5 -e ~/bin/tts.sh
@naholyr
naholyr / README.md
Last active August 29, 2015 14:10
React trivial keys

See the discussion

Before (not good):

return <ul>{ paragraphs.map(p => <li>{ p }</li>) }</ul>;
// Each child in an array should have a unique "key" prop. Check the render method of RoomSpace. See http://fb.me/react-warning-keys for more information.

Uglier (not sure better):

console.log(JSON.stringify(pathsToTree([
"a/b",
"a/c/d",
"e"
]), null, " "));
/*
{
"e": null,
"a": {
@naholyr
naholyr / Makefile
Last active March 6, 2018 17:02
browserify-friendly Makefile
# Main entry point
SOURCE = src/app.js
# The dependencies (other than node_modules/**)
LIBS = $(shell ls src/lib/*.js src/components/*.js)
# The target
TARGET = build/app.js
# Compilation flags
function defer () {
var _resolve, _reject;
var promise = new Promise(function (resolve, reject) {
_resolve = resolve;
_reject = reject;
});
return {
"promise": promise,
@naholyr
naholyr / fixtures.js
Created September 8, 2014 15:26
My usual fixtures loader
// TODO comments (lol)
"use strict";
/**
Usage:
- Put your data in data.json
- Require from your test files `var fixtures = require('./path/to/fixtures')
- Load and clear with `before(fixtures.clear)`, `before(fixtures.load)`, `after(fixtures.clear)`
@naholyr
naholyr / index.js
Created September 8, 2014 15:20
My usual nconf wrapper
"use strict";
/**
Save as config/index.js
Config files =
- config/config.json
- config/config.$NODE_ENV.json
- config/config.$NODE_ENV.$USER.json
**/
@naholyr
naholyr / .gitignore
Last active October 29, 2020 21:46
res.redirect not working as expected
node_modules
@naholyr
naholyr / _README.md
Last active December 5, 2023 23:37
Chrome extension exposing JS API

Install

Clone the repo and drop the folder into "chrome://extensions" page.

Use

Open any web page ("about:blank" will work too) and a console, then inspect and play with MY_API global variable.

@naholyr
naholyr / editors.md
Last active August 29, 2015 14:05
Mon ressenti sur les éditeurs

Contexte

Pour du web (HTML/JS/CSS) + Node sous Ubuntu.

Actuellement : SublimeText, mais pas de visibilité sur le futur du projet (d'où recherche d'alternative).

Challengers