Skip to content

Instantly share code, notes, and snippets.

View marcusmonteiro's full-sized avatar

Marcus Vinicius Monteiro de Souza marcusmonteiro

View GitHub Profile
@gabehollombe
gabehollombe / Main.elm
Created July 26, 2016 08:04
Example solution for Exercises from the Elm guide chapter on Forms
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 (..)
@atdt
atdt / aho_corasick.py
Last active April 12, 2024 19:29
Aho-Corasick string matching in Python
# 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");
@angerman
angerman / powerset.hs
Last active May 3, 2018 20:39
Powersets in Haskell
powerset :: [a] -> [[a]]
powerset [] = [[]]
powerset (x:xs) = map (x:) (powerset xs) ++ powerset xs
@davidallsopp
davidallsopp / PropertyTests.scala
Last active September 16, 2020 14:07
Examples of writing mixed unit/property-based (ScalaTest with ScalaCheck) tests. Includes tables and generators as well as 'traditional' tests.
/**
* 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._
@valtih1978
valtih1978 / HuffmanScalaAssignment.sc
Last active May 3, 2018 17:30
Odersky ProgFun coursera Huffman coding assignment
/**
* 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
@staltz
staltz / introrx.md
Last active June 29, 2024 15:58
The introduction to Reactive Programming you've been missing
@istepanov
istepanov / lcs.py
Created September 10, 2013 08:23
Search longest common substrings using generalized suffix trees built with Ukkonen's algorithm, written in Python 2.7
#!/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
"""
@robert-king
robert-king / fenwick_tree.py
Created May 28, 2013 03:51
Python Binary Index Tree (Fenwick tree) with range updates.
__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):
@BenLangmead
BenLangmead / DeBruijn.py
Last active September 26, 2023 15:39
Demonstration of de Bruijn graph construction and Eulerian path/cycle finding.
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)):
@cobyism
cobyism / gh-pages-deploy.md
Last active June 26, 2024 23:06
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

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.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).