- 1
- 2
val users = listOf("foo", "bar")
println(users.joinToString{","})
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
Всего: 41
+1
val users = listOf("foo", "bar")
println(users.joinToString{","})
+1
Currently it's hard or even impossible to use hexadecimal literal constants that result in overflow of the corresponding signed types.
https://github.com/Kotlin/KEEP/blob/master/proposals/unsigned-types.md
какой пиздец!!!
+3
include std/socket.e as s
include std/error.e as err
constant PORT = 5050
constant BACKLOG = 5
procedure die(object result, sequence action)
printf(2, "Error %d in %s", {result, action})
err:crash(action)
end procedure
procedure ensure_zero(integer result, sequence action)
if result != 0 then
die(result, action)
end if
end procedure
function ensure_seq(object result, sequence action)
if atom(result) then
die(result, action)
end if
return result
end function
enum SOCKET, READ, WRITE, ERROR
constant PHRASE = "Hello from Euphoria\n"
procedure client_proc(sequence socket)
while 1 do
for i = 1 to length(PHRASE) do
sequence result = s:select({}, socket, {}, 0, 100)
sequence result_s = result[1]
if result_s[WRITE] = 1 then
s:send(socket, {PHRASE[i]}, 0)
end if
task_yield()
end for
end while
end procedure
constant client_proc_id = routine_id("client_proc")
sequence server = ensure_seq(s:create(s:AF_INET, s:SOCK_STREAM, 0), "create")
ensure_zero(s:bind(server, "127.0.0.1", PORT), "bind")
ensure_zero(s:listen(server, BACKLOG), "listen")
while 1 do
sequence listen_result = s:select(server, {}, {}, 0, 100)
if listen_result[1][READ] = 1 then
sequence client = ensure_seq(s:accept(server), "accept")
printf(1, "Here comes %s\n", {client[2]})
atom task = task_create(client_proc_id, {client[1]})
task_schedule(task, {0.5, 0.5})
end if
task_yield()
end while
0
// Define type
define bottles_of_beer => type {
// Define internal data
data private bottles = 99
// Define private methods
private br => '<br/>'
private s => .bottles != 1 ? 's' | ''
// Generate lyrics when object represented as a string
public asstring => {
local(out = '')
// Use Lasso query syntax to generate the lyrics
with n in 99 to 1 by -1 do {
.bottles = #n
#out += .bottles + ' bottle' + .s + ' of beer on the wall, ' + .br
#out += .bottles + ' bottle' + .s + ' of beer; ' + .br
.bottles--
#out += 'Take one down, pass it around, ' + .br
#out += .bottles + ' bottle' + .s + ' of beer on the wall. ' + (.br * 2)
}
// Return result
return #out
}
}
bottles_of_beer
https://en.wikipedia.org/wiki/Lasso_(programming_language)
+2
ARMv8.3-a adds a new instruction "jscvt", which can be used for converting double to int32_t in JS semantics.
https://bugs.webkit.org/show_bug.cgi?id=184023#c24
+1
catch (Exception &exception)
{
Application->ShowException(&exception);
}
catch (...)
{
try
{
throw Exception("");
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
}
https://github.com/greatis/Anti-WebMiner/blob/master/AntiWebMiner.cpp#L23
0
q)\l sp.q
+`p`city!(`p$`p1`p2`p3`p4`p5`p6`p1`p2;`london`london`london`london`london`lon..
(`s#+(,`color)!,`s#`blue`green`red)!+(,`qty)!,900 1000 1200
+`s`p`qty!(`s$`s1`s1`s1`s2`s3`s4;`p$`p1`p4`p6`p2`p2`p4;300 200 100 400 200 300)
https://code.kx.com/q/learn/tour/
0
Есть те, кому нравится язык Elixir ?
Есть те, кому нравится язык Elixir ?
0
про свинг
песня про это дело
0
<#@ output extension=".cs" #>
<#@ assembly name="System.Xml" #>
<#
System.Xml.XmlDocument configurationData = ...; // Read a data file here.
#>
namespace Fabrikam.<#= configurationData.SelectSingleNode("jobName").Value #>
{
... // More code here.
}
T4
Design time templates define part of the source code and other resources of your application. Typically you use several templates that read the data in a single input file or database, and generate some of your .cs, .vb, or other source files. Each template generates one file. They are executed within Visual Studio or MSBuild.
https://docs.microsoft.com/en-us/visualstudio/modeling/code-generation-and-t4-text-templates?view=vs-2019