Deep breath...
-
Try Ruby - In-browser Ruby tutorial
-
Learn to Program by Chris Pine - The best first guide to programming I've seen. Good intro to Ruby mechanics
# This is an example of using the progress bar feature of Formatador. | |
require "rubygems" | |
require "formatador" | |
require "rake" | |
current = 0 | |
total = 100 | |
# get terminal width |
# The Limit - "She's So Divine" (from CP-721 12" single) (1982) | |
# Kashif - "I Just Gotta Have You (Lover Turn Me On)" (from CP-728 12" single) (1982) | |
# Kenton Nix featuring Bobby Youngblood - "There's Never Been (No One Like You)" (from WES 22130 12" single) (1980) | |
# Mr. Magic - "Magic's Message (There Has to Be a Better Way)" (from POS-1213 12" single) (1984) | |
# Tia Monae - "Don't Keep Me Waiting" (from CART-320 12" single) (1983) | |
# Cloud One - "Flying High" (from HS-1010 12" single) (1982) | |
# Ednah Holt - "Serious, Sirius Space Party" (from WES 22138 12" single) (1981) | |
# Conversion - "Let's Do It" (from S-12336 12" single) (1980) | |
# The Monkees - "Mary Mary"* (from More of the Monkees) (1967) Colgems Records | |
# Wilbur "Bad" Bascomb - "Black Grass"* (from PAS-6048 7" single) (1972) Paramount Records |
class WrongNumberOfPlayersError < StandardError ; end | |
class NoSuchStrategyError < StandardError ; end | |
VALID_MOVES = %w{R P S} | |
def rps_game_winner(game) | |
raise WrongNumberOfPlayersError unless game.count == 2 | |
game.each do |move| | |
unless VALID_MOVES.include?(move[1]) |
#! /usr/bin/env ruby | |
require "rubygems" | |
require "formatador" | |
styles = [ | |
:bold, | |
:underline, | |
:blink_slow, | |
:blink_fast, |
# Aggregated music 'Likes' from my Facebook Friends list | |
require 'koala' | |
# Visit https://developers.facebook.com/tools/explorer | |
# and click "Get Access Token", assigning appropriate permissions | |
@graph = Koala::Facebook::API.new(FACEBOOK_GRAPH_ACCESS_TOKEN) |
# Extracted library from a deprecated app | |
class Token | |
PREFIXES = ['ab', 'ac', 'acr', 'acl', 'ad', 'adr', 'ah', 'ar', 'aw', 'ay', 'br', 'bl', 'cl', 'cr', 'ch', 'dr', 'dw', 'en', 'ey', 'in', 'im', 'iy', 'oy', 'och', 'on', 'qu', 'sl', 'sh', 'sw', 'tr', 'th', 'thr', 'un', 'st', 'str', 'kn'] | |
DIPTHONGS = ['ae', 'au', 'ea','ou','ei','ie','ia','ee','oo','eo','io'] | |
CONSONANT_PAIRS = ['bb', 'bl', 'br', 'ck', 'cr', 'ch', 'dd', 'dr', 'gh', 'gr', 'gn', 'gg', 'lb', 'ld', 'lk', 'lp', 'mb', 'mm', 'nc', 'nch', 'nd', 'ng', 'nn', 'nt', 'pp', 'pl', 'pr', 'rr', 'rch', 'rs', 'rsh', 'rt', 'sh', 'th', 'tt', 'st', 'str'] | |
POSTFIXES = ['able', 'act', 'am', 'ams', 'ect', 'ed', 'edge', 'en', 'er', 'ful', 'ia', 'ier', 'ies', 'illy', 'im', 'ing', 'ium', 'is', 'less', 'or', 'up', 'ups', 'y', 'igle', 'ogle', 'agle', 'ist', 'est'] | |
VOWELS = ['a', 'e', 'i', 'o', 'u'] | |
CONSONANTS = ('a'..'z').to_a - VOWELS |
24 Diner | |
Arlo | |
Austin Ale House | |
Austin Java | |
Bacon | |
Bar Chi | |
Barley Swine | |
Biscuits and Groovy | |
Black Sheep Lodge | |
Black Star Co-op |
Deep breath...
Try Ruby - In-browser Ruby tutorial
Learn to Program by Chris Pine - The best first guide to programming I've seen. Good intro to Ruby mechanics
defmodule SieveOfEratosthenes do | |
@doc """ | |
https://www.baeldung.com/cs/prime-number-algorithms | |
Naive implementation of the Sieve Of Eratosthenes for finding primes below `number` | |
""" | |
@spec primes(number) :: list | |
def primes(1), do: [] |
{:ok, spi_ref} = Circuits.SPI.open("spidev0.0", speed_hz: 9_000_000) | |
off = <<0x72>> <> (<<0::8, 0::8, 0::8>> |> :binary.copy(16 * 16)) | |
red = <<0x72>> <> (<<255::8, 0::8, 0::8>> |> :binary.copy(16 * 16)) | |
green = <<0x72>> <> (<<0::8, 255::8, 0::8>> |> :binary.copy(16 * 16)) | |
blue = <<0x72>> <> (<<0::8, 0::8, 255::8>> |> :binary.copy(16 * 16)) | |
white = <<0x72>> <> (<<255::8, 255::8, 255::8>> |> :binary.copy(16 * 16)) | |
Circuits.SPI.transfer(spi_ref, red) |