Skip to content

Instantly share code, notes, and snippets.

View okj579's full-sized avatar

Owen Kieffer-Jones okj579

View GitHub Profile
@okj579
okj579 / x
Created December 14, 2008 22:36
Dict.cc German-English Dictionary Ubiquity Command
CmdUtils.CreateCommand({
name: "dictcc",
author: {name: "Owen", email: "okj579@gmail.com"},
icon: "http://www.dict.cc/favicon.ico",
description: "Translates between English and German using the http://www.dict.cc dictionary.<br>Übersetzt ins Englisch und Deutsch mit das http://www.dict.cc Wörterbuch.",
help: "Type a word in German or English to get multiple translations. Press enter to go to the dict.cc page. Try 'dictcc hello'<br>Tippen Sie ein Wort auf Deutsch oder Englisch mehrfach Übersetzungen zu sehen. Tippen Sie die Eingabetaste zu die dict.cc Seite zu gehen. Versuchen Sie 'dictcc hallo'",
takes: {"word": noun_arb_text},
preview: function(preview, input) {
preview.innerHTML = "Translates between English and German<br>Übersetzt ins Englisch und Deutsch";
@okj579
okj579 / queue-proxy.js
Last active January 11, 2018 16:40
Queue Proxy
function makeQueueProxy(name){
if (window[name] === undefined) {
var queue = [];
// When function is called, add to queue
function proxy() {
queue.push([this, Array.prototype.slice.apply(arguments)]);
}
window[name] = proxy;
@okj579
okj579 / tampermonkey.partyparrot.user.js
Last active September 17, 2020 15:04 — forked from froxxxy/tampermonkey.partyparrot.js
Tampermonkey userscript to get the party started with some parrots on any website! ;)
// ==UserScript==
// @name party parrot - PARTY OR DIE
// @namespace https://github.com/jmhobbs/cultofthepartyparrot.com
// @version 0.3.1
// @description There's no parrot like party parrot!
// @author cuidas
// @match http://*/*
// @match https://*/*
// @downloadURL https://raw.githubusercontent.com/imosnet/userscripts/master/tampermonkey.partyparrot.user.js
// @grant none
@okj579
okj579 / snippets.js
Last active September 27, 2018 09:50
var esLevel = function(){try{return eval('(x=>6)()')}catch(e){return Array.isArray?5:3}}();
(function(k,o,n,a,m,i){addEventListener('keydown',function(e){e.which!=k[o]?o=0:++o==k.length&&n()})})([38,38,40,40,37,39,37,39,66,65],0,function(){
// Do something
});
(function(j,Q,u,e,r,y){if(j[u])return r(j[u]);y=Q.createElement('script');y.onload=function(){r(j[u].noConflict(true))};y.src=e;Q.head.appendChild(script)})
(window,document,'jQuery','https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js',function($){
// $ available here
});
// ==UserScript==
// @name imos auto-scroll
// @version 0.2
// @match https://www.imos.net/
// @downloadURL https://gist.github.com/okj579/a52357ad2c6e6d1bfd6079ce45b07bca/raw/imos-autoscroll.user.js
// @grant none
// ==/UserScript==
setInterval(function(){
var $a = $('.menu-custom_start_fragment li.active + li > a');
$.fn.asyncEach = function(fn, maxDuration) {
var maxDuration = typeof maxDuration === 'undefined' ? 100 : maxDuration,
elems = Array.prototype.slice.apply(this),
i = 0;
var interval = setInterval(function() {
var end = Date.now() + maxDuration;
while (i < elems.length) {
if (fn.apply(elems[i]) === false) {
clearInterval(interval);
return;
@okj579
okj579 / utils.js
Last active September 13, 2018 09:31
var requestAnimationFrame = (
window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
function(fn) { return setTimeout(fn, 1000/60); }
),
animationLoop = function next(fn, immediate) {
immediate && (fn() === false) || requestAnimationFrame(next.bind(null, fn, true));
};
@okj579
okj579 / hotkey.js
Created February 26, 2018 09:33
Vanilla-JS Hotkeys
function hotkey(hotkeys, fn) {
hotkeys = hotkeys.split(' ');
function test(testObj, e) {
if (testObj.key !== e.key.toLowerCase()) return false;
for (var key in testObj) if (key !== 'key' && testObj[key] !== e[key]) return false;
return true;
}
var tests = hotkeys.map(function(hotkey){
var testObj = {
shiftKey: false,
@okj579
okj579 / cookie.js
Last active July 8, 2020 07:34
Code-golfed (240B) cookie library