Skip to content

Instantly share code, notes, and snippets.

View tcyrus's full-sized avatar

Timothy Cyrus tcyrus

View GitHub Profile
<?php
class Rhythm {
var $length, $duration, $_prevTap, $_curTap, $_taps, $_weight;
function __construct($length = 0, $duration = 0, $_taps = array(), $_weight = 1) {
$this->length = $length;
$this->duration = $duration;
$this->_taps = $_taps;
$this->_weight = $_weight;
}
}
if (!Element.prototype.getElementByTagName) {
Element.prototype.getElementByTagName = function(selector) {
return this.getElementsByTagName(selector).item(0);
}
}
if (!HTMLDocument.prototype.getElementByTagName) {
HTMLDocument.prototype.getElementByTagName = function(selector) {
return this.getElementsByTagName(selector).item(0);
}
}
@tcyrus
tcyrus / plugin.py
Created April 26, 2017 17:32
Sigil CleanOPF for Python 3
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
# target script
import sys
import string
import uuid
import re
<?php
define('PATHINFO_ALL', (PATHINFO_DIRNAME | PATHINFO_BASENAME | PATHINFO_EXTENSION | PATHINFO_FILENAME));
/**
* Multi-byte-safe pathinfo replacement.
* Originally Taken from PHPMailer
*
* @see http://www.php.net/manual/en/function.pathinfo.php#107461
* @see https://github.com/PHPMailer/PHPMailer/blob/v6.0.5/src/PHPMailer.php#L3961-L4007
@tcyrus
tcyrus / synthesia.rb
Last active June 29, 2020 16:18
Port of grav-plugin-synthesia-data to Jekyll
require 'nokogiri'
module Jekyll
class Synthesia
def populate(page)
data_dir = page.site.source + '/files/'
doc = File.open(data_dir + page.synthesia) { |f| Nokogiri::XML(f) }
songs = doc.xpath('/SynthesiaMetadata/Songs/Song')
page.data['synthesia_data'] = songs.map do |song|
{
@tcyrus
tcyrus / standard_files.yml
Last active December 17, 2019 02:49
An attempt to standardize the Standard Files API (OpenAPI3)
openapi: 3.0.0
info:
version: "1.0.0"
title: "Standard File"
license:
name: "Apache 2.0"
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
servers:
- url: https://app.standardnotes.org/
@tcyrus
tcyrus / main.js
Last active December 13, 2018 22:16 — forked from risacher/main.js
glue to make blessed (low-level API) work in browserify with xterm.js
const blessed = require("blessed");
window.onload = function () {
const term = new Terminal({
cols: 80,
rows: 24
});
term.open(document.body);
term.write('\x1b[31mWelcome to term.js!\x1b[m\r\n');
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tcyrus
tcyrus / KbdFix.ahk
Last active May 3, 2019 00:25
KbdFix
!1::
Send {g}
return
!2::
Send {h}
return
!3::
Send {'}