Skip to content

Instantly share code, notes, and snippets.

View emadb's full-sized avatar
⌨️
coding

Emanuele DelBono emadb

⌨️
coding
View GitHub Profile
@emadb
emadb / gist:10735529
Created April 15, 2014 14:05
An event
{
"commitId" : LUUID("556fb777-2cf3-e34d-9f34-88caad42c0be"),
"timestamp" : ISODate("2013-11-21T14:59:10.314Z"),
"aggregateId": "65dbab54-afd0-477b-a5fb-686cc90f7aff",
"events" : [
{
"eventName" : "item_added",
"args": ["1", "10"]
},
{
class BerlinClock
SECONDS = "Y"
HOURS_FIVES = "RRRR"
HOURS_ONES = "RRRR"
MINUTES_FIVES = "YYRYYRYYRYY"
MINUTES_ONES = "YYYY"
def initialize(h,m,s)
@h, @m, @s = h, m, s
end
@emadb
emadb / gist:38cf4c94ac858382300c
Created June 16, 2014 14:59
Javascript refactoring
function mouseup(evt) {
if (_isDD) {
return;
}
if (evt.shiftKey == true) {
var indexOf1 = this.cont.list.indexOf(_lastItemSelected);
var indexOf2 = this.cont.list.indexOf(this);
for (var i = indexOf2; i > indexOf1; i--) {
var item = this.cont.list[i];
module.exports = (function() {
var fizzFun = function(n){
if (n % 3 == 0)
return 'fizz';
};
var buzzFun = function(n){
if (n % 5 == 0)
return 'buzz';
@emadb
emadb / gist:1354b4fa365997746168
Created October 28, 2014 20:17
Spot the bug! Why doesn't doSomething print "new function"
function MyObject(fun){
this.fun = fun;
}
MyObject.prototype.doSomething = function() {
this.fun();
};
var f = function (){console.log('Original function')};
@emadb
emadb / app.js
Last active August 29, 2015 14:11
Angular directive rendering.
window.app = angular.module('myApp', []);
window.app.controller('mainController', function($scope){
$scope.title = "Demo";
$('#btn').click(function(){
console.log('Controller: click');
});
});
@emadb
emadb / gist:924b2a9f28e8fb3c6c2d
Created March 18, 2015 16:19
Callback object
var obj1 = {
foo: function(){
obj2.bar(this.obj1Callback);
},
obj1Callback: function(){
// do something
}
};
var obj2 = {
@emadb
emadb / Seti_modified.sublime-theme
Created April 20, 2015 14:42
Seti_UI modified
[
//========================================================
// TABS (REGULAR)
//--------------------------------------------------------
// Tab set
{
"class": "tabset_control",
"layer0.texture": "Seti_UI/Main/tabset-background.png",
"layer0.inner_margin": [1, 7],
"layer0.opacity": 1,
@emadb
emadb / Comp.ex
Last active August 29, 2015 14:23
Comp.ex
defmodule Comp do
def check([h|t], b) do
check(t, List.delete(b, h*h))
end
def check(_,[]), do: true
def check([], b), do: false
end