Skip to content

Instantly share code, notes, and snippets.

View brs14ku's full-sized avatar
👋
Hellooooooooooo!

Brent Schultz brs14ku

👋
Hellooooooooooo!
View GitHub Profile
@brs14ku
brs14ku / Array of US States as an Array
Created October 31, 2014 15:47
For my purposes I needed an array of state arrays that I could add data for each state into each respective array.
$states = array(
array('Alabama'),
array('Alaska'),
array('Arizona'),
array('Arkansas'),
array('California'),
array('Colorado'),
array('Connecticut'),
array('Delaware'),
array('District of Columbia'),
@brs14ku
brs14ku / gist:d2c0411785a27a937623
Created January 26, 2015 22:18
Timber + Gravity Forms Dynamic Population of Fields
$gravityfunction = new Twig_SimpleFunction('displaygform', function ($id, $eventName) {
$form = gravity_form($id,false, false, false, array('event_name'=>$eventName));
return $form;
});
$twig->addFunction($gravityfunction);
@brs14ku
brs14ku / gist:237b637661dd88321199
Last active August 29, 2015 14:16
CWEB 136 Assignment 2 Starter Code
function processPayment($paymentAmount){
$amountDue = 82.50;
if($paymentAmount >= $amountDue){
return thankYou($paymentAmount);
}else{
return "Thank you for your payment, you still owe $". number_format(($amountDue- $paymentAmount), 2);
}
}
@brs14ku
brs14ku / gist:743d77fc5750e0188234
Last active August 29, 2015 14:17
Assignment3 Starter Code
//Make a file called utilities.php. This is where you'll place all functions you write
include 'utilities.php';
//replace the information in $profile2 with your own
$profile1 = ["firstName" => "Brent", "middleName" =>"Ryan", "lastName" => "Schultz", "birthYear" => "1985", "age" => 29];
$profile2 = ["firstName" => "", "middleName" =>"", "lastName" => "", "birthYear" => ""];
//Write the functions you'll need into your utilities.php file. checkForAge(), getYearsToRetirement() and compareAge()
$profile1 = checkForAge($profile1);
@brs14ku
brs14ku / gist:436cc39e4b2a1885b2c5
Last active October 3, 2015 16:45
Class 2 Homework
<?php
//Use the following arrays for this homework problem
$classes = array(
'WEB128' => array(
'name' => 'php & mysql',
'instructor' => 'Brent Schultz',
'class_days' => 'R'
),
'WEB150' => array(
@brs14ku
brs14ku / gist:f63f1c440b9e81d2a8ba
Last active October 25, 2015 17:17
Scrape images preprod
wp migrate-abacus scrape_media_content --post_type=pehub-vc-journal --chunk=7000
wp migrate-abacus scrape_media_content --post_type=pehub-buyouts --chunk=5000
wp migrate-abacus scrape_media_content --post_type=pehub-buyouts --chunk=5000 --offset=5000
wp migrate-abacus scrape_media_content --post_type=pehub-buyouts --chunk=5000 --offset=10000
wp migrate-abacus scrape_media_content --post_type=pehub-buyouts --chunk=5000 --offset=15000
wp migrate-abacus scrape_media_content --post_type=pehub-buyouts --chunk=5000 --offset=20000
wp migrate-abacus scrape_media_content --post_type=pehub-buyouts --chunk=5000 --offset=25000
wp migrate-abacus scrape_media_content --post_type=pehub-buyouts --chunk=5000 --offset=30000
wp migrate-abacus scrape_media_content --post_type=pehub-buyouts --chunk=5000 --offset=35000
wp migrate-abacus scrape_media_content --post_type=pehub-digital-edition --chunk=150
@brs14ku
brs14ku / gist:77a2fb453b47ae65c248
Last active January 29, 2016 16:02
session and GET
if ( ( isset( $_GET['utm_medium'] ) && $_GET['utm_medium'] == 'pc' ) || ( isset( $_SESSION['utm_medium'] ) && $_SESSION['utm_medium'] == 'pc' ) {
$my_div = '<div class="A">THIS IS A</div>';
} else {
$my_div = '<div class="B">THIS IS B</div>';
}
echo $my_div;
@brs14ku
brs14ku / web128sp16class2
Last active March 10, 2016 22:26
Web 128 Class 2 Spring 2016
<form>
First name:<br>
<input type="text" name="firstname"><br>
Last name:<br>
<input type="text" name="lastname">
<input type="radio" name="gender" value="male" checked> Male<br>
<input type="radio" name="gender" value="female"> Female<br>
<input type="radio" name="gender" value="other"> Other
<input type="submit" value="Submit">
</form>
@brs14ku
brs14ku / batcache-variant.php
Created May 16, 2016 21:26
mobile detect batcache variant
function mysite_is_mobile()
{
$isMobile = preg_match("#(ipod|iphone|android|opera mini|blackberry|pre/|palm os|palm|hiptop|avantgo|plucker|xiino|blazer|elaine|iris|3g_t|windows ce|opera mobi|windows ce; smartphone;|windows ce; iemobile)#i", $_SERVER['HTTP_USER_AGENT'] );
return $isMobile == 1 ? true : false;
}
$batcache->unique['mobile'] = mysite_is_mobile();
@brs14ku
brs14ku / srcset.html
Created October 4, 2016 18:56
ykc img src set
<img src="http://yeahkc.dev/wp-content/uploads/2016/09/517fde84-e2f5-36ae-af1e-c91daaa1ebc4-150x150.jpg" srcset="http://yeahkc.dev/wp-content/uploads/2016/09/517fde84-e2f5-36ae-af1e-c91daaa1ebc4-300x200.jpg 300w, http://yeahkc.dev/wp-content/uploads/2016/09/517fde84-e2f5-36ae-af1e-c91daaa1ebc4-768x512.jpg 768w, http://yeahkc.dev/wp-content/uploads/2016/09/517fde84-e2f5-36ae-af1e-c91daaa1ebc4-1024x682.jpg 1024w, http://yeahkc.dev/wp-content/uploads/2016/09/517fde84-e2f5-36ae-af1e-c91daaa1ebc4-465x310.jpg 465w, http://yeahkc.dev/wp-content/uploads/2016/09/517fde84-e2f5-36ae-af1e-c91daaa1ebc4-670x446.jpg 670w, http://yeahkc.dev/wp-content/uploads/2016/09/517fde84-e2f5-36ae-af1e-c91daaa1ebc4-230x153.jpg 230w, http://yeahkc.dev/wp-content/uploads/2016/09/517fde84-e2f5-36ae-af1e-c91daaa1ebc4-440x293.jpg 440w, http://yeahkc.dev/wp-content/uploads/2016/09/517fde84-e2f5-36ae-af1e-c91daaa1ebc4-145x97.jpg 145w, http://yeahkc.dev/wp-content/uploads/2016/09/517fde84-e2f5-36ae-af1e-c91daaa1ebc4-350x233.jpg 350w, http://yea