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
package smsw::Table; | |
use Dancer ':syntax'; | |
use Dancer::Plugin::Scoped; | |
our $VERSION = '0.1'; | |
use strict; | |
sub my_template ($$$) { | |
my ($prefix, $file, $args) = @_; | |
$args->{lib}->{nbsp} = sub { $_[0] =~ s/\s+/ /g; $_[0] }; | |
$args->{lib}->{row} = sub { join '', map { join('', '<', $_[0],'>',$_,'</',$_[0],'>') } @{$_[1]} }; |
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
UAJQ = require("UA/JQ.coffee") | |
ua = new UAJQ | |
test_create_update_delete = (ua, name) -> | |
ua.then "click new", -> | |
@click "#0", ".ui-dialog-title" | |
ua.then "create #{name}", -> | |
@text "input[name=name]", "test" |
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
setup_sync() -> | |
sync:go(), | |
{ok, Comet} = wf:comet(fun() -> reload() end), | |
sync:onsync(fun(_) -> Comet ! {self(), reload} end). | |
reload() -> | |
receive | |
{_, reload} -> | |
wf:wire( "location.reload()" ), | |
wf:flush() |
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
map_spec_field(state, false) -> '$1'; | |
map_spec_field(_, false) -> '_'; | |
map_spec_field(F, {F, V}) -> V. | |
make_match_spec(Props) -> | |
lists:foldl( | |
fun | |
(F, Tuple) -> | |
erlang:append_element(Tuple, map_spec_field(F, lists:keyfind(F, 1, Props))) | |
end, {game}, record_info(fields, game)). |
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
if_true(true, Action) -> Action; | |
if_true(false, _) -> no_such_tile. | |
check_tile_exists(ExistsAction, Seat, Tile, Seats) -> | |
#desk_seat{ hand=Hand } = lists:nth(Seat, Seats), | |
if_true(deck:member(Tile, Hand), ExistsAction). | |
wait_for_discard({check_discard_possible, Seat, Tile}, S=#state{seat=Seat, seats=Seats}) -> | |
wait_for_discard({check_tile_exists(discard, Seat, Tile, Seats), Seat, Tile}, S); |
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
get_bindings() -> | |
get_bindings(kz_config:get(amqp, use_federation)). | |
get_bindings([_Federation=true]) -> | |
[{'notifications', [{'restrict_to', ?RESTRICT_TO}, 'federate']}, {'self', []}]; | |
get_bindings(_) -> | |
[{'notifications', [{'restrict_to', ?RESTRICT_TO}]}, {'self', []}]. |
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
-module(dia). | |
-export_type([uid/0, gid/0]). | |
-export([uid/0, uid/1, gid/0, gid/1]). | |
-export([parse_uid/1, do_weird_thing/2, user_uid/1]). | |
-type uid() :: {uid}. | |
-type gid() :: {gid}. | |
-record(user, { | |
uid = dia:uid() :: uid(), |
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
#!/bin/sh | |
echo """а-б A | |
аб C | |
а-б C""" | sort | |
locale | grep LANG= |