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:4106747
Created November 18, 2012 18:41
Craft.js : Draggable element
;(function(){
function createTransitionObject(transition) {
var obj = {
"-webkit-transition": transition,
"MozTransition": transition,
"OTransition": transition,
"transition": transition
}
@bloodyowl
bloodyowl / gist:4131714
Created November 22, 2012 15:27
globals check
(function(k,l,r,m,i,e,c,o,g){
for(i in window) k.push(i)
e = document.createElement("iframe")
e.style.display = "none"
document.body.appendChild(e)
c = e.contentWindow
for(o in c) l.push(o)
for(g=k.length;m < g;m++) if(!~l.indexOf(k[m])) r.push(k[m])
return r
})([],[],[],0)
@bloodyowl
bloodyowl / README.md
Created November 26, 2012 12:19
String#compile

String#compile

Has been added in Craft.js 1.1.7

Note : Uses Craft.js

Description

Fills placeholders in a string with data.

@bloodyowl
bloodyowl / gist:4173172
Created November 30, 2012 01:37
String#extract
/* relies on Craft.js */
Object.extend(String.prototype, {
extract : function (context){
return this.split(".").fold(function(a,b){ if(a) return b in a ? a[b] : undefined}, context || window )
}
})
"document.body".extract() // HTMLBodyElement
"document.body.foo.bar.baz".extract() // undefined
@bloodyowl
bloodyowl / index.htm
Created December 1, 2012 15:43 — forked from kunalvarma05/index.htm
AJAX Contact Form with PHP
<!DOCTYPE HTML>
<html>
<head>
<title>Welcome to my Website</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="send.js"></script>
</head>
<body>
<h1>A Simple AJAX Contact Form</h1>
<form method="post" action="" id="contact_form">
@bloodyowl
bloodyowl / gist:4189965
Created December 2, 2012 17:16
umad.js
(function(){
function umad(){while(true) alert("umad"); umad()}
window.onbeforeunload = umad
umad()
})()
@bloodyowl
bloodyowl / README.md
Created December 3, 2012 14:40
Simple Event delegation in CraftJS

Simple event delegation Craft.js

Description

Simple event delagation plugin.

Usage

Syntaxes

;(function(){
var foo = synchronousRequestInit
, bar = synchronousRequestInit
, fooResponse
, barResponse
, i = false
, interval
window.setTimeout(function(){
@bloodyowl
bloodyowl / gist:4259043
Created December 11, 2012 14:44
Simple Defer
;(function(){
var slice = [].slice
function push(array, value, length, callback){
var currentLength = array.push(value)
, self = this
if(currentLength === length) self.result = callback.apply(null, array)
}
@bloodyowl
bloodyowl / gist:4340751
Last active April 20, 2016 17:53
Smallest HTML5 shim ever

Smallest HTML5 shim ever

130 bytes, that's what it takes.

Script

"header footer section aside nav article figure figcaption hgroup time main".replace(/\w+/g,function(a){document.createElement(a)})