Skip to content

Instantly share code, notes, and snippets.

View dummey's full-sized avatar

Ricky Ng dummey

  • Washington University in St Louis
  • Saint Louis, MO
View GitHub Profile
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
@dummey
dummey / C gdb.runner
Created February 3, 2016 00:39
Runner config for C gdb on cloud9
// 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 ...",
@dummey
dummey / balanced_group_checker_regex.rb
Last active August 29, 2015 14:27 — forked from pmarreck/balanced_group_checker_regex.rb
A ruby regex to validate any level of nested balanced group characters
# Apparently, I am really 'en fuego' today.
require 'test/unit'
module RubyRegexMeister
BALANCED_GROUP_CHECKER = /(
(?<non_grouping_char>
[^\(\{\[\<\)\}\]\>]
){0}
(?<parens_group>
class Animal
WORDS = "animal"
@@foods = "anything"
def speak
p WORDS
p @@foods
end
end
class Dog < Animal
@dummey
dummey / test.rb
Last active August 29, 2015 14:25
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
# 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)
require 'find'
require 'nokogiri'
restaurants = []
Find.find('stl100/restaurants') do |path|
if path =~ /.*\.html$/
name = "?"
website = "?"
phone = "?"
module A
def foo1; end
end
class Klass
include A
end
module B
def foo2; end