Skip to content

Instantly share code, notes, and snippets.

View 5HT's full-sized avatar
🌐
I'm very skeptical that person without empathy can create beautiful mathematics.

Namdak Tonpa 5HT

🌐
I'm very skeptical that person without empathy can create beautiful mathematics.
View GitHub Profile
@5HT
5HT / WebFrameworks.md
Last active January 26, 2021 07:19
Overview of Web Frameworks (2013)
@5HT
5HT / char.erl
Last active December 17, 2015 01:49
Π§Π°Ρ‚ Π½Π° Π½ΠΈΡ‚Ρ€ΠΎΠ³Π΅Π½Π΅
body() -> wf:comet_global(fun() -> loop() end,chat),
[ #panel{id=history}, #textbox{id=message}, #button{postback=chat}].
event(chat) -> wf:send_global(chat, wf:q(message)),
loop() -> receive Message -> wf:insert_bottom(history, #span{text=Message}), wf:flush() end, loop().
defmodule N2O do
defmacro element_base(mod) do quote do [ancestor: :element, module: unquote(mod), id: :undefined,
actions: [], class: [], style: [], source: [],
data_fields: [], aria_states: [], body: [], role: [],
tabindex: 0, show_if: false, html_tag: :undefined, title: []] end end
defrecord :dtl, N2O.element_base(:element_dtl) ++ [file: "index", bindings: [], app: __DIR__, folder: "priv/templates", ext: "html", bind_script: true]
defrecord :context, Record.extract(:context, from_lib: "n2o/include/wf.hrl")
defrecord :button, Record.extract(:button, from_lib: "n2o/include/wf.hrl")
@5HT
5HT / gist:7900535
Created December 10, 2013 21:29
Erlang SSH
-module(x).
-export([exec/1]).
exec(A) -> spawn(fun() -> io:format("~p\n", [A]), exit(normal) end).
Node1:
> B=ssh_sample_cli:listen(8323, [{subsystems, []}, {exec, x, exec, ""]).
Node2:
$ ssh -p 8323 to.the.host 'lists:reverse("test").'

Bugs:

  • Autologin checkbox is disabled
  • Preferences menu is disabled
  • Main window isn't font sensitive. I use a 10pt font and there is 2 pixel space below the menu
  • When selecting a contact in the roster, the view LowColor isn't set, leading to text antialias artifacts
  • Double clicking a contact should open message window. Having to right-click > message is boring
  • Chat window: pressing enter should send message instead of doing a newline.

Enhancements:

  • Selection highlight in roster doesn't go all the way to the left of the window, there is whitespace left
@5HT
5HT / gist:10693872
Created April 15, 2014 01:05
Flex Random Code
public var tournamentsResultsHeader:TournamentsResultsHeaderVO = new TournamentsResultsHeaderVO(
"Position", "Name", "Score",
"1","2","3","4","5","6","7"
);
private var _tornamentsRecords:Dictionary = new Dictionary();
public function setTornamentsRecords(value:Object):void
{
if(value)
<text id="Easter-Campaign" stroke="#4990E2" stroke-width="2" fill="#303BA3" filter="url(#filter-10)" sketch:type="MSTextLayer" font-family="Lucida Grande" font-size="143" font-weight="bold">
<tspan x="891" y="378" fill="#22296E">Easter Campaign</tspan>
</text>
<text id="" stroke="#4990E2" stroke-width="2" fill="#303BA3" filter="url(#filter-11)" sketch:type="MSTextLayer" font-family="Lucida Grande" font-size="80" font-weight="bold">
<tspan x="1081" y="413" fill="#22296E"></tspan>
<tspan x="1081" y="507" fill="#22296E">1 March β€” 2 May</tspan>
</text>
<text id="" stroke="#4990E2" stroke-width="2" fill="#D0011B" filter="url(#filter-12)" sketch:type="MSTextLayer" font-family="Lucida Grande" font-size="80" font-weight="bold">
<tspan x="1337" y="501" fill="#22296E"></tspan>
<tspan x="1337" y="595" fill="#22296E">Most Game Points</tspan>
@5HT
5HT / gist:11177762
Created April 22, 2014 12:48
Convert Adobe CreateJS Path to SVG Path
function svgPrim(cjs) {
switch(cjs) {
case 'moveTo': return 'M';
case 'quadraticCurveTo': return 'Q';
case 'lineTo': return 'L';
case 'closePath': return 'Z';
default: return cjs;
}
}
@5HT
5HT / gist:11309676
Last active August 29, 2015 14:00
Typical Erlang Solution Directory Structure
$ tree -L 2 -d
.
β”œβ”€β”€ [email protected]
β”œβ”€β”€ apps
β”‚Β Β  β”œβ”€β”€ db
β”‚Β Β  β”œβ”€β”€ face
β”‚Β Β  └── server
β”œβ”€β”€ deps
β”‚Β Β  β”œβ”€β”€ avz
β”‚Β Β  β”œβ”€β”€ cowboy
dialyzer deps/cowboy/ebin --plt ~/.n2o_dialyzer.plt --no_native -Werror_handling -Wunderspecs -Wrace_conditions
Checking whether the PLT /Users/5HT/.n2o_dialyzer.plt is up-to-date... yes
Proceeding with analysis...
cowboy_app.erl:17: Callback info about the application behaviour is not available
cowboy_clock.erl:22: Callback info about the gen_server behaviour is not available
cowboy_http.erl:159: Type specification cowboy_http:media_type(binary(),fun()) -> any() is a supertype of the success typing: cowboy_http:media_type(binary(),fun((_,_,_) -> any())) -> any()
cowboy_http.erl:248: Type specification cowboy_http:language_tag(binary(),fun()) -> any() is a supertype of the success typing: cowboy_http:language_tag(binary(),fun((_,_) -> any())) -> any()
cowboy_http.erl:272: Type specification cowboy_http:maybe_qparam(binary(),fun()) -> any() is a supertype of the success typing: cowboy_http:maybe_qparam(binary(),fun((_,_) -> any())) -> any()
cowboy_http.erl:293: Type specification cowboy_http:qparam(binary(