Skip to content

Instantly share code, notes, and snippets.

View joshcanhelp's full-sized avatar
👋
Open to new connections!

Josh Cunningham joshcanhelp

👋
Open to new connections!
View GitHub Profile

Keybase proof

I hereby claim:

  • I am joshcanhelp on github.
  • I am joshcanhelp (https://keybase.io/joshcanhelp) on keybase.
  • I have a public key whose fingerprint is 8703 9194 46F1 49DD 05BA 772E 7E34 CED3 7442 9737

To claim this, I am signing this object:

Running "simplemocha:all" (simplemocha) task
1..1
ok 1 Array indexOf() should return -1 when the value is not present
# tests 1
# pass 1
# fail 0
Done, without errors.
@joshcanhelp
joshcanhelp / gist:a66e195864eadb7113b8
Created June 4, 2014 18:47
JS queue structure WTF
function Queue() {
this.dataStore = [];
}
Queue.prototype.enqueue = function (element) {
this.dataStore.push(element);
};
Queue.prototype.dequeue = function () {
return this.dataStore.shift();
@joshcanhelp
joshcanhelp / gist:b4eebe3be32d46a648d9
Created June 18, 2014 14:11
Mongo 101 homework 2.2
var MongoClient = require('mongodb').MongoClient;
MongoClient.connect('mongodb://localhost/m101', function(err, db) {
if (err) {
throw err;
}
var data = db.collection('data');
var cursor = data.find({});
cursor.sort("Temperature", -1);
@joshcanhelp
joshcanhelp / app.js
Created June 19, 2014 15:28 — forked from clarle/app.js
// Module dependencies
var express = require('express'),
mysql = require('mysql');
// Application initialization
var connection = mysql.createConnection({
host : 'localhost',
user : 'root',
/**
* CSS and JavaScript for admin pages
*/
function proper_admin_css_js() {
global $pagenow;
// CSS
wp_enqueue_style(
{
ID: 1787,
comment_count: "0",
comment_status: "open",
filter: "raw",
guid: "http://local.wordpress-trunk.dev/?post_type=uc_item&p=1787",
menu_order: 0,
ping_status: "open",
pinged: "",
post_author: "1",
@joshcanhelp
joshcanhelp / ejunkie-to-woocommerce
Created February 17, 2015 16:20
This script is used to migrate a transaction export from ejunkie into a Woocommerce-powered site. Please read the comments throughout to adjust this to your use case.
<?php
/**
* Class EjunkieWpCli
*
* This class adds an 'ejunkie' command to wp-cli with a 'migrate' action
* This works for simple products, variations, and the Woocommerce API Manager
* TODO: Look for lines marked as "TODO" to change this script for your use case
*/
final class EjunkieWpCli extends WP_CLI_Command {
@joshcanhelp
joshcanhelp / gist:8a133591d79c7db04a46
Last active August 29, 2015 14:17
Completely nuke comment support in WordPress
/**
* Completely nuke comments support
* Need to also also turn off comments/pingbacks at wp-admin > Settings > Discussion
* Need to also turn off comments for posts individually (Bulk Edit or DB find/replace)
*
* Adapted from: https://www.dfactory.eu/wordpress-how-to/turn-off-disable-comments/
*/
/**
@joshcanhelp
joshcanhelp / gist:5c31f8aa7194e63582bd
Last active August 29, 2015 14:21
Three columns using a shortcode (don't hate)
function otm_sc_column_wrap ( $atts = array(), $content ) {
return '<div class="column-wrap">' . do_shortcode( $content ) . '</div>';
}
add_shortcode( 'column_wrap', 'otm_sc_column_wrap' );
function otm_sc_column_3 ( $atts = array(), $content ) {
return '<div class="column-3">' . do_shortcode( $content ) . '</div>';
}