Skip to content

Instantly share code, notes, and snippets.

View nickkoskowski's full-sized avatar

Nick Koskowski nickkoskowski

View GitHub Profile
@nickkoskowski
nickkoskowski / new_way.php
Created November 12, 2015 23:26
Alphabetical Tabs
<?php
$user_query = get_users($args = array('orderby' => 'first_name','order' => 'ASC' ));
$i = 0;
foreach ($user_query as $user) {
if (substr($user_query[$i - 1]->first_name, 0, 1) != substr($user->first_name, 0, 1)) {
echo '<span class="lettering">'.substr($user->first_name, 0, 1).'</span>';
}
}
?>
@nickkoskowski
nickkoskowski / test.php
Last active November 12, 2015 23:24
User Sorting By Letter
<?php
//OLD WAY
function array_sort($array, $on, $order=SORT_ASC)
{
$new_array = array();
$sortable_array = array();
if (count($array) > 0) {
@nickkoskowski
nickkoskowski / modal.php
Created September 2, 2015 21:48
Jobs Modal Example
<div class="modal">
<div class="container">
<button class="close" data-dismiss="modal">×</button>
<div class="row">
<div class="text-center">
<h2>Python Engineer</h2>
<hr/>
<p class="description">Senior Python Developer that will participate in all aspects of architecting and developing new innovative applications as well as expanding existing applications code bases. This person will also mentor other developers and have a passionate and entrepreneurial personality to create clean and innovative products that solve business needs.</p>
</div>
</div>
@nickkoskowski
nickkoskowski / tracking-parameters.php
Created August 31, 2015 17:00
For encoding tracking parameters using hitpath.
<?php
function get_c1() {
if (isset($_REQUEST['c1'])) {
$c1 = $_REQUEST['c1'];
return $c1;
}
}
function get_c2() {
@nickkoskowski
nickkoskowski / gist:2fb00a84b2be7f91cb30
Last active August 29, 2015 14:27
Get a random post link from WP database using query
<?php
function get_random_post_link() {
$args = array(
'orderby' => 'rand',
'posts_per_page' => '1',
);
$wp_query = new WP_Query( $args );
if ( $wp_query->have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post();
@nickkoskowski
nickkoskowski / gist:6eb03a89ccb443de603f
Created May 28, 2015 20:35
Static class MailChimp API Wrapper
<?php
static class MailChimp
{
private $api_key;
private $api_endpoint = 'https://<dc>.api.mailchimp.com/2.0';
private $verify_ssl = false;
/**
* Create a new instance