Skip to content

Instantly share code, notes, and snippets.

@minimal
minimal / jetty.clj
Created January 20, 2010 01:17
Websockets with clojure + jetty
;; Copyright (c) James Reeves. All rights reserved.
;; The use and distribution terms for this software are covered by the Eclipse
;; Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which
;; can be found in the file epl-v10.html at the root of this distribution. By
;; using this software in any fashion, you are agreeing to be bound by the
;; terms of this license. You must not remove this notice, or any other, from
;; this software.
(ns compojure.server.jetty
"Clojure interface to start an embedded Jetty server."
Traceback (most recent call last):
File "/home/chris/devel/envs/tg2env/bin/bpython", line 8, in <module>
load_entry_point('bpython==0.9.6.2', 'console_scripts', 'bpython')()
File "/home/chris/devel/envs/tg2env/lib/python2.6/site-packages/bpython-0.9.6.2-py2.6.egg/bpython/cli.py", line 1594, in main
banner=banner)
File "/home/chris/devel/envs/tg2env/lib/python2.6/site-packages/bpython-0.9.6.2-py2.6.egg/bpython/cli.py", line 1496, in curses_wrapper
return func(stdscr, *args, **kwargs)
File "/home/chris/devel/envs/tg2env/lib/python2.6/site-packages/bpython-0.9.6.2-py2.6.egg/bpython/cli.py", line 1562, in main_curses
repl.repl()
File "/home/chris/devel/envs/tg2env/lib/python2.6/site-packages/bpython-0.9.6.2-py2.6.egg/bpython/cli.py", line 937, in repl
Emacs notes
selecting:
C-space start/stop mark mode
C-return select rectangle
esc C-\ indent region
ido mode:
C-f stops autocompletion so you can create a new file
@minimal
minimal / chris.el
Created March 16, 2010 22:03
chris.el
;; emacs customisations after using emacs starter kit.
;; font
(custom-set-faces
'(default ((t (:height 115 :width normal :foundry "outline" :family "Lucida Console")))))
(setq-default tab-width 4)
(setq column-number-mode t)
;; themes
(add-to-list 'load-path "color-theme.el")
(ns site.websocket
(:use [site.messaging])
(:use [compojure])
(:use [com.github.icylisper.rabbitmq])
(:use [clojure.contrib.json read write])
(:import java.io.IOException
javax.servlet.RequestDispatcher
(javax.servlet.http
HttpServletRequest
HttpServletResponse)
var viewer = function() {
ws = null;
ws_host = "ws://192.168.1.17:8090/";
//ws_host = "ws://10.137.16.6:8090/";
var current_queue = null;
function smartPoller(wait, poller) {
//var do_reset = false
if ($.isFunction(wait)) {
poller = wait
wait = 1000;
(def run-rpc
(fn*
([arg03319 arg13320]
(let*
[args
nil
socket
nil
failuren3322
(fn*
// calculate n reports per week
m = function() {
var getWeek = function(d) {
dowOffset = typeof(dowOffset) == 'int' ? dowOffset : 1;
var newYear = new Date(d.getFullYear(),0,1);
var day = newYear.getDay() - dowOffset;
day = (day >= 0 ? day : day + 7);
var daynum = Math.floor((d.getTime() - newYear.getTime() - (d.getTimezoneOffset()-newYear.getTimezoneOffset())*60000)/86400000) + 1;
var weeknum;
/* Calc number of reports per service per week */
m = function() {
var getWeek = function(d) {
dowOffset = typeof(dowOffset) == 'int' ? dowOffset : 1;
var newYear = new Date(d.getFullYear(),0,1);
var day = newYear.getDay() - dowOffset;
day = (day >= 0 ? day : day + 7);
var daynum = Math.floor((d.getTime() - newYear.getTime() - (d.getTimezoneOffset()-newYear.getTimezoneOffset())*60000)/86400000) + 1;
var weeknum;
/* JSON-Websocket-AMQP bridge */
var amqp_ws = function() {
ws = null;
function recieve_amqp(args) {
console.log(args.msg);
};