Skip to content

Instantly share code, notes, and snippets.

View ooflorent's full-sized avatar

Florent Cailhol ooflorent

  • Toulouse, France
  • 18:32 (UTC +01:00)
  • X @ooflorent
View GitHub Profile
@alecthomas
alecthomas / entityx_tx2.cc
Last active May 17, 2016 10:26
Parallel EntityX prototype
#include <utility>
#include <thread>
#include <limits>
#include <algorithm>
#include <cassert>
#include <vector>
#include <cstdint>
#include <iostream>
#include <mutex>
#include <future>
@gaearon
gaearon / slim-redux.js
Last active May 5, 2024 15:14
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
@alexkirsz
alexkirsz / ForceCaseSensitivityPlugin.js
Last active February 23, 2017 13:38
Force case sensitivity in webpack
/*
The MIT License (MIT)
Copyright (c) 2015 Alexandre Kirszenberg
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTI
@ooflorent
ooflorent / instance-const.js
Last active August 29, 2015 14:14
Research about instance constants
function Obj(x) {
if (typeof x !== 'number') throw new Error()
Object.defineProperty(this, 'x', {value: x})
}
var a = new Obj(1)
var b = new Obj(2)
// Do `a` and `b` have the same hidden class in v8?
//
var Errors = Reflux.createActions(['error1', 'error2' /*, 'error3' */]);
var ErrorNotificationStore = Reflux.createStore({
init: function() {
_.each(Errors, function(action) {
this.listenTo(action, this.onError);
}, this);
},
onError: function(errorMessage) {
/* whatever you want to do with errorMessage and this.trigger(...) */
@spoike
spoike / webapi_example.js
Last active May 12, 2017 13:37
Simple WebAPI example
var PostsApi = require('webapi/posts'),
// assuming the api object from the jsbin snippet
Reflux = require('reflux');
var PostActions = createActions(["load", "loadError"]);
// load action is invoked either from:
// * top most component's componentDidMount
// function in your application, or
// * window.onLoad
// I prefer the first strategy because that'll
@ooflorent
ooflorent / README.md
Last active August 29, 2015 14:05
Awesome minify
@ooflorent
ooflorent / README.md
Last active August 29, 2015 14:05
Simple cursor selection

cursor

Change your mouse cursor without pain.

New API

var cursor = require('./cursor2');

cursor(); // Use 'default'
@ooflorent
ooflorent / LICENSE
Last active April 18, 2018 03:55
Seeded random number generator
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2014 Florent Cailhol <https://github.com/ooflorent>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@ooflorent
ooflorent / LICENSE
Last active August 29, 2015 14:05
Helper for `requestAnimationFrame`
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2014 Florent Cailhol <https://github.com/ooflorent>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE