Skip to content

Instantly share code, notes, and snippets.

View chaupt's full-sized avatar

Christopher Haupt chaupt

View GitHub Profile
### Keybase proof
I hereby claim:
* I am chaupt on github.
* I am chaupt_swoogo (https://keybase.io/chaupt_swoogo) on keybase.
* I have a public key ASAFkDURgxYyDcl91TzhM24pnvhS_4gwKnGf7VCI9foKowo
To claim this, I am signing this object:
#
# Ruby For Kids Project 9: Acey Deucy
# Programmed By: Chris Haupt
# A multiplayer card game where you try to guess whether the next
# card will be between two other cards, placing bets on the results
#
require_relative "game"
require_relative "deck"
require_relative "card"
require "minitest/autorun"
# ruby -Ilib:test fetch_values.rb
class Hash
def monkey_fetch_values(*keys)
keys.inject([]) do |a,k|
if self.has_key?(k)
a << self[k]
else
if block_given?
#!/usr/bin/ruby
class Integer
Ones = %w[ zero one two three four five six seven eight nine ]
Teen = %w[ ten eleven twelve thirteen fourteen fifteen
sixteen seventeen eighteen nineteen ]
Tens = %w[ zero ten twenty thirty forty fifty
sixty seventy eighty ninety ]
Mega = %w[ none thousand million billion ]
@chaupt
chaupt / config.rb
Created November 10, 2014 21:47
Hacked config.rb from vagrant-berkshelf to deal with Proc or string attributes for berkshelf_path or client_key
module Berkshelf
module Vagrant
class Config < ::Vagrant.plugin("2", :config)
# @return [String]
# path to the Berksfile to use with Vagrant
attr_reader :berksfile_path
# @return [Boolean]
# disable of use Berks in Vagrant
attr_accessor :enabled
@chaupt
chaupt / maze_test.rb
Created August 19, 2011 02:03
Peter Cooper's Mazes (#5) RubyQuiz from RubyLearning.com
require 'test/unit'
require 'maze'
MAZE1 = %{#####################################
# # # #A # # #
# # # # # # ####### # ### # ####### #
# # # # # # # # #
# ##### # ################# # #######
# # # # # # # # #
##### ##### ### ### # ### # # # # # #
@chaupt
chaupt / sample_intercept_contact_form.html
Created March 16, 2011 23:27
Sample of intercepting a submission to third party site, doing ajax submit to Webvanta first, getting a unique ID
<div id='contact_intro'>
<h1>Contact <span>Us</span></h1>
<p>Please complete the form below and click the Submit button at the bottom.</p>
<p>We&#8217;ll reply as soon as possible.</p>
</div>
<div id='contact_pod_error' class='sysmsg'><w:sysmsg /></div>
<div id='contact_pod_form' class="box-s1">
<form id='contact_form' action='OTHERSITES ACTION URL GOES HERE' method='post' autocomplete='off'>
<p><label>NAME</label>
@chaupt
chaupt / test_webvanta_xml_datafeed.0.7.php
Created January 22, 2011 00:39
A version of the FoxyCart test script as used when testing integrations with Webvanta. See www.foxycart.com for latest version.
<?
/**
* FoxyCart Test XML Generator
*
* @link http://wiki.foxycart.com/integration:misc:test_xml_post
* @version 0.6a
*/
/*
DESCRIPTION: =================================================================
The purpose of this file is to help you set up and debug your FoxyCart XML DataFeed scripts.
@chaupt
chaupt / stickyFloat.js
Created December 4, 2010 21:19
Patched version of stickyFloat.js, a smart sticky floating box jQuery plugin
/*
* stickyfloat - jQuery plugin for verticaly floating anything in a constrained area
*
* Example: jQuery('#menu').stickyfloat({duration: 400});
* parameters:
* duration - the duration of the animation
* startOffset - the amount of scroll offset after it the animations kicks in
* offsetY - the offset from the top when the object is animated
* lockBottom - 'true' by default, set to false if you don't want your floating box to stop at parent's bottom
* $Version: 05.16.2009 r1
@chaupt
chaupt / sacruby_obfuscated_sigs.rb
Created June 21, 2010 04:06
SacRuby Obfuscated Signature Ruby Quiz Solutions
#
# You'll want to snip these out separated into files or command line strings to try them out.
#
# John Miller's Signature
require"net/http";s=" abcdefghijklmnopqrstuvwxyz.@,\n"
v=":6=9<<5BLI18??K3?=0=L;?7CG5<<K3?=NNG50@B5C5>D081=<5D02I0GK0C81;5C@51B5"
puts v.unpack("c*").map{|i| s[i-48].chr}.join; Net::HTTP.get_print \
URI.parse("http://www.gutenberg.org/dirs/etext00/0ws2610.txt")