Skip to content

Instantly share code, notes, and snippets.

View yurimorales's full-sized avatar

Yuri Morales yurimorales

  • Palhoça, SC - Brazil
View GitHub Profile
@yurimorales
yurimorales / simpleRandomTokenGenerator.php
Created December 10, 2019 21:00
Simple Token Generator PHP 7
<?php
$token = bin2hex(openssl_random_pseudo_bytes(54
));
echo $token;
@yurimorales
yurimorales / randomToken.php
Last active December 10, 2019 20:45
Random Token Generator - PHP
<?php
$generateToken = function($length = 50) {
$token = "";
$string = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
$maxNumbers = strlen($string);
$i = 0;
while ($i < $length) {
@yurimorales
yurimorales / git.md
Last active January 15, 2021 17:02 — forked from leocomelli/git.md
Lista de comandos úteis do GIT

#GIT

Estados

  • Modificado (modified);
  • Preparado (staged/index)
  • Consolidado (comitted);

Ajuda

@yurimorales
yurimorales / SessionIdleHandler.php
Created February 28, 2019 17:44 — forked from bbene/SessionIdleHandler.php
Symfony 3 Auto Logout
<?php
// AppBundle/Handler/SessionIdleHandler.php
namespace AppBundle\Handler;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
@yurimorales
yurimorales / vimtutor.md
Created August 16, 2018 14:17 — forked from ericdouglas/vimtutor.md
Síntese de comandos das lições 4, 5, 6 e 7 do vimtutor

Localização e Status do Arquivo

  • ctrl g informa a sua localização no arquivo.
  • G leva o cursor para última linha do arquivo.
  • gg leva o cursor para primeira linha do arquivo.
  • 13 G leva o cursor para linha 13. ps: Digitando qualquer número no lugar do 13, te leva para a linha digitada.

Buscando por Palavras

  • /padrão vai buscar por uma incidência da palavra padrão no texto. Troque padrão por qualquer outra palavra que você queira encontrar.
@yurimorales
yurimorales / Install Gulp.txt
Created June 17, 2018 00:22 — forked from objarni/Install Gulp.txt
Installing gulp in Windows
1. Install nodejs. https://nodejs.org/en/
2. Check npm (node package manager) is installed via command prompt:
$ npm
3. Install gulp:
$ npm install gulp --global
4. In relevant project folder, create 'gulpfile.js':
$file = new SplFileObject("filename.txt");
$file->seek(9); // so it's line 10
echo $file->current(); // outputs line 10
$linesIterator = new LimitIterator(
new SplFileObject("filename.txt"),
9, // start at line 10
20 // iterate 20 lines
);
foreach ($linesIterator as $line) {
echo $line; // outputs line 10 to 30
}
# remove specific file from git cache
git rm --cached filename
# remove all files from git cache
git rm -r --cached .
git add .
git commit -m ".gitignore is now working"