Skip to content

Instantly share code, notes, and snippets.

View pydawan's full-sized avatar

Thiago Monteiro pydawan

View GitHub Profile
@pascaldimassimo
pascaldimassimo / DataSourceConfig.java
Last active November 26, 2020 15:41
Spring Boot config for multiple datasources and EntityManagerFactories
package com.pascaldimassimo.xyz;
import java.util.HashMap;
import java.util.Map;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import org.hibernate.cfg.ImprovedNamingStrategy;
import org.springframework.beans.factory.annotation.Autowired;
@bradkarels
bradkarels / embeddedH2.groovy
Created December 17, 2014 19:48
Simple example: Embed H2 database within a groovy script (file based persistence)
@GrabConfig(systemClassLoader=true)
@Grab(group='com.h2database', module='h2', version='1.3.176')
import java.sql.*
import groovy.sql.Sql
import org.h2.jdbcx.JdbcConnectionPool
println("More groovy...")
def sql = Sql.newInstance("jdbc:h2:things", "sa", "sa", "org.h2.Driver") // DB files for 'things' in current directory (./hello.h2.db)
@magicznyleszek
magicznyleszek / css-selectors.md
Last active October 11, 2025 17:34
CSS Selectors Cheatsheet

CSS Selectors Cheatsheet

Hi! If you see an error or something is missing (like :focus-within for few years :P) please let me know ❤️

Element selectors

Element -- selects all h2 elements on the page

h2 {
@zedar
zedar / ratpackGradleWatch.md
Last active July 18, 2019 13:53
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.

@abernier
abernier / README.md
Last active May 16, 2021 23:18
CSS cheat sheet
@dstroot
dstroot / app.js
Created July 13, 2014 16:29
Gulp, BrowserSync, Node, and Nodemon all working in harmony. ;)
/**
* World's simplest express server
* - used to serve index.html from /public
*/
var express = require('express');
var serveStatic = require('serve-static');
var app = express();
app.use(serveStatic(__dirname + '/public'));
@chrisveness
chrisveness / utf8-regex.js
Last active May 25, 2023 01:53
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.
@staltz
staltz / introrx.md
Last active October 26, 2025 03:06
The introduction to Reactive Programming you've been missing
@leocomelli
leocomelli / git.md
Last active November 3, 2025 17:52
Lista de comandos úteis do GIT

GIT

Estados

  • Modificado (modified);
  • Preparado (staged/index)
  • Consolidado (comitted);

Ajuda