Skip to content

Instantly share code, notes, and snippets.

View natanfelles's full-sized avatar
💥
Hunting bugs!

Natan Felles natanfelles

💥
Hunting bugs!
View GitHub Profile
@natanfelles
natanfelles / git_submodules.md
Created July 13, 2021 18:50 — forked from gitaarik/git_submodules.md
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of advantages of using submodules:

  • You can separate the code into different repositories.
@natanfelles
natanfelles / codeigniter4-bootstrap-pager.php
Created April 15, 2020 20:30
CodeIgniter 4 Bootstrap Pager
<?php
/**
* @var \CodeIgniter\Pager\PagerRenderer $pager
*/
$pager->setSurroundCount(2);
?>
<nav aria-label="<?= lang('Pager.pageNavigation') ?>">
<ul class="pagination">
@natanfelles
natanfelles / text_helper.php
Created February 20, 2020 23:12
HTML Purifier Helper for TinyMCE
<?php
/**
* @param string $content
*
* @return string
*/
function purify(string $content) : string
{
$config = \HTMLPurifier_Config::createDefault();
$config->set('HTML.AllowedElements', [
$ sudo apt update
Obter:1 http://deb.debian.org/debian buster InRelease [122 kB]
Err:1 http://deb.debian.org/debian buster InRelease
As assinaturas a seguir não puderam ser verificadas devido à chave pública não estar disponível: NO_PUBKEY 04EE7237B7D453EC NO_PUBKEY 648ACFD622F3D138 NO_PUBKEY DCC9EFBF77E11517
Lendo listas de pacotes... Pronto
W: Erro GPG: http://deb.debian.org/debian buster InRelease: As assinaturas a seguir não puderam ser verificadas devido à chave pública não estar disponível: NO_PUBKEY 04EE7237B7D453EC NO_PUBKEY 648ACFD622F3D138 NO_PUBKEY DCC9EFBF77E11517
E: The repository 'http://deb.debian.org/debian buster InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
@natanfelles
natanfelles / xdebug_installation_on_linux.md
Created December 14, 2019 19:29 — forked from RazaChohan/xdebug_installation_on_linux.md
Walkthrough for installing xdebug for php 7 on linux and enabling its support for phpstorm.

Xdebug Installation

Please follow the following steps to configure Xdebug on Linux.


Tested on

@natanfelles
natanfelles / index.php
Created November 24, 2019 00:11 — forked from ziadoz/index.php
Simple PHP / jQuery CSRF Protection
<?php
// See: http://blog.ircmaxell.com/2013/02/preventing-csrf-attacks.html
// Start a session (which should use cookies over HTTP only).
session_start();
// Create a new CSRF token.
if (! isset($_SESSION['csrf_token'])) {
$_SESSION['csrf_token'] = base64_encode(openssl_random_pseudo_bytes(32));
}
@natanfelles
natanfelles / SCSS.md
Created March 4, 2019 23:16 — forked from jareware/SCSS.md
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

Bookmarklet

Copy and paste this into a bookmark:

javascript:!function(d){d.head.appendChild(d.createElement("style")).innerText="html,img,video{-webkit-filter:invert(1)hue-rotate(180deg);filter:invert(1)hue-rotate(180deg)}body{background:#000}"}(document);
<?php
// https://3v4l.org/gDRdq
$foo = 'a/b/c/d/e';
$bar = null;
$m = memory_get_usage();
$t = microtime(true);
for($i = 0; $i < 10000; $i++)
{
<?php
//https://3v4l.org/IoNmr
$dir = null;
$m = memory_get_usage();
$t = microtime(true);
for($i = 0; $i < 10000; $i++)
{
$dir = \dirname('/etc/crontab');