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
@boronine
boronine / fiddle.coffee
Created August 9, 2012 06:38
Synchronous and asynchronous form field validation using Ember.js bindings
window.App = Ember.Application.create()
App.Focusable = Ember.Mixin.create
# Don't let events spoil your Kool-Aid!
# Let's get these out of the way by turning them
# into a magical property:
focused: false
focusIn: (event) -> @set 'focused', true
focusOut: (event) -> @set 'focused', false
@theturtle32
theturtle32 / compilingNode0.8.4onCentOS5.md
Created July 25, 2012 20:57
Compiling and Installing Node v0.8.4 on CentOS 5.x

Compiling/Installing Node 0.8.4 (and Python 2.6, required by Node) on CentOS 5

Update system packages -- will migrate system forward to CentOS 5.8. (Optional?)

$ sudo yum update

Install the EPEL Repo:

@haric
haric / CloneEmberView.js
Created June 6, 2012 00:53
Ember clone view
function cloneFromView(obj) {
if (null == obj || "object" != typeof obj) return obj;
var copy = Ember.View.create({
templateName: obj.templateName
});
for (var attr in obj) {
if (obj.hasOwnProperty(attr)) copy[attr] = obj[attr];
}
return copy;
}
@cloke
cloke / gist:2490991
Created April 25, 2012 16:12
Select Element
{{view M.Select
contentBinding="Desires.elementTypeController"
valueBinding="this.type"
optionLabelPath="content.label"
optionValuePath="content.type"
classNames="input-xlarge"
}}
M.Select = Em.Select.extend({
@ebidel
ebidel / handle_file_upload.php
Created April 18, 2012 03:23
Uploading files using xhr.send(FormData) to PHP server
<?php
$fileName = $_FILES['afile']['name'];
$fileType = $_FILES['afile']['type'];
$fileContent = file_get_contents($_FILES['afile']['tmp_name']);
$dataUrl = 'data:' . $fileType . ';base64,' . base64_encode($fileContent);
$json = json_encode(array(
'name' => $fileName,
'type' => $fileType,
'dataUrl' => $dataUrl,
@real34
real34 / ActionsHelper.php
Created April 12, 2012 08:16
CakePHP2.x : Twitter bootstrap base for projects
<?php
/**
* Action Helper
* Allows to generate simple CRUD links for a given object and customize its rendering
* It only works for default baked urls
*
* Usage:
* <code>
* $this->Actions->setActionsOptions($order['Order']['id'], true);
* echo $this->Actions->view();
@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
@rlivsey
rlivsey / ember-data-chat.js
Created April 3, 2012 17:39
ember-data with filter
App = Ember.Application.create();
App.store = DS.Store.create({
adapter: DS.RESTAdapter.create()
})
App.set("room_id", 1);
App.Models = Ember.Namespace.create();
@farhadi
farhadi / rc4.js
Created March 24, 2012 17:09
RC4 encryption in javascript and php
/*
* RC4 symmetric cipher encryption/decryption
*
* @license Public Domain
* @param string key - secret key for encryption/decryption
* @param string str - string to be encrypted/decrypted
* @return string
*/
function rc4(key, str) {
var s = [], j = 0, x, res = '';
@fernandoaleman
fernandoaleman / Linux Static IP
Created March 23, 2012 16:20
How To Configure Static IP On CentOS 6
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static