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'); |
View inherited-controller.php
<?php | |
class BaseController | |
{ | |
public function __contruct(Foo $foo) | |
{ | |
$this->foo = $foo; | |
} | |
} |
View controller.php
<?php | |
/** | |
* @Route('/users', methods={'POST'}) | |
*/ | |
class RegisterUserController | |
{ | |
private RegisterUserService $service; | |
public function __construct(RegisterUserService $service) |
View controllers-one-endpoint.php
<?php | |
/** | |
* @Route('/users', methods={'POST'}) | |
*/ | |
class RegisterUserController | |
{ | |
private RegisterUserService $service; | |
public function __construct(RegisterUserService $service) { ... } |
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 .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 |
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 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 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; |