Skip to content

Instantly share code, notes, and snippets.

View robinvdvleuten's full-sized avatar
🚀

Robin van der Vleuten robinvdvleuten

🚀
View GitHub Profile
@robinvdvleuten
robinvdvleuten / gist:861848
Created March 9, 2011 07:53
jQuery - Check if element exists
$.fn.exists = function() {
return $( this ).length > 0;
}
@robinvdvleuten
robinvdvleuten / upload-to-rackspace-cloud-file.sh
Created August 15, 2011 14:21 — forked from chmouel/upload-to-rackspace-cloud-file.sh
Upload to RackSpace CloudFiles from shell with curl.
#!/bin/bash
# Author: Chmouel Boudjnah <chmouel.boudjnah@rackspace.co.uk>
# Not officially supported by Rackspace only as a best effort basis :)
# Define yes to make it to copy to url to clipboard (via a shortened url
# service) You need to have the software xclip installed in your system.
COPY_URL_TO_CLIPBOARD=yes
# Containers to ignore in the list
CONTAINERS_TO_IGNORE=".CDN_ACCESS_LOGS"
@robinvdvleuten
robinvdvleuten / gist:1210978
Created September 12, 2011 10:31
Usefull Mac Command
# Restart finder:
killall -KILL Finder
# Create symbolic links:
ln -s /Volumes/Classic/ Classic
# Remove .DS_Store recursively:
find . -name '*.DS_Store' -type f -delete
@robinvdvleuten
robinvdvleuten / gist:1554447
Created January 3, 2012 10:53
Zend Server useful commands
# Restart the Apache server
/usr/local/zend/bin/zendctl.sh restart
@robinvdvleuten
robinvdvleuten / wp-config.php
Created February 2, 2012 10:45
Multiple configuration files with Wordpress
<?php
/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
/** Load configuration based on the server's environment **/
$env = isset($_SERVER['ENVIRONMENT']) ? $_SERVER['ENVIRONMENT'] : 'dev';
require_once ABSPATH . 'wp-config/wp-config.' . strtolower($env) . '.php';
/** Sets up WordPress vars and included files. */
@robinvdvleuten
robinvdvleuten / template.php
Created February 23, 2012 11:43
Remove Drupal's core system stylesheets
<?php
/**
* Remove Drupal's core system stylesheets.
*/
function THEMENAME_css_alter(&$css)
{
$path_system = drupal_get_path('module', 'system');
$remove = array(
$path_system . '/system.base.css',
@robinvdvleuten
robinvdvleuten / ckeditor_styles.module
Created February 24, 2012 16:15
Add your own styles to Drupal's WYSIWYG module
<?php
function ckeditor_styles_wysiwyg_editor_settings_alter(&$settings, &$context)
{
if ($context['profile']->editor == 'ckeditor') {
$settings['extraPlugins'] .= ',stylesheetparser';
// Not necessary but removes all default styles from the CKEditor.
$settings['stylesSet'] = array();
}
}
@robinvdvleuten
robinvdvleuten / gist:1948620
Created March 1, 2012 09:50
Update Drupal modules in svn with Drush
drush pm-update --svnsync --svncommit [module name]
@robinvdvleuten
robinvdvleuten / gist:1986616
Created March 6, 2012 14:38
From A till Z in PHP
<?php
range('a', 'z');
?>
SUMMARY
I like to use kcachegrind for doing profiling on my ruby code. Most of my development
is done on OSX, and while you can install kcachegrind via macports, it takes forever
because it has to build KDE, as well. Much to my surprise, the fine folks who
wrote kcachegrind also made a QT version, qcachegrind. I was able to build this on
OSX without too much effort, only having to install QT and GraphViz. Yippie!
I'm running OSX 10.6.7, with Xcode 4. My default gcc/g++ version is 4.2. I'm sure
it will build just fine on earlier versions of Xcode, but I haven't tested it.