Skip to content

Instantly share code, notes, and snippets.

# == read_ch.rb
# read a character without pressing enter and without printing to the screen
# root module
module ReadCh
@@keys = {
" " => :space,
"\t" => :tab,
"\r" => :return,
"\n" => :line_feed,

Guides are just XML files, but with special tags.

Guide format:

<title>[insert title here]</title>
<tool>
  <image src="image/path" />
</tool>
<content>
Some text about the thing in quiestion here, oh here is a link to a related <guide href="modid:guide_name">thing</guide>, and here is an image: <image src="image/path" height="16" align="right" />
{
"test": "v2"
}
#!/usr/bin/env python
import math, os, re
from gimpfu import *
MERGE_MODE = 1
PATH_PREFIX = "!pth "
FILE_PREFIX = "!file "
TEXTURE_PREFIX = "!!"
REFERENCE_PREFIX = "!ref"
package thecodewarrior.soundcap;
import net.minecraftforge.common.config.Configuration;
import org.apache.logging.log4j.Logger;
import paulscode.sound.SoundSystemConfig;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
@Mod(modid = SoundCapMod.MODID, version = SoundCapMod.VERSION)
@thecodewarrior
thecodewarrior / charts.rb
Created November 10, 2016 08:23
Internet uptime tracker
#!/usr/bin/env ruby
require 'gruff'
require 'date'
require 'csv'
CALCULATE_PIXELS = true
DO_JUMP = false
MAX_PING = 500
@thecodewarrior
thecodewarrior / UIVisualEffectViewAdjuster.swift
Created February 11, 2018 23:10
An extension that allows you to freely adjust the amount of blur on a UIVisualEffectView. Tested on iOS 11.2 with Swift 4
extension UIVisualEffectView {
public var adjuster: UIVisualEffectViewAdjuster {
get {
if let adjuster = objc_getAssociatedObject( self, &UIVisualEffectViewAdjuster.key) as? UIVisualEffectViewAdjuster {
return adjuster
} else {
let adjuster = UIVisualEffectViewAdjuster(effectView: self)
objc_setAssociatedObject( self, &UIVisualEffectViewAdjuster.key, adjuster, .OBJC_ASSOCIATION_RETAIN)
return adjuster
}
@thecodewarrior
thecodewarrior / Swift Evolution Mailing List Formatter.js
Created February 20, 2018 08:36
Re-formats the angle bracket email quoting from a mailing list as actual indentation levels with nice lines. For use with TamperMonkey.
// ==UserScript==
// @name Swift-Evolution Email Formatting
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Formats the nested `>` indents of the mailing list into depth-marking lines
// @author TheCodeWarrior
// @match https://lists.swift.org/pipermail/swift-evolution/*
// @grant none
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js
// ==/UserScript==
@thecodewarrior
thecodewarrior / AssociatedValues.swift
Last active March 26, 2018 00:53
More convenient key-value observation
import Foundation
protocol AssociatedValueType: class {}
extension AssociatedValueType {
var associatedDictionary: AssociatedDictionary {
return AssociatedDictionary.associatedDictionary(for: self)
}
}
import Foundation
protocol AssociatedValueType: class {}
extension AssociatedValueType {
var associatedDictionary: AssociatedDictionary {
return AssociatedDictionary.associatedDictionary(for: self)
}
}