Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
  • Apr 25 2019 17:12
    @mstellaluna banned @cmal
  • Jan 08 2019 22:05
    @mstellaluna banned @dertiuss323
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:13
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:58
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:15
    User @bjorno43 unbanned @jkyereh
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
  • Jul 06 2018 15:23
    @texas2010 banned @imlegend19
  • Jul 03 2018 12:28
    @bjorno43 banned @vbvmatta
  • Jun 29 2018 13:54
    @bjorno43 banned @OGTechnoBoy
  • Jun 27 2018 04:48
    @bjorno43 banned @eddiecervello
  • Jun 26 2018 20:45
    @bjorno43 banned @DesmondJameso2_twitter
  • May 23 2018 21:45
    @bjorno43 banned @CherryPlaysRoblox1
  • May 22 2018 01:28
    @bjorno43 banned @grimroot23
Samuel Ludwig
Hey all, this is not technically a code review, but I wrote some notes with the objective of giving a high-level overview of the core concepts of the Phoenix framework for Elixir. I'm doing this as sort of a Feynman thing as I'm going through the Programming Phoenix >= 1.4 book, and I wanted to know if there are any concepts that I've misunderstood, misrepresent, or don't communicate well. Link: https://github.com/samuelludwig/elixir-practice/blob/master/prog_phx_gte1.4_programs/notes/chapter02.md
Hi guys! I want to ask if is there a better way to handle async code with a rest api using express+mongodb(without mongoose). I have the logic split in services/model/routes.
I'll add an example of the code for a rest endpoint just for clarity:
// service
export const getUserByUsername = username => new Promise(async function(resolve, reject) {
  const userData = await dbgetUserByUsername(username);
  const user = userModelFactory(userData);
  if(validateUser(user)) {
  } else {
export const dbgetUserByUsername = username => getdb().collection('users').find({ username }).toArray((err, result) => (err || result));
router.get('/user/:username', handleasyncreq(req => getUserByUsername(req.params.username)
  .then(result => ({ body: result }))
  .catch(result => ({ body: result, status: 400 }))
//handleasyncreq code
export function handleasyncreq(f) {
  async function asynchandler(req, res) {
    const { status = 200, headers = {}, body = {} } = await f(req);
  return asynchandler;
I don't know if I'm doing promises/async right. I feel like I have to handle the async nature of MONGODB in two different places for just one operation - get a user by username -.

@abeledovictor I personally feel like the code you posted it too complex for its own good. Your mixing async/await with normal promises, your own async handler function, and new Promise, even tho you have async/await code.

For such a simple case, you should be fine with just the route, service and maybe the model. I also don't believe in using .then and .catch if your using async/await. It's more important to stay consistent than to do "one-liners" for the same of one-liners.

Great code is dirt easy to read and understand. Don't be clever/shorter just for the sake of it.

great, thanks for the feedback. I get what you mean but could you please provide an example using the code i've just shared? @bradtaniguchi

without getting to verbose (I'm to lazy to write out all your code hehe)
I would have this:

// route
router.get('/user/:username', (req, res) => {
  try {
    const {username} = req.params;
    const user = await getUserByUsername(username);
    res.send({status: 200, body: user});
  } catch (err) {
    res.send({body: err, status: 400});
// getUserByUsername service
// NOTE: if your using async await, you automatically return promises from this function
export const getUserByUsername =(username) => {
  const user = userModelFactory(dbGetUserByUsername(username)); // this function is the same
  if (validateUser(user) {
    return user;
  throw Error();

The dbGetUserByUsernamefunction is the same

I mainly threw out the async-handler, and the new Promise code. I feel like using them saves you a few lines, but were like 1 or 2 lines here or there haha
great thanks @bradtaniguchi :)
Just noticed my getUserByUsername needs the async in front of the (username) code, otherwise the code wont work hehe
and you will need the await next to the dbGetUserByUsername call aswell hehe
Ankit Phondani
https://github.com/phondani0 can anyone review my code
Abiodun Akorede
I need help with the managing packages with npm,after following instructions and pasting url in to box,it does not verify,only show signs of loading
Dhairya Sharma
Implement Heap Sort with a Min Heap getting erroe
@dhairya0907 gist please
let me know what you think of my personal portfolio.. still need to add form submission .. mostly interested in everyones opinion on the design and colors of the site.. i suck at design and am working on it.
@RandyGoldsmith Good one but Smooth scroll will be an advantage!
@RandyGoldsmith hey man, the background image is way too heavy, pls compress it, to load the page faster
menu texts are dancing while hovering over
Paradox Framework - Please review and suggest any improvements. - https://emilo9.github.io/Paradox-CSS-Framework-Alpha/Paradox_Example.html
It worked fine for me on my website https://bbbootstrap.com
// running tests
JSON.parse: unexpected character at line 1 column 1 of the JSON data
// tests completed
Managing Packages with Npm
Someone help me please
Send the code if U can
Adhetya Narayan
Can someone review my project?https://codepen.io/AdiBoy/pen/ZEYyLEP
Test case 1 failure @Adhetya check bro
And always send the full page view ๐Ÿคน
Nancy Brown
Take Advices From Experts Regarding Cash App Using Cash App Help
Sometimes, it becomes necessary to take advice from the professionals who will help you out by resolving the whole host of your problems. What you need to do is to visit the official website of cash app and then move to Cash App Help section at anytime from anywhere.
Avoiding Breaking Security With The Cash App Number?
Do you really want to add up extra security over your cash app account? Are you also looking for the help to avoid breaking security? For the reason itself, you should get the complete information along with the proper supervision from customer care experts by using Cash App Number at anytime.
PTI Academy
Hello All, I want to remove my account from Gitter, because I got irrelevant traffic from this site. My website is totally based on Jaipur, Rajasthan. I have 4k plus unwanted url from this site on my website. Please tell me how can I remove that links from my website.
Are you using API like!? @ptiacademy_twitter
Mayursinh Sarvaiya
Hey folks! Check out Bitwise Calculator, which is built in React :) If you have time, please review and feedback code.
But code?
Mayursinh Sarvaiya
Sorry. Forgot to add the link in markdown format.
Unable to delete when "NaN" in input box
I think you can put label down to the input box and disable NaN
Not disable - *display
Mayursinh Sarvaiya
Thank you ๐Ÿ˜€. Restriction on input will be added soon.
Mayursinh Sarvaiya
Hello guys. Anyone interested to work in open source project from scratch. It is not any billion dollar idea. However it is somehow useful. The motive is to experiencing collaborative development & push our skills to real world. Are you in? The skills required is ReactJS or ElectronJS, Other technology we can learn later on during process.
@Marvin9 Whats the actual app idea? I'm a TS dev and have been interested in electronjs, but should be fine without TS (but I do think its always worth it hehe)
Mayursinh Sarvaiya
@bradtaniguchi I have messaged you personally.
John Melody Me

<Android Development>
My folder and and file not exist in the local storage. I made a helper to create a directory in phone storage. But it Works on Samsung J2 but not the rest.

My Helper : https://gist.github.com/johnmelodyme/c2e1d648df216fe0f168d0985418f4d7

 if (FileHelper.saveToFile(readMessage)) {
                Toast.makeText(MainActivity.this,  "Saved to " + Environment.getExternalStorageDirectory() + 
                + FILE_NAME, 
                 Log.d(TAG, "Data Saved");
} else {
    // something something;

Am I doing it wrong ?

2 replies
code review for my library https://github.com/linkin-park/csvtojson
Hello everyone ! i would love to receive feedback on my Landing Page project https://codepen.io/florci1/pen/ZEbZRGa either good or bad !