Skip to content

Instantly share code, notes, and snippets.

View abelrgr's full-sized avatar
⌨️
Coding in progress...

Abel abelrgr

⌨️
Coding in progress...
  • Bolivia
View GitHub Profile
@abelrgr
abelrgr / uniqid.js
Created March 17, 2016 00:37 — forked from larchanka/uniqid.js
JavaScript function that copies functionality of PHP's 'uniqid'.
(function () {
this.uniqid = function (pr, en) {
var pr = pr || '', en = en || false, result;
this.seed = function (s, w) {
s = parseInt(s, 10).toString(16);
return w < s.length ? s.slice(s.length - w) : (w > s.length) ? new Array(1 + (w - s.length)).join('0') + s : s;
};
result = pr + this.seed(parseInt(new Date().getTime() / 1000, 10), 8) + this.seed(Math.floor(Math.random() * 0x75bcd15) + 1, 5);
@abelrgr
abelrgr / sortable-list.html
Created January 4, 2016 03:14
Angular Sortable directive List with delete
<!doctype html>
<html>
<head>
<title>My Angular App</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.8/angular.min.js"></script>
<style type="text/css">
.bolsoft-sortable{
list-style-type:none;
margin: 0;
padding: 0;
@abelrgr
abelrgr / all.txt
Created December 7, 2015 02:07
Angular route active by initial params
javascript:
.directive('navbarCustom', ['$location', function($location) {
return {
restrict: 'C',
link: function(scope, elem, attrs) {
scope.checkActive = function(param) {
if (param == scope.active1) {
return true;
};
@abelrgr
abelrgr / gist:9a15b98f5a64273afbb6
Created October 8, 2015 23:33 — 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!"
@abelrgr
abelrgr / Template.php
Created May 21, 2015 16:41
Williams concepts template for Codeigniter 3
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
* An open source application development framework for PHP 4.3.2 or newer
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2006, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
@abelrgr
abelrgr / datatables.php
Last active August 29, 2015 14:02
ejemplo basico Ignited Datatables
<!-- vista paises_datatables -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="<?php echo base_url('public/js/jquery.js') ?>"></script>
<script type="text/javascript" src="<?php echo base_url(). 'public/js/jquery.dataTables.min.js' ?>"></script>
<link rel="stylesheet" href="<?php echo base_url(). 'public/css/jquery.dataTables.min.css' ?>">
function getBaseURL() {
var url = location.href; // entire url including querystring - also: window.location.href;
var baseURL = url.substring(0, url.indexOf('/', 14));
if (baseURL.indexOf('http://localhost') != -1) {
// Base Url for localhost
var url = location.href; // window.location.href;
var pathname = location.pathname; // window.location.pathname;
var index1 = url.indexOf(pathname);