Instantly share code, notes, and snippets.

//Luhn trait
pub trait Luhn {
fn luhn(self) -> bool;
impl Luhn for String {
fn luhn(self) -> bool {
let s = remove_whitespace(&self);
let d = Digits::digits(s);
if d.len() < 16 {
return false;
View luhn_4_styles_julia.jl
using BenchmarkTools
dbl2nd(da::Array{Int64,1}) = for i in 1:2:(length(da))
da[i] *= 2
mod9(da::Array{Int64,1}) = for i in 1:2:length(da)
if da[i] > 9
da[i] -= 9
View cz_ue_world_data_enrollment.fsx
#load "../packages/FsLab/FsLab.fsx"
(* My Environment
visual studio code 2017 Version 1.18.1
mono --version ‹2.4.1›
Mono JIT compiler version (2017-06/e66d9abbb27 Wed Oct 25 12:10:41 EDT 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors.
TLS: normal
SIGSEGV: altstack
View fibonacci_two_ways.ex
defmodule Mather do
def numbers(x,y) do
f = fn
x,y when x>0 -> x + y
x,y -> x*y
IO.puts f.(x,y)
# A tail call optimized fibonacci.
// Using the Unicode Names package:
//require macros...
// in Cargo.toml looks like this:
// [dependencies.unicode_names_macros]
// git = ""
#[phase(plugin)] extern crate unicode_names_macros;

I can only rebind a variable that is explicitly declared as mutable; cool.

fn main() {
    let mut x: int = 5;
    x = 10i;
    println!("value of x: {}", x); // -> 10
View word_counter.ex
defmodule WordCounter do
def count(sent) do
sent |> normalize |> find_words |> count_unique |> Enum.sort()
def find_words(sent) do
Regex.scan(~r/\w+/, sent)
View gist:9946328
### Keybase proof
I hereby claim:
* I am jbowles on github.
* I am jbowles ( on keybase.
* I have a public key whose fingerprint is 18A2 A842 FEB6 3E60 3CB3 AC80 3A7B 98D5 D2AA FE72
To claim this, I am signing this object:
View go1.2_brew_install_hack_for_lazy_and_impatient.rb
# Too lazy to make a pull request and too impatient to wait,
# Just tuck 1.2 into the devel version
## First,
## $brew unlink go
## $vim /usr/local/Library/Formula/go.rb
## around line 20 under the `devel' block edit the following
devel do
#url ''
#version '1.2rc5'
View mstatus.go
package gobike
Example JSON: