Skip to content

Instantly share code, notes, and snippets.

@krusynth
krusynth / Kru_AirshipEvents.js
Created May 9, 2017 18:59
A plugin for RPG Maker MV to allow airships to interact with events.
//=============================================================================
// Airship Events
// Version: 1.0.0
//=============================================================================
var Imported = Imported || {};
Imported.Kru_AirshipEvents = "1.0.0";
//=============================================================================
/*:
* @plugindesc 1.0.0 Allows airships to interact with events.
*
@krusynth
krusynth / Kru_ClearMapPhotos.js
Last active May 2, 2017 01:51
A plugin for RPG Maker MV to remove all photos from the map on load. This is useful when using parallax images for maps.
//=============================================================================
// Clear Map Photos
// Version: 1.0.0
//=============================================================================
var Imported = Imported || {};
Imported.Kru_ClearMapPhotos = "1.0.0";
//=============================================================================
/*:
* @plugindesc 1.0.0 Clear Map Photos - Remove photos from the map on load.
*
@krusynth
krusynth / dataTables_patch.js
Created January 13, 2015 04:00
dataTables.js requires you to have "good" tables. If your table has an uneven number of columns per row, and you're getting the dreaded " Cannot read property 'mData' of undefined " this will fix it.
// dataTables.js is great! But it requires you to have "good" tables in
// the first place. If your table has an uneven number of columns per
// row, and you're getting the dreaded "Cannot read property
// 'mData' of undefined" this'll fix it. If you're missing a thead or
// tbody you'll get that error too - this won't fix that!
$(document).ready(function() {
// We need to make sure every row in our table has the same number of columns.
// Otherwise dataTable doesn't work.
$('table').each(function(i, elm) {
@krusynth
krusynth / vegan_potato_salad
Created November 19, 2014 01:47
Vegan Potato Salad
To celebrate the fourth, here's Bill's Vegan Potato Salad! (Gluten free as well!) Super creamy and delicious, almost makes you think you're eating the dairy-thing. Makes about 8-10 servings, depending on your appetite.
Red Potatoes 5 lbs
Dill, finely chopped 1/4 Cup
Olive oil 1/2 Cup
Rice Vinegar 1/2 Cup
Sea Salt 1 teaspoon
Black Pepper, fresh ground (a dash)
Wash and prep the potatoes, leaving the skins on, and cut into 1/2 inch cubes. Throw them into a large pot with salted water, and boils for 30 minutes.
While the potatoes are cooking, remove the stalks from your dill and chop a fistful or so, to yield 1/4 cup.
After the potatoes are done cooking, drain with a large colander. At this point, you can either put them in the refrigerator to cool, or speed up the process by dipping them into an ice bath. After they've cooled, dab off any extra water with a paper towel.
@krusynth
krusynth / compareDocumentPosition.js
Created September 10, 2014 20:24
Polyfill for compareDocumentPosition if you need that for old IE or something. But you could probably just use .contains() too.
function compareDocumentPosition(thisNode, other) {
function recursivelyWalk(nodes, cb) {
for (var i = 0, len = nodes.length; i < len; i++) {
var node = nodes[i];
var ret = cb(node);
if (ret) {
return ret;
}
if (node.childNodes && node.childNodes.length) {
var ret = recursivelyWalk(node.childNodes, cb);

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

@krusynth
krusynth / annotator-madison.js
Created January 9, 2014 19:06
Using binding to add parameters to a function
Annotator.Plugin.Madison = function(element, options){
this.options = options;
}
$.extend(Annotator.Plugin.Madison.prototype, new Annotator.Plugin(), {
events: {},
options: {},
pluginInit: function(){
this.annotator.viewer.addField({
load: load_fn.bind(this, user)
@krusynth
krusynth / class.Law.inc.php
Created December 30, 2013 00:30
Possible fix for linking to non-numbered sections.
<?php
/**
* The Law class, for retrieving data about individual laws.
*
* PHP version 5
*
* @license http://www.gnu.org/licenses/gpl.html GPL 3
* @version 0.8
* @link http://www.statedecoded.com/
@krusynth
krusynth / clearsolr.sh
Created November 8, 2013 15:43
Clear solr on localhost. Throw this in your .bash_profile or .bashrc and use `clearsolr *instancename*`
clearsolr() {
curl http://localhost:8983/solr/$1/update -H "Content-type: text/xml" --data-binary '<delete><query>*:*</query></delete>'
curl http://localhost:8983/solr/$1/update -H "Content-type: text/xml" --data-binary '<commit />'
curl http://localhost:8983/solr/$1/update -H "Content-type: text/xml" --data-binary '<optimize />'
curl http://localhost:8983/solr/$1/update -H "Content-type: text/xml" --data-binary '<commit />'
}
@krusynth
krusynth / tasklist.md
Created October 29, 2013 01:25
Task List Test
  • List I
    • Thing To Do
    • Another Thing To Do
    • This one has sub-items
      • HALP I AM BROKEN
      • ME TOO
    • Totes OK
  • List II
    • But if I do this
  • This works fine