These are chat archives for FreeCodeCamp/HelpJavaScript

12th
Feb 2018
aRtoo
@artoodeeto
Feb 12 00:59
hey fam i have a nav but i cant make it move even though im adding a class or toggling it. any idea?
https://codepen.io/artoo/pen/qxmxyL?editors=0111
Ronique Ricketts
@RoniqueRicketts
Feb 12 01:03
My group will go through freecodecamp javascript tonight for 2-3hours, anyone wanna join?
Jonathon Lopez
@JonathonLLopez
Feb 12 01:10

function getElementsThatEqual10AtProperty(obj, key) {
/*
Given an object and a key, “getElementsThatEqual10AtProperty” returns an array 
containing all the elements of the array located at the given key that are equal to ten.
*/

  var emptyArray = [];
  for(var key in obj) {
    if(obj[key] === 10) {
      return obj[key];
    }
  }
  return emptyArray;

}

console.log(getElementsThatEqual10AtProperty());
It is worth mentioning that if the array is empty or doesn't have a key value of 10, it should return an empty array
Stephen James
@sjames1958gm
Feb 12 01:27
@JonathonLLopez Looks like you are overwriting your input key with for loop key
@JonathonLLopez can you supply input and output examples
Stephen James
@sjames1958gm
Feb 12 01:35
@JonathonLLopez Also, you just return from the inside of the loop - which will only ever return one value
FlashHero
@FlashHero
Feb 12 01:50
how do I pull a dispatcher from another file to
const mapDispatchToProps=(dispatch)=>{
    return ({

        })
}
Jonathon Lopez
@JonathonLLopez
Feb 12 02:02
@sjames1958gm hey sorry for delayed response. So you were right that I was returning in the loop. I decided to switch to using .filter but I'm still having trouble

function getElementsThatEqual10AtProperty(obj, key) {
/*
Given an object and a key, “getElementsThatEqual10AtProperty” returns an array 
containing all the elements of the array located at the given key that are equal to ten.

Notes:
* If the array is empty, it should return an empty array.
* If the array contains no elements that are equal to 10, it should return an empty array.
* If the property at the given key is not an array, it should return an empty array.
* If there is no property at the key, it should return an empty array.



*/

  var arr = [];

  arr = obj[key].filter(function(value) {
          return (value === 10);
    });
    return arr;

}
Tom
@moT01
Feb 12 02:36
try putting key in '
obj['key']
@JonathonLLopez
no, that cant be right
not quite sure - any idea whats going wrong - it looks like it should work
Jonathon Lopez
@JonathonLLopez
Feb 12 02:41
I figured out that I needed to meet a few other conditionals for it to pass. Thanks though! @moT01
CamperBot
@camperbot
Feb 12 02:41
jonathonllopez sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
:cookie: 983 | @mot01 |http://www.freecodecamp.org/mot01
Tom
@moT01
Feb 12 02:42
983
Wes
@wesneubeck
Feb 12 02:51
what am I missing here
Tom
@moT01
Feb 12 02:53
A question mark and a capital 'W'.
Wes
@wesneubeck
Feb 12 02:54

function palindrome(str) {
// Good luck!
if (str.replace(/[\W]/g, '').toLowerCase ===
str.replace(/[\W
]/g, '').toLowerCase.split('').reverse().join('')) {
return true;
} else {
return false;
}
}

palindrome("eye");
@wesneubeck

haha...thanks @moT01
Tom
@moT01
Feb 12 02:55
how to format...
three ticks (`) + new line (shift+enter) + code + new line + three more ticks
ticks are at the top left
Wes
@wesneubeck
Feb 12 02:57

'''

function palindrome(str) {
// Good luck!
if (str.replace(/[\W]/g, '').toLowerCase ===
str.replace(/[\W
]/g, '').toLowerCase.split('').reverse().join('')) {
return true;
} else {
return false;
}
}

palindrome("eye");

CamperBot
@camperbot
Feb 12 02:57
:bulb: to format code use backticks! ``` more info
Tom
@moT01
Feb 12 02:58
whats the regex for
i feel like you dont need it
parenthesis on .toLowerCase()
Wes
@wesneubeck
Feb 12 03:01
Ahhhh... @moT01 good call.
and it worked. thanks. first time on here. sorry for the format issue
Tom
@moT01
Feb 12 03:02
thanks @moT01
CamperBot
@camperbot
Feb 12 03:02
sorry mot01, you can't send brownie points to yourself! :sparkles: :sparkles:
Tom
@moT01
Feb 12 03:03
@wesneubeck thats alright, say thanks with my name like that if you dont mind
CamperBot
@camperbot
Feb 12 03:03
mot01 sends brownie points to @wesneubeck :sparkles: :thumbsup: :sparkles:
api offline
Wes
@wesneubeck
Feb 12 03:03
thanks @moT01
CamperBot
@camperbot
Feb 12 03:03
wesneubeck sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
:cookie: 984 | @mot01 |http://www.freecodecamp.org/mot01
Tom
@moT01
Feb 12 03:03
984
Conor Murphy
@cmurphy580
Feb 12 05:10
Can anyone help me incorporate ReduxPromise into this store file?
import { createStore, compose, applyMiddleware } from 'redux';
import { BrowserRouter, Route, Switch } from 'react-router-dom';
import ReduxPromise from 'redux-promise';
import { syncHistoryWithStore } from 'react-router-redux';
import { browserHistory } from 'react-router';

import rootReducer from './reducers/index';

const defaultState = {
  todays_news: null,
  term_results: null,
  provider_news: null
}

const enhancers = compose(
  window.devToolsExtension ? window.devToolsExtension() : f => f
);

const store = createStore(rootReducer, defaultState, enhancers);

//const createStoreWithMiddleware = applyMiddleware(ReduxPromise)(createStore); DO NOT KNOW HOW TO INCORPORATE REDUXPROMISE INTO THIS CONFIGURATION

export const history = syncHistoryWithStore(browserHistory, store);

if (module.hot) {
  module.hot.accept('./reducers/', () => {
    const nextRootReducer = require('./reducers/index').default;
    store.replaceReducer(nextRootReducer);
  });
}


export default store;
Claudio Restifo
@Marmiz
Feb 12 05:37

@cmurphy580 never used it (i'm a fan of redux saga) but from the docs there's a

import promiseMiddleware from 'redux-promise';

so probably something like:

const middleware = promiseMiddleware();

const store = createStore(
  reducer,
  applyMiddleware(middleware)
)

? but again never used it so this is just what I'm used to with saga or thunk

Conor Murphy
@cmurphy580
Feb 12 05:56
@Marmiz i tried that without defining the middleware. I'll give it a go. Thank you for the help. What docs are you ererring to
CamperBot
@camperbot
Feb 12 05:56
cmurphy580 sends brownie points to @marmiz :sparkles: :thumbsup: :sparkles:
:star2: 1152 | @marmiz |http://www.freecodecamp.org/marmiz
Claudio Restifo
@Marmiz
Feb 12 06:52
@cmurphy580 just went to the first redux-promise github project that I found:
https://github.com/acdlite/redux-promise
Conor Murphy
@cmurphy580
Feb 12 06:59
@Marmiz sweet thanks again
CamperBot
@camperbot
Feb 12 06:59
cmurphy580 sends brownie points to @marmiz :sparkles: :thumbsup: :sparkles:
:star2: 1153 | @marmiz |http://www.freecodecamp.org/marmiz
Claudio Restifo
@Marmiz
Feb 12 07:02
@cmurphy580 anyway if you are looking for an async store manager i really like redux-saga
https://github.com/redux-saga/redux-saga
Conor Murphy
@cmurphy580
Feb 12 07:07
I'm going to work with this tonight, but if ican 't get it to work i'll check it out, and hit you up with any questions. Either way though i'll check it out.
@Marmiz
Claudio Restifo
@Marmiz
Feb 12 07:09
@cmurphy580 well if it's specific with redux-promise I have never even heard of it before you asked/googled it :)
but it shouldn't differ much from the others
anyway hope I can be of help in case things don't work out :+1:
Sweet Coding :)
@SweetCodingInc
Feb 12 10:54
I prefer redux-observable
sabahatullah
@sabahatullah
Feb 12 11:34
Hi guys, I was wondering if someone can help me out here.
I have created a sticky header/navigation on scroll. it works fine, however, on Ipad I have noticed on scrolling down there is a bit of delay. basically on scroll I am adding a class "sticky" that gives it position fixed. In pad although on scroll, it adds the class but the css kicks in with a delay.
and if I keep on scrolling, the sticky nav only gets displayed when I stop scrolling.
here is a video of this bug https://we.tl/IgLTFYUvMI
sabahatullah
@sabahatullah
Feb 12 12:03
anyone?
JLuboff
@JLuboff
Feb 12 16:18
:wave:
Ken Haduch
@khaduch
Feb 12 16:18
:wave:
JLuboff
@JLuboff
Feb 12 16:18
@khaduch Hey Ken, how's it going?
Markus Kiili
@Masd925
Feb 12 16:18
:wave:
JLuboff
@JLuboff
Feb 12 16:18
@Masd925 Hey Markus, how's it going?
Ken Haduch
@khaduch
Feb 12 16:18
@JLuboff - going okay, and you?
JLuboff
@JLuboff
Feb 12 16:20
@khaduch Doing alright.... overslept this morning but managed to still get to work on time heh
Markus Kiili
@Masd925
Feb 12 16:20
@JLuboff Fine. Dreaming about being overslept this morning.
JLuboff
@JLuboff
Feb 12 16:21
Luckily it was only 20 minutes lol
Stephen James
@sjames1958gm
Feb 12 16:32
@JLuboff I have a dog that never lets me oversleep. Even on weekends.
JLuboff
@JLuboff
Feb 12 16:33
@sjames1958gm My dog goes through phases of that. Normally when the sun is up earlier. He'll start whacking his tail against the bed sicne he knows it wakes us :joy:
Markus Kiili
@Masd925
Feb 12 16:43
@JLuboff We are also going to buy a dog. I said that if the walking it falls on me, the dog will mysteriously disappear.
JLuboff
@JLuboff
Feb 12 16:44
Eh...walkings not that bad. Taking him for a long enough walk is another story though
@sjames1958gm Oh btw, thanks for the NVM suggestion, Got it installed along with node, easy-peasy
CamperBot
@camperbot
Feb 12 16:49
jluboff sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8967 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Markus Kiili
@Masd925
Feb 12 16:52
@JLuboff I made the bus departure application with pure JS. Nice exercise.
Stephen James
@sjames1958gm
Feb 12 16:56
@Masd925 :+1:
JLuboff
@JLuboff
Feb 12 16:56
@Masd925 Nice! Is it meant for mobile use?
Stephen James
@sjames1958gm
Feb 12 16:56
@JLuboff You're welcome
Markus Kiili
@Masd925
Feb 12 16:57
@JLuboff Yes. Still some work to do, but it is working.
Kelechi Chinaka
@kelechy
Feb 12 17:00
@sjames1958gm how do i turn a long long int in c to string
Stephen James
@sjames1958gm
Feb 12 17:01
@kelechy Use sprintf
long long x = 999;
char str[256];
sprintf(str, "%lld", x);
Kelechi Chinaka
@kelechy
Feb 12 17:03
so x is now a string? @sjames1958gm
JLuboff
@JLuboff
Feb 12 17:04
@Masd925 Nice, good job
Stephen James
@sjames1958gm
Feb 12 17:06
@sjames1958gm str is the string
JLuboff
@JLuboff
Feb 12 17:50
For anyone interested.. pm2 is a great package for setting up multiple node apps on a single server and have them auto start on boot
Stephen James
@sjames1958gm
Feb 12 17:55
@JLuboff Yes!
JLuboff
@JLuboff
Feb 12 17:57
@sjames1958gm You knew about it and didn't tell me?! :P
Stephen James
@sjames1958gm
Feb 12 17:58
@JLuboff :( sorry
Kelechi Chinaka
@kelechy
Feb 12 17:58
function validCard(card) {
  card = card.replace(/ /g,"").split``;
  for (let i = card.length-2; i >= 0; i-=2) {
    card[i] = (card[i]*2)>9 ? (card[i]*2)-9 : card[i]*2 ;
  }
  return card.reduce((a,b)=>a + +b, 0) % 10 === 0;
}
@sjames1958gm i did the luhn algo for credit card but banging ma head writing it in C :worried:
Stephen James
@sjames1958gm
Feb 12 17:58
@JLuboff The ability to get the console logs from each app is greate
JLuboff
@JLuboff
Feb 12 17:59
@sjames1958gm Ya just from the little bit I'm working with it, its nice. Only thing I wish it had mentioned is that you need to go into the directory of the app to start it for it to work properly. i.e
pm2 start /opt/app/app.js //This is a no go
Stephen James
@sjames1958gm
Feb 12 17:59
@kelechy not familiar with that algo
Kelechi Chinaka
@kelechy
Feb 12 17:59
everything seems strange in C
Christopher McCormack
@cmccormack
Feb 12 18:00
:wave:
JLuboff
@JLuboff
Feb 12 18:00
@cmccormack Yo
Stephen James
@sjames1958gm
Feb 12 18:01
You should try working on a Alexa app (backed by javascript) talking to a C++ backend that launches apps into an android emulator written in java
All in the same hour :)
Christopher McCormack
@cmccormack
Feb 12 18:01
How goes it
Kelechi Chinaka
@kelechy
Feb 12 18:01
JLuboff
@JLuboff
Feb 12 18:01
@sjames1958gm Ew..
:D
Kelechi Chinaka
@kelechy
Feb 12 18:02
i need to first convert a long long to an int arr @sjames1958gm
JLuboff
@JLuboff
Feb 12 18:02
@cmccormack Good. Got my node app up and running it looks like. Server can reboot and mongo/node start back up automatically
Kelechi Chinaka
@kelechy
Feb 12 18:02
terrible for me :worried: @cmccormack
Christopher McCormack
@cmccormack
Feb 12 18:02
@JLuboff awesome what did you use for node persistence?
@kelechy what's wrong man
JLuboff
@JLuboff
Feb 12 18:03

@cmccormack

For anyone interested.. pm2 is a great package for setting up multiple node apps on a single server and have them auto start on boot

Christopher McCormack
@cmccormack
Feb 12 18:03
@JLuboff yeah that's what I would recommend as well
Stephen James
@sjames1958gm
Feb 12 18:03
@kelechy The input is a long long? representing the CC number?
JLuboff
@JLuboff
Feb 12 18:03
Oh so you knew too. Apparently I'm in the dark ages
Stephen James
@sjames1958gm
Feb 12 18:03
@JLuboff Aren't you new to Linux?
Kelechi Chinaka
@kelechy
Feb 12 18:03
taking cs50. did the algo in js now need to write in C and everything in C seems strange to me
Christopher McCormack
@cmccormack
Feb 12 18:04
@JLuboff well I just learned about it last week, and I had this open in a tab already haha https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04
Kelechi Chinaka
@kelechy
Feb 12 18:04
yes @sjames1958gm
Christopher McCormack
@cmccormack
Feb 12 18:04
@kelechy arrays of characters being strings is weird to you?
JLuboff
@JLuboff
Feb 12 18:05
@sjames1958gm Ehhhhh...not exactly. I've worked with Linux in the past (taken courses, etc). And I was fairly well versed in OS X based Unix up until a few years ago so I can get my way around but installing applications in Linux is not something I'm used to doing
Stephen James
@sjames1958gm
Feb 12 18:05
@kelechy What I would do is use modulo and integer division to split the number by 10s
Christopher McCormack
@cmccormack
Feb 12 18:05
@JLuboff sudo apt-get install xxx not so bad
JLuboff
@JLuboff
Feb 12 18:05
@cmccormack Lol fair enough. Use NVM as suggested by @sjames1958gm for installing node though. It's easy and lets you install multiple versions if you want, keep up to date easier, etc
@cmccormack Nothing installs that easily :P mongo for instances has you run several commands prior
Christopher McCormack
@cmccormack
Feb 12 18:06
@JLuboff I use NVM, I just had that tab open :) wanted to know how to keep node apps running persistent
nvm is cool because you can run node on shared servers as it doesn't require admin rights
Kelechi Chinaka
@kelechy
Feb 12 18:07
i dont undestand @sjames1958gm
show an example @sjames1958gm
JLuboff
@JLuboff
Feb 12 18:09
@cmccormack Ya I haven't done much with nvm besides install node. pm2 though.. thats really cool. Can monitor everything, view logs, etc
Stephen James
@sjames1958gm
Feb 12 18:10

@kelechy

  long long x = 12834792;
  int digits[100];
  int ndx = 0;

  while ( x > 0 ) {
    digits[ndx++] = x % 10;
    x = x / 10;
  }

:tm: Code not warrantied against bugs/typos
See already a bug - the array will be reversed digits.

Christopher McCormack
@cmccormack
Feb 12 18:13
@sjames1958gm feature!
@JLuboff you have your hands in everything man! that's a great place to be
JLuboff
@JLuboff
Feb 12 18:14
@cmccormack Its both a blessing and a curse :joy:
Stephen James
@sjames1958gm
Feb 12 18:14
@JLuboff You'd said it brother.
JLuboff
@JLuboff
Feb 12 18:14
I never get truly great at one thing but can manage my way around most things
Christopher McCormack
@cmccormack
Feb 12 18:15
You just have to dip your toes in, then if you ever need it again you'll at least know where to look
JLuboff
@JLuboff
Feb 12 18:17
True
Christopher McCormack
@cmccormack
Feb 12 18:18
I wonder how much you need in each subject to actually be considered a renaissance man
JLuboff
@JLuboff
Feb 12 18:18
Now to remember the VNC password I set on the work raspberry pi lol
Christopher McCormack
@cmccormack
Feb 12 18:19
@JLuboff need to get used to headless :)
Stephen James
@sjames1958gm
Feb 12 18:19
@JLuboff I had that same problem yesterday
@JLuboff And I had to remember how to set up samba on the pi so I could use vscode on my PC
Christopher McCormack
@cmccormack
Feb 12 18:20
@sjames1958gm just to access your code from your PC or something VS Code specific?
dinesh
@1532j0004kg
Feb 12 18:20
happy night friends :sleeping:
Christopher McCormack
@cmccormack
Feb 12 18:20
@1532j0004kg :wave:
Stephen James
@sjames1958gm
Feb 12 18:20
@cmccormack Editing some python on the pi, nothing more
@1532j0004kg :sparkles:
JLuboff
@JLuboff
Feb 12 18:21
I think I've connected to it once since I set it up over a year ago..so I don't touch it frequently. I was thinking I may want to just plug in a bluetooth dongle and keep a keyboard/mouse paired for ease of use but meh.
Christopher McCormack
@cmccormack
Feb 12 18:21
@JLuboff why not just use SSH?
JLuboff
@JLuboff
Feb 12 18:22
Good question
I doubt I set it up though
Christopher McCormack
@cmccormack
Feb 12 18:22
I believe it's setup by default but I'd have to check, uses the default pi/raspberry creds
Kelechi Chinaka
@kelechy
Feb 12 18:22
i hope i finish cs50 i one piece @sjames1958gm @cmccormack @JLuboff
Stephen James
@sjames1958gm
Feb 12 18:22
@cmccormack I wanted visual editting rather than vi on the box
Kelechi Chinaka
@kelechy
Feb 12 18:22
:smile:
Christopher McCormack
@cmccormack
Feb 12 18:22
although I'd suggest removing that account
@sjames1958gm oh so you code directly on your pi?
JLuboff
@JLuboff
Feb 12 18:23
@cmccormack You act like I remember these credentials! I really should have taken notes when I did all that lol
@kelechy I'm sure you can manage
Christopher McCormack
@cmccormack
Feb 12 18:23
I can never get over how laggy VNC is
JLuboff
@JLuboff
Feb 12 18:23
Eh VNC isn't that bad
Christopher McCormack
@cmccormack
Feb 12 18:23
@JLuboff well you can ask me, I've set up a half dozen pi for different purposes
Muhammad Hasham
@MohammadHasham
Feb 12 18:23
the session id is wrapped inside a cookie, is that notion right?
Stephen James
@sjames1958gm
Feb 12 18:23
@cmccormack I was writing a python script that took in HTTP and proxied it to the serial port over to the arduino
@cmccormack I was using ssh -Y but that was laggy too
Christopher McCormack
@cmccormack
Feb 12 18:25
@sjames1958gm I think your samba method sounds easier :)
JLuboff
@JLuboff
Feb 12 18:25
Ooops.. just connected to one of our PLC monitors haha
Christopher McCormack
@cmccormack
Feb 12 18:31
break everything?
@sjames1958gm what are you using the arduino for?
JLuboff
@JLuboff
Feb 12 18:31
Nahhhh I just quickly disconnected. IF anything they saw the mouse move
And @cmccormack to add another thing I have my hands on.. currently checking in Dish Network items (dish, recievers, etc) as I help install that for our facilities
Stephen James
@sjames1958gm
Feb 12 18:39
@cmccormack This guy I am doing the work for is developing an automated target range system
Christopher McCormack
@cmccormack
Feb 12 18:40
sounds interesting
Stephen James
@sjames1958gm
Feb 12 18:43
@cmccormack Yeah. His programming experience is from way back.
He keeps saying he writes tight code, which from what I saw yesterday means no blank lines or indentation :)
Christopher McCormack
@cmccormack
Feb 12 18:43
@sjames1958gm ahhh that mindset is so unproductive!
"it's unreadable but at least it looks like it's more efficient"
Stephen James
@sjames1958gm
Feb 12 18:44
@cmccormack Somehow he thinks that the spaces take up space after compilation :P
@cmccormack But he pays in cash :dollar:
Christopher McCormack
@cmccormack
Feb 12 18:45
@sjames1958gm better remove the comments too then!!!
Stephen James
@sjames1958gm
Feb 12 18:45
@cmccormack Exactly.
JLuboff
@JLuboff
Feb 12 18:49
@cmccormack Doesn't look like I enabled ssh on the Pi.. I'll do so when I mess with it though
Christopher McCormack
@cmccormack
Feb 12 19:01
you may have had to do it as part of setup, I don't remember
Stephen James
@sjames1958gm
Feb 12 19:03
There is that utility raspi_config IIRC
Christopher McCormack
@cmccormack
Feb 12 19:04
@JLuboff sudo raspi-config > Advanced Options > SSH Enable
or
sudo systemctl enable ssh
sudo systemctl start ssh
JLuboff
@JLuboff
Feb 12 19:21
I probably specifically told it not to then. Not sure. Haven't looked at raspi_config yet
Christopher McCormack
@cmccormack
Feb 12 19:21
it's off by default
JLuboff
@JLuboff
Feb 12 19:23
Therefore I left it to default lol
Christopher McCormack
@cmccormack
Feb 12 19:23
SSH
Enable/disable remote command line access to your Pi using SSH.
SSH allows you to remotely access the command line of the Raspberry Pi from another computer. SSH is disabled by default.
Tiago Correia
@tiagocorreiaalmeida
Feb 12 20:19
has anyone runned into a similiar situation?
the backend logs the data correctly but the client side returns this
all the others routes work without any error
image.png
nm I guess console log the wrong variable wouldnt work :D
Christopher McCormack
@cmccormack
Feb 12 20:37
@tiagocorreiaalmeida :D
Tiago Correia
@tiagocorreiaalmeida
Feb 12 20:47
heyyyy @cmccormack
Christopher McCormack
@cmccormack
Feb 12 20:48
@tiagocorreiaalmeida what's up man
Tiago Correia
@tiagocorreiaalmeida
Feb 12 20:49
nothing special trying to figure out if bulma framework contains something similiar like the boostrap popover
how about you ?:D
Christopher McCormack
@cmccormack
Feb 12 20:54
@tiagocorreiaalmeida Maybe something like this extension? https://wikiki.github.io/elements/tooltip/
Tiago Correia
@tiagocorreiaalmeida
Feb 12 20:55
was testing them but they dont run :\
Christopher McCormack
@cmccormack
Feb 12 20:55
@tiagocorreiaalmeida not much working right now, then hopefully dig into my voting app some more
@tiagocorreiaalmeida that stinks. maybe make your own based on Bootstraps CSS/JS?
and popper I guess
Tiago Correia
@tiagocorreiaalmeida
Feb 12 20:57
@cmccormack gave it a look a few days ago I think still has some dummy data or look's like it ehehe, yeah will do It I guess but the idea of using a framework was to avoid write css guess I wont be avaible to run from it :D
Christopher McCormack
@cmccormack
Feb 12 20:57
sometimes you can just copy the css straight into a styled component (if you're using) and it's not much more work
probably not for this though :)
JLuboff
@JLuboff
Feb 12 21:11
I'm super lazy with CSS... just end up using bootstrap or bulma all the time lol
Tiago Correia
@tiagocorreiaalmeida
Feb 12 21:15
image.png
I guess this will work couldnt be more simple but well, yeah same but went for bulma and now they dont have popovers working
JLuboff
@JLuboff
Feb 12 21:18
Ya I see that. Hmm
Christopher McCormack
@cmccormack
Feb 12 21:21
@tiagocorreiaalmeida what are you using them for?
@tiagocorreiaalmeida and are you using any other frameworks?
Tiago Correia
@tiagocorreiaalmeida
Feb 12 21:22
making an onsearch request to the database and display the data on the popver
nah only bulma
JLuboff
@JLuboff
Feb 12 21:25
@cmccormack Ah man... VNC to my pi is laggy
Christopher McCormack
@cmccormack
Feb 12 21:25
@JLuboff pi ethernet uses the usb 2.0 controller which is slow
it's why I use ssh
JLuboff
@JLuboff
Feb 12 21:25
It's connected via wireless
Christopher McCormack
@cmccormack
Feb 12 21:25
ah
wait
wireless is internal?
JLuboff
@JLuboff
Feb 12 21:26
Ya, I think this is a Rasp 3
Christopher McCormack
@cmccormack
Feb 12 21:26
may still be using the same controller
it's one of the reasons I'm looking for an alternative to my pi for certain things like video streaming
JLuboff
@JLuboff
Feb 12 21:26
huh... apparently I do have ssh enabled
Christopher McCormack
@cmccormack
Feb 12 21:27
:)
you should try out iperf and see what your throughput is on wifi
Tiago Correia
@tiagocorreiaalmeida
Feb 12 21:27
image.png
Christopher McCormack
@cmccormack
Feb 12 21:27
I bet it's super slow
Tiago Correia
@tiagocorreiaalmeida
Feb 12 21:28
Im starting to really like how simple its to handle certain stuff on react
compared to vanilla js
Kaz Baig
@kbaig
Feb 12 21:28
It's tasty
Tiago Correia
@tiagocorreiaalmeida
Feb 12 21:28
@kbaig indeed starting to think about taking react for breakfast
Christopher McCormack
@cmccormack
Feb 12 21:28
@tiagocorreiaalmeida right?? I made a personal website the other day using jquery and vanilla and wish it could have been simple react components
JLuboff
@JLuboff
Feb 12 21:29
@cmccormack I need to install iperf?
Christopher McCormack
@cmccormack
Feb 12 21:29
@JLuboff probably already on there but I"m not sure, it's just a testing tool
Tiago Correia
@tiagocorreiaalmeida
Feb 12 21:29
@cmccormack there's no over thinking things are pretty straight I like it alot indeed could have been fun make the backend projects using react
JLuboff
@JLuboff
Feb 12 21:29
Doesn't recognize it. Oh well. Don't need this thing to be fast anyhow
Christopher McCormack
@cmccormack
Feb 12 21:29
@tiagocorreiaalmeida it takes forever though haha
At least for me :(
Kaz Baig
@kbaig
Feb 12 21:31
@cmccormack And that's why my personal site is gonna be made using Gatsby :)
Christopher McCormack
@cmccormack
Feb 12 21:32
@kbaig yeah I should have done that too. I dug into it thinking it would be really fast but my wife kept adding features
Kaz Baig
@kbaig
Feb 12 21:33
I'm working at my own (slow) pace so I'll get there eventually @cmccormack
Christopher McCormack
@cmccormack
Feb 12 21:36
@kbaig is it a portfolio or a personal project?
Kaz Baig
@kbaig
Feb 12 21:37
@cmccormack portfolio-ish personal site. Not likely to have a major focus on code
Christopher McCormack
@cmccormack
Feb 12 21:39
@kbaig ohhh I may have to play with this one
I've been using MD a lot but not with any templates
Tiago Correia
@tiagocorreiaalmeida
Feb 12 21:40
@cmccormack I normally just build the full api and test with postman and then follow to react part probably all the times I come back and change something :D how you do it?
Christopher McCormack
@cmccormack
Feb 12 21:40
@tiagocorreiaalmeida I don't really have a normal, this is still my first full webapp.
JLuboff
@JLuboff
Feb 12 21:40
@cmccormack So I did have SSH enabled..but I can't remember the password I set on this thing :joy:
Kaz Baig
@kbaig
Feb 12 21:40
@cmccormack I haven't really used any UI frameworks ever since I decided to ditch bootstrap etc in favor of learning CSS myself. Thinking of trying MD purely because I like the design
Christopher McCormack
@cmccormack
Feb 12 21:40
I guess I started with the backend stuff and then figured out how to get React to load without a web server
@kbaig learning css is overrated :p
@JLuboff try username: pi password: raspberry
JLuboff
@JLuboff
Feb 12 21:41
I have already
Kaz Baig
@kbaig
Feb 12 21:43
@cmccormack nah dude it lets you do so much interesting stuff
Christopher McCormack
@cmccormack
Feb 12 21:43
@tiagocorreiaalmeida I did learn something useful last night though - if you serve your index.html file from node/express, you may want to add this to your index.html head: <base href="/">
otherwise something like /path/* may not work because it tries to serve your files from /path/ instead of root
When using relative URIs, that is
@kbaig :) I know just messing. I'm excited to see CSS variables get widespread adoption
@JLuboff format/reinstall?
JLuboff
@JLuboff
Feb 12 21:48
@cmccormack Ewwww... no lol apparently I can always take the SD card out and there's a backdoor for reseting the password
Christopher McCormack
@cmccormack
Feb 12 21:48
you don't have any way to login?
JLuboff
@JLuboff
Feb 12 21:49
No, I'm logged in, it auto logs in on boot (goes into browser Kiosk mode)
Christopher McCormack
@cmccormack
Feb 12 21:49
does pi account still have root? Just make a new user and give it su rights
JLuboff
@JLuboff
Feb 12 21:50
I believe it would (I wouldn't have removed root access)
Christopher McCormack
@cmccormack
Feb 12 21:51
I usually delete or disable that account, you may have too that's why I ask
JLuboff
@JLuboff
Feb 12 21:53
I guess this is what I get for not making any notes well over a year ago :(
Christopher McCormack
@cmccormack
Feb 12 21:54
learn from your mistakes haha
JLuboff
@JLuboff
Feb 12 21:56
Ya I have another one I need to build up probably in the next few weeks..but it's going to be exactly the same as this one but with a different url to display so I'll probably just clone it
Christopher McCormack
@cmccormack
Feb 12 22:03
build from scratch you know you want to :)
JLuboff
@JLuboff
Feb 12 22:04
Pshhh ya right
Ain't nobody got time for that
Tiago Correia
@tiagocorreiaalmeida
Feb 12 22:05
@cmccormack uh didnt knew thanks :D
CamperBot
@camperbot
Feb 12 22:05
tiagocorreiaalmeida sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1317 | @cmccormack |http://www.freecodecamp.org/cmccormack
Christopher McCormack
@cmccormack
Feb 12 22:09
@JLuboff psshht
Markus Kiili
@Masd925
Feb 12 22:09
@JLuboff pissphp.
Christopher McCormack
@cmccormack
Feb 12 22:11
Is there a cleaner way to prevent extra whitespace in className when using variables that may be empty?
const TabBody = ({children, className="", id, size="s12"}) => (
    <div id={id} className={`col ${size} ${className}`.replace(/\s+/, ' ')}>
I know whitespace doesn't matter but feel like it looks ugly in source
Kaz Baig
@kbaig
Feb 12 22:13
Place each attr on a new line
Christopher McCormack
@cmccormack
Feb 12 22:13
I just mean the className attr
sorry
Kaz Baig
@kbaig
Feb 12 22:13
Oh no I misread
Christopher McCormack
@cmccormack
Feb 12 22:14
there, added specificity :)
Kaz Baig
@kbaig
Feb 12 22:15
You could just build it outside the JSX for readability
Christopher McCormack
@cmccormack
Feb 12 22:15
you don't find this readable? :)
Kaz Baig
@kbaig
Feb 12 22:17
you want to make it so that it's not col className (with 2 spaces in between) if size is missing right
Christopher McCormack
@cmccormack
Feb 12 22:17
Hmm maybe something like const classes = ['col', size, className].join(' ')
@kbaig right
Kaz Baig
@kbaig
Feb 12 22:17
Ya I was gonna suggest something like that above the JSX
you could instead use reduce to join and check for presence at the same time
Christopher McCormack
@cmccormack
Feb 12 22:18
That might be the way I go, it's fairly readable and easy to modify
Kaz Baig
@kbaig
Feb 12 22:18
So you don't have to call filter and join
Christopher McCormack
@cmccormack
Feb 12 22:19
oh yeah empty values will still add a space
hmm how would reduce be simpler than filter and join
Kaz Baig
@kbaig
Feb 12 22:22
['col', size, className].reduce((a, b) => b ? a + " " + b : a);
Just less function calls
Christopher McCormack
@cmccormack
Feb 12 22:23
but if a is empty it will start with a space
Kaz Baig
@kbaig
Feb 12 22:24
if size is empty, it should do 'col' + " " + className
if both empty, 'col'
Christopher McCormack
@cmccormack
Feb 12 22:24
but more generally if the 0th value of the array is empty it would start with a space
but yeah you could work around that by making any explicit values be first
Kaz Baig
@kbaig
Feb 12 22:25
in this case, 'col' is an explicit value
Christopher McCormack
@cmccormack
Feb 12 22:25
I wonder why Array filter doesn't just do a truthy test when passed no argument
@kbaig I agree but I don't always have explicit values, depends on the component
Kaz Baig
@kbaig
Feb 12 22:26
Ah no I was only looking to do a very specific solution here haha
not a generalized one
Christopher McCormack
@cmccormack
Feb 12 22:26
haha
Kaz Baig
@kbaig
Feb 12 22:26
for that, filter into join prob the best lol
Christopher McCormack
@cmccormack
Feb 12 22:27
dang it would also get complicated if you needed values like 0 and didn't want them filtered
Kaz Baig
@kbaig
Feb 12 22:27
yeeeep
Christopher McCormack
@cmccormack
Feb 12 22:28
have to check for undefined
welp, looks like I'll just keep the whitespace then haha
See this is why I never finish anything, I spend far too much time with this kind of worthless stuff
@kbaig thanks man :D
CamperBot
@camperbot
Feb 12 22:29
cmccormack sends brownie points to @kbaig :sparkles: :thumbsup: :sparkles:
:cookie: 570 | @kbaig |http://www.freecodecamp.org/kbaig
Kaz Baig
@kbaig
Feb 12 22:29
mhmm
Christopher McCormack
@cmccormack
Feb 12 22:32
bbiab ttyl
JLuboff
@JLuboff
Feb 12 22:32
see ya?