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 admin-only [handler] | |
(fn [request] | |
(when (:admin (:session request)) | |
(handler request)))) | |
(defroutes admin-routes | |
(GET "/some-admin-only-page" (admin-page)) | |
(GET "/another-admin-only-page" (other-admin-page))) |
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
#require "completor/version" | |
require 'rubygems' | |
require 'bundler' | |
require 'java' | |
Bundler.require(:default, :development) | |
require 'csv' | |
COMPLETOR_ROOT = File.expand_path(File.dirname(__FILE__)) | |
Dir.glob(File.join(COMPLETOR_ROOT, '..', 'jars', '*.jar')).each { |jar| require jar } |
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
public Number returnGreater(Number value1, Number value2) { | |
if (value1.doubleValue() > value2.doubleValue()) { | |
return value1; | |
} else { | |
return value2; | |
} | |
} |
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
for (int i = 0; i < allBoxesFast.size(); i++) { | |
SimpleSprite sprite = allBoxesFast.get(i); | |
sprite.render(container, g); | |
} | |
// TRY THIS | |
for(SimpleSprite sprite: allBoxesFast) { | |
sprite.render(container, g); | |
} |
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
Java + Jersey + Guice + Jackson | |
Concurrency Level: 10 | |
Complete requests: 2000 | |
Failed requests: 0 | |
Requests per second: 2868.75 [#/sec] (mean) | |
Percentage of the requests served within a certain time (ms) | |
50% 3 | |
66% 3 | |
75% 4 | |
80% 4 |
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
@Path("/") | |
class HomeResource { | |
@Path("test") | |
@Produces(Array("application/json")) | |
@GET | |
def test(): String = { | |
return "{'foo': 'bar'}" | |
} | |
} |
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 logic.y | |
(:refer-clojure :exclude [== reify inc]) | |
(:use [clojure.core.logic minikanren prelude nonrel match])) | |
(defna findo [x l o] | |
([_ [[?y '- o] . ?r] _] (project [x ?y] (== (= x ?y) true))) | |
([_ [_ . ?c] _] (findo x ?c o))) | |
(defn typedo [c x t] | |
(conda |
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
yakkstr.com:80 77.88.25.26 - - [13/May/2011:19:57:52 -0700] "GET /tags/1703-glenn-beck HTTP/1.1" 200 1953 "-" "Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)" | |
yakkstr.com:80 119.63.196.80 - - [13/May/2011:19:58:11 -0700] "GET /tags/28-introduction-of-sorts HTTP/1.1" 200 1953 "-" "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)" | |
yakkstr.com:80 67.195.113.242 - - [13/May/2011:19:58:19 -0700] "GET /tags/504-food HTTP/1.0" 200 4584 "-" "Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)" | |
yakkstr.com:80 66.249.67.242 - - [13/May/2011:19:59:58 -0700] "GET /posts/3240-Borders-bookstores-gives-executives-8300000-in-bonuses-after-it-lays-off-6000-workers-and-goes-into-chapter-11-bankruptcy- HTTP/1.1" 200 5011 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" | |
yakkstr.com:80 77.88.25.26 - - [13/May/2011:20:00:02 -0700] "GET /posts/1535-Its-piling-up HTTP/1.1" 200 5625 "-" "Mozilla/5.0 (compatible; YandexBo |
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
yakkstr.com:80 77.88.25.26 - - [13/May/2011:19:57:52 -0700] "GET /tags/1703-glenn-beck HTTP/1.1" 200 1953 "-" "Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)" | |
yakkstr.com:80 119.63.196.80 - - [13/May/2011:19:58:11 -0700] "GET /tags/28-introduction-of-sorts HTTP/1.1" 200 1953 "-" "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)" | |
yakkstr.com:80 67.195.113.242 - - [13/May/2011:19:58:19 -0700] "GET /tags/504-food HTTP/1.0" 200 4584 "-" "Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)" | |
yakkstr.com:80 66.249.67.242 - - [13/May/2011:19:59:58 -0700] "GET /posts/3240-Borders-bookstores-gives-executives-8300000-in-bonuses-after-it-lays-off-6000-workers-and-goes-into-chapter-11-bankruptcy- HTTP/1.1" 200 5011 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" | |
yakkstr.com:80 77.88.25.26 - - [13/May/2011:20:00:02 -0700] "GET /posts/1535-Its-piling-up HTTP/1.1" 200 5625 "-" "Mozilla/5.0 (compatible; YandexBo |
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
public boolean exists (String className) { | |
try { | |
Class.forName (className); | |
return true; | |
} | |
catch (ClassNotFoundException exception) { | |
return false; | |
} | |
} |