Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am nwshane on github.
  • I am nathanwshane (https://keybase.io/nathanwshane) on keybase.
  • I have a public key ASDHTFy5Jh8pbupnpnjpVOnmyDDAuuBsGZDQKBifFWPGTgo

To claim this, I am signing this object:

@nwshane
nwshane / elixir_fizz_buzz.exs
Created Nov 27, 2017
FizzBuzz in the Elixir language
View elixir_fizz_buzz.exs
# Tested with Elixir 1.5.2
defmodule FizzBuzz do
defp fizzbuzzify(n) do
cond do
rem(n, 15) == 0 -> "FizzBuzz"
rem(n, 5) == 0 -> "Buzz"
rem(n, 3) == 0 -> "Fizz"
true -> n
end
@nwshane
nwshane / index.js
Last active Jul 3, 2017
Tic Tac Toe in the Terminal
View index.js
// Tested with node v8.1.1
const readline = require('readline')
const defaultState = {
players: {
1: {
isComputer: true
},
2: {
isComputer: true
View routes
Rails.application.routes.draw do
scope ':locale', locale: /#{I18n.available_locales.join("|")}/ do
resources :articles do
collection do
get 'custom_json', constraints: { format: :json }, defaults: { format: :json }
end
end
get "*path", to: redirect("/#{I18n.default_locale}") # handles /en/fake/path/whatever
end
View articles index.html.erb
<%- model_class = Article -%>
<% page_title "#{model_class.model_name.human.pluralize.titleize}" %>
<p><%= link_to "#{model_class.model_name.human.pluralize.titleize} CSV Download", articles_path(format: :csv) %></p>
<table class="table table-striped">
<thead>
<tr>
<th><%= model_class.human_attribute_name(:id) %></th>
<th><%= model_class.human_attribute_name(:number) %></th>
<th><%= model_class.human_attribute_name(:criminal_code_id) %></th>
<th><%= model_class.human_attribute_name(:created_at) %></th>
@nwshane
nwshane / gist:91cc68b00096e06c453f
Created Feb 19, 2015
Gemfile.lock with rack-test version 0.6.3
View gist:91cc68b00096e06c453f
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.1.6)
actionpack (= 4.1.6)
actionview (= 4.1.6)
mail (~> 2.5, >= 2.5.4)
actionpack (4.1.6)
actionview (= 4.1.6)
activesupport (= 4.1.6)