This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
Something I threw together to test storage abilities in different browsers. | |
This test two forms of session storages: html 5 session storages, and the window.name fallback option. | |
It also tests two forms of persistent storage: html 5 local storage and cookies. | |
Intended usage: | |
Upload the html file to your web-server. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.HashMap; | |
import java.util.Map; | |
public class FormatUrlParameters { | |
public static String printFormat(String url) { | |
Map<String, String> mapper = new HashMap<String, String>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worlds["world"] = "/home/minecraft/terranova/world" | |
renders["normalrender"] = { | |
"world": "world", | |
"title": "Normal Render of My World", | |
"rendermode": smooth_lighting, | |
"dimension": "overworld", | |
} | |
optimizeimg = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HTMLUtil { | |
// ... other code | |
public static String styleClass(String ... styleClasses) { | |
StringBuffer result = new StringBuffer(); | |
result.append("class=\""); | |
for(String styleClass: styleClasses) | |
if(styleClass != null) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
"use strict"; | |
function changeAll() { | |
wrapSpan( | |
document.getElementsByTagName('body')[0], 0 | |
); | |
} | |
/** | |
* Wrap a span element around all text nodes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String shyfy(String text, int maxWidth) { | |
int length = text.length(); | |
if(length <= maxWidth) | |
return text; | |
StringBuilder result = new StringBuilder(); | |
int wordLength = 0; | |
for(int i = 0; i < length; i++) { | |
char c = text.charAt(i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
var fonts = ["cursive", "monospace", "serif", "sans-serif", "fantasy", "default", "Arial", "Arial Black", "Arial Narrow", "Arial Rounded MT Bold", "Arial Unicode", "Bookman Old Style", "Bradley Hand ITC", "Century", "Century Gothic", "Comic Sans MS", "Courier", "Courier New", "Droid Sans", "Droid Serif", "Droid Sans Mono", "Georgia", "Gentium", "Impact", "King", "Lucida Console", "Lalit", "Modena", "Monotype Corsiva", "Papyrus", "Tahoma", "TeX", "Times", "Times New Roman", "Trebuchet MS", "Verdana", "Verona"]; | |
var $testField = $('<span>⌫</span>'); | |
for(var i = 0; i < fonts.length; i++) { | |
$clone = $testField.clone(); | |
$clone.css({ | |
'font-family': fonts[i] | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var spawn = require('child_process').spawn, | |
minecraftProcess = spawn('java', ['-jar', 'minecraft_server.1.7.2.jar'], { | |
cwd: 'Absolute path to minecraft server jar here!' | |
}); | |
var util = require("util"); | |
var irc = require('irc'); // Remember to run "npm install irc!" | |
var channel = "channel name here, remember '#' before the name!"; | |
var bot = new irc.Client("irc server here", "bot name here", { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var hex = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F']; | |
var upper = 15; | |
for(var a = 0;a<=upper;a++) { | |
for(var b = 0;b<=upper;b++) { | |
for(var c = 0;c<=upper;c++) { | |
for(var d = 0;d<=upper;d++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This checks specifically for accidental garbage by trying to delete | |
// fields in window. If it is deleteable, and it is undefined after delete | |
// it means one of two things: | |
// 1. It is a field in which you forgot to declare "var" in front | |
// 2. It is a field you have placed on global scope on purpose ("window.something =") | |
!function() { | |
var count = 0; | |
for(var f in window) { | |
if(typeof window[f] !== "function" && delete window[f] && typeof window[f] === "undefined") { |
OlderNewer