Skip to content

Instantly share code, notes, and snippets.

@rquast
rquast / attached.js
Created July 9, 2017 01:05 — forked from peisenmann/attached.js
Aurelia custom attribute to invoke a callback when an element gets added to the dom. Demo: http://plnkr.co/edit/fguuz4
import {customAttribute, bindable, LogManager} from 'aurelia-framework';
const logger:Logger = LogManager.getLogger("attached");
/**
* MIT License. Patrick Eisenmann.
* Apply this attribute to an element to have a callback invoked when the element added to the DOM
*
* @param {Function} callback. Required. The function to be invoked.
* The first argument to the callback is the Element that had the attached on it.
@rquast
rquast / index.md
Created June 21, 2017 00:30 — forked from andris9/index.md
Retrieve UDP logs from ZoneMTA

Step 1. Install MessagePack module

ZoneMTA emits logs over UDP in MessagePack format, so a MessagePack parser is needed to read log messages

npm install msgpack-js

Step 2. Update MTA config

Edit your ZoneMTA application config to activate remote UDP logging. Add remote to the log section. Port and host should point to the server where logger.js app is running.

@rquast
rquast / config.json
Created June 20, 2017 13:20 — forked from andris9/config.json
ZoneMTA DKIM plugin example
{
"plugins": {
"dkim": {
"enabled": "sender",
"domain": "example.com",
"selector": "test",
"path": "/path/to/private/key.pem"
}
}
}
<?php
class FastSpringAPIClient {
const USER_AGENT = 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)';
function __construct() {
}
/**
* Observe the DOM for changes to find new Cavy topics.
*/
var observeDOM = (function() {
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver,
eventListenerSupported = window.addEventListener;
return function(obj, callback) {
if (MutationObserver) {
attached() {
this.fu = new qq.FineUploaderBasic({
// button: document.getElementById('uploadButton'),
request: {
endpoint: '/api/upload',
inputName: 'qqfile'
},
validation: {
// acceptFiles: ['image/jpeg', 'image/jpg', 'image/png', 'application/pdf'],
// allowedExtensions: ['jpeg', 'jpg', 'pdf', 'png'],
@rquast
rquast / file-drop.js
Created May 11, 2017 12:52
FileDrop
export class FileDrop {
dragoverListener = undefined;
dropListener = undefined;
el = undefined;
constructor(el) {
this.el = el;
}
.. snip ...
installPushStateEvents() {
this.router.pushState.actions.set('ChangeState', (state) => {
if (state['StateTabOpen'] === 'hide' || !state['StateTabOpen']) {
this.closeTab();
} else if (state['StateTabOpen']) {
this.openTab(state['StateTabOpen']);
}
if (state['StateTopicID'] && state['StateTopicID'] !== this.topicState.currentTopicId) {
@rquast
rquast / About.txt
Created February 20, 2017 01:09 — forked from Manouchehri/About.txt
OSX app menu compatibility shim for JDK 9 EA releases
Abstract:
Hooks existing preferences/about/quit functionality from an existing Java app into handlers for the Mac OS X application menu.
Tailored to provide compatibility with the Java 9 EA releases so that the app may be built on other platforms. Note that there
is no compatibility with Java 8, though all that is required is to change java.awt.desktop -> com.apple.eawt in all handler methods
This work was inspired by an OSX compatibility layer provided by Apple that used a different API. This is an otherwise original
contribution and is a reimplementation using newer interface methods.
Usage: