Skip to content

Instantly share code, notes, and snippets.


Thomas Buckel tbuckel

  • Perth, Australia
View GitHub Profile
tbuckel / insert.sql
Created Mar 27, 2014
SQL Insert only of not exists
View insert.sql
INSERT INTO example_table
(id, name)
SELECT 1, 'John'
SELECT id FROM example_table WHERE id = 1
View gist:7349789
Root<Employee> empRoot = cq1.from(getEntityManagerFactory().getMetamodel().entity(Employee.class));
Join<Employee, Project> join = empRoot.join("projects");
Path exp = ((Path)"budget");
cq1.where(qb1.equal(exp, new Integer(1000)) );
// --------------
Check for type:
cb.equal(join.type(), cb.literal(LargeProject.class))
tbuckel / gist:7137034
Created Oct 24, 2013
Mac OS: Setting the environment for new processes started by Spotlight
View gist:7137034
Setting the environment for new processes started by Spotlight
You can set the environment used by launchd (and, by extension, anything started from Spotlight) with launchctl setenv. For example to set the path:
launchctl setenv PATH /opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin
Or if you want to set up your path in .bashrc or similar, then have it mirrored in launchd:
launchctl setenv PATH $PATH
tbuckel / gist:6190883
Created Aug 9, 2013
Subversion/SVN : Show revisions eligible to be merged from branch
View gist:6190883
svn mergeinfo http://[server]/branches/[branch] --show-revs eligible
tbuckel / gist:5927485
Last active Dec 19, 2015
HTML5 Application Cache refresh
View gist:5927485
window.applicationCache.addEventListener('updateready', function(e) {
if (window.applicationCache.status == window.applicationCache.UPDATEREADY) {
// Browser downloaded a new app cache.
// Swap it in and reload the page to get the new hotness.
if (confirm('A new version of this site is available. Load it?')) {
} else {
// Manifest didn't changed. Nothing new to server.