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 ack) | |
(in-ns 'ack) | |
(defn pow [x y] | |
(if (zero? y) 1 | |
(reduce * (repeat y x)))) | |
(defn up [a n b] | |
(cond (= n 1) (pow a b) |
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 savings-balance | |
[& accounts] | |
(->> (seq accounts) | |
(filter #(= (:type %) 'savings)) | |
(map :balance) | |
(apply +))) | |
;; Use case for 'same higher order function. | |
;; That's better. |
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
# Aliases | |
alias la="ls -a" | |
alias ll="ls -l" | |
# Show git branch | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1] /' | |
} |
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 app | |
(:gen-class :extends javax.servlet.http.HttpServlet) | |
(:use (compojure.http routes servlet helpers) | |
compojure.html) | |
(:use com.freiheit.gae.datastore.datastore-access-dsl | |
com.freiheit.gae.datastore.datastore-query-dsl | |
com.freiheit.gae.datastore.datastore-types) | |
(:import (com.google.appengine.api.users User UserService UserServiceFactory) | |
(com.google.appengine.api.datastore Query) | |
java.util.Date)) |
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 user | |
(:import (com.google.appengine.api.users User UserService UserServiceFactory))) | |
(defn get-user-service [] | |
(UserServiceFactory/getUserService)) | |
(def *user* nil) | |
(defn inside-with-user-block? [] | |
(not= nil *user*)) |
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
;taken from clj-gae-datastore/src/example/clojure/com/freiheit/gae/datastore/example.clj | |
; short-cut to set-up the GAE environment for interactive programming with Clojure and GAE | |
(ns com.freiheit.gae.datastore.example | |
(:use | |
[clojure.contrib def]) | |
(:import | |
[com.google.apphosting.api ApiProxy ApiProxy$Environment] | |
[java.io File] | |
[java.util HashMap] |
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
(defproject guestbook "1.0.0-SNAPSHOT" | |
:author "FIXME: Me" | |
:description "FIXME: Simple guestbook." | |
:compile-path "war/WEB-INF/classes" | |
:library-path "war/WEB-INF/lib" | |
:dependencies [[org.clojure/clojure "1.2.0-master-SNAPSHOT"] | |
[org.clojure/clojure-contrib "1.2.0-SNAPSHOT"] | |
[compojure "0.4.0-SNAPSHOT"] |
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 'com.google.appengine.tools.development.testing.LocalUserServiceTestConfig) | |
(import 'com.google.appengine.tools.development.testing.LocalServiceTestHelper) | |
;; EVAL: | |
(new LocalServiceTestHelper (new LocalUserServiceTestConfig)) | |
> com.google.appengine.tools.development.testing.LocalUserServiceTestConfig | |
cannot be cast to | |
[Lcom.google.appengine.tools.development.testing.LocalServiceTestConfig; | |
[Thrown class java.lang.ClassCastException] |
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 gae-app.core | |
(:gen-class :extends javax.servlet.http.HttpServlet) | |
(:use [compojure.http.servlet :only (defservice)]) | |
(:use compojure.http.routes) | |
(:use [hiccup.core :only [h html]] | |
[hiccup.page-helpers :only [doctype include-css link-to xhtml-tag]] | |
[hiccup.form-helpers :only [form-to text-area text-field]]) | |
(:import (com.google.appengine.api.users UserServiceFactory |
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
#!/bin/bash | |
########################### | |
### Copyright Denis Popov 2010 ## | |
### Downloader files from ## | |
### The HTTP/FTP ## | |
########################### | |
get_information() | |
{ | |
dirdownload=$(zenity --entry --title "Quadregus Downloader" --text "Write folder for downloading file" --width 300) |