Skip to content

Instantly share code, notes, and snippets.

View alejandrofloresm's full-sized avatar

Alejandro Flores alejandrofloresm

View GitHub Profile
@alejandrofloresm
alejandrofloresm / export.txt
Created December 6, 2019 02:24
phpMyAdmin Export Database with Datetime
// Outputs: database_2019-09-09_14-15-12
@DATABASE@_%Y-%m-%d_%H-%M-%S
// Outputs: database_20190909_141512
@DATABASE@_%Y%m%d_%H%M%S
@alejandrofloresm
alejandrofloresm / export_database_with_timestamp.sh
Last active December 17, 2019 18:59
Exports a database with timestamp
# Exports the database to an sql file with a timestamp
# USERNAME = username
# PASSWORD = password
# DATABASE = database
# PATH = location to store the database
mysqldump -u [USERNAME] -p[PASSWORD] [DATABASE] > [PATH]/$(date +\%Y\%m\%d-\%H\%M\%S)_[DATABASE].sql
# Exports to a gzip file
mysqldump -u [USERNAME] -p[PASSWORD] [DATABASE] | gzip > [PATH]/$(date +\%Y\%m\%d-\%H\%M\%S)_[DATABASE].sql.gz
@alejandrofloresm
alejandrofloresm / Button.js
Created October 11, 2019 00:18
Simple Button Class for p5.js
class Button {
constructor(label, x, y, colorHex = '#FF0000') {
this.label = label;
this.x = x;
this.y = y;
this.colorHex = colorHex;
this.labelSize = textWidth(label);
this.spacing = 20;
@alejandrofloresm
alejandrofloresm / backup_create_user.sql
Last active November 26, 2020 05:04
Create a user for backing up your database.sql
CREATE USER '{{ BACKUP_USER_NAME }}'@'localhost' IDENTIFIED BY '{{ BACKUP_USER_PASSWORD }}';
GRANT SELECT, SHOW VIEW, RELOAD, REPLICATION CLIENT, EVENT, TRIGGER ON {{ BACKUP_DATABASE_NAME }}.* TO '{{ BACKUP_USER_NAME }}'@'localhost';
FLUSH PRIVILEGES;
-- CREATE DATABASE
CREATE DATABASE {{DATABASE_NAME}} CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER '{{DATABASE_USER}}'@'{{DATABASE_HOST}}' IDENTIFIED BY '{{BACKUP_USER_PASSWORD}}';
GRANT ALL PRIVILEGES ON {{DATABASE_NAME}}.* TO '{{DATABASE_USER}}'@'{{DATABASE_HOST}}' WITH GRANT OPTION;
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Zoológicos</title>
<meta name="description" content="">
<meta name="author" content="">
</head>
<body>
<h1>Zoológicos</h1>
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
public class GameManager : MonoBehaviour
{
public Transform Player;
// Start is called before the first frame update
void Start()
using UnityEngine;
using System.Collections;
public class MoveToTargets : MonoBehaviour {
// Lugar a donde vamos
public Transform[] Targets;
public int _targetIndex = 0;
// Velocidad que tenemos
public float Speed = 1;
@alejandrofloresm
alejandrofloresm / AppServiceProvider.php
Created January 31, 2019 17:47
Laravel AppServiceProvider.php for AMPPS
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
class AppServiceProvider extends ServiceProvider
{
/**
@alejandrofloresm
alejandrofloresm / margin-padding-gen.scss
Created December 23, 2017 07:49
Generate margin and padding options
/**
* Generates margin and padding classes:
* usage:
* @include gen-mar-pad(10, px);
* generates:
* .margin-top-10 {
* margin-top: 10px;
* }
*
* .padding-top-10 {
@alejandrofloresm
alejandrofloresm / gist:3f5475b6900f4b22c277de8ed4efe781
Created December 10, 2017 23:35
Connect using the socket of MySQL ampps
ln -s /Applications/AMPPS/var/mysql.sock /tmp/mysql.sock