Skip to content

Instantly share code, notes, and snippets.

View ostronom's full-sized avatar

Konstantin Kirillov ostronom

View GitHub Profile
module V.Views {
export class View {
public someVar: any;
// the presence of constructor doesn't affect the error triggering
}
}
module V.App {
export class Application {
public registerView(url: string, viewKlass: V.Views.View): void
# async calls sequentalization
apply = (f, s) -> () -> f( () -> s() )
id = (args...) -> args
foldr = (f, z, [x, xs...]) -> if x then f x, (foldr f, z, xs) else z
chain = (funcs...) -> (foldr apply, id, funcs)()
action1 = (done) ->
async_action_with_callback(done)
@ostronom
ostronom / CountryController.scala
Created February 20, 2012 17:00
Play 2.0 & squeryl simple integration
package controllers
import org.squeryl.PrimitiveTypeMode._
import org.squeryl.{Session}
import play.api._
import play.api.mvc._
import models._
import Text.Pandoc (WriterOptions, writerHtml5, writerWrapText, Pandoc, Inline(..), bottomUp)
import Hyphen (hyphenizeString)
hyphenize :: [Inline] -> [Inline]
hyphenize (Str x : xs) = (Str $ hyphenizeString x) : xs
hyphenize x = x
defaultPageCompiler = pageCompilerWithPandoc defaultHakyllParserState defaultWriterOptions (bottomUp hyphenize)
{-# LANGUAGE OverloadedStrings, PackageImports #-}
module Hyphen (hyphenizeString) where
import qualified Text.Regex as R
hyphenizeString :: String -> String
hyphenizeString x = foldl subHyphen x (map compileRule rules)
where rus_v = "[аеёиоуыэюя]" :: String
rus_n = "[бвгджзклмнпрстфхцчшщ]" :: String
rus_x = "[йъь]" :: String
rus_a = "[абвгдеёжзийклмнопрстуфхцчшщъыьэюя]" ::String
-E7gAANL5QKLVP__B2YAAM_w__-aBwAAhm3__7BIAAAh6P__PwMAAFls_v_T_f__4hj__yPb___QJP__6pj__7hK_v_u2P__KpD-_yo1AACu_f3_1wkBAAAAAABFEAAAqPv__yEOAABS9___2QoAACdc___higAAu7z__0sdAABqYP7_DrMAAC2c__8fGwAAhKD__-sLAACo-___bQUAAM-9__8GDQAA_PL__8YJAAArAgAAWREAAO8LAABLHQAA6v7__04QAAB_-f__Bg0AAJfU__83KQAAz73__x1OAAAN5___jRMAAPDY___ZCgAAzvD__6wIAAA89v__2QoAAH_5__8GDQAAje3__7IVAAD68v__DBoAALTi__-mIQAA-vL__wwaAAB_-f__MRwAALnv__-0CAAAje3__-b-__-04v__uu___3ns__-m-___bdL__5oHAADmvv__Zvj__-nL___NFgAAmtT__z8pAACN7f__fwYAAAvn__9zEgAADOf__4UTAACH4P__eR8AAD7D__-pYQAA0_3__4wgAADFCQAA8wsAAKr7___ZCgAAh63__zr2__9O6v__WQQAAArn__-GEwAAUvf__9kKAAD68v__DBoAAMvj__9gEQAAj8L__xILAADAKP__bfv__1Rd_v-bgwAAIur__4ejAAB9-f__tAgAAMzk_v-yuwAAXN7__40TAADJ2P3_kPkAAInV_f_o1gEAQgT__4esAAAd2___YBEAAG3S___rCwAAPir__0wdAACN7f__AAAAAGf4__-B-f__AAAAAAz0__9YBAAAQvb__2IeAABa3v__Zvj__1T3___88v__pvv__6Tu___t_v__ju3__yYCAAAH2_7__yUAAIng__-aBwAAG9v__1gRAADOS_7_wTsBAITU_v9lkAEAIbX__yOBAACxov__KtsAALmJ___5vgAAR93__0U2AAA89v__mgcAALrv__9SBAAA9n___4sgAAC1r___cxIAAKguAACOUgEA
class YandexEncoder(object):
million = 10**6
points = []
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_='
def __init__(self, geom):
#self._encode(geom)
self.points = [
self.lift( (37.593578,55.735094) ),
self.lift( (37.592159,55.732469) ),
self.lift( (37.589374,55.734162) )
-------------------------------------------------------------------------------
-- xmonad.hs for xmonad-darcs
-- Author: Øyvind 'Mr.Elendig' Heggstad <mrelendig AT har-ikkje DOT net>
-------------------------------------------------------------------------------
-- Imports --
-- stuff
import XMonad
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import System.Exit
Pq.loginController = SC.ObjectController.create({
userName: null,
password: null
});
module Views where
import Control.Monad
import Happstack.Server (ServerPart, Response, ok, toResponse, dir)
import Text.Blaze ((!))
import qualified Text.Blaze.Html5 as H
import qualified Text.Blaze.Html5.Attributes as A
routes = msum [ dir "smth" $ notok
, index