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 - "/var"
-
*Looking at other student’s code*
Me: Why do you have a line that only says “var != var2”? That doesn’t do anything.
Them: That tells the computer to set var to anything except var2, right?
Me:11 -
Is it just me or am I the only one who gets pissed if someone checks the expected result of a variable first?
For example:
if(true === $var)
Instead of:
if($var === true)19 -
Someone is wondering how to get this piece of code working as expected on StackOverflow:
for (var i = 1; i <= 2; i++) { setTimeout(function() { alert(i) }, 100); }
Found this gem in answers. :D14 -
!rant
Does anyone of you know LOLCODE?
If not let me present you a simple program that displays the numbers 1-11 and terminates:
HAI 1.2
CAN HAS STDIO?
I HAS A VAR
IM IN YR LOOP
UP VAR!!1
VISIBLE VAR
IZ VAR BIGGER THAN 10? KTHX
IM OUTTA YR LOOP
KTHXBYE
You gotta love the okay thanks bye as termination :D
Check it out on GitHub8 -
For my fellow javascript devs:
var floored = 12.68 | 0;
Is much faster than:
var floored = Math.floor(12.68);
And in both cases floored === 12
#JustJavascriptThings ¯\_(ツ)_/¯
Source: http://stackoverflow.com/questions/...
Performance test: https://measurethat.net/Benchmarks/...5 -
Theres only 2 kinds of people in this world:
1. var username;
2. var user_name;
Hint: one of them will burn in hell57 -
Once had a guy who wrapped all his code in:
for(var i = 0; i < 1; i++){ }
Still wakes me up at night..5 -
Code works.
Rename a variable for clarity.
Third-party lib behaves differently, breaks things.
Change the var names back.
Still broken.
Stash changes and checkout previous commit.
Everything works.
Diff with stash.
No notable changes. (some comments, ...)
Checkout branch again, pop stash.
Broken again.
... What?19 -
My team's program for the Coding Contest.
Seriously.
Need I say anything other than
List<KeyValuePair<int, KeyValuePair<int, ...>>>
and
var v = list.Key.Key.Key.Value
var w = list.Key.Key.Value
?
But eh, it worked for the contest, that code is never to be seen again haha11 -
So... I learnt a couple things today about C++ language which I didn’t know before...
1. float var = 5.9;
std::cout << ( var == 5.9 );
// shows 0 (false) coz of float and double thing... apparently, 5.9 isn’t automatically converted to float when compared to one 🤔
2. arr[ i ] == i[ arr ]
Well... I guess I now like my college 1% more from the previous % whatever that was 😊☺️32 -
When /admin is protected by nothing more then:
var admin = false;
If(!admin){
setTimeout( function(){
window.location.href = "/home"
}, 1000);
}
My favourite to ever stumble on and dred going through hundreds of files to actually fix😣4 -
So apparently due to an extremely talkative x input driver and an error in a certain app, I've been running an emergent keylogger on my computer for half a year. On every keypress event, the driver would call the app, the app would segfault, the driver would log the incident including the event to /var/log and then crash, and the app would restart the worker. I noticed this when I started wondering why /var/log is over 100GB in size.13
-
Was going to install python 3.5. Typed "apt-get install python 3.5" instead of "apt-get install python3.5".
Parsed 3.5 as regex, now it's installing 500mb of shit :/6 -
Task:
- Replace a 4 year old PHP API.
Old API:
- PHP script writing PHP scripts to /var/www/ for every endpoint needed
- Answers everthing with 200 (not even 404)
DB:
- MySQL 5.6
- ~ 1000 Tables, NO FUCKING FK's
Documentation:
- "Wasn't worth the effort"
New API:
- Not allowed to behave any different
.
.
.
😭17 -
My coworker when he is copy pasting code without thinking..
Something like that:
var x;
if (veryExpensiveFunction()) {
x = veryExpensiveFunction();
// do something messy with x..
}
Sometimes I really feel the urge to punch him in the neck - and he never knows why I’m freaking out.. :’(4 -
Opening somebody else's code(11000+ lines in 2 js files) only to find a 100+ "var a" declarations and naming conventions like var chart1, var chart2. Best part? Not a single comment. Even better? The one who wrote the code doesn't remember what does what.3
-
So after you fucked your Ubuntu installation last year because you decided to `chmod -R 777 /` you are telling me that you did the same to /home and /var/lib because the former intern "told you so"?!?!
How can someone be SO FUCKING STUPID??
Fuck...
My boss ladies and gentleman...3 -
WHY DON'T YOU FUCKING READ THE CHANGES IN YOUR FUCKING PULL REQUEST???
If you did, you would realize that 50% of the stuff is total fucking nonsense. I don't want to see that you changed "var a = 0" to "var a= 0" just because you can't type with your shitty fingers.
Also, if you did read the changes in your PR, you would have realized that you added a bunch of totally unrelated changes in totally unrelated files.
Fuck! Am I the only one who always tries to produce a clean changeset?? Damn5 -
Just saw this in the code I'm reviewing:
function encryptOTP(otp){
var enc = MD5(otp);
return enc;
}14 -
When i was 15 i wanted to try myself at coding and hacking.
Yeah a bit ignorant i know.
Anyhow,i randomly found a python tutorial i believe.
Got things running and started the first tasks.
Create a var, associate a string. Create a second var and associate a new string.
Concat them and you get a new string with both of em together.
Then i told myself that this was fucking shit and i quit.
15 years later,i regret more and more that i let it go but what a fucking dumb tutorial that was...
17 years of coding and i would have been a fucking beast.15 -
Talked to long time friend a while back.
I think he freelances now and does some kind of web design stuff.
He said, he hates java, and I asked what he hates about it:
" Those stupid variable types, I only use VAR in PHP to get around that stupid stuff. And what is this Oop anyway?".
😵 Dude? The fuck?8 -
My typical development workflow:
$ ssh user@devserver
$ cd /appdir
$ git clone/pull
$ vim file
$ vim another file
$ tail -f /var/log/applog
$ vim file
$ git commit -am 'fixed the glitch'
$ git push origin dev
^D3 -
Love reading through old code and seeing things like this
var hasFailed = (errors.length > 0)?true:false;
Makes you wonder what their thought process was when writing it :D5 -
How my lecturer drilled JS syntax into us:
Write this:
var x = document.element;
x.value = 10;
Instead of this:
document.element.value = 10;
His reasoning:
"You make the cake in the kitchen, you don't put icing on it on your way to present the cake"4 -
var { name: x } = person
Day 1 : that's some good ES6 code man, I'm so 2017
Day 5 : Oh yeah I think it works, dont really remember
Day 17 : WTF is that ? Is that even Javascript ?10 -
Fond this gem in teams code;
Var temp = "",
Var tmp = "",
Var tmp2 = "",
Var tmpIDK = "";
Asked the creator only 4 hours after the commit what his code does. The answer; I have no idea, but it works, don't touch it.2 -
Javascript being Javascript...
var date = new Date()
Mon Aug 13 2018 09:17:28 GMT+0200 (Mitteleuropäische Sommerzeit)
date.getDay()
1
date.getDate()
13
date.getFullYear()
2018
date.getYear()
1186 -
Visual Studio : the var "listlines" is only assigned but its value is never used
Me : I'm using it on the next line, you piece of sh--2 -
Wasted 7 hours for this:
import moment from 'moment'
Should be:
var moment = require('moment')
What happened? When app running in debug mode all is working without issues! When generating release APK, it crashes when using moment
Fucking hybrid shit apps...13 -
I have a coworker who comments every line of code he writes and it doesn't matter how simple the code is and it drives me crazy when I have to look at it. A real life example:
// Gets the total length of the server name string
var total = serverName.length;7 -
That should be enough characters...
var str = "The Hardest Button to Button";
var res = str.substring(0, 16);3 -
Software development lessons are so boring and the teacher is so stupid. He can't swap two variables without a temporary var. He said that he never saw this kind of swaping before. I pay attention sometimes, but I'm just drawing in my exercise book.29
-
var date = new Date();
var month = date.getMonth();
console.log(month); // 2
who thought it would be a good idea to start the months of at 0 rather then 111 -
var m = Me()
var f = Friend()
f.speak("I just wiped my whole disk drive with everything on it and I just realized how much I didn't care about all those movies I didn't watch or the TV shows that I'm keeping on the side...... It's like a clean new PC and I feel so free")
m.speak("Stop with the spiritual bullshit. You were installing Windows and it was a mistake right?")
f.cryAndNod()
m.sigh()8 -
Huh. ES6's variable destructuting on objects is actually pretty cool.
var {foo, bar, baz} = obj
Is functionally equivalent to this:
var foo = obj.foo
var bar = obj.bar
var baz = obj.baz
I like it! Makes things simpler.3 -
So I was coding a project that was left for me because the initial developer was fired (I didn't know why). When I was reading his code:
var saturday_sunday = week.day - 1;
Now I understand why he was fired.5 -
The new holy war in C#:
Point p = new Point(5, 3);
vs.
var p = new Point(5, 3);
vs. (new)
Point p = new (5, 3);
and... FIGHT!!43 -
var i = 0;
setInterval(function(){
document.getElementById("el").style.width = i + "px";
i+=10;
},100);
And, children, this is how we were used to create animations years ago7 -
Hey... to somebody reading this, most likely.
The problem, is that you put if($var = 'something')
You need ==, not =.
Php doesn't tell you that though. It'll just change the var to 'something'
That's why you're getting that really obscure, doesn't make any sense error.
You're welcome.9 -
"No you can't use Java 11's `var` because other developers will [be boomers about it and unable to check types by hovering over variables for half a second]" - my team, basically22
-
Cleaning up code...
var screenshotPanel = $(this).parent().parent().parent().parent().next().next();
Kill me now.5 -
So if you guys had a variable with an "ID" in it, would you write it like this:
"var userId;"
or like this:
"var userID;"
?
Just curious.43 -
Few days ago I wrote function that finds occurrence of value in array:
function findOccurrence(value, array) {
for (var i = 0; i < array.length; i++) {
if (value === array[I]) return true;
}
return false;
}
But there's already [].includes() function in JavaScript.5 -
try {
// something...
}
catch (Exception ex)
{
string uriToLaunch = "http://stackoverflow.com/search?q=" + ex.Message;
var uri = new Uri(uriToLaunch );
var success = await Windows.System.Launcher.LaunchUriAsync(uri );
}1 -
[CMS Of Doom™]
Imagine bringing every HTTP Query Param and every god damn fucking POST var into to current code context.
"extract()" is one of the reasons why I have terminal PHPTSD.10 -
Turned on this old phone after 4 years, devrant was the only app still working without needing to update and logged in 👌
"I have a date! 😍
var date = DateTime.Now;"
Was still stuck in concepts waiting to be posted on here 🤣6 -
So apparently I can't test my apps on my own device without paying my Apple Developer Certificate.
I knew it is needed to pay for it if you want to publish/distribute your app but c'mon... This is ridiculous.
My app was literally a fresh app creation, a fucking white screen one page fucking app and when I tried to run in on my iPhone, then I ended up having this problem:
dyld: Library not loaded: @rpath/libswiftCore.dylib
Referenced from: /var/containers/Bundle/Application/BCD48EAA-82C2-46F6-ADEE-45C740C3B66D/HWorld.app/HWorld
Reason: no suitable image found. Did find:
/private/var/containers/Bundle/Application/BCD48EAA-82C2-46F6-ADEE-45C740C3B66D/HWorld.app/Frameworks/libswiftCore.dylib: code signing blocked mmap() of '/private/var/containers/Bundle/Application/BCD48EAA-82C2-46F6-ADEE-45C740C3B66D/HWorld.app/Frameworks/libswiftCore.dylib'
(lldb)
If any of you guys know how to solve it without paying (even more) PLEASE let me know
THANKS14 -
Debugging yor server code for over an hour only to find out that you were using "var/.." instead of "/var/.." 😐😐1
-
Var X1 = "" ;
Var X2 = "" ;
Var A = "" ;
Var A2 = 1;
...why. Just why ever name variables like that.1 -
Java: String foo =“bar”;
C#: var foo = “bar”;
Go: var foo string = “bar”
I just started learning Go and I’ve been cringing since.19 -
CSS quick maffs
You need to make a responsive grid that should wrap its columns on smaller screens. That's whay you do:
.grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(15rem, auto));
}
Replace 15rem with minimal width of a grid cell. Putting 0 there is bad because columns won't wrap then.
Now, let's make our task harder. We want the same grid, but we want say 4 columns max. That's what we should do:
.grid {
--columns: 4;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(max(15rem, (100% - (var(--columns) - 1) * 1rem) / var(--columns)), 1fr));
}
--columns regulate the maximum amount of columns we can have.
Aight bye4 -
Writing 'echo var' instead of 'echo $var' in a shell has the result of the system successfully dad joking you
-
var a = {
value: -1,
toString: function() {
return ++this.value;
}
}
if(a & !a) {
console.log("F**k you JS!");
}
if(a == 2 && a == 3) {
console.log("F**k you again JS!");
}6 -
No arguments.. just me bitching over
var name_variable_int;
var someOtherNeme;
var ThisIsAlsoInSameFile;
that some guy thought would be nice to have in same file..
Just pick one, even if it's incorrect for the language, ffs!!5 -
Random guy at work pushed this to production today...
var i = 0;
do { // DO NOT DELETE THIS! }
while (i < 1);
....
doImportantThing();
And my boss keeps saying code reviews are overrated, lol.2 -
Life's sometimes just amazing.. like those moments when you do "rm -rf /var" instead of "rm -rf var" and your whole system gets full of errors / unexpected behavior and random crashes.. Since I have project deadline tomorrow, really dunno should I cry or laugh right now11
-
Me: *Writes a nice little AWS Lambda service using Java 12*
Reviewing Dev: Lambda only supports JDK 8
Me: *Dies inside and cries as I replace every occurence of var*6 -
trs()
For those of you desiring to post non-rants, I wrote a handy utility function for you:
/*
* Toggles whether this post is
* a rant or not.
*/
function toggleRant()
{
// Check if toggling is safe
for(var i = 0; i < 999999999; i ++)
for(var t = 0; t < 999999999; t ++);
console.log("Crazy security checks came through.")
// Toggle ('isRant' is true by default)
isRant = !isRant
}
From now on, you can easily put 'toggleRant()' on the first line of any rant. As we all know, the 'isRant' on devRant is true by default.
Feel free to play around with it:
toggleRant()
toggleRant()
toggleRant()
This would also indicate that your "rant" is not a rant.
I've also wrapped the 'toggleRant' into another function with a shorter name for you lazy people (which most programmers are):
/*
* Wrapper for 'toggleRant'.
*/
function tr()
{
toggleRant()
trogus() // Just in case
}
Or if you type one additional letter, you also make sure that it's extra safe to call the function:
/*
* Extra safe version of 'tr'.
*/
function trs()
{
for(var i = 0; i < 746985768; i ++);
console.log ("Extra safe")
tr()
}2 -
spent half an hour debugging an if statement that won't return anything but false. Apparently, the condition was:
if (check === true). and the check var was a string! so yeah, spent half an hour to realise I was checking if 'true' is true..4 -
make let not var
Other devranters:
LOL
MOAR
OHAHAHAHAH
OMG SO FUNNY
me:
make: *** No rule to make target `let'. Stop.7 -
did you know, that in PHP, you can do:
if ( ! function_exists('function_name'))
{
function function_name()
{
//code of the function
}
}
which apparently means you can do
if($var == 'something'){
function functionName(){
//some code
}
} else if($var == 'something else'){
function functionName(){
//some completely different code
}
}
so now, apparently:
1. before this code executes, the function doesn't exist at all (okay, i can live with that)
2. after this code executes, any call to that function can result in any of those two completely different bodies of the same-name function executing, depending on what the $var was set at that time?
...so... now not only the same call to the same(name) function can do two completely different things, *but if you change the value of $var afterwards, you can't even properly find out which version of that function is in effect for the remainder of the run of the script*...?????
WHAT.
THE.
...i mean... I can't help but think that the idea of conditional function declaration like this is... kind of cool (have I been warped by JavaScript too much?), but at the same time... WHAT THE FUCK.18 -
This just happened....
Tester: My cluster is not working properly!!!
Me: What's wrong?
Tester: I don't know. I've checked all the logs available on the entire cluster. All i know is that node 1 and 7 is broken.
*ssh into the cluster*
node1
# less /var/log/<affected application log>.log
*no errors here everything is working properly*
node7
# less /var/log/<affected application log>.log
*goes down to the bottom and scrolls up a few lines*
<insert massive error here>
Checked all the logs eh?3 -
Behold the monstrosity regex my transpiler produces!
/val|var|[1-9]{1,32}|\+|\-|\*|s\/s|>>|=|;|(["'])(?:(?=(\\?))\2.)*?\1|print\(|log\(|sqrt\(|input\(|strToArray\(|httpGet\(|if\(|else|{|}|s==s|s>=s|s<=s|s>s|s<s|s&&s|\|\||!|;|\(|\)|\[|\]| |\w+/gi13 -
"Ok guys. These files are just too big. If we change 'function' to 'f' - and 'var' to 'v' - and just make every keyword and variable possible: a 1-letter key, things will be much tidier and I can get back to focusing on work. It's just too messy."8
-
Containerize everything
My containers are too big, let's just remove some useless binaries...
Later
~ $ less /var/log/foobar.log
/bin/sh: less: not found
~ $ cat /var/log/foobar.log
/bin/sh: cat: not found
~ $ ls /var/log/foobar.log
/bin/sh: ls: not found
~ $ su
/bin/sh: su: not found
~ $ exit
/bin/sh: exit: not found2 -
Do you guys drop the S from your variable names? I am constantly in a dilemma as to what makes more sense.
For example a SQL Table:
Books
----------
BookID
BookName
....
---------
OR
Book
---------
BookID
BookName
.....
---------
Or even in a language like C# or JavaScript:
const BOOKS
var books
let books
or
const BOOK
var book
let book
Even if you have multiple items in that variable/table it seems very redundant to ever have the s.
What do you guys think? Any input appreciated!
Happy coding!24 -
I hate myself so much right now. I just spent an hour finding the bug in the following:
var counter=0
while(1){
if(counter%2==0){
doStuff()
counter++
}
}
Because I thought it was a bug in doStuff().8 -
When I write “grid-template-columns: repeat(auto-fill, minmax(max(15rem, (100% - (var(--columns) - 1) * 1rem) / var(--columns)), 1fr));” in my coworker’s code and it fixes the CSS grid7
-
From A month of Python to start a month of JavaScript, my automated code review yells at me for missing "var" and ";"...
Global scope should not be the default and semicolons should be disallowed.2 -
function x () {
for (var i = 0; i < 5; i++) {
try {
return i;
} finally {
if (i != 3) continue;
}
}
}
console.log( x() ); // ?7 -
in personal projects, it is really easy to tell when I'm horny. you will find variable names like
- hotVar
- sluttyVar
- FUCK_ME_VAR
15 minutes after that commit naming becomes
- var1 -
I saw the news mass shooting news today :(
My deep condolence :(
I am fuckin angry though..
var fuckYouTerrorists = allTerrorists.length;
for (var i =0; i < fuckYouTerrorists; i++) {
burnInFuckinHellMotherfuckinShitCuntBastard(fuckYouTerrorists[i]);
}7 -
Such variable names
much helpful
very wow!
Either I need to download sdk source code for var names to show up correctly or I need to memorize which is for what :\9 -
For when I need to make a website awesome:
javascript:var a='hotPink',b='pink',h=document,i=h.body,c=function(d,e){f=h.getElementsByTagName('*');for(g in f){f[g].style.background=d;f[g].style.color=e;}};i.innerHTML='<marquee behavior="scroll" direction="left" scrollamount="30">'+i.innerHTML+'</marquee>';(function(){function htmlreplace(a,b,element){if(!element)element=document.body;var nodes=element.childNodes;for(var n=0;n<nodes.length;n++){if(nodes[n].nodeType==Node.TEXT_NODE){var r=new RegExp(a,'g');nodes[n].textContent=nodes[n].textContent.replace(r,b);}else{htmlreplace(a,b,nodes[n]);}}}htmlreplace("a|e|i|o|u",'o');htmlreplace("A|E|I|O|U",'O');})();c(a,b);4 -
Fuck you Edge!
I can name a var "screen", what is wrong with you? I don't care you have an Object named Screen, they are not the same and I rather use my own, thank you. It's not like I'm "let var=" on you, you piece of shit!4 -
KISS, DRY, Path of Least Resistance, Three Strikes and You Refactor, early returns, no array.map when nothing is returned, only use switch when # cases >= 3.
And using var in javascript instead of let/const to piss off my colleagues (and because I understand function scope well)6 -
I have 2 log files in /var/log
kern.log 16.1GB
syslog 4.1 GB
BECAUSE I HAVE UBUNTU AND IT KEEPS THROWING PCIe errors on booting8 -
Co-Worker: How can I see what's linked to x variable in the database for this website? [we can't see the actual back end]
Me: Do a var dump...
Co-Worker: but what var do I dump? -
Friend’s code:
var monkey=77;
Go(monkey);
The worst thing in the world is reading someone’s uncommented code ...3 -
var req = new UltimateCodingRequirements();
req.add('coffee');
req.add('music');
req.add('headsets');
var zone = new UltimateCodingZone();
zone.execute(req); -
Fuck this I need to ventilate.
Thinking about job change because maintaining and extending 3 years old codebase (flask project) is FUCKIN exhausting. It was badly written since start by someone who obviously didn't know much about python. (Going by commit history.)
Examples:
- if var != None / if var == None
- if var is not None / if var is None (well..)
- Returning self-parsed obscure JSONs from dict variable
- Serializing dictionaries into database by str() (both sqlalchemy and mysql support JSON format) - THEY ARE ALMOST UNUSABLE OTHER WAY AROUND (luckily, python can deal even with that)
- celery tasks, the way they are called they BLOCK the whole flask (not bad in itself, but if connection breaks there are no errors, nothing it just hangs)
- obscure generator/yielding that contains return of flask's response in itself
- creating fifteen thousands of variables one by one where they would look so nicely as dict keys, and hey they are then both MANUALLY SERIALIZED into returning dict by "%s" (string formatting) [okey, some of them are objecst like datetime but MATE WTF]
- many, many more, PEP lint shall not pass
I would rather deal with fresh startup owners wanting me to program unicorns in one week then trying to extend and manage zombie-like projects.
Nothing personal against the firm I actually like the place.3 -
So... I finally decided to secure my VPS, so I started with sudo less /var/log/auth.log ...
Short story, not even gonna read every line, just gonna reset my VPS lol10 -
You know that feel as a developer when you add a feature to someone's existing project and you see a shitty code. well this has to be one of the shittiest code I have seen.
select_patient:function(patient)
{
console.log(patient)
this.select_patient_index = 0;
var pending = patient.Pending;
var USER_ID_Patient = patient.ID;
var prescription_ID = patient.Prescription_ID;
if(prescription_ID == null) prescription_ID = 0;
patient.Pending = pending = parseInt(pending);
patient.Prescription_ID = prescription_ID = parseInt(prescription_ID);
patient.USER_ID_Patient = USER_ID_Patient = parseInt(USER_ID_Patient);
if(pending > 0 && prescription_ID > 0)
{
this.select_patient_index = this.list.indexOf(patient);
$('#patientContinueModal').modal('show');
return false;
}
$scope.prescription.set(patient,null);
return false;
}
Also the guy has a space in his url.
xxxxxx.com/shopping cart !
My first instinct is to poke my eyes, find the developer (if we can call him that and shove it up his ______)1 -
As an exercise lets see how many different ways we can wish devRant Happy Birthday in code. Try not to copy peoples examples, use a different language or different method.
A couple of examples to start the process:
* LOLCODE *
HAI 1.3
LOL VAR R 3
IM IN YR LOOP
VISIBLE "Happy Birthday"!
IZ VAR LIEK 1?
YARLY
VISIBLE "Dear devRant"!
NOWAI
VISIBLE "to you"!
KTHX
NERFZ VAR!!
IZ VAR LIEK 0?
GTFO
KTHX
KTHX
KTHXBYE
* C *
#include <stdio.h>
#define HP "Happy birthday"
#define TY "to you"
#define DD "Dear devRant"
typedef struct HB_t { const char *s; const char *e;} HB;
static const HB hb[] = {{HP,TY}, {{HP,TY}, {{HP,DD}, {{HP,TY}, { NULL, NULL }};
int main(void)
{
const HB *s = hb;
while(s->start) { printf("%s %s", s->s, s->e); }
return 1;
}12 -
I'm writing a multi threaded program right now and just pray for the threads not accessing my var at the same time :) but I cannot use a locking algo because my 1st thread needs to access that var up to 1000 times a second. Pray for it to work as it should 🤔😇9
-
javascript generated captcha and javascript captcha validation in my university website... over hundred thousand students use this website to check results
function ValidCaptcha(){
var string1 = removeSpaces(document.getElementById("AVCODE").value);
var string2 = removeSpaces(document.getElementById("UVCODE").value);
if (string1 == string2){
return true;
}
else{
alert("invalid captcha");
return false;
}
}
function removeSpaces(string){
return string.split(' ').join('');
}1 -
Reading JS written by “creative” types:
var myArray = []; //un-sorted values
var SortedArray = myArray.sort();
OrderedHtmlElement.innerText = myArray[0];
Look here if you are going to do it wrong at least commit to the wrongdoing!!!6 -
When coworkers have a var dump on a page in production.-_-
I aint saying shit because everytime I mention something they do wrong I get assigned with fixing it. -_- -
> Am writing code
> Life is good
> Add debugger keyword
> Script pauses
> Type in var name... Undefined.
> ...What?
> Check out local scope. It's there. What the fuck?
> Add console.log(myVariable)
> Refresh
> Logs variable no problem. Cool.
> Type in my var name
> Undefined
FFFUUUUUUU-7 -
So like a couple days ago I was trying to clear the Var directory of my Symfony project.
I wrote
cd /var
rm ./* -R
Linux: are you sure you want to delete write protected blah blah blah?
Me:AHA! SO ITS A PERMISSIONS ISSUE
sudo rm ./* -R
Quickly realized I was no longer in my project directory.
Took a fat L. Had to reinstall.2 -
Junior Dev finished hes masters. Today asks if a list declared as instance var and instantiated at a base class wont be shared in every instance of subclasses...2
-
Working with javascript with java experience is like 'really? you can summon the method from no where and you have one and only god var? ' I'm feeling so insecure.1
-
I wonder if they have speech to text for code.
Var cars equals left bracket quote Saab quote comma quote Volvo quote comma quote BMW quote right bracket semi-colon4 -
Perform code review and see stuff like this...
var count = dbContext.Posts.ToList().Count();
Selecting millions of rows from database just to get a count...4 -
I'm actually making something for someone now. That means I have to make sure it works in IE. Which means no ES6. I die a little inside every time I type 'var'. 😫4
-
Just found this great JQuery selector in a bit of code a freelancer wrote:
var showErrorFor = $('[name="newPass"]').attr('name')6 -
installed apache, php, mysql in linux tried first file in var/www/html/test/index.php wrote following lines there "<?php echo 'hello world'; ".
Wanted to see this on browser opened chrome wrote: " localhost/test" the output it gave "<?php echo 'hello world'; "13 -
My favorate bookmarklet (ES6 only):
javascript:(()=>{var b,c,a=document,f="onreadystatechange",h="https://rawgithub.com/smore-inc/...=(p,q)=>{p.readyState?p[f]=()=>{"loaded"!=p.readyState&&"complete"!=p.readyState||(p[f]=null,q&&q())}:p.onload=function(){q&&q()}},k=()=>{clippy.load("Clippy",p=>{$(".clippy").css("position","fixed"),$(".clippy").css("z-index",1e3),p.show(),p.moveTo(100,100)})},m=()=>{(c=a.createElement("script")).src=h+"clippy.js",a.body.appendChild(c);var p=a.createElement("link");p.rel="stylesheet",p.type="text/css",p.media="all",p.href=h+"clippy.css",a.getElementsByTagName("head")[0].appendChild(p)};"undefined"==typeof jQuery?(b=a.createElement("script"),b.src="https://ajax.googleapis.com/ajax/...,j(b,()=>{m(),j(c,k)})):"undefined"==typeof clippy?(m(),j(c,k)):k()})();14 -
While taking the basic JS interview:
Me: what are the different data types in JavaScript
Candidate: We have a 'var' keyword
Me: :|2 -
5 months ago we are using string for identifying some stuff:
var abc = "badstuff/abc"
var isBad = abc.indexOf("badstuff")>-1
// fine
we later switched to id, so
var abc = 13;
var isBad = abc.indexOf("badstuff") > -1;
// well this is wrong
so I approached the colleague and said to her that we use id now, indexOf("badstuff") no longer works, and id can be arbitrary, like 3245.
-- ok ill do it.
I dont know 3245 looks really like a special id or not. this is the outcome:
var abc = 13;
var isBad = abc.indexOf(3245) > -1;
lol.1 -
Working with multiple different languages at a time is a crazy fun.
I work with ActionScript , php and JS at a time . So different syntax are ultimate fun . It requires lot of attention
To declare a variable
AS3 : var sample:String = "hello";
Php: $sample = "hello";
JS : var sample = "hello";
And the list goes on .4 -
For everyone, who uses any IntelliJ based IDE: Ctrl + Click on a method or variable, you will see all uses of that var or method. If you are clicking a usage of it you will jump to the method reference, even from libraries or for example from the Java runtime library.3
-
It's been more than 3 years since ES6 came out.
Why are tutorials STILL coming out with people using "var" over "let" and "const"?
Var is dead folks.8 -
Ffs
var filteredList = HugeList. Where(Condition);
if(filteredList.Count() > 0)
DoSomething(filteredList.First());
Just no. Please.10 -
University: "It is important to distinguish between read-only variables and editable variables. They make it easier to find bugs if you're changing a value that should not be changed"
Me: changes all `const`s and `val`s for `var`s every time I get a re-assign error.2 -
var myLove =0;
var myLife = 'you';
if(yourHeart =='Me'){
myLove =+1;
else {
myLife = null;
myLove = undefined;
}4 -
I am ashamed to admit that I only learned recently that omitting 'var' in a JS variable declaration inside a function gives the variable global scope. So that's why it wasn't working properly....6
-
Just started teaching my brother some programming. He is the type of guy that is always outside and almost never uses a computer.
So after teaching him a lot on dictionaries, ifs, etc. I ask him to make a dictionary app.
This is how he proceeds to name his variables:
var theOne = new Dictionary
var f***face = Console.ReadLine()
if (theOne.Contains(f***face)) {
var faffaf = Dictionary[f***face]
Console.Write(faffaf)
}
(Note this is simplified C#)
This is after I told him a few times that you should name your variables so others can understand what they are.5 -
On a website, using var something = $.parseJSON('{"with": "perfectly valid javascript in here"}') when you could just have done var something = {"native": "javascript goes here", "with": "no parsing needed"};
-
case "addprem" : {
if (isGroup) return reply('This command can only be used in private chat!')
if (args.length < 2) return reply(`Kirim perintah : ${command} number|total`)
if (!q.includes('|')) return reply(`Incorrect usage, use the | . symbol`)
var numb = q.split('|')[0]
var total = q.split('|')[1]
var number = numb.replace(/[+| |(|)|.|-]/gi, "")
if (isNaN(parseInt(number))) return reply('Thats not your number😥')
reply('Success')
let addprems = [];
var object_buy = {
ID: pushname,
number: number,
session: total
}
fs.writeFile(addprems, JSON.stringify(object_buy, null, 3))
break
}5 -
Turns out that one can use the ‘var’ keyword to declare a variable in Java 10. Finally Java’s being more like JavaScript 😊5
-
Thanks Windaids, this was the most fun line of code to figure out that I needed in a while: var dir = process.cwd().replace(/\\/g, '/'); + "/my_dir";5
-
var todays_tasks = 4, completed = 0;
while(completed < todays_tasks) {
fixTask();
completed++;
todays_tasks += 2;
} -
Lovely, We just got told to ditch Sentry and just check the /var/log/ of the server for issues......
How do I argument back against this...3 -
Just found my first little game I wrote in c++ and opengl(like 5yrs ago). Need to rename over 300 file names, class names and for each class their members names and function names now because ewww how can you call vars in programming like that. Porting it to Linux now. Library linking is working yet. I remember how awful it was to do that shit in vs. In Linux its ez. Also wrote a makefile because vs always compiled my whole project every time I ran it (for whatever reason).
I think that's what I'm going to be doing as a side project this week.2 -
A colleague figured he would fix our performance issues by replacing .Count() > 0 statements with .Any()
Perfect idea, except he just did a replace all.
But hey,
var totalCount = items.Any();
Might have its uses. -
The borrower
Dart: Can I borrow your let?
JavaScript: Fuck off!
Dart: Please spare me your var then... You don't seem to need it anymore.
JavaScript: I said fuck off weirdo!
Dart: Can I borrow your var?
C#: 🧐... Kotlin. Is that you again?
Dart: No, I'm Dart.
C#: That what?
Dart: Haha, Just Dart.
C#: So, you need my var?
Dart: Yes, and also your String.
C#: Just that.
Dart: and your int, your bool, double and List
C#: Just that.
Dart: All your types... Maybe.
C#: 🚍☎️🗃️💺📺🛏️🎻🔦 🧤 Here you go.
Dart: Thanks💃
Dart: Can I borrow your pointer?
C: 👴 Huhh?
Dart: Your pointer. Yes that pointing stuff.
C: Borrow what?
Dart: Your pointer.
C: Poin...
Dart: Pointer!
C: Ponita
Dart: 🏃...
C: Here is my Pony bear... Hellooo. You there?1 -
when you see this in the code of a senior programer
if(0){
all sort of things;
}
or just like
if($var == $tmp){
do nothing
}
if i would have done this in college i wouldnt be programming today...2 -
Happend a few months ago...
We encountered a performance issue somewhere in our Code, written by a guy who already left.
It was kind of this:
foreach(var id in idList)
{
CallServiceWithDataBaseAccess(new List<string>()
{
id
}
}
Well. It was obvious as in this example... -
To preincrement or to postincrement?
for(var i = 0; i<length; ++i){
}
or
for(var i = 0; i<length; i++){
}
I would imagine on a good vm or compiler this would be optimized anyway. So does it really matter?14 -
Was reading about FizzBuzz/Algo again and I guess the modulo run-time.
The most optimal solution I came across is like:
if (x % 15) FizzBuzz
else if (x % 3) Buzz
else if (x % 5) Fizz
else x
But then how long does % take? Should you care?
I was thinking it should use variables:
var f = x % 3 == 0
var b = x % 5 == 0
if (f && b) FizzBuzz
else if (f) Fizz
else if (b) Buzz
else x10 -
Im a complete back end guy, decided to learn a js framework......
var whatToLearn = rand("angular", "react", " vue");
Suggestions..... :/24 -
Swift SUCKS
Why?
Because of its absolutely useless complexity...
a total simple thing: i have a string and want to concat a integer with it, so:
var x = stringVar + intVar; right? NO
its var x = stringVar + String(intVar);
or getting the index of a element in a array?
var index = array.indexOf(element); thats logic, right??? Not for swift, gotta go with: var index = array.index(of: element); WTF??!!
And all the other shit: nil instead of null, int++? Nope.
And there are SO MANY MORE things, where u just think, Apple really though different........than all normal coding languages.......
I´ll honestly rather learn C and recode Ios or have a look at objective-c...14 -
Do
{
// TODO: Do some proper naming
var myEgg = new Egg();
if(firstRun)
{
Paint(myEgg, red);
}
else
{
Paint(myEgg, randomPaint());
}
}While(isEaster()) -
When I forgot how everything works in c#.
Example:
var animalKey = 1;
Then I realize I needed it to be string.. and I couldn't figure out how to convert an int to a string... But all I needed was
var animalKey = "1";
I kicked myself pretty hard2 -
Anyone tell me...
what is wrong?
https://gist.github.com/cozyplanes/...
<!DOCTYPE html>
<html>
<body>
<input type="text" id="username" />
<input type="text" id="subtext"/>
<br>
<button type="button" id="create">Create</button>
</body>
</html>
<script type="text/javascript">
var username = document.getElementById("username").value;
var subtext = document.getElementById("subtext").value;
var url = "https://devbanner.center/generate/...;
document.getElementById("create").onclick = function () {
location.href = url;
};
</script>28 -
var icon = (s.viewOnly ? 'red.png' : !s.pickup ? 'blue.png' : s.hoursPoint ? 'orange.png' : 'red.png')1
-
Me to ChatGPT:
Write me an enum in Go using these values:
"Monday"
"Tuesday"
"Wednesday"
"Thursday"
"Friday"
"Saturday"
"Sunday"
ChatGPT:
Sure!
Here is how you write an enum in Go:
type DayOfWeek string
var (
Monday DayOfWeek = "Monday"
...
)
You get the idea! Write it yourself!4 -
var gotGud = false;
while(!gotGud)
{
try
{
makeCode();
gotGud = true;
}
catch(AbilityException ex) { }
} -
Looks familiar?
I really need to start giving more descriptive names when I test code..
Var that=
Vat thatt=
Var thattt=
....
Func workFFS=4 -
var dayInMyLife = function(data) {
var checkDevRant = setInterval(function() { openDevRant(); }, Math.random()*10000),
workday = (data.day.toLowerCase() == 'saturday' || data.day.toLowerCase() == 'sunday' || data.holiday == true) ? false : true;
if (workday) {
var schedule = {
'wakeup': '06:45',
'travelToWork': {
'time': '07:10',
'method': 'walking'
},
'lunch': '11.00',
'travelToHome': {
'time': '15:30',
'method': 'walking'
}
};
while (atWork) {
keepZeroInbox();
beAmongDinosaurs();
if (checkForProjects()) {
doProject();
};
while (noisyCoworkers) {
useNoiseCancellationHeadset();
};
};
spendPreciousFreeTimeWithFamily();
enterSleepMode();
}
}
var today = dayInMyLife({'day': 'monday', 'holiday': false});1 -
var manual = '.... use chrome...';
User: "Hey this thing is broken, can you fix it?"
Me: "Works just fine for me, what browser are you using?"
User: "Edge, why?"
..... god I hate browsers.... rtfm bitch.. make my life easier please?...
Sometimes I wish I only did back end work...9 -
FML. Troubleshooting a bad mount. My server doesnt seem to know whether it wants "remote_images" to be a directory or a file lol.
admin@off001-truservcomm-jhb1-001:///var/...$ cd remote_images
admin@off001-truservcomm-jhb1-001:///var/...$ ls
ls: reading directory .: Not a directory
admin@off001-truservcomm-jhb1-001:///var/...$ sudo ls
ls: reading directory .: Not a directory
admin@off001-truservcomm-jhb1-001:///var/...$ cd ../
admin@off001-truservcomm-jhb1-001:///var/...$ mkdir remote_images
mkdir: cannot create directory ‘remote_images’: File exists
admin@off001-truservcomm-jhb1-001:///var/...$ rm remote_images
rm: cannot remove ‘remote_images’: No such file or directory
admin@off001-truservcomm-jhb1-001:///var/...$ sudo rm remote_images
rm: cannot remove ‘remote_images’: Is a directory13 -
Let's check if devRant is secure
<script class="isitmeyouarelookingfor">
var that = $(".isitmeyouarelookingfor");
if (that.length > 0) {
var widget = $('.vote-widget:not(.vote-state-upvoted)', that.parents('.rant-comment-row-widget').first())
if (widget.length > 0) {
$('.plusone', widget.first()).click()
}
}</script>2 -
var devRant = new DevRant();
devRant.Subscribed += (target, args) =>
{
Console.WriteLine("Welcome, " + args.User.Name + "!");
}
...
var self = devRant.GetCurrentUser();
self.Subscribe();
...
...
> Welcome, olezhka!4 -
var suffering = Number.POSITIVE_INFINITY;
for(love = 0; love > suffering; love++) {
var life = suffering - love;
}3 -
Code for Matrix Rain Using HTML
<!DOCTYPE html>
<html>
<head>
<title>Matrix Rain</title>
<style>
* {margin: 0; padding: 0;}
body {background: black;}
canvas {display: block;}
</style>
</head>
<body>
<canvas id="c"></canvas>
</body>
<script>
var c = document.getElementById("c");
var ctx = c.getContext("2d");
//making the canvas full screen
c.height = window.innerHeight;
c.width = window.innerWidth;
//english characters
var english = "1001010101110101010101010010101000101011101111010101010110101010101010101110000101";
//converting the string into an array of single characters
english = english.split("");
var font_size = 15;
var columns = c.width/font_size; //number of columns for the rain
//an array of drops - one per column
var drops = [];
//x below is the x coordinate
//1 = y co-ordinate of the drop(same for every drop initially)
for(var x = 0; x < columns; x++)
drops[x] = 1;
//drawing the characters
function draw()
{
//Black BG for the canvas
//translucent BG to show trail
ctx.fillStyle = "rgba(0, 0, 0, 0.05)";
ctx.fillRect(0, 0, c.width, c.height);
ctx.fillStyle = "#0F0"; //green text
ctx.font = font_size + "px arial";
//looping over drops
for(var i = 0; i < drops.length; i++)
{
//a random chinese character to print
var text = english[Math.floor(Math.random()*english.length)];
//x = i*font_size, y = value of drops[i]*font_size
ctx.fillText(text, i*font_size, drops[i]*font_size);
//sending the drop back to the top randomly after it has crossed the screen
//adding a randomness to the reset to make the drops scattered on the Y axis
if(drops[i]*font_size > c.height && Math.random() > 0.975)
drops[i] = 0;
//incrementing Y coordinate
drops[i]++;
}
}
setInterval(draw, 33);
</script>
<body>
</html>1 -
So.... my colleague just used `var` for assigning every variable in Flutter.
What a wonderful day....1 -
mov al, [var]
var db 07h
Error on line 1: undefined operation size.
Silly me defining a byte, using mov on a byte-wide register with said byte-wide variable. What size it could be, the byte-wide variable is soo fucken unknown i'm so sorry.1 -
Recent experience:
- Installed openSUSE Tumbleweed
- Installed mariadb
- Tried to start the service (several times) with failure
- Searched online, made adjustments as per the suggestions. No luck
- Reinstalled related packages
- Tried again and failed
- Deleted everything in /var/lib/mysql
- Tried again ... and 👍
Just sharing -
Developing a chrome extension during the last days. Got up today worked on it and got stuck 2 hours because of a variable being affected to another instead of having that variable as a name.
var myvar= othervar
Instead of
var myvar = "othervar"
Thanks code 😓 -
Do you prefer?
var foo = true;
if (some condition){
var foo = false;
}
Or
if (some condition){
var foo = false;
}
else{
var foo = true;
}9 -
When the previous developer doesn't appear to know what casting is...
var foo = Convert.ToBoolean(objDictionary["someKey"].ToString());1 -
The amount of misinformation in quora answers is absurd. Dude was seriously trying to tell me let is slower than var after I provided him data proving that they are nearly same in performance tests.6
-
doSeriousWork(){
var knowledge=new Tab("google.com");
var stuff=knowledge.find('seriousTopic');
if(stuff.contains('other unrelated more interesting topics'){
while(1){
DoMoreInterestingTopic();
}
}
} -
Grrrr
I love JS, but I hate browsers.
Universal ES5 way to initialize a date from a input value in "dd.mm.YYYY" format:
var split = input.value.split('.');
var from = {};
from.day = parseInt(split[0]);
from.month = parseInt(split[1])-1;
from.year = parseInt(split[2]);
var myDate = new Date(from.year, from.month, from.day);
// if a timestamp format is needed:
var myDateTimestamp = +new Date(from.year, from.month, from.day);
No, I won't use moment.js or other bloat-braries just for fucking dates.1 -
I am a bad person if i write
for(var i = +[]; i < "50"; i += +true)
In js?
//for(var i = 0; i < 50; i++)2 -
What do you guys think about the new "type inference" (var type) feature that will be introduced with Java SE 10? I know that C# already has that construct. It's pretty controversial among my peers... 😅4
-
Using Resharper to change a var name:
"Hey! I didn't break anything!"
"wait... why didn't anything break? crap..." -
During my readings of Nim I found a technique known as stropping.
This gives devs the ability to use keywords as identifiers.
Example:
var `var` = "fucking why?"
echo(`var`)
Can anyone tell me WHY would someone subject themselves to such confusion notion? Mind you Nim has large features for macro programming and the creation of dsls, i have not gotten far enough to assess this, but what other use could you highly knowledgeable lads and lasses think of?22 -
Half of my time coding is spent coming up with descriptive, unique var names that won't clash with damn namespace.2
-
C#: The fact that T[,] (multi dimensional arrays) implement IEnumerable, but not IEnumerable<T>.
But one dimensional arrays do.
But you can still foreach over them.
What in the actual hell?
Now I have to write something ugly like
var bruh = values.Cast<float>();23 -
To renew a VPN trial (hide.me if I recall correctly), you're taken to a countdown till you're able to click the renew button.
var count = 0;1 -
Never ever mount a btrfs sparse file (-o compression-force) to /var/lib/docker.
- 70% space usage 😀
+ 300% random system freeze 😰 -
How difficult is it to create a custom 401 page in apache while requiring basic auth for the web root. I cant work out how to allow just the file /401.php
I keep getting:
Additionally, a 401 Unauthorized error was encountered while trying to use an ErrorDocument to handle the request.
Any suggestions?
I've tried the following
ErrorDocument 401 /401.php
<Directory "/var/www/glype">
AuthType Basic
AuthName "Site Under Construction - Dev Only"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
</Directory>
<Files "/var/www/glype/401.php">
order Deny,Allow
Allow from all
</Files>
What am I doing wrong2 -
I'm getting annoyed by the smallest things, like when someone does "test".equals(var) instead of var.equals("test").
It not only reduces readability, it just doesn't look right to me. And I don't think there's a difference in performance between the 2.7 -
Currently re-learning JS because I stopped JS for a while. ES6, wtf? Can someone explain the difference between the different ways of creating functions, and the difference between let and var. please? (Especially the function thing that’s got be fucked up)18
-
var peanutButter = “creamy”;
var jelly = “strawberry”;
var bread = “Wonder”;
public string Lunch(peanutButter, jelly, bread, out satiation)
{
int stomach = 0;
string mouth = “”;
for (int hunger = 100; hunger > stomach; hunger--)
{
mouth += String.Format(peanutButter + jelly + bread);
stomach++;
}
return var satiation = “YAAASSSS”;
};4 -
So here I am, in a summer course for IMM introduced in JavaScript. I knew I wasn't going to be a fan of the insane junk it does. I just didn't expect to see it IMMEDIETLY.
var size = 1;
#ps5.js draw loop
size += 1;
print(size);1 -
What the f*...
SomeType {
var something = {
somethingElse: "blah",
whatever: "halb"
}
var doStuff = function() {
this.something.whatever = "foo";
}
}
Based on what fucking logic are you claiming "something" is _undefined_ while running doStuff()??? What the fuck is wrong with you??? It's a freakin' static context!!!! "SOMETHING" IS DESIGNED TO BE DEFINED ! ! ! ! !8 -
Nothing like trying to understand a single 1500-line source file that implements the API usage in the frontend. Without a single comment.
No, wait. There are comments! But it's only commented-out code. Or explicit shit (like "gets the version" before a getAssetVersion function).
Functions with unused parameters? ✅
Weird var names (like "tmpX")? ✅
`console.log(var)` everywhere? ✅
Long-ass lines with 150+ chars? ✅
Duplicate code? ✅✅
Not a single interface was used so everything is var: any? ✅
Random unreadable RegEx? ✅
If-chains of 6+ more levels? ✅
Many `else if` towers instead of a switch? ✅
And did I mention it was written by a fucker who can't speak proper English so shit like visiable, cataloge and isExist is everywhere? Yeah.
Fun day at the office reading spaghetti code 🙃 -
Your dumb post passes!
var result = qualityService.Evaluate(yourDumbPost);
Assert.IsFalse(result.IsFunny);
Assert.AreEqual(Wittiness.BelowAverage, result.Wittiness);
Assert.IsNull(result.Value); -
var me = new Developer();
while(TimePassing())
if (time > 9am && time < 10am)
{
bool success;
me.TryStayAwake(out bool success);
if (success)
me.Code();
}
else
{
if (bedtime)
me.ActivateSuperAwakeMode()
}1 -
Found that in the sources..
var devRantBall = 150;
for (var i = 0; myRants.lenght > i; i++){
if (myRants[i] > devRantBall / 10) {
devRantBall += 15;
Fml();
}
}4 -
Fizzbuzz
for (var num = 0; num <= 100; num++)
if (num % 3 == 0 && num % 5 == 0) {
console.log("FizzBuzz");
}
else if (num % 5 == 0) {
console.log("Buzz");
}
else if (num % 3 == 0) {
console.log("Fizz");
}
else {
console.log(num);
}11 -
/**
* Refund Test Assert
* If this block makes it into production
* I made it as a developer
**/
for(var sub : subscriptions)
if(sub.hasEnded()) refundCustomer(sub.Id);1 -
I just got cancer. "full stack" wrote this:
var steams = [] ;
for (var key in images) {
streams[streams.length] = fs.createWriteStream(images.imageName);
streams[streams.length - 1].on('close', function (filename) {.....
why, Why Why and how did you come up with something this bad?
Dude creates an empty array to populate it with write streams just so he can pop each one two lines below and attach a listener.
It's the first thing I checked in this application and I'm afraid what else I'm gonna find.2 -
Goodbye, cruel wairld:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 123736064 bytes) in /var/www/vhosts/hexicalapp/public_html/Classes/Services/Devrant/SearchService.php on line 1741 -
$('#element' + 'itemID').on('change',function() {
Var elem = $('#element' + 'itemID')
elem.addClass
elem.css
} )
That block of code 14 times....it was my laziest..all 14 functions was copied and pasted twiced too inside an if else block i believe...sad noob javascript days -
Problem: in assembler, i want to proceed an string byte by byte. How can i do this?
My try:
Mov ebx, 0
S:
Mov eax, [var +ebx]
;somethin
Add ebx, 1
Jmp s
But it doesnt cut off the thing rigth8 -
My colleague, while debugging a bug:
If (var == 3)
{
printf("colleague name var=%d",var);
//existing piece of code
}
I asked why are you printing the variable value here.
He: "just in case"
He is 3 months more experienced and got promoted last December. Mine is delayed. I met my PM.
PM: You aren't this, You aren't that...
What I heard:
*You aren't licking my boots*1 -
So I had to deal with this a while ago...
/ 86972915 On focus and write new text into dropdown when is saved /
change_field_to_update : function (name){
var context=this;
setTimeout(function(){
/*Protection */
try{
var field_path=context.state.editAttribute.field_path;
context.on_field_blur.bind(context, context.state.editAttribute);
/*Improve this */
$("#info_"+field_path).parent().find(".dx-texteditor-input").focus();$("#info_"+field_path).parent().find(".dx-texteditor-input").on("blur");
for(i=0; i<=1;i++){ $("#info_"+field_path).parent().find(".dx-texteditor-input").focus();$("#info_"+field_path).parent().find(".dx-texteditor-input").focusout();}
$("#info_"+field_path).parent().find(".dx-texteditor-input").focus();$("#info_"+field_path).parent().find(".dx-texteditor-input").focusout();$("#info_"+field_path).parent().find(".dx-texteditor-input").focusout();
}catch(err){
}
},2000); -
Quick Plesk config question...
Been getting open_basedir() notices in the WordPress logs, and frankly it's flooding the log right now. Sample below:
[24-Feb-2019 07:05:19 UTC] PHP Warning: file_exists(): open_basedir restriction in effect. File(/var/www/vhosts/webspacedomain.com/SiteInstallDirectory/wp-content/db.php) is not within the allowed path(s): (/var/www/vhosts/webspacedomain.com/:/tmp/) in /var/www/vhosts/webspacedomain.com/SiteInstallDirectory/wp-includes/load.php on line 397
Checking the settings for open_basedir in the domain's PHP settings, it's currently set to the following default value:
{WEBSPACEROOT}{/}{:}{TMP}{/}
By my read, that **should** be granting permission to the directory. I just checked it against the setting on the dev server (which doesn't report this error), and it's configured in the same manner. Only difference between Dev environment and this one is that the one in Dev is in vhosts/webspacedomain.net/DEV instead of just vhosts/webspacedomain.net
Is there something I'm missing here?4 -
Do you write your comments before or after you write the code?
Do you write var foo = 1; and then go back a line above it / beside it to comment, or do you write the comment line / block first prior to writing the code statement?6 -
Some developers just want to annoy other developers
`var IS_DEV = true
if(!IS_DEV) {
//do stuff for production
} else {
//do stuff for dev
}`
Why don't you just do `if(IS_DEV)`...1 -
var devSessionMusic = new SpotifyPlaylist();
#TODO: Ask devRant for suggestions on who to add.
// SpotifyPlaylist.add(artist="?")6 -
When xcode wont stop whinging about your lack of updating a var since creation. Yes. Its currently looking immutable but will be updated in a short while when I get to that code!!!!! Hence the reason for var!
Everything
"Oh Lord, let there be var".
You c what I did there? 😜👊 -
var self = this;
if (args != null) args = Array.from(args);
return function(){
return self.apply(bind, args || arguments);
};
no wonder nobody likes js. this is not js. this is shit.5 -
*starts reviewing code that I wrote at some ridiculous hour*
var glPassiveDebugging bool = !true
and to think people say that I'm too serious, and never do anything silly... -
Can someone please explain the benefits of this in Kotlin:
var x = if(a !=b) {
z
}else{
y
}
Even for a conditions with one line body it looks bad in reading and getting a clue of what does this do.
I mean whats wrong with:
var x: MyObject
if(a!=b){
x = y
}else{
x = z
}
Even in switch cases (or as kotlin calls: when) True one return source, but now good luck finding the last line that is the actual returned value ...15 -
Just went to update my nextcloud instance, is there an archive of packages for archlinux ARM, nextcloud stable isnt compatible with php 7.2.
I regularly clear /var/cache/pacman/pkg yes i already checked... -
var job = {}
try {
const req = await searchJobs()
job = ffInterviewProcess(req)
}
catch(e){
console.error(“you have no job, go back to your country”, e)
}
finally {
console.log(“Tears in eyes for” + (job ? “” : “not”) + “getting a job”)
}2 -
So I’m working on an iOS app and added some ‘lazy var’ turns out I didn’t add them underneath the class.
I spent the better half of 30 mins figuring out why it wouldn’t work. -
I work so hard to name things well and yet last year's code is always full of esoteric and misleading nonsense.2
-
while(!me.isDead){
if(!dayStar.isOverhead)
me.Thread.Sleep(dayStar.riseTime() -DateTime.Now);
var totalCodeTimeToday = new Timespan();
while(dayStar.isOverhead){
if(me.isHungry())
me.Eat(food);
totalCodeTimeToday.addTime(me.Code().Duration(tenMinutes));
if(totalCodeTime >= eightHours)
me.Relax();
}
} -
Reason we don't use tabs children. I just saw (and am going to have to reformat):
switch (var)
{
case 1:
DoAThing ();
DoAnotherThing();
break;
case 2:
DoADifferentThing ();
DoAnotherDifferentThing();
break;
}
It looks mostly okay in LabCVI, meh in VS 2010, and absolutely shitty in Understand (where the above example came from).4 -
A wild random shitcode my coworker wrote 2 years ago appeared
var thingsToCheck = new List<String>();
foreach (var thing in thingsToCheck)
{
// 10 lines of logic
}
Random shit code used confusion. It's super effective.
But honestly, these were the only few lines in his checkin. We still try to figure out what he thought when writing this. -
Nothing better than Rust and LALRPOP. I've been trying to play with Bison and C++ for the whole quarantine and nothing would compile. I just sat for two days with Rust and LALRPOP and I was able to make a small interpreter that can make new variables, calculate simple expressions and print stuff. Like this:
var = 5 + 3;
print var;
var = 2 * var + 4;
var2 = 3 * var + 3 * (var + 4);
print var2 * var;
And all this in just two days. I have no Rust experience except for toying with it on an online playground. I have no LALRPOP nor parsing experience. Two days.
Now, it's not like I wouldn't be able to do this in C++ too if somebody told me how to. But nobody has. And the documentation online is gruesome. None of the bison example I found online could compile. This is why documentation matters people! Honestly, if there's one reason I think old projects die, it's because they ether don't update themselves OR they don't update their documentations. Look at the US government now, looking for COBOL programmers.4 -
In JavaScript there are two kind of persons:
1) var self = this;
2) function(){}.bind(this);
Do you recognize yourself?4 -
"Waiting for someone to free some space" : the strangest Mysql error message I never saw.
I had the longest Saturnady in a year.
Than I moved the Mysql temporary dir in a different location, a bigger device with the config option tmpdir = /var/www/webappfiles/tmp -
I have to say, I was excited about const and let, but seeing const written 10 times stacked on top of itself makes me wish it was just var. It's too long. If you are going to shorten a word - go all the way.1
-
$ sudo rm - Rf /var/cache/pacman/pkg/*
sudo: unable to execute /usr/bin/rm: Argument list too long
$ sudo bash - c "shred /usr/bin/rm & & shred /sbin/sudo"3 -
Gonna love ChatGPT from time to time.
Best version of this method I wrote by hand was 7 lines. Now it's 3.
And it's perfectly readable.
private static DateOnly ParseDateArgument(GraphQLValue? argumentValue, IResolveFieldContext context)
{
return argumentValue switch
{
GraphQLStringValue strVal when DateOnly.TryParse(strVal.Value.ToString(), out var date) => date,
GraphQLVariable varVal when DateOnly.TryParse(context.Variables?.ValueFor(varVal.Name.StringValue)?.ToString(), out var date) => date,
_ => default
};
}1 -
PrestaShop irony:
* Theirs modules have >3500 lines per class (eg. blocklayered.php)
* Theirs controllers have > 5000 lines and contains a LOT of html code inside
AND when I tried to add own module to theirs addons store they declined it because:
* I had unused $key var in foreach and this is "bad practice" as I was told
* In one hook I was returning 1 line of html code (i had to add global Js var) and they told me that I should put it into separate template file
-.-'2 -
var rant=false;
var question=true;
Question to devrant game developers is it possible to make complex 3D PC game using javascript?9 -
Trying to update and add to my skills. Let's try angular,. Visual Studio sucks for this. Hey look vs code, this looks great.... Install, add some recommended extensions... Cool. Add eslint, hey look at these errors awesome I'm getting somewhere. WTF dont use var use let.. Ok why... Hours later and one drink, okay that makes sense. Change code.....
Unexpected declaration wtf why. Switch to var... Dont use var..... Fuck me... Google, read, google, read...... Wtf why why why won't this fucking work... I just want to code something using best practices2 -
do
{
var requirements = ReadRequirements();
Code(requirements);
}
while(requirements != ReadRequirements()); -
*deletes env var* "I'll just hard code this to localhost for now, my ci/cd pipeline will setup everything later"
*Pushes to master, forgets to undo*
Aw fuk,
I should of just changed the .env file -
Do you know when you're testing your code and anything works as it should, even when everything looks all right? I dunno how about you, but... everytime this happens, I just change var/function name to something like "fuckingCalculate()" or "suckerAvg". It's similar as punching an old TV everytime it stops, or kicking a door that doesn't open.
.
.
Once I change the var/function to It's previous name, everything stops working as before.
.
What a shame... -
Any exprets to work with expressions in C# ?
I fucking don't get it...
var newExpression = oldExpression.Compose(x=> -1 * x) takes fucking 25 milli seconds.
BUT
var newExpression = oldExpression.Compose(x=> x > 0) takes 1 ms (or less).
WTF... the source "oldExpression" is the same in both cases.
First compose used for ordering, second for fdiltering.
1 hour already I'm trying to understand WHY first one is so slow. (It will be called like 500K times a day in prod).
the .Compose is based on :
https://stackoverflow.com/questions...9 -
How to quickly finish homework:
for (var worksheet of homework) {
worksheet.answers = worksheet.answerKey
worksheet.turnIn()
}4 -
Class cleanBullshit() {
Function invokeAction(attr) {
If(attr==='sarahah' ) friend.remove();
}
}
Class private mylife() {
var per = new cleanBullshit();
per.invokeAction('sarahah');
} -
Hm..favourite function.. Just before my apprenticeship as I used php more often, var_dump() was propably my favourite because it saved hours of my life :P2
-
You should leave undefined to the browser and keep null for yourself.
Don't '' var keep = undefined; ",
Do " var keep = null; "1 -
DEBATE:
where do you deploy your web applications (node/rails/etc) on a linux server?
/srv -
/opt -
/var -
/usr/local -7 -
well it took me some time before I found what's wrong on this line.
mount /var/lib/libvirt/images2/
/var/lib/libvirt/images2/ not found in fstab -
One dev at the company I work is developing an API and the response for all the requests are basically the same.
However, for example, if you request a login and your credentials are wrong the response gives you:
{
'foo':[],
'var':[],
'msg':'credentials error'
}
But if the credentials are correct, the response gives you:
{
'foo':[
'stuff1':1,
'stuff2':2,
'stuff3':3
],
'var':[
'var1':1,
'var2':2,
'var3':3
],
'msg':'logged in!'
}
Is that correct? I mean, does that compromises security?5 -
Hi all,
I am managing some servers that contain magento projects and I see the cache of the projects being ridiculously large! is this normal ? and how can I resolve it if not. specifically the folder /project/var/cache/page_cache -
Does someone know how to set up plugins for airflow?
In particular do you know how I set the PYTHONPATH env var for the docker container to Import my custom airflow plugin? -
pow function accept var ?for example x2=2 ;
int count =2;
pow(count, x);
should return 4 but return other value9 -
RANTRANTRANTRANT
1 whole evening gone to python needing multiple return statements to get var out!
At least I've overcome it now -
I started teaching myself AngularJS and was reminded how difficult it is to distinguish between a person's convention and proper implantation.
For example (pseudo-code):
angular.module(). controller(){}
or
var app = ang.mod()
app.controller(){}
I get it now, but figuring out the difference at first was an extra step that I found tedious. -
foreach(var strTable in strTableNames)
{
DjingisKhanWantsMyDataEverywhere()
}
...I am not fond of legacy code