These are chat archives for FreeCodeCamp/Help

17th
Jan 2015
Ammar Ali Shah
@AmmarAliShah
Jan 17 2015 07:00

Okay this is a very basic question but i haven't started with Git/GitHub yet:

Let's say i have a folder name "site" on my home(I'm on Ubuntu). I want to upload it to a repository on GitHub named "example.github.io". How do i do that?

Quincy Larson
@QuincyLarson
Jan 17 2015 07:05
@AmmarAliShah Did you read the FAQ on github pages? https://pages.github.com/
It will technically be AmmarAliShah.github.io
Ammar Ali Shah
@AmmarAliShah
Jan 17 2015 07:10
Yeah i just gave in a little example
Quincy Larson
@QuincyLarson
Jan 17 2015 07:13
Did you have any luck with it?
Ammar Ali Shah
@AmmarAliShah
Jan 17 2015 07:18
yeah just pushed it
The files appeared on the repository but the link doesn't work yet
How long will it take?
Branden Byers
@brandenbyers
Jan 17 2015 07:24
What's the link to the repository? Is it in a gh-pages branch? Or if it is for AmarAliShah.github.io, did you name the repository that and commit the site to master?
Quincy Larson
@QuincyLarson
Jan 17 2015 07:27
@AmmarAliShah @brndnb is righy - you need to create a gh-pages branch
Ammar Ali Shah
@AmmarAliShah
Jan 17 2015 07:28
@QuincyLarson meaning?
Quincy Larson
@QuincyLarson
Jan 17 2015 07:28
@AmmarAliShah I’m going to sleep. Thanks for all your help in the chat room!
@AmmarAliShah I can help you. Do you have Screen Hero?
Ammar Ali Shah
@AmmarAliShah
Jan 17 2015 07:28
No teamviewer
Branden Byers
@brandenbyers
Jan 17 2015 07:28
It looks like your repository is named incorrectly.
You can't choose it, it has to math your GitHub account name.
*match
You can easily change the name of the repo, then add a gh-pages branch. Then it should show up at AmmarAliShah.github.io
Branden Byers
@brandenbyers
Jan 17 2015 07:30
If you change its repository to amaralishah.github.io, it should work.
Ammar Ali Shah
@AmmarAliShah
Jan 17 2015 07:31
okay let me check
Branden Byers
@brandenbyers
Jan 17 2015 07:31
Gh-pages is only for project pages unless I'm mistaken.
It should be on master for the "root" personal user site.
Ammar Ali Shah
@AmmarAliShah
Jan 17 2015 07:32
oh yes it works now
thanks @brndnb and @QuincyLarson
Branden Byers
@brandenbyers
Jan 17 2015 07:32
All project and organization sites use gh-pages branch.
Great! Now if you create any project specific sites you will have access to them from AmarAliShah.github.io/repositoryname
(Or a custom domain)
Ammar Ali Shah
@AmmarAliShah
Jan 17 2015 07:37
@brndnb one more thing
Branden Byers
@brandenbyers
Jan 17 2015 07:49
What's that?
@AmmarAliShah if you still have your question, hit me up in my tomorrow. I must sleep now.
Ammar Ali Shah
@AmmarAliShah
Jan 17 2015 08:06
@brndnb okay bye! Good Night
Serhii Borovskyi
@serhiicss
Jan 17 2015 13:53
Hello! I need F1 please!
Ammar Ali Shah
@AmmarAliShah
Jan 17 2015 15:05
@serhiicss with what?
Evan Davis
@davisec52
Jan 17 2015 20:37

'Afternoon, everybody.

I'm working on a coderbyte problem and am trying to build a simple function that will test a string against a regex pattern. I am trying to add statements excluding classes of characters. The code below evaluates to true, but When I add [^\d] to exclude digits, it evaluates to false.

function pat(str) {
    var pattern = /\=?\+[a-zA-Z]\+\=?/g;
        if(pattern.test(str)) {
        return true;
    }
    else
    {
        return false;
    }
}
pat("+a+=");

When I insert [^\d] anywhere in the regex below, it evaluates as false:

function pat(str) {
    var pattern = /[^\d]\=?\+[a-zA-Z]\+\=?/g;
        if(patter.test(str)) {
        return true;
    }
    else
    {
        return false;
    }
}
pat("=+a+=");

I thought you excluded classes by using the [^\d] notation. What am i doing wrong?

There is a typo in the second code block. "patter" should be "pattern". The typo isn't the problem.
Ben Clist
@BenClist
Jan 17 2015 21:02
@davisec52 Sorry only just seen this, try \D instead
Evan Davis
@davisec52
Jan 17 2015 21:05
@BenClist I'll give it a shot. Thanks!
Ben Clist
@BenClist
Jan 17 2015 21:06
also check out www.regexr.com it's an amazing tool when working with Regex
just paste in what you're wanting to match and then use the bar at the top to play with the Regex until you get what you want, has all the references and a cheat sheet as well
Evan Davis
@davisec52
Jan 17 2015 21:10
@BenClist \D did not have any effect. I've tried building the pattern on regexr but am not really getting anywhere. All references I've checked say the bracket carat notation is standard. Whatever works. Coderbyte does not seem to like it. Also using repl.it, and that also evaluates to false.
Maxim Orlov
@Maximization
Jan 17 2015 21:18
@davisec52 [^\d] strictly means: match anything that's not a digit
so according to your pattern, +a+= is indeed false and =+a+= should be true
James McShane
@jmcshane
Jan 17 2015 21:21
Ok, Ive got another regex question, this isn't matching anything but I think it should match function a(b) and function x(y)
var code = "function a(b){\n\treturn 2;}\nfunction x(y){\n\treturn 3;}";
var re = /function (\w+)\(([\w,]*)\)/g
var m;
while ((m = re.exec(code)) != null) {
    x += m+"<br>";      
}   
$('body').html( x );
I had this in a fiddle and it just doesn't hit
nm, x wasn't defined, carry on
Evan Davis
@davisec52
Jan 17 2015 21:25
@Maximization Ah, thank you. I knew I had something wrong.
Evan Davis
@davisec52
Jan 17 2015 21:38
Let me restate the problem. I think I confused things. As is, the code below evaluates to true even though there is a [^\d] statement. I thought the [^\d} notation would force false if the string included digits.

function pat(str) {
    var pattern = /[^\d]\=?\+[a-zA-Z]\+\=?/g;
        if(pattern.test(str)) {
        return true;
    }
    else
    {
        return false;
    }
}
pat("44=+a+=");
Maxim Orlov
@Maximization
Jan 17 2015 21:49
you're right and wrong, [^\d] only skips digits in your case
therefore 44=+a+= returns true because your pattern matches a part of the string, namely =+a+=
whenever your pattern matches the given input it's going to return true, regardless if it's only just part of the input
to force a false statement you'll have to explicitly tell regex to check the pattern starting from the beginning of the string with ^ in front
Evan Davis
@davisec52
Jan 17 2015 22:00
@Maximization Thank you.
Maxim Orlov
@Maximization
Jan 17 2015 22:00
anytime
Evan Davis
@davisec52
Jan 17 2015 22:02
Do you mean this: var pattern = /^[\d]\=?+[a-zA-Z]+\=?/g;
Maxim Orlov
@Maximization
Jan 17 2015 22:04
no
keep the ^ inside the brackets
now you're telling regex to start matching from the beginning and that the first char has to be a digit
Evan Davis
@davisec52
Jan 17 2015 22:06
Ok, the the result is false with or without [^\d] at the beginning. What I want to do is exclude all digits regardless of position in the pattern. What I'm shooting for is to exclude all non alphanumerics except + and =.
I'm probably going about this the wrong way.
I ithought /g meant globabl application of the statements
Maxim Orlov
@Maximization
Jan 17 2015 22:11
can you give me a few input examples which would return true and false so I can better understand what you want
Evan Davis
@davisec52
Jan 17 2015 22:14
Well, with the code below, I want statements with digits to return false. The statement below returns true.

function pat(str) {
    var pattern = /[^\d]\=?\+[a-zA-Z]\+\=?/g;
        if(pattern.test(str)) {
        return true;
    }
    else
    {
        return false;
    }
}
pat("44=+a+=");
Maxim Orlov
@Maximization
Jan 17 2015 22:17
read my above explanation again, you should add a ^ at the beginning
Evan Davis
@davisec52
Jan 17 2015 22:23
Right. Working.
sorry, I though when I checked a moment ago I was getting true, regardless.