Skip to content

Instantly share code, notes, and snippets.

💜
GitHub seems like the wrong place to put a status?

Cassie Jones porglezomp

💜
GitHub seems like the wrong place to put a status?
Block or report user

Report or block porglezomp

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@porglezomp
porglezomp / FloatShiftBlend.swift
Created Aug 8, 2019
What does Int << Float mean? :3
View FloatShiftBlend.swift
extension Int {
subscript(bit bit: Int) -> Int {
guard (0..<Int.bitWidth).contains(bit) else { return 0 }
return (self >> bit) & 1
}
subscript(bit bit: Float) -> Float {
var whole = bit
whole.round(.down)
let fract = bit - whole
return Float(self[bit: Int(whole)]) * (1 - fract)
@porglezomp
porglezomp / Denotation.swift
Created Jun 7, 2019
Swift has MixFix operators, right?
View Denotation.swift
// Colin Barrett - @cbarrett
// turning a big dial taht says "Mixfix operators like Agda" on it
// and constantly looking back at the audience for approval
// like a contestant on the price is right
// https://twitter.com/cbarrett/status/1137113289593413633
// Here define a mixfix interpreter operator spelled: _ ⊢ ⟦_⟧
prefix operator
postfix operator
@porglezomp
porglezomp / CompareChain.swift
Created Jun 7, 2019
Let's do horrible crimes with overloads, in order to get Python-style comparison chaining!
View CompareChain.swift
infix operator <: ChainComparison
infix operator >: ChainComparison
infix operator ==: ChainComparison
infix operator !=: ChainComparison
infix operator <=: ChainComparison
infix operator >=: ChainComparison
precedencegroup ChainComparison {
associativity: left
}
@porglezomp
porglezomp / ShitLetsBeSmalltalk.swift
Last active May 25, 2019
Where we're going we don't need primitive control flow!
View ShitLetsBeSmalltalk.swift
/// Like a smalltalk bool, but worse. Just used for control flow, we can use real boolean ops.
class ChitChatBool {
func ifTrue<T>(block: () -> T) -> T? { return nil }
}
class True: ChitChatBool {
override func ifTrue<T>(block: () -> T) -> T? { return block() }
}
class False: ChitChatBool { }
View joke.md

Making the same joke, over and over.

  • lattice minimum/maximum elements
  • function domains
  • secondary headings/titles
  • html subscripts
  • nintendo's newest console
  • nontermination
  • FRC 2018 field elements
  • compiler control flow graph analysis
@porglezomp
porglezomp / homestuck.dot
Last active Mar 19, 2019
Homestuck shipping diagram
View homestuck.dot
// neato -Tpng homestuck.dot > homestuck.png
digraph Shipping {
rankdir=LR;
sep="0.5";
overlap=scalexy;
//splines=true;
layout=neato;
subgraph {
edge [dir=none];
Rose -> Kanaya [label=""];
View Tuesday.idr
import Data.Fin
%language TypeProviders
%dynamic "./time.so"
%default total
epoch_seconds : IO Int
epoch_seconds = foreign FFI_C "epoch_seconds" (IO Int)
getTime : IO (Provider Int)
@porglezomp
porglezomp / twitter-alt-to-title.js
Last active Feb 10, 2019
Copy the alt text in tweets into the title text, so that you can see it on hover.
View twitter-alt-to-title.js
// ==UserScript==
// @name Twitter Alt-Text to Title-Text
// @description Copy the alt attribute of twitter images into the title attribute, so that I can see the alt text on hover.
// @version 1
// @grant none
// @include https://twitter.com/*
// ==/UserScript==
const SELECTORS = `.tweet .AdaptiveMedia-photoContainer img
, .Gallery-media img
@porglezomp
porglezomp / meta.lua
Created Feb 2, 2019
Metatable on Metatables
View meta.lua
local x = { value = 42 }
local index = {
__index = function(t, k)
print(k)
if k == "__add" then
return function(l, r)
return { value = l.value + r.value }
end
end
end
View 00-README.md

Goto

These scripts goto and label let you handle jumping around to directories that you want to get to frequently, without having to figure out the path relative to where you are currently. To create a location, go to the directory you care about, then type label <name>. After you've done that, you're able to type goto <name> at any time to jump directly to that location.

Installation

To install on fish, copy the fish scripts into the locations listed at the top of them. To install on bash/sh/etc., copy the goto-label.sh into the end of your .profile, .bash_profile, or whatever else you have your config code in.

You can’t perform that action at this time.