Skip to content

Instantly share code, notes, and snippets.

raybellis / jquery.classlist.js
Last active Dec 14, 2015
A shim for jQuery that uses the native "classList" property of an element for class modifications, if available.
View jquery.classlist.js
/*global jQuery */
;(function($) {
/*global document */
"use strict";
if (typeof document !== 'undefined' && ('classList' in document.createElement('a'))) {
var $ = jQuery;
kevingessner / parent.htm
Created May 17, 2013
Detect browser zoom in javascript 'zoom' event is triggered on window on every browser zoom change. No polling!
View parent.htm
<script src=""></script>
<iframe id="frame" style="width: 250px; border: solid 1px red;" ></iframe>
<script type="text/javascript">
var elFrame = $('#frame')[0];
$(elFrame.contentWindow).resize(function() {
guenthertheilen / gist:8401080
Created Jan 13, 2014
Install Composer on Managed Hosting at Domainfactory
View gist:8401080

Install Composer on Managed Hosting at Domainfactory

Step 1:

Log in to your Managed Hosting Server via SSH

Step 2:

Add these two lines to .bashrc:

mildlygeeky / gist:14b814ec8c815a1f5c6f
Last active Jan 3, 2019
Dynamic Navigation using native Craft CMS and Twig templates
View gist:14b814ec8c815a1f5c6f
{# For this, I wanted the nav to show the top-level node and second-level nodes #}
{# when on level 1, and then show the second-level and its children when on #}
{# level 2 or level 3 (so we get good parent, child, and sibling navigation. #}
{# Requires string 'sectionName' to be passed with Structure section name #}
{% if entry.showLeftNavigation %}
<nav class="interior-page__nav">
hashchange / marionette.handlebars.js
Last active Aug 29, 2015 — forked from funkjedi/marionette.handlebars.js
Handlebars for Marionette. -- No longer maintained. Instead, please use
View marionette.handlebars.js
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* This gist is no longer updated. Please use
* instead.
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
CITguy / custom-task.js
Last active Mar 3, 2021
Basic pattern for creating a custom Transform stream for use with gulp tasks.
View custom-task.js
var gulp = require('gulp');
var myTransform = require('./myTransform');
gulp.task('foobar', function (){
return gulp.src("foobar.js")
hashchange / rounding.js
Created Jul 26, 2015
Floating-point versions of Math.round, Math.floor, Math.ceil
View rounding.js
* Adjusts a number to a given precision, working around the buggy floating-point math of Javascript. Works for
* round, floor, ceil operations.
* Lifted from the Math.round entry of MDN. Minor changes without effect on the algorithm.
* @param {string} operation "round", "floor", "ceil"
* @param {number} value
* @param {number} [precision=0] can be negative: round( 104,-1 ) => 100
* @returns {number}
hashchange / scrollTargetPosition.js
Created Aug 17, 2015
Returns the scroll target position for scrolling to the top of an element.
View scrollTargetPosition.js
* Returns the scroll target position for scrolling to the top of an element.
* Pass the result to a scrollTo method:
* - $scrollContainer.scrollTop( result ) for instant scrolling
* - $scrollContainer.scrollTo( result ) for animated scrolling with jQuery.scrollable
* @param {jQuery} $target the target element
* @param {jQuery} $scrollContainer either $(window), or a scrollable HTML element
khalwat /
Last active Jan 1, 2020
Properly set permissions for a Craft CMS install, including ensuring that files are all g-x. Set CHOWN_USER, CHOWN_GROUP, and BASE_DIR to whatever is appropriate, add directories that need to be writeable by the web server to DIRS[], then execute: sudo ./ PROJECT_NAME
This is now part of craft-scripts:
nrollr /
Last active May 15, 2022
Enable SSL in Apache for 'localhost' (OSX, El Capitan)

Enable SSL in Apache (OSX)

The following will guide you through the process of enabling SSL on a Apache webserver

  • The instructions have been verified with OSX El Capitan (10.11.2) running Apache 2.4.16
  • The instructions assume you already have a basic Apache configuration enabled on OSX, if this is not the case feel free to consult Gist: "Enable Apache HTTP server (OSX)"

Apache SSL Configuration

Create a directory within /etc/apache2/ using sudo mkdir /etc/apache2/ssl
Next, generate two host keys: