Skip to content

Instantly share code, notes, and snippets.

View ramlev's full-sized avatar

Hasse Ramlev Wilson ramlev

View GitHub Profile
@ramlev
ramlev / restart-coreaudio.sh
Created April 22, 2013 17:52
Restart OSX CoreAudio
#!/bin/sh
sudo kill $(ps -ax | grep 'coreaudiod' | grep 'sbin' |awk '{print $1}')
@ramlev
ramlev / screenshot.sh
Created January 19, 2013 12:37
A little phantomjs shellscript for taking screenshots
#!/bin/sh
PATH_TO_PHANTOMJS=~/tmp/phantomjs
SCREENSHOT_PATH=~/Desktop
# Check if an url has been added as an arguemnt
if [ -n "$1" ]
then
URL=$1
else
@ramlev
ramlev / gist:4127356
Created November 21, 2012 20:13
Error on vim upgrade (vim (7.3.715 < 7.3.725))
> brew upgrade vim
==> Upgrading vim
==> Cloning https://vim.googlecode.com/hg/
Updating /Library/Caches/Homebrew/vim--hg
warning: vim.googlecode.com certificate with fingerprint 26:83:37:6b:84:6b:9b:8c:0a:35:71:67:08:ce:dd:f1:ba:20:05:c7 not verified (check hostfingerprints or web.cacerts config setting)
pulling from https://vim.googlecode.com/hg/
searching for changes
no changes found
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
==> Checking out tag v7-3-725
@ramlev
ramlev / gist:3618789
Created September 4, 2012 09:01
hook_views_pre_execute() - comment the query
function my_module_views_pre_execute(&$view) {
$view->build_info['query'] = "
-- NOTE: view is overwritten in my_module_views_pre_execute()
SELECT ......
FROM ....
";
}
; Basic Drush Make file
; Core version
; ------------
; Each makefile should begin by declaring the core version of Drupal that all
; projects should be compatible with.
core = 7.15
api = 2
projects[] = drupal
@ramlev
ramlev / gist:3186936
Created July 27, 2012 09:03
brew upgrade mariadb
> brew upgrade
==> Upgrading mariadb
==> Downloading http://ftp.osuosl.org/pub/mariadb/mariadb-5.3.7/kvm-tarbake-jaunty-x86/mariadb-5.3.7.tar.gz
Already downloaded: /Library/Caches/Homebrew/mariadb-5.3.7.tar.gz
==> ./configure --without-docs --without-debug --prefix=/usr/local/Cellar/mariadb/5.3.7 --localstatedir=/usr/local/var/mysql --sys
==> make install
Making install in .
make abi_headers="include/mysql.h include/mysql/client_plugin.h include/mysql/plugin_auth.h" do_abi_check
set -ex; \
for file in include/mysql.h include/mysql/client_plugin.h include/mysql/plugin_auth.h; do \
@ramlev
ramlev / settings.php
Created July 6, 2012 09:57
Varnish settings
// Add Varnish as the page cache handler.
$conf['cache_backends'] = array('profiles/zcf_site/modules/contrib/varnish/varnish.cache.inc');
$conf['cache_class_cache_page'] = 'VarnishCache';
// Drupal 7 does not cache pages when we invoke hooks during bootstrap. This needs
// to be disabled.
$conf['page_cache_invoke_hooks'] = FALSE;
@ramlev
ramlev / gist:1652469
Created January 21, 2012 11:40
PHPCS with Drupal output
FILE: /Users/me/www/drupal-7.10/modules/poll/poll.module
--------------------------------------------------------------------------------
FOUND 9 ERROR(S) AND 4 WARNING(S) AFFECTING 13 LINE(S)
--------------------------------------------------------------------------------
5 | WARNING | Line exceeds 80 characters; contains 81 characters
195 | WARNING | A comma should follow the last multiline array item. Found: )
227 | WARNING | A comma should follow the last multiline array item. Found: )
315 | ERROR | Inline comments must end in full-stops, exclamation marks, or
| | question marks
380 | ERROR | You must use "/**" style comments for a function comment
@ramlev
ramlev / gist:1652460
Created January 21, 2012 11:37
phpcs example
FILE: /Users/me/www/drupal-7.10/modules/poll/poll.module
--------------------------------------------------------------------------------
FOUND 630 ERROR(S) AND 36 WARNING(S) AFFECTING 519 LINE(S)
--------------------------------------------------------------------------------
4 | ERROR | There must be exactly one blank line before the tags in file
| | comment
7 | WARNING | PHP version not specified
7 | ERROR | Missing @category tag in file comment
7 | ERROR | Missing @package tag in file comment
7 | ERROR | Missing @author tag in file comment
@ramlev
ramlev / .vimrc
Created January 15, 2012 19:52
Vim configuration file.
set nocompatible
filetype off " force reloading after pathogen is loaded
" Use pathogen to easily modify the runtime path to include all
" plugins under the ~/.vim/bundle directory
call pathogen#helptags()
call pathogen#runtime_append_all_bundles()
filetype plugin indent on " enable detection, plugins and indenting in one step
set mouse=a " use mouse gestures