Skip to content

Instantly share code, notes, and snippets.

@maddiesch
maddiesch / minecraft.sh
Created April 20, 2014 10:12
This is the script I run when setting up a new Minecraft server.
#!/bin/bash
# The name of the .jar file for the latest version.
MINECRAFT_LATEST="minecraft_server.1.7.9.jar"
# The URL for the lates version of the minecraft server
MINECRAFT_LATEST_LINK="https://s3.amazonaws.com/Minecraft.Download/versions/1.7.9/minecraft_server.1.7.9.jar"
# The screen name for the Minecraft Server
MINECRAFT_SCREEN_NAME="Minecraft"
# Setup some variables
@maddiesch
maddiesch / start.bash
Created July 21, 2014 03:31
Minecraft start file
#!/bin/bash
###
#
# : Usage
# ./start -j server.jar -m 2G
# -j ) Path to the jar file
# -m ) Amount of memory to give the Java process
#
###
@maddiesch
maddiesch / room.lua
Created September 5, 2014 18:13
Create a room with a ComputerCraft Mining Turtle
--[[
By: skylarsch
Usage: room <length (9)> <width (9)> <height (5)>
Each of the arguments are optional, but if you must specify all the values before the one you want to change.
--]]
-- MARK: Helper Functions
function fwd() -- Move forward
while not turtle.forward() do
@maddiesch
maddiesch / branch.lua
Created September 5, 2014 18:14
Create a branch mine using a ComputerCraft Mining Turtle
--[[
By: skylarsch
Usage: branch <number of tunnels (8)> <length of each tunnel (10)> <space between tunnels (2)>
Each of the arguments are optional, but if you must specify all the values before the one you want to change.
--]]
-- MARK: Helper Functions
function fwd() -- Move forward
while not turtle.forward() do
@maddiesch
maddiesch / ipsum.rb
Last active August 29, 2015 14:06
Ruby lorem ipsum generator
#!/usr/bin/ruby
## Helpers
def get_word(words)
words.sample
end
def get_sentence(words)
count = (10..16).to_a.sample
str = ""
(0..count).each do
int32_t hex = 0x2578CB;
[[UIColor alloc] initWithRed:(((hex >> 16) & 0xFF) / 255.0) green:(((hex >> 8) & 0xFF) / 255.0) blue:((hex & 0xFF) / 255.0) alpha:1.0];
@maddiesch
maddiesch / size.rb
Created February 5, 2015 22:50
We have massive .xcassets catalogs. This helps verify the @2x & @3x assets are the right sizes.
#
# Used to valide image sizes in an Xcode asset cataloge.
#
# If a @1x image is 100x100 this will verify the @2x is 200x200 (+/- 4) and the @3x is 300x300 (+/- 4)
#
# Usage:
# ruby size.rb /full/path/to/assets/Images.xcassets
#
# Output:
# image@3x.png
#import <Foundation/Foundation.h>
@interface NSDate (Additions)
+ (instancetype)dateWithISO8601DateString:(NSString *)date;
+ (instancetype)dateWithISO8601DateTimeString:(NSString *)date;
@end
@interface NSDateFormatter (Additions)
@maddiesch
maddiesch / Distance.h
Created March 13, 2015 17:26
Get distance between two points
UIKIT_EXTERN CGFloat SKYDistanceFromPointToPoint(CGPoint, CGPoint);
@maddiesch
maddiesch / presence.rb
Created April 17, 2015 06:05
RSpec Helpers
# In spec/support/presence.rb
RSpec.shared_examples 'presence' do |attrs|
describe 'presence validations' do
attrs.each do |attr|
it "checks presence of #{attr}" do
target = described_class.name.downcase.to_sym
obj = FactoryGirl.build target, attr.to_sym => nil
expect(obj.valid?).to eq false
expect(obj.errors[attr.to_sym].size).to eq 1
end