Skip to content

Instantly share code, notes, and snippets.

@laughedelic
laughedelic / go-model.json
Last active August 29, 2015 14:03
Json representation of the GO Bio4j module
{
"label" : "go",
"properties" : [
{
"label" : "id",
"type" : "java.lang.String"
},
{
"label" : "name",
"type" : "java.lang.String"
{
"schemas" : [
{
"label" : "enzymedb",
"properties" : [
{
"label" : "id",
"type" : "java.lang.String"
},
{
@laughedelic
laughedelic / tabulaInANutshell.scala
Created September 5, 2014 15:49
This is kind of a minimal example of the tags failure. Works with the commented variation.
import ohnosequences.pointless._, AnyTaggedType._
trait AnyAct {
type Itm <: AnyTaggedType
val itm: Itm
// type Out[I <: Itm] = Tagged[I]
type Out = Tagged[Itm]
}
@laughedelic
laughedelic / Readme.md
Last active August 29, 2015 14:23
Typing unicode symbols in Atom (temporary solution)

Temporary solution for typing unicode symbols in Atom

Usage

  1. Install autocomplete-plus and autocomplete-snippets plugins
  2. Add these snippets to your snippets.cson
  3. Try typing u and the LaTeX name of the symbol you want and you should get autocompletetion with a preview of the symbol

Notes

scala> val conf = new org.apache.commons.configuration.BaseConfiguration()
conf: org.apache.commons.configuration.BaseConfiguration = org.apache.commons.configuration.BaseConfiguration@3ada9e37
scala> conf.setProperty("storage.directory", "/media/ephemeral0/applicator/16s/bio4j")
scala> conf.setProperty("storage.backend", "berkeleyje")
scala> val graph = new com.bio4j.titan.model.ncbiTaxonomy.TitanNCBITaxonomyGraph( new com.bio4j.titan.util.DefaultTitanGraph( com.thinkaurelius.titan.core.TitanFactory.open(conf) ) )
17:46:21.350 [main] DEBUG c.t.t.d.b.BerkeleyJEStoreManager - Opened database system_properties
java.lang.Throwable: null
@laughedelic
laughedelic / TH+SYB_substNames.hs
Created November 1, 2011 23:29
Names substitution in declaration templates (TH + SYB)
{-# LANGUAGE TemplateHaskell #-}
import Language.Haskell.TH
import Language.Haskell.TH.Lib hiding (rename)
import Control.Monad (liftM)
import Data.List (lookup)
import Data.Generics.Aliases (mkT)
import Data.Generics.Schemes (everywhere)
----------------------------------------------------------------
@laughedelic
laughedelic / Printf.hs
Created November 15, 2011 20:33
printf с помощью Template Haskell
{-# LANGUAGE TemplateHaskell #-}
module Printf (printf) where
-- Импортируем инструментарий Template Haskell
import Language.Haskell.TH
-- | Шаблон для функции printf
-- Пример использования:
-- > putStrLn ( $(printf "Number %d is %s of %d.") 327 "square" (327^2) )
@laughedelic
laughedelic / Prolog.hs
Created December 1, 2011 15:32 — forked from hodzanassredin/Prolog.hs
simple type level predicates in haskell (with functional dependencies)
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, UndecidableInstances #-}
module Prolog (Petja, Vasja, Serg, Father, Son, GrandFather) where
data Petja = Petja
data Vasja = Vasja
data Serg = Serg
@laughedelic
laughedelic / DecemberFair.hs
Created December 2, 2011 19:05
Solution for december FP fair
module DecemberFair where
import Data.Maybe (listToMaybe)
import Data.List (permutations, nubBy)
-- only non-symetric permutations
permute :: (Eq a) => [a] -> [[a]]
permute = nubBy (\ys zs -> ys == (reverse zs)) . permutations
-- binary operators
@laughedelic
laughedelic / g8test.sh
Last active December 11, 2015 09:58
Simple script for testing g8 templates without giter8 sbt-plugin (because it's weird). See instructions in comments.
# assuming that this script lies in g8test/ folder of the root directory of a g8-template
cd g8test
g8 file://.. --name=template > /dev/null
echo "Template applied in g8test/template/"
cd template
echo "sbt test:" && sbt test
cd ../..