Skip to content

Instantly share code, notes, and snippets.

View boxmein's full-sized avatar

Johannes Kadak boxmein

View GitHub Profile
@boxmein
boxmein / PastebinFetch.java
Created May 17, 2012 13:20
Connects to Pastebin and crops out the paste content via looking for HTML tags. Use as add-on class.
/** Connects to Pastebin and receives a paste's content through cutting the received string with some HTML tags that
* Pastebin uses to store its content.
*
*
*
*
*/
import java.io.*; // Used to read the content of the URL stream
import java.net.*; // Used to connect to the Internet and create a stream
@boxmein
boxmein / dark.less
Created May 21, 2012 21:47
Stylesheet for The Powder Toy's web site powdertoy.co.uk. I'll keep it updated less and less, please use https://github.com/boxmein/UserEdits/blob/master/userstyles/powdertoy.co.uk/tpt-redo-dark.css
/**
* The Powder Toy style re-write in LESS.
* Uses pattern from noqta.it
* 2012: boxmein. Remixing allowed, but credit is needed.
*
* To stylers: hope you won't get a headache reading this code.
* In redo progress, new front page and all :O
*
* Please use https://github.com/boxmein/UserEdits/blob/master/userstyles/powdertoy.co.uk/tpt-redo-dark.less for the latest, this won't be updated as much.
@boxmein
boxmein / irc-bot.bat
Last active December 11, 2015 18:49
An IRC bot in Javascript which uses node.js. Incomplete.
@echo off
:a
cls
node irc-bot.js
echo Fix me!
pause
goto a
@boxmein
boxmein / gist:4732285
Last active December 12, 2015 06:49
Contains the four generated files for The Powder Toy's build. As of 24 September 2013.
// ElementClasses.h
// This file is automatically generated by generator.py
#ifndef ELEMENTCLASSES_H
#define ELEMENTCLASSES_H
#include <vector>
#include "simulation/Element.h"
@boxmein
boxmein / jenn4bot.lua
Last active December 13, 2015 18:18
IRC bot in Lua using luasocket for http://tpt.io/@jenn4
require "socket"
--[[ Configuration ]]--
__DEBUG = true -- USE THIS!
serv = "chat.eu.freenode.net"
nick = "jenn4|luabot"
user = nick
mode = "0"
realname = "jenn4|luabot"
channels = "#jenn4,#powder-bots" -- You can stack channels like #ch1,#ch2 NO SPACES!
prefix = "!!" -- Careful to make sure both of those are replaced
@boxmein
boxmein / generator.py
Last active December 14, 2015 14:49
For jacob1
import re, os, shutil, string
def generateElements():
elementClasses = dict()
baseClasses = dict()
elementHeader = """#ifndef ELEMENTCLASSES_H
#define ELEMENTCLASSES_H
#include <vector>
@boxmein
boxmein / boxmini.js
Last active December 15, 2015 15:18
A small IRC bot which has a weird command syntax, no helps or command names, and it's quick. :D
/*jslint node: true */
/*
A really small and lightweight IRC bot
Made from pieces of NodeIRCBot (http://github.com/boxmein/NodeIRCBot/)
Features:
1. Commands are numbered, but have a prefix character
2. Output logging levels
3. Sandboxed Javascript handling (1)
*/
@boxmein
boxmein / tumblr-theme-adjust-columns.html
Created March 31, 2013 19:53
An adjusted Tumblr theme made for Johan, the things changed should be (1) the links won't hide, and (2) the blog has 4 columns
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!--
Genevo Theme by lsaac.tumblr.com
1: Modified for 4 columns (1080px width) by punanekleeps.tumblr
(Line 141, #content.posts CSS)
2: Disabled the link box hiding thing. As much of an effect it gives, links are fun.
(Lines 17..23, $(document).ready Javascript)
Feel free to customise the theme as much as you like but please rememeber to leave at least one credit link, thank you :-)
@boxmein
boxmein / magicaljs.js
Last active December 16, 2015 02:49
Rewrites TPT quoting to a minimal and much more 'embedded' kind of quote. It isn't huge and it combines the reply function as well, also reducing markup.
/*jshint browser: true, jquery: true */
/*global GetQuote*/
function getSelectionHtml() {
var html = '';
if (typeof window.getSelection != 'undefined') {
var sel = window.getSelection();
if (sel.rangeCount) {
var container = document.createElement('div');
for (var i = 0, len = sel.rangeCount; i < len; ++i) {
container.appendChild(sel.getRangeAt(i).cloneContents());
@boxmein
boxmein / tpt_forum_markdown.js
Created May 2, 2013 17:49
The Powder Toy forum now supports Markdown input! (Not all tags supported. Be wary of speed death.)
// ==UserScript==
// @id powdertoy.co.uk-f7ac10f4-5ccd-4504-94e8-60ac371ac11a@boxmein.web44.net
// @name TPT Markdown inputs
// @version 1.1.2
// @namespace boxmein.web44.net
// @author boxmein
// @description Makes an addition to TPT forum's comment text box for a 'semi-WYSIWYG' textbox via Markdown. Some tags might not work!
// @include http://powdertoy.co.uk/*
// @run-at document-end
// ==/UserScript==