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 doQuery = function() { | |
count.exec(function(err, total) { | |
if (err) return sendError('database error', err); | |
query.exec(function(err, items) { | |
if (err) return sendError('database error', err); | |
sendResponse({ |
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 init function takes care of initialisation traditionally done | |
// in a constructor | |
init: function(options) { | |
this.valueSetOnInit = options.valueSetOnInit; | |
}, | |
publicFunction: function() { | |
... |
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
device = function(){ | |
var flags = {}, ua = navigator.userAgent, el = document.createElement('div'), root = document.documentElement, i | |
function flag(names) { | |
root.className += (root.className ? ' ' : '') + names | |
names = names.split(' ') | |
for (i = 0; i < names.length; i++) flags[names[i]] = true | |
} | |
if (ua.indexOf('WebKit/') > -1) flag('webkit') | |
if (ua.indexOf('MSIE ') > -1) flag('msie') | |
if (ua.indexOf('Firefox') > -1) flag('firefox') |
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>jQuery Autocomplete</title> | |
<style> | |
#res { | |
margin: 0px; | |
padding-left: 0px; | |
width: 150px; | |
} |
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
/* | |
* object.watch polyfill | |
* | |
* 2012-04-03 | |
* | |
* By Eli Grey, http://eligrey.com | |
* Public Domain. | |
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. | |
*/ |
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
/** | |
add ability to load json fixtures into jasmine | |
**/ | |
var readJsonFixtures = function() { | |
return jasmine.getJsonFixtures().proxyCallTo_('read', arguments); | |
}; | |
var preloadJsonFixtures = function() { | |
jasmine.getJsonFixtures().proxyCallTo_('preload', arguments); |
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
source :rubygems | |
# We are not loading Active Record, nor Active Resources etc. | |
# We can do this in any app by simply replacing the rails gem | |
# by the parts we want to use. | |
gem "actionpack", "~> 3.2" | |
gem "railties", "~> 3.2" | |
gem "tzinfo" | |
# Let's use thin |
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
AL = function(type, url, callback) { | |
var el, doc = document; | |
switch(type) { | |
case 'js': | |
el = doc.createElement('script'); | |
el.src = url; | |
el.type = 'text/javascript'; | |
el.async = true; | |
break; |
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
#!/bin/bash | |
find . \( -iname '*.rb' -o -iname '*.css' -o -iname '*.js' -o -iname '*.erb' -o -iname '*.html' -o -iname '*.scss' \) -exec wc -l {} + | sort -n |
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
#A better 'I should not see' for Capybara that lets jQuery determine visibility of the text you're looking for. | |
Then /^"([^\"]*)" should not be visible$/ do |text| | |
finder_script = %{ | |
function is_text_visible_on_page(text) { | |
var match = false; | |
$('*:visible') | |
.contents() | |
.filter(function() { | |
//collect text nodes |
NewerOlder