One of the most salient features of our Tech Hiring culture is that there is so much bullshit. Everyone knows this. Each of us contributes his share. But we tend to take the situation for granted.
floatQ_rsqrt(floatnumber){longi;floatx2,y;constfloatthreehalfs=1.5F;x2=number*0.5F;y=number;i=*(long*)&y;// evil floating point bit level hackingi=0x5f3759df-(i>>1);// what the fuck? y=*(float*)&i;y=y*(threehalfs-(x2*y*y));// 1st iteration// y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removedreturny;}
French software engineer with 15 year experience on 3D data visualisation and processing. Lots of C++, and switch to Unity recently.
I like when it run fast π
French software engineer with 15 year experience on 3D data visualisation and processing. Lots of C++, and switch to Unity recently.
I like when it run fast π
#define private public
#include <SomeClassWithPrivateMembers.h>
For those who are not familiar with C++, the #define private public say that "Starting from now, each time you see βprivateβ word, replace it with βpublicβ.
Meaning, you can now access private members of following class.
I had to do this to workaround an uninitialized private variable in a 3rd part, leading to a crash.
Definitely an anti-pattern and doesn't work every time (create some low level binary incompatibilities).
I honestly don't remember where, but I saw some code that used an array of function pointers, like
logTrue = () => console.log("It's true");
logFalse = () => console.log("It's false");
var foo = [logFalse, logTrue]
foo[+true]() //Chrome doesn't convert directly from true to 1, so have to do this to convert it.
/// "It's true"
I'm with you on that. Whackiest not by its nature so much as the fact that it fulfilled such a ubiquitous need for so long before the language deigned to provide more logical solutions, even then I don't think it's been killed off completely yet.
I've used it while working as a frontend-developer back in 2009. And you know, in 2009 I really thought, that I've invented this trickπ€·ββοΈ I didn't know, that the others do the sameπ
The FizzBuzz code challenge, where developers are asked to write a program that prints the numbers from 1 to 100. But for multiples of three, the program should print Fizz instead of the number, and for multiples of five, it should print Buzz. For numbers that are multiples of both three and five, the program should print FizzBuzz. This challenge has led to some creative solutions, including one developer who wrote the entire program in one line of code using a ternary operator.
I saw one that worked by finding the right seed for an RNG, then for int ii from 0 to 100 { print [ "Fizz", "Buzz", "FizzBuzz", ii ][rand.nextInt() % 4] }
Another one, that I want to do myself, used a genetic algorithm to evolve an array containing the correct sequence of strings.
Howβs it going, I'm a Adam, a Full-Stack Engineer, actively searching for work. I'm all about JavaScript. And Frontend but don't let that fool you - I've also got some serious Backend skills.
Location
City of Bath, UK π¬π§
Education
11 plus years* active enterprise development experience and a Fine art degree π¨
He/Him; Senior Software Developer, IT Swiss-army-knife.
Lots of coding, some hardware, some devops & sysops, some micro-controller electronics.
I used Arch BTW :)
Anti-GenAI
xkcd.com/221/
There's the classic fast inverse square root:
And here's something I wrote myself:
It's been a while since I wrote this so it took me a hot minute to understand it :P
It's a little terminal color library I golfed, called planckcolors
The fast inverse square root, definitely my favorite one π
If by whacky, you mean bad:
It was the source of a bug, but the developer put it back when I fixed it to
if else. π€·For those who are not familiar with C++, the
#define private publicsay that "Starting from now, each time you see βprivateβ word, replace it with βpublicβ.Meaning, you can now access private members of following class.
I had to do this to workaround an uninitialized private variable in a 3rd part, leading to a crash.
Definitely an anti-pattern and doesn't work every time (create some low level binary incompatibilities).
I honestly don't remember where, but I saw some code that used an array of function pointers, like
Probably the classic clear fix
I'm with you on that. Whackiest not by its nature so much as the fact that it fulfilled such a ubiquitous need for so long before the language deigned to provide more logical solutions, even then I don't think it's been killed off completely yet.
I've used it while working as a frontend-developer back in 2009. And you know, in 2009 I really thought, that I've invented this trickπ€·ββοΈ I didn't know, that the others do the sameπ
The
FizzBuzzcode challenge, where developers are asked to write a program that prints the numbers from 1 to 100. But for multiples of three, the program should printFizzinstead of the number, and for multiples of five, it should printBuzz. For numbers that are multiples of both three and five, the program should printFizzBuzz. This challenge has led to some creative solutions, including one developer who wrote the entire program in one line of code using a ternary operator.I saw one that worked by finding the right seed for an RNG, then
for int ii from 0 to 100 { print [ "Fizz", "Buzz", "FizzBuzz", ii ][rand.nextInt() % 4] }Another one, that I want to do myself, used a genetic algorithm to evolve an array containing the correct sequence of strings.
In typescript, you can use
require()to work around a circular dependency error.Valid css and functioning too.
I've always been in awe of Duff's Device
Duff's Device(Wikipedia)