Skip to content

Instantly share code, notes, and snippets.

View jawira's full-sized avatar
Portugal. the dev

Jawira Portugal jawira

Portugal. the dev
View GitHub Profile
jawira / recursivity.php
Created September 23, 2020 09:04
Recursivity with anonymous function
View recursivity.php
namespace Jawira\Tests;
use function sleep;
function write($message): void
echo $message;
jawira / phive-install.php
Created September 3, 2019 18:17
Download and install Phive without wget nor curl
View phive-install.php
* Download and install Phive without wget nor curl
* Very useful for CI when using alpine images. However you will need to run
* `apk add ncurses` in order to execute Phive.
* If you want to run this with "php -r" you should first escape all '$' signs.
* @author Jawira Portugal <>
jawira / division-multiplication.php
Created January 21, 2018 09:29
Prints basic multiplication and division, answer is introduced by user.
View division-multiplication.php
#!/usr/bin/env php
try {
assert_options(ASSERT_ACTIVE, true);
assert_options(ASSERT_BAIL, true);
} catch (Exception $e) {
jawira / namespaces_and_constants.php
Last active March 15, 2016 09:25
Simple use of constants within a namespace.
View namespaces_and_constants.php
* Created by PhpStorm.
* User: jawira
* Date: 15.03.16
* Time: 10:03
namespace Dummy\MyTime;
const MONTHS = 12;
jawira / enable_logfile.sql
Created November 5, 2015 17:31
How to show the last queries executed on MySQL?
View enable_logfile.sql
-- Source:
SET GLOBAL log_output = "FILE";
SET GLOBAL general_log_file = "/path/to/your/logfile.log";
SET GLOBAL general_log = 'ON';
jawira / fibonacci.php
Last active June 20, 2019 08:27
Testing PHP7 features with Fibonacci sequence function
View fibonacci.php
* Succinct Fibonacci function
* Returns the first N Fibonacci numbers specified as parameter.
* This function has not been written for efficiency nor readabilty, instead it has
* been created for fun and for testing the latest PHP features (E.g.: generators,
* literal dereferencing, type hinting, short array syntax, ...).
jawira / 0_reuse_code.js
Last active August 29, 2015 14:23
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console