Skip to content

Instantly share code, notes, and snippets.

View IceDragon200's full-sized avatar

Corey Powell IceDragon200

View GitHub Profile
@IceDragon200
IceDragon200 / grc-fermenting-2.7.json
Created August 21, 2016 12:41
A snippet from Growthcraft 2.7's fermenting.json
{
"comment": "",
"data": [
{
"comment": "",
"item": {
"ore": "yeastBrewers",
"comment": "",
"mod_id": null,
"name": null,
# Utility class for creating Vector4 colors from RGBA8 values
class Color
# normalized values
#
# @param [Float] r
# @param [Float] g
# @param [Float] b
# @param [Float] a
# @return [Moon::Vector4]
def self.new(r, g, b, a)
# Search term parser from https://gist.github.com/1477730
# Modified to allow periods (and other non-letter chars) in unquoted field values
# and field names.
#
# Helper class to help parse out more advanced saerch terms
# from a form query
#
# Note: all hash keys are downcased, so ID:10 == {'id' => 10}
# you can also access all keys with methods e.g.: terms.id = terms['id'] = 10
# this doesn't work with query as thats reserved for the left-over pieces
assets/grcapples/textures/blocks/apples_1.png
assets/grcapples/textures/blocks/apples_2.png
assets/grcapples/textures/blocks/apples_3.png
assets/grcapples/textures/blocks/apple_sapling.png
assets/grcapples/textures/items/apple_seed.png
assets/grcbamboo/textures/blocks/block.png
assets/grcbamboo/textures/blocks/door_lower.png
assets/grcbamboo/textures/blocks/door_upper.png
assets/grcbamboo/textures/blocks/fence.png
assets/grcbamboo/textures/blocks/fence_top.png
require 'benchmark'
Benchmark.bmbm do |x|
a, b = 1, 0
n = 1_000_000
x.report('Catching a DivisionByZero') { n.times { a / b rescue nil } }
x.report('Checking if dividend is 0') { n.times { b == 0 ? nil : a / b } }
end

So you wanna play modded minecraft?

Well, first step is having minecraft, got that? GOOD.

Now you'll need minecraft forge, as most if not all mods use forge to interfacing with minecraft, base edit mods are evil, avoid em like the plague, unless you have good reason.

Make sure to grab the installer (not the installer-win, which is for Windows), You should have Java, you do right, if not WTF M8.

LINK http://files.minecraftforge.net/maven/net/minecraftforge/forge/index_1.7.10.html

## self_render
# The self render needs to be encapsulated in another object in order to handle its render parameters
# RenderContext is the class that currently handles wrapping these objects, since its #render method optionally takes
# the position and hides the internal object
list = []
list << SpriteContext<Sprite>
list << Icon<Spritesheet>
list << Label<Text>
list << SpritesheetMap<Tilemap>
list.each { |obj| obj.render x, y, z }
str = "Hello, World"
half = str.size / 2
n = 0
m = str.size - 1
while n < half
str[n], str[m] = str[m], str[n]
n += 1
m -= 1
end
puts str
n = 100
puts "Creating a #{n}**3 matrix"
10.times do |i|
puts "\tRun ##{i}"
# Array of Arrays
GC.disable
time_then = Time.now
m = Array.new(n) { Array.new(n) { Array.new(n, 0) } }
time_elapsed = Time.now - time_then
result = []
last_line = nil
File.open('my_awesome_file_of_doom_and_cookies.txt', 'r') do |file|
file.each_line do |line|
if line =~ /expected_line/ && (last_line && last_line =~ /expected_previous_line/)
result.pop
end
result << line
last_line = line