Skip to content

Instantly share code, notes, and snippets.

@smhmic
smhmic / gitignore_global.txt
Last active January 16, 2017 03:51
gitignore global
#
# This file specifies intentionally untracked files to ignore
# http://git-scm.com/docs/gitignore
#
# The purpose of gitignore files is to ensure that certain files not
# tracked by Git remain untracked.
#
# To ignore uncommitted changes in a file that is already tracked:
# `git update-index --assume-unchanged`.
#
__author__ = 'schwa'
import os
import subprocess
import glob
from github import Github # pip install PyGithub
from bitbucket.bitbucket import Bitbucket # pip install --user bitbucket-api
GH_USERNAME = '[email protected]'
GH_PASSWORD = '1234'
@smhmic
smhmic / events-conditional-wrappers.php
Last active November 27, 2017 22:41 — forked from jo-snips/events-conditional-wrappers.php
Modern Tribe's The Events Calendar (WordPress plugin) conditional template tags
<?php
/*-----------------------------------------------------------------------------------*/
/* Conditional Logic to Detect Various Event Related Views/Pages
/*-----------------------------------------------------------------------------------*/
if( tribe_is_month() && !is_tax() ) { // Month View Page
echo 'were on the month view page';
} elseif( tribe_is_month() && is_tax() ) { // Month View Category Page
@smhmic
smhmic / xdebug-styles.css
Created August 25, 2014 14:29
improved xdebug styling (for stack traces, etc)
.xdebug-error {
white-space: pre-wrap;
}
.xdebug-error > tr:first-child > td:first-child,
.xdebug-error > tbody > tr:first-child > td:first-child {
padding: 1em;
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/query.php
*/
$args = array(
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
source /bath/to/bash-getopt
foo_dflt="wibble"
bash-getopt "$@" <<END_OPTS
@smhmic
smhmic / confirm.sh
Last active August 29, 2015 13:57
bash shell yes/no confirmation prompt
function confirm() {
[ 1 != "`is_interactive`" ] && \
return 1
local prompt="$1"
local choices="y/n"
[ $# = 0 ] && \
prompt="Do you want to proceed?"
@smhmic
smhmic / hover-fix.js
Created March 24, 2014 16:58
disable :hover on touch devices to avoid sticky hover state (http://retrogamecrunch.com/tmp/hover-fix)
// disable :hover on touch devices
// based on https://gist.github.com/4404503
// via https://twitter.com/javan/status/284873379062890496
// + https://twitter.com/pennig/status/285790598642946048
// re http://retrogamecrunch.com/tmp/hover
if ('createTouch' in document)
{
try
{
var ignore = /:hover/;
@smhmic
smhmic / gist:7934153
Last active December 31, 2015 04:29
get query variable via js
function getParameterByName( name ){
if( typeof getParameterByName.params == 'undefined' )
getParameterByName.params = {};
if( typeof getParameterByName.params[name] == 'undefined' ){
name = name.replace( /[\[]/, "\\\[" ).replace( /[\]]/, "\\\]" );
var regex = new RegExp( "[\\?&]" + name + "(?:=([^&#]*))?" ),
results = regex.exec( location.search );
// if only key was given, assume value is 'true'
if( results === null )
getParameterByName.params[name] = null;
ol {
counter-reset:li; /* Initiate a counter */
margin-left:0; /* Remove the default left margin */
padding-left:0; /* Remove the default left padding */
}
ol > li {
position:relative; /* Create a positioning context */
margin:0 0 6px 2em; /* Give each list item a left margin to make room for the numbers */
padding:4px 8px; /* Add some spacing around the content */
list-style:none; /* Disable the normal item numbering */