(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
module Main exposing (..) | |
import Html exposing (..) | |
import Html.App as Html | |
import Html.Attributes exposing (..) | |
import Html.Events exposing (onInput, onClick) | |
import List exposing (..) | |
import String exposing (..) | |
import Char exposing (..) |
# Python implementation of Aho-Corasick string matching | |
# | |
# Alfred V. Aho and Margaret J. Corasick, "Efficient string matching: an aid to | |
# bibliographic search", CACM, 18(6):333-340, June 1975. | |
# | |
# <http://xlinux.nist.gov/dads//HTML/ahoCorasick.html> | |
# | |
# Copyright (C) 2015 Ori Livneh <ori@wikimedia.org> | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); |
powerset :: [a] -> [[a]] | |
powerset [] = [[]] | |
powerset (x:xs) = map (x:) (powerset xs) ++ powerset xs |
/** | |
* Examples of writing mixed unit/property-based (ScalaCheck) tests. | |
* | |
* Includes tables and generators as well as 'traditional' tests. | |
* | |
* @see http://www.scalatest.org/user_guide/selecting_a_style | |
* @see http://www.scalatest.org/user_guide/property_based_testing | |
*/ | |
import org.scalatest._ |
/** | |
* Assignment 4: Huffman coding | |
* | |
*/ | |
object Huffman1 { | |
abstract class CodeTree | |
case class Fork(left: CodeTree, right: CodeTree, chars: List[Char], weight: Int) extends CodeTree | |
case class Leaf(char: Char, weight: Int) extends CodeTree |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
#!/usr/bin/env python | |
# -*- coding: utf-8 | |
""" | |
Search longest common substrings using generalized suffix trees built with Ukkonen's algorithm | |
Author: Ilya Stepanov <code at ilyastepanov.com> | |
(c) 2013 | |
""" |
__author__ = 'robert' | |
""" | |
Implementation inspired by Petr Mitrichev's blog post http://petr-mitrichev.blogspot.co.nz/2013/05/fenwick-tree-range-updates.html | |
and | |
Yoshiya Miyata's Quora answer http://qr.ae/pHhNN | |
""" | |
class Bit: | |
def __init__(self, n): |
class DeBruijnGraph: | |
""" A de Bruijn multigraph built from a collection of strings. | |
User supplies strings and k-mer length k. Nodes of the de | |
Bruijn graph are k-1-mers and edges correspond to the k-mer | |
that joins a left k-1-mer to a right k-1-mer. """ | |
@staticmethod | |
def chop(st, k): | |
""" Chop a string up into k mers of given length """ | |
for i in xrange(0, len(st)-(k-1)): |
Sometimes you want to have a subdirectory on the master
branch be the root directory of a repository’s gh-pages
branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master
branch alongside the rest of your code.
For the sake of this example, let’s pretend the subfolder containing your site is named dist
.
Remove the dist
directory from the project’s .gitignore
file (it’s ignored by default by Yeoman).