Skip to content

Instantly share code, notes, and snippets.

@ramn
ramn / print_delicious_rss_feed.scala
Created August 21, 2011 18:28
Print rss feed (Scala)
val feed = xml.XML.load(new java.net.URL("http://feeds.delicious.com/v2/rss/some_user/some_tag"))
for (item <- feed \\ "item") {
println(item \\ "title" text)
println(item \\ "link" text)
}
@ramn
ramn / delicious_post_bookmarklet_original.js
Created June 12, 2011 00:04
Delicious Save Bookmarklet Original
javascript:(function(){f='http://www.delicious.com/save?url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'&notes='+encodeURIComponent(''+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text))+'&v=6&';a=function(){if(!window.open(f+'noui=1&jump=doclose','deliciousuiv6','location=yes,links=no,scrollbars=no,toolbar=no,width=550,height=550'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})()
@ramn
ramn / delicious_post_bookmarklet.js
Created June 10, 2011 08:40
Delicious Save Bookmarklet, stripping utm_*
javascript:(function(){f='http://www.delicious.com/save?url='+encodeURIComponent(window.location.href.replace(/utm_source=[^&]+&?|utm_medium=[^&]+&?|utm_campaign=[^&]+&?|utm_content=[^&]+&?/g, "").replace(/[?&]+$/, ""))+'&title='+encodeURIComponent(document.title)+'&notes='+encodeURIComponent(''+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text))+'&v=6&';a=function(){if(!window.open(f+'noui=1&jump=doclose'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})()
@ramn
ramn / MinimalSoapServer.scala
Created February 4, 2011 11:06 — forked from kings13y/MinimalSoapServer.scala
Soap server in Scala
/*
CHANGELOG
- add annotation for param names
*/
import javax.jws.{WebService, WebParam}
import javax.jws.soap.SOAPBinding
import SOAPBinding.Style
import javax.xml.ws.Endpoint
@ramn
ramn / emacs_uniq-lines.el
Created January 26, 2011 10:29
Emacs function that removes duplicate rows in a region
;; uniq-lines
;; ----------
;; This is something of a companion to the built-in sort-lines function.
;; Like the uniq utility, this removes duplicate lines from the region. It
;; is best used after sorting a region.
;;
(defun uniq-lines (start end)
"Removes duplicate lines from the selected region."
(interactive "*r")
(goto-char start)
@ramn
ramn / XmlSchemaValidator.scala
Created December 2, 2010 11:02
XML Schema validator in Scala
import javax.xml.transform.stream.StreamSource
import javax.xml.validation.Schema
import javax.xml.validation.SchemaFactory
import javax.xml.validation.{Validator=>JValidator}
import org.xml.sax.SAXException
object Validator {
def main(args: Array[String]) {
require(args.size >= 2, "Params: xmlFile, xsdFile")
val result =