Skip to content

Instantly share code, notes, and snippets.

@mattroyer
mattroyer / GitHub_JS.js
Last active October 3, 2015 08:18
Some on-the-fly JavaScript manipulation for - https://github.com/about/team
// Run these in your browser's script console
// Removes all employees that live in San Francisco
$('.employee_container:contains("San Francisco")').remove();
// NOTE: The following no longer applies as GitHub has changed the way employees are displayed
// Remove all employees that are not developers
$('.employee_container').not(':contains("Developer")').remove();
// Get a list of all github.com/ addresses for all GitHub employees
@mattroyer
mattroyer / md_sinatra.rb
Last active March 25, 2016 15:51
Create a Sinatra page of blog posts that are in separate markdown files
# Create an array of all markdown files from a specific directory
# And convert them to Html using the RDiscount gem
# Display them in the index of the page using Haml
#
# I sorted them this way because they are in the format:
# post_1.md
# post_2.md
# ...
# post_10.md
# post_11.md
@mattroyer
mattroyer / html.coffee
Created May 7, 2012 20:09
Create a new Html5 document with a CoffeeScript command.
# Create a new Html5 document, by default called index.html
# If the user supplies a different name, it will use that
# name instead.
#
# Examples:
# C:\>coffee html.coffee
# => index.html
# File Created!
#
# C:\>coffee html.coffee myNewDoc.html
@mattroyer
mattroyer / gist.js
Created May 9, 2012 16:33
Return all GitHub Gists from a user through jQuery
// In this example, I'll use my own username to get all of my gists
// into a Div element with an ID of "gists".
$(document).ready(function() {
$.getJSON("https://api.github.com/users/mattroyer/gists?callback=?", function(json) {
$.each(json.data, function(index, value) {
$('#gists').append('<li><a href="' + value.html_url + '">' + value.description + '</a></li>');
});
});
});
@mattroyer
mattroyer / dateCode.rb
Last active October 5, 2015 06:18
Date Formatting
# Decode dates encoded in a special format
#
# Example:
#
# > ruby dateCode.rb 125M
# => The date is: May 22, 2012
# Define a method to decode the dates
def dateDecode(date)
@mattroyer
mattroyer / Mine.reg
Created May 26, 2012 18:32
Portable Development Environment Using Dropbox and Windows
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
"Autorun"="C:\\Dropbox\\Apps\\tmp\\myRun.bat"
@mattroyer
mattroyer / AutoHotKey.ahk
Created June 5, 2012 14:37
AutoHotKey Configuration
; ------------
; Hotstrings
; ------------
::btw::By the way
::sig::--Matt Royer
; Ctrl+Shift+C
; ------------------------------------------------------
@mattroyer
mattroyer / fullGisty.js
Last active October 11, 2015 12:48
Create a button on GitHub profile page for user's Gist page
// This is the readable version of Gisty.js
//
(function() {
var url = document.URL.replace('github', 'gist.github');
$('.tabnav-right').append('<a class="minibutton" href="' + url + '">Gists</a>');
})();
@mattroyer
mattroyer / histogram.rb
Last active October 12, 2015 14:38
Histogram App in Ruby
# Create a histogram of a string
#
# Example:
#
# > This is my phrase. Is it a cool phrase?
# #=> phrase 2
# is 2
# cool 1
# it 1
# my 1
@mattroyer
mattroyer / description.md
Last active December 10, 2015 10:29
Interface with Outlook Through Ruby

Snacks Code

At work, we have a snacks program. There is a soda fountain and the cupboards are filled with all kinds of goodies. Everything, soda and snacks, is $0.25 cents. We have an iPad setup with a little web interface that was created in-house so that we can pay for our purchases and the money is automatically deducted from our checks. We each have our own pin to use so that we can puchase these things securely.

When we purchase something, we get an e-mail stating what we purchased and the total items. It doesn't have an amount, just a total of the number of items we've purchased.

One night, I was curious about how much I have purchased through this snack program. I have a rule in Outlook that takes the incoming snack e-mails, marks them as read, and then moves them to a folder I created called "Snacks". I have every e-mail in that folder from when this program started.

So I created the two code files (and added the .bat file to my path) so that all I had to do on my command-line is type ```snacks`