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 net-protocols.examples.console_server.client | |
| (:use [net-protocols.streams.base :as stream] | |
| [net-protocols.streams.tcp :as tcp] | |
| [net-protocols.control.core :as ctrl] | |
| [clojure.string :as str])) | |
| (defn authenticate [stream username password] | |
| (ctrl/challenge-response stream #"Username" (str username "\n")) | |
| (ctrl/challenge-response stream #"Password" (str password "\n"))) |
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 net_protocols.examples.console_server.client | |
| (:use [net_protocols.streams.base :as stream] | |
| [net_protocols.streams.tcp :as tcp] | |
| [net_protocols.control.core :as ctrl])) | |
| (defn authenticate [stream username password] | |
| (ctrl/challenge-response stream #"Username" (str username "\n")) | |
| (ctrl/challenge-response stream #"Password" (str password "\n"))) | |
| (defn get-version [] |
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 with-connection [host port fn] | |
| (with-open [sock (Socket. host port) | |
| writer (io/writer sock) | |
| reader (io/reader sock)] | |
| ;; handle errors | |
| (fn reader writer))) | |
| (defn- read-with-timeout | |
| "Reads a single byte from reader or returns false if it |
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
| cons = ->(x,y){ ->(a){ a.(x,y) } } | |
| car = ->(c){ c.(->(x,_){ x }) } | |
| cdr = ->(c){ c.(->(_,y){ y }) } | |
| pair = cons.(1,2) | |
| puts car.(pair) | |
| puts cdr.(pair) |
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
| (define (Alter x) | |
| (print "Wenn ich " x " Jahre alt bin, dann ist Lucie " (- x 2) " Jahre alt")) | |
| (Alter 10) | |
| (Alter 20) |
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
| class Foo | |
| def self.set_finalizer(obj) | |
| ObjectSpace.define_finalizer(obj,method(:finalize)) | |
| end | |
| def self.set_finalizer2(obj) | |
| ObjectSpace.define_finalizer(obj,finalize2) | |
| end | |
| def self.finalize |
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
| module Reader | |
| def load_hotels | |
| [Hotel.new] | |
| end | |
| end | |
| class Hotel | |
| extend Reader | |
| end |
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
| WITH RECURSIVE dates as | |
| ( SELECT NOW() AS day | |
| UNION ALL | |
| SELECT day + interval '1 day' | |
| FROM dates | |
| WHERE day + interval '1 day' <= '2012-12-24' | |
| ) | |
| SELECT day FROM dates | |
| LEFT OUTER JOIN DailyData ON dates.day = DailyData.date | |
| WHERE DailyData.id IS NULL |
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 "spec_helper" | |
| module Capybara | |
| module Node | |
| module Matchers | |
| def has_text?(content) | |
| normalized_content = normalize_whitespace(content) | |
| wait_until do | |
| normalize_whitespace(text).include?(normalized_content) or |
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 "spec_helper" | |
| feature 'capybara' do | |
| scenario "ignores hidden elements", js: true do | |
| visit root_path | |
| expect(page).to_not have_content("i'm hidden") | |
| end | |
| end |