Skip to content

Instantly share code, notes, and snippets.

@jjgod
jjgod / gmail.css
Created February 16, 2014 09:47
GMail Style Tweaks
div.editable {
font-family: monospace;
font-size: 100%;
}
div.Bk, .G-atb, .ha, .zE {
-webkit-font-smoothing: subpixel-antialiased !important;
background-color: #fff;
}
#!/usr/bin/env python
import os
import subprocess
import sys
# A minimal memoizing decorator. It'll blow up if the args aren't immutable,
# among other "problems".
class memoize(object):
def __init__(self, func):
@jjgod
jjgod / cldr-tool.patch
Created March 14, 2014 11:24
Patch to CLDR Java tool from unicode.org/cldr/
Index: org/unicode/cldr/icu/NewLdml2IcuConverter.java
===================================================================
--- org/unicode/cldr/icu/NewLdml2IcuConverter.java (revision 9961)
+++ org/unicode/cldr/icu/NewLdml2IcuConverter.java (working copy)
@@ -84,7 +84,8 @@
.add("filter", 'f', null, null, "Perform filtering on the locale data to be converted.")
.add("organization", 'o', ".*", null, "The organization to filter the data for")
.add("makefile", 'g', ".*", null, "If set, generates makefiles and alias files for the specified type. " +
- "The value to set should be the name of the makefile.");
+ "The value to set should be the name of the makefile.")
@jjgod
jjgod / osx-video-decoding-efficiency.markdown
Last active August 29, 2015 13:57
CPU consumption numbers for current video players on OS X
/* Example code of using harfbuzz together with Core Text APIs. */
#include <hb-coretext.h>
int main(int argc, char* argv[]) {
if (argc != 3) {
fprintf(stderr, "usage: %s <PostScript-Name> <text>\n", argv[0]);
return 1;
}
ASSERTION FAILED: !object->isSetNeedsLayoutForbidden()
../../third_party/WebKit/Source/core/rendering/RenderObject.cpp(671) : void WebCore::RenderObject::markContainingBlocksForLayout(bool, WebCore::RenderObject *, WebCore::SubtreeLayoutScope *)
1 0xd081c2d WebCore::RenderObject::markContainingBlocksForLayout(bool, WebCore::RenderObject*, WebCore::SubtreeLayoutScope*)
2 0xd15849a WebCore::RenderObject::setNeedsLayout(WebCore::MarkingBehavior, WebCore::SubtreeLayoutScope*)
3 0xcfed7c5 WebCore::RenderImage::repaintOrMarkForLayout(bool, WebCore::IntRect const*)
4 0xcfed4a0 WebCore::RenderImage::imageChanged(void*, WebCore::IntRect const*)
5 0xd093e8c WebCore::RenderObject::imageChanged(WebCore::ImageResource*, WebCore::IntRect const*)
6 0xc95a4db WebCore::ImageResource::notifyObservers(WebCore::IntRect const*)
7 0xc95b0ff WebCore::ImageResource::animationAdvanced(WebCore::Image const*)
8 0xc95b15f non-virtual thunk to WebCore::ImageResource::animationAdvanced(WebCore::Image const*)
In file included from /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/OpenGL.framework/Headers/OpenGL.h:10:
/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl.h:2765:13: error: conflicting types for 'GLES2TexImage2D'
extern void glTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
^
../../gpu/GLES2/gl2chromium_autogen.h:124:22: note: expanded from macro 'glTexImage2D'
#define glTexImage2D GLES2_GET_FUN(TexImage2D)
^
../../gpu/GLES2/gl2chromium.h:22:29: note: expanded from macro 'GLES2_GET_FUN'
#define GLES2_GET_FUN(name) GLES2 ## name
^
@jjgod
jjgod / LionOrLater.cpp
Created May 19, 2014 10:06
Test whether a system is running 10.7 or later
#define MAC_OS_X_VERSION_10_7_HEX 0x00001070
static int sOnLionOrLater = -1;
static bool OnLionOrLater()
{
if (sOnLionOrLater < 0) {
SInt32 major = 0, minor = 0;
CFURLRef url =
@jjgod
jjgod / KeychainTest.c
Last active August 29, 2015 14:02
Build with `clang -framework CoreFoundation -Wall -framework Security KeychainTest.c -o kctest`
#include <sys/param.h>
#include <Security/Security.h>
static void displayName(const void *value, void *context)
{
SecKeychainRef keychain = (SecKeychainRef) value;
UInt32 pathLength = MAXPATHLEN;
char pathName[MAXPATHLEN + 1];
SecKeychainGetPath(keychain, &pathLength, pathName);
printf(" \"%*s\"\n", (int)pathLength, pathName);
@jjgod
jjgod / fallback.m
Last active August 29, 2015 14:04
Test Core Text fallback line height.
// Compile with: clang fallback.m -framework CoreGraphics -framework CoreText -framework Foundation -o fallback
// Run with: ./fallback "Fallback Font Family" "Text to Typeset"
#import <ApplicationServices/ApplicationServices.h>
#import <Foundation/Foundation.h>
int main(int argc, char *argv[])
{
if (argc != 3)
return 0;