Skip to content

Instantly share code, notes, and snippets.

View Qard's full-sized avatar
👨‍💻
In an epic battle with my keyboard.

Stephen Belanger Qard

👨‍💻
In an epic battle with my keyboard.
View GitHub Profile
@Qard
Qard / userscript.js
Created December 21, 2023 07:13 — forked from fanuch/userscript.js
Block Click to Edit on Jira Issue
// ==UserScript==
// @name Disable Jira Click Edit
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Disable click edit in Jira issue descriptions
// @author fanuch
// @match https://*.atlassian.net/browse/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=atlassian.net
// @grant none
// ==/UserScript==
function betterPromise (executor) {
let args
const promise = new Promise((..._args) => {
args = _args
})
executor.apply(null, args)
return promise
$ ./configure && make test
creating ./icu_config.gypi
* Using ICU in deps/icu-small
creating ./icu_config.gypi
{ 'target_defaults': { 'cflags': [],
'default_configuration': 'Release',
'defines': [],
'include_dirs': [],
'libraries': []},
'variables': { 'asan': 0,
class Handler
def initialize
with self yield
end
def hello
puts "this should work..."
end
end
@Qard
Qard / ringo.md
Created November 22, 2013 05:13
Ringo - a self-healing, distributed storage engine built in Go, using a neighbor-coordinated ring network topology

Ringo

Ringo is a self-healing, distributed storage engine built in Go, using a neighbor-coordinated ring network topology. It is a simple key/value storage engine that more sophisticated database interfaces can layer on top of.

What is a neighbor-coordinated ring network topology?

You might be familiar with the typical ring network topology. This is a network structure where each node in a cluster has a connection to a left node and a right node. These connections form a ring.

The problem with a typical ring topology is that, if a link in the ring is broken, messages may not reach the destination. To get around this, some have created a reversible ring where any failure to send from one node to another will reverse the direction of the message and eventually it should reach the destination by looping back around the other side. This can result in terrible latency, but more importantly, it does not self-heal. If another link were to be broken, the cluster will be severed in two.

@Qard
Qard / qwry.js
Last active December 20, 2015 11:29
ActiveRecord-like query builder
var events = require('events');
var actions = [
'find'
, 'create'
, 'update'
, 'remove'
];
// These accept hashes to transform to key/val property pairs
#include "js_api.h"
// Sometimes you want to access the js "this" value in a function
// function Point(x, y) { this.x = x; this.y = y; }
bool point_constructor(js_context* C) {
js_set(C, 0, "x", 1); // this.x = arguments[0]
js_set(C, 0, "y", 2); // this.y = arguments[1]
return true; // js returns undefined, but C returns true meaning no error.
}
@Qard
Qard / gist:5711086
Created June 5, 2013 01:51
Gunzip buffers.
var JSONStream = require('JSONStream')
, zlib = require('zlib');
// With compression
var inputA = JSONStream.stringify()
, outputA = JSONStream.parse([true]);
inputA.pipe(zlib.createGzip()).pipe(zlib.createGunzip()).pipe(outputA);
outputA.on('data', function (data) {
@Qard
Qard / ab.rb
Created September 15, 2012 06:47
Formula to fix ab on OSX Lion
require 'formula'
class Ab < Formula
homepage 'http://httpd.apache.org/docs/trunk/programs/ab.html'
url 'http://www.apache.org/dist/httpd/httpd-2.4.3.tar.bz2'
sha1 '0ef1281bb758add937efe61c345287be2f27f662'
depends_on 'pcre'
def install
system './configure'
@Qard
Qard / index.js
Created April 1, 2012 13:39
Micro event dispatcher
function ev (m,e) {
m = this, e = []
m.on = function (a, b) { e.push([a,b]) }
m.emit = function (a) {
for (var i in e) e[i][0].test(a) && e[i][1].apply(m, [].slice.call(arguments, 1))
}
}