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> | |
<title>Web Workers</title> | |
</head> | |
<body> | |
<script id="worker" type="app/worker"> | |
addEventListener('message', function() { | |
postMessage('What up, sucka.'); |
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
// THE GOAL | |
// Write $('ul').on('click', 'a', fn); in JavaScript | |
// Must support old IE (so no Selectors API (matchesSelector) or anything) | |
// Can you shorten this? | |
var addEvent = (function () { | |
if (window.addEventListener) { | |
return function (el, ev, fn) { | |
el.addEventListener(ev, fn, false); | |
}; |
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> | |
<title>All Items in a Collection</title> | |
<style> | |
li { | |
list-style: none; | |
float: left; | |
} | |
</style> |
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
<!-- Prompt IE6 users to install Chrome Frame --> | |
<!--[if lt IE 7 ]> | |
<script src="//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js"></script> | |
<script>window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})</script> | |
<![endif]--> |
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 addEvent = (function () { | |
var filter = function(el, type, fn) { | |
for ( var i = 0, len = el.length; i < len; i++ ) { | |
addEvent(el[i], type, fn); | |
} | |
}; | |
if ( document.addEventListener ) { | |
return function (el, type, fn) { | |
if ( el && el.nodeName || el === window ) { | |
el.addEventListener(type, fn, false); |
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
.grid-overlay:before { | |
content: ""; | |
position: fixed; | |
background-color: rgba(34,102,153,0.5); | |
background: -webkit-linear-gradient(skyblue 2px, transparent 2px), -webkit-linear-gradient(0, skyblue 2px, transparent 2px), -webkit-linear-gradient(skyblue 1px, transparent 1px), -webkit-linear-gradient(0, skyblue 1px, transparent 1px); | |
background: -moz-linear-gradient(skyblue 2px, transparent 2px), -moz-linear-gradient(0, skyblue 2px, transparent 2px), -moz-linear-gradient(skyblue 1px, transparent 1px), -moz-linear-gradient(0, skyblue 1px, transparent 1px); | |
background: -o-linear-gradient(skyblue 2px, transparent 2px), -o-linear-gradient(0, skyblue 2px, transparent 2px), -o-linear-gradient(skyblue 1px, transparent 1px), -o-linear-gradient(0, skyblue 1px, transparent 1px); | |
background: -ms-linear-gradient(skyblue 2px, transparent 2px), -ms-linear-gradient(0, skyblue 2px, transparent 2px), -ms-linear-gradient(skyblue 1px, transparent 1px), -ms-linear-gradient(0, skyblue 1px, transparent 1px); | |
background |
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
presentation | |
.title('My Great Presentation') | |
.slide({ | |
title: 'Learn About Borders', | |
bullets: [ | |
'Thing 1', | |
'Thing 2', | |
], | |
code: ['path/to/file.css', [2,4]] // path to file, lines to grab |
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
// Very simple. Just handles the process of | |
// display an unordered list of movies, | |
// while providing the ability to edit each movie | |
// and update the model. | |
// Any glaring bad practices? Still in the early | |
// Backbone learning stages. | |
(function(Movie) { |
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
// Fun little quiz | |
Assuming this string: "January 5th, 2012" | |
In the shortest amount of code possible, place: | |
- 'January' within a $month variable | |
- '5th' within a $day variable | |
- '2012' within a $year variable. |
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
<?php | |
$template = "I am {{name}}, and I work for {{company}}. I am {{age}}."; | |
# Your template tags + replacements | |
$replacements = array( | |
'name' => 'Jeffrey', | |
'company' => 'Envato', | |
'age' => 27 | |
); |