Skip to content

Instantly share code, notes, and snippets.

View boxmein's full-sized avatar

Johannes Kadak boxmein

View GitHub Profile
@boxmein
boxmein / index.html
Last active December 19, 2015 08:09
WebSocket can be used for good and for bad. Here's the bad. :(
<!--
- Socket.io-powered WebSocket utilizing control module!
-
- * Sample index page for the implementation.
-
- by boxmein 2013, the code is free to use
- Socket.io Copyright(c) 2011 LearnBoost <[email protected]> MIT Licensed
-->
@boxmein
boxmein / rpn.py
Created June 17, 2013 00:04
HexChat/xchat plugin for inline reverse polish notation. The RPN part is unfinished.
import xchat, re, threading
__module_name__ = "RPN"
__module_description = "Reverse Polish Notation (/disablerpn, /enablerpn, {{rpn}})"
__module_version__ = "1.3.37"
class TimeoutError(Exception):
pass
@boxmein
boxmein / elem-ksns.lua
Last active December 18, 2015 05:09
An element for the powder toy that senses key presses and dishes out sparks accordingly.
--VER 1.1 UPDATE http://pastebin.com/raw.php?i=8Zuy6iB7
-- Keyboard sensor element
-- As per request by thread: http://tpt.io/:17012
-- Set TMP to the key code(!) to enable
-- set TMP2 (optional) to the modifier code to set modifiers
-- Use DEBUG to see the values before setting them
-- by boxmein with tremendous help from cracker64 and jacob1
@boxmein
boxmein / memory.py
Created May 22, 2013 21:17
Implementation of a card game called Memory in Python (CodeSkulptor)
# implementation of card game - Memory
# (c) 2013 boxmein
# MIT license if applicable
# prefers being run in CodeSkulptor
# Live: http://www.codeskulptor.org/#user14_m6ycUKSq7n_0.py
# (live url's last digits may change)
import simplegui, random, math
# --- Constants ---
@boxmein
boxmein / slidery.js
Created May 21, 2013 21:41
A simple wrapper to create slidy <range> elements with values attached and javascript stuff attached.
/*jshint browser: true*/
function Slider (p) {
if (!p.id)
throw new Error("Didn't pass an ID, can't do without :(");
var that = this;
var container = document.createElement("div");
container.setAttribute("class", "box-slider");
@boxmein
boxmein / pong.py
Last active December 17, 2015 08:08
A Python implementation of Pong for "Interactive Programming in Python" in Coursera.
# Requires to be played back in CodeSkulptor since
# the course requires 'simplegui'
# and the only place where it's implemented is ... guess it...
# CodeSkulptor!
# http://codeskulptor.org/ for CodeSkulptor
# http://www.codeskulptor.org/#user13_lPBkTAO6Ct_31.py for my script precisely
# the digits at the end of the URL may be subject to change (increment by one ad nauseum)
# -- 14. May 2013
# Implementation of classic arcade game Pong
@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==
@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 / 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 / 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)
*/