Skip to content

Instantly share code, notes, and snippets.

View rachellawson's full-sized avatar

Rachel Lawson rachellawson

View GitHub Profile
function contactology_libraries_info() {
// A very simple library. No changing APIs (hence, no versions), no variants.
// Expected to be extracted into 'sites/all/libraries/contactology_api'.
$libraries['contactology_api'] = array(
'name' => 'Contactology API',
'vendor url' => 'http://www.contactology.com/',
'download url' => 'http://www.contactology.com/email-marketing-api/',
'version arguments' => array(
'file' => 'class.Contactology.phps',
// Best practice: Document the actual version strings for later reference.
@rachellawson
rachellawson / _wysiwyg_ctas.scss
Created July 29, 2014 15:35
for adding multiple items
.cta_color_green {
background-color: $wax-green;
color: $white;
height: 150px;
border-radius: 8px;
padding: 10px;
}
.cta_color_red {
background-color: #ff0000;
@rachellawson
rachellawson / file.formatter.generic.css
Created September 20, 2014 11:35
just trying to understand how this fits into smacss
/**
* @file
* Default style for file module
*/
/**
* File icons
*/
.file {
padding-left: 20px; /* LTR */
@rachellawson
rachellawson / xxx.module
Last active August 29, 2015 14:12
Its possible to alter a user lookup on the owner field for an entity, such as an order in drupal commerce. In this case, I needed to make it possible to not only lookup a user by their username in drupal but also by their "Dealer Code", a field attached to the user entity. I have never had to select items across two or more columns in a Entity F…
<?php
/**
* Implements hook_form_alter().
* to allow admins to seach for order ownders by dealer code
*/
function xxx_form_commerce_order_ui_order_form_alter(&$form, &$form_state, $form_id) {
$form['user']['#title'] = 'Order owner';
$form['user']['name']['#description'] = t('Choose a user by entering their username or dealer code and
selecting from the list');

Keybase proof

I hereby claim:

  • I am rachellawson on github.
  • I am rachel_norfolk (https://keybase.io/rachel_norfolk) on keybase.
  • I have a public key whose fingerprint is 6146 E179 B14B FCE4 64DE 0701 0C03 7074 7E6D 2BC8

To claim this, I am signing this object:

@rachellawson
rachellawson / creategif
Last active September 1, 2015 13:07
Create a d.o compatible mini movie gif rather than a static screenshot
#!/bin/sh
# Create an animated GIF of a screen recording to upload to d.o
# Usage: creategif input_file.mp4 output_file.gif
# As described at http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
palette="/tmp/palette.png"
filters="fps=15,scale=1280:-1:flags=lanczos"
<?php
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node');
$query->entityCondition('bundle', 'article');
$result = $query->execute();
if (!empty($result)) {
$entities = entity_load('node', array_keys($result['node']));
return entity_view('node', $entities, 'full');
} else {
@rachellawson
rachellawson / fullwidth.css
Last active September 3, 2015 12:05
to use <p class="wide">something</p>
//add <p class="wide"> to make a <p> stretch a grey background across full width
.wide {
background-color: #aaa;
position: relative;
padding: 20px 0;
}
.wide:before,
.wide:after {
content: ' ';
@rachellawson
rachellawson / gist:3533696
Created August 30, 2012 17:10
.profile create taxonomy terms
function mundi_install_tasks($install_state) {
$tasks = array (
'mundi_create_terms' => array(
'display_name' => st('Create taxonomy terms'))
);
return $tasks;
}
/**
* Implements hook_install_tasks() callback
@rachellawson
rachellawson / xxxxx.install
Created August 30, 2012 17:12
How to run another profile from this one...
/**
* Implement hook_install().
*
*/
function mundi_install() {
include_once DRUPAL_ROOT . '/profiles/standard/standard.install';
standard_install();
}