Skip to content

Instantly share code, notes, and snippets.

View kaneel's full-sized avatar

Guillaume Richard kaneel

View GitHub Profile
@kaneel
kaneel / ChooseTL.js
Created February 28, 2016 17:04
Some stuff I'm working on
'use strict'
var klass = require('korbutJS/src/class').class
var UID = require('korbutJS/src/UID').UID
var Scene = module.exports.Scene = klass(function(statics, scenes) {
scenes = Object.create(null)
statics.getByUid = function(uid) {
return scenes[uid] && scenes[uid].instance
@kaneel
kaneel / Video.js
Last active January 11, 2019 10:33
Video.js
'use strict'
var Promise = require('korbutJS/src/Promise').Promise
var klass = require('korbutJS/src/ZView').class
var ZView = require('korbutJS/src/ZView').ZView
var Transition = require('korbutJS/src/Transition').Transition
var ClientRect = require('korbutJS/src/ClientRect').ClientRect
var requestAnimationFrame = require("korbutJS/src/dom-utils/requestAnimationFrame").requestAnimationFrame
var _ = require('./utils')
@kaneel
kaneel / kawai_k1m.lua
Created December 30, 2013 12:42
kawai k1m synth definition for renoise guru tool
-- no I didn't type it... I got it from an old C program found at a kawai synth yahoo group
local waveList = {
"Sine 1st",
"Sine 2nd",
"Sine 3rd",
"Sine 4th",
"Sine 5th",
"Sine 6th",
"Sine 7th",
"Sine 8th",
@kaneel
kaneel / events.js
Last active January 11, 2019 10:35
very simple event proto module, with delegation
define("events", ["utils", "dom"], function(utils, dom) {
var events = []
, slice = utils.borrow.slice
function addEvent(/* arguments */) {
var args = slice.call(arguments)
, thisEvent = {}
if(!args[0]._events) {
args[0]._events = []
@kaneel
kaneel / requester.js
Created November 11, 2013 10:59
requester AMD module, avoid you to constantly reselect the same elements from a script to an other.
define("domAdapter-jq", ["jQuery"], function($) {
function get(selector) {
return $(selector)
}
function remove(node) {
node.remove()
}
return {
@kaneel
kaneel / i18n-amd.js
Last active December 20, 2015 01:49
Simple i18n requireJS module for your simple architectures™
/*
You "should" define dict in requireJS path config so you're able, at load, to get the
right lang from wherever you want (lang attribute on <html> tag for example?)
Also, you'll need both text and json plugins for requires.
var config = {
paths: {
dict: "ur/path/to/dictionnary",
i18n: "ur/path/to/i18n"
@kaneel
kaneel / secretwords.js
Created April 30, 2013 09:28
konamimyass :) Replace sicritW with whatever encoded as character numbers you want
;(function(root, $, ns) {
var w = root.window,
d = root.document,
MBX = !!w[ns] ? w[ns] : w[ns] = {},
sicritW = "", // here you put your character table _ already encoded as numbers _
letters = [],
timerINYOFACE = null,
jDoc = $(d);
@kaneel
kaneel / resizeCollection.js
Last active December 16, 2015 19:49
resizeCollection, a tiny helper I've made so we can keep a trace of the resize events. Needs jQuery for its custom events + pub/sub model so you can have one resize event only that will trigger the resize-trigger inside resizeCollection.
;(function(root) {
/*
this module return methods for having resize collections bound to a timer;
use like this:
resizeCollection.register(function, ms)
If ms is null, will push the function to the 500ms timer.
If ms is given, will create a new resize timer.
*/
var lastTimer = 2000,
@kaneel
kaneel / loader.js
Last active December 16, 2015 19:48
le loader.js, an easy to use loader (spinner) factory. Every new loader can be instanciated this way: var myLoader = Loader.methods.register(node, state, type, className) // node is native node, state if 0/1 as hidden/displayed, type depends on the mixin, className for adding special class It also returns some methods like hide / show or whateve…
;
(function(root, $) {
var loaderArray = [],
dummyDiv = document.createElement("div");
var asSimpleLoader = (function() {
var spinner = dummyDiv.cloneNode(true),
make = function() {
this.container.appendChild(spinner.cloneNode(true));
@kaneel
kaneel / console.lol.js
Last active December 16, 2015 19:48
le console lol.
;(function(root) {
var w = root.window;
/*
tiny trick - Le Console
If you use any particular console trick, don't forget to add it in the array :)
*/
var oC = ["log", "warn", "time", "timeEnd"], dummy = function() {}, makeConsole = function(c) {
if (!c) c = {};