Skip to content

Instantly share code, notes, and snippets.

@mingodad
mingodad / fts3-compress-column.diff
Created September 24, 2018 13:43
Here is the diffs to an implementation of "notcompressed" option for columns in fts3/4 in sqlite3
Index: ext/fts3/fts3.c
==================================================================
--- ext/fts3/fts3.c
+++ ext/fts3/fts3.c
@@ -851,11 +851,12 @@
}else{
zFree = zFunction = fts3QuoteId(zFunc);
}
fts3Appendf(pRc, &zRet, "docid");
for(i=0; i<p->nColumn; i++){
#!/usr/bin/perl
# This filter changes all words to Title Caps, and attempts to be clever
# about *un*capitalizing small words like a/an/the in the input.
#
# The list of "small words" which are not capped comes from
# the New York Times Manual of Style, plus 'vs' and 'v'.
#
# 10 May 2008
# Original version by John Gruber:
@madrobby
madrobby / gist:8dc43c58114466d6a894
Created June 24, 2014 12:20
Code to prevent drag/drop in a Webview inside a Mac app. You can throw this in a `<script>` tag first thing inside the `<body>`. Users will no longer be able to accidentally break your app by dropping something (like a web page URL) onto it.
document.addEventListener('dragover', function(e){
e.preventDefault();
e.stopPropagation();
}, false);
document.addEventListener('drop', function(e){
e.preventDefault();
e.stopPropagation();
}, false)
@matej
matej / CALayer+MBAnimationPersistence.h
Last active February 16, 2023 18:43
Persists (pauses) layer animations (including UIView animation generated animations) when the application enters into background and restores (resumes) animations from where they left off upon returning from background.
//
// CALayer+MBAnimationPersistence.h
//
// Created by Matej Bukovinski on 19. 03. 14.
// Copyright (c) 2014 Matej Bukovinski. All rights reserved.
//
#import <QuartzCore/QuartzCore.h>
@eternalstorms
eternalstorms / NSSharingServicePicker+ESSSharingServicePickerMenu.h
Created November 22, 2012 18:50
A category on NSSharingServicePicker to create a menu that can be used as a sharing submenu or main menu
//
// NSSharingServicePicker+ESSSharingServicePickerMenu.h
//
// Created by Matthias Gansrigler on 22.11.12.
// Copyright (c) 2012 Eternal Storms Software. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface NSSharingServicePicker (ESSSharingServicePickerMenu)
@rsms
rsms / HUTF8MappedUTF16String.h
Created November 26, 2010 14:41
Convert a UTF-16 string to UTF-8, mapping indices to provide low-complexity range and index lookups
#ifndef H_UTF8_MAPPED_UTF16_STRING_H_
#define H_UTF8_MAPPED_UTF16_STRING_H_
#import <Foundation/Foundation.h>
#import <string>
/*
* Convert a UTF-16 string to UTF-8, mapping indices to provide low-complexity
* range and index lookups.
*