Skip to content

Instantly share code, notes, and snippets.

Avatar
🥵
Melting

Thiago Cordeiro thiagocordeiro

🥵
Melting
View GitHub Profile
@thiagocordeiro
thiagocordeiro / request.js
Last active Aug 20, 2019
Axios HTTP Client
View request.js
const axios = require('axios');
axios.get('/users/12345')
.then(function (response) {
const statusCode = response.status;
// successful request/response
})
.catch(function (error) {
const statusCode = error.response.status;
View vagrant-zsh + autosuggestion
# 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
View vagrant-zsh + autosuggestion
# 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
View .bashrc
# ~/.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
@thiagocordeiro
thiagocordeiro / Dart Class.dart
Last active Apr 27, 2020 — forked from buntagonalprism/Dart Class.dart
Flutter and Dart collection of file templates for Android Studio development
View Dart Class.dart
#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();
}
View controllers-one-endpoint.php
<?php
/**
* @Route('/users', methods={'POST'})
*/
class RegisterUserController
{
private RegisterUserService $service;
public function __construct(RegisterUserService $service) { ... }
View controller.php
<?php
/**
* @Route('/users', methods={'POST'})
*/
class RegisterUserController
{
private RegisterUserService $service;
public function __construct(RegisterUserService $service)
View inherited-controller.php
<?php
class BaseController
{
public function __contruct(Foo $foo)
{
$this->foo = $foo;
}
}
View service-layer.php
<?php
class Email
{
private string $email;
public function __construct(string $email)
{
if (false === filter_var($email, FILTER_VALIDATE_EMAIL)) {
throw new Exception('Invalid Email');
You can’t perform that action at this time.