Skip to content

Instantly share code, notes, and snippets.

View irisfofs's full-sized avatar

Iris irisfofs

View GitHub Profile
@irisfofs
irisfofs / mappings.json
Last active February 6, 2016 19:04
Script to run through a media library (in iTunes XML format) and combine duplicates (add play counts together).
{
"mappings": {
"file://localhost/X:\\music\\CLOVER STUDIO - 大神 オリジナル・サウンドトラック [Disc 1]": "file://localhost/X:\\music\\Okami OST [Disc 1]",
"file://localhost/X:\\music\\CLOVER - Okami Original Soundtrack [Disc 2]": "file://localhost/X:\\music\\Okami OST [Disc 2]",
"file://localhost/X:\\music\\CLOVER STUDIO - Okami Original Soundtrack Disc 3": "file://localhost/X:\\music\\Okami OST [Disc 3]",
"file://localhost/X:\\music\\CLOVER STUDIO - Okami Original Soundtrack [Disc 4]": "file://localhost/X:\\music\\Okami OST [Disc 4]",
"file://localhost/X:\\music\\Masami Ueda [上田雅美] - Okami Original Soundtrack [大神]": "file://localhost/X:\\music\\Okami OST [Disc 5]"
}
}
@irisfofs
irisfofs / example.json
Created September 20, 2015 19:50
Sample badge JSON for the autoloader
{
"badgeTypeString": "Press Badge",
"badgePaymentType": "Comp",
"badges": [["Firstname Lastname","Badge name","[email protected]"],["Joe Smith","Joe","[email protected]"]]
}
@irisfofs
irisfofs / solver.rb
Last active December 6, 2015 20:37
Advent of Code day 3 parts 1 and 2
class HouseLocation
DIRS = "^>v<"
attr_accessor :x, :y
def initialize(x = 0, y = 0)
@x = x
@y = y
end
@irisfofs
irisfofs / _rp.scss
Created January 18, 2016 05:14
WIP inset box shadow for OOC lines
#log p.ooc {
background: #222;
padding: .5em;
margin-left: -1em;
margin-right: -1em;
box-shadow: inset 0em 0em 4px 0px #000;
}
#log p.ooc + p.ooc {
margin-top: -2.5em;
@irisfofs
irisfofs / tree output.txt
Created January 24, 2016 01:00
The generated site scaffold for a new Jekyll::RpLogs site
.
├── arcs.html
├── _config.yml
├── _config.yml.default
├── css/
│   └── main.scss*
├── Gemfile
├── Gemfile.lock
├── _includes/
│   ├── footer.html
@irisfofs
irisfofs / rp_tags.rb
Created February 5, 2016 18:19
Alternate Tag#<=> implementation
##
# Compares two tags. Character tags are less than meta tags, and meta
# tags are less than general tags. Two tags of the same type are compared
# by their names.
def <=>(other)
sort_order = [:character, :meta, :general]
arr = [""] * 3
other_arr = [""] * 3
# Due to quirks, the string <=> behavior vs "" is the opposite of what
# we want for comparing names. "" is the 'smallest' string. Everything
@irisfofs
irisfofs / reflog
Created March 1, 2016 18:42
leaving a commit behind
7ae0ae7 HEAD@{0}: checkout: moving from d3db4a7d4eb3394286e0ca815edc5c66d5b45120 to master
d3db4a7 HEAD@{1}: commit: Another boop
3ff7027 HEAD@{2}: checkout: moving from master to 3ff7027
7ae0ae7 HEAD@{3}: commit: Boop
3ff7027 HEAD@{4}: clone: from https://github.com/xiagu/2015-advent-of-code.git
@irisfofs
irisfofs / autocomplete.directive.js
Created March 3, 2016 16:27
Terrible workaround for weird select2 bug
// For some reason select2 interferes with the space key for multiple
// selects. It doesn't in its own examples, but it does here. This is a
// workaround to manually add a space to the input. It uses JQuery event
// delegation because the actual element that the event is triggered on
// doesn't exist at the time this gets set up.
element.parent().on('keypress', '.select2-selection', awfulSpaceHack);
element.on('$destroy', function () {
element.parent().off('keypress', '.select2-selection', awfulSpaceHack);
});
function awfulSpaceHack(evt) {
@irisfofs
irisfofs / World.java
Created March 4, 2016 18:25
Part of a 3D tower defense game I made... in 2008
import java.awt.event.*;
import java.awt.image.*;
import java.text.NumberFormat;
import java.awt.*;
import java.io.*;
import java.util.*;
import java.nio.*;
import javax.media.opengl.*;
import javax.media.opengl.glu.*;
import javax.swing.*;
@irisfofs
irisfofs / gui-completion.c
Created April 26, 2016 19:13
Snippet from Weechat's gui-completion.c. I feel like this could be rewritten with memcpy...
if (pos_start <= pos_end)
{
completion->position_replace = pos_start;
completion->base_word = malloc (pos_end - pos_start + 2);
for (i = pos_start; i <= pos_end; i++)
{
completion->base_word[i - pos_start] = data[i];
}
completion->base_word[pos_end - pos_start + 1] = '\0';
}