Skip to content

Instantly share code, notes, and snippets.

View IceDragon200's full-sized avatar

Corey Powell IceDragon200

View GitHub Profile
def partial(func, arg)
->(*args) { func.call(arg, *args) }
end
f = ->(a, b, c) { [a, b, c] }
fail unless [1, 2, 3] == partial(partial(partial(f, 1), 2), 3).call

We'll make a project. Make a new directory somewhere Put:

# mruby-moon load
engine = Moon::Engine.new do |e, delta|
  step e, delta
end
 
engine.setup
# mruby-moon load
engine = Moon::Engine.new do |e, delta|
step e, delta
end
engine.setup
require 'core/load'
require 'scripts/load'
require 'thread'
class Worker
# I couldn't come up with anything better, so just bear with me.
STOP = Object.new
# @!attribute in
# @return [Queue] input queue/channel
attr_accessor :in
# @!attribute out
@IceDragon200
IceDragon200 / __gemmy__.sh
Last active August 29, 2015 14:20
My scripts for syntax checking, bundle updating, bundle testing, installing local gems
#!/usr/bin/env bash
crawl_ruby_check . &&
bundle update --local &&
bundle exec rspec &&
gemmy
class Object
# Attempts to wrap the object into an Array if it isnt already one.
#
# @return [Array]
def to_arylist
[self]
end
end
class Array
#include <mruby.h>
#include <mruby/class.h>
#include <mruby/data.h>
#include <mruby/numeric.h>
#include <SFML/Graphics/Rect.hpp>
static struct RClass *int_rect_class;
static struct RClass *float_rect_class;
static inline mrb_value
module Enumerable
def each_uniq(&block)
return to_enum :each_uniq unless block_given?
uniq_map = {}
each do |*a|
next if uniq_map.key?(a)
uniq_map[a] = true
block.call(*a)
end
end
@IceDragon200
IceDragon200 / reactive.rb
Created April 3, 2015 21:57
Prototype reactive API for moon
module Reactive
module Observable
def subscribe(listener)
listeners.push listener
listener
end
def unsubscribe(listener)
listeners.delete listener
end
{
"autoformat_on_save": true,
"user_defined_syntax_mode_mapping": {
// For example:
/*
"arduino": "c",
"pde": "java",
"apex": "java"
*/
"angelscript": "c",