Skip to content

Instantly share code, notes, and snippets.

View MattReimer's full-sized avatar
😝
Just about done...

Matt MattReimer

😝
Just about done...
View GitHub Profile
/**
* Implements hook_theme().
*/
function cogito_theme($existing, $type, $theme, $path) {
global $theme;
$path_to_child = "/" . drupal_get_path('theme', $theme) . '/';
$path = is_file( getcwd() . $path_to_child . 'header.tpl.php' ) ? $path_to_child : $path;
return array(
'cogito_header' => array(
@MattReimer
MattReimer / build.sh
Created October 24, 2012 17:22
Drush install Script
#!/usr/bin/env drush php-script --everything -v
<?php
// ---------------------------------------
// CREDENTIALS ETC.
// ---------------------------------------
$dir = "public_html";
$theme_dir = "public_html/sites/all/themes";
$makefile = "site.make";
@MattReimer
MattReimer / gist:6323217
Created August 23, 2013 19:43
A quick test of a serial-real GPS device
#include <SoftwareSerial.h>
void setup() {
Serial.begin(57600);
}
void loop() {
if (Serial.available()) {
Serial.write(Serial.read());
}
}
#include <SoftwareSerial.h>
#include <TinyGPS.h>
/* This sample code demonstrates the normal use of a TinyGPS object.
It requires the use of SoftwareSerial, and assumes that you have a
4800-baud serial GPS device hooked up on pins 3(rx) and 4(tx).
*/
TinyGPS gps;
<VirtualHost *:80>
ServerName component.local
ServerAlias www.component.local
ServerAlias component-something.pagekite.me
DocumentRoot /Users/Pigsy/Sites/component/public_html
<Directory /Users/Pigsy/Sites/component/public_html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
@MattReimer
MattReimer / Asset.php
Created October 4, 2013 21:44
Show contexts DEBUG helper
//Little helper to show our contexts
global $user;
if ($user->uid == 1 && $contexts = context_active_contexts() ) {
$msg = "Active Contexts: ";
foreach ($contexts as $key => $context) {
$msg .= "<label class='label round context'>" . $context->name . "</label>";
}
drupal_set_message( $msg, 'debug');
$site_addr = "http://". $_SERVER['HTTP_HOST'] . "/cultch";
define('WP_HOME', $site_addr);
define('WP_SITEURL', $site_addr);
@MattReimer
MattReimer / Asset.sh
Created February 24, 2014 17:04
Stupid Git tricks
# Cleaning up a problematic submodule
# ======================================
# Remove submodule foo data from .git/config
# Remove the stale submodule's gitfile rm foo/.git
# Remove the stale submodule's repo rm -rf .git/modules/foo
# Clean now: git clean -xdf
# Fun Git aliases:
@MattReimer
MattReimer / gist:c263aad4a145bf89417c
Last active August 29, 2015 14:01
AI1EC get_events_between
<?php
function some_plugin_events_get_upcoming_ids() {
//We need some helper classes from timely
global $post, $ai1ec_calendar_helper, $ai1ec_events_helper;
if (!is_object($ai1ec_events_helper)){
return;
}
function ai1ec_cl_get_upcoming_events( Ai1ec_Registry_Object $registry ) {
global $cleventlist;
$date_system = $registry->get( 'date.system' );
$search = $registry->get('model.search');
$local_date = $registry
->get( 'date.time', $date_system->current_time(), 'sys.default' );