This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| angular.module('app') | |
| .directive('uiScrollGo', function() { | |
| return { | |
| restrict: 'AC', | |
| link: function(scope, el, attr) { | |
| el.on('click', function(e) { | |
| var target = $('#' + attr.uiScrollGo); | |
| if (target.length) { | |
| $('html, body').animate({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * The MIT License (MIT) | |
| * | |
| * Copyright (c) 2016 Develer S.r.L. | |
| * | |
| * Permission is hereby granted, free of charge, to any person obtaining a copy | |
| * of this software and associated documentation files (the "Software"), to deal | |
| * in the Software without restriction, including without limitation the rights | |
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| * copies of the Software, and to permit persons to whom the Software is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.directive('uiSelectRequired', function() { | |
| return { | |
| require: 'ngModel', | |
| link: function(scope, elm, attrs, ctrl) { | |
| ctrl.$validators.uiSelectRequired = function(modelValue, viewValue) { | |
| for(var prop in modelValue) { | |
| if(modelValue.hasOwnProperty(prop)) | |
| return true; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.directive('textEditor', function () { | |
| return { | |
| require: 'ngModel', | |
| link: function(scope, element, attributes, controller) { | |
| scope.$watch(attributes.ngModel, function(value) { | |
| $(element).html(value); | |
| }); | |
| element.bind('keyup mouseup', function(){ | |
| controller.$setViewValue(element.html()); | |
| if (!scope.$$phase) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <table st-table="displayedCollection" st-safe-src="rowCollection" class="table table-bordered table-striped no-border-top"> | |
| <thead> | |
| <tr class="search-header"> | |
| <th colspan="6"> | |
| <span>Buscar:</span> <input st-search="" class="form-control input-sm" type="text"/> | |
| </th> | |
| </tr> | |
| <tr> | |
| <th st-sort="codigo" class="sortable">Código</th> | |
| <th st-sort="nombre" class="sortable">Nombre</th> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Installation */ | |
| composer global require "laravel/installer" | |
| /* New Project Using Laravel */ | |
| laravel new blog | |
| /* New Project Using Composer */ | |
| composer create-project laravel/laravel nombre --prefer-dist | |
| /* Rename Project */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // El orden empleando setInterval() puede ser impredecible ( 0 1 2 5 4 6 8 7). | |
| // Invocar recursivamente a setTimeout() puede asegurar el orden de ejecución ( 0 1 2 3 4 5 6). | |
| // Hasta que no finalize una ejecución no continua con las demás. | |
| var ul = $('ul.log'), | |
| index = 0; | |
| setTimeout(function getDate() { | |
| var started = new Date(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Las ejecuciones muy largas de codigo JavaScript tienden a bloquear el UI y dejar al navegador sin responder, | |
| // sobre todo cuando se emplean bucles. Este patron emplea temporizadores para evitar precisamente este problema. | |
| // Es un inconveniente bastante común en dispositivos móviles. | |
| var buffer = function( items, iterFn, callback ) { | |
| var i = 0, | |
| len = items.length; | |
| setTimeout(function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Los temporizadores en JavaScript son: setTimeout() y setInterval(). | |
| // El primero se ejecuta una sola vez y el segundo se ejecuta continuamente. | |
| // En ambos casos el primer parametro es la función que se ejecutará y el segundo el tiempo en milisegundos. | |
| // El periodo mínimo es de 4ms y el temporizador solo se ejecuta cuando la función principal ha finalizado. | |
| var i = 0; | |
| var timer = setInterval(function() { | |
| console.log( i ); | |
| i++; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |