Skip to content

Instantly share code, notes, and snippets.

View anolson's full-sized avatar
👋

Andrew Olson anolson

👋
View GitHub Profile
@anolson
anolson / simple_ed_authenticator.rb
Created December 14, 2011 15:44
Simple class for authenticating people against VT EDAuth Ldap.
require 'rubygems'
require 'net/ldap'
class SimpleEdAuthenticator
HOST, PORT, BASE_DN = 'authn.directory.vt.edu', 636, 'ou=People,dc=vt,dc=edu'
def initialize(options = {})
@authenticated = false
@attributes = {}
@anolson
anolson / output
Created February 21, 2012 21:52
Find saddle points in a matrix
Saddle point found at: [1, 3]
No saddle points found
Saddle point found at: [1, 3]
@anolson
anolson / luhn_checksum.rb
Created May 15, 2012 14:43
Luhn Checksum
class LuhnChecksum
attr_accessor :number
def initialize(number = "")
@number = number
end
def valid?
calculate_checksum % 10 == 0
end
@anolson
anolson / index.html
Created May 22, 2012 15:14
Super simple bar chart with D3.
<html>
<head>
<title>D3</title>
<link type="text/css" rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.15/jquery-ui.min.js"></script>
<script type="text/javascript" charset="utf-8" src="d3.v2.js"></script>
<script type="text/javascript" charset="utf-8" src="d3.layout.min.js"></script>
@anolson
anolson / articles.html
Created June 7, 2012 14:32
Create a static website out of a tree of files (pdf)
<html>
<head>
<link rel=stylesheet href="/style/screen.css" media="screen" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title><%= @path %></title>
</head>
<body>
@anolson
anolson / README.md
Created February 18, 2013 16:54 — forked from JanDupal/README.md

Jekyll sorted_for plugin

Quick'n'dirty Jekyll plugin for sorted cycle.

Install

Copy sorted_for.rb to _plugins/ directory of your Jekyll site.

Usage

@anolson
anolson / instructions.md
Last active December 18, 2015 04:59
Luhn Checksum

Luhn Checksum

Implement a Ruby program that outputs the validity of a number by applying the Luhn Checksum.

http://en.wikipedia.org/wiki/Luhn_algorithm

Please treat this as you would any other project or task you'd encounter during your daily work. This will show us how currently code, and not how you coded 6, 12 or 18 months ago. Your code should also be suitably tested.

Input:

@anolson
anolson / happy.md
Last active December 21, 2015 02:49
Recent things that make me happy.
@anolson
anolson / keybase.md
Created September 24, 2014 12:50
keybase.md

Keybase proof

I hereby claim:

  • I am anolson on github.
  • I am anolson (https://keybase.io/anolson) on keybase.
  • I have a public key whose fingerprint is F1C4 5C7C 42AC 5FD2 492D D67B C68E 0F36 79C0 CAD4

To claim this, I am signing this object:

@anolson
anolson / debug_assets.rb
Created November 12, 2014 19:28
Debug rails asset pipeline.
module Sprockets
class Manifest
def logger_with_debug
logger_without_debug.tap do |logger|
logger.level = Logger::DEBUG
end
end
alias_method_chain :logger, :debug
end
end