Skip to content

Instantly share code, notes, and snippets.

View tsraveling's full-sized avatar

Tim Raveling tsraveling

View GitHub Profile
@tsraveling
tsraveling / DataTypes.md
Last active April 23, 2020 19:39
PostgresQL Data Types

Original here

Name	Aliases	Description
bigint	int8	signed eight-byte integer
bigserial		serial8	autoincrementing eight-byte integer
bit [ (n) ]	 	fixed-length bit string
bit varying ... variable-length bit string (... = [ (n) ]	varbit [ (n) ])
boolean	bool	logical Boolean (true/false)
@tsraveling
tsraveling / challenge.swift
Last active April 24, 2019 19:48
Codility Playground import
import UIKit
// Put the Codility test question in here
public func solution(_ A : inout [Int]) -> Int {
// write your code in Swift 4.2.1 (Linux)
// Answer return
return 1
}
@tsraveling
tsraveling / example.js
Created March 15, 2019 17:58
Catch all other URLs and 404s #express
//Other routes here
app.get('*', function(req, res){
res.send('Sorry, this is an invalid URL.');
});
@tsraveling
tsraveling / InvocationClass.cs
Last active December 14, 2018 21:44
Add invocation to the inspector #unity
public class InvocationClass : MonoBehavior {
public UnityEventGameObject OnClick;
void someMethod() {
OnClick.Invoke(this.gameObject);
}
}
@tsraveling
tsraveling / ModLoop.cs
Created December 14, 2018 21:34
HowTo: Loop from 0 to 1 Using Float Increments #math
float interval = 1.0f;
totalTime += Time.delta;
float val = (totalTime / interval) % 1f;
@tsraveling
tsraveling / ExampleManager.cs
Created December 13, 2018 20:43
GameObject Manager Pattern #unity
{
...
public static ExampleManager getManager()
{
GameObject ret = GameObject.Find("ExampleManager");
return ret.GetComponent<ExampleManager>();
}
}
@tsraveling
tsraveling / States.swift
Created September 14, 2017 18:27
State Arrays and Dictionaries
var states = ["Alabama",
"Alaska",
"Arizona",
"Arkansas",
"California",
"Colorado",
"Connecticut",
"Delaware",
"Florida",
"Georgia",
@tsraveling
tsraveling / Date+Styling.swift
Created September 9, 2017 22:03
Date Formatter
let globalDateFormatter : DateFormatter = {
let df = DateFormatter()
df.dateFormat = "MMMM d, yyyy"
return df
}()
extension Date {
static func fromString(_ source : String) -> Date? {
let string_id = UUID().uuidString
import UIKit
import MessageUI
extension UIViewController : MFMailComposeViewControllerDelegate, MFMessageComposeViewControllerDelegate, UINavigationControllerDelegate {
func sendEmail(_ to: [String], defaultSubject: String, defaultBody: String, _ completion : ((_ result: MFMailComposeResult) -> Void)? = nil) {
if MFMailComposeViewController.canSendMail() {
let mail = MFMailComposeViewController()
mail.mailComposeDelegate = self
mail.setToRecipients(to)