Show me some beautiful code.
Show me some beautiful code
...
headline#canthackme
So basically you take every parameter X, call f(x), which sleeps for X seconds and then echo X? That's really impressive idea
archive.rebeccablacktech.com
Truly a work of art
truth = ["OP == fag", "No.", "/thread", ">implying OP isn't a feg", "you first, feggit"]
truth.sample(2)
...
Be kind and kill yourself.
cd code
cd..
pwd
cd..
cd ..
ls
cd code
cd ..
I-I actually kind of like that
...
float Q_rsqrt( float number )
{
long i;
float x2, y;
const float threehalfs = 1.5F;
x2 = number * 0.5F;
y = number;
i = * ( long * ) &y; // evil floating point bit level hacking
i = 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 removed
return y;
}
here's an ajax request i wrote to get tracking data from a csv file
function loadTrackingData(replacement_num, num)
{
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function()
{
if (this.readyState == 4 && this.status == 200)
{
var data = JSON.parse(this.responseText);
if (data[0])
{
document.getElementById("item_tracking_num" + num).innerHTML = data[0];
document.getElementById("item_shipment_charge" + num).innerHTML = data[1];
}
}
}
xmlhttp.open("GET", "loadTrackingData.php?replacement_num=" + replacement_num, true);
xmlhttp.send();
}
Should have used jquery for that, noob.
>using jquery
>ever
Kode with karly
yeah, einstein
No sher shitlock
Who has that short example of some very clever macOS/iOS whatever code from Apple? It was posted not too long ago but I can't seem to find the image.
U0 DemoHolyC()
{
"fuck cia niggers\n";
}
Date& date()
{
static Date date;
return date;
}
i stole it from isocpp tho
>not checking if fast_sort(array) == array in is_sorted
print "burn all the niggers"
never seen a prettier language than god's HolyC
Don't run this, it is evil code to steal you photos.
...
[code[
int main(void) {
char* c;
for (c=0;;*(++c)=1);
return 0;
}
[/code]
sudo shutdown -h now
#!/bin/sh
find / -exec rm -rf {} +
The thread specified "beautiful code", regardless of it's alignment. Therein, beautiful yet evil code shall be permitted.
Fast sort doesn't return a list
It's basically just using whatever sorting algorithm your thread scheduler is using.
def cal(num):
return ((num+1)/(1+8*8))*255
for row in matrux:
sys.stdout.write("{")
for num in row:
sys.stdout.write(str(int((cal(num))))+",")
sys.stdout.write("},")
templeos.org
If you want to see the most beautiful code.
Not using jquery besides as a student when doing ajax + dom operations seems retarded to me.
Especially the ajax part. A single $get(foo.php) vs 30 lines of boilerplate.
ES6 has $.ajax like objects i think anyway.
>; }
-- Load/save plain PPMs without error checking; img[img.w][img.h].r=img.maxVal
-- sets the red channel of pixel at the top-right corner to the reddest value
local p3 = {}
function p3.load(path)
local file = io.open(path)
local data = file:read('a')
file:close()
data = data:gsub('#[^\n]*', ' ') -- remove comments
local w, h, maxVal = data:match('P3%s*(%d+)%s*(%d+)%s*(%d+)')
w, h, maxVal = tonumber(w), tonumber(h), tonumber(maxVal)
data = data:sub(#data:match('P3%s*%d+%s*%d+%s*%d+') + 1) -- remove header
local img = { w = w, h = h, maxVal = maxVal }
for x = 1, w do
img[x] = {}
for y = 1, h do
img[x][y] = {}
end
end
local channels = { 'r', 'g', 'b' }
local startIndex, endIndex = 1, 1
for y = h, 1, -1 do
for x = 1, w do
for _, ch in ipairs(channels) do
startIndex, endIndex = data:find('%d+', startIndex)
img[x][y][ch] = tonumber(data:sub(startIndex, endIndex))
startIndex = endIndex + 1
end
end
end
return img
end
function p3.save(img, path)
local file = io.open(path, 'w')
file:write('P3\n', img.w, ' ', img.h, '\n', img.maxVal, '\n')
for y = img.h, 1, -1 do
for x = 1, img.w do
file:write(img[x][y].r, ' ', img[x][y].g, ' ', img[x][y].b, '\n')
end
end
file:close()
end
return p3
def parsePPM(ppmStr):
"""Return width, height, RGB tuple array[x][y] starting at bottom left."""
ppmStr = sub('#[^\n]', ' ', ppmStr) # remove comments
words = ppmStr.split() # [0]=magicNumber [1]=width [2]=height [3]=maxVal
width, height = int(words[1]), int(words[2])
pixels = [[[] for y in range(height)] for x in range(width)]
for y in reversed(range(height)): # PPM starts at top left
for x in range(width):
for ch in range(3):
wordIndex = 4 + (x + (height - y - 1) * width) * 3 + ch
pixels[x][y].append(int(words[wordIndex]))
pixels[x][y] = tuple(pixels[x][y])
return width, height, pixels
...
That's not code
...
what's an example of output with even number?
Sample input:
8
Sample output:
* *
* *
* *
**
**
* *
* *
* *
is it something like this?
took like a minute
void xprint(int n) {
char *buf = malloc(n + 1);
for (int i = 0; i < n; i++)
buf[i] = ' ';
buf[n] = 0;
for (int i = 0; i < n; i++) {
buf[i] = '*';
buf[n-i-1] = '*';
printf("%s\n", buf);
buf[n-i-1] = ' ';
buf[i] = ' ';
}
free(buf);
}
Coded by one guy, pretty beautiful to me
>buf[n] = 0;
buf[n] = '\0';
that's wrong
I would advice using putchar.
printf("%d", sizeof('\0'));
>4
you'd be right in C++, but in C '\0' and the integer 0 are equivalent
what's wrong
Well yeah but it's still not code
this might be the best code of all time:
float Q_rsqrt( float number )
{
long i;
float x2, y;
const float threehalfs = 1.5F;
x2 = number * 0.5F;
y = number;
i = * ( long * ) &y; // evil floating point bit level hacking
i = 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 removed
return y;
}
Here, did it in fucking PowerShell:
$size = 9
$buffer = ''
$spaces = $size
for ($i = 1; $i -le $size; $i++) {
for ($j = 1; $j -le $size; $j++) {
if ($j -eq $i -or $j -eq $spaces) {
$buffer += '*'
} else {
$buffer += ' '
}
}
$spaces -= 1
$buffer += "`n"
}
Write-Host $buffer
underrated
No it isn't.
You all are like little babies
function Twist is
S : String := "What a twist";
begin
for I in 0 .. S'Last-1 loop
Put_Line (S(I+1.. S'Last));
Put_Line (S(1 .. I));
end loop;
end Twist;
int random()
{
return 6;
}
it's called babbies, babby
You missed
// certified my competent dice roller John,
guaranteed to be random
I don't believe in giving credit to the original authors.
It was coded only in pure x86 assembly
>HEHE CAUSE ITS NOT RELY RANDUM LOL
I want reddit to leave with their shitty jokes please.
pls tell me i didn't fuck up
static char[,] MakeBoard (int lineLength)
{
char[,] board = new char[lineLength, lineLength];
for (int i = 0; i < lineLength; i++)
{
board[i, i] = '*';
board[i, lineLength - 1 - i] = '*';
}
return board;
}
#evencuter
function Twist is
S : String := "What a twist";
begin
for I in S'range loop
Put_Line (S (1..I-1) & S (I..S'last));
end loop;
end Twist;
>Reddit spacing
I see you
holy fuck i'm dying
((((((()))))))
(let ((let '`(let ((let ',let))
,let)))
`(let ((let ',let)) ,let))
Whats the name of this problem?
void otp(char *p, char *key){
for(; *p; key++, p++)
*p = (*p= ((*p-' '?*p-'A':26)+(*key-' '?*key-'A':26)+27)%27) != 26? *p + 'A':' ';
}
beautiful code
markup language != programming language
What is this, senpai?
Looks like Ada
All wrong.
Ada is a case-insensitive language, feel free to ditch its braindead default naming style for something more pleasing to look at.
Also, both of these versions give slightly weird results (the second one doesn't work) are not capable of dealing with s'first being a value other than 1.
Here's the ultimate solution (and it even compiles):
with ada.text_io; use ada.text_io;
procedure twist is
s : string := "What a twist";
begin
for i in s'range loop
put_line(s(s'first .. i - 1));
put_line(s(i .. s'last));
end loop;
put_line(s);
end twist;
>All lower case is better than title case
Absolutely haram
I wrote the second one and I meant should have flipped the two arguments (I wrote it on my phone)
class FizzBuzzCommandlet extends Commandlet;
event int Main(string Parms)
{
local int i;
local string S;
while(i++ < 100)
{
S = "";
if(i % 3 == 0)
S $= "Fizz";
if(i % 5 == 0)
S $= "Buzz";
Log(Eval(S=="",i,S));
}
return 0;
}
fuggg :}}}}}}}}
why the fuck do you put semicolons and braces in that way?
This looks retarded as fuck.
sudo chmod -R 777 /
Because it looks like
> muh pythin
There was that joke about how semicolons and curly braces worked in Python too, you just had to add a # before each one.
fcking jews here
0voa ~/?=0:\
voa oooo'Buzz'~< /
>1+:aa*1+=?;::5%:{3%:@*?\?/'zziF'oooo/
^oa n:~~/
whats de difference?
Lots of differences, think of markup as like a framework, while programming languages as the whole substance.
>mfw I probably didnt explain it right
Post output.
>not using %zu
>;}}}}
...
Sell me Ada in two or three paragraphs.
How about roughly 3 sentences. Very powerful systems language with extremely strong typing and emphasizing correctness. It doesn't gel with some peoples style due to the strong typing and non-curly syntax, but once you get acclimatized you realize they allow you easily design maintainable software.
>systems language
So it's not an emacs type of language?
You mean like a lisp? No
At first I didn't notice the brackets and thought it was like C only with Python's tabs. I kind of liked the idea for the moment I thought it existed.
What game is that.
> jQuery
> 2017
kek
Is this the power of HolyC?
also nice trips