Skip to content

Instantly share code, notes, and snippets.

@worldsayshi
worldsayshi / fiddle.html
Created December 13, 2012 17:44
Source to Dom mapping: Combinator utilities for creating a callback that inserts elements into the DOM tree once a long running data retrieval operation is done.
<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML>
<HEAD>
<TITLE>
Datasource to DOM mapping
</TITLE>
</HEAD>
<BODY>
<b>A list of stuff:</b>
<ul id="dest"></ul>
@worldsayshi
worldsayshi / GroupingAlgorithm.pseudo
Created December 14, 2012 16:43
Algorithm for ranking and grouping properties of a set of ranked articles.
Grouping Algorithm ('ranked articles') =
'input groups' : [{'Property Names'}] <- trivially preprocess 'ranked articles'
'set of all graphs' <- 'Identify separate graphs' using 'input groups'
groups : {Group} <- empty
for each graph in 'set of all graphs'
'spanning tree' <- 'Find minimal spanning tree' of graph
groups += 'Split spanning tree' 'spanning tree' into groups
groups <- merge groups smaller than (g_min : Int)
'ranked groups' <- rank groups by average scoring
return 'ranked groups'
This is my gist
@worldsayshi
worldsayshi / headlines.md
Last active December 12, 2015 01:38
Headlines for master thesis

Preface

  • Abstract
  • Background/Introduction

Prototype summary

  • Pluggable facet filters
  • Grouping algorithm
  • (Solr configuration)

@worldsayshi
worldsayshi / mergeRepos.md
Last active December 25, 2015 04:09
How to merge git repos into a parent repo while maintaining history and using only "conventional git commands"

How to merge git repos with history with conventional git commands only

Clone what is to become child projects

git clone git:path/to/repo1
git clone git:path/to/repo2

Move repo contents one level down. By default this should not move hidden files. We don't want to move the .git folder so that is good.

{-# LANGUAGE ScopedTypeVariables #-}
module Blog.DynLoad (
loadSourceGhc,
execFnGhc
) where
{-
Source:
http://codeutopia.net/blog/2011/08/20/adventures-in-haskell-dynamic-loading-and-compiling-of-modules/
https://gist.github.com/jhartikainen/1158986
@worldsayshi
worldsayshi / DynLoad.hs
Last active February 25, 2022 15:01 — forked from jhartikainen/DynLoad.hs
Example for loading Haskell source code dynamically using the GHC api
-----------------------------------------------------------------------------
-- | Example for loading Haskell source code dynamically using the GHC api
-- Tested on ghc 7.4.2
--
-- Useful links:
-- GHC api:
-- http://www.haskell.org/ghc/docs/latest/html/libraries/ghc/GHC.html
-- Wiki:
-- http://www.haskell.org/haskellwiki/GHC/As_a_library
-----------------------------------------------------------------------------
@worldsayshi
worldsayshi / list_today.py
Last active November 24, 2016 12:30
Put this script in your working dir and run it at the end of the day to remind you what you've done (+ some other git useful commands)
#!/usr/bin/python
import os, fnmatch
# Some useful git commands to choose from:
reposNotCommited = 'git --no-pager log --branches --not --remotes --simplify-by-decoration --decorate --oneline'
logEntriesToday = 'git --no-pager log --since="6am"'
logEntriesLastSemester = 'git --no-pager log --since="2014-01-01" --until="2014-06-30" --oneline --author="Jon Doe"'
logEntriesThisWeek = 'git --no-pager log --since="last sunday"'
@worldsayshi
worldsayshi / Templ1.hs
Last active August 29, 2015 14:07
Hello world inspection of haskell data types with template haskell
{-# LANGUAGE TemplateHaskell #-}
module Templ1 where
import Language.Haskell.TH
import Templ2
data Person = P {
name :: String,
age :: Integer
}
@worldsayshi
worldsayshi / Label.hs
Last active August 29, 2015 14:07
How to create lenses for Algebraic Data Types with fclabels
{-# LANGUAGE
TemplateHaskell
#-}
module Label where
import Data.Label.Partial
import Data.Label.Base
import Data.Label.Derive
data Foo a b c = A a
| B b