Skip to content

Instantly share code, notes, and snippets.

@diter14
diter14 / Switch-PHP-version-on-Valet.md
Created July 1, 2019 14:57 — forked from bgarrant/ValetSwitchPHP.md
How to Switch PHP Version in Laravel Valet between PHP 7.1 and PHP 5.6

How to Switch PHP Version in Laravel Valet between PHP 7.1 and PHP 5.6

Valet switch PHP version with these commands

Install PHP 5.6 and switch Valet to PHP 5.6

valet stop
brew unlink php71
brew install php56
brew install php56-mcrypt

Kill localhost server on Mac

  lsof -i :8000
  kill -9 <PID>

You can replace :8000 with the port that you are using

Find php.ini in any OS

 php -i | grep php.ini

Documentation

  • https://lavrton.com/javascript-loops-how-to-handle-async-await-6252dd3c795/
@diter14
diter14 / sleep.js
Last active February 20, 2019 14:04 — forked from eteeselink/delay.js
ES7 async/await version of setTimeout
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
async function doSomething() {
console.log("this might take some time....");
await sleep(5000);
console.log("done!")
}
doSomething();
    $keyToSearch = 'age';
    $valueToSearch = 20;
    $multidimensional = [
        [
            'name' => 'Barry Allen',
            'age' => 20,
        ],
        [
 'name' =&gt; 'Steve Rogers',
@diter14
diter14 / Remove branch locally and remotelly.md
Created September 18, 2018 17:47
Remove branch locally and remotelly

Remove branch locally and remotelly

// To remove locally branch
git branch -d branch_name

// To remove remotelly branch
git push origin :branch_name
@diter14
diter14 / How to handle dates in PHP.md
Last active September 7, 2018 14:16
How to add or subtract dates in PHP

How to add or subtract dates in PHP

  • For current date
// You can add or subtract days, weeks, months, years using
// (+/-)(number) (day|week|month|year)
// e.g. "+1 year"

$currentDate = date('Y-m-d');
@diter14
diter14 / git-flow_windows.md
Last active August 7, 2018 15:26 — forked from geedelur/git-flow_windows.textile
Git Flow Windows Install

Git-Flow Windows Install

  • Instalar Git en Windows

    • Asegurarse de settear: "Checkout as-is, commit Unix-style line endings."
  • Descargar los siguientes paquetes:

    • Paquete getopt
      • Descomprimir y copiar getopt.exe a C:\Program Files (x86)\Git\bin
    • DLL
  • Descomprimir y copiar libintl3.dll a C:\Program Files (x86)\Git\bin
Account acc = Database.query('SELECT ' + String.join(new List<String>(Schema.getGlobalDescribe().get('Account').getDescribe().fields.getMap().keySet()), ',') + ' FROM Account');