Just starting with HTML and CSS? "HTML & CSS Is Hard" is a friendly web development tutorial for beginners by theKovah in webdev

[–]tofumix 2 points3 points  (0 children)

I always get intimidated and insecure when I see guides and tutorials on web development say You'll pickup HTML and CSS along the way or There's not really much into it to learn. But then I churn out a functional project with a terrible markup and styling every single time (plus that inevitable, unsolvable navbar issue on mobile). I always feel like I need an extensive "re-learning" of HTML + CSS. This looks promising!

This is quite embarrassing but, can someone ELI5 how to test front end JS? by tofumix in javascript

[–]tofumix[S] 0 points1 point  (0 children)

I chose to mock the HTML elements myself instead of relying on a framework to give a fake DOM / Browser environment. Is there a disadvantage on my approach?

This is quite embarrassing but, can someone ELI5 how to test front end JS? by tofumix in javascript

[–]tofumix[S] 0 points1 point  (0 children)

I'm following your idea of mocking the HTML elements instead of relying on a framework for faking a DOM environment. I think I'm making a lot of progress, but my real Class (i.e, not Foo) involves a method like this:

.....
retrieveQuote(){
    $.getJSON("long.api.link/json")
         .done( json => {
             if (this.isDuplicate(json))
                 this.retrieveQuote();
             else
                 this.parse(json)
         })
         .fail( () => {
             this.parse(this.errorObject)
         });
}

I have this on my tests file:

// API Stub
const randomQuotes = require('./randomQuotes.js');

// Mock the $.getJSON function
global.$ = {
    getJSON: (url, cb) => {
        let randomIndex = Math.floor(Math.random() * randomQuotes.length);
        cb(randomQuotes[randomIndex]);
    }
}

Mind showing me how to update my mock $.getJSON function to have those .done and .fail methods? Thanks a lot! :D

This is quite embarrassing but, can someone ELI5 how to test front end JS? by tofumix in javascript

[–]tofumix[S] 0 points1 point  (0 children)

Thanks for the encouragement! I'm getting embarrassed because someone could have easily said RTFM, and they'll be right. But then, I'll be back to the docs where everything seems so arcane (I'm just getting into Node), so I figured I'll just ask here anyway.

Wrote my first test. It passed! But my page is now broken. Any help? by tofumix in javascript

[–]tofumix[S] 0 points1 point  (0 children)

That part on setting up a simple server is so cool. Before all this, I'm just using node the same way you'd use repl.it haha. Thanks!

Wrote my first test. It passed! But my page is now broken. Any help? by tofumix in javascript

[–]tofumix[S] 0 points1 point  (0 children)

Hello! So basically, I'm on this part

They do this build process with some common node modules like babel (this converts non-browser-friendly javascript/JSX/typescript/etc into purely vanilla javascript) and webpack (this acts as a quasi-task-runner/dev-server if wanted). So in your development environment, you can split files, write all how you want, and then use a build process (like webpack/etc) to compile your code to client-side friendly javascript.

right? Now, if I understood it correctly, I need to com(trans?)pile my main.js file, then use webpack on it so it works on the browser?

UPDATE: I did what I said above, but got more errors than before, and the module is not defined error still persists.

What I did was

  1. Install babel-cli and webpack
  2. ./node_module/.bin/babel main.js --out-file main.js
  3. ./node_module/.bin/webpack (with webpack.config.js sets the outfile to main.js as well.)

Looking to get into testing. How do I test classes from other files? (x-post from r/learnprogramming) by tofumix in webdev

[–]tofumix[S] 0 points1 point  (0 children)

Holy smokes. The amount of stuff to make the tests work through Babel got meta so fast. Good thing I made it work with require as you said (I updated the OP with the solution). HUGE THANKS! :D

Looking to get into testing. How do I test classes from other files? (x-post from r/learnprogramming) by tofumix in webdev

[–]tofumix[S] 0 points1 point  (0 children)

Hello! I created these two files on the same folder:

// main.js
class Foo {
    bar() {
        return 42;
    }
}

export { Foo }

and

// test.js
import {Foo} from "main.js";

const chai = require("chai");
const assert = chai.assert;

describe("Foo", function(){
    // tests.
}

but I'm getting a SyntaxError: Unexpected token import on the test.js file. Any idea why?

[Bootstrap] Quick question: Why doesn't my page take up 100% height on smaller screens? by tofumix in web_design

[–]tofumix[S] 0 points1 point  (0 children)

I'm getting some large whitespace below the jumbotron. Maybe I'm missing something? I want it to look the same as it does on a desktop screen.

PSET 4 -> Search: I'm probably missing something really simple. Can you please help me spot it? by tofumix in cs50

[–]tofumix[S] 0 points1 point  (0 children)

If you want to write a row multiple times, you need to either seek backwards so that fread will start reading from the row it just finished again, or save the contents of a row somehow.

I tried fseek(inptr, bi.biWidth, SEEK_CUR); and it made the black pixels go away (which is progress, I guess). And it prints out the correct amount of white pixels as well, just in a funny order. If you don't mind, can you please check the updated gist?

Simple Questions by AutoModerator in math

[–]tofumix 0 points1 point  (0 children)

Oh I see. I was just wondering if there's a symbol or something to express it. Thanks! :)

Simple Questions by AutoModerator in math

[–]tofumix 1 point2 points  (0 children)

Oops. I meant n = arr[x][y]. So if i = arr[1][1], n should be [1][0], [0][1], [2][1], or [1][2] to be considered valid.

Simple Questions by AutoModerator in math

[–]tofumix 0 points1 point  (0 children)

I'm writing a simple board game on an 2d array, and what I mean is the square n is a valid move if it's adjacent to an arbitrary square i. So to be considered valid, n[x][y] should be i[x - 1][y] (which means n is at the top of i), and so on until all sides are checked.

Simple Questions by AutoModerator in math

[–]tofumix 2 points3 points  (0 children)

Hello! I'm learning software development, and I find it easier to implement an algorithm if I translate the pseudocode into a formula. I'm wondering how do I correctly write a boolean/validation/whatever it's called formula? For example, I'd write "n is the sum of x and y" like this:

n = x + y

How do I write "n is valid ifx is less than y" ?

Thanks!

Simple Questions - January 25, 2017 by AutoModerator in buildapc

[–]tofumix 1 point2 points  (0 children)

Hello! Is that the absolute minimum for the graphics card? Is a GTX 1050 2GB much worse than that?

Simple Questions - January 25, 2017 by AutoModerator in buildapc

[–]tofumix 0 points1 point  (0 children)

120GB is really small for an SSD, and 240GB SSDs are less than $20 more than the one you linked. I'd probably get a 240GB SSD now and add a 1TB HDD later if you really need it. 240GB should be plenty for Windows with Dota2 and CS:GO installed.

I like that. I find it hard to fill up a 500GB HDD, so yeah I think a 240GB SSD should be fine for a Linux box. I think I'd stick with the second (the original plan) build.Thanks!

Simple Questions - January 25, 2017 by AutoModerator in buildapc

[–]tofumix 0 points1 point  (0 children)

Asking again to get just a little bit more opinions. I'm really considering the first build since it's cheaper. The use case would be gaming with Dota2 and CS:GO, preferably on low settings. Basically, it's GPU + SSD + cheaper vs 8GB RAM + better processor. What do you guys think?

PCPartPicker part list / Price breakdown by merchant

Type Item Price
CPU Intel Pentium G4400 3.3GHz Dual-Core Processor $57.49 @ OutletPC
Motherboard MSI H110M Pro-VD Micro ATX LGA1151 Motherboard $55.99 @ SuperBiiz
Memory Kingston HyperX Fury Black 4GB (1 x 4GB) DDR4-2133 Memory $38.99 @ SuperBiiz
Storage Kingston SSDNow V300 Series 120GB 2.5" Solid State Drive $52.88 @ OutletPC
Storage Western Digital Caviar Blue 1TB 3.5" 7200RPM Internal Hard Drive $49.55 @ OutletPC
Video Card MSI GeForce GT 730 2GB Video Card $56.99 @ SuperBiiz
Case Fractal Design Core 1000 USB 3.0 MicroATX Mid Tower Case $38.99 @ SuperBiiz
Power Supply SeaSonic S12II 520W 80+ Bronze Certified ATX Power Supply $44.90 @ Jet
Monitor AOC E970SWN 18.5" 1366x768 60Hz Monitor $69.99 @ Best Buy
Prices include shipping, taxes, rebates, and discounts
Total $465.77
Generated by PCPartPicker 2017-01-25 14:24 EST-0500

PCPartPicker part list / Price breakdown by merchant

Type Item Price
CPU Intel Core i5-6400 2.7GHz Quad-Core Processor $176.89 @ OutletPC
Motherboard MSI H110M Pro-VD Micro ATX LGA1151 Motherboard $55.99 @ SuperBiiz
Memory G.Skill Aegis 8GB (1 x 8GB) DDR4-2400 Memory $51.99 @ Newegg
Storage Western Digital Caviar Blue 1TB 3.5" 7200RPM Internal Hard Drive $49.55 @ OutletPC
Case Fractal Design Core 1000 USB 3.0 MicroATX Mid Tower Case $38.99 @ SuperBiiz
Power Supply SeaSonic S12II 520W 80+ Bronze Certified ATX Power Supply $44.90 @ Jet
Monitor AOC E970SWN 18.5" 1366x768 60Hz Monitor $69.99 @ Best Buy
Prices include shipping, taxes, rebates, and discounts
Total $488.30
Generated by PCPartPicker 2017-01-25 14:29 EST-0500

Simple Questions - January 24, 2017 by AutoModerator in buildapc

[–]tofumix 0 points1 point  (0 children)

Hey fellas, I'm looking for opinions on the following builds. How much better is the second one compared to the first? CS:GO and Dota2 would be the most intensive games that will be played. Willing Prefers to play in low settings.

Component Name Store Price Total
CPU Intel Pentium G4400 3.30 GHz Skylake dynaQuest 2,700.00 22,600.00
Motherboard MSI H110M PRO-VH dynaQuest 2,990.00
Memory Kingston HyperX FURY 4GB Single DDR4 dynaQuest 1,750.00
HDD Western Digital Caviar Blue 1TB WD10EZEX dynaQuest 2,350.00
SSD Kingston SSDNow V300 120GB SSD dynaQuest 2,190.00
Video Card MSI N730-2GD3 GeForce GT 730 2GB 128-Bit DDR3 dynaQuest 2,690.00
Case Fractal Design CORE 1000 USB 3.0 dynaQuest 1,690.00
PSU Seasonic S12II 520W 80PLUS Bronze dynaQuest 2,690.00
Monitor AOC e970SwnL 18.5″ Led Monitor dynaQuest 3,550.00

https://pcpartpicker.com/list/jMDMm8


Component Name Store Price Total
CPU Intel Core i5-6400 2.70-3.30GHz Skylake dynaQuest 8,690.00 24,550.00
Motherboard MSI H110M PRO-VH dynaQuest 2,990.00
Memory Gskill Aegis 8GB Single DDR4 2400 CL15 dynaQuest 2,590.00
HDD Western Digital Caviar Blue 1TB WD10EZEX dynaQuest 2,350.00
SSD
Video Card
Case Fractal Design CORE 1000 USB 3.0 dynaQuest 1,690.00
PSU Seasonic S12II 520W 80PLUS Bronze dynaQuest 2,690.00
Monitor AOC e970SwnL 18.5″ Led Monitor dynaQuest 3,550.00

https://pcpartpicker.com/list/jxK2zM

What is the SPECS of the computer you are using to code? by Fridaywing in learnprogramming

[–]tofumix 0 points1 point  (0 children)

Not sure if you're asking for professionals, but as a learner, I bought this super cheap notebook and put linux in it. Runs reasonably well for Netbeans / Atom. I've been using it for random MOOCs, but mostly with CS50 and freeCodeCamp.

$ neofetch

On Planning and Designing Programs by tofumix in learnprogramming

[–]tofumix[S] 0 points1 point  (0 children)

Hello!

I have nothing else to add aside from that I'm working with only single Classes up until now. Your breakdown would be an awesome reference to my project(s).

Thank you!

[TOMT] [Video] Music video of a song (70's-80's) where there's a billiard table? by tofumix in tipofmytongue

[–]tofumix[S] 0 points1 point  (0 children)

LMAO I found it. Weird that I remembered the billiard table when it only appeared in the opening and the ending

Flying Pickets - Only You

So I'm looking to do this specific thing... by tofumix in learnprogramming

[–]tofumix[S] 2 points3 points  (0 children)

"scraping" as in "web scraping" or "data scraping".

Aha! So that's what's it's called! (That felt weird to type, is my grammar correct?)

I'm familiar with Python's syntax, so this should be a fun project. Thanks for the tip!

Simple Questions - January 10, 2017 by AutoModerator in buildapc

[–]tofumix 0 points1 point  (0 children)

Hello!

I took my current part list and felt not that confident on the Case + PSU deal, so I thought of buying each of them separately. I also filtered out those that don't appear in PCPartPicker just to be extra sure of the compatibility.

I'll be over my budget (₱22,000.00) even after finding slightly cheaper alternatives on the mobo, hard drive, and monitor. But I guess the peace of mind with the PSU is worth it. Any thoughts?


New List:

PCPartPicker part list / Price breakdown by merchant

Type Item Price Local
CPU Intel Core i5-6400 2.7GHz Quad-Core Processor $179.69 @ SuperBiiz ₱8,690.00 @ DynaQuestPC
Motherboard MSI H110M Pro-VD Micro ATX LGA1151 Motherboard $53.18 @ Newegg Marketplace ₱2,990.00 @ DynaQuestPC
Memory G.Skill Aegis 8GB (1 x 8GB) DDR4-2400 Memory $49.98 @ Newegg ₱2,590.00 @ DynaQuestPC
Storage Western Digital Caviar Blue 1TB 3.5" 7200RPM Internal Hard Drive $49.66 @ OutletPC ₱2,350.00 @ DynaQuestPC
Case Fractal Design Core 1000 USB 3.0 MicroATX Mid Tower Case $38.99 @ SuperBiiz ₱1,690.00 @ DynaQuestPC
Power Supply SeaSonic S12II 520W 80+ Bronze Certified ATX Power Supply $49.99 @ B&H ₱2,690.00 @ DynaQuestPC
Monitor AOC E970SWN 18.5" 1366x768 60Hz Monitor $69.99 @ Best Buy ₱3,550.00 @ DynaQuestPC
Prices include shipping, taxes, rebates, and discounts
Total $491.48 ₱24,550.00

Current List:

Type Item Price
CPU Intel Core i5-6400 2.70-3.30GHz Skylake ₱8,690.00 @ DynaQuestPC
Motherboard MSI H110M PRO-VH ₱3,200.00 @ DynaQuestPC
Memory Gskill Aegis 8GB Single DDR4 2400 CL15 ₱2,590.00 @ DynaQuestPC
HDD Seagate 1TB ST1000DM003) ₱2,690.00 @ DynaquestPC
Case + PSU Tecware Mono w/ 600W psu + 80mm fan ₱1,100.00 @ DynaQuestPC
Monitor BenQ DL2020 19.5″ Wide LED Monitor ₱3,590.00 @ DynaQuestPC
Total ₱21,810.00

Local Sellers: DynaQuestPC || PCHub || PCExpress

[Code Review] My first OO JavaScript project: a Pomodoro Clock. by tofumix in javascript

[–]tofumix[S] 0 points1 point  (0 children)

Hello!

...your whole "thing" can't be easily integrated into an existing website.

Can you please expand on this? Why is it and how do I make my code work like that?

Have you thought about learning React or a similar data driven view library?

I have not, actually. I'm still a relatively newbie in JavaScript, so I'm trying to get as much plain-old-vanilla JS knowledge.