Skip to content

Instantly share code, notes, and snippets.

View JamsMendez's full-sized avatar
🏠
Working from home

Jose Angel Mendez Santiago JamsMendez

🏠
Working from home
View GitHub Profile
@JamsMendez
JamsMendez / factorySocketIO.js
Created September 25, 2014 14:31
Factory para implementar Socket.IO y Angular.js
app.factory('SocketIO', function ($rootScope) {
var socket = io.connect();
return {
on: function (eventName, callback) {
socket.on(eventName, function () {
var args = arguments;
$rootScope.$apply(function () {
callback.apply(socket, args);
});
});
@JamsMendez
JamsMendez / orderByObject.js
Created September 24, 2014 18:31
Filtro para ordenar lista de objetos en Angular.js
var filters = {};
filters.orderByObject = function() {
return function(items, field, reverse) {
var filtered = [];
angular.forEach(items, function(item) {
filtered.push(item);
});
@JamsMendez
JamsMendez / ngCarousel.js
Created August 15, 2014 16:47
Directive Carousel, simulates a form component, Select
/*
Dependencies
http://sorgalla.com/jcarousel/
Implementation
<carousel ng-model="Object.property" elements="elements"></carousel>
@JamsMendez
JamsMendez / ngUploadDrop.js
Created August 12, 2014 05:00
Directiva de Angular.js para subir archivos Drag on Drop
directives.uploadDrop = function (){
return {
require: '?ngModel',
restrict: 'E',
template: '<div class="input-file" style="width: 150px;"><span class="glyphicon glyphicon-picture"></span></div>',
link: function (scope, element, attrs, ngModel){
if (!ngModel) return;
element.bind('drop', function (event) {
@JamsMendez
JamsMendez / ngUpload.js
Last active August 29, 2015 14:01
Directiva de Angular.js para Input File y Ajax
// Bootstrap is used for visual effects
/*
HTML
<ng-upload ng-model="file"></ng-upload>
<ng-upload ng-model="Object.file"></ng-upload>
*/
var directives = {
ngUpload: function () {