Skip to content

Instantly share code, notes, and snippets.

View JulienMelissas's full-sized avatar
🎯

Julien Melissas JulienMelissas

🎯
View GitHub Profile
@JulienMelissas
JulienMelissas / site-id-wp-toolbar.php
Last active December 15, 2019 19:05
Show Site ID next to Site Title in WP Toolbar for Super Admins
<?php
/**
* Display Site ID next to site name
*/
add_action( 'admin_bar_menu', function( $wp_admin_bar ) {
// Check to make sure user is super admin
if ( is_super_admin() ) {
// Get site name node and Blog ID
$site_name_node = $wp_admin_bar->get_node( 'site-name' );
$blog_id = get_current_blog_id();
<?php
/*
Plugin Name: Fix WooCommerce Template Cache
Plugin URI: https://woocommerce.com
Description: This fixes some issues with WC's template caching on sites that use multiple containers, due to the entire path being cached. If the file does not exist, this script uses default WC logic (copy/pasted) to grab the correct templates.
Version: 1.0.0
Author: Julien Melissas
Author URI: https://julienmelissas.com
*/
add_filter('wc_get_template_part', function( $template, $slug, $name ) {
@JulienMelissas
JulienMelissas / assets.php
Created January 21, 2018 18:36
Mix 4 Sage - Toby
<?php
/**
* Label Assets
*
* @package label
* @since 1.0
*/
namespace Craftpeak\Label\Assets;
@JulienMelissas
JulienMelissas / new.php
Created October 21, 2017 23:42
Customizer Registerer
<?php
use ClassName;
$panels = [
'general_settings' => [
'priority' => 10,
'title' => __('General Settings', 'label'),
'description' => __('General settings for this site', 'label'),
'sections' => [
'general_colors' => [
@JulienMelissas
JulienMelissas / Select.js
Last active September 12, 2017 22:44 — forked from keeth/Select.js
A formsy-react wrapper around React Select (ES6)
import React from 'react';
import Formsy from 'formsy-react';
import ReactSelect from 'react-select';
// Dont forget to import your styles somewhere
const Select = React.createClass({
mixins: [Formsy.Mixin],
@JulienMelissas
JulienMelissas / Part1.js
Last active December 12, 2015 18:26
Advent Code Day 12
// Here's the data:
var data = {"e":{"a":{"e":-39,"c":119,"a":{"c":65,"a":"orange","b":"green","d":"orange"},"g":"violet","b":{"e":6,"c":{"c":"violet","a":8,"b":["red",{"a":37},"green",84,"yellow","green",[24,45,"blue","blue",56,"yellow"],"orange"]},"a":"violet","b":{"a":85},"d":[109,66,["yellow","violet",21,-30],"violet","blue",-43,{"e":"violet","c":"red","a":"blue","b":-22,"d":[71,"red",30,"violet","red",26,120],"f":["red"]},"red"]},"d":{"e":"violet","a":"blue","d":"blue","c":"blue","h":"orange","b":{"e":"red","a":{"c":115,"a":137,"b":"green"},"d":-25,"c":"blue","h":{"a":161,"b":["yellow",56,129,-31,"yellow","red","green",105,"orange",130]},"b":142,"g":194,"f":122,"i":-16},"g":173,"f":["orange","green",54,-9],"i":-23},"f":{"c":110,"a":"yellow","b":[{"a":155},156,"violet",94,"yellow"],"d":{"e":91,"a":-18,"d":"red","c":["green","orange","orange",190,"yellow",158,"blue","orange","blue",4],"h":143,"b":"orange","g":145,"f":["orange",37,"yellow",-22,{"c":30,"a":78,"b":196,"d":84},-7,["yellow"]]}}},"b":[[{"c":0,"a

Development Software

  • VirtualBox - Virtualization software for running local operating systems within your computer. This let's us have a full version of linux within our computers that better matches how a live webserver works.
  • Vagrant - A tool for provisioning virtual machines.
  • VVV - A pre-built, community supported Vagrant configuration for WordPress development.
  • Git - Version control system for managing code during development. Easily allows for tracking changes, and merging new code into an existing project.
  • SourceTree - A GUI available on Windows and Mac for managing Git projects. This makes Git much easier to use, as we won't have to learn the command line interface.
  • GitHub.com - A website that provides free Git repos for both open source and private projects.
  • SASS - (we'll use the SCSS flavor) A CSS preprocessor that allows us to write much less CSS for a project. This basically makes CSS into a simple programming language.
@JulienMelissas
JulienMelissas / spbmo.php
Created February 3, 2015 18:52
Sort Posts by Menu Order
<?php
/*
Plugin Name: Sort Posts by Menu Order (SPBMO)
Description: This plugin adds support to posts or custom post types for menu order, and sorts queries for those post types by menu_order on the front end. It's reccommended that you download <a href="https://wordpress.org/plugins/simple-page-ordering/">Simple Page Ordering</a> if you'd like to display by menu_order in the admin and to add Drag/Drop support.
Plugin URI: http://julienmelissas.com/add-drag-drop-support-to-posts
Author: Julien Melissas
Author URI: http://julienmelissas.com
Version: 1.0
*/
@JulienMelissas
JulienMelissas / Haversine.html
Created January 21, 2014 00:11
Using the Haversine formula to calculate the distance between 2 points in JS. CHECK IT OUT IN YOUR CONSOLE
<html>
<head>
<title>Haversine Test</title>
</head>
<body>
<script>
myLoc = {
lat: 35.597982,
lng: -82.551416
@JulienMelissas
JulienMelissas / Center
Last active January 3, 2016 01:48
Some super cool LESS Mixins
/*
This will compile code for an element you want to center exactly inside a div, just give it the width and height.
You must know the width and height, and the parent element must be relatively positioned
See this article here on CSS tricks: http://css-tricks.com/centering-in-the-unknown/
Use like this for example:
#center-me {
.center(300px, 400px);
}
*/