This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Parser do | |
def parse_input(input) do | |
[number_of_switches | actions] = input |> String.split("\n") | |
number_of_switches = parse_number_of_switches(number_of_switches) | |
actions = parse_actions(actions) | |
[number_of_switches, actions] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For more information see http://docs.c9.io:8080/#!/api/run-method-run | |
// put me in .c9/runners/ | |
{ | |
"cmd": [ | |
"sh", | |
"-c", | |
"/usr/bin/make $file_base_name && gdbserver --once :64528 $file_path/$file_base_name $args && echo '' || echo 'Please be sure to stop other debuggers before continuing.'" | |
], | |
"info": "Compiling $file ...", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Apparently, I am really 'en fuego' today. | |
require 'test/unit' | |
module RubyRegexMeister | |
BALANCED_GROUP_CHECKER = /( | |
(?<non_grouping_char> | |
[^\(\{\[\<\)\}\]\>] | |
){0} | |
(?<parens_group> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Animal | |
WORDS = "animal" | |
@@foods = "anything" | |
def speak | |
p WORDS | |
p @@foods | |
end | |
end | |
class Dog < Animal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Animal | |
def create_animal(name) | |
p UsersTab.ancestors #[Animal::UsersTab, Object, Kernel, BasicObject] | |
UsersTab.new | |
end | |
class UsersTab | |
def initialize | |
puts "Animal::UsersTab" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Setting up base conditions | |
list = 0..100 | |
num_missing = 2 | |
# Shuffling list and removing some number of numbers | |
list = list.to_a.shuffle | |
num_missing.times do |i| | |
puts "Missing: #{list.shift}" | |
# This a cheat to add a blank value to the end of the list to presvere list length | |
list.push(-1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'find' | |
require 'nokogiri' | |
restaurants = [] | |
Find.find('stl100/restaurants') do |path| | |
if path =~ /.*\.html$/ | |
name = "?" | |
website = "?" | |
phone = "?" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module A | |
def foo1; end | |
end | |
class Klass | |
include A | |
end | |
module B | |
def foo2; end |