Skip to content

Instantly share code, notes, and snippets.

View leogtzr's full-sized avatar
🏠
Working from home

Leo Gutiérrez Ramírez leogtzr

🏠
Working from home
View GitHub Profile
enum ShapeType {
CIRCLE {
@Override
public Supplier<Shape> create() {
return Circle::new;
}
},
RECTANGLE {
@Override
public Supplier<Shape> create() {
interface TV {
void show();
}
enum TVFactory {
COLOR {
@Override
TV create() {
return () -> {
System.out.println("Showing content in Color ... ");
// @leonidasgtzr
interface TV {
void show();
}
class ColorTV implements TV {
@Override
public void show() {
System.out.println("Showing content with Color ... ");
}
@leogtzr
leogtzr / share_dir.sh
Created January 12, 2020 01:11
How to share your current working directories with other terminals ...
PROMPT_COMMAND=__prompt_command
__prompt_command() {
if [[ -f '/tmp/sdir' ]]; then
local -r terminal_number=$(tty)
local -r terminal_number_in_sdir_file=$(awk --field-separator '|' '{print $1}' /tmp/sdir)
local -r dir_in_sdir_file=$(awk --field-separator '|' '{print $2}' '/tmp/sdir')
if [[ "${terminal_number}" != "${terminal_number_in_sdir_file}" ]]; then
\rm --force '/tmp/sdir'
echo "Changing to: [${dir_in_sdir_file}] via 'sdir' file"
@leogtzr
leogtzr / main.go
Created October 2, 2020 04:14
How to send SMS in Golang
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
)