Skip to content

Instantly share code, notes, and snippets.


Ben Gotow bengotow

View GitHub Profile
View namespace.html
<html version="XHTML+RDFa 1.1" xmlns=""
lang="en" >
bengotow /
Last active Dec 17, 2015
Living document with information about adding the Spark Inspector framework into a RubyMotion project

###Add the Spark Inspector to a RubyMotion Project

Please give these instructions a try and let me know how it goes - it should be possible to get the Spark Inspector working. I don't own a copy of RubyMotion yet, but I identified the vendor_project options I think you'll need to include and link the Inspector's framework into your app.

UPDATE: @tbdr has confirmed that the instructions below work. Feel free to comment below if you discover issues!

UPDATE 2: @tbdr has published a gem motion-sparkinspector to make this easier. Source available

  1. Download the Spark Inspector from
bengotow / gist:9433828
Created Mar 8, 2014
Objective-C convenience methods for abstracting timing dependency
View gist:9433828
- (void)example
NSTextView * console = [self xcodeConsoleIn: IDEWindow];
NSInteger baseLength = [[console string] length] + [command length];
[_log appendFormat: @"\n Writing into console: %@", command];
[console insertText: command];
[console insertNewline:nil];
bengotow /
Last active Aug 29, 2015
A simple implementation of the authorization flow for Inbox. Presents a sign in page, and then displays the first message from the user's inbox once they've signed in.
#!/usr/bin/env python
# NOTE: This sample app does NOT use SSL. Before deploying this code to a
# server environment, you should ENABLE SSL to avoid exposing your API
# access token in plaintext.
# To run this demo app:
# 1. Save this file to your computer as ``
# 2. In the Inbox Developer Portal, create a new application. Replace the
View gist:131e51f30155efe5bd42
### Keybase proof
I hereby claim:
* I am bengotow on github.
* I am bengotow ( on keybase.
* I have a public key whose fingerprint is 74AB 1024 E78C 6F3A 12F1 D92C C034 F07C CC52 32D1
To claim this, I am signing this object:
bengotow / pong.rb
Created Aug 22, 2014
Ping back and forth between two email accounts over and over forever using Inbox
View pong.rb
#!/usr/bin/env ruby
require 'inbox'
@inbox_careless ='xdfim6g4mbduytzjhn8ud490', '80q785tt4l6qn5g07c5ylwi6a', '<<token 1>>')
@inbox_emoink ='xdfim6g4mbduytzjhn8ud490', '80q785tt4l6qn5g07c5ylwi6a', '<<token 2>>')
emoink = @inbox_emoink.namespaces.first
careless = @inbox_careless.namespaces.first
while true do
bengotow / app.js
Created Aug 7, 2015
concurrency - rolling average
View app.js
var Promise = require('bluebird');
var request = Promise.promisify(require('request'));
var fs = require('fs');
global.Nylas = require('nylas').config({
appId: '1',
appSecret: '2',
apiServer: ''
View Signature config.cson
"<ACCOUNT ID>": "<br>Test User<br>XXX-XXX-XXXX<br>"
bengotow / Comparison.txt
Created Mar 17, 2016
Comparison of SQL Approaches for Counting Threads
View Comparison.txt
Option A: Two Subqueries
`Thread-Category`.`value` as category_id,
COALESCE((SELECT unread FROM `Thread-Counts` WHERE category_id = `Thread-Category`.`value`), 0) + SUM(unread) as unread,
COALESCE((SELECT total FROM `Thread-Counts` WHERE category_id = `Thread-Category`.`value`), 0) + COUNT(*) as total
FROM `Thread`
INNER JOIN `Thread-Category` ON `Thread`.`id` = `Thread-Category`.`id`
`Thread`.in_all_mail = 1
bengotow / spdlog-extensions.cpp
Created Aug 30, 2017
SPDLog Sink for "Flush Within Xmsec"
View spdlog-extensions.cpp
The code below shows a custom SPDLog sink that uses a separate thread and a C++0x condition_variable
to ensure that a spdlog::sinks::rotating_file_sink_mt is flushed to disk within a second of a new
log message being emitted. When no messages are arriving, the helper thread has very low wake overhead
and sleeps for 30s.
std::mutex spdFlushMtx;
std::condition_variable spdFlushCV;
int spdUnflushed = 0;