Skip to content

Instantly share code, notes, and snippets.

public class AuthenticationFactory {
public static Object result; # Change Object with appropriete type returned from AuthenticationManager
public static void init() {
# code for authentication and so on
self.result = AuthenticationManager.method()
}
public static Object getResult() {
return self.result;
@hahcho
hahcho / gist:b7b83757f02d713e0fd7
Created December 14, 2015 21:06
ruby-match-array
expect(agenda.notes.size).to eq(2)
expect(agenda.notes.first.file_name).to eq('todo_list')
expect(agenda.notes.first.header).to eq('one')
expect(agenda.notes.first.date.class).to eq(LazyMode::Date)
expect(agenda.notes.first.date.year).to eq(2012)
expect(agenda.notes.first.date.month).to eq(8)
expect(agenda.notes.first.date.day).to eq(7)
expect(agenda.notes.first.status).to eq(:postponed)
expect(agenda.notes.first.body).to eq('one body lies here...')
@hahcho
hahcho / Fact ot Rule
Created November 21, 2014 17:59
Fact or Rule
zaebin(mario):- prezkurin(mario).
import unittest
import collections
from solution import (RANKS, SUITS, Card, CardCollection,
StandardDeck, SixtySixDeck, BeloteDeck)
class RankTest(unittest.TestCase):
def setUp(self):
self.rank_string = 'Three'
self.rank = RANKS[self.rank_string]()
class ArrayMatcher
attr_reader :matcher
def initialize(*matcher)
@matcher = matcher
end
def ===(other)
matcher.zip(other).all? {|pair| pair.first === pair.last}
end