Skip to content

Instantly share code, notes, and snippets.

@mmagm
mmagm / tree.rb
Last active August 29, 2015 13:56
class Node
attr_accessor :numbers
attr_accessor :children
def initialize
@numbers = []
@children = []
end
end
@mmagm
mmagm / Tree.java
Last active August 29, 2015 13:56
import java.util.Stack;
import java.util.Queue;
import java.util.ArrayList;
import java.util.List;
import java.util.ArrayDeque;
import java.util.LinkedList;
public class Tree {
private Node root = null;
require 'devise'
class TestToken
def self.token
@token ||= Devise.friendly_token
end
end
class TestToken2 < TestToken
end
import Data.Functor
import Control.Applicative
newtype O f g a = O { unO :: f (g a) }
instance (Functor f, Functor g) => Functor (O f g) where
-- fmap :: (a -> b) -> O f g a -> O f g b
fmap f' o = O $ fmap (\g' -> fmap f' g') $ unO o
instance (Applicative f, Applicative g) => Applicative (O f g) where
import Control.Monad
import Data.List
distinct :: Eq a => [a] -> Bool
distinct [] = True
distinct (x:xs) = case x `elem` xs of
True -> False
False -> distinct xs
multipleDwelling :: [[(String, Integer)]]
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
int main(void) {
int8_t ms[] = {
0x50,
0x50,
0x50,
0x50,