Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Dec 29 2021 12:47
    KimberleyCook closed #446
  • Dec 29 2021 12:46

    KimberleyCook on gh-pages

    update README with correct Bund… Merge pull request #476 from ro… (compare)

  • Dec 29 2021 12:46
    KimberleyCook closed #476
  • Dec 29 2021 12:46

    KimberleyCook on gh-pages

    Update old links Merge pull request #478 from ro… (compare)

  • Dec 29 2021 12:46
    KimberleyCook closed #478
  • Dec 20 2021 22:48
    rowanajmarshall opened #478
  • Dec 20 2021 22:40
    rowanajmarshall closed #477
  • Dec 20 2021 22:40
    rowanajmarshall opened #477
  • Dec 20 2021 21:25
    rowanajmarshall opened #476
  • Dec 12 2021 17:27
    HungOm starred codebar/tutorials
  • Sep 08 2021 08:06
    andyharmon starred codebar/tutorials
  • Jul 12 2021 19:54
    dependabot[bot] labeled #475
  • Jul 12 2021 19:54
    dependabot[bot] opened #475
  • Jul 12 2021 19:54

    dependabot[bot] on bundler

    Bump addressable from 2.5.2 to … (compare)

  • Jun 27 2021 12:57
    Heizal starred codebar/tutorials
  • Jun 23 2021 20:33
    minnieshay starred codebar/tutorials
  • Jun 10 2021 09:52
    gracemarsey starred codebar/tutorials
  • Jun 01 2021 16:18
    NoorinSakhi starred codebar/tutorials
  • May 12 2021 09:55

    KimberleyCook on update-copy-js-tutorial-2

    (compare)

  • May 12 2021 09:55

    KimberleyCook on gh-pages

    copy for Js tutorial 2 kriszta feedback Merge pull request #473 from co… (compare)

Nicky Chorley
@ndchorley
hopefully everyone's aware that there's a Tube strike starting tomorrow: https://tfl.gov.uk/modes/tube/tube-strike, sigh
Kriszta Matyi
@matyikriszta
@ndchorley yes, we have sent out a tweet about it yesterday, will repeat it tomorrow
thanks for the heads up :)
Nicky Chorley
@ndchorley
we're really in Whitechapel tonight?
Kriszta Matyi
@matyikriszta
@ndchorley yes, we are
sorry if that' a bit inconvenient for you
it's a bit further out than our usual locations
Nicky Chorley
@ndchorley
no, it's good. It's relatively easy to get home from there :D. I was a bit confused as I looked at ClauseMatch's website and that's not where their office is!
thanks :D
Carolina Sawney
@assembly21

Hi: I'm practising exercises from Head First Javascript Programming (p.101).

I write the code in the book in the console and it gives me an error: points is not defined. It's not necessary to define a variable points for the parameters, right? Thanks in advance.

var avatar = "generic";
var skill = 1.0;
var pointsPerLevel = 1000;
var userPoints = 2008;

function getAvatar(points){
var level = points / pointsPerLevel;
if (level == 1) {
return "Teddy bear";
} else if (level == 1) {
return "Cat";
} else if (level >= 2) {
return "Gorilla";
}
};
function updatePoints(bonus, newPoints) {
var i = 0;
while(i<points){
newPoints = newPoints + skill * bonus;
i = i + 1;
}
return newPoints + userPoints;
}
userPoints = updatePoints(2,100);
avatar = getAvatar(2112);

Ali
@Najaf
It looks the problem is in your usage later in updatePoints
Where you're doing while (i < points)
points doesn't appear to be defined in the scope of updatePoints I mean.
Carolina Sawney
@assembly21
the book has 6 tech reviewers...
Ali
@Najaf
:P Who wants to spend their whole day reading code? Sounds way too much like work.
Carolina Sawney
@assembly21

Hi everyone,
I'm practising Javascript with exercises from two books. They explain not to use global variables but then in the examples, they use them very often. So I'd like to rewrite this example from Javascript Head First, so that it's all done with locals. But my version is not completely right...So I'd appreciate your comments. Thanks in advance.

The code from the book:

var avatar = "generic";
var skill = 1.0;
var pointsPerLevel = 1000;
var userPoints = 2008;

function getAvatar(points){
var level = points / pointsPerLevel;
if (level == 1) {
return "Teddy bear";
} else if (level == 1) {
return "Cat";
} else if (level >= 2) {
return "Gorilla";
}
};
function updatePoints(bonus, newPoints) {
var i = 0;
while(i<bonus){
newPoints = newPoints + skill * bonus;
i = i + 1;
}
return newPoints + userPoints;
}
userPoints = updatePoints(2,100);
avatar = getAvatar(2112);

My version with locals - but gives me undefined...

function getAvatar(points){
var pointsPerLevel = 1000;
var level = points / pointsPerLevel;
if (level == 1) {
return "Teddy bear";
} else if (level == 1) {
return "Cat";
} else if (level >= 2) {
return "Gorilla";
}
};
function updatePoints(bonus, newPoints) {
var i = 0;
var skill = 1.0;
var userPoints = 2008;
while(i<bonus){
newPoints = newPoints + skill * bonus;
i = i + 1;
}
return newPoints + userPoints;
}

function init(){
userPoints = updatePoints(2,100);
var avatar = getAvatar(2112);}

Denise Yu
@deniseyu
@assembly21 could you please wrap code snippets in code tags? click the list icon at the bottom right of the textbox. it will make your code much easier to read :)
an aside, does anyone want to help QA test some new codebar app features? send me a private message
@assembly21 i think the book code is wrong. there are two conditions where level == 1. you should always use === not ==
Juyoung
@juyoungbang
@assembly21 I am just wondering why there is the same condition as 'level == 1' twice....
Juyoung
@juyoungbang

in the book,
there is the default value of 'avatar' so it seems to work well even though it is weird there is the same condition twice,
but in your version,
the return value of getAvatar() hasn’t the default one.
So if level is not equal to 1,2 or greater than 2, getAvatar() will return undefined…

you could code like following...
getAvatar(){
if(){..}
else if() {..}
return ‘generic’;
}

That is just my guess, so it might be wrong...

Kai Chan Vong
@kaichanvong
@deniseyu or another organisers for codebar. Do I need to make sure I'm on the list (of coaches). It's for my speaking slot. Wondering if I can just turn up?
Denise Yu
@deniseyu
@kaichanvong your lightning talk is next week (Thoughtworks)! tomorrow is Kate's turn. on the night that you are scheduled, if you don't manage to RSVP in time for a coach slot just email us. lightning talk speakers get priority, whether you're a coach or student...another incentive to sign up for one! :)
Kai Chan Vong
@kaichanvong
Didn't get in for this evening's event. Booo.
Denise Yu
@deniseyu
does anyone have experience migrating image assets from a heroku platform service (in this case, Cloudinary) over to AWS?
Baris Balic
@barisbalic
@deniseyu I'm not aware of any migration tools, I believe it's a case of DIY
Denise Yu
@deniseyu
@barisbalic i had suspected as much... :-/ Cloudinary wants us to pay $50 a month for optimized image hosting, but last night a few coaches suggested just getting an AWS bucket would be much cheaper. if anyone has some time to help out w this, please let me know. i've not had to do this before and don't want to accidentally delete all of our assets lol
Baris Balic
@barisbalic
You can have both in place, and not delete cloudinary resources until you're happy/sure it's all in place
Carolina Sawney
@assembly21

Hi: I'd like to know how to create a .gitignore file from the command line to exclude .idea related files. I don't know what do I need to exclude.
Or if this is just a txt.file.

I have this:

'code'
Carolinas-MBP:first_git_project carolina$ git add .
Carolinas-MBP:first_git_project carolina$ git commit -m "Initial commit"
[master (root-commit) 19c3842] Initial commit
9 files changed, 394 insertions(+)
create mode 100644 .idea/.name
create mode 100644 .idea/compiler.xml
create mode 100644 .idea/copyright/profiles_settings.xml
create mode 100644 .idea/first_git_project.iml
create mode 100644 .idea/misc.xml
create mode 100644 .idea/modules.xml
create mode 100644 .idea/vcs.xml
create mode 100644 .idea/workspace.xml
create mode 100644 first_file.html
Carolinas-MBP:first_git_project carolina$ .idea/
-bash: .idea/: is a directory
Carolinas-MBP:first_git_project carolina$
'code'

I know that inside the .gitignore file I can add this:

.idea/workspace.xml
.idea/modules.xml

Thanks!

Denise Yu
@deniseyu
in .gitignore in the root of the project directory (create one if you haven't yet), just put .idea/in it
Carolina Sawney
@assembly21
but idea has .idea/first_git_project.html that's the one I'm tracking...and how to I create the file, what kind of file is it. What should I write on the command line I mean.
Denise Yu
@deniseyu
then exclude by extension, like .idea/*.xml, etc
Baris Balic
@barisbalic
@assembly21 @deniseyu from the command line you can use echo in conjunction with >> to append to a file
@assembly21 @deniseyu for example echo .idea >> .gitignore will add ".idea" to the ignore
If you use special characters you may need to put " around the string
echo ".idea" >> .gitignore
Carolina Sawney
@assembly21
that's the line of magic I needed, cheers.
Baris Balic
@barisbalic
@assembly21 no problem!
@assembly21 be cautious of dropping > because that will overwrite the file rather than append to it
Carolina Sawney
@assembly21

Shall I ignore the .gitignore "untracked files" and the "changes not staged for commit"? Here's the console.

"code"
Carolinas-MBP:first_git_project carolina$ git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)

modified:   .idea/misc.xml
modified:   .idea/workspace.xml

Untracked files:
(use "git add <file>..." to include in what will be committed)

.gitignore

no changes added to commit (use "git add" and/or "git commit -a")
Carolinas-MBP:first_git_project carolina$

"code"

Thanks.

Baris Balic
@barisbalic
Sorry I cannot understand what that means
You wanted to ignore idea?
you would need .idea/ in your .gitignore
Carolina Sawney
@assembly21

yes, but now if I do git status I get changes not staged for commit and lists the .idea files that I modified. And also says that I have an untracked file, .gitingore.
In the .gitingore I have all this:

.idea/.name
.idea/compiler.xml
.idea/copyright/profiles_settings.xml
.idea/first_git_project.iml
.idea/misc.xml
.idea/modules.xml
.idea/vcs.xml
.idea/workspace.xml

Baris Balic
@barisbalic
Okay, so the problem is that these files had already been added to git
You need to tell git to forget about them, and then they won't creep up like this
You will also need to add the .gitignore, that cheeky beggar lives in git alongside your project
Carolina Sawney
@assembly21
Shall I start again?
Baris Balic
@barisbalic
Have you pushed this code to github yet?
Or is it all just local?