Skip to content

Instantly share code, notes, and snippets.

View gjoseph's full-sized avatar

Grégory Joseph gjoseph

  • Sydney, Australia
View GitHub Profile
diff --git a/tests/integration-tests-parent/integration-testkit/src/index.js b/tests/integration-tests-parent/integration-testkit/src/index.js
index 565fedf..fee6be1 100644
--- a/tests/integration-tests-parent/integration-testkit/src/index.js
+++ b/tests/integration-tests-parent/integration-testkit/src/index.js
@@ -5,7 +5,7 @@ import * as _logging from "./logging";
export {permissions, PermissionsBackdoor} from "./backdoor/permissions-backdoor";
export {RolesBackdoor} from "./backdoor/roles-backdoor";
-export {SdApiClient, JiraApiClient, ApprovalClient, AtlassianAnalyticsClient, ServiceDeskClient, ReportsClient, RequestsClient} from "./rest-clients";
+export {SdApiClient, JiraApiClient, ApprovalClient, AtlassianAnalyticsClient, ServiceDeskClient, ReportsClient, BackdoorClient, RequestsClient} from "./rest-clients";
@gjoseph
gjoseph / gist:2312493
Created April 5, 2012 16:55
Can you bots stop hammering my SVN server via ViewVC? You really don't need to index all revisions of all files, kthxbye
# Exclude bots for requests with a query string, with the exception of the view=log query: bots can see the file's latest revision (no query string), or the log.
RewriteCond %{HTTP_USER_AGENT} bot [nocase]
RewriteCond %{QUERY_STRING} !(^view=log$|view=log&log_pagestart=[0-9]+$|^$)
RewriteRule /view/.* - [F,L]
@gjoseph
gjoseph / CanonicalIsWeirdScript
Created January 5, 2012 16:13
Did i just find a bug in @canonical or am i thick ? #groovy
#!/usr/bin/env groovy
import groovy.transform.Canonical
def weird = new CanonicalIsWeird(a: 'first letter', b: 'second letter')
println "a: ${weird.a}"
println "b: ${weird.b}"
assert weird.a == 'first letter'
assert weird.b == 'second letter'
@gjoseph
gjoseph / ROOT.xml
Created October 25, 2011 13:23
Tomcat context file for the public instance of the "Acme" project discussed at http://dev.magnolia-cms.com/~gjoseph/dont-deploy-magnolia-deploy-your-project
<!-- if this was declared in the <Host> configuration, we'd add a path="" attribute -->
<Context path="" docBase="/opt/acme-project/wars/acme-project-webapp-1.0-SNAPSHOT.war" debug="0" reloadable="false">
<Parameter name="magnoliaInstance" value="prodPublic" override="false"/>
<Resource name="jdbc/MagnoliaAcmeDS" auth="Container"
type="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
factory="com.mysql.jdbc.jdbc2.optional.MysqlDataSourceFactory"
driverClassName="com.mysql.jdbc.Driver"
user="acme_magnolia" username="acme_magnolia"
password="secret"
@gjoseph
gjoseph / author.xml
Created October 25, 2011 13:22
Tomcat context file for the author instance of the "Acme" project discussed at http://dev.magnolia-cms.com/~gjoseph/dont-deploy-magnolia-deploy-your-project
<!-- if this was declared in the <Host> configuration, we'd add a path="/author" attribute -->
<Context docBase="/opt/acme-project/wars/acme-project-webapp-1.0-SNAPSHOT.war" debug="0" reloadable="false">
<Parameter name="magnoliaInstance" value="prodAuthor" override="false"/>
<Resource name="jdbc/MagnoliaAcmeDS" auth="Container"
type="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
factory="com.mysql.jdbc.jdbc2.optional.MysqlDataSourceFactory"
driverClassName="com.mysql.jdbc.Driver"
user="acme_magnolia" username="acme_magnolia"
password="secret"
@gjoseph
gjoseph / jackrabbit-acme-prod.xml
Created October 25, 2011 11:06
Jackrabbit configuration file for the "Acme" project discussed at http://dev.magnolia-cms.com/~gjoseph/dont-deploy-magnolia-deploy-your-project
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.6//EN" "http://jackrabbit.apache.org/dtd/repository-1.6.dtd">
<Repository>
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
<param name="path" value="${rep.home}/repository" />
</FileSystem>
<Security appName="Jackrabbit">
<AccessManager class="org.apache.jackrabbit.core.security.simple.SimpleAccessManager"></AccessManager>
<LoginModule class="org.apache.jackrabbit.core.security.simple.SimpleLoginModule">
<param name="anonymousId" value="anonymous" />
@gjoseph
gjoseph / URLUtil.encode
Created August 29, 2011 15:00
And another irked gist, which turned out to be unneeded after all.
/**
* So java.net.URLEncoder#encode(java.lang.String) is deprecated, because it uses the OS' default encoding,
* java.net.URLEncoder#encode(java.lang.String, java.lang.String) takes a second parameter for said encoding,
* while mentioning that "The World Wide Web Consortium Recommendation states that UTF-8 should be used.
* Not doing so may introduce incompatibilites.". (typo not mine).
* Still, we have to choose, read doc, and specify the ourselves, and deal with the uncanny possibility that
* UTF-8 might not be available on a system where we do have a 1.6 JVM.
* Right.
*/
@gjoseph
gjoseph / SplitUtil.java
Created August 17, 2011 11:05
Why are there so many ways of getting a String[] from a comma-separated String in Java, and none of the basic ones really work (split(",") or StringTokenizer) ? I don't know, but this is my ultimate solution at the moment. Are there more cases to cover ?
import java.util.regex.Pattern;
public class SplitUtil {
private static final Pattern COMMA_DELIMITED_SPLIT = Pattern.compile("(\\s*,\\s*)+");
private static final String[] EMPTY = new String[0];
public static String[] commaDelimited(String s) {
if (s == null) {
return EMPTY;
}
@gjoseph
gjoseph / sourcedrop
Last active August 29, 2015 14:20
Use SourceDrop from the command line
#!/bin/sh
# Set SourceDrop's keyboard shortcut to control-option-command-f13 (or whatever, really)
# F13 is code 105 (http://macbiblioblog.blogspot.ch/2014/12/key-codes-for-function-and-special-keys.html)
# Print out stuff and pipe it into this script (e.g cat ~/bin/sourcedrop | sourcedrop)
pbcopy && osascript -e 'tell application "System Events" to key code 105 using {control down, option down, command down}'
WILL EXECUTE git push --all --dry-run
./enterprise/advanced-cache:
To git@git.magnolia-cms.com:enterprise/advanced-cache
fc97d7e..8a9f0bf magnolia-module-advanced-cache-1.3.x -> magnolia-module-advanced-cache-1.3.x
8bd8545..1a90aea master -> master
./enterprise/backup:
To git@git.magnolia-cms.com:enterprise/backup
6f94c38..3ac993e magnolia-module-backup-1.0.x -> magnolia-module-backup-1.0.x
5718974..fc4218c magnolia-module-backup-1.1.x -> magnolia-module-backup-1.1.x