Skip to content

Instantly share code, notes, and snippets.

@azell
azell / MockHTable.java
Created November 23, 2011 20:50 — forked from agaoglu/MockHTable.java
MockHTable
/**
* This file is licensed to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@azell
azell / SpringExceptionTranslationExecuteListener.java
Created October 17, 2012 01:55
Minimal Spring / jOOQ transaction integration
import javax.sql.DataSource;
import org.jooq.ExecuteContext;
import org.jooq.impl.DefaultExecuteListener;
import org.springframework.jdbc.datasource.DataSourceUtils;
import org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator;
import org.springframework.jdbc.support.SQLExceptionTranslator;
import org.springframework.jdbc.support.SQLStateSQLExceptionTranslator;
@azell
azell / gist:5322103
Created April 5, 2013 19:50
Result from running: rvm install --autolibs=read-only --binary --trace 1.9.3
--autolibs=read-only --binary --trace 1.9.3
rvm 1.19.1 (master) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]
+ [[ -n '' ]]
+ set -o errtrace
+ export 'PS4=+ $(date "+%s.%N") ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > '
+ PS4='+ $(date "+%s.%N") ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > '
+ 1365191040.972879771 /scripts/cli : __rvm_parse_args() 795 > [[ -z install ]]
+ 1365191040.974559260 /scripts/cli : __rvm_parse_args() 798 > [[ error == \i\n\s\t\a\l\l ]]
+ 1365195022.125873791 /tmp/go : 7 > rvm install --autolibs=read-only --binary --trace 1.9.3
--autolibs=read-only --binary --trace 1.9.3
rvm 1.19.1 (master) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]
+ 1365195022.205960037 /scripts/cli : __rvm_parse_args() 764 > [[ -n '' ]]
+ 1365195022.207334771 /scripts/cli : __rvm_parse_args() 766 > set -o errtrace
+ 1365195022.208645507 /scripts/cli : __rvm_parse_args() 767 > export 'PS4=+ $(date "+%s.%N") ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > '
+ 1365195022.210013205 /scripts/cli : __rvm_parse_args() 767 > PS4='+ $(date "+%s.%N") ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > '
@azell
azell / Spring Txn and jOOQ 3.7.0
Last active April 11, 2020 19:05
Attempting to integrate Spring Transaction with jOOQ 3.7.0
public class SpringExceptionTranslationExecuteListener
extends DefaultExecuteListener {
/** {@inheritDoc} */
@Override
public void exception(ExecuteContext ctx) {
SQLException e = ctx.sqlException();
if (e != null) {
String name = ctx.configuration().dialect().thirdParty().springDbName();
@azell
azell / gist:5704171
Last active December 18, 2015 01:29
Tables:
CREATE TABLE "activities" (
"id" INT UNSIGNED NOT NULL AUTO_INCREMENT,
...
);
CREATE TABLE "interests" (
"id" INT UNSIGNED NOT NULL AUTO_INCREMENT,
"name" VARCHAR(255) NOT NULL,
{
"chat": {
// the list of chats may not be listed (no .read permissions here)
// a chat conversation
"$key": {
// if the chat hasn't been created yet, we allow read so there is a way
// to check this and create it; if it already exists, then authenticated
// user (specified by auth.id) must be in $key/users
{
"chat": {
// the list of chats may not be listed (no .read permissions here)
// a chat conversation
"$key": {
// if the chat hasn't been created yet, we allow read so there is a way
// to check this and create it; if it already exists, then authenticated
// user (specified by auth.id) must be in $key/users
@azell
azell / string_type
Created December 2, 2013 07:27
Multi-field and string type working as expected
curl -XDELETE localhost:9200/test
curl -XPUT localhost:9200/test -d '{
"mappings" : {
"type1" : {
"properties" : {
"name" : {
"type" : "multi_field",
"fields" : {
"name" : {"type" : "string", "index" : "analyzed"},
@azell
azell / string-value
Created December 2, 2013 07:29
Multi-field and string type with embedded value not working as expected
curl -XDELETE localhost:9200/test
curl -XPUT localhost:9200/test -d '{
"mappings" : {
"type1" : {
"properties" : {
"name" : {
"type" : "multi_field",
"fields" : {
"name" : {"type" : "string", "index" : "analyzed"},