Skip to content

Instantly share code, notes, and snippets.

@wagenet
wagenet / Assetfile.rb
Created January 13, 2012 20:37
Ember Handlebars Precompile
require 'execjs'
class HandlebarsFilter < Filter
class << self
def contents
@@contents ||= [File.read("headless-ember.js"), File.read("ember.js")].join("\n")
end
def context
@@context ||= ExecJS.compile(contents)
@ppcano
ppcano / carousel_view.js
Created January 13, 2012 13:01
Ember Touch ScrollView without iScroll, and using movejs for transfomations.
@ppcano
ppcano / scroll_mixin.js
Created January 12, 2012 16:58
View get notified when its childviews has been inserted.
ScrollMixin = Em.Mixin.create({
didInsertElementEnd: function() {
this._setup_dimensions();
this._super();
}
..........
});
@ppcano
ppcano / swipe.css
Created January 7, 2012 13:57
Ember SwipeView for mobile devices based on SwipeView's approach of @cubiq
.swipe_item {
position: absolute;
-webkit-transform: translateZ(0);
top: 0px;
height: 100%;
width: 100%;
}
.swipe_slider {
position: relative;
@ppcano
ppcano / scrollable_view.js
Created November 17, 2011 17:49
ScrollableView using sproutcore-touch
UI.Kit.ScrollableView = SC.CollectionView.extend({
// options
animationDuration: 1000,
easing: "easeOutExpo",
// must be set ( pixels available) to provide elastic scroll
scrollableHeight: 0,
// options elastic
@mattsahr
mattsahr / native.scroll.html
Created November 17, 2011 02:47
IOS Webkit - native internal scroll - a fix for the document page-top-bounce
<!DOCTYPE html>
<html>
<!-- NOTES
Demo - uses IOS native scroll available in IOS5, but sidestep the document-bounce behavior. Tested on iPad 1, using IOS 5.1.
This approach uses a set of 3 nested divs.
OuterDiv -- fixed height, width, overflow-scrolling: touch;
MiddleDiv -- fixed height width, overflow-scrolling: touch; fits inside OuterDiv
InnerDiv -- fixed height width, bigger than MiddleDiv, so it kicks in the overflow behavior
@getify
getify / auto-ga.js
Created November 24, 2010 15:25
create an auto-loader for Google Analytics (using LABjs)
/*! LAB.js v1.0.3 (c) Kyle Simpson MIT License */
/* INCLUDE THE MINIFIED LAB.js CODE HERE */
$LAB
.script('https:'==document.location.protocol?'https://ssl':'http://www')+'.google-analytics.com/ga.js')
.wait(function(){
var scripts = document.getElementsByTagName("script"),
src, i, len,
acct = "UA-XXXXX-X",
@getify
getify / gist:713779
Created November 24, 2010 15:09
loading google analytics using LABjs
<!DOCTYPE html>
<html>
<head>
<title>LABjs Demo</title>
</head>
<body>
<!-- some stuff -->
<script src="/js/LAB.js"></script>