Skip to content

Instantly share code, notes, and snippets.

View lyonanderson's full-sized avatar

Christopher Lyon Anderson lyonanderson

View GitHub Profile
#!/bin/bash
set -e
CONTENTS=$(tesseract -c language_model_penalty_non_dict_word=0.8 --tessdata-dir /usr/local/share/tessdata/ "$1" stdout -l eng | xml esc)
hex=$((cat <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
@pitbulk
pitbulk / gist:ff028a9ba472ed810e54a976d583ef88
Last active October 3, 2023 03:13
Magento 2 - Default Country Code list
AF - Afghanistan
AX - Åland Islands
AL - Albania
DZ - Algeria
AS - American Samoa
AD - Andorra
AO - Angola
AI - Anguilla
AQ - Antarctica
AG - Antigua &amp; Barbuda
@mackuba
mackuba / wwdc16.md
Last active March 5, 2023 21:28
New stuff from WWDC 2016

Following the tradition from last year, here's my complete list of all interesting features and updates I could find in Apple's OSes, SDKs and developer tools that were announced at this year's WWDC. This is based on the keynotes, the "What's New In ..." presentations and some others, Apple's release notes, and blog posts and tweets that I came across in the last few weeks.

If for some reason you haven't watched the talks yet, I really recommend watching at least the "State of the Union" and the "What's New In" intros for the platforms you're interested in. The unofficial WWDC Mac app is great way to download the videos and keep track of what you've already watched.

If you're interested, here are my WWDC 2015 notes (might be useful if you're planning to drop support for iOS 8 now and start using some iOS 9 APIs).


OSX → macOS 10.12 Sierra

@Catfish-Man
Catfish-Man / sethack.m
Created March 11, 2016 06:21
Demonstrating the trick of using stack-allocated mimics and sets for lookup tables instead of heap allocated keys and dictionaries
// Compile with clang -framework Foundation sethack.m
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
/*
CFHashBytes from http://www.opensource.apple.com/source/CF/CF-1153.18/CFUtilities.c
*/
#define ELF_STEP(B) T1 = (H << 4) + B; T2 = T1 & 0xF0000000; if (T2) T1 ^= (T2 >> 24); T1 &= (~T2); H = T1;
@BenjyWiener
BenjyWiener / Add Screen Recorder Button.py
Last active September 15, 2017 08:06
Screen recorder for Pythonista
# coding: utf-8
from objc_util import *
from ReplayKit import *
from console import alert
import ui
UIBarButtonItem = ObjCClass('UIBarButtonItem')
def main():
@palaniraja
palaniraja / wwdc-2015-pdf.txt
Created June 16, 2015 10:01
WWDC 2015 - PDF download links
http://devstreaming.apple.com/videos/wwdc/2015/217wu453thu1r1/217/217_adopting_new_trackpad_features.pdf?dl=1
http://devstreaming.apple.com/videos/wwdc/2015/2267p2ni281ba/226/226_advanced_nsoperations.pdf?dl=1
http://devstreaming.apple.com/videos/wwdc/2015/233l9q8hj9mw/233/233_advanced_touch_input_on_ios.pdf?dl=1
http://devstreaming.apple.com/videos/wwdc/2015/224o6pqmtb4ik/224/224_app_extension_best_practices.pdf?dl=1
http://devstreaming.apple.com/videos/wwdc/2015/2048w4vdjhe1i1m/204/204_apple_watch_accessibility.pdf?dl=1
http://devstreaming.apple.com/videos/wwdc/2015/232f1zopzycv/232/232_best_practices_for_progress_reporting.pdf?dl=1
http://devstreaming.apple.com/videos/wwdc/2015/213w6grumlfm0q/213/213_building_apps_with_researchkit.pdf?dl=1
http://devstreaming.apple.com/videos/wwdc/2015/234reaz1byqc/234/234_building_document_based_apps.pdf?dl=1
http://devstreaming.apple.com/videos/wwdc/2015/2313dt427pmq/231/231_cocoa_touch_best_practices.pdf?dl=1
http://devstreaming.apple.com/videos/wwdc/2015/209c9277tttlt9
@0xced
0xced / uncruftapidiff.m
Created June 18, 2014 22:17
Uncruft iOS 8.0 and OS X 10.10 API diffs
//
// Copyright (c) 2014 Cédric Luthi “0xced”
//
// ./uncruftapidiff https://developer.apple.com/library/prerelease/ios/releasenotes/General/iOS80APIDiffs/index.html iOS8_0APIDiffs.html
// ./uncruftapidiff https://developer.apple.com/library/prerelease/mac/documentation/General/Reference/APIDiffsMacOSX10_10SeedDiff/index.html OSX10_10APIDiffs.html
//
#import <Foundation/Foundation.h>
#import <sysexits.h>
- (void)testRelativeURLs {
PSPDFDocument *document = [[PSPDFTestAssetLoader new] documentWithName:@"Testcase-relative-links.pdf"];
NSArray *annotations = [document annotationsForPage:0 type:PSPDFAnnotationTypeLink];
PSPDFLinkAnnotation *link = annotations[0];
NSString *const referenceString = @"Testcase-relative-links/Simple.txt";
XCTAssertEqualObjects(link.URL.absoluteString, referenceString, @"URL should be correct");
PSPDFViewController *pdfController = [[PSPDFViewController alloc] initWithDocument:document];
__block NSURL *showPreviewURL = nil;
@landonf
landonf / nx.scala
Last active August 29, 2015 13:56
NX macro example
/**
* Private implementation of the nx macro; rather than triggering compilation errors,
* it simply returns the result of the validation.
*
* Example usage:
*
* {{{
* val unhandledExceptions: Set[Class[_ <: Throwable]] = NX.check {
* java.inet.InetAddress.getByName("some host")
* }
@henryiii
henryiii / installsympy.py
Last active August 29, 2015 13:56
installsimpy
# Install SimPy
import urllib
import tarfile
import shutil
import console
import os
name = 'sympy'
version = '0.7.5'