Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Saleh Souzanchi zoghal

🎯
Focusing
Block or report user

Report or block zoghal

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View jquery.textchange.js
/*!
* jQuery TextChange Plugin
* http://www.zurb.com/playground/jquery-text-change-custom-event
*
* Copyright 2010, ZURB
* Released under the MIT License
*/
(function ($) {
$.event.special.textchange = {
@zoghal
zoghal / gist:2027599
Created Mar 13, 2012 — forked from aaronpeterson/gist:1874366
Cakephp flatten
View gist:2027599
<?php
// from my ApiComponent
/**
* Flatten Model find data
*
* Will flatten data from a find or find multi response by moving the specified
* className up to the root of the array. Useful for converting find results to
* REST responses.
*
View index.html
{{#view Luh.Ui.TabMainView currentView="pane1"}}
{{#view Luh.Ui.TabPaneView id="pane1" class="content" viewName="pane1"}}
{{/view}}
{{#view Luh.Ui.TabPaneView id="pane2" class="content" viewName="pane2"}}
{{/view}}
View index.html
{{#view Luh.Ui.TabMainView currentView="pane1"}}
{{#view Luh.Ui.TabPaneView id="pane1" class="content" viewName="pane1"}}
{{/view}}
{{#view Luh.Ui.TabPaneView id="pane2" class="content" viewName="pane2"}}
{{/view}}
@zoghal
zoghal / gist:2783361
Created May 24, 2012 — forked from borismus/gist:2165681
dynamic template loading
View gist:2783361
/*
* Loads a handlebars.js template at a given URL. Takes an optional name, in which case,
* the template is added and is reference-able via templateName.
*/
function loadTemplate(url, name, callback) {
var contents = $.get(url, function(templateText) {
var compiledTemplate = Ember.Handlebars.compile(templateText);
if (name) {
Ember.TEMPLATES[name] = compiledTemplate
} else {
@zoghal
zoghal / gist:2816139
Created May 27, 2012 — forked from tomdale/gist:1134558
Load remote Handlebars templates
View gist:2816139
jQuery.get('/templates/foo.handlebars', function(data) {
var template = SC.Handlebars.compile(data);
SC.TEMPLATES['foo'] = template;
})
View 1_template_container_view.js
// A mixin for `Em.ContainerView` that allows an initial render from
// a template, followed by further additions by mutating childViews.
// Note that the template should *only* contain calls to
// `{{childView}}`
App.Mixins.TemplateContainerView = Em.Mixin.create({
render: function() {
if (!this.get('_renderedFromTemplate')) {
Em.View.prototype.render.apply(this, arguments);
this.set('_renderedFromTemplate', true);
@zoghal
zoghal / didRequestRange.js
Created Jun 4, 2012 — forked from tchak/pagination_support.js
Ember.PaginationSupport
View didRequestRange.js
App.collectionController = Em.ArrayProxy.create(Ember.PaginationSupport, {
content: [],
fullContent: App.store.findAll(App.Job),
totalBinding: 'fullContent.length',
didRequestRange: function(rangeStart, rangeStop) {
var content = this.get('fullContent').slice(rangeStart, rangeStop);
this.replace(0, this.get('length'), content);
}
});
@zoghal
zoghal / 1-helper.js
Created Jun 4, 2012 — forked from wagenet/1-helper.js
Ember Handlebars Transform Helper
View 1-helper.js
Ember.HandlebarsTransformView = Ember.View.extend(Ember.Metamorph, {
rawValue: null,
transformFunc: null,
value: function(){
var rawValue = this.get('rawValue'),
transformFunc = this.get('transformFunc');
return transformFunc(rawValue);
}.property('rawValue', 'transformFunc').cacheable(),
@zoghal
zoghal / animatable_view.js
Created Jun 4, 2012 — forked from ppcano/animatable_view.js
Control Animations on Ember Views
View animatable_view.js
AnimatableView = Ember.ContainerView.extend(Em.Animatable,{
executeAnimation: function() {
.......
this.animate({duration: that.duration, stopEventHandling:true}, function() {
# perform animations based on your JS choices
move('#'+id)
.x(translatePosition)
You can’t perform that action at this time.