Skip to content

Instantly share code, notes, and snippets.

@tjweir
tjweir / .bashrc
Created January 15, 2009 14:59 — forked from henrik/.bashrc
# I made a change to the PS1, I prefer my dirpath on a line above the prompt,
# so the prompt does not wind up at the right edge in deep trees.
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
object MyPayPalIPN extends PayPalIPN {
def actions = {
case (action, info, _) => {
val payAmt: Long = info.paymentGross match {
case Full(gross) => gross.roboSplit("\\.") match {
case whole :: fraction => println("split case");toLong(whole) * 100 + toLong(fraction)
case _ => println("non-split case"); toLong(info.paymentGross)
}
case _ => 0
}
object MyPayPalPDT extends PayPalPDT {
override def pdtPath = "paypal_complete"
def paypalAuthToken = Props.get("paypal.authToken") openOr "cannot find auth token from props file"
def pdtResponse: PartialFunction[(PayPalInfo, RequestState), LiftResponse] = {
case _ => println("--- in pdtResponse"); DoRedirectResponse("/account_admin/index");
}
}
# Bash snippet to open new shells in most recently visited dir.
# Useful if you want to open a new terminal tab at the present
# tab's location.
#
# Put this in your .bashrc or whatever.
pathed_cd () {
if [ "$1" == "" ]; then
cd
else
/**
* api helpers
*/
implicit def boxNodeSeqToNodeSeq(in: Box[NodeSeq]): NodeSeq = {
in match {
case Full(n) => n
case Failure(msg, _, _) => <error>{msg}</error>
case _ => <error></error>
}
// Copied from Apple's SeismicXML code sample
// When the user taps a row in the table, display the USGS web page that displays details of the earthquake they selected.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
Earthquake *earthquake = (Earthquake *)[earthquakeList objectAtIndex:indexPath.row];
PLActionSheet *sheet = [[PLActionSheet alloc] initWithTitle: @"Display Map"];
[sheet addButtonWithTitle: @"Show USGS Site in Safari" block: ^{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: [earthquake USGSWebLink]]];
}];
//
// Events.h
// TWI
//
// Created by Shaun Harrison on 3/18/09.
// Copyright enormego 2009. All rights reserved.
//
#import <UIKit/UIKit.h>
//
// EGOTitledTableViewCell.h
// EGOClasses
//
// Created by Shaun Harrison on 6/2/09.
// Copyright 2009 enormego. All rights reserved.
//
#import <UIKit/UIKit.h>
@implementation CPTextView : CPView
{
DOMElement FIXME_textArea;
id _delegate;
CPScrollView _scrollView;
CPView _contentView;
JSObject _existingSelectStart;
/**
* REST interface to Akka's JMX service.
* <p/>
* Here is an example that retreives the current number of Actors.
* <pre>
* http://localhost:9998/management
* ?service=service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
* &component=se.scalablesolutions.akka:type=Stats
* &attribute=counter_NrOfActors
* </pre>