Skip to content

Instantly share code, notes, and snippets.

View heijmerikx's full-sized avatar

Rutger Heijmerikx heijmerikx

View GitHub Profile
#!/bin/bash -xe
# Run this script from machine with the credintials and the latest api tools installed
EBS_DEVICE='/dev/sdh'
INSTANCE_ID=$1
AKI=${2:-'aki-5f15f636'}
ARI=${3:-'ari-0915f660'}
ARCH=${4:-'i386'}
SIZE=${5:-10}
<% form_tag :search, :url => asdf, :html => { :id => 'search_form' } do %>
<%= text_field_tag :search %>
<%= submit_tag 'zoeken' %>
<% end %>
<div id="search_results"></div>
$('#search_form').live('submit', function(event) {
event.preventDefault();
$.post($(this).attr('action'), $(this).serialize(), null, 'script');
});
!!! 5
%html
%head
%title= 'Zetetic - ' + yield_for(:title, 'Blog')
%meta{:name => 'description', :content => yield_for(:description, "blarf blarf dorf dorf dorf, hooray it's our blog!")}/
...
!!! 5
%html
%head
%title= 'Zetetic - ' + yield_for(:title, 'Blog')
%meta{:name => 'description', :content => yield_for(:description, "blarf blarf dorf dorf dorf, hooray it's our blog!")}/
...
!!! 5
%html
%head
%title= 'Zetetic - ' + yield_for(:title, 'Blog')
%meta{:name => 'description', :content => yield_for(:description, "blarf blarf dorf dorf dorf, hooray it's our blog!")}/
...
@heijmerikx
heijmerikx / gist:738264
Created December 12, 2010 19:40
jQuery mobile homepage, incult.nl
%div{'data-role' => 'page'}
%div{'data-role' => 'header'}
%h1 InCult #{t('mobile.mobile').capitalize}
%div{'data-role' => 'content'}
%ul{'data-role' => 'listview', 'data-inset' => 'true', 'data-theme' => 'c', 'data-dividertheme' => 'b'}
%li{'data-role' => 'list-divider'} Menu
%li=link_to t('site.artists').capitalize, artists_url
%li=link_to t('mobile.current_events').capitalize, events_url
%li=link_to t('site.venues').capitalize, venues_url
= form_tag('/search', :id => 'qs') do |f|
@heijmerikx
heijmerikx / installation.sh
Created September 7, 2011 19:20 — forked from mikhailov/installation.sh
Nginx+passenger application config: ssl redirection, http headers, passenger optimal settings. see details: http://mikhailov.posterous.com/nginx
$ cd /usr/src
$ wget http://nginx.org/download/nginx-0.8.52.tar.gz
$ tar xzvf ./nginx-0.8.52.tar.gz
$ rm ./nginx-0.8.52.tar.gz
$ gem install s3sync capistrano capistrano-ext passenger --no-ri --no-rdoc
$ passenger-install-nginx-module
# Automatically download and install Nginx? 2. No: I want to customize my Nginx installation
# Where is your Nginx source code located?: /usr/src/nginx-0.8.52
# Where do you want to install Nginx to?: /opt/nginx
@heijmerikx
heijmerikx / gist:1261118
Created October 4, 2011 08:05
MySQL FIND_IN_SET to Postgresql...
def self.order(ids)
# The postgresql way
update_all(["position = STRPOS(?, ','||id||',')", ",#{ids.join(',')},"], { :id => ids })
# the mysql way
# update_all(['position = FIND_IN_SET(id, ?)', ids.join(',')],{ :id => ids })
end
@heijmerikx
heijmerikx / gist:1446468
Created December 8, 2011 08:37
JWplayer javascrip embed code in haml, including custom logo configuration.
#vc
Loading player...
:javascript
jwplayer("vc").setup({
flashplayer: "#{asset_path 'jwplayer/player.swf'}",
file: "#{@video.path}_site.mp4",
image: "http://#{APP_CONFIG['bucket_name']}.s3.amazonaws.com/#{@thumb}/site/frame_0004.png",
height: 375,
width: 700,
streamer: "rtmp://#{APP_CONFIG['cloudfront_url_video']}/cfx/st",
@heijmerikx
heijmerikx / gist:1456523
Created December 10, 2011 21:33
Nederlandse lijst van landen in haml markup.
=f.select :country, ["Afghanistan",
"Albanië",
"Algerije",
"Amerikaanse Overzeese eilanden",
"Andorra",
"Angola",
"Anguilla",
"Antartica",
"Antigua",
"Argentinië",