Skip to content

Instantly share code, notes, and snippets.

View will-in-wi's full-sized avatar

William Johnston will-in-wi

View GitHub Profile
@will-in-wi
will-in-wi / circle.js
Created January 12, 2013 16:59
ScriptCraft Circle Plugin
// Circle
function rasterCircle(radius, height, material) {
var f = 1 - radius;
var ddF_x = 1;
var ddF_y = -2 * radius;
var x = 0;
var y = radius;
fwd(radius).box(material,1,height,1);
fwd(0-radius).box(material,1,height,1);
@will-in-wi
will-in-wi / gist:4355041
Created December 21, 2012 19:09
Example for streaming audio issue.
<!doctype html>
<html>
<head>
<title>This is an audio tag test.</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="soundmanager/script/soundmanager2.js"></script>
<script>
$(function(){
soundManager.setup({
@will-in-wi
will-in-wi / gist:4251908
Created December 10, 2012 17:13
Soundmanager Test Results
<table>
<tr>
<td> </td>
<td> Pure JS - Different vars </td>
<td> Pure JS - Same var </td>
<td> SM2 - Same var </td>
<td> SM2 - Different vars </td>
<td> SM2 - Same ID </td>
</tr>
<tr>
@will-in-wi
will-in-wi / gist:4251919
Created December 10, 2012 17:14
Soundmanager Test
<!doctype html>
<html>
<head>
<title>This is an audio tag test.</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<style>
.button {
display: block;
padding: 10px;
border: 1px solid gray;
@will-in-wi
will-in-wi / gist:4120767
Created November 20, 2012 20:19
Kindle Fire HTML5 Audio Streaming Bug Test Case
<!doctype html>
<html>
<head>
<title>Audio Streaming test</title>
</head>
<body>
<div>
<p>
Test page for Kindle Fire Audio Streaming. Using 89.3 The Current as an example.
</p>
@will-in-wi
will-in-wi / gist:3841181
Created October 5, 2012 17:31
ffmpeg error for homebrew
CC libavdevice/alldevices.o
CC libavdevice/avdevice.o
CC libavdevice/lavfi.o
CC libavfilter/af_aconvert.o
CC libavfilter/af_aformat.o
CC libavfilter/af_amerge.o
CC libavfilter/af_amix.o
CC libavfilter/af_anull.o
brew: superenv removed: -I./ -g -Wdeclaration-after-statement -Wall -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wwrite-strings -Wtype-limits -Wundef -Wmissing-prototypes -Wno-pointer-to-int-cast -Wstrict-prototypes -O3
brew: superenv removed: -I./ -g -Wdeclaration-after-statement -Wall -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wwrite-strings -Wtype-limits -Wundef -Wmissing-prototypes -Wno-pointer-to-int-cast -Wstrict-prototypes -O3
@will-in-wi
will-in-wi / gist:3668580
Created September 7, 2012 18:54
Test for iTunes Album Art Sizes
<?php
$starting_links = array('http://a5.mzstatic.com/us/r1000/107/Music/v4/3a/1c/4b/3a1c4bff-7b99-2162-3036-54157c6924e6/0818610010094_1200x1200_300dpi.100x100-75.jpg',);
$timeout = 1; // In seconds
foreach ($starting_links as $link) {
$curr_size = 25;
while ($curr_size < 2000) {
$result = get_headers(str_replace('100x100', $curr_size . 'x' . $curr_size, $link));
if ($result[0] === 'HTTP/1.0 404 Not Found') {
require 'pry'
# A linear algebra matrix row.
class Row
def initialize(arr)
@arr = arr.map(&:to_r)
end
def map_with_index
arr = @arr.map.with_index do |val, i|
@will-in-wi
will-in-wi / output
Created April 14, 2014 22:22
Output from console for Rails bug
(0.1ms) begin transaction
SQL (0.6ms) INSERT INTO "wizards" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-04-14 22:18:36.904177"], ["name", "Merlin"], ["updated_at", "2014-04-14 22:18:36.904177"]]
SQL (0.2ms) INSERT INTO "dungeon_wizards" ("created_at", "dungeon_id", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-04-14 22:18:36.906145"], ["dungeon_id", 2], ["updated_at", "2014-04-14 22:18:36.906145"]]
SQL (0.2ms) UPDATE "dungeon_wizards" SET "updated_at" = ?, "wizard_id" = ? WHERE "dungeon_wizards"."id" = 1 [["updated_at", "2014-04-14 22:18:36.907402"], ["wizard_id", 1]]
(1.3ms) commit transaction
@will-in-wi
will-in-wi / commands.rb
Created April 14, 2014 22:22
Commands to expose Rails bug
d = Dungeon.create name: 'The Pit of Dispair'
w = Wizard.new name: 'Merlin'
w.dungeons << d
w.save