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
<?xml version="1.0"?> | |
<root> | |
<item> | |
<name>Shifts to Parentheses</name> | |
<appendix>Shifts, when pressed alone, type parentheses. When used with other keys they're normal shifts.</appendix> | |
<identifier>private.shifts_to_parens</identifier> | |
<!-- This is the basic mapping. --> | |
<autogen>--KeyOverlaidModifier-- KeyCode::SHIFT_R, ModifierFlag::SHIFT_R | ModifierFlag::NONE, KeyCode::SHIFT_R, KeyCode::KEY_0, ModifierFlag::SHIFT_L</autogen> |
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
( | |
#((if (odd? %2) | |
(conj %1 %2) ; а почему тут кложура пытается чо та эвалюэйтить? я ж всего навсего пытаюсь лист вернуть | |
%1)) | |
'() | |
1) | |
; ClassCastException clojure.lang.PersistentList cannot be cast to clojure.lang.IFn | |
; ды, не самый удачный пример) я фкурси про всякие та filter и т.д., |
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 one-or-no-letter-diff? [a b] | |
(loop [xs (seq a) | |
ys (seq b)] | |
(cond | |
(= xs ys) true | |
(and (empty? xs) (= (count ys) 1)) true | |
(and (empty? ys) (= (count xs) 1)) true | |
(= (first xs) (first ys)) (recur (rest xs) (rest ys)) | |
:else (or (= (rest xs) ys) (= (rest ys) xs) (= (rest xs) (rest ys)))))) |
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 board-step [board] | |
(let [live-cell \# | |
dead-cell \space | |
live-cell? (fn [cell] (= cell live-cell)) | |
transit-cell (fn [cell live-neib] | |
(if (live-cell? cell) | |
(cond | |
(< live-neib 2) dead-cell | |
(> live-neib 3) dead-cell | |
:else live-cell) |
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
import grequests | |
urls = [ | |
'http://www.heroku.com', | |
'http://python-tablib.org', | |
'http://httpbin.org', | |
'http://python-requests.org', | |
'http://kennethreitz.com' | |
] |
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 hcache.core | |
(:require [clj-http.lite.client :as client] | |
[clojure.string :as string] | |
[clojure.core.async :as async :refer [>! <! >!! <!! go chan]]) | |
(:import (java.io File))) | |
(def h {"User-Agent" "Mozilla/5.0 (Windows NT 6.1;) Gecko/20100101 Firefox/13.0.1"}) | |
(defn page [url] | |
(:body (client/get url {:headers h}))) |
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 lazy-open [file] | |
(letfn [(helper [rdr] | |
(lazy-seq | |
(if-let [line (.readLine rdr)] | |
(cons line (helper rdr)) | |
(do (.close rdr) (println "closed") nil))))]) | |
(do (println "opening") | |
(helper (clojure.java.io/reader file)))) |
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 lazy-open [file] | |
(letfn [(helper [rdr] | |
(lazy-seq | |
(if-let [line (.readLine rdr)] | |
(cons line (helper rdr)) | |
(do (.close rdr) (println "closed") nil))))] | |
(do (println "opening") | |
(helper (clojure.java.io/reader file))))) | |
(defn parse-cvs [seq] |
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
;;; Move region | |
(defun selected-text () | |
(let ((text (if (region-active-p) | |
(vector (buffer-substring-no-properties (region-beginning) (region-end)) | |
(region-beginning) (region-end)) | |
nil))) | |
(if (null text) (unit-at-cursor 'line) text))) | |
(defun move-line (start end 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 translate.core | |
(:use clojure-csv.core)) | |
(defonce store (parse-csv (slurp "resources/trans.csv"))) | |
(def lang-shortcuts { "Russian" "ru" | |
"French" "fr" | |
"Italian" "it" | |
"German" "de" | |
"Spanish" "es" |