This file contains 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
require 'sax-machine' | |
class Foo | |
include SAXMachine | |
attribute :bar | |
end | |
class FooDoc | |
include SAXMachine | |
elements :foo, :as => :foos, :class => Foo |
This file contains 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
- (IBAction)btnConvert:(id)sender { | |
NSString *urlString = urlField.text; | |
answerData = [NSData dataWithContentsOfURL:[NSURL URLWithString:urlString]]; | |
html = [[NSString alloc] initWithData:answerData encoding:NSUTF8StringEncoding]; | |
NSLog(@"Source: %@", html); | |
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"ansMap\\[\\d+\\] = '(\\w+)'" options:0 error:NULL]; | |
[regex enumerateMatchesInString:html options:0 range:NSMakeRange(0, [html length]) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) { |
This file contains 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
(defmacro plet [bindings & forms] | |
(let [pairs (partition 2 bindings) | |
names (map first pairs) | |
vals (map second pairs)] | |
`(let [[~@names] (pvalues ~@vals)] ~@forms))) |
This file contains 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
- (id)initWithFrame:(CGRect)frame | |
{ | |
if (self = [super initWithFrame:frame]) { | |
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectZero]; | |
[titleLabel setTranslatesAutoresizingMaskIntoConstraints:NO]; | |
[titleLabel setNumberOfLines:0]; | |
[titleLabel setLineBreakMode:NSLineBreakByWordWrapping]; | |
[self addSubview:titleLabel]; | |
UILabel *dateLabel = [[UILabel alloc] initWithFrame:CGRectZero]; |
This file contains 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
self.currentItem.pubDate = [[[formats map:^id(id fmt) { | |
[formatter setDateFormat:fmt]; | |
return option([formatter dateFromString:text]); | |
}] find:^BOOL(id maybeDate) { | |
return ![maybeDate isEmpty]; | |
}] getOrElse:nil]; |
This file contains 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
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectZero]; | |
[titleLabel setTranslatesAutoresizingMaskIntoConstraints:NO]; | |
[titleLabel setNumberOfLines:0]; | |
[titleLabel setLineBreakMode:NSLineBreakByWordWrapping]; | |
[titleLabel setFont:[USNTheme smallTitleFont]]; | |
[self addSubview:titleLabel]; | |
[self setTitleLabel:titleLabel]; | |
UILabel *summaryLabel = [[UILabel alloc] initWithFrame:CGRectZero]; |
This file contains 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
(ns foo.web.util | |
"Utilities shared by various web namespaces" | |
(:use compojure.core) | |
(:require [foo.json :as json] | |
[foo.model :refer (uuid)])) | |
(defn json-response | |
"Return a Ring response with the appropriate JSON content type | |
header and a JSON representation of obj in the body." | |
[obj & flags] |
This file contains 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
(ns deck.core | |
(:require [clojure.java.io :as io]) | |
(:import java.io.PushbackReader | |
java.io.File | |
java.util.Date)) | |
(defn- dispatch-play | |
[state [event-name & rest]] | |
(keyword event-name)) |
This file contains 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
<div class="page-header"> | |
<h1>>Navy Feeds</h1> | |
</div> | |
<table class="table table-striped"> | |
<thead> | |
<tr> | |
<th>Name></th> | |
<th>URL</th> | |
<th>Tags</th> | |
<th>Actions</th> |
This file contains 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
#!/bin/bash | |
# Please supply your own audio file... | |
audiofile="$1" | |
if [[ ! -f "$audiofile" ]] | |
then | |
echo "USAGE: $(basename ${0}) audio_file" | |
exit 1 |