Skip to content

Instantly share code, notes, and snippets.

View kevingriffin's full-sized avatar

Kevin Griffin kevingriffin

View GitHub Profile

Keybase proof

I hereby claim:

  • I am kevingriffin on github.
  • I am kevingriffin (https://keybase.io/kevingriffin) on keybase.
  • I have a public key ASAT1rj9XlLnWTCd6yNcHNvESds2GxWF2n_vHAHZJhdjbAo

To claim this, I am signing this object:

## Results:
## CollectionProxies (1000000): 30.980000 2.890000 33.870000 ( 33.993120)
## Associations (1000000): 0.120000 0.000000 0.120000 ( 0.120288)
require 'active_record'
require 'sqlite3'
require 'benchmark'
ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"
@kevingriffin
kevingriffin / phraseapp_driver.sh
Last active February 17, 2017 03:37
A driver for the phraseapp_updater gem. This driver uses git to maintain a history from PhraseApp and diff against it.
#!/bin/bash -e
PREFIX=config/locales
BRANCH=test-master
WORKING_DIRECTORY=/data/application
PA_API_KEY=""
PA_PROJECT_ID=""
cd ${WORKING_DIRECTORY}
git reset --hard
override func awakeFromNib() {
let voices = NSSpeechSynthesizer.availableVoices() as Array<String>
var defaultRow = indexOfObject(voices, NSSpeechSynthesizer.defaultVoice())
if let row = defaultRow {
self.tableView.scrollRowToVisible(row)
}
}
@kevingriffin
kevingriffin / swiftIndexOf.swift
Last active August 29, 2015 14:02
Swift NSArray indexOfObject (Is there no better way to do this?)
func indexOfObject<T: Equatable>(array: Array<T>, object: T) -> Int? {
var i: Int
for i = 0; i < array.count; ++i {
if (array[i] == object) {
return i
}
}
return nil
<dict>
<key>name</key>
<string>diff.deleted</string>
<key>scope</key>
<string>markup.deleted.git_gutter</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#F80018</string>
</dict>
<script>
Namespace('OurAssets.Sounds', {
<%= ['correct1', 'correct2', 'correct3', 'correct4', 'correct5'].map { |s| "#{s}: '#{compute_public_path(s + '.mp3', 'apps/sounds/new')}'" }.join(",\n") %>
});
</script>
@kevingriffin
kevingriffin / buffered_logger.rb
Created November 19, 2012 07:40
ActiveSupport 2.3.14 BufferedLogger
require 'thread'
module ActiveSupport
# Inspired by the buffered logger idea by Ezra
class BufferedLogger
module Severity
DEBUG = 0
INFO = 1
WARN = 2
ERROR = 3
@kevingriffin
kevingriffin / buffered_logger.rb
Created November 19, 2012 07:38
ActiveSupport 3.2.9 BufferedLogger
require 'thread'
require 'logger'
require 'active_support/core_ext/logger'
require 'active_support/core_ext/class/attribute_accessors'
require 'active_support/deprecation'
require 'fileutils'
module ActiveSupport
# Inspired by the buffered logger idea by Ezra
class BufferedLogger