Skip to content

Instantly share code, notes, and snippets.

View alexeckermann's full-sized avatar

Alex Eckermann alexeckermann

View GitHub Profile
@alexeckermann
alexeckermann / keybase.md
Created March 29, 2014 13:19
keybase.md

Keybase proof

I hereby claim:

  • I am alexeckermann on github.
  • I am alexeckermann (https://keybase.io/alexeckermann) on keybase.
  • I have a public key whose fingerprint is CBAA 4632 B67F B4A3 0D03 3832 6446 9476 2557 891E

To claim this, I am signing this object:

# Better… not really. Nicer… maybe.
$search = $('#main-navbar .search')
$search.find('input').css
border: '1px solid #cccccc'
$search.find('button').hide()
$search.find('.results').html(loading)
$search.find('.active, .results').show()
@alexeckermann
alexeckermann / gist:95b4cfb6d10538ed7c62
Created October 20, 2014 04:49
Fix yo Postgres, Fix yo Yosemite
# Put this in your shell and smoke it
mkdir -p /usr/local/var/postgres/{pg_tblspc,pg_twophase,pg_stat_tmp}
@alexeckermann
alexeckermann / SwiftLoopTest.playground
Created November 10, 2014 09:21
GCD dispatch_resume test for Swift
import Foundation
import XCPlayground
import Dispatch
class Looper {
var loopQueue : dispatch_queue_t!
var tickSource : dispatch_source_t!
init() {
/*
Example custom UIView implementation
------------------------------------
Used as a custom UITableView header cell.
*/
- (id)initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {
userName = [[UILabel alloc] initWithFrame:CGRectMake(70, 16, (self.bounds.size.width - 70), 28)];
int (^minusOne)(int);
minusOne = ^(int myNumber) {
return myNumber - 1;
};
NSLog(@"%d", minusOne(3)); // Will print: 2
@alexeckermann
alexeckermann / AFTER_main.m
Created January 12, 2011 08:00
Before and after going XIB-less
#import <UIKit/UIKit.h>
int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, @"UIApplication", @"LapTimerAppDelegate");
[pool release];
return retVal;
}
@alexeckermann
alexeckermann / server.rb
Created May 14, 2011 06:59
Webrick Server for TumblrThemr
#!/usr/bin/ruby
require 'webrick'
include WEBrick
s = HTTPServer.new(:Port => 3000, :DocumentRoot => Dir::pwd)
['INT', 'TERM'].each { |sig| trap(sig) { s.shutdown } }
s.start
@alexeckermann
alexeckermann / category_list_block.rb
Created June 27, 2011 11:46
The Jekyll plugins used on alexeckermann.com
module Jekyll
class CategoryListBlock < Liquid::Block
include Liquid::StandardFilters
def render(context)
categories = context.registers[:site].categories.keys
result = []
context.stack do
@alexeckermann
alexeckermann / 404.js
Created June 27, 2011 12:34
The 404 RedirectOMatic 3000
$(function(){
// Fade the page, hide the 'Not found' message a little, there's still hope!
$('#title, #page').css('opacity', 0.3);
// If the JSON is taking its time or fail then reset
var timeout = setTimeout(function(){
$('#page, #title').css('opacity', 1);
}, 2000);
// Get the JSON. Using jQuery.