Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Search - "code snippet"
-
A new urgent request today…
“ITS URGENT WE NEED THIS CODE IN IMMEDIATELY I DONT CARE IF ITS FRIDAY WE NEED IT THERE BY ONE HOUR”
“What is happening?”
“ADD THIS CODE TO OUR CODE”
(A snippet to track marketing conversions from fb)
“Uhhh it’s Friday and our product won’t release to the public for 2 months anyway?”
“YOU DONT GET HOW URGENT IT IS, MUST BE THERE IN AN HOUR OR WE’LL LOSE DATA”
“O….k”
Spoiler: data said that today we had no customers on an unreleased project. Go figure!5 -
Worst experience with cs profs? Oh boy....
Databases lab: "You'll need to work of this snippet, if your IDE tells you it's deprecated you don't need to care about it"
If you want to imagine the quality of the code base we were expected to work upon just think about that attached xkcd comic, basically an undecipherable black box.
The instructions where at the same time micro managing everything (he gave us frickin variable names to use, and no good ones, no the database connection had to be called datbc, yeah very descriptive) and yet so obfuscated that I'm not completely sure he didn't resurrect Kant himself to ghostwrite for him.
He also didn't like us to use any Java feature that was to 'modern', for example for each loops since "they offer no benefit over normal for loops".
Further, everything we wrote had to be documented with a relationship diagram and a uml. So far no problem if he hadn't invented his own flavor of both (which can be read about in his book).
Oh, and he almost failed me because I used a lambda expression in his 'code on paper' exam and this "arrows are a C command" I "must have been confused"... which is glorious coming from the guy who can't get operators and commands straight.1 -
@dfox
!rant, it's the Feature request
Possibility to post `a code snippet with monospaced font` would be usefull.
Or even
```
def multiline_code():
from 2 to Inf:
"Lines of code"
```
Sth like in markdown.9 -
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
John F. Woods
(found this in a demo snippet)6 -
Oh my dear DevRant, please add code-formatting standards & check-style validation on submitted code snippets, because the wrong indentations of code snippet posts on DevRant is driving me crazy, check-style ftw!2
-
I just found this code snippet on Stackoverflow that decodes polylines from Google Maps.
I even doubt the genius who wrote it understands what it does.
Anyway,as long as it works am good.4 -
Story Time:
When I first started working where I currently am, the manager at the time decided to send us off to a conference about one of the products our institution was purchasing at the time. She also thought that it would be a good way for me, the new guy, to bond with the rest of the staff.
During the presentations we found out that the people surrounding us were not exactly developers because of a couple of things:
1. Some examples were done with php and javascript for adding functionality to said product. The product gave you the opportunity to script on top of it (think of some sort of CMS, but it does not use PHP as its backend language) EVERYONE from the "class" in this particular workshop said they were developers. But at the sight of php in a group of 80 people or so, only about 7 recognized it, including myself and my team.
2. When they showed an example with Javascript, in particular jquery, one of the dudes in the workshop said (with extreme senior level confidence might I add) "yeah I never liked Javascript because you really can't connect it to any database in a website" <--- my face went 0.o and one of the actual developers doing the presentation did a Jim from the Office and looked at some out of screen camera.
3. During a conf talk, one PHD dude showed an example in the template language the CMS used (an obscure Java based template language)in which he was proudly calling out a technique he used to include one snippet of code into another one.....at that time, one of my coworkers squinted his eyes in disbelief, got close to me and said "is this man telling everyone in here that he discovered how to include a file? like, as a new thing?" me: "lol yes", him: "this is a waste of time, do the docs for this thing show how to do it or is he doing some sort of strange maneuver for something the platform does not support?" me: "let me check....nope, it is included, for some reason he made a function that takes the...name of the file he wants to include and passes it over to that call inside of the body....which as per the docs it is the include function...." him: ".....fuck, what a waste of time and money, fuck it lets spend a couple of more minutes here and then go get a drink or something"
That last part was my favorite really, the man speaking was not just any phd holder, but a comp sci phd holder. To this day my dude would walk into my office and say shit like "I DISCOVERED HOW TO INCLUDE A FILE WITH PHP!"14 -
Oauth2 examples.
Seriously all examples I found use library that use library that use library to just build url encoded parameters like this
client_secret=foo&code=bar
Got me 5 hours to dig going trough couple of github repos with implementation to see that shit at the end.
Seriously people !!!
Start thinking before you write single line.
I don’t want to download 10 dependencies and 100MB+ just to send 2 requests with url encoded parameters.
It’s in every - literally every language.
I know you’re stupid but please just try to understand how things work instead of copy paste another stackoverflow and medium snippet.4 -
Share your VS Code installed extensions here.
Mine is: Alignment, Better Comments, change-case, Colonize, CSS Peek, DotENV, File Utils, GitLens (my favorite!), Gulp Snippets, JS-CSS-HTML Formatter, Laravel 5 Snippets, Laravel Blade Snippets, Material Icon Theme, npm Intellisense, Numbered Bookmarks, Path Intellisense, PHP Debug, PHP DocBlocker, PHP Intelephense, PHP IntelliSense, Prettify JSON, Quokka.js, snippet-creator, Vetur.
Feels like there are redundant extensions here that I need to uninstall.
Happy Friday and Cheers! Excited for Infinity War movie! 😎15 -
Interviewer: can you write a code snippet to explain function overriding
Me: *gives a practical example *
Interviewer: *not satisfied*
Me: what would be a proper example for the question?
Interviewer: *writes a text book example *
Her example didn't even need inheritance in the first place. It's one of those forced examples.
Next question: a riddle. Yes, a riddle4 -
That moment when your function runs problem free on the first try.
The feeling of "Holy shit" and "I think I just spent an entire day's worth of luck in this snippet of code"
I don't think I'm gonna go outside today.3 -
Self rant!
Looked at a code snippet I wrote last year and I thought to myself: am I geting stupid for not understanding my own code ?
Tried to re build it from scratch...
Failed and had to reuse it without understanding how it's working.
I guess I am getting stupid!5 -
Genuine snippet of code from something we are rewriting from scratch..
// Returns true if section length is greater than maximum path
public bool isOversized(double sectionLength) {
return false;
}
Fffuuuuuu6 -
Saw a funny code-snippet on a notebook in front of me and noticed the name devrant. Checked, immediately registered, already having a blast!7
-
Consumers ruined software development and we the developers have little to no chance of changing it.
Recently I read a great blog post by someone called Nikita, the blog post talks mostly about the lack of efficiency and waste of resources modern software has and even tho I agree with the sentiment I don't agree with some things.
First of all the way the author compares software engineering to mechanical, civil and aeroespacial engineering is flawed, why? Because they all directly impact the average consumer more than laggy chrome.
Do you know why car engines have reached such high efficiency numbers? Gas prices keep increasing, why is building a skyscraper better, cheaper and safer than before? Consumers want cheaper and safer buildings, why are airplanes so carefully engineered? Consumers want safer and cheaper flights.
Wanna know what the average software consumer wants? Shiny "beautiful" software that is either dirt ship or free and does what it needs to. The difference between our end product is that average consumers DON'T see the end product, they just experience the light, intuitive experience we are demanded to provide! It's not for nothing that the stereotype of "wizard" still exists, for the average folk magic and electricity makes their devices function and we are to blame, we did our jobs TOO well!
Don't get me wrong, I am about to become a software engineer and efficient, elegant, quality code is the second best eye candy next to a 21yo LA model. BUT dirt cheap software doesn't mean quality software, software developed in a hurry is not quality software and that's what douchebag bosses and consumers demand! They want it cheap, they want it shiny and they wanted it yesterday!
Just look at where the actual effort is going, devs focus on delivering half baked solutions on time just to "harden" the software later and I don't blame them, complete, quality, efficient solutions take time and effort and that costs money, money companies and users don't want to invest most of the time. Who gets to worry about efficiency and ms speed gains? Big ass companies where every second counts because it directly affects their bottom line.
People don't give a shit and it sucks but they forfeit the right to complain the moment they start screaming about the buttons not glaring when hovered upon rather than the 60sec bootup, actual efforts to make quality software are made on people's own time or time critical projects.
You put up a nice example with the python tweet snippet, you have a python script that runs everyday and takes 1.6 seconds, what if I told you I'll pay you 50 cents for you to translate it to Rust and it takes you 6 hours or better what if you do it for free?
The answer to that sort of questions is given every day when "enganeers" across the lake claim to make you an Uber app for 100 bucks in 5 days, people just don't care, we do and that's why developers often end up with the fancy stuff and creating startups from the ground up, they put in the effort and they are compensated for it.
I agree things will get better, things are getting better and we are working to make programs and systems more efficient (specially in the Open Source community or high end Tech companies) but unless consumers and university teachers change their mindset not much can be done about the regular folk.
For now my mother doesn't care if her Android phone takes too much time to turn on as long as it runs Candy Crush just fine. On my part I'll keep programming the best I can, optimizing the best I can for my own projects and others because that's just how I roll, but if I'm hungry I won't hesitate to give you the performance you pay for.
Source:
http://tonsky.me/blog/...13 -
Proof that there is no drug testing at Apple:
- Xcode 10 moved code snippets in a transient spotlight-style window.
The only way you can show snippets is if you have your editor window in "browser mode" vs "document mode" and then the dumbass button with { } on it shows.
If you go into the help menu in the menubar where you can search the other menus, typing in "Snippet" shows only "Create Code Snippet" under "Editor" menu.
So to make it painfully clear, they hide the snippets under a button on a window in a particular window mode. Then, because they have now fucked up the use of Snippets, the "Create" capability becomes a "how do we do that?". This did not make them reconsider their approach... oh nooo... instead they sloppily stuff it in the regular menus all by itself... and do not put a Show Snippets near it. And conversely they don't put a "+" or "-" button in the snippets window.
So here is what happened... someone said "having the snippets in the code editor window is a pain" and someone half-listening heard "windowpane" and pulled out their stash of LSD... everyone took a hit ... and now we have a fucked up hidden button and an orphaned menu command.
I'm going to have to change my username to "XcodeDevTeamAreMorons"3 -
Everyone is on their vacation and I am in good mood so time to refactor some 3 year old frontend, angular, javascript code. After 5 minutes of looking, some great quality of code snippet on the image below.10
-
Trying to explain to your S/O why a particular snippet of code is so fucking sexy and exciting -- then you get the "WTF are you talking about? 😐"5
-
When will medium and its coding tutorials die out already? Why the hell are every fucking post of this plattform so cringy af, like tf why you start your tutorial with a fucking irrelevant meme you dumb asshole? Your code snippet is mostly garbage and you aint explain shit; I am not even sure if the code is yours. Go eat a dick and learn the subject properly before even start to teach people online.6
-
Me in front of an year old code snippet:
1) "omg, wtf did i write that time?"
2) "i'm going to fix it"
3) after 2 hours lost trying to get new code working... reset from git
4) look around feeling guilty -
Saw this today in the exercise code of a deep learning lecture. These people are doing their PhDs in deep learning 😳
* the snippet has no side effects14 -
I can't be the only one who zooms into random pictures on the internet containing a monitor(with an IDE open) in the background to see what language they're using and whether it's a legit snippet of code.5
-
My Team Lead: Hey do you know goofy?
Me: What is it?
TL: It's a new programming language
Me: *being suspicious* show me what are you dealing with
TL: *Shows me a Groovy code snippet*
Me: Yeah!! Your goofy is pretty good!! Enjoy! 😡1 -
me vs marketing guy, again
me: yeah, the database server is not responding, so you cannot log in to post your blog, wait for it to get online.
MG: But, the website is online.
me: web host and database server are two distinct things, they are not the same, *share a screenshot of the error*
MG: Oh okay.
Literally 3 hours later this fucking idiot sends an email and I quote.
"Hi Dev,
@CTO FYI, Someone has removed this code So there is some tracking issue on it.
Please add below google analytics code on the website.
Note: Copy and paste this code as the first item into the <HEAD> of every web page that you want to track. If you already have a Global Site Tag on your page, simply add the config line from the snippet below to your existing Global Site Tag.
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://googletagmanager.com/gtag/..."></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-xxxxxxxx-1');
</script>
"
The fucking issue was of him not being able to post his shitty blog, and he shares an email like this, FOR FUCK'S SAKE!2 -
Programming commandment: Thou shall not commit code snippet copied from StackOverflow without adding a comment to help future coder brethren!
-
Rant on anti devs.
I helped my friend crack a fairly simple hackerank. The questionnaire was basic JavaScript questions and little on CSS selectors nth child. The test is finished in half hour instead of 75 mins.
5 months later. He calls again and ask if he can get the question solutions (code snippets). I didn't have those but curious why he needed it. He says he wants to put that solutions to Github. So would look on resume. This is not even a project just code snippet with a for loop. He just wants any codebase to upload to his profile.
My ears are bleeding. It makes me sad that some people had to do Masters in computer science purely out of societal pressure. Just because software development is booming field a lot of folks who are not genuinely interested in development are being forced into the industry.6 -
After noticing 4 operations in a single line, I comment a pr stating the line is not simple to read as there are many operations which can be, especially in the eyes of a junior, hard to read.
I proceed to suggest a better solution.
Colleague: “what??? How is this not readable??? Is it [op1], [op2], [op3] or [op4]? 🤷♂️”
I kindly explain this person that it’s not about the single operations, but the fact they are all on a line. Inside an object assignment.
Colleague: “you should learn stuff! (4 links to websites giving that snippet of code”
Ah yes, the oldie: “but other people are jumping off a cliff, why don’t WE do it???”5 -
Calling all Devs 🤙:
What's the _best_ worst code you've seen in the wild in your corporate codebases?
Include a snippet of the traumatic lines in your comments!
I'll start with a classic:
$send = $enabled ? true : false;14 -
!Rant
Do you guys have a idea how I can call my new snippet manager application? The application allows you to save code and URLs to view Inside of the application. Also the application is highly customizable supporting 42 coding Languages and over 42 Themes. Currently its named: "SNIPR". But i would like a Name thats not directly connected to the application and what it does. Maybe you guys have some ideas? Because im not that creative😀😀👌
This is a example of the main ui using the dark theme26 -
Now this looks stupid already, but here is the kicker: by "partially hydrated cursor" i mean that once every page size an sql query is ran to get the next page content. This code is put in an event handler, executed once every time a file is uploaded in a dms where files get uploaded by the thousand.
To sum things up, this simple snippet achieves triple dipping:
* waste time on useless sql queries
* waste cpu on useless iterations
* waste disk space on useless logs
Icing on the cake, the author of this piece of shit was complaining about the overall slowness of the process.
Needless to say that when I stumbled on this, both internal *and* external screaming ensued...4 -
A client asked me to include a GA tracking code into her website,
I said yea I'll add it for you, just send me the code snippet please :)
she sent me the URL to google analytics login page....
I told her that I need the code snippet not the URL.
She replied: yah that's what I sent.
Me:...2 -
drives me crazy when people send log or code snippets in slack and don't create a code snippet and send through as a plain message.2
-
Posted a question on SO and someone thought they could get clever and turn my Feathers + Nuxt snippet into a functional SO code (to preview or whatever). I told him it's not going to work for various reasons, so he deleted his answer and "down voted" my question. Thanks dude... Thanks a lot...
#StackUnderflowed1 -
The infuriating edgecases of python copypasta.
If you're like me, and you find it easier to noodle in notepad++ and the console, then you may have encountered this peculiar bug.
Try padding blank spaces on an empty string variable, and follow it with print(blanks + str(var))
#for any variable
Now copypaste that along with at least one other line at the same time.
Observe how no matter what you do, print will always output the blanks variable on a separate line, with quotes.
Try rewriting right-justify? No good.
Try using f-format strings? No good.
Raw strings? Inspecting bytes to see where the newlines and carriage returns are being inserted? Nothing.
Copypaste with multiple strings will *always* insert quotes and a new line when printing *any* variable with a string thats been justified.
And this is 100% non-congruent with pasting the same *line* of code *by itself*, which works as intended, no quotes or additional new lines are inserted.
I just went ahead, turned the snippet into a function, and called it from there, which solved the problem entirely.6 -
I have been asked to submit a piece of code for review for an interview, something I'm proud of writing.
What kind of code snippet would you submit? (A custom sort.. a tricky bit of data manipulation etc)7 -
I began exploring code and graphic design early on at about 6-7 years old. My Dad had a commodore 64 with a few games and a little handbook that had some awesome examples to go by. My Dad had at one time been a subscriber to a serial magazine for Commodore enthusiasts that featured a snippet of code in each issue. After getting into my Dad's old stash of magazines I was able to combine all the magazines and write the code from each issue to create a hangman game. This got me into computers and programming. Then we did some Logo/Turtle work as got into qbasic on our IBM machine.
-
Dont get me wrong I like C, but I've never seen so many different ways to do things where I cant even tell whats fucking happening in the snippet of code.12
-
I don't like that my team and my company uses Skype as the messaging tool for teams. There are no code highlighting when I need to share code snippet to devs!13
-
So, today I wanted to program a bit and, after reading the last chapter, I want to see what I able to do.
I run my last Linux distro, I open sublime and I start typing code. I finish, I build. 0 warning, 0 errors. Nice! I execute the code: error.
I watch and I struggle on the code for hours, I search on Google, I search on StackOverflow, but after 1 hour I notice I'm looking for a needle in a haystack. So I search instead for a way to produce a better error. I found it, I'm very happy. Let's try what the error actually is:
Error: success
Ok....
Ok...... Well, maybe.... Uhm......
Ok, I won't give up. I search for a tutorial. Found.
The code is almost the mine, it's actually a usual snippet, nothing new. I compare my code with the code in the example/tutorial.
First line, is the same.
First 10 lines, are the same.
First 30 lines, are the same.
I build and execute the example: it works.
I build and execute my code: still doesn't work.
I won't give up, I said it. I won't give up.
I wonder if there's a tool like git diff, so I can see what the differences are, maybe I've no good eyes.
I search, first Google result, "diff"
diff myCode.c example.c
"the files are not identical"
...thank you
I search for a better command
diff -y myCode.c example.c
"the files are not identical"
I search for a still better command
Found. StackOverflow stroke again.
sdiff myCode.c example.c
"the files are not identical"
.....
....
.....
I gave up.
Ps. I've 10 years of experience in programming4 -
Just found this today in the Terms for a VPN provider...
hide.me uses Google Analytics to analyze in aggregate information about our website visitors. When your web browser loads a page on our site, a small snippet of javascript code is executed within your browser which submits information about the device from which you are connecting such as your browser user-agent, language, screen resolution, referring website, etc. to the Google Analytics service. To enhance your anonymity, hide.me have opted to only allow Google to collect only a portion of the IP address. Google Analytics may also store a web cookie to facilitate the identification of users who revisit the site. If users are concerned with being tracked by Google analytics scripts on hide.me or any other site running Google analytics, we recommend installing a browser add-on which allows you to opt out.
source: https://hide.me/en/legal
ARE YOU FUCKING JOKING?!? GO BOIL WHAT SMALL MAN JUNK YOU HAVE AND EAT IT.2 -
So today I started working on a code base someone else wrote and stubled across this and thought it was worth sharing.
Why somebody would be doing something like this is beyond my understanding.
Not commenting on the empty catch block keep in mind the whole snippet has nothing to do with rest of the code...
WHY!!!!!?!?!?!?!13 -
Sometime in the mid to late 1980's my brother and I cut our teeth on a Commodore 64 with Basic. We had the tape drive, 1541 Disk Drives, and the main unit and a lot of C64 centric magazines my dad subscribed to. Each one of the magazines had a snippet of code in a series so that once you had 6 volumes of the magazine, you had a full free game that you got to write by yourself. We decided to write a Hangman game. Since we were the programmers, we already knew all the possible words stored in the wordlist, so it got old quick. One thing that hasn't changed is that my brother had the tenacity and mettle for the intensive logic based parts of the code and I was in it for the colors and graphics. Although we went through some awkward years and many different styles and trends, both of us graduated with computer science degrees at Arkansas State University. Funny thing is, I kept making graphics, CSS, UI, front end, and pretty stuff, and he's still the guy behind the scenes on the heavy lifting and logical stuff. Not that either of us are slacks on the opposite ends of our skilsets, but it's fun to have someone that compliments your work with a deeper understanding. I guess for me it was 2009 when I turned on the full time DEV switch after we published our first website together. It's been through many iterations and is unfortunately a Wordpress site now, but we've been selling BBQ sauce online since 2009 at http://jimquessenberry.com. This wasn't my first website, but it's the first one that's seen moderate success that someone else didn't pay the bill for. I guess you could say that our Commodore 64 Hangman game, and our VBASIC game The Big Giant Head for 386 finally ended up as a polished website for selling our Dad's world class products.1
-
Which place do y'all go for developer related comics and memes ? Besides devrant ofc.
I actually wanted to use some in a boring article am about to write. Something with a sword and needle context, like people using heavy frameworks when a small snippet of native code could do just fine.8 -
When you decide it's not worth of your time to go through lengthy code documentation and just run that stackoverflow snippet straight on production.. 🤠
-
!!rant
I just hate job ads which have a pseudo-language (Java or C for ex) code snippet inviting you for an interview.
Oh my God they are so fucking LAME. I actually pass on these job offers.1 -
1. Wrote super complex snippet w/o comments.
2. Commit & push.
3. Read code after 1 month
4. Ask yourself how you wrote that.1 -
Here’s a snippet of code that I found in our production codebase. I found this while fixing a bug. This is not part of the bug though but I see this a problem. Should I say this to my senior that his logic is off here?
First he doesnt have to do explicitly strict comparison since the return type is boolean and it could be true or false. Also the returnUrl will alway be undefined because redirectIfUserLoggedIn is called first before it was set.
He dosent like me. Hell get mad for sure. I think ill let this go.37 -
Reading documentation for 3rd party software... come across a code snippet which references a class. The class is spelt correctly in the comment but wrong in the code!
What??? Surely if you're going to get it wrong it would be the other way round :/ -
When I wrote a code snippet on an exam paper📄 during college🎓 days and the lecturer compiled ✔️ it without an error.2
-
!rant
The new end to the idiotic code snippet head scratchers interviews (awkward for both parties but nobody is willing to admit it)?
Hometasks.
Infinite internet access, use whatever tools you want, do as much as you can in 2-3 hours.
The best non-toxic way to see how someone works as a dev.
This is the way I expect you to work, so this is the way I will interview you.
Sorry silicon valley, we don't need people who can write up a binary search algo from rote memory.3 -
does my co-worker code is actually really necessary, for the sake of arguments lets ignore server performance, and focus on this snippet.
added comment on the side of the parameters11 -
How do you feel about using TypeScript with React? I appreciate the benefits, but, as every snippet of React code everywhere on the web is vanilla JS,I just don't want the cognitive overhead.
Yes, I know TS is JS, but, if I'm not going to use the features, why bother? I'd want to strongly type props, state, etc.
What's the status of TypeScript support in the React ecosystem (eg Router, MUI, etc.)?
I'm kinda hoping Reason will get some traction as the type inference is much better, but, will that happen? Or is that going to fizzle so it's a choice between TS and JS?
Appreciate any thoughts on this---including those from anyone who's in the same boat.
Looking for views on TS in React ecosystem---no need to sell me on TS in general.6 -
I hate it so badly when syntex highlighted code snippet on a web page goes to plain text on double click. Anyone knows it's purpose?7
-
I have small knowledge in programming in Java, have not learned it in a couple of months, and I was wondering, how do you take what you know to make a larger piece of software. HTML and CSS seems easy in comparison as I know how to a websites but, I can't comprehend Java programming.1
-
As a dev, I have to reuse a lot of codes again and again. Some I've written, and some of them I found after stucking my head for 1 hour on StackOverflow.
Now, the problem is every time I need the code, I have to search again. Some of them I saved in note apps but organizing code snippets & finding them with a quick search is a mess.
I was thinking of building a code snippet organizer where developers can save code snippets in any language (have syntax highlighting), search quickly, share with anyone, create buckets, manage multiple accounts etc.
Let me know if it's a good idea or not. Would you be interested in using something like this? Is this even a real problem or it's just me?15 -
I still don't get it why we don't have code snippet paste ability, like slack or .MD file? Can we have some little formatting please?
Pasting screenshots is not always the best.3 -
what is the weirdest thing (library, framework, code snippet) in your opinion which you've used in production?
we are using a library that on every exception prints for us URL to StackOverflow related problem in the logs2 -
When I finally learned how to use vertex lists with OpenGL bindings in Python and optimized my game's tilemap rendering. I think it is my best written code snippet so far. It took me weeks to finish it.1
-
when a senior recommends you rewrite some code with their example snippet (which doesn't work), for the 3rd time, on a different ticket
i guess i should've called them out on the 2nd time this happened, instead of silently not doing so think i'd save them some dignity after telling them the first time they did this, their recommendation didn't pass automated tests4 -
Rule: NumberIdunno,
It's easier to figure out a solution yourself than it is to clean your code, recreate the bug in a small snippet then posting it on Stackoverflow.2 -
Ah, yes, the ages old dilemma of a piece of shit function written in-between taking long drags out of a fucking crackpipe being more reliable than the refactored version; how delightful.
Now, they say broken code from cleanup of sketchy bits is better than any working snippet whose reading feels as pleasant as being repeatedly slapped with a decaying rhinoceros testicle sack, but I'll be fucked if I don't __sometimes__ feel like I just *might* prefer eating the maggot soup out of the rotting fucking gonads of deceased male pachydermata than deal with this kind of shit: feet facing backwards and all that.
Ugh. If only I could live my life without everyday feeling like I'm on a pointless quest to slay a mother fucking dragon, where everytime I get to the castle I'm suddenly a mustachioed italian plumber stepping on turtles and my bitch is in another sicillian ghetto. You know, basic shit.
The good thing in seeing these old errors pop up again after my shoddy bandaid of a patch is taken off is that I'm finally experienced enough to realize that my ~ A P P R O A C H ~ was wrong to beg with. And this is VERY nice, because I came in to do some trivial maintenance of forgotten code, and now I have a plan for correcting a very small and silly but definitively annoying as fuck design error.
Why am I so annoyed then? Because it's more and more work, it never fucking ends, and I can't EVER take a break: with apocalypsis incoming, as we have clearly seen in the stars, tea cups, palm readings, crytal balls, ouija boards, and also in the cover of old-school pornographic magazines nailed to the wall of a defunct newspaper kiosk, the fear of economic collapse is somewhat too real to even THINK about any kind of necessary vacation.
And so: fucking shit, here we go again... TIME FOR MORE COFFEE.
<ad> But have YOU ever picked ingesting the hairy BALLS of a large mammal over doing your stupid job in a proper way? Is the ghost of your dead self haunting the hollow being that remains in this meaningless plane of existence? Do you lull yourself to sleep by chanting dark prayers to the Horror Immemorial with a heartfelt desire for the sweet release of death?
While it may be true that your corporate masters are keen on savagely raping your every breathing hole from the ass up to your fucking eyesockets on a daily basis, there's no good reason NOT to have a good time -- and with the help of ScalySalad, you will be able to unwind in the evenings by realizing your *supressed* childhood dream of debouring the certified, lab-tested, 100% authentic, gonorrhea-infected ASS of a sewer-dwelling lizard man!
ScalySalad pimps only the FINEST specimens of failed, government-sanctioned and highly clandestine experiments for your lacertaerotic pleasure. These proud and noble creatures were once human beings, until they were kidnapped by [CENSORED] in order to be used as weapons of war against their enemies. And for the lowlow price of GABTRIDTIHSTAE, you will be among the few lucky ones to experience the GLORIOUS taste of their anal cavities before they go extinct!
Go NOW to triple.doble.you dot. dot you.www www.triplewww.wwwwwwwwwwww dot if you click and it's malware you deserve it DOT com, and use my promo code SALAMUNCHER for 20% OFF on a date with a homeless societal reject turned prostitute after being [CENSORED] by state scientists!
Illegal inter-species fornication has never been easier! Thanks to ScalySalad for sponsoring this �vI�n��lK�^�3��V#^B�^NI�%^G�v�|3I��.1 -
Ah, the ancient art of copy-paste development – where originality goes to die and bugs come out to play. It's like a cursed incantation that tempts even the best of us into the dark abyss of shortcuts.
You think you're saving time by copying that snippet from Stack Overflow, but little do you know, you've just invited a horde of gremlins into your codebase. Suddenly, your once-cohesive architecture looks like a patchwork quilt sewn by a drunkard.
And let's not forget the thrill of debugging when you realize that the copied code references variables that don't even exist in your context. "Ah, yes, I remember copying this gem at 2 AM. What could possibly go wrong?"
But wait, there's more! Copy-pasting also introduces a special kind of chaos when updates are needed. You find yourself fixing the same bug in five different places because you couldn't be bothered to encapsulate that logic in a reusable function.
So here's a heartfelt salute to all the copy-paste warriors out there, bravely navigating the treacherous waters of borrowed code. May your future coding endeavors involve more thinking, less CTRL+C, and a lot fewer late-night bug hunts!1 -
When you copy&paste a code snippet from a forum into your IDE like VS and suddenly - for some reason - after every single line comes an empty line that you first have to manually delete so that your OCD doesn't bite off your own head.4
-
Arrify nodejs module. I always thought, that a modul is something bigger, not this function with 4 lines. Who thinks, that using a module to make an array of a value instead of copying a 4 line snippet to your code is actually a good idea?4
-
Quick JS tip
If you want to split a string into characters, you can use the ES6 spread operator
If you have
const name = 'react-dev'
You can just spread it like this:
const charsInName = [...name]5 -
!rant
Can we bring into discussion inline monospaced code snippets again?
Basic markdown text formatting. Like bold, italics, lists.
https://devrant.com/rants/333316/...question dfox functionality request feature inline code code snippet trogus markdown feature request3 -
If I code 10 to 1 or 2 I can have good sleep..but in any case if I sleep eaely before 1 then code snippet and bugs come in dreams.........
..
Even if I sleep early when I'm too tired.. -
tldr: i take pride of our code! It hurts when someone calls it wrong when i know it was right.
So there was this integrations team that are trying to connect to our api. This team has been throwing different people to work with us. We even taught them how to use postman/soapui with ssl, even to the point that we search stackoverflow to resolve their code-level issues and left us halfway, then came back again repeating all process. A year passed, they came back with the same issue... now all answer that they get from us was to “review past conversation”, Today, they insist that we repeat ssl onboarding process as they are having issues with their current one, we insisted not to do it, and told them we (including them) can proceed without changing the client ssl. And told them we had a snippet sent to resolve their issues, but instead told us in a rude way, our sample is wrong. I was challenged to prove that we can make it work by eod. With their wrong sense of pride as theyve been working for that issue for long, they started throwing tantrums on us, saying that we do not need to make them feel that they do not know what their doing. man! Cmon, its you who requested that snippet few years back, then you tell us you dont need it as it is not working, in the first place, it is not our job to code for you asses,...i left the channel after. it was escalated quickly to management and accounts team(those people who only cares for traffic/money).. asked to return to the channel, spoonfed the details to them, provided a working snippet and left again.not sure what happened next.,. I hope this started a fire on our management to handle such incompetence. -
When you don't compile small code snippet and keeps on writing lines of codes and after writing large lines of code that one moment when you start compiling your code for the first time
Brace yourself for errors 😕 -
Worst fear while adding a snippet of code from the net to my project :
I hope this doesn't mess up other UI elements.2 -
Anyone got too used to ChatGPT until now google feels like a caveman tool?
if you tell chatgpt to write code that uses library X that does something it will provide the snippet ready to be copied
whereas googling it means you have to scroll through results, pray someone asked it on stack overflow before you, otherwise skim through medium articles until you find a code block or something
and yeah ChatGPT doesnt always write working code coz of the knowledge cut-off, i switch to bard sometimes or default to google11 -
just wanted some help from you people..
if anyone knows some sort of Code Snippet Manager or Gists Manager.
I want to store my code snippets (public and private) with the following abilities:
1. Search the snippets
2. Tag the snippets
3. Code highlighting
4. Cloud Stored Snippets
5. Is free
I've found Cacher and Lepton but Cacher allows only Public snippets in the free version and Lepton lags search ability.
Anyone know a better client for this purpose?8 -
A v dumb C language question....
Consider this code snippet:
{
while( getchar() != EOF )
printf("a");
while( getchar() != EOF )
printf("b");
}
Is there some way to get inside the second loop? After I input some text, ctrl+D sends in the text stream and loop 1 executes, then the control waits at the test for loop 1 again, pressing ctrl+D again triggers EOF, but it ends up skipping all loops after24 -
When you have no time to learn by code snippet, you'd have to copy and paste it rather than writing it line by line.
-
I came across this code snippet on Quora, and I tried crashing the Codeforces server (strictly for educational purposes). But this thing wouldn’t compile, either because fork() was not declared in the scope, or the file <unistd.h> was not found. I tried it on different C++ machines. What is the fix for this ?6
-
Currently working on a snippet manager application in my free time.
Added support for c++,c and codffe script. Added them to my supported languages array to use them inside the editor.
Just to realize that now all my test snippets i created for testing are using the wrong language for the internal code editor.
Well Fuck me! Deleting all snippet files now and changing the system to be indipendent of the array index. -
found this interesting snippet tool for all javascript devs out there: https://github.com/30-seconds/...
found it useful! -
In finals, I was prepared to write code for any given problem. Instead, the professor gave code snippet itself for all questions and asked to write output. No comments, nothing. Just pure spaghetti code. Wasted so much time in analyzing the code that I had to leave a couple of questions unattended. Moreover each question weighted for around 8 marks. So, just one miscalculation means 8 marks is into the void. I'm feeling like I'd get just enough marks to clear the subject.1
-
It feels like there is a rule of the internet that any code snippet visible is immediately subject to review by the comments.1
-
Dont know why but on the occasion that i throw out a 'do while' snippet of code i chuckle to myself.
-
For those who are on my team, arguing on not putting comments in their code:
How much ever (un)readable your code is, any peer / reviewer / future team member can only understand what that code snippet is doing, but not why was it written in the first place or what the hell you were thinking while writing that logic. So, it'll be awesome if you write that as comments or at least link to the story/design doc which warranted that code.3 -
I develop for a Minecraft server, (Ik, MC is a dead meme, etc.) and I got a snippet of code from a kid one day asking for help debugging. He was missing a square bracket. How relatable.
-
#include <iostream>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
int n;
cin>>n;
int arr[n];
int count=0;
for(int i=0;i<n;i++){
cin>>arr[i];
count^=arr[i];
}
cout<<count<<endl;
}
return 0;
}
In the above program,
how does this code snippet work?
count^=arr[i];8 -
Please give me code snippet to create windows ec2 instance using boto3 within aws free tier limit.
import boto3
# Create an AWS session and EC2 client
aws_management_console = boto3.session.Session(profile_name='....')
ec2_console = aws_management_console.client(service_name='ec2')
def create_ec2_instance():
try:
print("Creating EC2 instance")
ec2_console.run_instances(
ImageId="....",
MinCount=1,
MaxCount=1,
InstanceType="t3.micro",
KeyName="...",
SecurityGroupIds=['...1'] # Specify your security group ID(s) as a list
)
except Exception as e:
print(e)
# Call the function to create the EC2 instance
create_ec2_instance()
Have i missed anything in this code?
It's running fine not creating any instance.4 -
Typescript is so fucking frustrating sometimes to deal with
The snippet above AND below do the EXACT SAME FUCKING THING. But because you double tap, it loses the fucking (not needed) type before the mapTo. If you aren't paying attention, you get this extremely fucking aggravating wall of red.
God damn it, can't this be better? RxJS is pretty fucking important, so why is this so god damned hard to just get some coherent fucking code highlighting!?
/rantover4