Skip to content

Instantly share code, notes, and snippets.

View hsjunnesson's full-sized avatar

Hans Sjunnesson hsjunnesson

View GitHub Profile
{:class Composite
:children [{:class Button :text "Button 0"}
{:class Button :text "Button 1"}
{:class Button :text "Button 2"}
{:class Button :text "Button 3"}
{:class Button :text "Button 4"}
{:class Button :text "Button 5"}
{:class Button :text "Button 6"}
{:class Button :text "Button 7"}
{:class Button :text "Button 8"}
/usr/local/bin/bzr
==> Cloning bzr://http://bzr.savannah.gnu.org/r/emacs/trunk
Updating /Users/hanssjunnesson/Library/Caches/Homebrew/emacs--bzr
bzr update
Tree is up to date at revision 106538 of branch http://bzr.savannah.gnu.org/r/emacs/trunk
bzr export /private/tmp/homebrew-emacs-HEAD-yi99
==> Downloading patches
/usr/bin/curl -f#LA Homebrew 0.8 (Ruby 1.8.7-249; Mac OS X 10.7.2) https://raw.github.com/gist/1012927 -o 001-homebrew.diff
######################################################################## 100.0%
~ 0 $ cat ~/.bash_profile
# ~/.bash_profile: executed by bash(1) for login shells.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/login.defs
#umask 022
# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
@hsjunnesson
hsjunnesson / HSActionSheet.h
Created February 25, 2012 22:55
UIAlertViews are bad for you
//
// HSActionSheet.h
// UIAlertViewBlock
//
// Created by Hans Sjunnesson on 2/25/12.
// Copyright (c) 2012 Hans Sjunnesson
//
// 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 to
#+BEGIN: columnview :hlines 1 :vlines t :id global :skip-empty-rows t
#+END:
#+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file :compact t :block thisweek :step week :stepskip0 t
#+END: clocktable
// Block which determine whether two NSDates are on the same day
BOOL(^areDatesSameDay)(NSDate *, NSDate *) = ^(NSDate *date1, NSDate *date2) {
if (!date1 || !date2)
return NO;
NSDateComponents *day1 = [[NSCalendar currentCalendar] components:NSEraCalendarUnit|NSYearCalendarUnit|NSMonthCalendarUnit|NSDayCalendarUnit fromDate:date1];
NSDateComponents *day2 = [[NSCalendar currentCalendar] components:NSEraCalendarUnit|NSYearCalendarUnit|NSMonthCalendarUnit|NSDayCalendarUnit fromDate:date2];
if ([day1 day] == [day2 day] &&
[day1 month] == [day2 month] &&
* {
margin: 0px;
padding: 0px;
}
ul, ol, dl, li, dt, dd, h1, h2, h3, h4, h5, h6, pre, form, body, html, p, blockquote, fieldset, input {
margin: 0;
padding: 0;
color: inherit;
font-family: inherit;
font-size: inherit;
@hsjunnesson
hsjunnesson / log
Created September 5, 2013 21:28
Update: I've made a more thorough example of embedding Clojure logic in an iPhone app. Toes, a tic-tac-toe game in clojure on the iPhone. https://github.com/hsjunnesson/toes
2013-09-05 23:24:37.777 Prime[4204:c07] 1
2013-09-05 23:24:37.779 Prime[4204:c07] 0.732028842267092
2013-09-05 23:24:37.780 Prime[4204:c07] 0.2530017011838238
2013-09-05 23:24:37.781 Prime[4204:c07] 0.22892546997679017
2013-09-05 23:24:37.781 Prime[4204:c07] 0.5423003204364027
2013-09-05 23:24:37.782 Prime[4204:c07] 0.6065306597126334
2013-09-05 23:24:37.783 Prime[4204:c07] 0.44399788140114904
2013-09-05 23:24:37.783 Prime[4204:c07] 0.15345314921321815
2013-09-05 23:24:37.784 Prime[4204:c07] 0.13885046809469812
2013-09-05 23:24:37.784 Prime[4204:c07] 0.32892187595578626
#import <Foundation/Foundation.h>
typedef void(^SuccessBlock)(id object);
typedef void(^ErrorBlock)(NSString *error);
@interface JenkinsRequest : NSObject
@property (copy) SuccessBlock successBlock;
@property (copy) ErrorBlock errorBlock;
@hsjunnesson
hsjunnesson / gist:7450562
Created November 13, 2013 15:07
How to programmatically scroll a tableview to the top, then run a block when it's done animating. #ReactiveCocoa
[[[RACObserve(self.tableView, contentOffset)
filter:^BOOL(NSValue *contentOffset) {
CGPoint point = [contentOffset CGPointValue];
return point.y == 0.0f;
}]
take:1]
subscribeCompleted:^{
// This block gets executed when the tableview has scrolled to top
}];