This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (global, doc) { | |
// expose a function to recieve data via JSONP | |
global.getBattle = function getBattle (data) { | |
// calculate ranks of songs. ("questions" are songs) | |
var rankedData = rankData(data.reply.battle.questions); | |
// make the data more readable... | |
var sanetizedData = sanetizeData(rankedData); | |
// do stuff with sanetizedData here... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alert('hello, world'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
body { | |
margin: 40px; | |
} | |
a { | |
display: inline-block; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2>{{name}}</h2> | |
<ul> | |
{{#subItems}} | |
<li> | |
Sub Item name: {{name}} | |
Parent Item name: {{?!}} | |
parent name is inaccessible since the subItem has a name property :( | |
how is this not a common use case? | |
</li> | |
{{/subItems}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (doc) { | |
var parent = doc.documentElement, | |
rect = parent.getBoundingClientRect(), | |
canvas = doc.createElement("canvas"), | |
context = canvas.getContext("2d"), | |
max = 0, rects = []; | |
canvas.width = rect.width; | |
canvas.height = rect.height; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
document.location of the current page tested against a url (string) like: | |
"pages/page.html" // false | |
"../pages/page.html" // false | |
"/pages/page.html" // false | |
"//foo.bar.com/pages/page.html" // false | |
"http://foo.bar.com/pages/page.html" // false | |
"//bar.com/pages/page.html" // true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alert("hello world"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dom = function (selector) { | |
var element, props, el, | |
id, className, attributes, | |
attribute, name, value, i; | |
while (selector.length > 1) { | |
props = selector.match(/(?:\s|^)([^.#\[\s]+|)(#[^.\[\s]+|)((?:\.[^.\[\s]+)+|)((?:\[[^\]]+\])+|)$/); | |
el = document.createElement(props && props[1] || "div"); | |
if (element) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
div { | |
margin: 10px; | |
min-height: 20px; | |
padding: 2px; | |
} | |
span { | |
margin: 2px; | |
} | |
div { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.body.appendChild(document.createElement("div")).innerHTML = "<svg><filter id='#'><feGaussianBlur stdDeviation='3'/></filter></svg>"; | |
document.body.style.filter = "url(#\#)"; |
OlderNewer