Test Name Xbench Score Measured Values
Base configuration (AMD Radeon HD 6750M 512MB). Full specs at Everymac.
#import <Foundation/Foundation.h> | |
@interface NSArray (LGCSVParser) | |
+ (instancetype)arrayWithCSVString:(NSString *)csvString delimiter:(unichar)delimiter; | |
@end |
static unichar const comma = ','; | |
static unichar const semicolon = ';'; | |
static unichar const colon = ':'; | |
static unichar const tab = '\t'; | |
static unichar const space = ' '; | |
NSRegularExpression *fieldRegExForDelimiter(unichar delimiter) { | |
NSString *fieldRegExPattern = [NSString stringWithFormat:@"(?<=^|%C)(\"(?:[^\"]|\"\")*\"|[^%C]*)", delimiter, delimiter]; // Via http://stackoverflow.com/questions/3268622/regex-to-split-line-csv-file - works very good. Handles double double quotes, fields containing a delimiter and starting and ending with double quotes, delimiter after double double quotes in field that starts and ends with double quotes. | |
return [NSRegularExpression regularExpressionWithPattern:fieldRegExPattern options:0 error:nil]; | |
} |
(def grid (insert [[nil nil nil nil] | |
[nil nil nil nil] | |
[nil nil nil nil] | |
[nil nil nil nil]])) | |
;; Grid functions. | |
(defn move | |
"Moves all field to the choosen direction, merges fields and inserts field value for random free location. Returns nil if game is over. Returns same grid if move doesn't change the grid." | |
[grid direction] |
type Node = String | |
type Length = Int | |
type Path = [Node] | |
data Way = Way Path | Visited | Unknown | |
type Ways = [(Node, Way)] | |
type Connection = (Node, Length) | |
type Connections = [Connection] |
{- | |
Command-line: ./dijkstra graph.txt startNode endNode | |
Haskell: dijkstra startNode endNode aGraph | |
Works with any directed edge-weighted graph. | |
Graph File Structure: | |
Node ConnectedNode DistanceToConnectedNode ConnectedNode DistanceToConnectedNode ... |
import Data.List | |
import System.Random | |
import System.Environment | |
import Control.Parallel.Strategies | |
-- run with "./game TREEDEPTH" and it outputs a game tree of a specific depth | |
-- see below for more specific functions | |
main = do | |
[depthString] <- getArgs |
javascript:if(/(iPad|iPhone|iPod)/g.test(navigator.userAgent)){window.location="pushpin://x-callback-url/add?url="+encodeURIComponent(location.href)+"&title="+encodeURIComponent(document.title)}else{q=location.href;if(document.getSelection){d=document.getSelection()}else{d=""}p=document.title;void open("https://pinboard.in/add?url="+encodeURIComponent(q)+"&description="+encodeURIComponent(d)+"&title="+encodeURIComponent(p),"Pinboard","toolbar=no,width=700,height=350")} |
Test Name Xbench Score Measured Values
Base configuration (AMD Radeon HD 6750M 512MB). Full specs at Everymac.
;; ido-find-file-in-dir but start in directory currently open in Finder. | |
(defun ido-find-file-in-finder-dir () | |
(interactive) | |
(let ((finder-dir (do-applescript "tell application \"Finder\"\nreturn POSIX path of (target of window 1 as alias)\nend tell"))) | |
(ido-find-file-in-dir finder-dir))) | |
;; Bind to C-x C-o | |
(global-set-key (kbd "C-x C-o") 'ido-find-file-in-finder-dir) |
When you want to use awesome paredit with erlang-mode or any other non-lisp language there's a problem when you want to insert a pair of parenthesis for a function call.
Say you have typed myFunction
and now type (
, paredit assumes you're in a lisp and creates myFunction ()
instead of myFunction()
.
The snippet prevents paredit from inserting a space before parentheses by locally resetting the predicate functions used to determine if a space should be inserted before a pair of parentheses. By changing the hook used you could also make this work in any other mode for non-lisp languages. For exampe for js2-mode
replace erlang-mode-hook
in line 1 with js2-mode-hook
.