Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am brucem on github.
* I am brucem (https://keybase.io/brucem) on keybase.
* I have a public key whose fingerprint is FBF9 3CCC 717D 68B4 D2B1 8E1F 87D3 9622 B34B 8260
To claim this, I am signing this object:
@brucem
brucem / deploy.rb
Created October 2, 2013 04:53
Capistrano recipe to clear the cached repo copy. Handy if you change repos. You'll see a "fatal: Could not parse object" error if you do change git repos and don't clear the cache
desc "Clear cached copy"
task :clear_cached_copy do
cached_copy_path = "#{shared_path}/cached-copy"
cached_copy_exists = capture("if [ -d '#{cached_copy_path}' ]; then echo '1'; fi")
if cached_copy_exists.to_i == 1
puts "Removing cached copy"
run "rm -fR #{cached_copy_path}"
end
end
@brucem
brucem / gist:5485905
Last active December 16, 2015 19:30
Get the latest ubuntu AMIs in us-east-1
wget --quiet http://uec-images.ubuntu.com/query/precise/server/released.current.txt -O - | \
grep us-east-1 | \
grep i386 | \
grep paravirtual | \
grep ebs | \
awk '{ print $8 }'
@brucem
brucem / winner.js
Created July 19, 2012 05:13
Bookmarklet to pick a random RSVP from a meetup.com event page (great for door prizes) Need to be on a meetup.com event page e.g. http://www.meetup.com/The-Brisbane-Web-Design-Meetup-Group/events/46890482/
javascript:(function(){var%20ele=$($("#rsvp-list li.rsvp-list").attr("style","")[Math.floor(Math.random()%20*%20$("#rsvp-list li.rsvp-list").length)]).attr("style","border:5px solid red;");jQuery(window).scrollTop(ele.offset().top-jQuery(window).height()/2)})();
@brucem
brucem / ezSiteIDUpdate.sql
Created July 28, 2011 02:41
Mysql to update eZPublish siteID
update ezsite_data set value = md5(concat(UNIX_TIMESTAMP(), '-',rand())) where name = 'ezfind_site_id';
@brucem
brucem / loggedin.tpl
Created May 5, 2011 02:38
Checking if user is loggedin in eZpublish template
{if is_set($current_user)|not}{def $current_user=fetch( 'user', 'current_user' )}{/if}
{if $current_user.is_logged_in}
{* Show content for logged in users *}
{else}
{* Show content for anon users *}
{/if}
@brucem
brucem / eZwebmin reCAPTURE Feedback form
Created February 6, 2011 03:04
eZwebmin reCAPTURE Feedback form
{* Feedback form - Full view *}
<div class="border-box">
<div class="border-tl"><div class="border-tr"><div class="border-tc"></div></div></div>
<div class="border-ml"><div class="border-mr"><div class="border-mc float-break">
<div class="content-view-full">
<div class="class-feedback-form">
<div class="attribute-header">