These are chat archives for FreeCodeCamp/Help

29th
Mar 2015
Aiden Montgomery
@AidenMontgomery
Mar 29 2015 00:00
@cshutchinson and I just had a pretty decent screen hero session. Short, but without any issues.
Priscilla P. Wood
@RailsGirl
Mar 29 2015 00:02
So it’s me I guess...
Cristián Berríos
@crisberrios
Mar 29 2015 00:04
@Vince33 what are you trying to achieve? There are some services that serve images optimized depending on how you request them.
This message was deleted
Vince
@Vince33
Mar 29 2015 00:08
@crisberrios I don't need to optimize them just need to grab resize and mv to a specific project directory and may need to do alot
and conver t to png
if not already a png
Bianca Mihai
@biancamihai
Mar 29 2015 00:09
@Vince33 you can gatb ings using wget in node and resize/convert them using imagemagick and/or gm but what do you want to do?
Cristián Berríos
@crisberrios
Mar 29 2015 00:09
grab from an url?
Vince
@Vince33
Mar 29 2015 00:09
straight off a site
Cristián Berríos
@crisberrios
Mar 29 2015 00:09
sounds like gulp can do that
maybe a simple routine to grab the image from the url
check if you don't get 304
download the image
and then gulp will be watching the folder
grabs the file
resizes it
and puts it in the target folder
if it's going to be a manual process then just a shell script will do
Bianca Mihai
@biancamihai
Mar 29 2015 00:10
*imgs, sorry I 'm on my phone...
Cristián Berríos
@crisberrios
Mar 29 2015 00:11
chain wget + imagemagick + mv
Vince
@Vince33
Mar 29 2015 00:11
the target project directory is built on grunt
Cristián Berríos
@crisberrios
Mar 29 2015 00:11
or not even mv
well it should be the same for grunt
Vince
@Vince33
Mar 29 2015 00:13
even from an external url
Aiden Montgomery
@AidenMontgomery
Mar 29 2015 00:13
Is anyone in here really good with MongoDB?
Cristián Berríos
@crisberrios
Mar 29 2015 00:14
just basic mongo stuff here :(
Vince
@Vince33
Mar 29 2015 00:14
same here
I need to grab header images from sites built on cms and resize and mv
Vince
@Vince33
Mar 29 2015 00:20
Thanks guys I am going to explore your suggestions !!
Suzanne Atkinson
@AdventureBear
Mar 29 2015 03:26
I have a mongo questions, I'm workign thorugh week 2
i have an actual database I'm working with and I need to remove a couple empty documents. This is the first document:
{ "_id" : ObjectId("550233b2e0205f61a1000001"), "__v" : 0 }
I tried this to remove it:
db.products.remove({"_id": "550233b2e0205f61a1000001"})
as well as this
db.products.remove({"_id": "ObjectId("550233b2e0205f61a1000001"")})
neither one worked.
suggestions?
seems like such a simple thing!
Cristián Berríos
@crisberrios
Mar 29 2015 03:30
"ObjectId("550233b2e0205f61a1000001"" => ObjectId("550233b2e0205f61a1000001"
Suzanne Atkinson
@AdventureBear
Mar 29 2015 03:31
Love you Cris!
:clap:
Cristián Berríos
@crisberrios
Mar 29 2015 03:33
:shipit:
Darryl Dixon - Piece Digital
@piecedigital
Mar 29 2015 03:36
Dem typos
Suzanne Atkinson
@AdventureBear
Mar 29 2015 03:37
lol
Evan Davis
@davisec52
Mar 29 2015 20:53

The wikipedia page on Euclid's algorithm
shows how to write a simple function to
determine the gcd of two numbers.

I'd appreciate some pointers on how to
make the function below work to determine the
gcd of an array of numbers.


function gcd(num1, num2) {  
  while(num2) {  
    var t = num2;  
    num2 = num1 % num2;  
    num1 = t;  
  }  
  return num1;
}  
gcd(12, 42);
Bianca Mihai
@biancamihai
Mar 29 2015 21:19
@davisec52 well if you know the way to find out the gcd of 2 numbers then to find the gcd of n numbers you can use gcd(a, gcd(b,gcd(c,d)))
Evan Davis
@davisec52
Mar 29 2015 21:28
@biancamihai Hi. Thank you. Any chance you could give me a hint on how to write the loop to make that happen?
Carlos Toro Vera
@carmelo12341
Mar 29 2015 21:31
@davisec52 are you doing the bonfires?
Evan Davis
@davisec52
Mar 29 2015 21:33
@carmelo12341 Yes. I'm on the smallest common multiples challenge. I can get it for two numbers but can't get the iteration for an array of numbers. If I can get the gcd of an array then I should be able to use that to determine the lcm.
Carlos Toro Vera
@carmelo12341
Mar 29 2015 21:35
well I used the rosetta code's algorithm
it accepts arrays
:)
Bianca Mihai
@biancamihai
Mar 29 2015 21:35
@davisec52 let's assume you already put an array with all the numbers [12,13,14,....,40,41,42]
function smallestCommons(arr) {
  // complete your array here
  // .... => [12,42 => [12,13,14,....,40,41,42]
  if(arr.length == 2){ // if it is a simple case, only 2 no
    return gcd(arr[0], arr[1]);
  } else {
      var arr0 = arr[0]; // get the first element
      arr.shift(); // remove the first element
      return gcd(arr0, smallestCommons(arr));
  }
}
Evan Davis
@davisec52
Mar 29 2015 21:35
@carmelo12341 Thank you--I'll check it out.
Bianca Mihai
@biancamihai
Mar 29 2015 21:37
something like this ...
Evan Davis
@davisec52
Mar 29 2015 21:39
@biancamihai Thank you, again! I completely missed that I could call the function as an argument.
Bianca Mihai
@biancamihai
Mar 29 2015 21:40
@davisec52 test it first and then thank me :P it should work
Evan Davis
@davisec52
Mar 29 2015 21:41
@biancamihai Hey, I don't mind thanking in advance!
storbeck
@storbeck
Mar 29 2015 22:26
@QuincyLarson Thanks for the merge!