Skip to content

Instantly share code, notes, and snippets.

View joelbrennan0's full-sized avatar

Joel Brennan joelbrennan0

View GitHub Profile
@joelbrennan0
joelbrennan0 / class-metabox.php
Created August 17, 2017 11:06
Yoast Multisite not saving
https://github.com/Yoast/wordpress-seo/issues/6121
// if ( is_multisite() && ms_is_switched() ) {
// return false;
// }
@joelbrennan0
joelbrennan0 / gekko-bot-windows
Last active May 7, 2017 23:58
node-gyp-error
open up a new cmd as administrator and run this command:
npm install --global --production windows-build-tools
then
npm config set msvs_version 2015 --global
close all instances of shell/cmd, reopen a cmd (regular this time, non-administrator) return to your directory where you are trying to run npm install and run it again
source: https://github.com/chjj/pty.js/issues/60
credit: mokanfar
@joelbrennan0
joelbrennan0 / *.js
Last active March 2, 2017 16:39
JavaScript Function Move HTML Element - Reorder
// Move an element withing the DOM at 992 window width - additional CSS required
var moveHtmlElement = function(init_el, add_cl, rm_cl, target_el, return_el) {
if ($(window).width() < 992) {
$(init_el).addClass(add_cl);
$(init_el).removeClass(rm_cl);
$(init_el).insertAfter(target_el);
} else {
$(init_el).addClass(rm_cl);
$(init_el).removeClass(add_cl);
$(init_el).insertAfter(return_el);
// Web fonts
@mixin font-face($family, $file) {
@font-face {
font-family: $family;
src: url('#{$path-font}/#{$file}-webfont.eot');
src: url('#{$path-font}/#{$file}-webfont.eot?#iefix') format('embedded-opentype'),
url('#{$path-font}/#{$file}-webfont.woff') format('woff'),
url('#{$path-font}/#{$file}-webfont.ttf') format('truetype');
}
@joelbrennan0
joelbrennan0 / app.js
Created January 19, 2016 17:04
Treehouse JavaScript TODO
//element vars
var taskInput = document.getElementById("new-task"); //new-task
var addButton = document.getElementsByTagName("button")[0]; //first button
var incompleteTasksHolder = document.getElementById("incomplete-tasks"); //incomplete-tasks
var completedTasksHolder= document.getElementById("completed-tasks"); //completed-tasks
var createNewTaskElement = function(taskString) {
var listItem = document.createElement("li");
var checkBox = document.createElement("input");
var label = document.createElement("label");
@joelbrennan0
joelbrennan0 / CustomersController.php
Last active January 13, 2016 19:51
Laravel Search ( model ) by Category
public function getCategory($category) {
$customers = Customer::whereHas('categories', function($query) use
($category) {
$query->where('name', '=', $category);
})->get();
return view('customers.index', compact('customers'));
}
//http://laravel.io/forum/02-25-2014-eager-loading-with-constrains-load-post-based-on-category-name
@joelbrennan0
joelbrennan0 / gist:99a03cbcd2c9a4e1b621
Last active August 29, 2015 14:22
equally spaced justified divs
http://stackoverflow.com/questions/6865194/fluid-width-with-equally-spaced-divs
Using the 'stretch CSS method' see link above..
@joelbrennan0
joelbrennan0 / Person.php
Created May 15, 2015 21:59
Encapsulation within PHP Classes(using getters and setters)
<?php
/*===================================
ENCAPSULATION - protecting our code
===================================*/
//this shows the benefits of encapsulation; ie protecting certain methods and parts of your code from external modification
class Person {
//by declaring our properties private all subsequent methods may only be called from within the class on instantiation.
private $name;
private $age;
@joelbrennan0
joelbrennan0 / Task.php
Last active August 29, 2015 14:21
PHP CLASSES - Basics of a class:
<?php
class Task {
public $title;
public $description;
public function __construct($title, $description) {
$this->title = $title;
$this->description = $description;
}