Skip to content

Instantly share code, notes, and snippets.

View boyvanamstel's full-sized avatar
👋
Hi there

Boy van Amstel boyvanamstel

👋
Hi there
View GitHub Profile
@boyvanamstel
boyvanamstel / gist:1378780
Created November 19, 2011 12:18
Automatically compile folders filled with .coffee files
$ coffee -cwo lib src
@boyvanamstel
boyvanamstel / gist:1306167
Created October 22, 2011 16:27
Precompile modernizr.js in Rails' assets pipeline
# in config/application.rb
# source: http://blog.nakedapps.co.nz/post/11306258708/site-down-site-down
config.assets.precompile += %w( modernizr.js )
@boyvanamstel
boyvanamstel / gist:1180475
Created August 30, 2011 08:38
Add color to git
$ git config --global color.ui true
@boyvanamstel
boyvanamstel / gist:1147019
Created August 15, 2011 15:37
Commands to copy files needed to run ImageMagick 6.7.0 on FreeBSD in chroot
sudo cp /usr/local/bin/convert /opt/httpd/usr/local/bin/;
sudo cp /usr/local/bin/composite /opt/httpd/usr/local/bin/;
sudo cp /usr/local/bin/identify /opt/httpd/usr/local/bin/;
sudo cp /usr/local/lib/liblcms.so.1 /opt/httpd/usr/local/lib/;
sudo cp /usr/local/lib/libtiff.so.4 /opt/httpd/usr/local/lib/;
sudo cp /usr/local/lib/libjasper.so.4 /opt/httpd/usr/local/lib/;
sudo cp -Rp /usr/local/lib/ImageMagick-6.7.0 /opt/httpd/usr/local/lib;
sudo cp /usr/local/lib/libMagickCore.so.4 /opt/httpd/usr/local/lib/;
sudo cp /usr/local/lib/libMagickWand.so.4 /opt/httpd/usr/local/lib/;
sudo cp /usr/local/lib/libjbig.so.1 /opt/httpd/usr/local/lib/;
@boyvanamstel
boyvanamstel / gist:1146834
Created August 15, 2011 14:12
Show all output of exec() or system() commands in PHP or Rails
Just append 2>&1 to the command to redirect all ouput to standard out instead of the error stream.
Source: http://stackoverflow.com/questions/714740/php-exec-is-failing-silently
@boyvanamstel
boyvanamstel / gist:1093789
Created July 19, 2011 21:39
When posts and other http CRUD methods stop working in Rails
# You probably used the html5-boilerplate gem..
# Comment this part at line 348 and it'll start working again.
# Option 1:
# Rewrite "domain.com/foo -> domain.com/foo/"
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/|#(.*))$
@boyvanamstel
boyvanamstel / gist:1081390
Created July 13, 2011 21:36
Deploying to Heroku
# In Rakefile
require 'rake/dsl_definition'
# In config/environments/production.rb
config.serve_static_assets = true
Compass.configuration.sass_options={:never_update=>true}
@boyvanamstel
boyvanamstel / gist:1079891
Created July 13, 2011 07:40
Get the amount of likes and retweets for a url
# Facebook
https://api.facebook.com/method/fql.query?query=select%20total_count,like_count,comment_count,share_count,click_count%20from%20link_stat%20where%20url='http://hiplikejapie.nl/'&format=json&callback=blah
blah([{
total_count: 150,
like_count: 110,
comment_count: 34,
share_count: 6,
click_count: 0,
}])
@boyvanamstel
boyvanamstel / gist:1071959
Created July 8, 2011 14:29
Add javascripts inside view in Rails, using haml and the compass html5-boilerplate
- content_for :javascripts do
= javascript_include_tag "http://maps.google.com/maps/api/js?sensor=false"
= javascript_include_tag "maps"
@boyvanamstel
boyvanamstel / gist:1069792
Created July 7, 2011 15:41
Quick fix for 404 errors with custom post types
<?php
function register_pt() {
register_post_type([...]);
// Stop 404's from happening..
flush_rewrite_rules( false );
}
add_action( 'init', 'register_pt' );
?>