Skip to content

Instantly share code, notes, and snippets.

# Here's a simple lisp expression parser that generates
# an abstract syntax tree in the form of nested arrays
def tokenize(lisp_expression)
lisp_expression.gsub("(", " ( ").gsub(")", " ) ").split(" ")
end
def parse(tokens)
raise "No tokens to parse" if tokens.empty?
(1..100).to_a.each do |n|
if n % 3 == 0 && n % 5 == 0
puts "CracklePop"
elsif n % 3 == 0
puts "Crackle"
elsif n % 5 == 0
puts "Pop"
else
puts n
end
@blvrd
blvrd / cloudSettings
Last active July 15, 2019 20:56
VS Code
{"lastUpload":"2019-07-15T20:56:10.566Z","extensionVersion":"v3.4.0"}
Verifying my Blockstack ID is secured with the address 1L4gUadnqY1ZhskLDtPkHtek4HmLh5Ve9e https://explorer.blockstack.org/address/1L4gUadnqY1ZhskLDtPkHtek4HmLh5Ve9e
Verifying my Blockstack ID is secured with the address 1DMnvtnR9YdNEqTjcufHqi2QHRRFFzAMb3 https://explorer.blockstack.org/address/1DMnvtnR9YdNEqTjcufHqi2QHRRFFzAMb3
@blvrd
blvrd / flow.rb
Created February 14, 2017 21:55
Flow
# Every block should catch errors and add them to the instance of CheckoutFlow
#
# CheckoutFlow.new.execute do
# # ...
# end.then do
# # ...
# end
class Flow
def initialize

Keybase proof

I hereby claim:

  • I am garrettqmartin8 on github.
  • I am garrettqmartin (https://keybase.io/garrettqmartin) on keybase.
  • I have a public key ASCF8xQWUBMxeuCFGdhxdghXzmZhzxmPfkJWV1dFmKfd9wo

To claim this, I am signing this object:

@blvrd
blvrd / game.js
Created August 1, 2016 14:51
Game of Life
var gameOfLife = {
width: 12,
height: 12,
stepInterval: 100,
playing: false,
intervalObject: null,
createAndShowBoard: function(state) {
// create <table> element
var goltable = document.createElement("tbody");
@blvrd
blvrd / game.js
Created August 1, 2016 04:34
Game of Life starting point
var gameOfLife = {
width: 12,
height: 12,
createAndShowBoard: function () {
// create <table> element
var goltable = document.createElement("tbody");
// build Table HTML
var tablehtml = '';
@blvrd
blvrd / gist:75eb064e2b4b7eda493a
Created May 9, 2014 00:00
Generate default avatars
#### Model
def initials
[Person.first_letter(first_name), Person.first_letter(last_name)].compact.join("")
end
# "try" is a method Ryan showed me. It sends whatever method you specify
# and if it doesn't work, it returns nil instead of an error.
def self.first_letter(string)
string.try(:split, "").try(:first)