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 instagroup.core | |
(:require [net.cgrand.enlive-html :as html] | |
[clj-http.client :as http] | |
[clj-http.cookies :as cookies] | |
[clojure.java.io :as io] | |
[clojure.string :as s] | |
[clojure.pprint :as pp]) | |
(:import java.io.ByteArrayInputStream) | |
(:gen-class)) |
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
$ dig datastax.com | |
; <<>> DiG 9.8.3-P1 <<>> datastax.com | |
;; global options: +cmd | |
;; Got answer: | |
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31423 | |
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 | |
;; QUESTION SECTION: | |
;datastax.com. IN A |
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 defdyntest | |
[test-meta test-name & test-body] | |
`(let [fn# (deftest ~test-name ~@test-body)] | |
(alter-meta! fn# merge ~test-meta) | |
fn#)) | |
(let [tname (symbol 'test-1)] | |
(defdyntest {} tname (println 1))) | |
; => #'user/tname | |
;; this should be #'user/test-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
> a | |
[ 'Wed Dec 11 2013 04:00:00 GMT+0400 (MSK)', | |
'Tue Dec 10 2013 04:00:00 GMT+0400 (MSK)', | |
'Sun Dec 15 2013 04:00:00 GMT+0400 (MSK)', | |
'Sat Dec 14 2013 04:00:00 GMT+0400 (MSK)' ] | |
> a.map(function(d){return new Date(d)}).sort() | |
[ Sat Dec 14 2013 04:00:00 GMT+0400 (MSK), | |
Sun Dec 15 2013 04:00:00 GMT+0400 (MSK), | |
Tue Dec 10 2013 04:00:00 GMT+0400 (MSK), | |
Wed Dec 11 2013 04:00:00 GMT+0400 (MSK) ] |
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
<html> | |
<head> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script src="http://d3js.org/colorbrewer.v1.min.js"></script> | |
<style> | |
body { | |
background: #ccc; | |
font: 14/1.5 Helvetica, sans-serif; | |
} |
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
<html> | |
<head> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script src="http://d3js.org/colorbrewer.v1.min.js"></script> | |
<style> | |
.axis { | |
shape-rendering: crispEdges; | |
stroke-width: 2; | |
} |
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 'benchmark' | |
chars = 'abcdeABCDE!@#$%1234 ' | |
res_str = '' | |
n = 1000 | |
100_000.times do | |
res_str << chars[rand(chars.length)] | |
end | |
Benchmark.bm(15) do |x| |
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
class A; | |
def initialize a | |
@a = a | |
end | |
def to_str | |
@a.dup | |
end | |
def == o |
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
case | |
when utterance.silent? | |
... | |
when utterance.loud? | |
... | |
... | |
else | |
... | |
end |
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 'minitest/autorun' | |
require 'uri' | |
class UriValidator | |
ALLOWED_PROTOS = [URI::HTTP, URI::HTTPS, URI::FTP] | |
def initialize uri | |
@uri = uri | |
end |
NewerOlder