Skip to content

Instantly share code, notes, and snippets.

@astralbodies
astralbodies / maven.xml
Created March 15, 2012 20:12
Maven shade for uber jar
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<phase>package</phase>
<goals>
@astralbodies
astralbodies / spring.xml
Created March 26, 2012 18:46
Spring WS Maven
<dependencies>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
<version>2.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.0</version>
@astralbodies
astralbodies / gist:2394164
Created April 15, 2012 18:03
Unload 1Password agent
launchctl unload -w ~/Library/LaunchAgents/ws.agile.1PasswordAgent.plist
@astralbodies
astralbodies / TransitionController.h
Created July 9, 2012 18:24 — forked from xjones/TransitionController.h
TransitionController for animating iOS view controller transitions w/o a controller stack
//
// TransitionController.h
//
// Created by XJones on 11/25/11.
//
#import <UIKit/UIKit.h>
@interface TransitionController : UIViewController
@astralbodies
astralbodies / gist:3226609
Created August 1, 2012 12:51
Add search magnifying glass to a UITableView
[array insertObject:UITableViewIndexSearch atIndex:0];
@astralbodies
astralbodies / gist:3226628
Created August 1, 2012 12:54
Scroll to the search bar when tapping the magnifying glass
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index
{
if (index == 0) {
CGRect searchBarFrame = self.searchDisplayController.searchBar.frame;
[tableView scrollRectToVisible:searchBarFrame animated:NO];
return -1;
}
return index;
}
- (void)keyboardControls:(BSKeyboardControls *)keyboardControls selectedField:(UIView *)field inDirection:(BSKeyboardControlsDirection)direction
{
AppointmentDetailEditCell *cell = (AppointmentDetailEditCell *)keyboardControls.activeField.superview.superview;
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:cell.center];
[self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionMiddle animated:YES];
double delayInSeconds = 0.2;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
- (void)keyboardControls:(BSKeyboardControls *)keyboardControls selectedField:(UIView *)field inDirection:(BSKeyboardControlsDirection)direction
{
AppointmentDetailEditCell *cell = (AppointmentDetailEditCell *)keyboardControls.activeField.superview.superview;
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:cell.center];
NSLog(@"Scroll to: %@ for cell: %@ and field: %@", indexPath, cell, field);
[self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionMiddle animated:YES];
}
2013-03-06 09:27:40.748 PowerPlay[11962:c07] Scroll to: <NSIndexPath 0xcab9230> 2 indexes [1, 0] for cell: <AppointmentDetailEditCell: 0xc90d050; baseClass = UITableViewCell; frame = (0 140; 512 46); text = 'Name'; autoresize = W; layer = <CALayer: 0xc90d1b0>> and field: <UITextField: 0xc90cba0; frame = (266 12; 183 19); text = 'Santa-Maria'; clipsToBounds = YES; opaque = NO; autoresize = LM+W; tag = 1; gestureRecognizers = <NSArray: 0xc915090>; layer = <CALayer: 0xc90ccf0>>
2013-03-06 09:27:41.130 PowerPlay[11962:c07] Scroll to: <NSIndexPath 0x12bc09e0> 2 indexes [3, 0] for cell: <AppointmentDetailEditCell: 0xc9215f0; baseClass = UITableViewCell; frame = (0 351; 512 45); text = 'Address 1'; autoresize = W; layer = <CALayer: 0xc921750>> and field: <UITextField: 0xc921e80; frame = (83 12; 350 19); text = '134 cc way'; clipsToBounds = YES; opaque = NO; autoresize = W; tag = 2; gestureRecognizers = <NSArray: 0xc922410>; layer = <CALayer: 0xc921fd0>>
2013-03-06 09:27:41.525 PowerPlay[11962:c07] Scroll to: <NSInde
@astralbodies
astralbodies / Person.swift
Created May 3, 2017 00:49
Vicki Loves Jorge
class Person {
let name: String
var loves: Person?
init(_ name: String) {
self.name = name
}
func loves(_ who: Person) {
loves = who