Skip to content

Instantly share code, notes, and snippets.

View JUSTINMKAUFMAN's full-sized avatar

Justin Kaufman JUSTINMKAUFMAN

View GitHub Profile
@stopyoukid
stopyoukid / diff2html.sh
Last active March 11, 2024 19:57
Script that takes a git diff and outputs an html file in GitHub style
#!/bin/bash
#
# Convert diff output to colorized HTML.
# (C) Mitch Frazier, 2008-08-27
# http://www.linuxjournal.com/content/convert-diff-output-colorized-html
# Modified by stopyoukid
#
html="<html><head><meta charset=\"utf-8\"><title>Pretty Diff</title><style>body {text-align: center;}#wrapper {display: inline-block;margin-top: 1em;min-width: 800px;text-align: left;}h2 {background: #fafafa;background: -moz-linear-gradient(#fafafa, #eaeaea);background: -webkit-linear-gradient(#fafafa, #eaeaea);-ms-filter: \"progid:DXImageTransform.Microsoft.gradient(startColorstr='#fafafa',endColorstr='#eaeaea')\";border: 1px solid #d8d8d8;border-bottom: 0;color: #555;font: 14px sans-serif;overflow: hidden;padding: 10px 6px;text-shadow: 0 1px 0 white;margin: 0;}.file-diff {border: 1px solid #d8d8d8;margin-bottom: 1em;overflow: auto;padding: 0.5em 0;}.file-diff > div {width: 100%:}pre {margin: 0;font-family: \"Bitstream Vera Sans Mono\", Courier, monospace;font-size: 12px;line-height: 1.4em;text-indent: 0.5em;}.file {color:
@jonasreinsch
jonasreinsch / rounded_polygon_path
Created December 2, 2014 11:39
function to create a UIBezierPath for a (rounded corner) polygon in Swift
// this is a port from the following Objective C code
// http://stackoverflow.com/a/24770675/1269132
func roundedPolygonPath(
#square:CGRect,
#lineWidth:Double,
#sides:NSInteger,
#cornerRadius:Double) -> UIBezierPath {
let path = UIBezierPath()
@venetucci
venetucci / NerdBot
Last active March 29, 2022 22:39
🤓 A Google Apps Script to use with Slack webhooks - allows you to post to a spreadsheet from Slack, and receive a confirmation message in Slack. Full tutorial with Slack integrations: https://medium.com/p/a-bot-to-help-you-read-your-way-through-next-4-years-7ba9d80066fc
function testNewItemPost() {
var request = {
parameters: {
token: "[]",
user_name: "michelle",
text: "add: Rural America; Hillbilly Elegy; J.D. Vance; From a former marine and Yale Law School graduate, a powerful account of growing up in a poor Rust Belt town that offers a broader, probing look at the struggles of America’s white working class; https://www.amazon.com/gp/product/0062300547/ref=pd_bxgy_14_2?ie=UTF8&pd_rd_i=0062300547&pd_rd_r=MG2AV2PZZVEXNYZ1Y84V&pd_rd_w=xCKNl&pd_rd_wg=55Iya&psc=1&refRID=MG2AV2PZZVEXNYZ1Y84V;"
}
};
doPost(request);
}
@TheCodedSelf
TheCodedSelf / RxSwiftChainObservablesExample.swift
Last active June 29, 2018 19:36
RxSwift: An example of causing one observable to rely on the output of another
import RxSwift
func submit(number: Int) {
let validateAndPerformServiceCallIfSuccessful = performValidation(numberThatShouldBeEven: number)
.flatMap { () -> Observable<Void> in
print("Validated successfully")
return performServiceCall() // For any .next events from performValidation, perform the service call
}
// By subscribing, validation is performed and the service call is executed for any .next events from performValidation
@soffes
soffes / Rakefile
Last active January 16, 2023 16:37
Programmatically build and sign a Developer ID macOS app
TEAM_ID = 'XXXXXXXXXX'
APP_NAME = 'My App'
SCHEME_NAME = APP_NAME
desc 'Create a beta build'
task :build do
# Ensure clean git state
unless system 'git diff-index --quiet HEAD --'
abort 'Failed. You have uncommitted changes.'
end
@loucimj
loucimj / Diffable.swift
Last active April 12, 2018 16:38
Diffable workaround for structs with IGListKit
//
// Diffable.swift
//
// Created by danielgalasko on 8/5/17.
//
import Foundation
import IGListKit
@ShinobiWPS
ShinobiWPS / ShinobiWPS-Unity_WebGL_tips.txt
Last active August 29, 2022 16:14
ShinobiWPS - Tips to optimize a WebGL build of a Unity game
http://docs.unity3d.com/Manual/webgl-building.html
http://docs.unity3d.com/Manual/ReducingFilesize.html
https://www.youtube.com/watch?v=gVUgF2ZHveo - AssetBundles
Webgl game size Info:
When we compile a Webgl project,it generates 3 folders along with html file.
Compressed
Release
TemplateData
@cryocaustik
cryocaustik / README.md
Last active October 3, 2023 21:16
JSON Dump of ICD 10 Codes & Desc

CMS ICD GEMs JSON Dump

JSON Dump of ICD 10 Codes & Desc

Data Sample (formatted)

[
    {
      "code": "A000",
@MCJack123
MCJack123 / BeatSaberLevelFormat.md
Last active September 11, 2021 22:47
Beat Saber 1.0 level format conversion
info.json Info.dat
+ _version = "2.0.0"
songName _songName
songSubName _songSubName
authorName _songAuthorName
+ _levelAuthorName = ""
beatsPerMinute _beatsPerMinute
difficultyLevels[].offset _songTimeOffset
Difficulty.json => _shuffle _shuffle
@JUSTINMKAUFMAN
JUSTINMKAUFMAN / CrashViewController.swift
Last active September 2, 2019 18:37
Crash when mutating [UIColor] in a struct on a UIView prior to adding that view as a UIViewController's subview
import UIKit
/**
This code *consistently* crashes when built with
the following Xcode 10.2.1 build settings:
`Swift Version` = `5` (i.e. default)
`Enable Testability` = `NO`
`Optimization Level` = `-Owholemodule`