AtomicZBRA
AtomicZBRA
WBWeb Bae
Created by AtomicZBRA on 5/16/2024 in #❓︱questions
Local vs Prod Dev (with a twist)
Next steps would be seeing if i could automate the page script variable by making sure the filenames are the same as the slug of the current page, and then i wouldn't need to edit the script on the page, it would just be dynamic
22 replies
WBWeb Bae
Created by AtomicZBRA on 5/16/2024 in #❓︱questions
Local vs Prod Dev (with a twist)
Just a little update, but i ended up using localStorage combined with an applescript automation for triggering the localstorage variable on and off
const loadScript = (url, type) => {
return new Promise((resolve, reject) => {
const script = document.createElement("script");
script.type = "text/javascript";
script.onload = resolve;
script.onerror = reject;
script.src = `${url}/${pageScript}`;
document.body.appendChild(script);
});
};

const loadScriptAsync = async () => {
const localScriptURL = "http://localhost:3000";
const publicScriptURL = "https://production.server.goes.here";
const pageScript = "src/some-file.js";

try {
const url = localStorage.getItem("devMode") ? localScriptURL : publicScriptURL;
await loadScript(url, "dev");
console.log(`${url === localScriptURL ? "Dev" : "Public"} Script loaded`);
} catch (error) {
console.error("Error loading script:", error);
}
};

loadScriptAsync();
const loadScript = (url, type) => {
return new Promise((resolve, reject) => {
const script = document.createElement("script");
script.type = "text/javascript";
script.onload = resolve;
script.onerror = reject;
script.src = `${url}/${pageScript}`;
document.body.appendChild(script);
});
};

const loadScriptAsync = async () => {
const localScriptURL = "http://localhost:3000";
const publicScriptURL = "https://production.server.goes.here";
const pageScript = "src/some-file.js";

try {
const url = localStorage.getItem("devMode") ? localScriptURL : publicScriptURL;
await loadScript(url, "dev");
console.log(`${url === localScriptURL ? "Dev" : "Public"} Script loaded`);
} catch (error) {
console.error("Error loading script:", error);
}
};

loadScriptAsync();
Applescript automation (i'm triggering this with a raycast script and/or a streamdeck action)
tell application "System Events"
-- Open the JavaScript console
keystroke "j" using {command down, option down}
delay 0.5

-- Run the JavaScript code
set jsCode to "if(localStorage.getItem('devMode')) { localStorage.removeItem('devMode'); } else { localStorage.setItem('devMode', 'true'); };"
keystroke jsCode
keystroke return
delay 1

-- Close the JavaScript console
keystroke "j" using {command down, option down}
end tell
tell application "System Events"
-- Open the JavaScript console
keystroke "j" using {command down, option down}
delay 0.5

-- Run the JavaScript code
set jsCode to "if(localStorage.getItem('devMode')) { localStorage.removeItem('devMode'); } else { localStorage.setItem('devMode', 'true'); };"
keystroke jsCode
keystroke return
delay 1

-- Close the JavaScript console
keystroke "j" using {command down, option down}
end tell
22 replies
WBWeb Bae
Created by AtomicZBRA on 5/16/2024 in #❓︱questions
Local vs Prod Dev (with a twist)
I really don't mind a more manual thing, i just hate constantly adjusting the webflow scripts 😂
22 replies
WBWeb Bae
Created by AtomicZBRA on 5/16/2024 in #❓︱questions
Local vs Prod Dev (with a twist)
oh the url param is good too!
22 replies
WBWeb Bae
Created by AtomicZBRA on 5/16/2024 in #❓︱questions
Local vs Prod Dev (with a twist)
wonder if i could throw up local storage if the ip is mine
22 replies
WBWeb Bae
Created by AtomicZBRA on 5/16/2024 in #❓︱questions
Local vs Prod Dev (with a twist)
ooooh i never considered using local storage
22 replies
WBWeb Bae
Created by AtomicZBRA on 5/16/2024 in #❓︱questions
Local vs Prod Dev (with a twist)
This is actually what sparked me to start 😂
22 replies
WBWeb Bae
Created by AtomicZBRA on 5/16/2024 in #❓︱questions
Local vs Prod Dev (with a twist)
I was reading a recommendation someone made on stack overflow where they said you could overwrite the window.console function globally to ignore certain messages LOL
22 replies
WBWeb Bae
Created by AtomicZBRA on 5/16/2024 in #❓︱questions
Local vs Prod Dev (with a twist)
No description
22 replies
WBWeb Bae
Created by AtomicZBRA on 5/16/2024 in #❓︱questions
Local vs Prod Dev (with a twist)
This is what i ended up on, it didn't solve the main issue, but it at least works instead of erroring out
const localScriptURL = "http://localhost:3000/some-script.js";
const publicScriptURL = "https://some-cdn.com/some-script.js";

function loadScript(url, callback) {
const script = document.createElement("script");
script.type = "text/javascript";
script.onload = function () {
callback();
};
script.src = url;
document.body.appendChild(script);
}

fetch(localScriptURL)
.then(() => {
loadScript(localScriptURL, function () {
console.log("Dev Script loaded");
});
})
.catch(() => {
loadScript(publicScriptURL, function () {
console.log("Public Script loaded");
});
});
const localScriptURL = "http://localhost:3000/some-script.js";
const publicScriptURL = "https://some-cdn.com/some-script.js";

function loadScript(url, callback) {
const script = document.createElement("script");
script.type = "text/javascript";
script.onload = function () {
callback();
};
script.src = url;
document.body.appendChild(script);
}

fetch(localScriptURL)
.then(() => {
loadScript(localScriptURL, function () {
console.log("Dev Script loaded");
});
})
.catch(() => {
loadScript(publicScriptURL, function () {
console.log("Public Script loaded");
});
});
22 replies
WBWeb Bae
Created by Alex Villacres on 5/7/2024 in #❓︱questions
Finsweet Starter repo causing a ERR_CONNECTION_REFUSED
How did you get this index.js file? I cloned your repo from github and i ran pnpm build and the file that i got for index.js looks vastly different from yours
11 replies
WBWeb Bae
Created by Alex Villacres on 5/7/2024 in #❓︱questions
Finsweet Starter repo causing a ERR_CONNECTION_REFUSED
I think this file is also erroring, might be worth checking out: https://unpkg.com/@launchnotes/embed@1.0.2/dist/launchnotes-embed/launchnotes-embed.js
11 replies
WBWeb Bae
Created by Alex Villacres on 5/7/2024 in #❓︱questions
Finsweet Starter repo causing a ERR_CONNECTION_REFUSED
You've got a couple issues here i think The one that's causing this issue is this file https://cdn.jsdelivr.net/gh/alexvillacres/testimonial-slider@v1.1.0/dist/index.js this has got some functionality from the the bin/build.js file that's used for serving or bundling the file, not sure how you got it into the dist folder but this is what's looking for the localhost
11 replies
WBWeb Bae
Created by Alex Villacres on 5/7/2024 in #❓︱questions
Finsweet Starter repo causing a ERR_CONNECTION_REFUSED
Which are the custom scripts you're bringing in from the cdn?
11 replies
WBWeb Bae
Created by Alex Villacres on 5/7/2024 in #❓︱questions
Finsweet Starter repo causing a ERR_CONNECTION_REFUSED
So this is expected behaviour, I think. Localhost is your local machine, so if there’s script tags with a source of localhost it’s going to need the local dev server to be running When you have bundled code hosted with a cdn you would change your script sources to point at the new cdn links. Like I said though, I think this is expected behaviour, if anything I’m saying sounds off, please provide some more context!
11 replies
WBWeb Bae
Created by Toydestroyer on 3/4/2024 in #❓︱questions
Webflow creates empty records on CSV import /Imported Item 1, Imported Item 2, Imported Item 3, etc/
I'm not sure what you mean that you need the empty rows to format it as text, I opened the csv you sent in excel, deleted the empty rows at the bottom of the file, saved back as a csv, and uploaded to webflow. From there I was getting the correct amount of items, 18
7 replies
WBWeb Bae
Created by AtomicZBRA on 3/21/2024 in #❓︱questions
Mobile Terminal Based Snake Game
I think I had to move the canvas size declarations out of the function anyways because I want to add other games, but also have an event listener for resizing the canvas element that applies to all games
6 replies
WBWeb Bae
Created by AtomicZBRA on 3/21/2024 in #❓︱questions
Mobile Terminal Based Snake Game
Haha glad that you liked it!! I did want it to change with the viewport so that it’s always the same size as the terminal window! But I was actually thinking of swapping the width and height declarations if the canvas height is larger than the width
6 replies
WBWeb Bae
Created by Tomek Grabski on 3/20/2024 in #❓︱questions
The best (?) way to learn Webflow
Also the idea of money from niches comes from when you can demonstrate a commensurate amount of knowledge related to that niche. So like if I’m niching down to medical companies because I’ve already done 50 of them, now I can charge more because I know what 50 of your competitors are doing and how to help you stand out. This also might mean you might not necessarily charge more for a niched product, but you can finish it faster because of the experience you already have >>> increasing your overall revenue. I think it’s easy to get caught in the idea that niching down will automatically lead to more money because the market is narrower but it’s really just becoming an expert in that field which yields the best value
26 replies
WBWeb Bae
Created by Tomek Grabski on 3/20/2024 in #❓︱questions
The best (?) way to learn Webflow
Agree with that 100% ^ don’t niche to start, you’re just limiting your potential clients!
26 replies