Skip to content

Instantly share code, notes, and snippets.

😃
Coding

J. Gabriel Corpas naoxink

😃
Coding
Block or report user

Report or block naoxink

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
@naoxink
naoxink / getType.js
Last active Sep 26, 2018
Utility to check variable types easy
View getType.js
function getType(x){
return Object.prototype.toString.call(x).toLowerCase().replace(/\[(.*)\s|\]$/g, '')
}
// Types (all strings):
//
// number
// string
// boolean
// date
@naoxink
naoxink / print_array.php
Last active Jul 17, 2018
print_array PHP
View print_array.php
<?php
/**
* Imprime un array en consola con otro formato
* @param array $array
* @param integer $lvl
* @param integer $keylen
* @param integer $actual_spaces
*/
function print_array($array, $lvl = 0, $keylen = 0, $actual_spaces = 0){
if($lvl == 0){
@naoxink
naoxink / addVirtualProperty.js
Created Jul 17, 2018
`Object.defineProperty` calculated property test
View addVirtualProperty.js
function addVirtualProperty(options){
if(!options.obj || typeof options.obj !== 'object'){
throw new Error('Expected `obj`[Object object]')
}
if(!options.prop){
throw new Error('Expected `prop`')
}
Object.defineProperty(options.obj, options.prop, {
get(){
return options.getter.call(options.obj)
@naoxink
naoxink / customElements.html
Created Jul 12, 2018
TEST Custom Web Elements
View customElements.html
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>TEST Custom Elements</title>
<style>body{text-align: center;}</style>
</head>
<body>
<template id="clickBtn">
@naoxink
naoxink / createIterator.js
Last active Jul 11, 2018
Simple iterator in Javascript
View createIterator.js
function createIterator(array){
var index = -1
var hasNext = function(){
return (index + 1) < array.length
}
var hasPrev = function(param){
return (index - 1) < array.length && (index - 1) > -1
}
You can’t perform that action at this time.