Skip to content

Instantly share code, notes, and snippets.

mweppler / string_to_base64.rb
Created Apr 29, 2014
Base 64 encode a string at the command line via ruby.
View string_to_base64.rb
#!/usr/bin/env ruby
if ARGV[0].nil?
raise "Expecting a string as the first argument"
require 'base64'
based = Base64.encode64 ARGV[0]
if !ARGV[1].nil? && ARGV[1] == 'sep'
View info.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
View wedding-photography-rates-2015.html
<title>Wedding Photography Rates 2015</title>
body, h1, h2, h3, h4, h5, h6, hr, p, ul { margin: 0; padding: 0; }
header { text-align: center; margin: 0 0; }
.logo { width: 200px; }
h1, h2, h3, h4, h5, h6 { text-align: center; text-transform: uppercase; }
h2 { margin: 35px 0; }
mweppler / hex_color_changer.rb
Created Aug 21, 2015
Darken/Lighten a hex color value (CSS)
View hex_color_changer.rb
#!/usr/bin/env ruby
class HexColorChanger
def self.valid_hex?(hex)
def self.valid_lum?(lum)
mweppler /
Created May 18, 2011
Coding: Triangle Numbers Puzzle - from
package pack;
public class TriangleNumbersPuzzle
private static int returnNumberOfDivisors(int inNum)
mweppler / Singleton.class
Created Aug 3, 2011
Wiki Definition: "In software engineering, the singleton pattern is a design pattern used to implement the mathematical concept of a singleton, by restricting the instantiation of a class to one object."
View Singleton.class
// Traditional Simple Way:
public class Singleton {
private static final Singleton instance = new Singleton();
private Singleton() {
public static Singleton getInstance() {
return instance;
mweppler / kitties_yay.js
Created Oct 4, 2011
Replace images on a page with kittens (boredom)...
View kitties_yay.js
if (jQuery) (function($){
jQuery('img').each(function() {
jQuery(this).attr('src', ''+jQuery(this).width()+'/'+jQuery(this).height());
mweppler / inventory_fs.rb
Created Oct 4, 2011
Get an inventory of the file system...
View inventory_fs.rb
#!/usr/bin/env ruby
def compare_filesystem(previous, current)
previous_inventory =
current_inventory =
# puts "The following files have been added:"
# puts current_inventory - previous_inventory
# puts ""
mweppler /
Created Oct 20, 2011
Learning Binary Trees through recursive programming.
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
* Sample application output:
* **** Building Dictionary Start with Isabella ****
mweppler / gist:1310752
Created Oct 24, 2011
clip-it bookmarklet
View gist:1310752
javascript:(function(){function b(g){var m=document,k=m.createElement("script"),f=m.body,h=m.location,i="";try{if(!f){throw (0)}i=m.title;m.title="(Saving...) "+m.title;k.setAttribute("src",h.protocol+"//"+g+"&url="+encodeURIComponent(h.href));f.appendChild(k);m.title=i;return 0}catch(j){alert("The page has not loaded. Please try again in a moment.")}}function a(e,h){var d=document.createElement("script");d.src=e;var f=document.getElementsByTagName("head")[0];var g=false;d.onload=d.onreadystatechange=function(){if(!g&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){g=true;h();d.onload=d.onreadystatechange=null;f.removeChild(d)}};f.appendChild(d)}function c(d){var f=document.createElement("link");f.href=d;f.rel="stylesheet";f.type="text/css";var e=document.getElementsByTagName("head")[0];e.appendChild(f)}a("",function(){a("