Skip to content

Instantly share code, notes, and snippets.

Abeilles en Vélo / Bees on a bike shaneonabike

Block or report user

Report or block shaneonabike

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
shaneonabike / import.php
Last active Jan 21, 2020
Wordpress Inject Countries
View import.php
function insert_countries() {
wp_insert_term('CA', 'countries', array('description'=>'Canada'));
$array_data = csv_to_array('/var/www/cinema/wp-content/themes/cp-theme/country.csv');
// Knock off the first line
foreach($array_data as $data)
View Drupal Search Index blocks
SELECT n.nid FROM node n LEFT JOIN search_dataset d ON d.type = 'node' AND d.sid = n.nid WHERE d.sid IS NULL OR d.reindex <> 0 ORDER BY d.reindex ASC, n.nid asc;
View popup.js
jQuery(function($) {
// Scroll the popup with the user
$(window).scroll(function() {
var windowWidth = document.documentElement.clientWidth;
var windowHeight = document.documentElement.clientHeight;
var popupWidth = $("#likeus").width();
var popupHeight = $("#likeus").height();
var topPopup = windowHeight * 2 / 3 + $(window).scrollTop();
var leftPopup = windowWidth - popupWidth;
View popup.css
* Like Us Popup CSS
#likeus {
border: 1px solid #666;
-webkit-box-shadow: 0 0 16px #666;
box-shadow: 0 0 16px #666;
shaneonabike / page.html
Last active Sep 11, 2018
Popup code body
View page.html
<div id="likeus"><div id="likeus-wrapper">
<div id="likeus-banner">&nbsp;</div>
<div id="likeus-inner">
<h2>Join us on Facebook</h2>
<div class="fb-like" width="300" data-href="" data-layout="standard" data-action="like" data-show-faces="false" data-share="true"></div>
<div id="likeus-close-wrapper">
<a href="#likeus" class="close-like">Close</a> ·
<a href="#likeus"> class="close-forever">I already like Bees on a Bike</a>
shaneonabike / template.php
Created Sep 11, 2018
Drupal Timefield exposed filter integration (template.php)
View template.php
* Preprocess output of form element
function yourtheme_preprocess_form_element(&$vars) {
if (!empty($vars['element']['#id']) && ($vars['element']['#id'] == 'edit-hour')) {
// Add special class for JS to work properly but we need to edit the #children value :/
$children = $vars['element']['#children'];
if (!empty($children)) {
$vars['element']['#children'] = str_replace('form-text', 'form-text edit-timefield-timepicker filter-project-event-time', $children);
shaneonabike / yourmodule.module
Created Sep 11, 2018
Drupal Timefield exposed filter
View yourmodule.module
* Alter the exposed form for the projects view
* $form
* Relative form that is being created
* $form_state
* Existing statee
You can’t perform that action at this time.