Skip to content

Instantly share code, notes, and snippets.

@squarism
squarism / baseball_stories.txt
Last active July 24, 2024 05:29
Baseball Stories
Strike Out
----------
1. Pitcher pitches ball
2. A strike happens
3. Umpire sees strike
4. Umpire updates internal count
5. Umpire shouts strike to field
6. Pitcher pitches ball, after hearing call in field
... repeat
7. Third strike is called
package main
import "fmt"
type Doer interface {
Do(i int)
}
type Base struct{}
func (b Base) Do(i int) {
@squarism
squarism / go_tour.go
Last active August 29, 2015 14:03
Go Tour Excercies
// Exercise 25 - Loops and Functions
// --------------------------------------------------------------------
package main
import (
"fmt"
"math"
)
@squarism
squarism / happy_golang_libraries.md
Last active November 4, 2017 08:57
Happy Time Golang Libraries

Happy Time Go Libraries.

Another curated list like awesome-go.
Not complete. Not authoritative. Not cupcake.
Send suggestions: @squarism :)
☆ = Github stars (in November 2016)


Adapters and Drivers

define_behavior :sliding do
requires :director
setup do
actor.has_attribute :x_tween
actor.has_attribute :y_tween
actor.has_attributes tween_time: opts[:time]
director.when :update do |time|
if actor.x_tween
@squarism
squarism / words_we_need.txt
Last active August 29, 2015 14:13
Words That Need to Exist
I don't want or expect any of these to stick.
I just want a list of made-up words that I can define and use once or twice.
----------------------------------------------------------------------------
When someone mishears or misunderstands you and now much later you have to do something extra to fix the situation.
When you have something funny to say way too late while in bed.
Something you learned on your own but you don't think you are professional at it.
@squarism
squarism / english_is_terrible.md
Last active August 20, 2024 02:02
English is Terrible

I'm sad that the world has adopted English as the language of science and business. English is a mutt language that has never been redone, reworked or even designed. It's a combination of ice cream, meatballs and wine. All fine things by themselves but terrible when combined.

There are more English learners than there are native English speakers in the world. I'm really sorry world. I'm just so so sorry that you have to learn Germanic-French-Latin nonsense. It's terrible. It's a terrible language.

Update: I wrote this before I read Mother Tongue by Bill Bryson. It's fantastic and a better write-up of what I'm trying to say here.


Prepositional phrases

@squarism
squarism / swagger.md
Created January 23, 2015 23:00
Swagger Grape Weirdness

Imma turn this into a blog post soon but in the meantime wanted to give the Google index a hit on

  cannot load such file -- grape-swagger

The grape-swagger gem is forked right now (2015-01-23). If you simply follow the docs, you're going to get a require error.

In Gemfile, change gem "grape-swagger-rails" to this: gem "grape-swagger-rails", github: "BrandyMint/grape-swagger-rails"

@squarism
squarism / hi_spec.rb
Last active August 29, 2015 14:14
Hi spec
# I know what you are saying about the composition.
# I know that this simple example doesn't represent the
# composability that you probably trying to do.
# But this is how I would do what you want.
# You already know all this so I'm wasting your time actually.
# =>
# hi!
# hi!
# hello!
@squarism
squarism / lunch_spec.rb
Last active August 29, 2015 14:14
Lunch Spec
# RSpec really does have an identity crisis. It's not quite ruby and it's
# not quite English. But what if we really made our tests complicated
# with shared_examples that behave like mixins sorta? How bad would this be?
# rspec --format doc lunch_spec.rb
shared_examples "charge" do
let(:cash_register) { "ding!" }
it "charges a price" do