Skip to content

Instantly share code, notes, and snippets.

@lucianspec
lucianspec / roll.rb
Last active May 8, 2016 05:05
roll scipt for fun
def generate_pool likes, comments
all = likes.dup.concat(comments).uniq
puts "总人数#{all.count}"
puts "点赞党有#{likes.uniq.count}"
puts "评论党有#{comments.uniq.count}"
puts "计算权重ing..."
hash = all.reduce(Hash.new(0)) {|m, o|
priority = 1;
priority = 2 if comments.include?(o)
m[o] = priority
@lucianspec
lucianspec / Gemfile
Created April 26, 2017 02:31 — forked from chrisroos/Gemfile
Comparison of the various ERB trim modes available
source 'https://rubygems.org'
gem 'minitest'
@lucianspec
lucianspec / interpreter.rb
Created April 26, 2017 02:48
Ruby instance_method
class Interpreter
def do_a() print "there, "; end
def do_d() print "Hello "; end
def do_e() print "!\n"; end
def do_v() print "Dave"; end
Dispatcher = {
"a" => instance_method(:do_a),
"d" => instance_method(:do_d),
"e" => instance_method(:do_e),
"v" => instance_method(:do_v)
// Hey there!
// This is CODE, lets you control your character with code.
// If you don't know how to code, don't worry, It's easy.
// Just set attack_mode to true and ENGAGE!
var attack_mode=false
game_log("My current Speed is " + character.speed)
//Source code of: use_hp_or_mp
function my_use_hp_or_mp()