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
Victor Popescu
@padunk thank you for your feedback! good idea, with the shadow
Subrata Sarker
Here is my updated personal portfolio https://codepen.io/picklu/full/bpraBV. Please review the page and let me have your comments. Thank you.
Victor Popescu
I would appreciate some feedback on this project, thank you
Subrata Sarker
Nice work, @VicPopescu. I like the mobile version.
Victor Popescu
@picklu thank you!
abraham anak agung
@VicPopescu awesome as always. One think i want to ask what is this? let lastCopied: HTMLElement = null; I never see variable like this one.
Victor Popescu
@padunk thank you! that is a typescript declaration and initialization, its the equivalent of var lastCopied = null but with the type of the variable declared as HTMLElement
abraham anak agung
@VicPopescu ah, cool. idk that we can do TS with codepen like that. Thanks.
Victor Popescu
@padunk yes, you have typescript and babel preprocessors integrated in codepen
need help . couldn't passed the last one.. please help meh how can i improve this code
abraham anak agung
@hasarmu there is sieve of erasthothenes to help you sum all prime numbers
Massab Dubey
Hi! Everybody.
Hae campers
Kate Shim
Hi, guys!
Nelson Mfinda
Hi, everyone!
Hi guys, I have done few challenges from freeco
freeCodeCamp. Please review and suggest any improvements .
hi everyone, how to attach viber button from dialogflow
Aditya Dehal
@rnallu you're doing good.... keep going
@aditya2000 Thank you
Justin Rhodes
Hi guys! I
Justin Rhodes
I published a react tooltip library on npmjs: npmjs.com/package/react-power-tooltip Would be great if you guys could have a look at it and give feedback. That would be awesome!!
Christopher McCormack
@justinrhodes1 wow a lot of effort was put into those docs, nice job!
Justin Rhodes
@cmccormack thanks a lot! :)
Thanks for sharing such a great article or post on it. It is very useful for everyone. Publish some more article on it in future. Our institute PTI Academy also offer various IT courses and training for all IT students. For more info visit: https://www.ptiacademy.in/
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