Jump to content

SamC

Members
  • Posts

    733
  • Joined

  • Last visited

  • Days Won

    9

SamC last won the day on August 31 2019

SamC had the most liked content!

3 Followers

Profile Information

  • Location
    Surrey, UK

Recent Profile Visitors

7,006 profile views

SamC's Achievements

Hero Member

Hero Member (6/6)

739

Reputation

  1. My wifi has been fine since stopping the bluetooth use. I can't bring myself to call this a solution though. Kinda like saying my car works, as long as I don't use 4th gear. I complain, but I love my macbook ?
  2. Guess you could be clever with modulus and some dynamic class names etc. Or, just go for two loops and call it a day. I did something before and tried to be uber clever about it, turns out it's not so clever when you go back and have to waste time working out how it works.
  3. Now I haven't done any development for a number of months now, just kinda lost the mojo. Maybe it'll return, maybe not, but I still like to check out the forum once in awhile. I used repeater matrix a lot on one site. I think it's not only useful, but essential. If you have a page that has a lot of content in the form of title > paragraph > image > paragraph > quote > image > paragraph etc... good luck with doing that in either a huge single text field or multiple fields all cobbled together in a specific order that's awkward to change. I can't say I used the other included goodies as much, but repeater is worth its weight in gold, plus buying it supports an amazing project.
  4. Did for me. Bluetooth is really dodgy on 10.14.5. Sometimes works with my headphones, sometimes hangs the whole laptop with that stupid spinning beach ball. It's really not acceptable on such a supposedly 'high end' product. But hey, I love this laptop so meh.
  5. For now, I added a $post_date (datetime) field on journal-entry and created pages normally with a title. It actually works ok, I sort the index page children by $post_date and happy enough for the moment. Thanks everyone.
  6. Ah yeah, I see your point. These dates are actually backdated. Hmmmm, I'll look at the other replies on here tomorrow and see if I can come up with something. @bernhard like: Journal (journal-index) - 2019/04/02 - Day 1 (journal-entry) - 2019/04/05 - Day 4 (journal-entry) - 2019/04/09 - Day 8 (journal-entry) - 2019/05/09 - Day 9 (journal-entry) - 2019/06/09 - Day 10 (journal-entry) - 2019/07/09 - Day 11 (journal-entry) etc...
  7. Hi everyone, I'm creating a journal style site. I have the templates journal-index and journal-entry (child), I wanted to see if there was a way that when I create a new blog entry, the title field will automatically be populated with [DATE] - [DAY n], for example: 9th April 2019 - Day 1 10th April 2019 - Day 2 11th April 2019 - Day 3 This is a local 'countdown from' site and I may publish it, haven't decided yet. Now, let's say this is possible. What would then be the way to change the format at a later date, say I wanted to change to '09/04/19 - Day 1 since...'. Would this be awkward? Is there a way to batch change all the titles like this after a bunch of pages have been created? Thanks. *NOTE* I'm open to other suggestion because this may suck a fair bit for SEO should this go live. Thing is, I don't have an actual title in mind for each page, there could be a lot of these. I was thinking in this case, a date actually makes more sense. Although, another problem could be the URL, it would be awesome to get something like 'site.com/09/04/2019/day-1'
  8. This option perhaps? https://www.browsersync.io/docs/options#option-https
  9. Nice one :) go get the full course, it's so worth it!
  10. Had no idea about this: https://developer.mozilla.org/en-US/docs/Web/API/Performance/now Add web APIs to the bucket list...
  11. @Autofahrn that last post was awesome!
  12. Wow, there's some really great replies here, thanks everyone ? For clarity, the context is 'this' (quite literally): http://javascriptissexy.com/understand-javascripts-this-with-clarity-and-master-it/ That line came from this section on the page: 3. Fix this when method is assigned to a variable So what I've read previously in this thread and about bitwise OR, is this what happens? // Let's forget about the + 1 -1 stuff for now // Math random returns a float between 0-1 (not inclusive of 1) var randomNum = ((Math.random() * 2 | 0); // Once this float is multiplied by two (keeping the decimal places shorter) var randomNum = (1.6 | 0); // After forced type coercion to int and trucation (because of bitwise OR) var randomNum = (1 | 0); // Binary values are compared // Bitwise OR: 1 compared to 0 = 1 var randomNum = 1; // OR var randomNum = (0.7 | 0) // After forced type coercion to int and trucation (because of bitwise OR) var randomNum = (0 | 0); // Binary values are compared // Bitwise OR: 0 compared to 0 = 0 var randomNum = 0; Just did a super quick demo to try and solidify this in my head, if you don't use vscode and quokka plugin, try it, it's awesome ? @happywire if you're just starting out with JS, I can highly recommend this course: https://www.udemy.com/understand-javascript/ Anthony is an incredible teacher. This isn't just your usual "make a project with me" i.e. just code along, finish the project, learn next to nothing and not be able to implement anything you've learned in different scenarios kind of course. This is much more about the theory of how JS works.
  13. Hi everyone, got a random JS question. Could anyone explain to me how this line works? var randomNum = ((Math.random() * 2 | 0) + 1) - 1; It assigns either 0 or 1 to randomNum. What I don't get is the bitwise operator. I mean I get it compares two binary numbers, and two 0s is 0, 1 and 0 is 1, 1 and 1 is 1 etc.. but what happens with a decimal here? // Let's say Math.random() gives us 0.12005029823663982 var randomNum = ((Math.random() * 2 | 0) + 1) - 1; // So... ((0.12005029823663982 * 2) | 0) + 1) - 1; //... ((0.24010059647) | 0) + 1) - 1; // Now what? Do you even need the bit at the end? + 1) - 1; From what I've read (and tested), the output number from the between the first set of parenthesis alone will be 0 or 1. Not really sure what's going on. Any advice would be great, thanks.
×
×
  • Create New...