Skip to content

Instantly share code, notes, and snippets.

View wpsmithtwc's full-sized avatar

Travis Smith wpsmithtwc

View GitHub Profile
@wpsmithtwc
wpsmithtwc / my_add_menu_descriptions.php
Last active July 24, 2017 17:24
Add description to all menus.
<?php
add_filter( 'wp_nav_menu_args', 'my_add_menu_descriptions' );
function my_add_menu_descriptions( $args ) {
$args['walker'] = new Menu_With_Description;
$args['desc_depth'] = 0;
$args['thumbnail'] = true;
$args['thumbnail_link'] = false;
$args['thumbnail_size'] = 'nav_thumb';
$args['thumbnail_attr'] = array( 'class' => 'nav_thumb my_thumb', 'alt' => 'test', 'title' => 'test' );
<?php
class Menu_With_Description extends Walker_Nav_Menu {
function start_el( &$output, $item, $depth, $args ) {
global $wp_query;
$indent = ( $depth ) ? str_repeat( "t", $depth ) : '';
$class_names = $value = '';
#!/bin/bash
############################################################
# init helpers
############################################################
# helper to source file if it exists and is not zero in size
function source_if_exists() {
for arg in $@; do
if [[ -s $arg ]]; then
if_debug_echo $arg
source $arg
@wpsmithtwc
wpsmithtwc / asyncHttpGets-1.go
Created June 14, 2017 14:55
Async Concurrent Requests into a Slice
package main
import (
"fmt"
"net/http"
"time"
)
var urls = []string{
"http://pulsoconf.co/",
@wpsmithtwc
wpsmithtwc / gist:b6299e7be78be8bc03113b8828a0866c
Created June 14, 2017 14:54 — forked from mattetti/gist:3798173
async fetching of urls using goroutines and channels
package main
import (
"fmt"
"net/http"
"time"
)
var urls = []string{
"http://pulsoconf.co/",
@wpsmithtwc
wpsmithtwc / curl.md
Created June 14, 2017 13:55
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@wpsmithtwc
wpsmithtwc / curl.md
Created June 14, 2017 01:46 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@wpsmithtwc
wpsmithtwc / poker.go
Created June 7, 2017 18:25 — forked from montanaflynn/poker.go
Generate a deck of cards, shuffle it and then deal them out in Golang
package main
import (
"fmt"
"math/rand"
"os"
"time"
)
// Card holds the card suits and types in the deck
@wpsmithtwc
wpsmithtwc / cards-deal-2.go
Created June 6, 2017 02:12
Generate a deck of cards, shuffle it and then deal them out in Golang
package main
import (
"fmt"
"math/rand"
"os"
"time"
)
// Card holds the card suits and types in the deck
@wpsmithtwc
wpsmithtwc / Scripts.ascx.cs
Last active May 17, 2017 16:49
Based on WayPoints v3.1.1
namespace AGGSP.CONTROLTEMPLATES.AGGSP
{
using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;
using System.Web.UI;
public partial class Scripts : UserControl
{
// Override the CreateChildControls method to add our JS reference
protected override void CreateChildControls()