Skip to content

Instantly share code, notes, and snippets.

fs.readdir(`./plugins`, (err, plugins) => {
if(err) {
console.log(`Error reading plugins folder: ${err}`);
}
webview.addEventListener('did-navigate', (event) => {
plugins.forEach((plugin) => {
const pluginSettings = require(`../plugins/${plugin}/settings.json`);
fs.readFile(`./plugins/${plugin}/plugin.js`, 'utf8', (err, code) => {
if(err) {
console.log(`Error loading plugin (${plugin}): ${err}`);
@xbenjii
xbenjii / tabReply.js
Last active March 4, 2016 13:48
Tab Reply
const input = $('#input');
const yourName = $('#active-user .avatar img').attr('title').replace(/\s/g,"");
const mention = `@${yourName}`;
$(document).on('keydown', (e) => {
if(e.which === 9) {
if($('#autocomplete').children().length) {
return false;
}
e.preventDefault();
import { createSocket } from 'dgram'
import { lookup } from 'dns';
const IPRe = /^\d+\.\d+\.\d+\.\d+$/;
const IPPortRe = /^\d+\.\d+\.\d+\.\d+\:\d+$/;
class Qry {
constructor(options) {
this.options = Object.assign({
bindAddress: 1337
const parseNode = (node) => {
if( node.classList && node.classList.contains('user-container') ) {
let meta = node.querySelectorAll('.meta');
[].forEach.call(meta,m=>{
let del = document.createElement('span');
del.textContent = 'x';
del.classList.add('vote-count-container');
del.style.cursor = 'pointer';
del.onclick = function() { // fuck you I want `this`
let id = this.parentNode.parentNode.id.split('-')[1];
@xbenjii
xbenjii / TinyEE.js
Created February 6, 2017 11:55
Tiny Event Emitter
/**
* TinyEE - A tiny event emitter using Map.
*/
class TinyEE {
constructor() {
// Where we will store the events
this.events = new Map();
}
on(eventName, action) {
if(typeof action !== 'function') {
@xbenjii
xbenjii / browser.js
Last active February 1, 2021 20:15
// fW+NNwPWJCU5rMf3YZk6pwoFYY5CbwSbds3ZKjeDySwIcSouJ5G1qOn/jceAZry4+EeXjwNb1m+T/U8kecXpZ1U4HY46Mu3YYDsiMqjHNTZXThp5cMpAclX3MkBqEgEfllC8l7rajcrBkeo65joj10w2oI+8mFJ8S1MWnxQOP/IOZzl+OI7/Rr0HdwZ7LhilLc81RW0EbyTljX+7jRtLYQnzaC3NA8llhPTv74dPFfAYLw30/ntojO3tyUHJoTHKxLr+9+6xGJODSU7RCfRU6s4zw3OgBXX1XxFTlhhHC1DIhOZf1b1vxn6EsTOLX3wKShcEJSHbcz9BvI06hAp8vw==
/**
** Copyright (C) 2000-2015 Opera Software AS. All rights reserved.
**
** This file is part of the Opera web browser.
**
** This script patches sites to work better with Opera
** For more information see http://www.opera.com/docs/browserjs/
**
** If you have comments on these patches (for example if you are the webmaster
@xbenjii
xbenjii / podio_calendar_enable.user.js
Created October 19, 2018 14:30
Enable podio calendar past 6 months
// ==UserScript==
// @name Podio Re-enable calendar
// @namespace https://www.prestigegifting.co.uk
// @version 0.1
// @description Podio has limited the calendar to 6 months, this re-enables it.
// @author Benjamin Fortune <ben@prestigegifting.co.uk>
// @match https://podio.com/calendar
// @grant none
// ==/UserScript==