Skip to content

Instantly share code, notes, and snippets.

View onlyshk's full-sized avatar

Kuleshov Alexander onlyshk

View GitHub Profile
@onlyshk
onlyshk / gist:1327774
Created October 31, 2011 15:36
Simple test
public class Main {
/**
* Test Eq<T> interface
*/
public static void main(String[] args) {
Color color1 = new Color(ColorType.Red);
Color color2 = new Color(ColorType.Green);
System.out.println("Red == Green -> " + color1.eq(color1, color2));
@onlyshk
onlyshk / gist:1327768
Created October 31, 2011 15:34
java Eq interface
enum ColorType {
Red,
Yellow,
Green
}
interface Eq<T> {
Boolean eq(T a, T b);
}
@onlyshk
onlyshk / gist:1327765
Created October 31, 2011 15:34
Color data structure with Eq class type instance
data Color = Red | Yellow | Green
instance Eq Color where
Red == Red = True
Yellow == Yellow = True
Green == Green = True
_ == _ = False
%%%---------------------------------------------------------------------
%%% Module config
%%%---------------------------------------------------------------------
%%% mod_poker plugin's config
%%%---------------------------------------------------------------------
%%% Exports
%%%---------------------------------------------------------------------
%%% create_foobar(Parent, Type)
%%% returns a new foobar object
%%% etc etc etc
@onlyshk
onlyshk / gist:1308786
Created October 24, 2011 11:11
emacs build error
cd lib-src; make all \
CC='gcc' CFLAGS='-g -O2 -Wno-pointer-sign ' CPPFLAGS='-D_BSD_SOURCE ' \
LDFLAGS='-Wl,-znocombreloc ' MAKE='make'
make[1]: Entering directory `/home/shk/emacs-22.1/lib-src'
Makefile:148: *** commands commence before first target. Stop.
make[1]: Leaving directory `/home/shk/emacs-22.1/lib-src'
make: *** [lib-src] Error 2
[shk@myhost emacs-22.1]$ make
cd lib-src; make all \
CC='gcc' CFLAGS='-g -O2 -Wno-pointer-sign ' CPPFLAGS='-D_BSD_SOURCE ' \
(setq load-path (cons "/usr/lib/erlang/lib/tools-2.6.6.1/emacs" load-path))
(add-to-list 'auto-mode-alist '("\\.erl?$" . erlang-mode))
(add-to-list 'auto-mode-alist '("\\.hrl?$" . erlang-mode))
(setq erlang-root-dir "/usr/lib/erlang")
(add-to-list 'exec-path "/usr/lib/erlang/bin")
(setq erlang-man-root-dir "/usr/lib/erlang/man")
(defun my-erlang-mode-hook ()
# Makefile for GNU Emacs.
# Copyright (C) 1985, 1987, 1988, 1993, 1994, 1995, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008
# Free Software Foundation, Inc.
# This file is part of GNU Emacs.
# GNU Emacs is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
start(Pid) ->
register(my_process, spawn(module, loop, [Pid])).
loop(Pid) ->
receive
{From, give_pid} ->
From ! Pid
end,
loop(Pid).
{"src/*", [debug_info, {d, debug}, {outdir, "ebin"}, {i, "include"}]}.
@onlyshk
onlyshk / gist:1266661
Created October 6, 2011 06:21
diff between time
T2 = erlang:now(),
A = timer:now_diff(T2, T1),
?INFO_MSG("T2 - T1 -- " ++ integer_to_list(A), []),