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
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE RankNTypes #-} | |
module Bencoding where | |
import Control.Applicative | |
import Crypto.Hash.SHA1 | |
import Data.Attoparsec.ByteString.Char8 (Parser) | |
import qualified Data.Attoparsec.ByteString.Char8 as P | |
import Data.ByteString as B | |
import Data.ByteString.Char8 as BC |
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
###################### | |
# Options | |
###################### | |
REVEAL_ARCHIVE_IN_FINDER=false | |
FRAMEWORK_NAME="${PROJECT_NAME}" | |
SIMULATOR_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${FRAMEWORK_NAME}.framework" |
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
-------------------------------------------------------------------------------- | |
{-# LANGUAGE OverloadedStrings #-} | |
module Main | |
( main | |
) where | |
-------------------------------------------------------------------------------- | |
import Control.Concurrent (forkIO) | |
import Control.Applicative ((<$>)) |
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
+ (UIImage *)generatedBackground { | |
static NSArray *colors = nil; | |
if (!colors) { | |
colors = @[ | |
[UIColor colorWithRed:0.957 green:0.138 blue:0.287 alpha:1.000], | |
... | |
[UIColor colorWithRed:0.972 green:0.207 blue:0.225 alpha:1.000], | |
]; | |
} |
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
@interface MyAsyncOperation () | |
@property (nonatomic) BOOL isExecuting; | |
@property (nonatomic) BOOL isFinished; | |
@end | |
@implementation MyAsyncOperation | |
- (void)start { | |
self.isFinished = NO; | |
self.isExecuting = YES; |
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 translate.core | |
(:use clojure-csv.core)) | |
(defonce store (parse-csv (slurp "resources/trans.csv"))) | |
(def lang-shortcuts { "Russian" "ru" | |
"French" "fr" | |
"Italian" "it" | |
"German" "de" | |
"Spanish" "es" |
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
;;; Move region | |
(defun selected-text () | |
(let ((text (if (region-active-p) | |
(vector (buffer-substring-no-properties (region-beginning) (region-end)) | |
(region-beginning) (region-end)) | |
nil))) | |
(if (null text) (unit-at-cursor 'line) text))) | |
(defun move-line (start end n) |
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
(defn lazy-open [file] | |
(letfn [(helper [rdr] | |
(lazy-seq | |
(if-let [line (.readLine rdr)] | |
(cons line (helper rdr)) | |
(do (.close rdr) (println "closed") nil))))] | |
(do (println "opening") | |
(helper (clojure.java.io/reader file))))) | |
(defn parse-cvs [seq] |
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
(defn lazy-open [file] | |
(letfn [(helper [rdr] | |
(lazy-seq | |
(if-let [line (.readLine rdr)] | |
(cons line (helper rdr)) | |
(do (.close rdr) (println "closed") nil))))]) | |
(do (println "opening") | |
(helper (clojure.java.io/reader file)))) |
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 hcache.core | |
(:require [clj-http.lite.client :as client] | |
[clojure.string :as string] | |
[clojure.core.async :as async :refer [>! <! >!! <!! go chan]]) | |
(:import (java.io File))) | |
(def h {"User-Agent" "Mozilla/5.0 (Windows NT 6.1;) Gecko/20100101 Firefox/13.0.1"}) | |
(defn page [url] | |
(:body (client/get url {:headers h}))) |