Skip to content

Instantly share code, notes, and snippets.

//
// All lines starting with "//" will not show up in the style.css
// However, the following lines inside "/* ... */" WILL show up.
//
// The visible comment below is there to warn any developer who
// opens a .css file that they need to edit the .scss versions ONLY.
// But you already know that because you're reading this :)
//
/*
@shrop
shrop / brewStack.md
Last active October 11, 2023 20:18
brewStack Docs
@pascalduez
pascalduez / modulename.module
Created February 22, 2012 23:33
Drupal 7 - Add a cancel button on node forms
<?php
/**
* Implements hook_form_alter().
*/
function modulename_form_alter(&$form, &$form_state, $form_id) {
// You might want to filter by content type.
if ($form_id == 'ctype_node_form') {
// Add a cancel button.
$form['actions']['cancel'] = array(
@macek
macek / pear-lion-install.md
Created October 20, 2011 16:03
PEAR on OS X Lion

After upgrading to OSX Lion, I discovered that both PEAR and PECL had gone missing. It turns out that you have to re-install them, but luckily it's quite simple. I found this quick guide from Ruggero De Pellegrini on Google+, and thought I would share the info to save you the confusion:

  1. Download the installer curl http://pear.php.net/go-pear.phar > go-pear.php
  2. Start the installation procedure with sudo sudo php -q go-pear.php
  3. Select a new installation base ($prefix) e.g. /usr/local
  4. Proceed with the install.
  5. If there is no /etc/php.ini file yet, copy the default sudo cp /etc/php.ini.default /etc/php.ini
  6. Edit /etc/php.ini and change the line ;include_path = ".:/php/includes" to include_path = ".:/usr/local/share/pear"
  7. Add /usr/local/bin/ to your path if you haven't already, e.g. in .profile
@nathansmith
nathansmith / .htaccess
Created October 1, 2011 03:33
Route extension-less files to HTML.
# Route extension-less URLs to the equivalent *.html file.
# For instance: example.com/about = example.com/about.html
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]
</IfModule>
javascript:(function(){x%20=%20open().document;$(".views-field-title a").each(%20function()%20{%20x.write('[' + $(this).attr('href').replace(/\/node\//, '#') + '] : ' + $(this).text()+'<br%20/>')%20})})()
@q0rban
q0rban / Starter Drush Make
Created July 28, 2010 17:53
Sample Drush Makefile
core = 6.x
projects[pressflow][type] = "core"
projects[pressflow][download][type] = "get"
projects[pressflow][download][url] = "http://lb.cm/pressflow6"
; INSTALL PROFILES
projects[profiler] = 2.0beta1
; DEVELOPMENT
@kennethreitz
kennethreitz / ssh-copy-id
Created April 26, 2010 00:48
Installs your publickey to a remote host
#!/bin/sh
# Shell script to install your public key on a remote machine
# Takes the remote machine name as an argument.
# Obviously, the remote machine must accept password authentication,
# or one of the other keys in your ssh-agent, for this to work.
ID_FILE="${HOME}/.ssh/id_rsa.pub"
if [ "-i" = "$1" ]; then