Skip to content

Instantly share code, notes, and snippets.

View reymon359's full-sized avatar
🍊
eating

Ramón Morcillo reymon359

🍊
eating
View GitHub Profile
@reymon359
reymon359 / StorageProvider.ts
Last active January 3, 2019 14:11
A string variable local storage provider for ionic. ( Done a bit too fast, probably something worng)
// Author: Ramon Morcillo @reymon359
import { Platform } from "ionic-angular";
import { Storage } from "@ionic/storage";
@Injectable()
export class StorageProvider {
constructor(private platform: Platform, private storage: Storage) {
console.log('Hello Storage Provider');
}
@reymon359
reymon359 / tokenGenerator.js
Created January 4, 2019 08:46
Jus another token generator
// Author: Ramon morcillo @reymon359
function random() {
return Math.random().toString(36).substr(2); // To remove `0.`
}
function token() {
return random() + random(); // To make it longer
}
@reymon359
reymon359 / basicCRUD.js
Created January 8, 2019 13:23
basic node express CRUD
const express = require('express');
let app = express();
let example = require('../models/example');
// Create a new example
app.post('/example', (req, res) => {
let body = req.body;
let example = new example({
@reymon359
reymon359 / loginTokenTest.js
Created January 10, 2019 13:01
Postman login token test
// this function makes that the token environment variable updates after making the login
let resp = pm.response.json();
if(resp.ok){
let token = resp.token;
pm.environment.set("token",token);
}else{
console.log('Token was not updated');
}
@reymon359
reymon359 / tictactoe.py
Created April 30, 2019 10:45
Tic Tac Toe Python game for 2 people
# Specifically for the iPython Notebook environment for clearing output
from IPython.display import clear_output
import random
# Global variables
theBoard = [' '] * 10 # a list of empty spaces
available = [str(num) for num in range(0,10)] # a List Comprehension
players = [0,'X','O'] # note that players[1] == 'X' and players[-1] == 'O'
# IMPORT STATEMENTS AND VARIABLE DECLARATIONS:
import random
suits = ('Hearts', 'Diamonds', 'Spades', 'Clubs')
ranks = ('Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Jack', 'Queen', 'King', 'Ace')
values = {'Two':2, 'Three':3, 'Four':4, 'Five':5, 'Six':6, 'Seven':7, 'Eight':8,
'Nine':9, 'Ten':10, 'Jack':10, 'Queen':10, 'King':10, 'Ace':11}
playing = True
@reymon359
reymon359 / email-pattern.txt
Last active May 16, 2019 17:39
Regular expression for email pattern
pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$"
@reymon359
reymon359 / deploy-gh.sh
Created June 1, 2019 21:44 — forked from nicobytes/deploy-gh.sh
Deploy gh-pages ionic pwa
#!/bin/bash
git branch -D gh-pages
git push origin --delete gh-pages
git checkout -b gh-pages
ionic build --prod
find . -type d ! -path './www*' ! -path './.git*' ! -path '.' | xargs rm -rf
rm -r *.*
mv www/* .
rm -rf www
git add .
@reymon359
reymon359 / .hyper.js
Created June 12, 2019 14:44
My personal configuration for hyper https://hyper.is/
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
@reymon359
reymon359 / gh_pages_angular.sh
Last active August 17, 2019 16:23
Deploy Angular ( 2+ ) project to Github Pages
#! /bin/bash/ps1/
#! 🥝🥝IMPORTANT🍅🍅 Before doing this, change the path of images from path="imagePath" to path="./imagePath"
#! Then install the angular-cli-ghpages globally
npm install -g angular-cli-ghpages
#! Now lets build the project in to a project folder
ng build --prod --output-path project --base-href "https://<githubUsername>.github.io/<repositoryName>/"
#! Publishing it to gh pages