Skip to content

Instantly share code, notes, and snippets.

View zoghal's full-sized avatar
🏠
Working from home

Saleh Souzanchi zoghal

🏠
Working from home
View GitHub Profile
@zoghal
zoghal / index.html
Created July 1, 2012 07:00 — forked from fpauser/index.html
Ember.Router
<!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>
@zoghal
zoghal / ember-store.js
Created July 10, 2012 22:32
Ember-Data Example
// <== 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);
@zoghal
zoghal / localization_helper.js
Created July 24, 2012 19:23 — forked from davidwkeith/localization_helper.js
Localization Helper for Ember.js's Handlebars
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;
@zoghal
zoghal / view.handlebars
Created July 25, 2012 02:54 — forked from coop/view.handlebars
Getting access to form properties in Ember.js
<form>
<div>
<label for="name">Name</label>
{{view Ember.TextField valueBinding="view.name"}}
</div>
<div>
<label for="application">Application</label>
{{view Ember.TextField valueBinding="view.file" type="file"}}
</div>
@zoghal
zoghal / carousel_view.js
Created July 27, 2012 15:01 — forked from johanvalcoog/carousel_view.js
Ember Touch ScrollView without iScroll, and using movejs for transfomations.
@zoghal
zoghal / transition_end_on_app.js
Created July 30, 2012 19:09 — forked from ppcano/transition_end_on_app.js
How to receive transitionEnd events on the view layer, which option is the most suitable?
App = Em.Application.create({
customEvents: {
webkitTransitionEnd: 'transitionEnd'
}
});
Em.View.extend({
transitionEnd: function(event) {
@zoghal
zoghal / dev_view.coffee
Created August 26, 2012 01:09 — forked from charlesjolley/dev_view.coffee
Adding event locks to Ember
# example view implements a simple dragging for mouse events.
Wall.DevView = Ember.View.extend
mouseDown: (ev) ->
ev.dispatcher.lock @, 'mouseMove', 'mouseUp'
@_mouseDown = @$().offset()
@_mouseDown.pageX = ev.pageX
@_mouseDown.pageY = ev.pageY
@_mouseDown.dispatcher = ev.dispatcher
console.log 'mouseDown'
@zoghal
zoghal / key_responder.js
Created October 13, 2012 20:15
KeyResponder
(function() {
var get = Ember.get, set = Ember.set;
/*
Holds a stack of key responder views. With this we can neatly handle restoring the previous key responder
when some modal UI element is closed. There's a few simple rules that governs the usage of the stack:
- mouse click does .replace (this should also be used for programmatically taking focus when not a modal element)
- opening a modal UI element does .push
- closing a modal element does .pop
@zoghal
zoghal / pagination_support.js
Created October 13, 2012 20:26
Ember.PaginationSupport
var get = Ember.get;
/**
@extends Ember.Mixin
Implements common pagination management properties for controllers.
*/
Ember.PaginationSupport = Ember.Mixin.create({
/**
*/
@zoghal
zoghal / file_picker.js
Created November 1, 2012 22:54
Ember.FilePicker
var get = Ember.get, set = Ember.set, getPath = Ember.getPath;
Ember.FilePicker = Ember.Button.extend({
tagName: 'span',
classNames: ['ember-filepicker'],
classNameBindings: ['disabled'],
/**
* @type {String}
*/