Skip to content

Instantly share code, notes, and snippets.

View tamouse's full-sized avatar
🏠
Retired from Work

Tamara Temple tamouse

🏠
Retired from Work
View GitHub Profile
@tamouse
tamouse / swaac.md
Created January 6, 2013 16:54
initial thoughts on creating a software as a craft website

% Software as a Craft Website % Tamara Temple tamara@tamaratemple.com % 2013-01-06

Introduction

I have been thinking about software as a craft for some months now. Having gotten a new job working as a quality assurance cum process architect since October, and being surrounded by really cool software devs of varying experience, talent, and skills, I am thinking about how can one acheive the mindset of a master craftsperson in the realm of software development?

@tamouse
tamouse / validate_page.js
Created January 14, 2013 06:39
validate page bookmarklet
javascript:var%20l=encodeURIComponent(location.href.replace(/^http:\/\//,%20""));window.open("http://validator.w3.org/unicorn/check?ucn_uri="+l+"&ucn_task=conformance#","_blank");
@tamouse
tamouse / munge_data.rb
Last active January 19, 2016 15:29
Pull in US Economic data from IMF database, pull out some columns and save as tab-delimited file. Updating to clarify the extraction algo and adding the write data algo.
require 'csv'
module MungeData
# Open a tab-delimited data file converting it into a CSV structure,
# expecting the first row to be headers,
# passing the table to map each row of the table,
# converting each row to a hash and then selecting only
# those items in the array that match the characteristics in the block
def self.extract_years(censusdata, y_start, y_end)
@tamouse
tamouse / mulitple_select.php
Created February 19, 2013 02:36
PHP snippet to show how to handle multiple select, maintaining select options.
<?php
// Initial value for demo
$DPRpriority = array(array('name' => "Crimes Against Persons", 'selected' => false),
array('name' => "Disturbances", 'selected' => false),
array('name' => "Assistance / Medical", 'selected' => false),
array('name' => "Crimes Against Property", 'selected' => false),
array('name' => "Accidents / Traffic Problems", 'selected' => false),
array('name' => "Suspicious Circumstances", 'selected' => false),
array('name' => "Morality / Drugs", 'selected' => false),
@tamouse
tamouse / compare_multiple.php
Created February 21, 2013 06:36
compare multiple select using an array [] as the select name and a scalar as the select name. The first returns the multiple values chosen. the latter only returns one of the values selected.
<h1>Test what gets returned from &lt;select multiple&gt; when using array and scalar</h1>
<?php
if (count($_POST)>0) {
echo "<h2>POST</h2><pre><code>\n";
var_dump($_POST);
echo "</code></pre>\n";
}
?>
<form method="POST">
@tamouse
tamouse / dbcred_form.php
Created April 21, 2013 15:36
Response to '[PHP] mysql_connect noob question' on php-general@lists.php.net
<?php
error_reporting(-1);
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
echo '<h1>$_POST:</h1>'.PHP_EOL;
echo '<pre><code>'.PHP_EOL;
echo htmlspecialchars(print_r($_POST,true));
echo '</code></pre>'.PHP_EOL;
@tamouse
tamouse / Numify.rb
Created April 24, 2013 03:17
Numify - convert long words to short equivalents
=begin rdoc
= NUMFIY.RB
*Author*:: Tamara Temple <tamara@tamaratemple.com>
*Since*:: 2013-04-23
*Copyright*:: (c) 2013 Tamara Temple Web Development
*License*:: MIT
== Description
@tamouse
tamouse / myrds.rb
Created May 2, 2013 16:33
Problem with making a double work
=begin
= myrds.rb
*Copyright*:: (C) 2013 by Novu, LLC
*Author(s)*:: Tamara Temple <tamara.temple@novu.com>
*Since*:: 2013-05-01
*License*:: GPLv3
*Version*:: 0.0.1
@tamouse
tamouse / kaprekar.rb
Last active December 17, 2015 22:29
Kaprekar Numbers
=begin rdoc
= KAPREKAR.RB
*Author*:: Tamara Temple <tamara@tamaratemple.com>
*Since*:: 2013-05-30
*Copyright*:: (c) 2013 Tamara Temple Web Development
*License*:: MIT
A kaprekar number satisfies the following condition:
@tamouse
tamouse / recursion.rb
Created June 6, 2013 02:31
a couple of simple recursion examples
def fibonacci(n,l=0)
raise "#{n} is not a non-negative Integer" unless (n.is_a?(Integer) && n >= 0)
STDERR.puts "Debug: level #{l}:\tn=#{n}" if $debug
return n if n <= 1
(fibonacci(n-1,l+1)+fibonacci(n-2,l+1)).tap{|t| STDERR.puts "Debug: Current calculation: #{t}" if $debug}
end
def factorial(n,l=0)