Skip to content

Instantly share code, notes, and snippets.

Nathan Youngman nathany

Block or report user

Report or block nathany

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
nathany / checksum.go
Created Aug 11, 2016
Using MultiWriter to do two things at once
View checksum.go
// copyAndChecksum calculates a checksum while writing to another output
func copyAndChecksum(w io.Writer, r io.Reader) (string, error) {
h := md5.New()
mw := io.MultiWriter(w, h)
if _, err := io.Copy(mw, r); err != nil {
return "", err
return hex.EncodeToString(h.Sum(nil)), nil
View git_test.go
package main
import (
func TestGetSHA(t *testing.T) {
sha, err := getSHA1()
if err != nil {
nathany / luhn.ex
Last active Dec 28, 2016
Luhn algorithm to checksum credit cards.
View luhn.ex
defmodule Luhn do
@moduledoc """
Luhn algorithm to checksum credit cards.
@doc """
Check if a credit card number is valid based on luhn.
def valid?(cc) when is_integer(cc) do
nathany /
Last active Nov 15, 2015
blue light reduction and f.lux

To modify screen colour temperatures during evening hours, I have been using the f.lux app on my Macs for years.

I was quite looking forward to using it on my iPad, particularly for reading, but it seems Apple has not provided the necessary documented APIs, nor is Apple allowing side loading of apps using Xcode 7.

This is why iPad will never replace the PC.

Hopefully you will open up the capabilities needed to make f.lux a first class app, or work with them to build the features into a future revision of iOS.

nathany / zshenv
Last active Sep 11, 2015
Go environment
View zshenv
export PATH=$PATH:$HOME/src/$HOME/bin
nathany /
Created Apr 28, 2015
Go / Ruby bridge with Sidekiq
brew install redis
gem install sidekiq
go get -u

redis-server /usr/local/etc/redis.conf
nathany / go.cson
Created Oct 4, 2014
Atom conversion of GoSublime-next.tmLanguage
View go.cson
'comment': 'Based on work from and'
'fileTypes': [
'firstLineMatch': '-[*]-( Mode:)? Go -[*]-'
'name': 'GoSublime-next'
'patterns': [
'begin': '/\\*'
'end': '\\*/'

Keybase proof

I hereby claim:

  • I am nathany on github.
  • I am nathany ( on keybase.
  • I have a public key ASDQMnXaH02CR8BQhuy4A0xJpt8RfQDOIkGAJFX9QuNlIAo

To claim this, I am signing this object:

nathany / rails-4.0.10.rc1.rb
Created Aug 21, 2014
Test case for bug in Rails 4.0.10.rc
View rails-4.0.10.rc1.rb
# Activate the gem you are reporting the issue against.
# gem 'activerecord', '4.0.9' # works
gem 'activerecord', '4.0.10.rc1'
# gem 'activerecord', '4.1.5' # works
# gem 'activerecord', '4.1.6.rc1'
gem 'pg'
require 'active_record'
nathany / multiselect.html
Created Nov 6, 2013
iOS 7.0.3 multiple select issue minimal test case
View multiselect.html
<!DOCTYPE html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>iOS Test</title></head>
<div data-role="page">
<div data-role="content">
You can’t perform that action at this time.