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
@nojimage
nojimage / app_13_helper.php
Created March 13, 2012 11:06
element buffering for CakePHP 1.3/2.0
<?php
/**
* for CakePHP 1.3
*
* Copyright 2012, nojimage http://php-tips.com/
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
@nsfmc
nsfmc / artboard.py
Last active October 1, 2015 23:57
commit successive changes to illutrator files
#!env python
"""
artboard.py - (c) 2012 marcos.a.ojeda <[email protected]>
--"Quis leget haec?"
requires:
graphicsmagick - brew install graphicsmagick
ghostscript - brew install ghostscript
macfsevents - pip install MacFSEvents
@borismus
borismus / gist:2165681
Created March 23, 2012 00:06
dynamic template loading
/*
* 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 {
@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
@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 = '';
@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();
@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]"
@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();
@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,
@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({