Skip to content

Instantly share code, notes, and snippets.

Nick Wellnhofer nwellnhof

Block or report user

Report or block nwellnhof

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
nwellnhof / xml2md.xsl
Last active Sep 2, 2018
Transform the cmark XML format back to Commonmark
View xml2md.xsl
<?xml version="1.0" encoding="UTF-8"?>
This XSLT stylesheet transforms the cmark XML format back to Commonmark.
Since the XML output is lossy, a lossless MD->XML->MD roundtrip isn't
possible. The XML->MD->XML roundtrip should produce the original XML,
View improve-locking-v2.diff
diff --git a/core/Lucy/Index/FilePurger.c b/core/Lucy/Index/FilePurger.c
index 211f0ea..6daa805 100644
--- a/core/Lucy/Index/FilePurger.c
+++ b/core/Lucy/Index/FilePurger.c
@@ -234,7 +234,10 @@ S_delete_entry(Folder *folder, String *folder_entry) {
Folder *inner = Folder_Local_Find_Folder(folder, folder_entry);
if (inner == NULL) { return false; }
if (Folder_is_a(inner, COMPOUNDFILEREADER)) {
- inner = CFReader_Get_Real_Folder((CompoundFileReader*)inner);
+ CompoundFileReader *cf_reader = (CompoundFileReader*)inner;
View cmark_ext_can_contain.c
// Add two functions `can_contain` and `can_be_contained` to the
// node type metaobject. (This is just an example. It's possible
// to split the work between these two functions differently.)
struct cmark_ext_node_type {
cmark_syntax_extension *extension;
char *name;
void (*free)(cmark_node *node);
// Used to check document structure.
View cfish_interfaces_java_style.c
// Interface method stub. Needs a custom struct for arguments and return value
// of each interface method.
typedef void
(*cfish_interface_stub_t)(void *self, void *vargs, uint32_t *hash);
// Classes contain a fixed-size hashtable with pointers to interface method
// stubs. This table could also be moved in memory before the class struct
// to avoid overhead for classes that don't implement interfaces.
typedef struct {
View abstract_method_docs.diff
diff -ru lib_old/Lucy/Analysis/CaseFolder.pod lib/Lucy/Analysis/CaseFolder.pod
--- lib_old/Lucy/Analysis/CaseFolder.pod 2015-09-19 16:51:19.000000000 +0200
+++ lib/Lucy/Analysis/CaseFolder.pod 2015-09-19 16:52:02.000000000 +0200
@@ -51,6 +51,22 @@
Constructor. Takes no arguments.
+=head1 METHODS
+=head2 transform(inversion)
View cfish_ruby_reg.c
// This is a sketch of how to make caching of Ruby objects work with
// Ruby's GC under Clownfish. We use a registry that keeps a list of all
// Ruby objects created from Clownfish. This list is walked during GC to
// mark all objects with a positive Clownfish refcount and prevent them
// from being destroyed if all references from Ruby space were dropped.
// Once a Clownfish object has been passed to Ruby, it lives on even with
// a zero Clownfish refcount. This means that there are no more references
// from Clownfish but possibly from Ruby space. The Clownfish refcount
// might even become positive again if an object is passed back to
extern crate libc;
use libc::types::common::c99::*;
use libc::types::os::arch::c95::*;
pub struct ObjInternal {
refcount: size_t,
class: *mut ObjInternal,
nwellnhof /
Created Jun 6, 2015
Proof of concept for Clownfish Rust bindings
extern crate libc;
use libc::types::common::c99::*;
use libc::types::os::arch::c95::*;
pub struct ObjInternal {
refcount: size_t,
class: *mut ObjInternal,
nwellnhof / scanners.c
Created Nov 16, 2014
scanners.c, generated by re2c, compiled on Windows 7, MinGW32, MSYS, gcc 4.8.1
View scanners.c
/* Generated by re2c on Mon Nov 17 00:09:41 2014 */
#include <stdlib.h>
#include "chunk.h"
#include "scanners.h"
int _scan_at(int (*scanner)(const unsigned char *), chunk *c, int offset)
int res;
unsigned char *ptr = (unsigned char *)c->data;
unsigned char lim = ptr[c->len];
View fc_nfkc.c
#include <stdio.h>
#include <stdlib.h>
#include "utf8proc.h"
static const int32_t codepoints[] = {
You can’t perform that action at this time.