$(document).ready(function(){
var long;
var lat;
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
lat = position.coords.latitude;
long = position.coords.longitude;
$("#data").html("latitude: " + lat + "<br>longitude: " + long );
});
}
var api = "https://fcc-weather-api.glitch.me/api/current?lat="+lat+"&lon="+long+";
$.getJSON(api, function(data){
var weatherType = data.weather[0].description;
var kelvin = data.main.temp;
var windSpeed = data.wind.speed;
var city = data.name;
console.log(city);
console.log(api);
});
});
"https://fcc-weather-api.glitch.me/api/current?lat=" + lat + "&lon=" + long;
chrisandsuch sends brownie points to @dr-d-m and @sorinr :sparkles: :thumbsup: :sparkles:
:cookie: 257 | @dr-d-m |http://www.freecodecamp.com/dr-d-m
:star2: 1352 | @sorinr |http://www.freecodecamp.com/sorinr
"&lon="+long+";
. it had to be "&lon="+long;
and i just moved the weather part into a function
dr-d-m sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:star2: 1353 | @sorinr |http://www.freecodecamp.com/sorinr
dr-d-m sends brownie points to @chrisandsuch :sparkles: :thumbsup: :sparkles:
:cookie: 269 | @chrisandsuch |http://www.freecodecamp.com/chrisandsuch
seahchye sends brownie points to @isaiahct :sparkles: :thumbsup: :sparkles:
<script>
$(document).ready(function)({});
</script>
<script src=“yourJsFile.js”></script>
seahchye sends brownie points to @dr-d-m and @isaiahct and @leanjunio :sparkles: :thumbsup: :sparkles:
:cookie: 300 | @leanjunio |http://www.freecodecamp.com/leanjunio
:cookie: 258 | @dr-d-m |http://www.freecodecamp.com/dr-d-m
$(document).ready(function() {
var long;
var lat;
var fTemp;
var cTemp;
var kTemp;
var tempChange = true;
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
lat = position.coords.latitude;
long = position.coords.longitude;
$("#data").html("latitude: " + lat + "<br>longitude: " + long);
getWeather(lat, long);
});
}
function getWeather(lat, long) {
var api =
"https://fcc-weather-api.glitch.me/api/current?lat=" +
lat +
"&lon=" +
long;
$.getJSON(api, function(data) {
var weatherType = data.weather[0].description;
kTemp = data.main.temp;
var windSpeed = data.wind.speed;
var city = data.name;
// temperature status convertion
fTemp = (kTemp*(5/9)-459.67).toFixed(1);
// celsius
cTemp = (kTemp - 273).toFixed(1);
console.log(city);
$("#city").html(city);
$("#weatherType").html(weatherType);
$("#fTemp").html(fTemp);
$("#fTemp").click(function(){
if(tempChange === false){
$("#fTemp").html(cTemp);
tempChange = true;
}
else{
$("#fTemp").html(fTemp);
tempChange = false;
}
});
$("#windSpeed").html(windSpeed);
//console.log(api);
});
}
});
dr-d-m sends brownie points to @danjp2016 :sparkles: :thumbsup: :sparkles:
:cookie: 294 | @danjp2016 |http://www.freecodecamp.com/danjp2016
primuscovenant sends brownie points to @rajarahull :sparkles: :thumbsup: :sparkles:
:cookie: 4 | @rajarahull |http://www.freecodecamp.com/rajarahull
git checkout previousCommit-id
git checkout latestCommit-id
then it shows error with the statement Please commit your changes or stash them before you switch branches.
git status
to see which files hasn't been commited
git clone
, you will be in that directory automatically?
git clean -f
?
neeldvirus sends brownie points to @korzo :sparkles: :thumbsup: :sparkles:
:cookie: 763 | @korzo |http://www.freecodecamp.com/korzo
if(targetId === 'selectAll') {
allStreamers.css('display', 'block');
console.log('selectAll has been clicked');
} else if(targetId == 'selectOnline') {
offlineStreamers.addClass('hidden');
console.log('selectOnline has been clicked');
} else if(targetId == 'selectOffline') {
onlineStreamers.addClass('hidden');
console.log('selectOffline has been clicked');
}```
walaamedhat sends brownie points to @longnt80 :sparkles: :thumbsup: :sparkles:
:cookie: 668 | @longnt80 |http://www.freecodecamp.com/longnt80
"2017-11-10 11:48:36.371"
Can any one explain me about reducers in redux? How use it and what should i do there, i can do logic in container.
reducer
is a pure function that takes in state and action and return a new state
reducer
2017-11-10 11:48:36.371".split(/[ \-:\.]/g);
retrieveUserProfile
. that thunk action will create a GET
request asynchronously. when the request returns a response, the response is then passed to the reducer. the reducer takes the userprofile data, and adds it to store (by creating a new store).
deepak2322 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8687 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
// I tried adding ...
if (combination[j] == combination[j-1]){
setTimeout...
}
//... into the `var delay`
setTimeout/setInterval run everything at (almost) same time
it doesnt wait for previous to finish
setTimeout(()=>console.log('hello'),2000)
setTimeout(()=>console.log('bye'),2000)
will log hello bye almost at same time....
NOT hello.. wait 2 seconds n bye
if u want :point_up: behavior u will need to adjust the interval
setTimeout(()=>console.log('hello'),2000)
setTimeout(()=>console.log('bye'),4000)
var delay = setInterval(function() {
if (j < combination.length) {
if (combination[j] === combination[j - 1]) {
setTimeout(function(){
console.log('hi');
activate(combination[j]);
}, 5);
return j; //this return causes an unintended loop but gets the effect I want...
} else {
activate(combination[j]); //has timeout function
}
} else {
clearInterval(delay);
}
j++;
}, 500);
return
it doesn't cause a delay...
return
in there hi
logs to the console, but it doesn't seem to run activate()
<div class="iso-box-wrapper col2-iso-box">
diegoignacious sends brownie points to @tiagocorreiaalmeida :sparkles: :thumbsup: :sparkles:
:cookie: 440 | @tiagocorreiaalmeida |http://www.freecodecamp.com/tiagocorreiaalmeida
setTimeout
runs the code within it after x
milliseconds... correct?
var combination = [1, 1]
if (combination[j] === combination[j - 1]) {
setTimeout(function(){
console.log('hi');
activate(combination[j]);
}, 500);
}else {
activate(combination[j]);
}
this should delay activate
should it not?
if
- but yes. 500
milliseconds - so half a second
if
doesn't hold
activate
I want delayed... the if
seems to hold as hi
shows up in the console
activate
should run right after the hi
activate
and don't get a second running when combination[j] == combination[j-1]
1000
instead of 500
activate
doesn't run, there is a half second delay before logging hi
activate
?
hi
only logs 1 time
activate
runs, but button
is undefined
switch
doesn't enter a case
j
is actually out of bounds and i see why. j
incremented before the setTimeout
callback runs and doesn't have the same value anymore as when the if
was run. Make a local copy of the variable j
with let
let jCopy = j;
setTimeout(...); // Use jCopy in here instead of j
rscales02 sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:star2: 1454 | @alpox |http://www.freecodecamp.com/alpox
Can anyone help me with my code in mutations?
function mutation(arr) {
var zero = arr[0].toLowerCase();
var one = arr[1].toLowerCase();
var zeroarr = zero.split("");
var onearr = one.split("");
zeroarr.sort();
onearr.sort();
function alpha(arr) {
for(x = 0; x !== arr.size; x++) {
if(arr[x] == arr[x + 1]) {
arr.splice(x, 1);
}
}
}
alpha(zeroarr);
alpha(onearr);
var zerostring = zeroarr.toString();
var onestring = onearr.toString();
return zerostring.indexOf(onestring) !== -1;
}
mutation(["Mary", "Aarmy"]);
I'm trying to see if the letters present in arr[0]
are present in arr[1]
. I've been stuck on trying to remove duplicate letters. My attempt at doing so is in alpha();
^(((http:\/\/)|(www)|(https:\/\/))?(www)?).(\w+)
(http|www|...)
just as example
escape
a .
--> \.
\.
:)
^(http:\/\/|https:\/\/)?w{3}?\.(.*)\.
Hi,
Any ideas why when the user inputs "Yes" or "No into my program the following method doesn't load. I think the problem is with these lines within my program. I'm using JAVA.
System.out.println("Please enter the one of the following exactly how you see on your display 'Yes' or 'No'");
outcome1=userinput.next();
if(outcome1== "Yes"){
FunctionalSkills();
}
if(outcome1== "No"){
System.out.println("Thanks for using the Liam's UCAS grade calculator.");
System.exit(0);
}
\.
after w{3}?\.
<-- has be optional
http://google.com
there is no .
before google
w{3}?
doesn't work. Only one multiplier is allowed
w{0,3}
to allow w
to be there 0-3
times
w
can also be there 0
times
(w{3})?
/.../.exec(url)[3]
url.match(/.../)[3]
.match
works different it seems... use .exec
then :D
.exec
you can get out specific capturing groups
I tried if(outcome1.equalsIgnoreCase("Yes")){
.
However, the program runs but doesn't being the user to that method when they input "Yes" or "No". How can I fix this?
System.out.println("Please enter the one of the following exactly how you see on your display 'Yes' or 'No'");
outcome1=userinput.next();
if(outcome1.equalsIgnoreCase("Yes")){
FunctionalSkills();
}
if(outcome1.equalsIgnoreCase("No")){
System.out.println("Thanks for using the Liam's UCAS grade calculator.");
System.exit(0);
}
tiagocorreiaalmeida sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:star2: 1455 | @alpox |http://www.freecodecamp.com/alpox
znadams sends brownie points to @kevinkiklee :sparkles: :thumbsup: :sparkles:
:cookie: 331 | @kevinkiklee |http://www.freecodecamp.com/kevinkiklee
<div>
and apply a background-image
to it or you can apply the image to the body.
background-image
in css to the element
import { module_name } from 'package-name';
? I'm just getting to that part in a React course that I'm going through. Still not quite sure when you need the curly brackets, I think it's when there are multiple exported functions?