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
package com.classifyr.hello_world | |
import android.app.Activity | |
import android.widget.Button | |
import android.widget.Toast | |
import android.view.View | |
import android.view.View.OnClickListener | |
import android.hardware.SensorManager |
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
description "train the spam filter" | |
instance $x | |
stop on reddit-stop or runlevel [016] | |
respawn | |
respawn limit 10 5 | |
nice 10 |
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
(defdb db | |
(postgres {:password "a-password", :user "timeline", :db "timeline"}) | |
(defentity tag | |
(database db) | |
(table :tags) | |
(pk :tag)) | |
(sql-only (select tag)) |
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
(defn user-feedback [user-id] | |
(-> (select users (where (= :users.id user-id))) | |
(join items (where (= :items.user_id :users.id))) | |
(join reservations (where (or (= :renter :users.id) | |
(= :item :items.id)))) | |
(join feedback (where (= :reservation :reservations.id))) | |
distinct | |
(project [:feedback.id :feedback.reservation :feedback.score :feedback.sender :feedback.comment]))) |
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
(def bot-name "irclj_bot_test") | |
(def irc-server "irc.freenode.net") | |
(def irc-channel "#clojure") | |
(def msgs (agent [])) | |
(def info (agent [])) | |
(defn log-info [{:keys [nick channel message irc errors doing]}] | |
(send info conj message)) |
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
#app/models/document.rb | |
class Document < ActiveRecord::Base | |
has_attached_file :attachment, styles: {html: {}}, :processors => [:htmlprocessor] | |
attr_accessor :attachment_file_name | |
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
Started POST "/documents" for 127.0.0.1 at 2011-10-21 20:52:27 -0400 | |
Processing by DocumentsController#create as HTML | |
Parameters: {"Filename"=>"Contract.odt", "_urcollege_session"=>"BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJWIxODBkMTJhOWNlMDg1ZTY1NzZiZWM5ZGUxYjgxNGMxBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMXM0bzNzY3Z3TWE4WVh6UGZXandkRzJvTFkvVjJvcWNDRUo0M1JjQ1dnTUk9BjsARg==--4e8e0ce753d8618b22cc2e18e80bc753b4831f35", "authenticity_token"=>"s4o3scvwMa8YXzPfWjwdG2oLY/V2oqcCEJ43RcCWgMI=", "folder"=>"/documents/", "attachment"=>#<ActionDispatch::Http::UploadedFile:0x0000000588afe0 @original_filename="Contract.odt", @content_type="application/octet-stream", @headers="Content-Disposition: form-data; name=\"attachment\"; filename=\"Contract.odt\"\r\nContent-Type: application/octet-stream\r\n", @tempfile=#<File:/tmp/RackMultipart20111021-29558-ungtwg>>, "Upload"=>"Submit Query"} | |
(0.1ms) BEGIN | |
SQL (5.1ms) INSERT INTO "documents" ("attachment", "created_at", "processed", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [ |
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 trie.core | |
(:refer-clojure :exclude (merge contains?)) | |
(:use clojure.test)) | |
;; some generic trie (prefix tree) functions | |
(def box list) | |
(defn trie | |
"Returns trie for single seq s" |
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
(defn search-items [terms & [cat]] | |
(let [terms-seq (map sql-wildcard | |
(s/split terms #"[ \t]+"))] | |
(select (if cat | |
(items-by-cat cat) | |
items) | |
(where (or (apply or (map (partial ilike :longdesc) terms-seq)) | |
(apply or (map (partial ilike :shortdesc) terms-seq))))))) |
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
(defmethod learn :unique-cat [how items] | |
(fn [corpus] | |
(merge-with merge-item | |
corpus | |
items))) |