Skip to content

Instantly share code, notes, and snippets.

View bay007's full-sized avatar
🏠
Working from home

egalicia bay007

🏠
Working from home
View GitHub Profile
@bay007
bay007 / strategy-pattern.js
Last active May 19, 2017 05:31 — forked from glcheetham/strategy-pattern.js
Strategy Pattern JS example
// Example. Let's sort the apples, pears, and oranges into the right baskets.
const fruits = ["apple", "pear", "apple", "apple", "orange", "pear", "orange", "pear", "apple"]
let appleBasket = []
let pearBasket = []
let orangeBasket = []
let strategies = []
const appleSortStrategy = (fruit) => {
@bay007
bay007 / appspec.yml
Created June 30, 2018 20:02 — forked from moshest/appspec.yml
Node.js Project on AWS CodeDeploy CentOS
version: 0.0
os: linux
files:
- source: /
destination: /home/ec2-user/node
permissions:
- object: /home/ec2-user
owner: ec2-user
group: ec2-user
type:
@bay007
bay007 / appspec.yml
Created July 8, 2018 03:31 — forked from erickeno/appspec.yml
Node.js Project on AWS CodeDeploy CentOS
version: 0.0
os: linux
files:
- source: /
destination: /home/ec2-user/node
permissions:
- object: /home/ec2-user
owner: ec2-user
group: ec2-user
type:
@bay007
bay007 / gist:e8b969cbe82ded2e8ce3a0f6771afa07
Last active January 4, 2019 07:22
Good websites for learn tech
https://sabe.io
https://alistapart.com
https://alligator.io
https://scotch.io
http://codebyjeff.com
https://vuejsdevelopers.com
@bay007
bay007 / blog.md
Created January 4, 2019 07:36 — forked from JacobBennett/blog.md
Clean up your Vue modules with ES6 Arrow Functions

Recently when refactoring a Vue 1.0 application, I utilized ES6 arrow functions to clean up the code and make things a bit more consistent before updating to Vue 2.0. Along the way I made a few mistakes and wanted to share the lessons I learned as well as offer a few conventions that I will be using in my Vue applications moving forward.

The best way to explain this is with an example so lets start there. I'm going to throw a rather large block of code at you here, but stick with me and we will move through it a piece at a time.

<script>

// require vue-resource...

new Vue({
@bay007
bay007 / gist:20a0a0229d2816e9c8884b8e58fb9b9b
Last active January 26, 2019 06:03
Clases -- Temas básicos.
from random import randint
class Dado:
"""Simula un dado y mantiene su estado
--- Hay 3 clases de estilos de generar doc strings,
Sphinx, NumPy y Google.
"""
@bay007
bay007 / users.json
Created January 29, 2019 07:24
Users
[
{
"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "Sincere@april.biz",
"address": {
"street": "Kulas Light",
"suite": "Apt. 556",
"city": "Gwenborough",
@bay007
bay007 / bancomer
Created April 1, 2019 05:58
Regex Tarjetas Credito
var patron=/^[a-zA-Z0-9]{1}[0-9]{7}(-){0,1}[0-9]{3}$/;
var patron2=/^((0094)[0-9]{8})$/;
var patron3=/^(([0-9]{16}))$/;
@bay007
bay007 / Postgres restricted access
Last active June 29, 2019 19:29
Create Django with postgres user without full access.
GRANT CONNECT ON DATABASE database_name TO username;
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA database_name TO username;
ALTER ROLE "username" WITH LOGIN;
ALTER USER username WITH NOSUPERUSER;
sudo apt update &sudo apt upgrade
sudo apt install postgresql postgresql-contrib
sudo -i -u postgres
psql -h localhost
# \du
# create database alphadb01
# \l
# create user restricteduser01 with encrypted password 'ER#df6512**!ff#sd...';
# GRANT CONNECT ON DATABASE alphadb01 TO restricteduser01;
# GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO restricteduser01;