Skip to content

Instantly share code, notes, and snippets.

View devsdmf's full-sized avatar

Lucas Mendes devsdmf

View GitHub Profile
@devsdmf
devsdmf / adapter-w-strategy.scala
Last active February 13, 2020 20:06
Scala's Adapters and Strategies
// DEFINITIONS
trait DiscountCode {
def getValue: Double
}
trait Adapter[E] {
def updateAndReturnEntity(entity: E, amount: Double): E
<?php
interface DatabaseDriver {
public function save(string $data);
}
abstract class AbstractPersistence {
private $driver;
@devsdmf
devsdmf / test.js
Created May 10, 2019 17:50
Test js
alert("Test!!!!");
@devsdmf
devsdmf / test.js
Created May 10, 2019 17:50
Test js
alert("Test!!!!");
@devsdmf
devsdmf / base_options.json
Last active March 28, 2019 16:38
Test shipping options
{
"rates": [
{
"name": "Standard Shipping",
"code": "standard",
"price": 0.00,
"price_merchant": 14.15,
"currency": "BRL",
"type": "ship",
"min_delivery_date": "2016-07-14T14:48:45-0300",
@devsdmf
devsdmf / devsdmf.zsh-theme
Created May 19, 2018 22:51
My personal oh-my-zsh theme
#!/usr/bin/env zsh
local LAMBDA="%(?,%{$fg_bold[green]%}λ,%{$fg_bold[red]%}λ)"
if [[ "$USER" == "root" ]]; then USERCOLOR="red"; else USERCOLOR="cyan"; fi
# Git sometimes goes into a detached head state. git_prompt_info doesn't
# return anything in this case. So wrap it in another function and check
# for an empty string.
function check_git_prompt_info() {
if git rev-parse --git-dir > /dev/null 2>&1; then
@devsdmf
devsdmf / .vimrc
Created May 19, 2018 22:04
My Vim configuration file
" setting up plugin manager
call plug#begin('~/.vim/plugged')
" basic linux commands inside editor
Plug 'tpope/vim-eunuch'
" auto close parenthesis, brackets, quotes, etc...
Plug 'jiangmiao/auto-pairs'
@devsdmf
devsdmf / is_repo_dirty.sh
Last active April 3, 2018 20:10
Bash function to check if a git repository is clean [of changes] or dirty
#!/bin/bash
function is_repo_dirty {
local dir=$(pwd)
[[ -n $1 ]] && dir=$1
[[ -n $(git status --porcelain 2> /dev/null | tail -n1) ]] && return
false
}
@devsdmf
devsdmf / commit-past.sh
Created March 23, 2017 20:01
Git commit in past
GIT_COMMITTER_DATE="`date -jR -vFebm -v16d -v12H -v29M`" git commit --date "`date -jR -vFebm -v16d -v12H -v29M`" -m "first commit"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.40253299474716187</real>