Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Diego Chavez diegochavez

🎯
Focusing
Block or report user

Report or block diegochavez

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:da2f8d9578a53e0a79192302cfc215fc
### Keybase proof
I hereby claim:
* I am diegochavez on github.
* I am diegochavez (https://keybase.io/diegochavez) on keybase.
* I have a public key ASDsYbqzKu0JDEcVYoD-6cDNIgJCQzIH7iWmBIntkpEaCwo
To claim this, I am signing this object:
@diegochavez
diegochavez / findCarrier.js
Last active Mar 16, 2017
Detect Mobile Phone Carrier Guatemala
View findCarrier.js
function findCarrier(MSISDN){
num = MSISDN * 1;
if(num < 30000000 || num >= 60000000)
return {"carrier":null,"error":true};
if(
((30000000<= num) && (num <= 33599999)) ||
((40000000<= num) && (num <= 40999999)) ||
((44760000<= num) && (num <= 46999999)) ||
((47730000<= num) && (num <= 48199999)) ||
((48220000<= num) && (num <= 50099999)) ||
@diegochavez
diegochavez / country-tourism-slogans.json
Created Dec 29, 2016
Country Slogans, Tourism messages, JSON file,
View country-tourism-slogans.json
{
"Albania": "Go your own way!",
"Algeria": "Tourism for everybody",
"Andorra": "The Pyrenean Country",
"Antigua and Barbuda": "The beach is just the beginning",
"Argentina": "Beats to your rhythm",
"Armenia": "Visit Armenia, It is Beautiful",
"Australia": "There’s NOTHING like Australia",
"Austria": "Arrive and revive",
"Bahamas": "Life Is Grand",
View examples.md
@diegochavez
diegochavez / multiFilter.js
Last active Aug 30, 2019 — forked from jherax/filterArray.js
Multi filters an array of objects
View multiFilter.js
/**
* Multi-filter an array of objects
* @param {Array} array : list of elements to apply a multiple criteria filter
* @param {Object} filters: Contains multiple criteria filters by the property names of the objects to filter
* @return {Array}
*/
function multiFilter(array, filters) {
let filterKeys = Object.keys(filters);
// filters all elements passing the criteria
return array.filter((item) => filterKeys.every((key) => (filters[key].indexOf(item[key]) !== -1)));
View about.js
import angular from 'angular';
import uiRouter from 'angular-ui-router';
import ocLazyLoad from 'oclazyload';
let aboutModule = angular.module('about', [
uiRouter,
ocLazyLoad
])
.config(($stateProvider, $compileProvider) => {
@diegochavez
diegochavez / Introduccion.ts
Last active Apr 4, 2016
Introducción basica de TypeScript.
View Introduccion.ts
// Texto de tipo String o cadena,
let texto: String = 'hello world'
texto = 2 // Error no puede asignar un Numero a un tipo Cadena o String
// Una constante no puede ser reasignada
const PI: Number = 3.1416
PI = 3543 // Error: no puede asignar un valor a una constante
// Tipos de array lo cual es muy conveniente para evitar mutación de los datos con tipos invalidos
let nombres:Array<String> = ['David','Jose','Maria']
View configuration.yml
packages:
yum:
git: []
files:
/opt/elasticbeanstalk/hooks/appdeploy/pre/51install_meteor.sh:
mode: "000755"
user: root
group: root
encoding: plain
@diegochavez
diegochavez / htaccess
Created Mar 26, 2015
Angular App htaccess
View htaccess
# Apache Configuration File
# (!) Using `.htaccess` files slows down Apache, therefore, if you have access
# to the main server config file (usually called `httpd.conf`), you should add
# this logic there: http://httpd.apache.org/docs/current/howto/htaccess.html.
# ##############################################################################
# # CROSS-ORIGIN RESOURCE SHARING (CORS) #
# ##############################################################################
@diegochavez
diegochavez / swich_page_template
Last active Aug 29, 2015
Automatically Apply Parent Page Template To All Sub Pages In WordPress
View swich_page_template
function switch_page_template() {
global $post;
// Checks if current post type is a page, rather than a post
if (is_page())
{
// Checks if page is parent, if yes, return
if ($post->post_parent == 0)
return true;
else if ($post->post_parent != $post->ID)
You can’t perform that action at this time.