Skip to content

Instantly share code, notes, and snippets.

@aadrian
aadrian / alt_gr_bug.
Created April 5, 2012 10:54
keyboard.js bug with AlgGR
<!doctype html>
<html>
<head>
<title>KeyboardJS Bug 1</title>
<script src="keyboard.0.2.2.js"></script>
<script type="text/javascript">
// this should be a different function from Alt GR
KeyboardJS.bind.key('alt + e', function(event, keysPressedArray, keyComboString){
console.log('event object', event);
@aadrian
aadrian / gist:2310092
Created April 5, 2012 11:32
Keymaster bug with ALT key under Firefox.
<!doctype html>
<html>
<head>
<title>Kemyaster Bug 2</title>
<script src="keymaster.js"></script>
<script type="text/javascript">
key('alt+e', function(){
console.log('alt+e pressed!');
return false });
key('alt+q', function(){
@aadrian
aadrian / Github_error
Created November 14, 2012 11:57
Lein Download GitHub Error.
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>F66C5173ABD0A5AA</RequestId>
<HostId>ORuboFNGU+riQps08Te3HSZhlwWiSEyNtovQSamuiFQVStxxO76aJDmGrlDTzxwF</HostId>
</Error>
@aadrian
aadrian / Grails Domain Example
Last active August 29, 2015 14:19
Grails "Created By" and "Last Updated By" Fields.
// domain
class MyDomainEntity {
transient springSecurityService
// usual fields ...
String name
// ...
Date dateCreated
Date lastUpdated
@aadrian
aadrian / Grails Roles Init
Last active August 29, 2015 14:19
Grails Roles init and check at startup
// config
class BootStrap {
def init = { servletContext ->
def adminRole = Role.findByAuthority('ROLE_ADMIN')?: new Role(authority: 'ROLE_ADMIN').save(failOnError: true)
def userRole = Role.findByAuthority('ROLE_USER')?: new Role(authority: 'ROLE_USER').save(failOnError: true)
// admin user.
def admin = User.findByUsername('admin@domain.com')?: new User(username: 'admin@domain.com',password: 'password', enabled: true).save(failOnError: true)
UserRole.create admin, adminRole, true
UserRole.create admin, userRole, true
@aadrian
aadrian / Grails Prefix Tables
Created April 21, 2015 09:28
Grails Prefixing all Tables (without changing the mapping of each domain class)
// in "/src/groovy/MyNamingStrategy.groovy"
import org.hibernate.cfg.ImprovedNamingStrategy
/** Override the default naming strategy to support prefixing tables with the "MY_PREFIX_" */
class MyNamingStrategy extends ImprovedNamingStrategy {
String classToTableName(String className) {
"my_prefix_" + super.classToTableName(className)
}
}
@aadrian
aadrian / error.gsp
Created April 21, 2015 09:33
Grails Improved error messages in production mode.
<%@ page import="org.codehaus.groovy.grails.web.errors.GrailsExceptionResolver" %>
<!DOCTYPE html>
<html>
<head>
<title><g:if env="development">Grails Runtime Exception</g:if><g:else>Error</g:else></title>
<meta name="layout" content="main">
<g:if env="development"><link rel="stylesheet" href="${resource(dir: 'css', file: 'errors.css')}" type="text/css"></g:if>
</head>
<body>
<g:if env="development">
@aadrian
aadrian / scalatra26.md
Last active June 6, 2017 09:10 — forked from takezoe/scalatra26.md
[Draft]The plan of Scalatra 2.6.0

[Draft]Plan for Scalatra 2.6.0

The main goal of Scalatra 2.6.x is to decrease future maintenance efforts and costs, since there are not enough active committers to maintain the existing huge codebase. To achieve this goal, I propose the followings:

  • Follow the Scala standards (e.g. Twirl instead of Scalate, ScalaTest instead of Specs2)
  • Deprecate modules that are not used much or not maintained enough

More specific tasks:

Overall

@aadrian
aadrian / build.gradle
Last active June 29, 2017 15:46
Gradle getWebAppVersion based on time and GIT hash
We couldn’t find that file to show.
https://github.com/metabase/metabase/issues/5737 -> Solr
https://github.com/metabase/metabase/issues/6094 -> CSV Upload
https://github.com/metabase/metabase/pull/7534 -> CSV Implementation
https://github.com/metabase/metabase/issues/3745 -> Prometheus
https://github.com/metabase/metabase/issues/2561 -> InfluxDB
https://github.com/metabase/metabase/issues/1309 -> RethinkDB
https://github.com/metabase/metabase/issues/1300 -> ElasticSearch
https://github.com/metabase/metabase/issues/3101 -> OAuth
https://github.com/metabase/metabase/issues/3210 -> SSO Modular