Skip to content

Instantly share code, notes, and snippets.

View petercossey's full-sized avatar

Peter Cossey petercossey

View GitHub Profile
; This file describes the core project requirements for Open Futures
;
; Use this file to build a full project including Drupal core (with patches)
; and the Rec Post install profile using the following command:
;
; $ drush make build-openfutures.make [directory]
api = 2
core = 7.x
@petercossey
petercossey / welcome_text_search_form.inc
Last active August 29, 2015 14:02
A panels content plugin for displaying some text and an image.
<?php
/**
* @file
* Welcome text and search form content plugin.
*/
$plugin = array(
'title' => t('Welcome text search form'),
'single' => TRUE,
'category' => array(t('Content widgets'), -9),
@petercossey
petercossey / AWSELB
Created October 20, 2014 10:47
Firefox AWS cookie
81172F0D14F7AF09D6E05F31DCDA866D7CD7FC9158734F6CBFBDA124915091C3EFB07E0A2ABE5FF6A5FDA336EA8453AA1C5D509D88374963092FFD73D8A76F1A779378D89E
@petercossey
petercossey / nginx-drupal.example
Created January 17, 2015 23:44
nginx server block template for Drupal 6/7
server {
server_name domain.tld;
root /var/www/drupal7; ## <-- Your only path reference.
# Enable compression, this will help if you have for instance advagg module
# by serving Gzip versions of the files.
gzip_static on;
location = /favicon.ico {
log_not_found off;
@petercossey
petercossey / sublime.desktop
Created January 23, 2015 02:31
Sublime Text desktop shortcut
# paste the following content into sublime.desktop
[Desktop Entry]
Version=1.0
Name=Sublime Text 2
GenericName=Text Editor
Exec=sublime
Terminal=false
Icon=/opt/Sublime Text 2/Icon/48x48/sublime_text.png
Type=Application
Categories=TextEditor;IDE;Development
@petercossey
petercossey / hack.sh
Created March 31, 2012 11:30 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@petercossey
petercossey / gist:2495173
Created April 26, 2012 01:57
Drush - change user password 6.x and lower.
drush user-password someuser --password="gr3@tP@$s"
@petercossey
petercossey / mysql-new-db-snippet
Created May 7, 2012 10:06
Setup a new database and database user
CREATE DATABASE db_name;
GRANT USAGE ON *.* TO 'db_user'@'hostname' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON db_name.* TO 'db_user'@'hostname';
# Shorter
create database db_name;
grant all on db_name.* to 'db_user' identified by 'password';
flush privileges;
@petercossey
petercossey / htaccess-redirect
Created May 14, 2012 11:15
htaccess redirect
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{http_host} ^original-url.com [nc]
RewriteRule ^(.*)$ http://www.where-you-want-it-to-go.com/ [r=302,nc]
# Redirect domain and all subdomains
RewriteCond %{http_host} ^(.*)original-domain\.com [nc]
RewriteRule ^(.*)$ http://www.new-domain.com [r=302,nc]
@petercossey
petercossey / php-stdin
Created May 16, 2012 00:18
PHP scripting - record input from STDIN
<?php
function nfact($n) {
if ($n == 0) {
return 1;
}
else {
return $n * nfact($n - 1);
}
}