Skip to content

Instantly share code, notes, and snippets.

View ethanhinson's full-sized avatar

Ethan Hinson ethanhinson

View GitHub Profile
<!doctype html>
<html>
<head>
<title>Event Bubbling</title>
<script type="text/javascript">
window.onload = function() {
var div1 = document.querySelector("#div1");
var div2 = document.querySelector("#div2");
div1.addEventListener("click", function (event) {
<?php
/**
* @file
* Examples of valid statements for a Drush runtime config (drushrc) file.
*
* Use this file to cut down on typing out lengthy and repetitive command line
* options in the Drush commands you use and to avoid mistakes.
*
* Rename this file to drushrc.php and optionally copy it to one of the places
(function ($, tag) {
var flickrParams,
vimeoParams,
apiCalls = [];
tag.photosets = null;
tag.videos = null;
if(opts.flickr && opts.flickr.api_key && opts.flickr.user_id) {
<?php
ini_set('max_execution_time', 0);
ini_set('memory_limit', '3096M');
$entities = db_select('drealty_listing','dr')
->fields('dr', array('rets_key', 'id'))
->execute()
->fetchAllKeyed();
foreach($entities as $id => $eid) {
$q = db_select('file_managed', 'fm')
->condition('filename', $id . '%', 'LIKE')
@ethanhinson
ethanhinson / ng-page-views.js
Last active August 19, 2016 20:00
Pseudo code for firing dataLayer
(function(ng) {
ng
.module('app', ['ngRoute'])
.run($run);
// Safely instantiate dataLayer
var dataLayer = window.dataLayer = window.dataLayer || [];
$run.$inject = ['$rootScope', '$location'];
var selectors = {
'.sidebar' : -20,
'.prop-details': -50,
}
function my_module_slider_alter($slideshow, $this->id, $this->settings) {
$output = picturefill_wp_apply_to_html($slideshow);
return $output;
}
add_filter('metaslider_slideshow_output', 'my_module_slider_alter');
@ethanhinson
ethanhinson / drupal-installation-ec2-ami.sh
Created October 14, 2015 00:35 — forked from Mulkave/drupal-installation-ec2-ami.sh
Script to install drupal on Amazon AWS EC2 instances (AMI)
# update
sudo yum -y update
# install nginx -- the web server to be used with this installation
# for virtual host configuration visit https://gist.github.com/Mulkave/6103129
sudo yum install nginx
# install php and mysql
sudo yum -y install mysql mysql-server php54 php54-cli php54-gd php54-intl php54-mbstring php54-mcrypt php54-mysql php54-pdo php-pear php54-xml php54-xmlrpc
<?php
/*
Plugin Name: BT Image Optimization
Plugin URI: http://bluetent.com
Description: Provides image optimization capabilities as users upload images to the library.
Author: ethan@bluetent.com
Version: 0.1
Author URI: http://bluetent.com/
Text Domain: bt-image-optimize
License: GPLv2
@ethanhinson
ethanhinson / wp_block_comment_length.php
Last active August 29, 2015 14:20
Blocks the total comment link for WP
<?php
add_filter( 'preprocess_comment', 'bt_preprocess_comment' );
function bt_preprocess_comment($comment) {
// the comment_content column should never by greater than 64kb
if ( strlen( $comment['comment_content'] ) > 65534 ) {
wp_die('Comment is too long.');
}
return $comment;
}