Skip to content

Instantly share code, notes, and snippets.

View bloodyowl's full-sized avatar
🦉

Matthias Le Brun bloodyowl

🦉
View GitHub Profile
@bloodyowl
bloodyowl / gist:9683838
Created March 21, 2014 11:01
hodor spec

hodor spec

0. key concepts

  • all hodor belong the the hodor scope
  • everything is a hodor
  • hodor are first-class citizens

1. the hodor operator

@bloodyowl
bloodyowl / gist:9763492
Created March 25, 2014 14:55
glurnt.js
var glurnt = require("gulp")
, uglify = require("gulp-uglify")
glurnt.task("k", function(){
return glurnt.src("foo/**")
.pipe(uglify())
.pipe(glurnt.dest("dist/foo"))
})
@bloodyowl
bloodyowl / gist:9769514
Last active August 29, 2015 13:57
noThis
var splice = [].splice
, baseClass = {
create : function(){
return Object.create(this)
},
method : function(name, fn){
Object.defineProperty(this, name, {
writable : true,
configurable : true,
enumerable : false,
@bloodyowl
bloodyowl / light.md
Created April 2, 2014 19:16
lightweight specifications draft

navigation

events

click : menu item

Opens the subNav block. Should use a transition.

click : subnav close icon

@bloodyowl
bloodyowl / app.js
Created April 12, 2014 10:14
cornea real-world example
module.exports = require("bloody-events").create()
function toUnicode(string) {
var index = -1
var length = string.length
var chars = []
var item
while(++index < length) {
item = string.charCodeAt(index).toString(16).toUpperCase()
item = "\\u" + Array(5 - item.length).join("0") + item
chars.push(item)
}
@bloodyowl
bloodyowl / index.js
Created June 24, 2014 20:33
requirebin sketch
var stream = require("bloody-stream")
var concat = require("bloody-stream/lib/concat")
var escapeRE = /([.*+?^=!:$(){}|[\]\/\\])/g
var mapEscape = function(string){
return string.replace(escapeRE, "\\$1")
}
var tilde = function(words){
var wordsRE = RegExp("\\b" + words.map(mapEscape).join("\\b|\\b") + "\\b", "g")
return stream.create(function(chunk){
if(!wordsRE.test(chunk)) {
@bloodyowl
bloodyowl / index.js
Created August 1, 2014 16:20
requirebin sketch
var promise = require("bloody-promise")
var log = function(string){
document.body.appendChild(document.createTextNode(string))
document.body.appendChild(document.createElement("br"))
}
var mapAsync = function(array, fn){
var index = -1
var length = array.length
var promises = []
@bloodyowl
bloodyowl / index.js
Created August 12, 2014 09:59
requirebin sketch
var klass = require("bloody-class")
var myClass = klass.extend({
get : function(){
return "deep"
}
})
.extend({
get : function(){
return "shallow"
@bloodyowl
bloodyowl / gist:00a533f3aa277d217c92
Created September 12, 2014 09:25
simple selector
var nativeSlice = Array.prototype.slice
var CAN_SLICE_NODELISTS = function(){
try {
nativeSlice.call(document.documentElement.children)
return true
} catch(e){
return false
}
}()
var ACCEPTED_NODETYPES = {