Skip to content

Instantly share code, notes, and snippets.

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

Luis luisintosh

🏠
Working from home
View GitHub Profile
@luisintosh
luisintosh / DbmigrateController.php
Created December 6, 2015 00:20 — forked from bruceoutdoors/DbmigrateController.php
Laravel 4 Convert existing MySQL database to migrations. This is a fork of Christopher Pitt's work http://laravelsnippets.com/snippets/convert-an-existing-mysql-database-to-migrations, which is based off michaeljcalkins's work at http://paste.laravel.com/1jdw#sthash.0nEgQzQR.dpuf. His original source code doesn't really work out of the box in my…
<?php
/* * **
*
* This script converts an existing MySQL database to migrations in Laravel 4.
*
* 1. Place this file inside app/controllers/
*
* 2. In this file, edit the index() method to customize this script to your needs.
* - inside $migrate->ignore(), you pass in an array of table
@luisintosh
luisintosh / NumeroALetras.js
Last active November 26, 2016 00:03 — forked from alfchee/NumeroALetras.js
Código en JavaScript que convierte números a letras, bastante útil para formularios de documentos contables y similares
/*************************************************************/
// NumeroALetras
// The MIT License (MIT)
//
// Copyright (c) 2015 Luis Alfredo Chee
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
const regex = /[?&]tag=([a-zA-Z0-9\-]+)/;
const str = `https://www.amazon.com.mx/Hewlett-Packard-14-av006la-Port%C3%A1til-Pavilion/dp/B01GV7OOCU/ref=s9_simh_gw_g147_i2_r?pf_rd_m=AVDBXBAVVSXLQ&pf_rd_s=&pf_rd_r=YAMKESSPKDXG1&tag=offer10b0b-20&pf_rd_t=36701&pf_rd_p=fe19d36a-3411-4bce-8ef7-fef09d37fff8&pf_rd_i=desktop`;
let m;
if ((m = regex.exec(str)) !== null) {
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
@luisintosh
luisintosh / create-swapfile-ondigital-ocean.sh
Created February 15, 2017 05:46
Create swapfile on digitalocean
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
swapon -s
free -m
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
@luisintosh
luisintosh / numberToCurrency.js
Created April 26, 2018 17:56
Number to currency Javascript
/**
* Separates groups of numbers three in three by a comma
*/
function numberToCurrency(number) {
var number = ""+number;
number = number.split("").reverse().join("");
number = number.split(".");
number[1] = number[1].match(/.{1,3}/g).join(",");
number = number.join(".");
number = number.split("").reverse().join("");
@luisintosh
luisintosh / create_wp.sh
Last active April 27, 2019 02:17
create_wp.sh
#!/bin/bash
if [ $# -lt 1 ]; then
echo usage: create_wp domain [email]
exit 1
fi
domain=$1
PATH=$PATH:/usr/local/vesta/bin
@luisintosh
luisintosh / create_wp.vestacp.md
Last active June 2, 2019 20:40
Install wordpress in VestaCP with a command

Installing command in a server with VestaCP

wget https://gist.githubusercontent.com/luisintosh/ad4ef22dc1c4fa40adf336e608f0cafe/raw/70dd98b379ae8614d6df96720f9845b5ae026002/create_wp.sh && chmod +x create_wp.sh && mv create_wp.sh /usr/local/bin/create_wp

Usage

create_wp domain [email]

NOTE: If you disabled the PHP functions proc_open() and/or proc_close() you need to temporary enable them.

@luisintosh
luisintosh / Cursor Profile
Last active January 16, 2025 21:29
{"name":"Cursor Profile","settings":"{\"settings\":\"{\\n \\\"ruby.format\\\": \\\"rubocop\\\",\\n \\\"ruby.codeCompletion\\\": \\\"rcodetools\\\",\\n \\\"editor.fontSize\\\": 15,\\n \\\"editor.tabSize\\\": 2,\\n \\\"editor.suggestSelection\\\": \\\"first\\\",\\n \\\"vsintellicode.modify.editor.suggestSelection\\\": \\\"automaticallyOverrodeDefaultValue\\\",\\n \\\"[ruby]\\\": {\\n \\\"editor.defaultFormatter\\\": \\\"rebornix.ruby\\\"\\n },\\n \\\"emmet.includeLanguages\\\": {\\n \\\"erb\\\": \\\"html\\\",\\n \\\"ruby\\\": \\\"html\\\"\\n },\\n \\\"vsicons.dontShowNewVersionMessage\\\": true,\\n \\\"git.autofetch\\\": true,\\n \\\"javascript.updateImportsOnFileMove.enabled\\\": \\\"always\\\",\\n \\\"turboConsoleLog.quote\\\": \\\"'\\\",\\n \\\"turboConsoleLog.addSemicolonInTheEnd\\\": true,\\n \\\"editor.fontLigatures\\\": true,\\n \\\"[typescript]\\\": {\\n \\\"editor.defaultFormatter\\\": \\\"esbenp.prettier-vscode\\\"\\n },