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>Remove rubberband scrolling from web apps on mobile safari (iOS)</title> | |
<meta name="apple-mobile-web-app-capable" content="yes"> | |
<meta name="apple-touch-fullscreen" content="yes"> | |
<meta id="extViewportMeta" name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"> | |
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script> | |
<style> | |
html, body {margin: 0; padding: 0; overflow: hidden} |
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
autoSizeText = -> | |
elements = $('.resize') | |
return if elements.length < 0 | |
for el in elements | |
do (el) -> | |
resizeText = -> | |
elNewFontSize = (parseInt($(el).css('font-size'), 10) - 1) | |
$(el).css('font-size', elNewFontSize) | |
resizeText() while el.scrollHeight > el.offsetHeight |
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
/** | |
* Converts an RGB color value to HSL. Conversion formula | |
* adapted from http://en.wikipedia.org/wiki/HSL_color_space. | |
* Assumes r, g, and b are contained in the set [0, 255] and | |
* returns h, s, and l in the set [0, 1]. | |
* | |
* @param Number r The red color value | |
* @param Number g The green color value | |
* @param Number b The blue color value | |
* @return Array The HSL representation |
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
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript | |
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); |
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
$.fn.autoSizr = function () { | |
var el, elements, _i, _len, _results; | |
elements = $(this); | |
if (elements.length < 0) { | |
return; | |
} | |
_results = []; | |
for (_i = 0, _len = elements.length; _i < _len; _i++) { | |
el = elements[_i]; | |
_results.push((function(el) { |
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
angular.module('qAllSettled', []).config(function($provide) { | |
$provide.decorator('$q', function($delegate) { | |
var $q = $delegate; | |
$q.allSettled = function(promises) { | |
return $q.all(promises.map(function(promise) { | |
return promise.then(function(value) { | |
return { state: 'fulfilled', value: value }; | |
}, function(reason) { | |
return { state: 'rejected', reason: reason }; | |
}); |
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
app.factory('NormalizedPosts', function($firebaseArray, userCache) { | |
var PostsWithUsers = $firebaseArray.$extend({ | |
// override $$added to include users | |
$$added: function(snap) { | |
// call the super method | |
var record = $firebaseArray.prototype.$$added.call(this, snap); | |
userCache.$load( record.user ).$loaded(function( userData ) { | |
record.userData = userData; | |
}); |
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
// this will remove all error logging globally | |
angular.config(function($provide) { | |
$provide.decorator("$firebaseObject", function($delegate) { | |
$delegate.prototype.$$error = function(err) { | |
this.$destroy(err); | |
}; | |
return $delegate; | |
}); | |
$provide.decorator("$firebaseArray", function($delegate) { |
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
{ | |
"rules": { | |
// REQUIRED FIELDS | |
"example1" : { | |
"$record": { | |
// foo and bar are required fields that must always exist | |
// this will reject writes to $record, as well as directly to $record/foo or $record/bar if they are null | |
".validate": "newData.hasChildren(['foo', 'bar'])" | |
} |
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
{ | |
"rules": { | |
"users": { | |
"$user_id": { | |
// email address is required | |
".validate": "newData.hasChildren(['email'])", | |
} | |
}, | |
"emails_to_users": { |
OlderNewer