Skip to content

Instantly share code, notes, and snippets.

View ootoovak's full-sized avatar

Juna Ootoovak ootoovak

View GitHub Profile
@ootoovak
ootoovak / useful_ruby_methods.md
Last active July 23, 2021 05:56
Ruby Array, Hash, and Enumerable to start with

Ruby Array, Hash, and Enumerable methods

What is this?

This is a list of methods from Ruby's Array, Hash, and Enumerable that I find useful and have used a lot. It is by no means an complete list so just think of it as a starting point. (BTW, Enumerable is a mixin and not a class but both Array and Hash include it they both have Enumerable methods avaliable to them.)

In preperation for this week and the upcoming week make sure you are understand how to sort and filter each of these data structures. Read the documentation on these methods and play with them in IRB.

Verifying that "ootoovak.id" is my Blockstack ID. https://onename.com/ootoovak
@ootoovak
ootoovak / 0_reuse_code.js
Created May 21, 2017 22:54
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ootoovak
ootoovak / essential_internet_tools.md
Last active December 23, 2015 23:09
Essential Internet Tools: Protect yourself from the horrors of the internet.
@ootoovak
ootoovak / capybara cheat sheet.rb
Last active December 19, 2015 17:19 — forked from zhengjia/capybara cheat sheet
Capybara Cheat Sheet
# Navigating
visit('/projects')
visit(post_comments_path(post))
# Clicking links and buttons
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
@ootoovak
ootoovak / Learn Rails And Ruby Resources.md
Last active December 19, 2015 17:18
Learn Rails And Ruby
@ootoovak
ootoovak / Problem.rb
Last active December 18, 2015 16:29
Don't recreate another object if you don't need to.
# Want to pass in a hash or instance of object. Was hoping to avoid is_a? or creating a new object but
# think that can only be done with is_a? or overriding new. Also, I might be missing the point as
# avoiding is_a? should mean I am using Duck Typing but if I'm using Duck Typing then I shouldn't be
# checking object equality anyway. See RSpec test for details.
describe MyClass do
let(:hash) { { name: 'Duck Type', description: 'Quacks like a duck?' } }
before do
@my_instance_1 = MyClass.new(hash)
@ootoovak
ootoovak / example_usage.rb
Created May 21, 2013 00:02
Helper methods to load as few files as possible to get tests to run. Some create require paths to load files and others to init required constants.
require 'fast_spec_helper'
require 'date'
require_model 'generate_required_daily_lists'
required_constants %w(Distributor PackingList DeliveryList)
---- OR ----
require 'fast_spec_helper'
require_model 'exporter', sub_dir: 'sales_csv'
require_model 'delivery_exporter', sub_dir: 'sales_csv'
@ootoovak
ootoovak / fast_spec_helper.rb
Last active December 13, 2015 17:48
Something I'm working with at the moment. WIP
require 'active_attr'
RELATIVE_APP_PATH = File.expand_path("../../app", __FILE__)
def construct_require_path(middle_path, name)
"#{RELATIVE_APP_PATH}/#{middle_path}/#{name}.rb"
end
def require_model(name)
require construct_require_path('models', name)
@ootoovak
ootoovak / tb_fluid_inside_static.haml
Created September 1, 2012 07:11
Twitter Bootstrap Fluid Inside Static
%body
.container
.row
.span2
.span10
.container-fluid
.row-fluid
.span3
.span3
.row-fluid