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
- (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 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
<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 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
#!/bin/bash | |
# Please supply your own audio file... | |
audiofile="$1" | |
if [[ ! -f "$audiofile" ]] | |
then | |
echo "USAGE: $(basename ${0}) audio_file" | |
exit 1 |
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
(defn make-ghost | |
[color] | |
{:get-tick 0, :eatable nil, :color nil, :eaten nil, :specs color, :position nil, :due nil, :map nil, :direction nil}) | |
(def ghost-specs ["#00FFDE" "#FF0000" "#FFB8DE" "#FFB847"]) | |
(def game-state (atom {:state nil | |
:audio [] | |
:ghosts (mapv make-ghost ghost-specs) | |
:eaten-count 0 |
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
- (id)initWithImage:(UIImage *)image | |
{ | |
self = [super init]; | |
if (self) { | |
[self setClipsToBounds:YES]; | |
[self setAutoresizesSubviews:YES]; | |
[self setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight]; | |
CGImageRef originalImage = [image CGImage]; | |
_image = image; |
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
(ns honeycomb.core | |
(:gen-class) | |
(:require [clojure.string :as string] | |
[clojure.java.io :as io])) | |
;; this is basically an iterative approach, which avoids building up lazy sequences. there | |
;; would be almost no overhead here in terms of memory or objects | |
(defn -main-simple | |
"Prints n random rows from given filenames. All command-line arguments are strings." |
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
<html> | |
<head> | |
<title>Dynamic Stacked Bar Chart using d3.js</title> | |
<script src="http://mbostock.github.com/d3/d3.v2.js"></script> | |
<style> | |
rect.a { | |
fill: green; | |
} | |
rect.b { | |
fill: orange; |
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
;;;; Translation of Peter Norvig's sudoku solver to idiomatic Clojure | |
;;;; See http://norvig.com/sudoku.html | |
;;;; | |
;;;; Throughout this program we have: | |
;;;; r is a row, e.g. :a | |
;;;; c is a column, e.g. 3 | |
;;;; s is a square, e.g. [:a 3] | |
;;;; d is a digit, e.g. 9 | |
;;;; u is a unit, e.g. [[:a 1] [:b 1] [:c 1] ... [:i 1]] | |
;;;; grid is a grid, e.g. 81 non-blank chars, e.g. starting with ".18...7..." |
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
(defn bytes2hex [^bytes bytes] | |
(.toString | |
(let [alpha "0123456789ABCDEF"] | |
(areduce bytes idx ret (StringBuilder.) | |
(doto ret | |
(.append (.charAt alpha (int (bit-shift-right (aget bytes idx) 4)))) | |
(.append (.charAt alpha (int (bit-and (aget bytes idx) 0xf))))))))) | |
(def byte-table | |
(delay ;don't generate the byte array unless needed |