Skip to content

Instantly share code, notes, and snippets.

View jasonsperske's full-sized avatar

Jason Sperske jasonsperske

View GitHub Profile
@jasonsperske
jasonsperske / README.MD
Last active March 1, 2017 01:00
AWS Status Page with fewer requests.

While waiting for the Amazon AWS Status page to report on the actual status of S3 (US-EAST-1) I saw this tweet (https://twitter.com/awscloud/status/836656664635846656)

The dashboard not changing color is related to S3 issue. See the banner at the top of the dashboard for updates.

After seeing this I started working out a way to generate the page from Gulp with as few HTTP requests as possible and thus as few depeancies as possible. This is that attempt (with some guessees as to their schema for status information). I also took the opporunity to fix some invalid HTML on thier site while retianing as close as possible the look and feel of their original site (though with this approach

@jasonsperske
jasonsperske / example.cpp
Created February 21, 2017 22:10
A simple answer to a quoar question
#include <iostream>
using namespace std;
int main() {
int x;
int y;
while(cin >> x >> y) {
cout << "x:" << x << " y:" << y << "\n";
}
return 0;
@jasonsperske
jasonsperske / index.html
Created January 24, 2017 19:17
BeanStream Dynamic Payform (not working)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<title>Payform Demo</title>
function Parser() {
var int = function(n) {
//keep code readable
return parseInt(n, 10);
};
var def = function(field, source, defaults) {
return source[field] ? source[field] : (defaults ? defaults[field] : undefined);
};
var pad = function(number) {
if (number < 10) {
@jasonsperske
jasonsperske / trim.sh
Created April 20, 2016 21:38
Trim the first 3 characters from all filenames
for f in *; do mv "$f" "${f:3}"; done
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%}
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'/>
@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">
@jasonsperske
jasonsperske / index.html
Last active September 3, 2015 03:54
A barcode book scanner with an export to CSV file
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script src="http://momentjs.com/downloads/moment.min.js"></script>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">
<script>
$(function() {
$('#books').on('click', 'button', function(e) {
e.preventDefault();
@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);