Skip to content

Instantly share code, notes, and snippets.

View blendmaster's full-sized avatar

Steven Ruppert blendmaster

View GitHub Profile
@blendmaster
blendmaster / Blarg.java
Last active May 3, 2023 23:42
optparse-applicative for java
import java.io.*;
import java.nio.file.*;
import java.util.*;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
@blendmaster
blendmaster / FancyLenses.java
Created December 2, 2015 08:19
van laarhoven lenses in java
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.*;
/**
* Fancy Lenses Like The Ones In Haskell
*/
class FancyLenses {
// You've got yourself some fine immutable JavaBeans™, and you're cool with that.

Keybase proof

I hereby claim:

  • I am blendmaster on github.
  • I am blendmaster (https://keybase.io/blendmaster) on keybase.
  • I have a public key whose fingerprint is 7A45 BF92 A2EF 3975 F965 CB84 D4D3 5CF7 AD8B B97A

To claim this, I am signing this object:

import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.artifacts.Configuration
import org.gradle.api.file.FileTreeElement
import org.gradle.api.internal.file.FileResolver
import org.gradle.api.internal.tasks.DefaultScalaSourceSet
import org.gradle.api.plugins.JavaBasePlugin
import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.api.reporting.ReportingExtension
import org.gradle.api.tasks.ScalaRuntime
@blendmaster
blendmaster / hovergifs.user.js
Created May 23, 2012 21:42
preview /r/gifs on hover, displaying firefox bug
// ==UserScript==
// @id www.reddit.com-0496007c-95e3-4661-b485-846f1932fbbb@scriptish
// @name gif hover preview
// @version 0.1
// @namespace
// @author blendmaster
// @description shows gifs on hover
// @match http://www.reddit.com/r/gifs/*
// ==/UserScript==
// @namespace http://qoln.org/
// @include http://*facebook.com*
// @creator Miles Meloro [milemeloro@yahoo.com], rewritten by anon
// @version 0.11
// @date 2012-04-29
// ==/UserScript==
var inputButton = document.createElement('button');
inputButton.textContent = 'Love It';
inputButton.addEventListener( 'click', function () {
@blendmaster
blendmaster / translator.coffee
Created March 2, 2012 01:37
Dynamically generating functions with Coffeescript
lines = -> Array::join.call arguments, '\n' # joins arguments into a newline separated string
# helper function, generates instructions to put base+index into D
load_from_base = (base) -> (idx) -> lines "@#{base}", "D=M", "@#{idx}", "A=D+A", "D=M"
push_segment = # returns instructions to load value to push into D given index
constant: (idx) -> lines "@#{idx}" 'D=A'
argument: load_from_base 'ARG'
local: load_from_base 'LCL'
this: load_from_base 'THIS'
@blendmaster
blendmaster / gist:1897787
Created February 24, 2012 04:41
.hack assembler main logic in coco
code = input
.replace /\/\/.*/gm '' # remove comments
.trim!
.split /\s+/ # turn into lines
.filter (it, i) -> # build symbol table and remove labels
if it.match /\(([A-Za-z\._$:][\w\.$:]*)\)$/ # that[1] is the first capturing group
symbols[that[1]] = i - len++ # len++ adjusts the symbol's line number to the filtered array
return false
true # keep actual instructions
.map -> # parse instructions
@blendmaster
blendmaster / dabblet.css
Created January 17, 2012 04:43
Floating images left of headings
/**
* Floating images left of headings
*/
body {margin: 50px ; }
div, p, h1, img { outline: 1px dotted; }
div {
overflow: hidden;
margin: 10px 0;
}