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
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdbool.h> | |
int main(void) { | |
int8_t ms[] = { | |
0x50, | |
0x50, | |
0x50, | |
0x50, |
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 | |
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)]] |
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.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 |
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 'devise' | |
class TestToken | |
def self.token | |
@token ||= Devise.friendly_token | |
end | |
end | |
class TestToken2 < TestToken | |
end |
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 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; |
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
class Node | |
attr_accessor :numbers | |
attr_accessor :children | |
def initialize | |
@numbers = [] | |
@children = [] | |
end | |
end |
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 'find' | |
class Expression | |
def |(other) | |
Or.new(self,other) | |
end | |
def &(other) | |
And.new(self,other) | |
end |
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
class Node | |
attr_accessor :next | |
attr_accessor :value | |
def initialize(value) | |
@next = nil | |
@value = value | |
end | |
end |
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
class InfiniteCycleEnumerator | |
def self.enum(num) | |
Enumerator.new do |y| | |
idx = 0 | |
loop do | |
y << idx % num | |
idx = idx + 1 | |
end | |
end | |
end |
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
(defun replace-rockets () | |
(interactive) | |
(goto-char (point-min)) | |
(while (re-search-forward ":\\([_A-Za-z0-9]+\\)[\t\n ]+=>" nil t) | |
(replace-match "\\1:"))) |
NewerOlder