Svårt att nå ut
Det blir inget Cursed Code i år 😔
Ett utdrag ur Kodsnack 665, lyssna där poddar finns eller på kodsnack.se
#podcast #cursedCode #konferens #detBlevIngenCD
Svårt att nå ut
Det blir inget Cursed Code i år 😔
Ett utdrag ur Kodsnack 665, lyssna där poddar finns eller på kodsnack.se
#podcast #cursedCode #konferens #detBlevIngenCD
Veckans Kodsnack är här: Malin Leverin och Gustav Nyberg berättar allt om hur det är att arrangera Cursed Code - konferens, hackathon, och en hel del annat i samma paket.
Och första året drog de ihop allt på bara fyra veckor!
https://kodsnack.se/665/, och överallt där poddar finns.
#podcast #konferens #halloween #cursedcode
There should be a #printf format `%ꙮ` that just shits an unfeasible number of zeroes all over the place.
`printf("%ꙮ\n", 32)`
000000000032.0000000000
I've found the perfect way to make #rstats programmers scream in existential terror. Behold zero-indexed R!
Redefining reality with <15 lines of code is so hot right now.
Now watch as I calmly refer to v[0] while maintaining direct eye contact.
So I was looking at the recently released C'n'C source code and… oh boy.
Now I understand why that game was so crashy and slow. The code is full of cargo cult programming idioms, numerically unstable in other places, often merely truncates double to int, and (my personal favorite so far) implements 3D coordinate equality comparison by testing for bitwise equality of their constituent floating point values.
In today's instance of cursed JS: abusing await.
When Top-Level Await is available in ES modules, you can do this.
When the module is first evaluated, the key is evaluated. Note that this only works with keys, not with the values, even in a static block.
PHP in JSX. Without React (https://nakedjsx.org)
There must be something wrong with me. Even when I try to write #CursedCode, I find myself trying to make it readable.
bool is_odd(int number) { // convert the number to a string char number_as_string[12]; // assuming at most 32-bit integers sprintf(number_as_string, "%d", number); // get the last character in the string char last_character = number_as_string[strlen(number_as_string) - 1]; // convert that character to a number int last_digit = last_character - '0'; // get the English name of the digit const char *digit_names[] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}; const char *digit_name = digit_names[last_digit]; // get the last two characters of the digit; char penultimate_letter = digit_name[strlen(digit_name) - 2]; char ultimate_letter = digit_name[strlen(digit_name) - 1]; // test if the character represents an even or odd digit return ((penultimate_letter == 'e') || (ultimate_letter == 'e')); } int main() { int number = 68588; printf("The number %d is %s.\n", number, is_odd(number) ? "odd" : "even"); return 0; }
the Swift code is every bit as cursed as the C version:
// find the default sink
// yes this is vaguely cursed, blame Frost for the initial implementation in vubar
let paInfoCmd = Process()
paInfoCmd.executableURL = URL(fileURLWithPath: "/bin/sh")
paInfoCmd.arguments = ["-c", "pactl info | grep \"Default Sink:\" | perl -pe \"s/.*?: (.*)/\\1.monitor/\" | tr -d '\n'"]
let paInfoStdout = Pipe()
paInfoCmd.standardOutput = paInfoStdout
paInfoCmd.standardError = paInfoStdout
try paInfoCmd.run()
paInfoCmd.waitUntilExit()
let output = paInfoStdout.fileHandleForReading.readDataToEndOfFile()
sink = String(data: output, encoding: .utf8)