Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View tsloughter's full-sized avatar

Tristan Sloughter tsloughter

View GitHub Profile
/* These all just call the generic function since they're all basically the same
* anyway. Unfortunately, they can't just be macros, since we need to be able to
* create a pointer to them for callbacks. */
static gboolean goto_tab_1 (tilda_window *tw) { return goto_tab_generic (tw, 1); }
static gboolean goto_tab_2 (tilda_window *tw) { return goto_tab_generic (tw, 2); }
static gboolean goto_tab_3 (tilda_window *tw) { return goto_tab_generic (tw, 3); }
static gboolean goto_tab_4 (tilda_window *tw) { return goto_tab_generic (tw, 4); }
static gboolean goto_tab_5 (tilda_window *tw) { return goto_tab_generic (tw, 5); }
static gboolean goto_tab_6 (tilda_window *tw) { return goto_tab_generic (tw, 6); }
static gboolean goto_tab_7 (tilda_window *tw) { return goto_tab_generic (tw, 7); }
==> make install
/usr/bin/cc -O3 -march=core2 -msse4.1 -w -pipe -DBUILD="\"1.4\"" -iquote. -I/opt/local/include -c -o attributes.o attributes.c
/usr/bin/cc -O3 -march=core2 -msse4.1 -w -pipe -DBUILD="\"1.4\"" -iquote. -I/opt/local/include -c -o cfg.o cfg.c
In file included from attributes.c:23:
tmux.h:30:19: error: event.h: No such file or directory
In file included from cfg.c:26:
tmux.h:30:19: error: event.h: No such file or directory
In file included from cfg.c:26:
tmux.h:830: error: field ‘name_timer’ has incomplete type
In file included from attributes.c:23:
class @viewModel
firstname : ko.observable ""
lastname : ko.observable ""
email : ko.observable ""
username : ko.observable ""
password : ko.observable ""
save : ->
$.post '/user', ko.toJSON(this), (data) -> $('body').append "Successfully created user."
def __new__(clazz, *args, **kwargs):
if not clazz.__instance:
clazz.__instance = super(Se, clazz).__new__(
clazz, *args, **kwargs)
clazz.__instance.__singleton_init()
return clazz.__instance
set(Vals, Rec) ->
F = fun ([], R, _F1) -> R;
([{field, V} | T], R, F1) ->
F1(T, R#hello{field = V}, F1)
end,
F(Vals, Rec, F).
vs
%%%-------------------------------------------------------------------
%%% @author Tristan Sloughter <>
%%% @copyright (C) 2011, Tristan Sloughter
%%% @doc
%%%
%%% @end
%%% Created : 5 Jul 2011 by Tristan Sloughter <>
%%%-------------------------------------------------------------------
-module(ct_model_sessions).
-spec is_valid(binary(), binary()) -> true | false.
is_valid(Username, Password) ->
case ct_model_users:find([{username, Username}]) of
not_found ->
false;
User ->
UserPassword = ct_model_users:get(password, User),
UserPassword =:= bcrypt:hashpw(Password, UserPassword)
end.
-spec is_valid(binary(), list()) -> true | false.
is_valid(Username, Password) when is_binary(Username),
is_list(Password) ->
case ct_model_users:find([{username, Username}]) of
not_found ->
false;
User ->
UserPassword = ct_model_users:get(password, User),
UserPassword =:= bcrypt:hashpw(Password, UserPassword)
end.
-spec is_valid(binary(), list()) -> true | false.
is_valid(Username, Password) when is_binary(Username),
is_binary(Password) ->
is_valid(Usernname, binary_to_list(Password);
is_valid(Username, Password) when is_binary(Username),
is_list(Password) ->
case ct_model_users:find([{username, Username}]) of
not_found ->
false;
User ->
greater_than_3(X) when X > 3 -> true;
greater_than_3(X) -> false.