Skip to content

Instantly share code, notes, and snippets.

View joelstransky's full-sized avatar

Joel Stransky joelstransky

View GitHub Profile
@joelstransky
joelstransky / bootstrap-breakpoints.html
Created November 12, 2014 19:49
Bootstrap 3 media query break-point visual debugger
<!-- media query debugger -->
<div class="navbar-fixed-top" style="right: initial">
<button type="button" class="btn btn-default visible-lg">Large</button>
<button type="button" class="btn btn-default visible-md">Medium</button>
<button type="button" class="btn btn-default visible-sm">Small</button>
<button type="button" class="btn btn-default visible-xs">Extra-Small</button>
</div>
<!-- end media query debugger -->
@joelstransky
joelstransky / gist:cbcf8dd57a34a3f27c5f
Created March 5, 2015 20:12
grunt-contrib-imagemin
'use strict';
// following guidelines from http://mattbailey.io/a-beginners-guide-to-grunt-redux/
module.exports = function(grunt) {
require('load-grunt-config')(grunt);
require('time-grunt')(grunt);
grunt.loadNpmTasks("grunt-contrib-imagemin");
/*grunt.loadNpmTasks("grunt-concurrent");*/
grunt.initConfig({
@joelstransky
joelstransky / acf_contact_form_head.php
Created August 17, 2015 19:15
Bypass Advanced Custom Fields acf_form() create/update post functionality
function acf_contact_form_head() {
// verify nonce
if( acf_verify_nonce('acf_form') ) {
// validate data
if( acf_validate_save_post(true) ) {
// form
$GLOBALS['acf_form'] = acf_extract_var($_POST, '_acf_form');
$GLOBALS['acf_form'] = @json_decode(base64_decode($GLOBALS['acf_form']), true);
@joelstransky
joelstransky / functions.php
Created February 12, 2016 21:18
How to customize a Wordpress Multisite (WPMU) registration form
<?php
/**
* Customize the MutltiSite Registration Form
*/
//1. Add a new form element...
add_action( 'signup_extra_fields', 'mydomain_register_form' );
function mydomain_register_form( $errors ) {
// First name
$first_name = ( ! empty( $_POST['first_name'] ) ) ? trim( $_POST['first_name'] ) : '';
echo '<label for="first_name">' . __('First Name:') . '</label>';
@joelstransky
joelstransky / wp_get_full_url.php
Created February 26, 2016 20:04
Get referer url in wordpress
// because $_SERVER['HTTP_REFERER'] is unreliable
function get_referer() {
$scheme = is_ssl() ? 'https' : 'http';
return $scheme . "://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
}
@joelstransky
joelstransky / column-fluid.scss
Created March 10, 2016 02:29
Break out of bootstrap column padding
*[class^="col-"] .column-fluid {
margin-left: ceil(($grid-gutter-width / -2));
margin-right: floor(($grid-gutter-width / -2));
@include clearfix();
}
<span class="match-slot">
<% if @response[index].to_i > 0 %>
<div data-id="<%= @response[index].to_i %>" class="draggable">
<span class="bar"><%= Answer.find_by_id(@response[index]).answer %></span>
</div>
<% end %>
</span>
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@joelstransky
joelstransky / gist:d0b75e761797cc160ff95e9e87a53ca5
Created May 6, 2016 07:07
How to get Unity Remote to work on mac
1. USB, set to Software Install
2. Launch Unity Remote
3. Launch Unity
4. Edit->Project Settings->Editor
5. Device: Any Android Device
@joelstransky
joelstransky / SQL when both are used
Created May 12, 2016 01:26
searching with taxonomy terms in Wordpress
// Not unique table/alias: 'wp_term_relationships'
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID
FROM wp_posts
INNER JOIN wp_term_relationships
ON (wp_posts.ID = wp_term_relationships.object_id)
INNER JOIN wp_term_relationships
ON wp_posts.ID = wp_term_relationships.object_id
INNER JOIN wp_term_taxonomy
ON wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id
INNER JOIN wp_terms