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 / calendar.html
Created May 31, 2013 10:42
Responsive calendar which switches between a grid and list.
<!DOCTYPE html>
<html>
<head>
<title>Calendar Multires Demo</title>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0" />
<style type="text/css">
body {
font-family: Arial;
@will-in-wi
will-in-wi / jquery-oas.js
Created June 10, 2013 19:40
An attempt to create a jquery plugin for async OAS usage. Unused.
(function($){
// Properties is an object with the following keys:
// listpos (required) A comma delimited list (no spaces) of the used positions on this page.
// sitepage (optional) The page to be sent for the ad server. Defaults to the current page.
//
// Position is defined by the data-oas-pos attribute. The ad will be inserted inside.
$.fn.oas = function(properties) {
// Set default properties and fail on required properties.
if (typeof(properties.sitepage) === 'undefined') {
@will-in-wi
will-in-wi / serialization-test-case.php
Created December 13, 2013 21:29
Test case for PHP serialization bug
<?php
class HelloWorld implements Serializable {
public $test;
public function __construct($str)
{
$this->test = $str;
}
@will-in-wi
will-in-wi / soundmanager-position.html
Created January 21, 2014 16:00
A test for starting at the right position on initial playback.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test time to duration</title>
<meta name="viewport" content="width=device-width, user-scalable=no" />
<script src="script/soundmanager2.js"></script>
@will-in-wi
will-in-wi / dungeon.rb
Last active August 29, 2015 13:59
Demonstration of rails bug
class Dungeon < ActiveRecord::Base
has_many :wizards, through: :dungeon_wizard
has_many :dungeon_wizard
end
@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
@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
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|
require "capistrano/setup"
require "capistrano/deploy"

Keybase proof

I hereby claim:

  • I am will-in-wi on github.
  • I am willinwi (https://keybase.io/willinwi) on keybase.
  • I have a public key ASDmHXlBeEB7URpkGmjRNdy8dTtc6dV3SV4Evr20jmosugo

To claim this, I am signing this object: