Skip to content

Instantly share code, notes, and snippets.

View joshuaiz's full-sized avatar
💭
it iz what it iz

Joshua Michaels joshuaiz

💭
it iz what it iz
View GitHub Profile
@joshuaiz
joshuaiz / soundcloud_mixin.scss
Created February 12, 2014 21:57
A SCSS @mixin for styling custom SoundCloud widgets
// Here's a little mixin I created to style some custom SoundCloud players
// $size = the size of the arwork box (also size of margins for track info + waveform)
// $title-color = the color of the track title
// $waveform-color = color of the audio waveform
// $play-color = color of the player indicator bar (current track position in playback)
//
// Usage: @include scplayer (60px, #001825, #aaa, #777)
@mixin scplayer($size, $title-color, $waveform-color, $play-color) {
<script type="text/javascript">
jQuery(document).ready(function($){
$.equalHeightColumns('destroy');
$('yourselector(s)').equalHeightColumns();
});
</script>
@joshuaiz
joshuaiz / shows-list-start.php
Created February 18, 2014 01:07
GigPress shows-list-start.php with gig title
<?php
// STOP! DO NOT MODIFY THIS FILE!
// If you wish to customize the output, you can safely do so by COPYING this file
// into a new folder called 'gigpress-templates' in your 'wp-content' directory
// and then making your changes there. When in place, that file will load in place of this one.
// This template opens a list of shows - by default it opens a table,
// but it could also open a list, or be blank if you so desired
@joshuaiz
joshuaiz / shows-list.php
Created February 18, 2014 01:09
GigPress shows-list.php with gig title(s) added
<?php
// STOP! DO NOT MODIFY THIS FILE!
// If you wish to customize the output, you can safely do so by COPYING this file
// into a new folder called 'gigpress-templates' in your 'wp-content' directory
// and then making your changes there. When in place, that file will load in place of this one.
// This template displays all of our individual show data in the main shows listing (upcoming and past).
// It's marked-up in hCalendar format, so fuck-around with caution.
// See http://microformats.org/wiki/hcalendar for specs
@joshuaiz
joshuaiz / cpfolder.sh
Last active August 29, 2015 14:15
Copy files and folders from source into current directory
# After struggling with Automator and AppleScript to try to copy a target folder and its contents
# to the current directory, I ended up creating this simple shell script to do just that.
# Every time I get a new web development project I was creating the same folders and subfolders and
# this script does it all in one go. Just create a template (source) folder with everything you need
# in it and then navigate to your target directory in Terminal and run this script by typing cpfolder
# at the command line.
# To install, add this to your ~/.bash_profile and edit [your source] to your preferred source directory
# (remove the brackets). Do not enclose the source directory in quotes. The "." refers to the current directory.
@joshuaiz
joshuaiz / prepopulate-gf-radio.php
Created May 19, 2017 14:29
Pre-populate Gravity Forms Dropdown
<?php
add_filter( 'gform_pre_render_2', 'populate_posts' );
add_filter( 'gform_pre_validation_2', 'populate_posts' );
add_filter( 'gform_pre_submission_filter_2', 'populate_posts' );
add_filter( 'gform_admin_pre_render_2', 'populate_posts' );
function populate_posts( $form ) {
foreach ( $form['fields'] as &$field ) {
if ( strpos( $field->cssClass, 'populate-posts' ) === false ) {
@joshuaiz
joshuaiz / update-custom-user-field-with-donation-amount.php
Last active August 23, 2017 00:05
Trying to save GF donation amount to ACF custom user field
<?php
add_action("gform_after_submission_6", "update_usar_sponsorship_amount", 10, 2);
function update_usar_sponsorship_amount($entry, $form) {
// get required GF fields
$team = rgar( $entry, "14"); // GF radio buttons (select Team to sponsor)
$amount = rgar($entry, "2"); // donation amount
// query through users
$users = get_users();
@joshuaiz
joshuaiz / update-limit-choices-value.php
Created August 24, 2017 06:50
Attempt to update GF Limit Choices value when user profile is updated (not working)
<?php
// just a sample function to see what's going on
// not tied to a particular action yet
// we are on a user profile edit screen
add_action( 'wp', function() {
$form_id = 4; // GF user registration form
$choice_field_id = 13; // ACF 'time_slots' field
$choice_value = ''; // initializing the variable (otherwise PHP 7 freaks out)
$field_key = "field_5996299aee5a9"; // ACF 'time_slots' field
@joshuaiz
joshuaiz / liquidsass.sublime-snippet
Last active February 9, 2018 05:03
Sublime liquid sass/scss interpolation. Use this to select elements in a scss.liquid file and use sass interpolation to escape them so you can use a preprocessor.
<!-- Save to ~/Library/Application Support/Sublime Text 3/Packages/User/ -->
<!-- Example: if you have some liquid like: {{ settings.site_bg_col }}; in your .scss.liquid file,
select that (except for the closing ; and use the keybinding set below. -->
<!-- Output: #{" {{ settings.site_bg_col }} "}; -->
<snippet>
<content><![CDATA[
#{" $SELECTION "}
]]></content>
<!-- this tab trigger won't really work when using $SELECTION -->
@joshuaiz
joshuaiz / jsx-wrap-comment.sublime-snippet
Last active March 5, 2018 01:22
Wrap selected text in JSX style comment
<snippet>
<!-- Wraps selected text in JSX style comment, e.g. {/* <Component /> */} -->
<!-- Save this to ~/Application Support/Sublime Text 3/Packages/User/ -->
<!-- You'll need to add a keybinding in Sublime Text > Preferences > Key Bindings -->
<!-- {
"keys": ["alt+command+j"],
"command": "insert_snippet",
"args": { "name": "Packages/User/jsx-wrap-comment.sublime-snippet" }
} -->
<content><![CDATA[