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
@addyosmani
addyosmani / jquery.tinypubsub.js
Created October 27, 2011 10:10 — forked from cowboy/HEY-YOU.md
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery 1.7
/*!
* jQuery Tiny Pub/Sub for jQuery 1.7 - v0.1 - 27/10/2011
* Based on @cowboy Ben Alman's REALLY tiny pub/sub.
* 1.7 specific updates by @addyosmani.
* Copyright maintained by @cowboy.
* Dual licensed under the MIT and GPL licenses.
*/
(function($){
@addyosmani
addyosmani / pubsub.md
Created October 28, 2011 06:49
Four ways to do Pub/Sub with jQuery 1.7 and jQuery UI (in the future)

#Four Ways To Do Pub/Sub With jQuery and jQuery UI (in the future)

Between jQuery 1.7 and some of work going into future versions of jQuery UI, there are a ton of hot new ways for you to get your publish/subscribe on. Here are just four of them, three of which are new.

(PS: If you're unfamiliar with pub/sub, read the guide to it that Julian Aubourg and I wrote here http://msdn.microsoft.com/en-us/scriptjunkie/hh201955.aspx)

##Option 1: Using jQuery 1.7's $.Callbacks() feature:

$.Callbacks are a multi-purpose callbacks list object which can be used as a base layer to build new functionality including simple publish/subscribe systems. We haven't yet released the API documentation for this feature just yet, but for more information on it (including lots of examples), see my post on $.Callbacks() here:

/*!
* jQuery TextChange Plugin
* http://www.zurb.com/playground/jquery-text-change-custom-event
*
* Origin:
* Copyright 2010, ZURB
* Released under the MIT License
*/
(function ($) {
@scottburton11
scottburton11 / gist:1479734
Created December 15, 2011 03:43
Ember.js tree
<html>
<head>
<script src="javascripts/jquery.js" type="text/javascript" charset="utf-8"></script>
<script src="javascripts/ember.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
App = Ember.Application.extend();
App.Node = Ember.Object.extend({
name: null,
@maxbrunsfeld
maxbrunsfeld / backbone_super.js
Created December 30, 2011 23:58
A 'super' method for backbone.js (plain javascript)
// This method gives you an easier way of calling super
// when you're using Backbone in plain javascript.
// It lets you avoid writing the constructor's name multiple
// times. You still have to specify the name of the method.
//
// So instead of having to write:
//
// User = Backbone.Model.extend({
// save: function(attrs) {
// this.beforeSave(attrs);
@ziadoz
ziadoz / awesome-php.md
Last active May 10, 2024 15:06
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
@sbuller
sbuller / test.html
Created January 26, 2012 22:40
Ember Test
<html>
<head>
<title>Ember Test</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="https://github.com/downloads/emberjs/ember.js/ember-0.9.4.min.js"></script>
<script type="text/javascript" src="http://coffeescript.org/extras/coffee-script.js"></script>
</head>
<body>
<h1>Todos</h1>
<script type="text/x-handlebars">
@aaronpeterson
aaronpeterson / gist:1874366
Created February 21, 2012 06:40
Cakephp flatten
<?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.
*
@mxriverlynn
mxriverlynn / 1.js
Created February 22, 2012 02:02
ember: clicking html elements
EmberCloneMail.EmailListView = Em.View.extend({
tagName: "ul",
classNames: ["email-list", "email-view"],
templateName: "email-list-view"
});
EmberCloneMail.EmailPreview = Em.View.extend({
tagName: "li"
templateName: "email-preview"
});
@Bokugene
Bokugene / CGFontToFontData.m
Created February 23, 2012 13:21
Read Table Data from a CGFont, then wrap them into a OTF/TTF font.
typedef struct FontHeader {
int32_t fVersion;
uint16_t fNumTables;
uint16_t fSearchRange;
uint16_t fEntrySelector;
uint16_t fRangeShift;
}FontHeader;
typedef struct TableEntry {
uint32_t fTag;