Skip to content

Instantly share code, notes, and snippets.

View gonzaloruizdevilla's full-sized avatar

Gonzalo Ruiz de Villa gonzaloruizdevilla

  • GFT
  • Madrid, Spain
View GitHub Profile
@gonzaloruizdevilla
gonzaloruizdevilla / gist:3780545
Created September 25, 2012 08:03
AngularJs y detección de conexión para cambiar sistema de almacenamiento
angular.module('myApp').run(function($rootScope) {
window.addEventListener("online", function () {
$rootScope.$broadcast('onlineChanged', true);
}, true);
window.addEventListener("offline", function () {
$rootScope.$broadcast('onlineChanged', false);
}, true);
});
@gonzaloruizdevilla
gonzaloruizdevilla / gist:4168405
Created November 29, 2012 11:34 — forked from Mithrandir0x/gist:3639232
Difference between Service, Factory and Provider in AngularJS
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
var http = require('http'), httpProxy = require('http-proxy');
/**
* HTTP authentication module.
*/
var auth = require('http-auth');
/**
* Requesting new authentication instance.
*/
var moduleA = function () {
return {
data: dataArrayObject,
init: function () {
this.addTable();
this.addEvents();
},
var moduleD = function () {
return {
data: dataArray,
init: function () {
this.addTable();
this.addEvents();
},
moduleG = function () {};
moduleG.prototype.data = dataArray;
moduleG.prototype.init = function () {
this.addTable();
this.addEvents();
};
moduleG.prototype.addTable = function () {
var template = _.template($('#template').text());
var html = template({'data' : this.data});
// Prototypal pattern
Klass1 = function () {}
Klass1.prototype.foo = function () {
log('foo');
}
Klass1.prototype.bar = function () {
log('bar');
}
// Module pattern

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

// Directives
(function (angular) {
'use strict';
var filtroVisor = "filtrovisor";
function FilterVisor($timeout, $http, $q) {
return {
restrict: 'A',
require: '?ngModel',
@gonzaloruizdevilla
gonzaloruizdevilla / LICENSE.txt
Last active August 29, 2015 14:08 — forked from 140bytes/LICENSE.txt
JavaScript curry function in 136 bytes
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2014 Gonzalo Ruiz de Villa <adesis.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE