Skip to content

Instantly share code, notes, and snippets.

View johnbocook's full-sized avatar
💯
I come here for the dark theme.

John Bocook johnbocook

💯
I come here for the dark theme.
View GitHub Profile
@johnbocook
johnbocook / Bash S3 Upload.sh
Last active December 10, 2018 04:56
AWS S3 Upload
S3KEY="my aws key"
S3SECRET="my aws secret"
function uploadS3
{
path=$1
file=$2
aws_path=$3
bucket='aws-bucket-name'
date=$(date +"%a, %d %b %Y %T %z")
@johnbocook
johnbocook / missing_images.js
Last active January 16, 2018 03:53
Use jQuery to deal with missing images
// Hide the image on error
$("img").error(function(){
$(this).hide();
});
// Change the missing image to a default image
$('img').error(function(){
$(this).attr('src', 'no-image.jpg');
});
@johnbocook
johnbocook / DateFormatter.js
Last active September 28, 2017 07:07
Display's the current date in this format: Friday, June 11, 2015.
<script language="JavaScript">
var now = new Date();
var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
function fourdigits(number) {
return (number < 1000) ? number + 1900 : number;
}
@johnbocook
johnbocook / js-date-compare.js
Created July 17, 2017 12:21
Javascript Date Compare
var myDate = '05/05/2019';
var today = new Date();
function process(date) {
var parts = date.split("/");
return new Date(parts[2], parts[1] - 1, parts[0]);
}
if (process(myDate) <= today) {
@johnbocook
johnbocook / isLocal.js
Created August 28, 2017 19:37
Javascript, check if localhost
var isLocal = location.host.includes('localhost');
@johnbocook
johnbocook / Add WWW
Last active September 28, 2017 07:04
htaccess stuff
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
@johnbocook
johnbocook / SonisSlack.cfm
Created September 28, 2017 06:53
Proof of concept - interacting with our SIS via slack channels. Includes authentication check based on channel access.
<cfoutput>
<cfif #StructKeyExists(FORM, "token")#>
<cfif #FORM.token# NEQ '##############'>
Sorry, Authentication Failed
<cfelse>
<cfif #FORM.channel_id# NEQ "############">
What are you doing?!?!!?? This channel is not authenticated - stop trying to break stuff.
<cfelse>
<cfif #FORM.text# EQ "restart">
@#FORM.user_name# - Sonis is restarting
@johnbocook
johnbocook / LunchBot.cfm
Created September 28, 2017 06:50
LunchBot is a little slack integration that randomly chooses where to have lunch.
<cfoutput>
<cfif #StructKeyExists(FORM, "token")#>
<cfif #FORM.token# NEQ '#PUBLICKEY##'>
Sorry, Authentication Failed
<cfelse>
<cfset resturants = "BW3, Roosters, Wendys, Gibbys, Tuscan Table, El Palmor, Goodwins Family
Resturant, Cardo's Pizza, Zanzy's Pizza, High Court Cafe, Arby's, Grand Buffett, McDonalds, KFC, Richie's New York Corner Deli, ">
<cfset objRandomReport=ArrayNew(1)>
@johnbocook
johnbocook / blazerPadding.css
Created September 28, 2017 06:20
Padding styles used in blazer framework.
/* Padding and Margins */
/* 0 */
.padding-top-0 {
padding-top: 0px;
}
.padding-bottom-0 {
padding-bottom: 0px;
}
.padding-left-0 {
@johnbocook
johnbocook / Tool List
Created September 28, 2017 05:51
OSX Tools
Homebrew
https://brew.sh/
Oh-My-Zsh
https://github.com/robbyrussell/oh-my-zsh/
Lepton
http://hackjutsu.com/Lepton/
iTerm2 version 3