Skip to content

Instantly share code, notes, and snippets.

View leoj3n's full-sized avatar
:octocat:
Edit status

Joel Kuzmarski leoj3n

:octocat:
Edit status
  • Drinking coffee somewhere.
View GitHub Profile
@leoj3n
leoj3n / Hack for @pippinsplugins
Created September 2, 2012 01:44
Pippins' question: An a WP site, adding query args like this /checkout/?an_action=this is causing 404 errors. Doesn't matter what query arg. Ideas?
// a possible workaround
function my_add_rewrites($content) {
global $wp_rewrite;
$new_non_wp_rules = array(
site_url('checkout/(*)') => plugins_url('checkout.php?$1');
);
$wp_rewrite->non_wp_rules = array_merge($wp_rewrite->non_wp_rules, $new_non_wp_rules);
@leoj3n
leoj3n / gist:3691661
Created September 10, 2012 15:45
replace "Home" link in primary nav with an icon
// replace "Home" link in primary nav with an icon
add_filter( 'walker_nav_menu_start_el', 'pp_walker_nav_menu_start_el', 11, 4 );
function pp_walker_nav_menu_start_el( $item_output, $item, $depth, $args ) {
if (($args->theme_location == 'primary_navigation') && ($item->title == 'Home')) {
$domDocument = new DOMDocument();
$domDocument->loadHTML($item_output);
$domElement = $domDocument->createElement('i', '');
$domElement->setAttribute('class', 'icon-home icon-large');
$item = $domDocument->getElementsByTagName('a')->item(0);
<div class="row" style="color:#f0f0f0;">
<div id="foo" class="span4 bar">
<div class="apply-bg-here">
<h3>Box 1 Title</h3>
<div class="textwidget">
Put a lot of info here like the font should be #f0f0f0 and the background should be #232728 and that lipsum cume laude is greek for taking up space.
</div>
</div>
</div> <!-- END SPAN 4 -->
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
</head>
<body>
<div id="board"></div>
</body>
</html>
@leoj3n
leoj3n / Traceur_ES6_Demo.js
Created January 26, 2013 07:31
Playing around with EcmaScript 6 using the Traceur compiler. Digging it!
// Live demo: http://traceur-compiler.googlecode.com/git/demo/repl.html#module%20Player%20{%0A%20%20let%20options%20%3D%20new%20WeakMap%28%29%3B%0A%20%20%0A%20%20export%20class%20Controller%20{%0A%20%20%20%20constructor%28%20id%20%3D%200%2C%20type%20%3D%20%22jwplayer%22%20%29%20{%0A%20%20%20%20%20%20options.set%28%20this%2C%20{%20id%3A%20id%2C%20type%3A%20type%20}%20%29%3B%0A%20%20%20%20}%0A%20%20%20%20name%28%29%20{%0A%20%20%20%20%20%20return%20%22contoller%22%20%2B%20options.get%28this%29[%22id%22]%3B%0A%20%20%20%20}%0A%20%20%20%20setId%28%20id%20%3D%200%20%29%20{%0A%20%20%20%20%20%20options.get%28this%29[%22id%22]%20%3D%20id%3B%0A%20%20%20%20}%0A%20%20}%0A}%0A%0Aimport%20{%20Controller%20}%20from%20Player%3B%0A%0Avar%20c%20%3D%20new%20Controller%28%201%20%29%3B%0A%0Ac.setId%28%20300%20%29%3B%0A%0Aconsole.log%28%20%22Controller%20name%3A%20%22%20%2B%20c.name%28%29%20%29%3B
module Player {
let options = new WeakMap();
export class Controller {
constructor( id = 0, type = "jwplayer" ) {
opti
<?php
/*
Plugin Name: Image Optimizer
Plugin URI:
Description: Automatically optimizes images using jpegtran and optipng on upload
Version: 0.1
Author: Scott Walkinshaw
Author URI:
Support URI:
*/
@leoj3n
leoj3n / learn-gush.md
Created January 15, 2014 11:10
Using gush on the command-line.

Learning gush!

Create an issue

There needs to be an open issue before a PR can be made. This makes sense because you should always discuss the work you're about to do with team members before you go off and do it. It also gives someone else a chance to "take" the issue and create a PR for it if you're too busy, forget, or w/e.

I created this issue: https://github.com/cordoval/gush/issues/114

Take the issue, fix, and then create a PR

@leoj3n
leoj3n / Git-and-GitHub-tools.md
Last active April 11, 2017 01:59
A big list of links to Git and GitHub tools!
@leoj3n
leoj3n / designer.html
Created July 12, 2014 04:19
designer
<link rel="import" href="../yt-video/yt-search-video.html">
<link rel="import" href="../speech-mic/speech-mic.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
@leoj3n
leoj3n / designer.html
Created July 12, 2014 06:39
designer
<link rel="import" href="../paper-tabs/paper-tabs.html">
<link rel="import" href="../paper-tabs/paper-tab.html">
<link rel="import" href="../core-animated-pages/core-animated-pages.html">
<link rel="import" href="../core-animated-pages/transitions/hero-transition.html">
<link rel="import" href="../core-animated-pages/transitions/cross-fade.html">
<link rel="import" href="../core-animated-pages/transitions/slide-down.html">
<link rel="import" href="../core-animated-pages/transitions/slide-up.html">
<link rel="import" href="../core-animated-pages/transitions/tile-cascade.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icons/iconsets/av-icons.html">