Skip to content

Instantly share code, notes, and snippets.

@stack
stack / dqsolver.rb
Last active February 24, 2017 01:26
Solves the El Monumento de Pomposo Puzzle in Dragon Quest VII
#!/usr/bin/env ruby
def rotate_clockwise(direction)
case direction
when :n
:e
when :e
:s
when :s
:w
@stack
stack / # libyaml - 2016-11-27_18-48-33.txt
Created November 28, 2016 00:43
libyaml on macOS 10.12.1 - Homebrew build logs
Homebrew build logs for libyaml on macOS 10.12.1
Build date: 2016-11-27 18:48:33
@stack
stack / UIView+Superviews.swift
Created February 19, 2016 04:00
An extension of UIView that gives a superviews property as a sequence
//
// UIView+SuperviewSequence.swift
// PhotoKeeper
//
// Created by Stephen Gerstacker on 2/18/16.
// Copyright © 2016 net.shortround. All rights reserved.
//
import UIKit
@stack
stack / net detect.rb
Created November 27, 2015 05:06
A script for my friend to help with a failing wireless card
#!/usr/bin/env ruby
require 'rubygems'
require 'net/ping'
require 'time'
TEST_SITES = [
"http://www.google.com",
"http://www.yahoo.com"
].freeze

Keybase proof

I hereby claim:

  • I am stack on github.
  • I am stack (https://keybase.io/stack) on keybase.
  • I have a public key whose fingerprint is 21E9 80DD 2C0D 1421 F5C3 9859 D5D3 F4F8 C270 4B4E

To claim this, I am signing this object:

<html>
<body>
<script type="text/javascript">
document.write(navigator.userAgent);
</script>
</body>
</html>
@stack
stack / lighttpd.conf
Created May 25, 2011 20:34
Lighttpd config file for local development
server.bind = "0.0.0.0"
server.port = 3000
server.document-root = CWD
index-file.names = ( "index.php", "index.html", "index.htm", "default.htm" )
server.modules = ( "mod_fastcgi" )
## Start an FastCGI server for php (needs the php5-cgi package)
fastcgi.server += ( ".php" =>
@stack
stack / embedded_mailer.rb
Created April 7, 2011 16:41
Multipart Alternative + Multipart Related Email with ActionMailer for Rails 3
class EmbeddedMailer < ActionMailer::Base
def embedded_mail(to, from, subject, html_message, text_message, files = {}, embeds = {})
mail(:to => to, :from => from, :subject => subject) do |format|
format.text { render :text => text_message }
format.html { render :text => html_message }
end
# Embeds
embeds.each do |key, embed|
@stack
stack / embedded_mailer.rb
Created April 7, 2011 16:40
Multipart Alternative + Multipart Related Email with ActionMailer for Rails 2
class EmbeddedMailer < ActionMailer::Base
def embedded_mail(to, from, subject, html_message, text_message, files = {}, embeds = {})
# Hack TMail to allow embeds
TMail::HeaderField::FNAME_TO_CLASS.delete 'content-id'
recipients to
from from
subject subject
@stack
stack / close-status.rb
Created January 17, 2011 22:55
A script to turn off my chat accounts at the end of the day
#!/usr/bin/env ruby
require 'rubygems'
require 'dbus'
# Get the proper DBus session address
pid = nil
programs = %w( gnome-session )
programs.each do |program|
pid = `pidof -s #{program}`