Skip to content

Instantly share code, notes, and snippets.

View jasonsperske's full-sized avatar

Jason Sperske jasonsperske

View GitHub Profile
@jasonsperske
jasonsperske / Wave_Writer.cpp
Last active August 29, 2015 14:01
Small utility that generates a clean set of WAV files from any supported format of game-music-emu
// Game_Music_Emu 0.6.0. http://www.slack.net/~ant/
#include "Wave_Writer.h"
#include <assert.h>
#include <stdlib.h>
/* Copyright (C) 2003-2006 by Shay Green. Permission is hereby granted, free
of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without
@jasonsperske
jasonsperske / highlight.html
Created May 15, 2014 00:29
Basic System to highlight keywords in a textarea (http://jsfiddle.net/KcP7m/)
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<title>Textarea Highlighter</title>
<script src="//code.jquery.com/jquery-1.11.0.js" type="text/javascript"></script>
<style type="text/css">
#Status, #Highlighter {
width: 96%;
height: 250px;
font-family: Helvetica, Arial, 'lucida grande', tahoma, verdana, arial, sans-serif;
@jasonsperske
jasonsperske / car_cdr.playground
Last active August 29, 2015 14:02
Getting aquainted with a new langauge. Really wish there was a splatter operator.
func car<T>(l: Array<T>?) -> T? {
if l == nil || l!.count <= 0 {
return nil
} else {
return l![0]
}
}
func cdr<T>(l: Array<T>?) -> Array<T>? {
if l == nil || l!.count <= 1 {
@jasonsperske
jasonsperske / so.scheme
Created August 19, 2014 20:46
Nested for loops in scheme
(define (SO x y)
(let* ((x! (car x)) (y! (car y)))
(while (< x! (car (cdr x)))
(set! y! (car y))
(while (< y! (car (cdr y)))
(print (string-append (number->string x!) "-" (number->string y!)))
(set! y! (+ y! 1))
)
(set! x! (+ x! 1))
)

Keybase proof

I hereby claim:

  • I am jasonsperske on github.
  • I am sperske (https://keybase.io/sperske) on keybase.
  • I have a public key whose fingerprint is E40C A8A8 8284 94A9 823C 951D 7865 73E7 33D8 50FA

To claim this, I am signing this object:

var page = require('webpage').create();
page.open('http://github.com/', function() {
page.render('github.png');
phantom.exit();
});
@jasonsperske
jasonsperske / CompressionFilter.java
Last active August 29, 2015 14:16
A flexible compression filter for Tomcat web apps created by http://stackoverflow.com/a/11068672/16959
public class CompressionFilter implements Filter {
public void destroy() {}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
HttpServletResponse httpResponse = (HttpServletResponse) response;
String acceptEncoding = httpRequest.getHeader(HttpHeaders.ACCEPT_ENCODING);
if (acceptEncoding != null) {
if (acceptEncoding.indexOf("gzip") >= 0) {
GZIPHttpServletResponseWrapper gzipResponse = new GZIPHttpServletResponseWrapper(httpResponse);
@jasonsperske
jasonsperske / wizard.html
Created April 24, 2015 18:19
A Bootstrap styled wizard
<!-- example from http://getfuelux.com/javascript.html#wizard -->
<link href="//www.fuelcdn.com/fuelux/3.6.3/css/fuelux.min.css" rel="stylesheet">
<script src="//www.fuelcdn.com/fuelux/3.6.3/js/fuelux.min.js"></script>
<div class="wizard" data-initialize="wizard" id="myWizard">
<ul class="steps">
<li data-step="1" data-name="campaign" class="active"><span class="badge">1</span>Campaign<span class="chevron"></span></li>
<li data-step="2"><span class="badge">2</span>Recipients<span class="chevron"></span></li>
<li data-step="3" data-name="template"><span class="badge">3</span>Template<span class="chevron"></span></li>
</ul>
<div class="actions">
From http://sndtst.com/Doom
You will find these meta tags:
<meta property='sndtst:title' content='Doom'/>
<meta property='sndtst:platform' content='PC'/>
<meta property='sndtst:composed_by' content='Bobby Prince' role='Composer/Arranger'/>
background: linear-gradient(223deg, #00ffbd, #7d00ff, #ef583a);
background-size: 600% 600%;
-webkit-animation: Channel 42s ease infinite;
-moz-animation: Channel 42s ease infinite;
-o-animation: Channel 42s ease infinite;
animation: Channel 42s ease infinite;
@-webkit-keyframes Channel {
    0%{background-position:81% 0%}
    50%{background-position:20% 100%}
    100%{background-position:81% 0%}