Skip to content

Instantly share code, notes, and snippets.

View I-CRE8's full-sized avatar

Dave Buchholz I-CRE8

View GitHub Profile
// The core app code
var myApp = (function () {
'use strict';
// Create a public methods object
var methods = {};
/**
* Extend the public methods object
@Grant-Smith-74
Grant-Smith-74 / Perch-Runway-Collection-Menu.md
Last active April 8, 2019 14:50
Perch Runway Collection Menu

#Perch Runway Collection Menu

This is to document how to make a menu with collection items. For this project I needed a Services collection, consisting of a Services page with Service sub pages as menu items in the Header Nav of my project.

The project also uses Bulma Navbar.

To achieve, you need to of setup a Perch Collection and then the following templates require creating if you haven't already done so.

/layouts/global/header.php
/navigation/level_1.html

@cjkoepke
cjkoepke / logging_errors.js
Created August 10, 2017 18:20
Debugging tips and tricks.
// Great for getting values, outputting context strings, and so on.
console.log(variable)
// Same as console.log(), but prints in yellow as a warning. Useful to show a non-breaking error in a dev env.
console.warn('It is a good idea to use .map instead of a for-loop.')
// Same as console.log(), but prints in red as an error. Useful to show a breaking error in a dev env.
console.error(`The value must be an integer. You provided a ${typeof variable}.`)
// Group console data together for better viewing. Nice to group console logs together.
@cowboy
cowboy / bocoup-training-more-efficient-event-handlers.js
Created February 12, 2013 21:38
Bocoup training: More Efficient jQuery Event Handlers
// Straightforward + simple.
$("button").on("click", function(event) {
event.preventDefault();
var button = $(this);
var numberElem = button.find(".number");
var number = Number(numberElem.text()) - 1;
numberElem.text(number);
if (number === 0) {
button.prop("disabled", true);
button.off("click");
@slivero
slivero / gist:3164297
Created July 23, 2012 15:41
Resampling a JPEG image in PHP using GD (not imagemagick)
<?php
/**
* Class used for resampling images
*/
class Resampler
{
/**
* Resample an image
*
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/