Skip to content

Instantly share code, notes, and snippets.

@fcurella
fcurella / django_postgis_on_os_x.md
Created July 27, 2012 15:22
Django and Postgis on OS X

Django and Postgis on OS X

Install Homebrew

Install a few things with homebrew:

Notice that some packages give you information at the end, read it carefully. To recall that info use brew info like this: $ brew info postgresql

$ brew install python --universal
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@MrMaksimize
MrMaksimize / commit-msg.sh
Created September 22, 2012 00:27
Commit message hook that appends story id
#!/bin/sh
#
# An example hook script to check the commit log message.
# Called by "git commit" with one argument, the name of the file
# that has the commit message. The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
# commit. The hook is allowed to edit the commit message file.
#
# To enable this hook, rename this file to "commit-msg".
@nathansmith
nathansmith / gist:4354237
Last active December 10, 2015 00:49
Utility function for checking if something exists.
// Check existence
function exists(thing) {
return (!isNaN(thing) && typeof thing !== 'undefined' && thing !== null) ? thing : undefined;
}
// Or, more tersely
function exists(thing) {
// != checks `null` and `undefined`
return thing != null ? thing : undefined;
}
anonymous
anonymous / gist:4357636
Created December 22, 2012 05:37
SELECT n.nid, n.title, fc.count
FROM node n
INNER JOIN flag_counts fc ON fc.content_id = n.nid
ORDER BY fc.count DESC
LIMIT 20;
691078 Field tokens 350
1499460 [meta] New theme system 221
494100 State of the multigroup module 218
@davereid
davereid / gist:4639015
Last active December 11, 2015 18:08
Entity operation automation
<?php
function entity_get_operation_links($entity_type, $entity, $base_path = NULL) {
$build = array(
'#theme' => 'links__operations__' . $entity_type,
'#links' => array(),
'#attributes' => array('class' => array('links inline')),
);
list($entity_id) = entity_extract_ids($entity_type, $entity);
@jgraham909
jgraham909 / image_link_update.php
Created March 6, 2013 21:43
Update content after Drupal 7.20 update to account for image cache tokens
@agarzon
agarzon / DbHelper.php
Last active February 18, 2025 05:42
Codeception DB helper to extend database functionalities (update & delete)
<?php
namespace Codeception\Module;
/**
* Additional methods for DB module
*
* Save this file as DbHelper.php in _support folder
* Enable DbHelper in your suite.yml file
* Execute `codeception build` to integrate this class in your codeception
*/
@maban
maban / Event Notes.md
Last active March 9, 2020 19:28
Event Notes

Event Notes

  • Event Name:
  • Location:
  • Date:
  • Conference format: (number of days, tracks, and speakers)

Talk

@aaronbauman
aaronbauman / p-connect.sh
Last active June 10, 2020 09:28
Connect to a Pantheon database in Sequel Pro
#!/bin/sh
# exit on any errors:
set -e
if [ $# -lt 1 ]
then
echo "Usage: $0 @pantheon-alias"
exit 1
fi