Skip to content

Instantly share code, notes, and snippets.

View pydawan's full-sized avatar

Thiago Monteiro pydawan

View GitHub Profile
@pydawan
pydawan / build.gradle
Created February 2, 2018 11:32 — forked from aalmiray/build.gradle
Simple Gradle build file for Asciidoctor + Diagram + PDF
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.2'
classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.6'
classpath 'com.github.jruby-gradle:jruby-gradle-plugin:0.1.11'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.7'
@pydawan
pydawan / start_jetty.groovy
Created February 2, 2018 13:41 — forked from msakamoto-sf/start_jetty.groovy
Jetty + GroovyServlet + Groovy Script = Start Jetty Anywhere !! You only need Groovy :)
@Grapes([
@Grab('org.eclipse.jetty.aggregate:jetty-all:8.1.10.v20130312'),
@Grab('com.h2database:h2:1.3.171'),
@Grab('javax.servlet:servlet-api:2.5'),
])
import org.eclipse.jetty.server.Server
import org.eclipse.jetty.servlet.*
import org.eclipse.jetty.webapp.*
import javax.servlet.*
import javax.servlet.http.*
@pydawan
pydawan / UploadArquivoServlet.java
Created April 6, 2018 17:28 — forked from alexandreaquiles/UploadArquivoServlet.java
Servlet que faz upload de arquivos no diretório configurado no init-param "diretorio", utilizando a biblioteca commons-fileupload.
package upload;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Iterator;
import java.util.List;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
@pydawan
pydawan / keybindings.json
Created May 4, 2018 01:43 — forked from yuki-takei/keybindings.json
Visual Studio Code - Eclipse Keybindings (Win, Linux)
[
{
"key": "ctrl+d",
"command": "editor.action.cutLines",
"when": "editorTextFocus"
},
{
"key": "ctrl+o",
"command": "workbench.action.gotoSymbol"
},
@pydawan
pydawan / utf8-regex.js
Created October 5, 2018 19:29 — forked from chrisveness/utf8-regex.js
Utf8 string encode/decode using regular expressions
/**
* Encodes multi-byte Unicode string into utf-8 multiple single-byte characters
* (BMP / basic multilingual plane only).
*
* Chars in range U+0080 - U+07FF are encoded in 2 chars, U+0800 - U+FFFF in 3 chars.
*
* Can be achieved in JavaScript by unescape(encodeURIComponent(str)),
* but this approach may be useful in other languages.
*
* @param {string} unicodeString - Unicode string to be encoded as UTF-8.
@pydawan
pydawan / starUML.md
Created October 21, 2018 20:01 — forked from trandaison/starUML.md
Get full version of StarUML

StarUML

Download: StarUML.io

Crack

Source: jorgeancal

After installing StartUML successfully, modify LicenseManagerDomain.js as follow:

/**
@pydawan
pydawan / README.md
Created November 16, 2018 12:54 — forked from joyrexus/README.md
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.AsyncTask;
import android.os.Environment;
import android.util.Log;
import android.widget.Toast;
import com.itextpdf.text.BaseColor;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
@pydawan
pydawan / ratpackGradleWatch.md
Created December 27, 2018 04:26 — forked from zedar/ratpackGradleWatch.md
ratpack gradle & watch for changes

Ratpack and runtime class reloading

Ratpack works very smoothly with spring-loaded library. It is defined as dependency in build.gradle file. Spring-loaded enables runtime hot class reloading.

dependencies {
    springloaded "org.springframework:springloaded:1.2.0.RELEASE"
}

But default configuration reloads only changes in Ratpack.groovy file.

@pydawan
pydawan / gradle-cheatsheet.gradle
Created January 6, 2019 15:54 — forked from jahe/gradle-cheatsheet.gradle
Gradle Cheatsheet
// imports a couple of java tasks
apply plugin: "java"
// List available tasks in the shell
> gradle tasks
// A Closure that configures the sourceSets Task
// Sets the main folder as Source folder (where the compiler is looking up the .java files)
sourceSets {
main.java.srcDir "src/main"