Skip to content

Instantly share code, notes, and snippets.

@johnlinvc
Last active August 2, 2020 06:24
Show Gist options
  • Save johnlinvc/d3cde05b8a7ed5c155498b1534e43bd8 to your computer and use it in GitHub Desktop.
Save johnlinvc/d3cde05b8a7ed5c155498b1534e43bd8 to your computer and use it in GitHub Desktop.
Coscup 2020 Ruby Byebug
def get_coupon(user_id, history)
if history[user_id] = true
return 0
end
history[user_id] = true
3000
end
puts get_coupon(1, {})
#!/usr/bin/env ruby
require_relative 'my_code.rb'
puts eval("my"+"_"+"method")
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
# gem "rails"
gem 'byebug'
class HiddenLib
def method_missing(name, *args)
"called #{name} with args: #{args.map(&:to_s)}"
end
end
require_relative 'hidden_lib.rb'
puts HiddenLib.new.hello("world")
require 'byebug'
def my_method
byebug
"hello"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment