Skip to content

Instantly share code, notes, and snippets.

View alejandrofloresm's full-sized avatar

Alejandro Flores alejandrofloresm

View GitHub Profile
@alejandrofloresm
alejandrofloresm / script.sh
Created November 21, 2017 00:22
Remove all the branches except master and the current one
# Remove all the branches except master and the current one
# Resource: https://coderwall.com/p/x3jmig/remove-all-your-local-git-branches-but-keep-master
git branch | egrep -v "(master|\*)" | xargs git branch -D
@alejandrofloresm
alejandrofloresm / .editorconfig
Created October 3, 2017 06:01
An .editorconfig proposal for Laravel projects
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
@alejandrofloresm
alejandrofloresm / RemoveCarriage.vb
Created September 14, 2017 05:20
Remove new line and change it for a <br>
'taken from: https://www.extendoffice.com/documents/excel/902-excel-remove-line-breaks.html
Sub RemoveCarriage()
Dim Rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
For Each Rng In WorkRng
Rng.Value = Replace(Rng.Value, Chr(13), "<br>")
@alejandrofloresm
alejandrofloresm / error-jquery.html
Last active September 10, 2017 17:41
error-jquery.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="description" content="Description">
<title>File</title>
<script>
// Este método va a dar error por que jQuery no se ha cargado
$('body').change(function() { });
</script>
@alejandrofloresm
alejandrofloresm / delete-all-branches-except-master-local.sh
Created September 9, 2017 16:02
Delete all branches except master in local
# Taken from:
# https://coderwall.com/p/x3jmig/remove-all-your-local-git-branches-but-keep-master
$ git branch | grep -v "master" | xargs git branch -D
@alejandrofloresm
alejandrofloresm / commands-git.sh
Created July 16, 2017 17:40
Delete your local branches that are not on the remote.
# Shows the branches that should be deleted
# Resource: https://kparal.wordpress.com/2011/04/15/git-tip-of-the-day-pruning-stale-remote-tracking-branches/
git remote prune origin --dry-run
# Deletes the branches
git remote prune origin
# It can also be done with fetch
git fetch origin --prune
@alejandrofloresm
alejandrofloresm / resources.txt
Created June 23, 2017 17:03
Laravel Resources
+----------------------------------------+----------------------+---------+----------------+
| Actions Handled By Resource Controller | | | |
+----------------------------------------+----------------------+---------+----------------+
| Verb | URI | Action | Route Name |
| GET | /photos | index | photos.index |
| GET | /photos/create | create | photos.create |
| POST | /photos | store | photos.store |
| GET | /photos/{photo} | show | photos.show |
| GET | /photos/{photo}/edit | edit | photos.edit |
| PUT/PATCH | /photos/{photo} | update | photos.update |
@alejandrofloresm
alejandrofloresm / GenerateUserAndDatabaseMYSQL.sql
Last active January 2, 2019 20:26
Generate and grant new permissions to a MySQL user to a new database
/**
* 1. Create the database
* Change:
* <database_name>: to your database name
*/
CREATE DATABASE <database_name>;
/**
* 2. Create the user
* Change:
@alejandrofloresm
alejandrofloresm / gist:ba1eb5750a2afa6c3ec4d13f037db9d2
Created May 29, 2017 04:47
Generate a Laravel Key but don't added it to your .env file, just print it on the terminal
php artisan key:generate --show
@alejandrofloresm
alejandrofloresm / Some useful regex things for sublime text.md
Last active January 31, 2017 21:54
Some useful regex for sublime text

This is a collection of useful regex formulas that I have found on the internet, to be honest mainly on stackoverflow :) #Selection

Select everything inside brackets {}

\{[^}]*\}

Select everything between ""

(["'])(?:(?=(\\?))\2.)*?\1