Skip to content

Instantly share code, notes, and snippets.

View yvesvanbroekhoven's full-sized avatar

Yves Van Broekhoven yvesvanbroekhoven

View GitHub Profile
@yvesvanbroekhoven
yvesvanbroekhoven / Get filename extension
Created June 2, 2010 11:23
Ruby function for getting the file extension
File.extname(File.basename(file_url)).gsub(/\./, '').gsub(/\?[0-9]*/, '')
@yvesvanbroekhoven
yvesvanbroekhoven / jquery.messenger.js
Created October 4, 2010 09:34
Display or remove a message in a DOM element
/*
* Display or remove a message in an element
*/
(function($){
var _add, _remove;
$.fn.messenger = function(action, options){
opts = options ? $.extend({}, $.fn.messenger.defaults, options) : $.fn.messenger.defaults;
$this = this;
@yvesvanbroekhoven
yvesvanbroekhoven / Log
Created October 20, 2010 11:50
A lightweight wrapper for console.log (By Paul Irish)
// usage: log('inside coolFunc',this,arguments);
// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
window.log = function(){
log.history = log.history || []; // store logs to an array for reference
log.history.push(arguments);
if(this.console){
console.log( Array.prototype.slice.call(arguments) );
}
};
@yvesvanbroekhoven
yvesvanbroekhoven / setWindowMinMaxDimensions.js
Created December 1, 2010 10:00
Set window min / max height on resize
(function(){
window.setWindowMinMaxDimensions = function(){
var min_height = 680;
var max_height = '100%';
var min_width = 950;
var max_width = 'auto';
window.onresize = function() {
var height = document.documentElement.clientHeight;
if (height < min_height) {
document.body.style.height = min_height + 'px';
@yvesvanbroekhoven
yvesvanbroekhoven / gist:946066
Created April 28, 2011 09:14
check for dir path in Rails config files
case Etc.getpwuid(Process.uid).name
when 'your name'
# my config
when 'my name'
# my config
else
# everybody else
end
@yvesvanbroekhoven
yvesvanbroekhoven / gist:958636
Created May 6, 2011 08:39
Run script/runner in specific environment
RAILS_ENV=production script/runner
window.CEPHAS = {
init: function(){
this.autoRefresh(10000);
this.statusUpdate();
this.simonizer();
},
/*
var report = {
project: {
api_token: "d43be74d5664b4c295b56bdb2c0ca798cf2206b5"
},
error: {
hash_string: "1"
},
occurence: {
name: "MethodNotFound tralalala",
reporter: "Javascript",
@yvesvanbroekhoven
yvesvanbroekhoven / modern.theme.bash
Created September 12, 2011 08:46
Bash-it Template Modern customized
SCM_THEME_PROMPT_PREFIX=""
SCM_THEME_PROMPT_SUFFIX=""
RVM_THEME_PROMPT_PREFIX="["
RVM_THEME_PROMPT_SUFFIX="]"
SCM_THEME_PROMPT_DIRTY=' ${bold_red}✗${normal}'
SCM_THEME_PROMPT_CLEAN=' ${bold_green}✓${normal}'
SCM_GIT_CHAR='${bold_green}${normal}'
SCM_SVN_CHAR='${bold_cyan}${normal}'
@yvesvanbroekhoven
yvesvanbroekhoven / add-empty-dock-item
Created November 3, 2011 20:24
Add a divider/empty space in your OSX dock
defaults write com.apple.dock persistent-apps -array-add '{ "tile-type" = "spacer-tile"; }'
killall Dock