Skip to content

Instantly share code, notes, and snippets.

View coryetzkorn's full-sized avatar
😴
probably writing code

Cory Etzkorn coryetzkorn

😴
probably writing code
View GitHub Profile
@coryetzkorn
coryetzkorn / hours.php
Last active December 26, 2015 04:39
PHP Store Hours Array
$hours = array(
'mon' => array('11:00-20:30'),
'tue' => array('11:00-16:00', '18:00-20:30'),
'wed' => array('11:00-20:30'),
'thu' => array('11:00-20:30'),
'fri' => array('11:00-20:30'),
'sat' => array('11:00-20:30'),
'sun' => array('11:00-20:30')
);
@coryetzkorn
coryetzkorn / gist:7095476
Created October 22, 2013 05:02
PHP Store Hours - Exceptions
$exceptions = array(
'Christmas' => '10/22',
'New Years Day' => '1/1'
);
@coryetzkorn
coryetzkorn / output.php
Last active December 26, 2015 04:49
PHP Store Hours - HTML Output
$open_now = "<h3>Yes, we're open! Today's hours are %open% until %closed%.</h3>";
$closed_now = "<h3>Sorry, we're closed. Today's hours are %open% until %closed%.";
$closed_all_day = "<h3>Sorry, we're closed on %day%.</h3>";
$exception = "<h3>Sorry, we're closed for %exception%.</h3>";
@coryetzkorn
coryetzkorn / dashbaord.php
Created February 3, 2014 15:51
Embedding Dashboard - PHP
<?php
function generateHash() {
$email = $_SESSION['email'];
$first_name = $_SESSION['firstName'];
$last_name = $_SESSION['lastName'];
$security_group = "default";
$company_key = "cust";
$secret_key = "423d004c716839b4af16ef680cc742f2";
$timestamp = (int)gmdate('U');
$verify = md5($first_name . "|" . $last_name . "|" . $email . "|" . $company_key . "|" . $security_group . "|" . $timestamp . "|" . $secret_key);
@coryetzkorn
coryetzkorn / gist:d537887aa917f1e1dcb0
Created February 2, 2015 18:07
Yahoo Weather API Codes
<yahoo-weather-codes>
<code number="0" description="tornado"/>
<code number="1" description="tropical storm"/>
<code number="2" description="hurricane"/>
<code number="3" description="severe thunderstorms"/>
<code number="4" description="thunderstorms"/>
<code number="5" description="mixed rain and snow"/>
<code number="6" description="mixed rain and sleet"/>
<code number="7" description="mixed snow and sleet"/>
<code number="8" description="freezing drizzle"/>
[
{
"name": "Money Options",
"settings": [
{
"type": "checkbox",
"id": "show_multiple_currencies",
"default": true,
"label": "Show currency selector?"
},
@coryetzkorn
coryetzkorn / gist:0223245750fa12149d10
Created May 1, 2015 19:02
JSON to Wordpress Import
$json = file_get_contents(get_bloginfo('template_directory') . '/posts.json');
$json = json_decode($json);
foreach($json as $post) {
$my_post = array(
'post_title' => $post->title,
'post_date' => date("Y-m-d", strtotime($post->date)),
'post_status' => 'publish',
'post_type' => 'press',
'post_author' => 1
);
dropdb db-name
createdb db-name
pg_restore --verbose --clean --no-acl --no-owner -h localhost -d db-name ~/desktop/db-backup
@coryetzkorn
coryetzkorn / hendrix-profile-query.rb
Created July 24, 2018 15:12
Hendrix Profile Query
@profiles = Profile
.where(visible: true)
.includes(:profile_type)
.joins(:user)
.where(:users => {:state => User.states[:active]})
sort_by = params[:sort] ? params[:sort] : "recently-active"
case sort_by
when "recently-active"
@profiles = @profiles.order('users.last_sign_in_at DESC')
<template>
<p>{{ greeting }} World!</p>
</template>
<script>
module.exports = {
data: function () {
return {
greeting: 'Hello'
}