This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Taken from the commercial iOS PDF framework http://pspdfkit.com. | |
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved. | |
// Licensed under MIT (http://opensource.org/licenses/MIT) | |
// | |
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it. | |
// PLEASE DUPE rdar://27192338 (https://openradar.appspot.com/27192338) if you would like to see this in UIKit. | |
#import <objc/runtime.h> | |
#import <objc/message.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// QLCDispatchAsyncWithCompletionAndTimeout.m | |
// Blocks-WaitUntilDate | |
// | |
// Created by Prachi Gauriar on 12/23/2013. | |
// Copyright (c) 2013 Prachi Gauriar. | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// StateMachineExample | |
// | |
// Created by Jacob Farkas on 6/4/14. | |
// | |
#import <Foundation/Foundation.h> | |
#define DownloadTempPath "/tmp/tacosXXXXXX" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-> k { -> f { -> f { -> x { f[-> y { x[x][y] }] }[-> x { f[-> y { x[x][y] }] }] | |
} [-> f { -> l { -> x { -> g { -> b { b }[-> p { p[-> x { -> y { x } }] | |
}[l]][x] [-> y { g[f[-> l { -> p { p[-> x { -> y { y } }] }[-> p { p[-> x { -> | |
y { y } }] } [l]] }[l]][x][g]][-> l { -> p { p[-> x { -> y { x } }] }[-> p { | |
p[-> x { -> y { y } }] }[l]] }[l]][y] }] } } } }][k][-> x { -> y { -> f { | |
f[x][y] } } }[-> x { -> y { x } }][-> x { -> y { x } }]][-> l { -> x { -> l { | |
-> x { -> x { -> y { -> f { f[x][y] } } }[-> x { -> y { y } }][-> x { -> y { -> | |
f { f[x][y] } } } [x][l]] } }[l][f[x]] } }] } }[-> f { -> x { f[-> y { x[x][y] | |
}] }[-> x { f[-> y { x[x][y] }] }] }[-> f { -> m { -> n { -> b { b }[-> m { -> | |
n { -> n { n[-> x { -> x { -> y { y } } }][-> x { -> y { x } }] }[-> m { -> n { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import AudioToolbox | |
class KKSimplePlayer: NSObject { | |
var URL: NSURL | |
var URLSession: NSURLSession! | |
var packets = [NSData]() | |
var audioFileStreamID: AudioFileStreamID = nil | |
var outputQueue: AudioQueueRef = nil | |
var streamDescription: AudioStreamBasicDescription? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Excerpt from https://github.com/krzyzanowskim/CoreTextWorkshop | |
// Licence BSD-2 clause | |
// Marcin Krzyzanowski [email protected] | |
func getSizeThatFits(_ attributedString: NSAttributedString, maxWidth: CGFloat) -> CGSize { | |
let framesetter = CTFramesetterCreateWithAttributedString(attributedString) | |
let rectPath = CGRect(origin: .zero, size: CGSize(width: maxWidth, height: 50000)) | |
let ctFrame = CTFramesetterCreateFrame(framesetter, CFRange(), CGPath(rect: rectPath, transform: nil), nil) |