Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻
Staying hungry, staying foolish.

Igor Moraes igorsgm

👨‍💻
Staying hungry, staying foolish.
View GitHub Profile
View Code Sniffer (PhpStorm, Laravel, Git Hook).md

Don't forget to set PHP Code Style to PSR-2 in your PHPStorm


1) Add Code Sniffer to composer.json file

composer require squizlabs/php_codesniffer
@igorsgm
igorsgm / iterm2-solarized.md
Last active Jan 16, 2020 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)
View iterm2-solarized.md

Default

Default

Powerlevel10k

Powerlevel10k

@igorsgm
igorsgm / Criar novo Usuário e Schema.sql
Created Aug 13, 2018
#Criar novo Usuário e Schema no Banco de Dados Oracle
View Criar novo Usuário e Schema.sql
CREATE USER NOME_USUARIO_AQUI IDENTIFIED BY SENHA_USUARIO_AQUI DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMP ACCOUNT UNLOCK;
GRANT CREATE SESSION TO NOME_USUARIO_AQUI;
GRANT CREATE TABLE TO NOME_USUARIO_AQUI;
ALTER USER NOME_USUARIO_AQUI QUOTA UNLIMITED ON USERS;
GRANT EXP_FULL_DATABASE TO NOME_USUARIO_AQUI;
GRANT CONNECT TO NOME_USUARIO_AQUI;
GRANT create session, alter session TO NOME_USUARIO_AQUI;
GRANT create procedure to NOME_USUARIO_AQUI;
GRANT execute any procedure to NOME_USUARIO_AQUI;
GRANT create table TO NOME_USUARIO_AQUI;
View Importar JavaScript.php
<?php
JHtml::_('script', 'media/jui/js/article-img-credits.js', false, false, false, false, true);
@igorsgm
igorsgm / User.php
Created Feb 22, 2017
Coletar informações de um User
View User.php
<?php
// Importar se for utilizar o JUserHelper
jimport( 'joomla.user.helper' );
$userId = JUserHelper::getUserId('username');
$user = JFactory::getUser($userId);
View Carregar um helper na Model.php
<?php
JLoader::register('ComponentClassNameHelper', JPATH_COMPONENT);
View Verificar se o usuário é Super Admin.php
<?php
$user = JFactory::getUser();
$isroot = $user->authorise('core.admin');
View Pausar video ou audio ao fechar modal.js
js = jQuery.noConflict();
js(document).on('click', '.close', function () {
// Pausar e resetar video do YouTube
js(".modal iframe").attr("src", js(".modal iframe").attr("src"));
js('audio').each(function () {
this.pause(); // Pausar áudio
this.currentTime = 0; // Resetar tempo
});
View Filtro parseUrl.js
.filter('parseUrl', function ($sce) {
var urls = /(\b(https?|ftp):\/\/[A-Z0-9+&@#\/%?=~_|!:,.;-]*[-A-Z0-9+&@#\/%=~_|])/gim;
var emails = /(\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,6})/gim;
return function (text) {
if (text.match(urls)) {
text = text.replace(urls, '<a href="$1">$1</a>');
}
if (text.match(emails)) {
text = text.replace(emails, '<a href=\"mailto:$1\">$1</a>');
@igorsgm
igorsgm / Criar alias.php
Created Dec 12, 2016
Este código cria uma alias (para url amigável) da variável $string no Joomla
View Criar alias.php
<?php JFilterOutput::stringURLSafe($string);