Skip to content

Instantly share code, notes, and snippets.

View elijahmanor's full-sized avatar
😀

Elijah Manor elijahmanor

😀
View GitHub Profile
@elijahmanor
elijahmanor / gist:1686794
Created January 27, 2012 03:22 — forked from showell/gist:1663926
object creation pattern
( ( logger, $ ) ->
logContainer = null
write = ( msg ) -> logContainer.append "<p>#{ msg }</p>"
logger.init = ( el ) -> logContainer = el
logger.log = ( msg ) -> write msg
) window.logger = window.logger || {}, jQuery
@elijahmanor
elijahmanor / skype-emoticon-restaurant.js
Created January 27, 2012 05:48
Skype-enabled JavaScript Restaurant
var restaurant = (function($) {
var pub = {},
menu = [ "(pi)", "(^)" ],
drinks = [ "(coffee)", "(beer)", "(d)" ];
pub.eat = function(call) {
if ( call === "(pi)" ) {
console.log( "(happy)" );
} else if ( call === "(^)" ) {
console.log( "(party)" );
@elijahmanor
elijahmanor / _snippet.html
Created January 30, 2012 04:37
Find the jQuery Bug #3: Problem
<div id="dialog-modal">Hello World</div>
@elijahmanor
elijahmanor / _snippet.html
Created January 30, 2012 05:32
Find the jQuery Bug #3: Solution
<div id="dialog-modal">Hello World</div>
@elijahmanor
elijahmanor / fiddle.html
Created January 31, 2012 05:31
jQuery Private Data Should Stay Private
<!DOCTYPE html>
<html>
<head>
<script class="jsbin" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
@elijahmanor
elijahmanor / _snippet.html
Created February 6, 2012 04:51
Differences Between jQuery .bind() vs .live() vs .delegate() vs .on() Methods
<ul id="members" data-role="listview" data-filter="true">
<!-- ... more list items ... -->
<li>
<a href="detail.html?id=10">
<h3>John Resig</h3>
<p><strong>jQuery Core Lead</strong></p>
<p>Boston, United States</p>
</a>
</li>
<!-- ... more list items ... -->
@elijahmanor
elijahmanor / emailPattern.coffee
Created February 8, 2012 05:37
Regular Expressions in CoffeeScript
emailPattern = /// ^ #begin of line
([\w.-]+) #one or more letters, numbers, _ . or -
@ #followed by an @ sign
([\w.-]+) #then one or more letters, numbers, _ . or -
\. #followed by a period
([a-zA-Z.]{2,6}) #followed by 2 to 6 letters or periods
$ ///i #end of line and ignore case
if "[email protected]".match emailPattern
console.log "E-mail is valid"
@elijahmanor
elijahmanor / _snippet.html
Created February 9, 2012 04:50
Find the jQuery Bug #4: Problem
<ul id="menu">
<li><a href="#">Browsers</a>
<ul>
<li><a href="#">Firefox</a></li>
<li><a href="#">Google Chrome</a></li>
<li><a href="#">Internet Explorer</a></li>
<li><a href="#">Opera</a></li>
<li><a href="#">Safari</a></li>
</ul>
</li>
@elijahmanor
elijahmanor / _snippet.html
Created February 9, 2012 06:06
Find the jQuery Bug #4: Solution
<ul id="menu">
<li><a href="#">Browsers</a>
<ul>
<li><a href="#">Firefox</a></li>
<li><a href="#">Google Chrome</a></li>
<li><a href="#">Internet Explorer</a></li>
<li><a href="#">Opera</a></li>
<li><a href="#">Safari</a></li>
</ul>
</li>
@elijahmanor
elijahmanor / fiddle.css
Created February 15, 2012 13:18
jQuery Mobile Form Validation
label.error {
color: red;
font-size: 16px;
font-weight: normal;
line-height: 1.4;
margin-top: 0.5em;
width: 100%;
float: none;
}