Skip to content

Instantly share code, notes, and snippets.

View bitemyapp's full-sized avatar
🐺
aroo

Chris A. bitemyapp

🐺
aroo
View GitHub Profile
(defn ellip-2 [words]
(let [sentlist (re-split #"\s+" words)]
(str (str-join " " (take 3 sentlist)) "...")))
(ns pc.core
(str 1 2 nil 3)
(+ 1 3)
(Character/toUpperCase \s)
(def y (apply str (interleave "Attack at midnight" "The purple elephant chortled")))
(apply str (take-nth 2 y))
; (if part) (else part), () evaluates true
(if () "We are in clojure!" "We are in common Lisp!")
; zero is true too. that's uh, pretty absurd.
(if 0 "Zero is true" "Zero is false")
(defn ellip-2 [words]
(str (->> words (re-split #"\s+") (take 3) (str-join " ")) "..."))
; What does this do? Well, it ellipsizes sentences. it's an improvement upon the book's version.
; we send it strings like "Yo this is a test sentence!" and we get back "Yo this is..."
; legitimately useful for creating things like short descriptions to articles.
; you call it like
(ellip-2 "Yo this is a test sentence!")
require "rubygems"
require "json"
require "httparty"
require "zip/zipfilesystem"
$tmp = "/home/callen/tmp/"
def judgments_url(job_id)
"https://api.crowdflower.com/v1/jobs/#{job_id}.csv?type=json&key=88530fff071fd1301c1279efb35281997b3b9e10"
end
def zip_path(job_id)
(ns irc
(:import (java.net Socket)
(java.io PrintWriter InputStreamReader BufferedReader)))
(require 'clojure.contrib.duck-streams)
(:use 'clj-time.core :only [in-secs interval epoch now]) ;; stashing until I understand
(def network {:name "irc.freenode.net" :port 6667})
(def user {:name "callen-bot" :nick "callen-bot"})
(declare conn-handler)
chat.js:176
Uncaught TypeError: Cannot call method 'get' of undefined
(anonymous function)
f.event.dispatch
f.event.add.h.handle.i
var windowName = irc.chatWindows.getActive().get('name');
Uncaught TypeError: Cannot call method 'get' of undefined (repeated 10 times)
bash --init-file <(cat <<EOF
source `which virtualenvwrapper.sh`;
workon $PROJECT_NAME;
EOF
)
# The Computer Language Benchmarks Game
# http://shootout.alioth.debian.org/
#
# contributed by Karl von Laudermann
# modified by Jeremy Echols
# modified by Detlef Reichl
# modified by Joseph LaFata
# modified by Peter Zotov
size = ARGV.shift.to_i
import sys
from array import array
from multiprocessing import Pool
def do_row(fy):
local_abs = abs
two_over_size = 2.0 / size
xr_offs = range(7, -1, -1)
xr_iter = range(50)
# Searching on my elasticsearch instance returns an empty list
class Dish(Document):
# ... some content removed
search = { u'name': {'boost': 1.0,
'index': 'analyzed',
'store': 'yes',
'type': u'string',
'term_vector' : 'with_positions_offsets'},
u'venue': {'boost': 1.0,
'index': 'analyzed',