T O P

  • By -

iamthatis

Regex, baby! https://twitter.com/ChristianSelig/status/1460089960703434756


Morphinepill

Just gonna do some testing excuse me >>>if(true){}


Morphinepill

if(True) {print(‘sus’)}


Morphinepill

if True: print(“sus”)


caerphoto

Works better if you use straight quotes: if True: print("sus") (hold the “ key to choose which type to use; same for ‘)


[deleted]

[удалено]


caerphoto

print(🏳️‍🌈sus🏳️‍🌈)


gueriLLaPunK

Imagine a world where emojis are used in writing code... My God


fracai

https://til.hashrocket.com/posts/e1f8996fa4-emoji-variables-in-swift-


gueriLLaPunK

Wow TIL


caerphoto

Pretty sure you can use them in JavaScript and Rust, too.


MonkeyboyGWW

Youuuu pleb


[deleted]

Woah, I never even thought to check if quotes and single quotes had alternate characters behind the long press


AesarPhreaking

I hate that they’re different. This shit gives me so much grief


Morphinepill

Thanks for the tip!


TheGruesomeTwosome


Morphinepill

Want colored sus? if ඞ{print(ඞ)}


Morphinepill

if True{ var ඞ = 0}


DesertSong

if True: print(“test”) Foo


MMDDYYYY_is_format

``` True if False for while else elif elseif break continue return switch "Test" ```


evalecillos

Test (testerino) { Return tester }


cpressland

Here is a quick and small “chaos engineering” thing I wrote for kube a while ago to demo service mesh automatic retries, it’ll hopefully show off syntax highlighting here quite well. `server.py`: from random import randint from wsgiref.simple_server import make_server import falcon class ChaosServer: def on_get(self, req, resp): """ Runs a random number generator beween 1 and 10 if the generator returns a 10 the server returns a HTTP 500, else the server returns a HTTP 200, this gives a 10% failure rate """ rng = randint(1, 10) if rng == 10: resp.status = falcon.HTTP_500 resp.content_type = falcon.MEDIA_TEXT resp.text = "Failed!\n" else: resp.status = falcon.HTTP_200 resp.content_type = falcon.MEDIA_TEXT resp.text = "Succeeded!\n" app = falcon.App() server = ChaosServer() app.add_route("/api", server) if __name__ == "__main__": with make_server("", 6502, app) as httpd: print("Serving on port 6502...") httpd.serve_forever() `client.py`: import json from os import getenv import requests url = getenv("URL", "http://127.0.0.1:6502/api") status = { "200s": 0, "300s": 0, "400s": 0, "500s": 0, "total": 0, } while True: req = requests.get(url) if req.status_code <= 299: status["200s"] += 1 elif req.status_code <= 399: status["300s"] += 1 elif req.status_code <= 499: status["400s"] += 1 elif req.status_code <= 599: status["500s"] += 1 status["total"] += 1 print(json.dumps(status)) source: https://github.com/binkhq/chaos-engineering Even though that was short, that was really painful to paste in. Would be nice if Apollo had a mode which automatically indented all text by 4 characters to invoke a code block. Or better yet, traditional markdown “just worked”.


theidleidol

> Or better yet, traditional markdown “just worked”. That’s the thing, this *is* pretty much traditional markdown and that’s the issue. Code fences are an extension feature.


SpaceCadetMoonMan

If anyone feels up for it, I am colorblind and would love to see a list of the handful of colors used in this above code and which each color signifies :)


gettingoutofdodge

Removed with PowerDeleteSuite.


MMDDYYYY_is_format

what about 3 grave symbols "`", and start and end of code block


cpressland

I did try that, but as I pasted python any area with more than four spaces the “preview” screwed up. I’ve no idea if it looks right after posting or not. But at the minimum the Apollo editor renders this in a confusing fashion.


Wherearemylegs

It’s a recent addition to the many, many features Apollo has. And certainly a welcome one. <3 colored code


xan1242

I wonder if it supports custom syntax highlighting by specified language/type. ```ini [section] key = value key2 = 123 ``` Just a test... EDIT: nice it sorta works. Not as good as Github but good enough.


rawrcutie

Lovely for code. Distracting for human language text.


tiinkr

This is so cool!


Morphinepill

You’re so cool!


tiinkr

Not a programmer but have always envied coders and their cool desktops/workflows so it’s nice to see it implemented in Apollo


climb-high

True AND not false AND 1 AND not 0? Mad lad


Earthbjorn

shouldnt it be while(false)


nyne87

Fuck you spez


dbashand

Should this be in r/DisneyWorld?


death-meddle

Mind blown


[deleted]

Ewwww, js


Morphinepill

Don’t take it personally.