Skip to content

Instantly share code, notes, and snippets.

View thiagocordeiro's full-sized avatar
🥵
Melting

Thiago Cordeiro thiagocordeiro

🥵
Melting
View GitHub Profile
@thiagocordeiro
thiagocordeiro / check-file-size.sh
Created November 26, 2021 14:03
check-file-size.sh
#!/bin/bash
echo "$(git ls-files | xargs cat | wc -l | xargs) Lines of code"
RESULT=$(wc -l $(git ls-files) | grep .php | grep -v "tests/" | awk '{ if ( $1 > 250 ) printf("%-6s | %s \n\r", $1, $2) }')
if [ -n "$RESULT" ]; then
awk 'BEGIN {s=sprintf("%131s","");gsub(/ /,"-",s);print s}'
echo "LINE | FILE"
awk 'BEGIN {s=sprintf("%131s","");gsub(/ /,"-",s);print s}'
echo $RESULT
awk 'BEGIN {s=sprintf("%131s","");gsub(/ /,"-",s);print s}'
@thiagocordeiro
thiagocordeiro / globo-pip.js
Last active July 27, 2021 12:50
Enable globo.com Picture in Picture
$('iframe').remove();
el=document.getElementById('c37');
el.removeEventListener('contextmenu', getEventListeners(el).contextmenu[0].listener);
<?php
class Email
{
private string $email;
public function __construct(string $email)
{
if (false === filter_var($email, FILTER_VALIDATE_EMAIL)) {
throw new Exception('Invalid Email');
<?php
class BaseController
{
public function __contruct(Foo $foo)
{
$this->foo = $foo;
}
}
<?php
/**
* @Route('/users', methods={'POST'})
*/
class RegisterUserController
{
private RegisterUserService $service;
public function __construct(RegisterUserService $service)
<?php
/**
* @Route('/users', methods={'POST'})
*/
class RegisterUserController
{
private RegisterUserService $service;
public function __construct(RegisterUserService $service) { ... }
@thiagocordeiro
thiagocordeiro / Dart Class.dart
Last active April 28, 2021 00:14 — forked from buntagonalprism/Dart Class.dart
Flutter and Dart collection of file templates for Android Studio development
#set( $nameparts = $NAME.split("_"))
#set( $namepart = '')
#set( $classname = '')
#foreach( $namepart in $nameparts )
#set( $classname = $classname + $namepart.substring(0, 1).toUpperCase() + $namepart.substring(1))
#end
class $classname {
$classname();
}
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
# Added zsh shell.
sudo apt-get install zsh -y
wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
sudo chsh -s /bin/zsh vagrant && sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="af-magic"/g' ~/.zshrc && echo "alias ll=\"ls -lha\"" >> ~/.zshrc && zsh
# disable git when needed
git config --global oh-my-zsh.hide-status 1
# autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions && echo "source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh" >> ~/.zshrc && source ~/.zshrc
# Added zsh shell.
sudo apt-get install zsh -y
wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
sudo chsh -s /bin/zsh vagrant && sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="af-magic"/g' ~/.zshrc && echo "alias ll=\"ls -lha\"" >> ~/.zshrc && zsh
# autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions && echo "source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh" >> ~/.zshrc && source ~/.zshrc