Skip to content

Instantly share code, notes, and snippets.

View IceDragon200's full-sized avatar

Corey Powell IceDragon200

View GitHub Profile

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@IceDragon200
IceDragon200 / rm-simple_resolution.rb
Last active December 12, 2015 02:28
A collection of various resolutions for use in any game that wants fancy resolutions.
#
# core/resolution.rb
# by IceDragon (mistdragon100@gmail.com)
# dc 02/02/2013
# dm 02/02/2013
# vr 1.0
#
# INSTRUCTIONS
# Simply uncomment the resolution you wish to use
#
@IceDragon200
IceDragon200 / enum_with_objects.rb
Created September 15, 2013 17:11
An implementation of each_with_objects and map_with_objects for ruby
module Enumerable
def each_with_objects(*args, &block)
return to_enum(:each_with_objects, *args) unless block_given?
each do |obj|
yield obj, *args
end
end unless method_defined?(:each_with_objects)
def map_with_objects(*args, &block)

Keybase proof

I hereby claim:

  • I am IceDragon200 on github.
  • I am IceDragon (https://keybase.io/IceDragon) on keybase.
  • I have a public key whose fingerprint is 1354 B480 2004 E2CE CDCF 7367 C0A4 B48E 0FE8 9D30

To claim this, I am signing this object:

@IceDragon200
IceDragon200 / attr_flop.rb
Created October 22, 2014 17:12
Attribute flopping
def attr_flop(obj, attribute)
old_value = obj.send(attribute)
yield obj, old_value
new_value = obj.send(attribute)
obj.send("#{attribute}=", old_value)
new_value
end
def parse_ip_string(line)
line.scan(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/).each do |addr|
split_array = addr.split(".")
return split_array.map{ |str| str.rjust(3, '0') }.join '.'
end
nil
end
unless ARGV.size == 1
puts "Invalid number of arguments?"
@IceDragon200
IceDragon200 / extractall.rb
Last active August 29, 2015 14:11
Multi-archive extractor (shells out)
#!/usr/bin/env ruby
# extractall
# Because sometimes I don't feel like typing unzip or tar and just want
# to extract multiple acrhives of varying type, or I dont feel like
# mkdir-ing && doing the previous thing.
# I just wanna "Do the thing" as varrick would say ;3
require 'fileutils'
require 'optparse'
module ExtractAll
@IceDragon200
IceDragon200 / config_readers.rb
Created January 12, 2015 02:36
My sad attempt at writing a set of parsers for minecraft mod configs...
require 'pp'
require 'rltk/parser'
require 'rltk/lexer'
require 'rltk/ast'
require 'json'
module ConfigReaders
# OpenComputers has a simple config file format
# lines starting with # are comments (ignoring spaces)
# lines ending with { are objects
use sdk
import structs/ArrayList
main: func(args: ArrayList<String>) {
"Hello, World".println()
}

Changes

  • Edited the template, so it puts out each line instead of inlining them.
  • Used 4 interfaces instead of 2.