Skip to content

Instantly share code, notes, and snippets.

View Daveiano's full-sized avatar
🏠
Working from home

Daveiano

🏠
Working from home
View GitHub Profile
@infojunkie
infojunkie / views_join_translation.module
Last active December 17, 2015 17:19
A Drupal Views join handler to be used with node translation relationships. This join returns translated nodes *or* the node itself if it is not translated. This is useful to guarantee that some node is returned. To understand the context: http://thereisamoduleforthat.com/content/view-nodes-and-their-translations.
<?php
/**
* Implements hook_views_data_alter().
*/
function views_join_translation_views_data_alter(&$data) {
$data['node']['translation']['relationship']['join_handler'] = 'views_join_translation';
}
/**
@opie4624
opie4624 / commandline.py
Last active March 6, 2025 20:56
Base Python Command Line template
#!/usr/bin/env python
#
# import modules used here -- sys is a very standard one
import sys, argparse, logging
# Gather our code in a main() function
def main(args, loglevel):
logging.basicConfig(format="%(levelname)s: %(message)s", level=loglevel)
@dbowling
dbowling / gist:2589645
Created May 3, 2012 21:25
Convert text to a valid CSS class name
string = 'Invalid C$$ class name';
string.replace(/[!\"#$%&'\(\)\*\+,\.\/:;<=>\?\@\[\\\]\^`\{\|\}~]/g, '').toLowerCase();