Skip to content

Instantly share code, notes, and snippets.

@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>
@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",
@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
@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
@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 / 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 / carousel_view.js
Created January 13, 2012 13:01
Ember Touch ScrollView without iScroll, and using movejs for transfomations.
@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 / Makefile
Created January 19, 2012 11:35
assetfile
update:
rm -rf packages/*; \
cp -pr ~/Git/forks/ember.js/packages/* ./packages; \
cp -pr ~/Git/forks/sproutcore-touch/packages/ember-touch ./packages; \
cp -pr ~/Git/emberjs/ember-mk/packages/ember-mk ./packages
@ppcano
ppcano / tab_view.js
Created February 3, 2012 11:13
new tab view
require('app/app');
var get = Ember.get , set = Ember.set, setPath = Ember.setPath, getPath = Ember.getPath;
// Tab View was created because a general Tab did not
// work because the flip animation
// with z-index opacity feature won't work, because it shows the hidden z-index panels
App.TabMainView = Ember.Mixin.create({