Skip to content

Instantly share code, notes, and snippets.

View mclaughj's full-sized avatar

Joseph McLaughlin mclaughj

View GitHub Profile
{
"config_version": 0,
"min_enabled_build": 0,
"min_supported_build": 0,
"latest_prod_build": 0,
"urls":{
"layserbeam":"https://layserbeam-cached.8bleacherreport.com/",
"api": "https://api.8bleacherreport.com/api/",
"push": "https://push.8bleacherreport.com/",
"data_turner": "https://data.t.8bleacherreport.com/",
@mclaughj
mclaughj / AppDelegate.swift
Created May 30, 2017 17:46
Mimicking the Things.app 3.0 status bar tinting
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var overlayWindow = UIWindow()
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
@mclaughj
mclaughj / impossible-bugs.swift
Last active September 1, 2016 15:30
Example from @cocoaphony at try! Swift NYC (Sep. 1, 2016)
struct Token {
var value: String
}
struct Credential {
var username: String
var password: String
}
enum Result<Value> {
{"success": 1, "results": [{"Skus": [{"PskuId": "1", "Price": "170.00", "Upc": "8053672000481", "Scene7ImageId": "luxottica_raybansun_0RB3025_yellow", "SearchColors": ["Blue"], "BuyNowURL": "http://www.ray-ban.com/usa/sunglasses/virtual-try-on/8053672000481", "TempleColorName": "Gold", "FrontColorName": "Gold", "LensColorName": "Blue Flash", "StandardInStock": "4090", "IsVTOCapable": "1", "StyleSortOrder": "3", "StyleMemberSortOrder": "1", "ManifestPath": "Ray-Ban~AviatorLargeRB3025-HASH-0/8053672000481", "GlassesUPC": "8053672000481", "SKU": "0RB3025 58 112/17", "LensTech": null, "LensOption": null, "TempleWidth": "135", "BridgeWidth": "14", "LensWidth": "58", "LensHeight": null, "FrameFit": null, "SpringHinge": null, "SearchMaterials": ["Metal"], "MaterialName": "Metal"}, {"PskuId": "2", "Price": "170.00", "Upc": "8053672000511", "Scene7ImageId": "luxottica_raybansun_0RB3025_grey", "SearchColors": ["Yellow", "Yellow"], "BuyNowURL": "http://www.ray-ban.com/usa/sunglasses/virtual-try-on/8053672000511", "Templ
{"success": 1, "results": [{"Skus":[{"PskuId":"1", "Price":"170.00", "Upc":"8053672000481", "Scene7ImageId":"luxottica_raybansun_0RB3025_yellow}", "SearchColors":["Blue"], "BuyNowURL":"http://www.ray-ban.com/usa/sunglasses/virtual-try-on/8053672000481", "TempleColorName":"Gold", "FrontColorName":"Gold", "LensColorName":"Blue Flash", "StandardInStock":"4090", "IsVTOCapable":"1", "StyleSortOrder":"3", "StyleMemberSortOrder":"1", "ManifestPath":"Ray-Ban~AviatorLargeRB3025-HASH-0/8053672000481", "GlassesUPC":"8053672000481", "SKU":"0RB3025 58 112/17", "LensTech":null, "LensOption":null, "TempleWidth":"135", "BridgeWidth":"14", "LensWidth":"58", "LensHeight":null, "FrameFit":null, "SpringHinge":null, "SearchMaterials":["Metal"], "MaterialName":"Metal"}, {"PskuId":"2", "Price":"170.00", "Upc":"8053672000511", "Scene7ImageId":"luxottica_raybansun_0RB3025_grey}", "SearchColors":["Yellow", "Yellow"], "BuyNowURL":"http://www.ray-ban.com/usa/sunglasses/virtual-try-on/8053672000511", "TempleColorName":"Gold", "FrontColor
@mclaughj
mclaughj / 0_reuse_code.js
Last active August 29, 2015 14:20
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mclaughj
mclaughj / NCButton.m
Last active August 29, 2015 14:08
A button that looks like it belongs in Notification Center
_myNCButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_myNCButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[_myNCButton setBackgroundColor:[UIColor whiteColor]];
[_myNCButton setTitle:@"My Button Title" forState:UIControlStateNormal];
[_myNCButton.titleLabel setFont:[UIFont systemFontOfSize:13]];
_myNCButton.layer.cornerRadius = 4;
UIVibrancyEffect *vibrancyEffect = [UIVibrancyEffect notificationCenterVibrancyEffect];
_vibrancyEffectView = [[UIVisualEffectView alloc] initWithEffect:vibrancyEffect];
[[_vibrancyEffectView contentView] addSubview:_myNCButton];
@mclaughj
mclaughj / plinko.cpp
Last active December 24, 2015 11:19
A little program I helped a friend write for a C++ intro to programming class he's taking. It's a basic Plinko simulator. I know there are probably better ways to do the same thing, but this was the final evolution of the program that allowed me to teach simple loops, if statements, and functions.
#include <iostream>
int simulatedrop(int slot, int printslots)
{
float location = slot;
for (int i = 0; i < 12; i++) {
int random = rand() % 10;
if (random < 5){
location -= 0.5;
}
@mclaughj
mclaughj / BudgetCalc.c
Last active December 21, 2015 23:38
A simple program to time how long it takes to count by one from 1 to 16,000,000,000,000.
#include <stdio.h>
#include <time.h>
int main(int argc, const char * argv[])
{
time_t now;
time(&now);
printf("%s", ctime(&now));
for (unsigned long i = 1; i < 16000000000000; i++) {
@mclaughj
mclaughj / html5.sublime-snippet
Created May 21, 2013 02:04
HTML5 Sublime Text 2 Snippet (Tools > New Snippet…) Activate in any file by typing `html5` and tabbing.
<snippet>
<content><![CDATA[
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>${1:Your awesome title here...}</title>
<link rel="stylesheet" href="css/style.css">
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>