Skip to content

Instantly share code, notes, and snippets.

View austenstrine's full-sized avatar

Austen L. Strine austenstrine

View GitHub Profile
<?php
class SomeZendeskTicketClass {
public function getAndSendTestData() {
$reallyLongJsonString = "[{\"phone\":\"7202532407\",\"autorespond\":false,\"subject\":\"New Order #S4481058\",\"alert\":false,\"ip\":\"192.168.3.172\",\"message\":\"<link type=\\\"text\\\/css\\\" href=\\\"..\\\/scp\\\/css\\\/bootstrap.css\\\" rel=\\\"stylesheet\\\">\\n<table class=\\\"table table-striped\\\">\\n\\t<tbody>\\n\\t\\t<tr>\\n\\t\\t\\t<td><strong>Website:<\\\/strong> www.craftdirect.com <\\\/td>\\n\\t\\t\\t<td><strong>OrderID:<\\\/strong> CD000016462<\\\/td>\\n\\t\\t\\t<td><strong>Eclipse:<\\\/strong> S4481058<\\\/td>\\n\\t\\t\\t<td><strong>Date:<\\\/strong> 2023-05-26 13:45:32<\\\/td>\\n\\t\\t<\\\/tr>\\n\\t\\t<tr>\\n\\t\\t\\t<td><strong>ORDER DATE:<\\\/strong> <\\\/td>\\n\\t\\t\\t<td><strong>SHIPPING METHOD:<\\\/strong> CDBM<\\\/td>\\n\\t\\t\\t<td><strong>EXT. MERCHANT ID:<\\\/strong><\\\/td>\\n\\t\\t\\t<td><strong>PAYMENT METHOD:<\\\/strong> paypal_express <\\\/td>\\n\\t\\t<\\\/tr>\\n\\t\\t<tr>\\n\\t\\t\\t<td><stro
@austenstrine
austenstrine / synonyms.php
Last active February 10, 2022 19:31
Synonym map for mass import tool
<?php
$synonym_map = [
//CAD
'cad' => 'CAD',
//Clean and Care
'clean and care' => 'Clean and Care',
import Foundation
protocol PropertyLoopable {
func allProperties() -> [String: Any?]
}
extension Optional {
func unwrappedDebugString() -> String {
switch self {
import 'package:json_annotation/json_annotation.dart';
import 'package:gogreen_utility_belt/interface_class/JSONSerializable.dart';
part 'Product.g.dart'; //flutter pub run build_runner build
@JsonSerializable()
class Product extends JSONSerializable {
static final Product example = Product(//comment out on build_runner build
upc: '10000000000',
inventory: 0,
categories: ['Rum'],
@austenstrine
austenstrine / AppManagedDataController.swift
Last active June 25, 2019 01:56
An API for CoreData that allows safe access and mutation of "global" variables.
// AppManagedDataController.swift
// Yah-El
//
// Created by Austen Strine on 5/20/19.
// Copyright © 2019 GoGreen. All rights reserved.
//
import CoreData
import Foundation
import CoreData
class CopyingCodable : Encodable, Decodable, NSCopying
{
func copy(with zone: NSZone? = nil) -> Any
{ //this is like...the ugliest code I've ever written
return try! JSONDecoder().decode(
type(of: self),
from: try! JSONEncoder().encode(self)
import Foundation
infix operator =!& : AssignmentPrecedence
func =!&<T:NSCopying>(lhs: inout T, rhs: T)
{
lhs = rhs.copy(with: nil) as! T
}
@austenstrine
austenstrine / ScopedPrintableStack.swift
Created February 14, 2019 20:06
A stack for gathering function names and printing them in a scope-level conscious fashion
import Foundation
struct ScopedPrintableStack: CustomStringConvertible
{
var items = [String]()
var description: String
{
var tabbedStackString:String = ""
for (index, string) in items.enumerated()
@austenstrine
austenstrine / scoreAverageProgram.cpp
Last active February 10, 2017 21:05
A program to help teachers average grades
//The purpose of the original assignment was to create a program that would
//allow teachers to input three test scores, and get the average of
//those three. I've altered it quite a bit, and the current version includes
//my first attempt at vectors (just taught myself how to use them today.)
//Planning on eventually making the averages be stored/retreivable.
//Also note that I follow the whitespace convention of indenting
//loops and if statements in entirety, and again for the body.
#include <iostream>
//I got a tiny bit further in the book and realized I was
//coding pretty inefficiently in the switch/case area.
//These are the updates I made to that.
//
#include <iostream>
#include <iomanip>
#include <typeinfo>
#include <limits>