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
object Main { | |
def main(args: Array[String]) = { | |
val data = testData() | |
val start1 = System.currentTimeMillis() | |
data.foreach(isValidIpFormat1) | |
val end1 = System.currentTimeMillis() | |
println("1: " + (end1 - start1)) | |
val start2 = System.currentTimeMillis() |
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
import sbt._ | |
import sbt.Keys._ | |
import sbtassembly.Plugin.{MergeStrategy, assemblySettings, defaultMergeStrategy} | |
import sbtassembly.Plugin.AssemblyKeys.{assembly, mergeStrategy} | |
import sbtassembly.AssemblyUtils | |
object AppBuild extends Build { | |
lazy val app = Project( | |
id = "app", | |
base = file("app"), |
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 'anything-grep) | |
(defun recentf-grep (str) | |
(interactive "sSearch: ") | |
(let* ((files (mapconcat #'(lambda (x) (concat "'" x "'")) | |
(filter #'file-readable-p recentf-list) " ")) | |
(command (concat "grep -i -nH -e " str " " files)) | |
(pwd "/tmp") | |
(src (agrep-source (agrep-preprocess-command command) pwd))) | |
(setcdr (assoc 'name src) (format "grep %s in recentf-list" str)) | |
(anything-grep-base (list src) (format " *recentf-grep:%s*" str)))) |
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
/** | |
* Haskell Brushe for SyntaxHighlighter 3.0 | |
*/ | |
SyntaxHighlighter.brushes.Haskell = function() | |
{ | |
var constants = 'True False Nothing Just Left Right LT EQ GT'; | |
var datatypes = 'Bool Maybe Either Ordering Char String Int Integer Float Double Rational ' + | |
'IO ReadS ShowS FilePath IOError Monad Functor Show Read' + | |
'Eq Ord Enum Bounded Num Real Integral Fractional Floating RealFrac RealFloat'; |
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 TemplateHaskell #-} | |
import Language.Haskell.TH | |
import Control.Applicative ((<$>)) | |
data Hoge = Hoge1 | Hoge2 | Hoge3 deriving (Eq, Show) | |
data Fuga = Fuga1 | Fuga2 deriving (Eq, Show) | |
-- runQ [| \t -> case t of "hoge1" -> Hoge1; "hoge2" -> Hoge2; "hoge3" -> Hoge3; _ -> error "Hoge" |] |
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 ScopedTypeVariables #-} | |
type Nat = Int | |
---------------------------------------- | |
-- Lists | |
---------------------------------------- | |
data NatList = Nil () | Cons (Nat, NatList) | |
deriving (Eq, Show) |
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
#include <sys/param.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
int main(int argc, char **argv) { | |
if (argc != 2) { | |
printf("usage: %s <path>\n", argv[0]); | |
exit(1); | |
} |
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
import Control.Monad (when) | |
import System.IO (hFlush, stdout) | |
-- main = f | |
main = g | |
f :: IO () | |
f = do | |
x <- getLine | |
when (x /= "q") $ do |
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
// compile: g++ -std=c++11 sudoku.cpp | |
#include <iostream> | |
#include <tuple> | |
#include <string> | |
#include <vector> | |
#include <array> | |
#include <cmath> | |
using namespace std; |
OlderNewer