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> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/> | |
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script> | |
<script type='text/javascript' src="http://cloud.github.com/downloads/wycats/handlebars.js/handlebars-1.0.0.beta.6.js"></script> | |
<script type='text/javascript' src="http://cloud.github.com/downloads/emberjs/ember.js/ember-latest.js"></script> | |
</head><body> | |
<script type="text/x-handlebars" data-template-name="application"> | |
<h1>Application</h1> | |
<a href="#/dashboard">Dashboard</a> |
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 = Ember.Application.create(); | |
App.RootState = Em.State.extend({ | |
index : Em.State.extend({ | |
route : '/' | |
}), | |
main: Em.State.extend({ | |
route : '/main', | |
index : Em.State.extend({ | |
route : '/' |
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
// <== BOOTSTRAP | |
var App = Ember.Application.create(); | |
App.stateManager = Ember.StateManager.create(); | |
DS.fixtureAdapter.createRecord = function(store, type, record) { | |
var json = record.toJSON(); | |
json.id = 1; | |
store.didCreateRecord(record, json); |
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/Event/BlogEventListener.php | |
<?php | |
App::uses('CakeEventListener', 'Event'); | |
class BlogEventListener implements CakeEventListener { | |
public function implementedEvents() { | |
return array( | |
'Controller.Blog.afterAdd' => 'myEventFunction', // assign event to 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
Handlebars.registerHelper('loc', function(property, fn) { | |
var str; | |
// we are bound to a value, it is now the context | |
if (fn.contexts && typeof fn.contexts[0] === 'string') { | |
str = fn.contexts[0]; | |
// Convention, start all localization keys with _ | |
} else if (property[0] === '_') { | |
str = property; |
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.CarouselView = Em.CollectionView.extend(Luh.Ui.ScrollMixin, { | |
scrollOptions: { | |
hScroll: true, | |
vScroll: false, | |
duration: 500, | |
velocity: 0.1, | |
simultaneously: true, | |
initThreshold: 10*ScreenFactor | |
}, |
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 = Em.Application.create({ | |
customEvents: { | |
webkitTransitionEnd: 'transitionEnd' | |
} | |
}); | |
Em.View.extend({ | |
transitionEnd: function(event) { |
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 interval; | |
jQuery.fn.contentchange = function(fn) { | |
return this.bind('contentchange', fn); | |
}; | |
jQuery.event.special.contentchange = { | |
setup: function(data, namespaces) { | |
var self = this, | |
$this = $(this), |
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
function checkMeliCode(code) | |
{ | |
if(!/^\d{8,10}$/.test(code) || /^(0{8,10}|1{8,10}|2{8,10}|3{8,10}|4{8,10}|5{8,10}|6{8,10}|7{8,10}|8{8,10}|9{8,10})$/.test(code)) | |
return false; | |
var L=code.length, _=0; | |
for(i=0;i<L-1;i++) | |
_+=code.charAt(i)*(L-i); | |
_%=11; | |
return (code.charAt(L-1)==((_<2)?_:11-_)) | |
} |