This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package servlet; | |
import clojure.lang.RT; | |
import clojure.lang.Var; | |
import javax.servlet.ServletException; | |
import javax.servlet.ServletResponse; | |
import javax.servlet.http.HttpServlet; | |
import javax.servlet.http.HttpServletRequest; | |
import javax.servlet.http.HttpServletResponse; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import signal | |
server = None | |
def sigusr1_handler(signum, frame): | |
server.close() | |
signal.signal(signal.SIGUSR1, sigusr1_handler) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'fileutils' | |
if ARGV.length != 2 | |
puts "Usages: #{$0} <moin pages directory> <gitit wikidata directory>" | |
exit 1 | |
end | |
from_dir = File.expand_path ARGV[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'hpricot' | |
require 'open-uri' | |
INDEX_PAGE = "http://community.livejournal.com/clinic_duty/12225.html" | |
(open(INDEX_PAGE) { |f| Hpricot(f) }/"table > tbody > tr > td > a").each do |a| | |
#Skip season links |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.sql.ResultSet; | |
import java.sql.SQLException; | |
import java.sql.Types; | |
import java.util.List; | |
import javax.sql.DataSource; | |
public class FooDao extends JdbcDaoSupport { | |
private final String COLUMNS = "id a b"; | |
private final RowMapper<Foo> rowMapper = new RowMapper<Foo>() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package geojson; | |
import com.google.gson.JsonArray; | |
import com.google.gson.JsonElement; | |
import com.google.gson.JsonObject; | |
import com.google.gson.JsonSerializationContext; | |
import com.google.gson.JsonSerializer; | |
import org.geotools.feature.FeatureCollection; | |
import org.geotools.feature.FeatureIterator; | |
import org.opengis.feature.Feature; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.List; | |
import com.google.common.base.Function; | |
public interface JdbcTemplate { | |
<T> List<T> query(String sql, Object[] args, int[] argTypes, RowMapper<T> rowMapper); | |
<T> T queryFirst(String sql, Object[] args, int[] argTypes, RowMapper<T> rowMapper); | |
int queryForInt(String sql, Object[] args, int[] argTypes); | |
<T> void eachDo(String sql, Object[] args, int[] argTypes, RowMapper<T> rowMapper, Function<T, Void> block); | |
int update(String sql, Object[] args, int[] argTypes); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Pic (plugin) where | |
-- This plugin allows you to include a PIC diagram | |
-- in a page like this: | |
-- | |
-- ~~~ {.pic name="diagram1"} | |
-- box "box" | |
-- ~~~ | |
-- | |
-- The "pic2png" executable must be in the path. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns markup.test | |
(:use (clojure.java shell))) | |
(defn run-test [name input expected dut] | |
(let [actual (:out (sh dut :in input))] | |
(if (= actual expected) | |
:pass | |
:fail))) | |
(defn print-plan [tests] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn look-and-say [input] | |
((fn [input acc] | |
(if (empty? input) | |
(reverse acc) | |
(let [[x & xs] input [i n & as] acc] | |
(if (= x i) | |
(recur xs (list* x (inc n) as)) | |
(recur xs (list* x 1 acc)))))) | |
(rest input) [(first input) 1])) |