Skip to content

Instantly share code, notes, and snippets.

View bebraw's full-sized avatar

Juho Vepsäläinen bebraw

View GitHub Profile
@bebraw
bebraw / structure.md
Last active December 11, 2015 14:58

JS Developer's Survival Guide

  • Welcome to the Jungle - Guns N' Roses - jungle.asyncjs.com
  • JavaScript Garden?
  • Special Features
    • Hoisting (scope!)
    • Closures (and how to get most out of those)
    • Prototypes (vs. classes as in Java etc.)
    • ???
  • Common Problems
@bebraw
bebraw / 3-colorpickers.yml
Created December 5, 2012 19:06
Color picker blog post
type: rating
title: JavaScript Color Pickers
user: bebraw
slug: javascript-color-pickers
includes: [nativeColorPicker, colorjoe, Flexi Colorpicker, SimpleColor, ExColor, JavaScript Colorpicker, Farbtastic, mooRainbow, jPicker]
body: |
If you are building an application that deals with graphics somehow, you are likely going to need a color picker. Fortunately
there are quite a few of those available for JavaScript. HTML5 includes `color` input type even. One color picker, aptly
named `nativeColorPicker`, provides a shim for Internet Explorer so that you have got all bases covered. Other pickers
available are more specialized.
@bebraw
bebraw / chunk.js
Created November 28, 2012 16:02
Type annotations + QC
define(['../common/annotate', '../math/range', '../functional/map', '../operators/gt'], function(annotate, range, map, gt) {
function chunk(len, a) {
return map(function(k) {
return a.slice(k, k + len);
}, range(0, a.length, len));
}
return annotate(chunk, gt(0), Array);
});
@bebraw
bebraw / mocha.js
Created November 21, 2012 07:21
Mocha vs. suite.js
// https://github.com/visionmedia/mocha
var assert = require("assert");
describe('Array', function(){
describe('#indexOf()', function(){
it('should return -1 when the value is not present', function(){
assert.equal(-1, [1,2,3].indexOf(5));
assert.equal(-1, [1,2,3].indexOf(0));
})
})
@bebraw
bebraw / Bugira.user.js
Created October 3, 2012 19:52
Bugira user script (expects jQuery to be found)
// ==UserScript==
// @name Bugira Script
// @namespace http://use.i.E.your.homepage/
// @version 0.55
// @description injects bugira script
// @match http://jswiki.codegyre.com/*
// @copyright 2012+, You
// ==/UserScript==
// http://stackoverflow.com/questions/2246901/how-can-i-use-jquery-in-greasemonkey-scripts-in-google-chrome
@bebraw
bebraw / my_effect.c
Created September 25, 2012 20:43
Custom Data Specification
struct {
uint8_t fac;
uint8_t fac2;
} params;
struct {
xyz_t xyz[10];
} vars;
... // effect def etc.
http://designinghypermediaapis.com/
http://www.udacity.com/overview/Course/ep245/CourseRev/1
http://www.ashmaurya.com/
http://jswiki.org/
@bebraw
bebraw / assembly.lss
Created September 20, 2012 15:23
commit id: 10e193a45040acf826aa9b6e15382410baccfe9d
build/release/firmware.elf: tiedostomuoto elf32-avr
Lohkot:
Ind Nimi Koko VirMuisOs LatMuisOs TiedSiir Tasaus
0 .data 00000010 00800100 0000153a 000015ee 2**0
CONTENTS, ALLOC, LOAD, DATA
1 .text 0000153a 00000000 00000000 000000b4 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .bss 0000066f 00800110 00800110 000015fe 2**0
@bebraw
bebraw / licensify.py
Created September 13, 2012 15:55
Tiny licensifier script
#!/usr/bin/env python
import os
def walk(path, extensions, cb):
path = os.path.abspath(path)
for f in os.listdir(path):
fp = os.path.join(path, f)
p, ext = os.path.splitext(f)
@bebraw
bebraw / fx.js
Created July 21, 2012 18:44
Quick fx description
effects = { // note that this is supposed to be ordered dict! (alternative, use list + name prop)
sine: {
init: function() {...},
exec: function() {...},
},
gameOfLife: {
init: function() {...},
exec: function() {...},
accumulate: true // defaults to false
},