Skip to content

Instantly share code, notes, and snippets.

View oomlaut's full-sized avatar

Paul Gueller oomlaut

  • Milwaukee, WI
View GitHub Profile
@oomlaut
oomlaut / merge.js
Created June 18, 2013 19:37
Modify the Object prototype to allow a passed object argument to be merged in.
// http://stackoverflow.com/questions/171251/how-can-i-merge-properties-of-two-javascript-objects-dynamically
Object.prototype.merge = function(mergeFrom){
var newObj = {};
for (var attrname in this) { newObj[attrname] = this[attrname]; }
for (var attrname in mergeFrom) { newObj[attrname] = mergeFrom[attrname]; }
return newObj;
};
@oomlaut
oomlaut / concat.String.js
Created July 12, 2013 17:47
Extend the String superclass to enable a more OO-elegant way of joining strings.
(function(){
String.prototype.concat = function(argument){
if ( arguments.length > 0 ){
if ( typeof argument === "string" ) {
return this + argument;
} else {
var str = "";
for ( var i in argument ){
str += argument[i];
}
@oomlaut
oomlaut / randomint.js
Created July 16, 2013 14:56
generates a random integer based on a parameter
/**
* used for testing purposes only
* @param {int} size the maximum number possible
* @return {array} a random integer
*/
function randomInt(max){
return Math.ceil(Math.random() * max);
}
@oomlaut
oomlaut / dynamicselect.html
Last active August 29, 2015 13:56
dynamicselect_ui
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>New Web Project</title>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="dynamicselect.js"></script>
</head>
<body>
@oomlaut
oomlaut / fixednsap.css
Created February 10, 2014 19:25
fixedsnap_ui
#container{
width:960px;
margin:0 auto;
}
header{
width:100%;
height:200px;
background-color:#ccc;
}
section#main{
@oomlaut
oomlaut / SHA-1.js
Created October 23, 2014 19:57
SHA-1 implementation in JavaScript
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* SHA-1 implementation in JavaScript (c) Chris Veness 2002-2014 */
/* */
/* - see http://csrc.nist.gov/groups/ST/toolkit/secure_hashing.html */
/* http://csrc.nist.gov/groups/ST/toolkit/examples.html */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* jshint node:true *//* global define, escape, unescape */
'use strict';
@oomlaut
oomlaut / generatesitemap.php
Last active August 29, 2015 14:20
Generate sitemap.xml formatted file from text file containing list of links
<?php
print("\n");
if(!isset($argv[1]))
{
die("! Required argument: filename \n");
}
$filename = $argv[1];