Skip to content

Instantly share code, notes, and snippets.

[1]dim@aldan-3l ~/Work/Scala $ activator new ysubs play-java
Fetching the latest list of templates...
Could not fetch the updated list of templates. Using the local cache.
Check your proxy settings or increase the timeout. For more details see:
http://typesafe.com/activator/docs
OK, application "ysubs" is being created using the "play-java" template.
module Main where
import Debug.Trace
foreign import getStringProp
"function getStringProp(obj) {\
\ return function (prop) {\
\ return obj[prop];\
\ };\
\}" :: forall a. a -> String -> String
var mainApp = angular.module('mainApp', [
'angular-websocket',
'ngRoute',
'appCtrl',
])
.config(function(WebSocketProvider){
WebSocketProvider
.prefix('')
.uri("ws://127.0.0.1:8080/");
});
;; That one works:
(defroutes all-routes
(GET "/req" req (str req)))
(def endpoint {:on-message (fn [channel message]
(websocket-message-received message channel))
:on-close (fn [channel {:keys [code reason]}]
(websocket-channel-closed channel code))})
(def current-page (atom nil))
(def history (History.))
(defn change-page [newPage]
(.setToken history newPage)
(reset! current-page newPage))
...
(defun my-send-to-nrepl ()
(interactive)
(let ((p (point)))
(cider-eval-last-sexp 't)
(goto-char p)
(insert " ;;=> ")))
(defun my-send-to-nrepl2 ()
(interactive)
(let ((p (point)))
(ns my.core
(:require ...
[ring.middleware [multipart-params :as mp]]))
(defn upload-picture [{:keys [tempfile content-type filename]}]
(let [ext (.substring content-type (inc (.lastIndexOf content-type "/")))
id (:id (session/get :user))]
(if (or (nil? tempfile)
(nil? id))
(defun string/starts-with (s arg)
(cond ((>= (length s) (length arg))
(string-equal (substring s 0 (length arg)) arg))
(t nil)))
(defun chomp (str)
(while (string-match "\\`\n+\\|^\\s-+\\|\\s-+$\\|\n+\\'"
str)
(setq str (replace-match "" t t str)))
str)
(global-ede-mode t)
(ede-enable-generic-projects)
(require 'ede/generic)
(defclass ede-haskell-project (ede-generic-project)
((buildfile :initform ".cabal"))
"Haskell project.")
(defmethod initialize-instance ((this ede-haskell-project) &rest fields)
(call-next-method)
(defmacro macro1 (name)
name)
(defmacro macro2 (name)
'(name))
(defmacro macro3 (name)
`(,name))
;; #123456789012345678901234567890123456789012345678901234567890