Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by SamC

  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.
  14. Awesome, thanks @szabesz ? I'm in JS land right now, this may come in very helpful, after I've completed the already massive todo list...
  15. @bernhard nice! I'll update the tutorial (done now) and point to this module. I haven't had much time at ll to work on that site, been so busy trying to learn enough skills to call myself a dev one day...
  16. This is a really nice font! Thanks for this ?
  17. Ah, ok, thanks guys. I did wonder one other thing, there seems to be numerous ways to achieve something, like, which approach would you use, inject into a method, or into the constructor? Both work in my case here (only showing one method, there are more, but they do not ALL need the Project class, create() for example just returns a view). So would you (the Laracasts showing me how to do this way): namespace App\Http\Controllers; use Illuminate\Http\Request; // Bring Project model into namepsace use App\Project; class ProjectsController extends Controller { public function show(Project $project) { return view('projects.show', compact('project')); } } ...OR (the way shown in @Wanze's link above from Laravel docs): namespace App\Http\Controllers; use Illuminate\Http\Request; // Bring Project model into namepsace use App\Project; class ProjectsController extends Controller { protected $project; // Inject Project model here instead of on multiple methods public function __construct(Project $project) { $this->project = $project; } public function show($id) { $project = $this->project->findOrFail($id); return view('projects.show', compact('project')); } } Would one way be considered 'better' than the other way? Does it just depend on how many methods actually need the other class? i.e. what's the point of instantiating in the constructor if 3 methods need it, and 3 methods don't. That kind of thing? Not sure I like compact() either, it's not obvious to me (lack of experience?) what's actually being passed to the view. I know there are other ways. If you use artisan to set this up automagically: php artisan make:controller ProjectsController -r -m Project ...it results with the former i.e. no constructor, which seems weird seeing as their docs say: i.e. using a constructor: https://laravel.com/docs/5.7/container#automatic-injection
  18. My needs are shall we say, basic. But CI/CD is something that interests me. I've seen a lot of travis files on various projects but no idea what they do tbh. I'm guessing it's like Buddy, but less point and click. I use buddy to sync files between a staging and production site, for pushing code from a gitlab repo > staging site (automatically when pushed from vscode) > production site (on a button click in buddy web UI). I'm guessing I can do all the same things with github. One concern would be them sucking me in with a 'free' promise, then start charging for it, like what And.co just did for my invoicing! And gravit.io just did the same... except they didn't just add a premium version, they took features OUT the free one and started charging for them. I didn't use github because it wasn't free for private repos, it was as simple as that. I tried bitbucket but IMHO, the UI was awful. Gitlab was much nicer, but I prefer Github. Now it's free, maybe I can try it out some more... and learn what travis does.
  19. Still not sure whether 'dev talk' means talk about just PW or anything else?! Anyway, been working with Laravel for a bit now but still a bit confused about a certain thing. For example: namespace App\Http\Controllers; // Bring Project model into namepsace use App\Project; class ProjectsController extends Controller { /** * Save new project */ public function store() { $project = new Project(); // <<<<<< NEW OBJECT $project->title = request('title'); $project->description = request('description'); $project->save(); // A GET request by default return redirect('/projects'); } } ... but I've since found out that you don't need to instantiate a new object in a method, you can type hint like so: /** * Update existing project */ public function update(Project $project) { // Update and save $project->title = request('title'); // <<<<<< OBJECT IS AVAILABLE LIKE MAGIC $project->description = request('description'); $project->save(); // A GET request by default return redirect('/projects/' . $project->id); } What I'm confused with is how type hinting creates a Project object that is then available in the update() method. Isn't type hinting simply saying "this method expects param 1 to be an Object of type Project"? i.e. nothing to do with dependency injection. Any hints would be awesome, thanks.
  20. Hi Adrian ? I'm using GitLab for all my private stuff, worked fine so far. It also integrates nicely with Buddy (which is good for me because I don't know how to set up CI stuff manually). Why would this move by Github have you move from Gitlab? What would make Github a better choice for you?
  21. After trying @wbmnfktr suggestion of turning off bluetooth (I also deleted wifi and re-set it up), the wifi seems to be working fine for the last couple of days.... fingers crossed. Although crossing fingers and hoping for the best is no substitute for it actually working like it should!
  22. I've been on windows since about win95 and I've never had any issues. Other than the ancient looking (IMHO) explorer and those yellow folders, I really enjoy it, now on win10 on the desktop. I actually had a surface laptop on order, then got all paranoid about the material staining up (I have eczema so my hands can be greasy with moisturizer). The order fell through when they failed to deliver it on time so I cancelled and got my money back, and bought the 2015 macbook. What do you use as a terminal on win10? I'm using cmder at the moment which seems to do the job. Mind you, I've got no idea what actually happened behind the scenes on initial setup.
  23. Mine's a 2015 13" MBP. @ryan, thanks but I don't have the android file transfer installed. The only things I leave running are postgres server, docker and onedrive. I actually never turn the thing off because every time I did, I got this: https://jeroenmols.com/blog/2017/12/26/macosupdate/ on startup. I wasn't trying to upgrade or anything, just restarting. Actually, not sure if upgrade is the right word. Doesn't that imply something that's better? I started using a macbook in 2012 and never had any problems, now the number of issues seems to be creeping up and up. I guess I could quit moaning and buy a windows laptop but I expect more from such an expensive bit of gear. Anyway, I'll try the bluetooth suggestion tomorrow. Not sure what'll happen when I need to use my external (bluetooth) keyboard though.
  • Create New...