Skip to content

Instantly share code, notes, and snippets.

View skuro's full-sized avatar

Carlo Sciolla skuro

View GitHub Profile
@skuro
skuro / Bean.java
Last active August 29, 2015 13:59
Testing clara rules and queries over POJOs
package tk.skuro;
public class Bean {
private final String _value;
public Bean(String value) {
_value = value;
}
@skuro
skuro / code.clj
Last active August 29, 2015 14:03
Solution for the problems in today's meetup
; https://www.hackerrank.com/challenges/functional-programming-warmups-in-recursion---fibonacci-numbers
(let [fibos (iterate (fn [[a0 a1]] [a1 (+ a0 a1)]) [0 1])
fibo (fn [n] (->> n dec (nth fibos) first))]
(->
(read)
fibo
println))
;https://www.hackerrank.com/challenges/pascals-triangle
(let [k (read)
@skuro
skuro / nonograms.clj
Created December 10, 2014 20:03
Nonograms solver
#_(
Amsterdam Clojurians Dojo#3: A nonogram solver
==============================================
Fork this gist and provide your solution!
)
@skuro
skuro / AppConfig.groovy
Last active August 29, 2015 14:14
Environment micro benchmark
@PropertySource(["classpath:application.properties"])
@Configuration
@ComponentScan("org.sample")
public class AppConfig {
@Autowired
private Environment environment
}
@skuro
skuro / protocols.clj
Created February 5, 2015 08:58
Just a sample use of Clojure protocols
(ns protocols)
(defprotocol Flying
(fly [this from to]))
(extend-type String ; <- protocols are "open", as they install a dispatch facility rather than fussing with type inheritance
Flying
(foo [this from to] (println "Even a String can fly from" from "to" to)))
package foo;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;
/**
#
# Debian useful commands
#----
# look for eventually installed packages that provide filename.ext
dpkg -D filename.ext
#
# Various stuff
#----
<%--
Original source: http://paste.lisp.org/display/71541
--%>
<%--
This JSP page is intended to start swank-clojure
in a running Java system executed in an HTTP
container like Tomcat, so that you can connect to
it from SLIME and interactively inspect, control and
modify it.
(ns skuro.alfresco.clojure
:import (org.alfresco.util ApplicationContextHelper ApplicationContextHelper$RunAsWork)
(org.alfresco.repo.transaction RetryingTransactionHelper RetryingTransactionHelper$RetryingTransactionCallback))
;; this is problematic: it looks like swank is launched in a separated class loader!
;; this usually results in the spring ctx to be recreated
(def ctx (. ApplicationContextHelper getApplicationContext))
(defn run-as [user work]
(. AuthenticationUtil runAs
$ sc-server
SproutCore v1.4.1 Development Server
Starting server at http://0.0.0.0:4020 in debug mode
To quit sc-server, press Control-C
>> Thin web server (v1.2.7 codename No Hup)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:4020, CTRL+C to stop
LocalJumpError: no block given
/Library/Ruby/Gems/1.8/gems/sproutcore-1.4.1/lib/sproutcore/models/manifest.rb:26:in `each'
/Library/Ruby/Gems/1.8/gems/sproutcore-1.4.1/lib/sproutcore/models/manifest.rb:26:in `visible'