Skip to content

Instantly share code, notes, and snippets.

@tternes
tternes / readinglist-googlebooksid-resolver.js
Created Dec 31, 2020
Simple script to resolve Google Books IDs in Reading List export files
View readinglist-googlebooksid-resolver.js
// NOTE: filenames hardcoded!
const got = require('got')
const csv = require('csv')
const fs = require('fs')
async function fetchGoogleBookId(isbn) {
const queryUrl = `https://www.googleapis.com/books/v1/volumes?q=isbn:${isbn}`
const response = await got(queryUrl)
const json = JSON.parse(response.body)
View EVIInternalLogging.m
static EVILoggingCallback s_callback = nil;
#pragma mark -
void EVILog(EVILogLevel level, NSString *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
if(s_callback)
View EVIFrameworkClass.m
- (void)start:(NSString *)queueItemId
{
// ...
EVILog(EVILogLevelInfo, @"started playing %@", queueItemId);
// ...
}
View AppDelegate.m
@implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
// ...
EVIRegisterLoggingCallback(^(EVILogLevel level, NSString *message) {
NSLog(@"EVIStreamer (%@): %@", EVILogLevelString(level), message);
});
// ...
}
View Logging-Internal.h
extern void EVILog(EVILogLevel level, NSString *fmt, ...);
View Logging-Public.h
typedef NS_OPTIONS(NSInteger, EVILogLevel)
{
EVILogLevelError,
EVILogLevelWarning,
EVILogLevelInfo,
EVILogLevelDebug,
};
typedef void(^EVILoggingCallback)(EVILogLevel level, NSString *message);
View gist:45e80f198c2f3c599ce1
clang hi.c -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -o hi
where -isysroot parameter is discovered with:
xcrun --sdk macosx10.9 --show-sdk-path
--sdk parameter possibilities:
thaddeus@pegasus:~$ xcodebuild -showsdks
OS X SDKs:
@tternes
tternes / PKDemo.m
Created Jan 18, 2015
PactolaKit Example
View PKDemo.m
BTPactolaNotificationRequest *request = [[BTPactolaNotificationRequest alloc] init];
request.deviceIdentifier = @"123456";
request.title = @"My App"
request.message = @"Something Happened!"
[request sendRequest];
View GIF-Screencast-OSX.md

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@tternes
tternes / curl.sh
Created Nov 25, 2014
Pactola Example: curl
View curl.sh
#!/bin/sh
curl -X POST --data '{"message":"Hello, Pactola"}' http://pactola.io/f1b7db32/notification