Skip to content

Instantly share code, notes, and snippets.

View ppazos's full-sized avatar
🌎
All around

Pablo Pazos Gutiérrez ppazos

🌎
All around
View GitHub Profile
public class SimpleEchoServer implements Runnable {
private int port;
private LinkedList<Socket> openClients = new LinkedList<Socket>();
private boolean cleaningUp = false;
public SimpleEchoServer(int port) {
this.port = port;
}
@ppazos
ppazos / price.md
Created December 6, 2016 05:52 — forked from justjanne/Price Breakdown.md
AWS Lightsail vs DigitalOcean, VULTR and Linode

Price breakdown vs DigitalOcean, Vultr, Linode, OVH, and Online.net / Scaleway:

$5/mo

Provider RAM Cores Storage Transfer
LightSail 512MB 1 20GB SSD 1TB
DO 512MB 1 20GB SSD 1TB
@ppazos
ppazos / CustomValidationTagLib.groovy
Created July 10, 2017 09:20 — forked from hussainanjar/CustomValidationTagLib.groovy
Extension of Grails ValidationTagLib
package com.hussain.pf
import groovy.xml.MarkupBuilder
import org.apache.commons.lang.StringEscapeUtils
import org.codehaus.groovy.grails.plugins.web.taglib.ValidationTagLib
class CustomValidationTagLib extends ValidationTagLib {
/**
@ppazos
ppazos / tree.md
Created August 26, 2018 18:15 — forked from timyates/tree.md
A two-line tree in Groovy

Two line Tree in Groovy


Update!

Wow... Kiyotaka Oku's fork of this shows how to do it in one line :-)


The other day, I saw Harold Cooper's One-line tree in Python via autovivication, and wondered if the same thing was possible in Groovy.

@ppazos
ppazos / GitCommitEmoji.md
Created October 2, 2019 12:29 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji
@ppazos
ppazos / iso_date.groovy
Created October 13, 2019 00:17 — forked from kdabir/iso_date.groovy
current date in iso 8601 in groovy
new Date().format("yyyy-MM-dd'T'HH:mm:ss'Z'", TimeZone.getTimeZone("UTC"))
// Credit David Walsh (https://davidwalsh.name/javascript-debounce-function)
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
function debounce(func, wait, immediate) {
var timeout;
@ppazos
ppazos / material-design-shadows.css
Last active July 3, 2020 23:27 — forked from serg0x/material-design-shadows.css
Google material design elevation system shadows as css. Based on https://material.io/design/environment/elevation.html#default-elevations Exported with Sketchapp from the Google material design theme editor plugin "Baseline" theme.
/* Shadow 0dp */
box-shadow: none;
/* Shadow 1dp */
box-shadow: 0 1px 1px 0 rgba(0,0,0,0.14), 0 2px 1px -1px rgba(0,0,0,0.12), 0 1px 3px 0 rgba(0,0,0,0.20);
/* Shadow 2dp */
box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14), 0 3px 1px -2px rgba(0,0,0,0.12), 0 1px 5px 0 rgba(0,0,0,0.20);
/* Shadow 3dp */
@ppazos
ppazos / README.md
Created November 26, 2020 21:46 — forked from developius/README.md
Setup SSH keys for use with GitHub/GitLab/BitBucket etc

Create a new repository, or reuse an existing one.

Generate a new SSH key:

ssh-keygen -t rsa -C "your_email@example.com"

Copy the contents of the file ~/.ssh/id_rsa.pub to your SSH keys in your GitHub account settings.

Test SSH key:

@ppazos
ppazos / MapDiff.groovy
Created March 2, 2021 23:06 — forked from sujeet100/MapDiff.groovy
Groovy script to find out the difference between two maps. Can be useful to debug failing unit tests when the objects in comparison are big jsons.
def mapDiff(Map m1, Map m2, String path="") { m1.each{k,v->
if(m2[k] != m1[k]) {
if(m1[k] in Map) {
mapDiff(m1[k] as Map, m2[k] as Map, "${path}${k}.")
}
else {
println("${path}${k} ->");
println("\texpected: ${m1[k]}")
println("\tactual: ${m2[k]}")
if (m1[k] in List) {