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
| 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"); | |
| } | |
| } | |
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
| We have HTTP Basic Auth and HTTP Digest Auth support in Lift. The | |
| authentication is implemented as a partial function that you implement | |
| like so: | |
| LiftRules.httpAuthProtectedResource.prepend { | |
| case (ParsePath("api" :: _, _, _, _)) => Full(AuthRole("admin")) | |
| } | |
| LiftRules.authentication = HttpBasicAuthentication("lift") { | |
| case (username, password, req) => { |
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
| /* | |
| Here's some code to serve an image out of the database. Here's the Mapper | |
| definition: | |
| */ | |
| class Image extends LongKeyedMapper[Image] with IdPK { | |
| def getSingleton = Image | |
| object image extends MappedBinary(this) | |
| object lookup extends MappedUniqueId(this, 32) { |
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
| class Trace { | |
| def head(script:JsCmd) = <head>{Script(script)}</head> | |
| def render(xhtml: NodeSeq): NodeSeq = { | |
| val id = S.attr("id").openOr("") | |
| val event = S.attr("event").openOr("keyup") | |
| val msg = S.attr("msg").openOr("You typed") | |
| def logit = new JsExp with JQueryRight { |
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
| First there is a snippet using the bind functionality. | |
| var image : FileParamHolder = _ | |
| bind("widget", xhtml, | |
| "image" -> fileUpload(image = _) | |
| } | |
| Now write out: |
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
| # 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 |
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
| [merge] | |
| tool = mvim | |
| [mergetool "mvim"] | |
| cmd = <path to mvim>mvim -d -g "$LOCAL" "$MERGED" "$REMOTE" | |
| keepBackup = false | |
| trustExitCode = false |
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
| /** | |
| * api helpers | |
| */ | |
| implicit def boxNodeSeqToNodeSeq(in: Box[NodeSeq]): NodeSeq = { | |
| in match { | |
| case Full(n) => n | |
| case Failure(msg, _, _) => <error>{msg}</error> | |
| case _ => <error></error> | |
| } |
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
| // 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]]]; | |
| }]; |
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
| // | |
| // Events.h | |
| // TWI | |
| // | |
| // Created by Shaun Harrison on 3/18/09. | |
| // Copyright enormego 2009. All rights reserved. | |
| // | |
| #import <UIKit/UIKit.h> |