Skip to content

Instantly share code, notes, and snippets.

@trioni
trioni / localbranches
Created May 22, 2015 01:55
Working with local branches in Git
[master]$ git checkout -b localdev
# Make all of your changes in your local dev branch
[localdev]$ git add .
[localdev]$ git commit -m"My changes"
[localdev]$ git checkout master
[master]$ git pull
# If no changes from the remote, just merge localdev
# Case 1: No changes from remote
[master]$ git merge localdev
[master]$ git push
@trioni
trioni / Backbone Collection
Created September 10, 2012 11:29
Backbone Collection
define([
'underscore',
'backbone',
'models/mymodel'
], function(_, Backbone, MyModel){
var Foo = Backbone.Collection.extend({
model: MyModel
});
return Foo;
});
@trioni
trioni / Backbone Model
Created September 10, 2012 11:28
Backbone Model
define([
'underscore',
'backbone'
], function(_, Backbone){
var Foo = Backbone.Model.extend({
});
return Foo;
});
@trioni
trioni / gist:2769720
Created May 22, 2012 15:21
CSS ol style
ol {
counter-reset:li;
}
ol li {
list-style:none;
}
ol li:before {
content:counter(li); /* Use the counter as content */
@trioni
trioni / gist:2376655
Created April 13, 2012 12:41
php logging
function wtf_log($code) {
if (is_null($code) || is_string($code) || is_int($code) || is_bool($code) || is_float($code)) :
$code = var_export($code, true);
else :
$code = print_r($code, true);
endif;
error_log($code);
@trioni
trioni / gist:1991886
Created March 7, 2012 08:20 — forked from gogoxoom/gist:1990512
Javascript: jQuery PubSub
(function($) {
var o = $( {} );
$.each({
on: 'subscribe',
trigger: 'publish',
off: 'unsubscribe',
}, function ( key, api ) {
$[api] = function() {
o[key].apply( o, arguments );