Skip to content

Instantly share code, notes, and snippets.

// Adapted from Python's implementation of randrange.
// https://github.com/python/cpython/blob/master/Lib/random.py
const crypto = require('crypto');
const bases = require('bases');
const START = 33554432; // '100000'
const END = 1073741824; // 'ZZZZZZ'
function getrandbits(k) {
@dstaley
dstaley / fizzbuzz.swift
Last active February 5, 2019 21:19
FizzBuzz in Swift using pattern matching
func fizzbuzz(i: Int) -> String {
let result = (i % 3, i % 5)
switch result {
case (0, _):
return "Fizz"
case (_, 0):
return "Buzz"
case (0, 0):
return "FizzBuzz"
default:
/*!
* Bootstrap v3.3.5 (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*!
* Generated using the Bootstrap Customizer (http://getbootstrap.com/customize/?id=3356eb28a4f746ca1528)
* Config saved to config.json and https://gist.github.com/3356eb28a4f746ca1528
*/