Skip to content

Instantly share code, notes, and snippets.

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

Moisés Alcocer oricis

🏠
Working from home
View GitHub Profile
To set code snippets on Visual Studio Code:
Go to to View / Command Palette
Write "snippets" and select "Snippets > Configure User Snippets".
Select PHP.json or the language that you want.
***
My PHP snippets:
{
@oricis
oricis / git-aliases.md
Created October 24, 2021 16:00
git aliases

[user] email = foo@mail.es name = "Foo Baz"

[alias] aa = add --all br = branch ca = commit --amend cm = commit -m co = checkout

{
"name": "ironwoods/some-name",
"type": "project",
"description": "Lorem ipsum...",
"license": "MIT",
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},

set all files to 644

sudo find /path/to/your/code -type f -exec chmod 644 {} ;

make all folders 755

sudo find code -type d -exec chmod 755 {} ;

make sorage and cache writable

sudo chmod -R ug+rwx storage bootstrap/cache

@oricis
oricis / FileHelper.php
Created October 30, 2020 18:46 — forked from atorscho/FileHelper.php
Helpers to manipulate with files and images for Laravel projects.
<?php
namespace App\Helpers;
use Closure;
use Image;
use Intervention\Image\Constraint;
use Symfony\Component\HttpFoundation\File\UploadedFile;
class FileHelper
# With NPM
npm install --save-dev @babel/core@7.9.0 @lingui/cli@2.9.1 @lingui/macro@2.9.1 babel-core@7.0.0-bridge.0
npm install --save @lingui/react@2.9.1
# With Yarn
yarn add --dev @babel/core@7.9.0 @lingui/cli@2.9.1 @lingui/macro@2.9.1 babel-core@7.0.0-bridge.0
yarn add @lingui/react@2.9.1
@oricis
oricis / gist:deec0426e9d028814733dd746a8df00c
Created April 6, 2020 09:33
aleatory ordenation of the elements in an array
function getRandomSort(arr, number_of_elements)
{
// Check and fix number_of_elements value
if (number_of_elements === undefined
|| number_of_elements > arr.length) {
number_of_elements = arr.length
}
let result = [];
while (result.length < number_of_elements) {
@oricis
oricis / gist:757f0719596bd6a5709e4b513e4a7d6d
Created April 5, 2020 18:22
JS random string (letters + numbers)
// From: https://stackoverflow.com/a/1349426/3919660
function getRamdomString(length)
{
let result = '';
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
const charactersLength = characters.length;
for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
@oricis
oricis / countries.json
Created June 19, 2016 22:41 — forked from keeguon/countries.json
A list of countries in JSON
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},
#############################################
# Push de la rama actual
git push origin $rama_actual
#############################################
# Volver a un commit anterior, descartando los cambios
git reset --HARD $SHA1
#############################################
# Ver y descargar Ramas remotas