This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function grbi() { | |
if [ "$1" -gt 0 ]; then | |
git rebase -i "HEAD~${1}" | |
else | |
echo "Using: grbi n\n (n is number greater then 0)" | |
fi | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List | |
import Control.Monad | |
data Section = Section {getA :: Int, getB :: Int, getC :: Int} deriving Show | |
pathData :: [[Int]] | |
pathData = [[50,10,30],[5,90,20],[40,2,25],[10,8,0]] | |
makeSections :: [Section] | |
makeSections = foldr (\(a:b:c:[]) sections -> Section a b c : sections) [] pathData |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List | |
import System.Environment | |
test :: String | |
test = "D3C3C10D10S3" | |
test2 :: String | |
test2 = "D3C3C10D10S4" | |
test3 :: String |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Heap (Heap(Empty, Node), getValue, insert, pop, fromList) where | |
import Prelude hiding (foldl, foldr) | |
import Data.Foldable | |
import Data.Monoid | |
data Heap a = Empty | Node (Heap a) a (Heap a) | |
instance (Show a) => Show (Heap a) where | |
show Empty = "E" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Monad.State | |
import Control.Monad.Writer | |
import System.Environment | |
import Data.List | |
type Result = (Int, Int, Int) | |
showResult :: Result -> String | |
showResult (o, s, b) = show o ++ show s ++ show b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Prelude hiding (lookup) | |
import Data.List hiding (lookup) | |
import Data.Maybe | |
import Data.Map | |
import Control.Monad.RWS | |
import System.Environment | |
data Node = A | B | C | D | E | F deriving (Show, Eq, Ord, Enum) | |
data Path = Path {source :: Node, target :: Node} deriving Show |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Monad.RWS | |
import System.Environment | |
data Node = A | B | C | D | E | F deriving (Show, Eq, Ord, Enum) | |
data Path = Path {source :: Node, target :: Node} deriving Show | |
data NodeGroup = NG Node Node Node Node deriving Show | |
route :: Path -> Char -> Node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "bundler/setup" | |
require "pattern-match" | |
require "pp" | |
class Tree | |
class Node | |
attr_accessor :value, :left, :right | |
include PatternMatch::Deconstructable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "bundler/setup" | |
require "tapp" | |
class Regexp | |
def self.build(*numbers) | |
nums = [] | |
numbers.each do |num| | |
if num.is_a? Range | |
nums.concat(num.to_a) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List | |
import Control.Monad.Writer | |
import System.Environment | |
testSource :: [Int] | |
testSource = [100, 5, 5, 2, 6, 8] | |
testTarget :: Int | |
testTarget = 522 |