Skip to content

Instantly share code, notes, and snippets.

@LuisPaGarcia
LuisPaGarcia / 0_reuse_code.js
Created March 14, 2017 19:20
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@LuisPaGarcia
LuisPaGarcia / comoCifrar.js
Created October 5, 2017 22:35
Como cifrar con AES
//<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js"></script>
var encrypted = CryptoJS.AES.encrypt("Texto A Cifrar", "Llave");
var decrypted = CryptoJS.AES.decrypt(encrypted, "LLave");
var plaintext = decrypted.toString(CryptoJS.enc.Utf8);
console.log('encrypted', encrypted.toString(), 'decrypted', decrypted.toString(), 'plaintext', plaintext);
@LuisPaGarcia
LuisPaGarcia / uniq.js
Created October 5, 2017 22:54 — forked from telekosmos/uniq.js
Remove duplicates from js array (ES5/ES6)
var uniqueArray = function(arrArg) {
return arrArg.filter(function(elem, pos,arr) {
return arr.indexOf(elem) == pos;
});
};
var uniqEs6 = (arrArg) => {
return arrArg.filter((elem, pos, arr) => {
return arr.indexOf(elem) == pos;
});
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
@LuisPaGarcia
LuisPaGarcia / webpack.config.js
Created January 6, 2018 14:57
A webpack basic config for personal projects
const path = require("path");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
entry: "./src/webpack.app.js",
output: {
filename: "bundle.js",
path: path.join(__dirname, "src")
},
module: {
@LuisPaGarcia
LuisPaGarcia / IndexedDB101.js
Created April 6, 2018 00:42 — forked from JamesMessinger/IndexedDB101.js
Very Simple IndexedDB Example
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB;
// Open (or create) the database
var open = indexedDB.open("MyDatabase", 1);
// Create the schema
open.onupgradeneeded = function() {
var db = open.result;
var store = db.createObjectStore("MyObjectStore", {keyPath: "id"});
@LuisPaGarcia
LuisPaGarcia / html
Created June 2, 2018 11:22
LIbro Ale
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Libro</title>
<style>
html,
@LuisPaGarcia
LuisPaGarcia / git-lambda.js
Created February 20, 2019 00:58 — forked from loopiezlol/git-lambda.js
flow showing off how to clone, update and push to a git repo from an AWS lambda function
const fs = require('fs')
const path = require('path')
const process = require('process')
const { spawnSync } = require('child_process')
const { GITHUB_TOKEN, GITHUB_USERNAME, GITHUB_EMAIL } = process.env
// leaving this without https:// in order to reuse it when adding the remote
const gitRepositoryURL = 'github.com/owner/repo-name.git'
const repositoryName = 'repo-name'
@LuisPaGarcia
LuisPaGarcia / hello_world.py
Created March 25, 2019 03:35
Hello World Examples
class HelloWorld:
def __init__(self, name):
self.name = name.capitalize()
def sayHi(self):
print "Hello " + self.name + "!"
hello = HelloWorld("world")
hello.sayHi()
@LuisPaGarcia
LuisPaGarcia / hello_world.py
Created March 25, 2019 03:37
Hello World Examples
class HelloWorld:
def __init__(self, name):
self.name = name.capitalize()
def sayHi(self):
print "Hello " + self.name + "!"
hello = HelloWorld("world")
hello.sayHi()