Skip to content

Instantly share code, notes, and snippets.

View nhobi's full-sized avatar
🌼

Nate nhobi

🌼
View GitHub Profile
@nhobi
nhobi / keepIndexInBounds.js
Created May 6, 2021 22:50
A Vue mixin that handles keeping the index for a given collection in bounds.
export default (collectionName, indexName = "selectedIndex", cycle = false) => {
return {
watch: {
[indexName](newValue, oldValue) {
if (this[collectionName] === undefined) {
return;
}
let highestIndex = this[collectionName].length - 1;
@nhobi
nhobi / uploadBlob.js
Created May 6, 2021 22:56
Uploads a given blob to S3.
import random from "./randomString";
function getBucketObj() {
AWS.config.region = window.aws.region; // 1. Enter your region
AWS.config.credentials = new AWS.Credentials(aws.key, aws.secret);
AWS.config.credentials.get(function(err) {
if (err) alert(err);
});
@nhobi
nhobi / calculateDownloadSpeed.js
Last active May 6, 2021 22:59
Calculates the download speed of your current network based on an image fixture.
export default () => {
return new Promise((resolve, reject) => {
let imageAddr =
"https://nhmisc.s3.amazonaws.com/liswall/stub.jpg" +
"?n=" +
Math.random();
let startTime, endTime;
let downloadSize = 1025385;
let download = new Image();
@nhobi
nhobi / stylesheet.css
Last active October 26, 2025 16:17
www-codecareermastery
@font-face {
font-family: Display;
src: url(https://font-public.canva.com/YAFcfqJdReQ/0/subsets/ARCINGDT.0ba0f4d65d27ffaf8aea6df3e58fade.87ebbe75b359376e1e8b9b69bd783cc.woff2);
}
@font-face {
font-family: Body;
weight: bold;
src: url(//font-public.canva.com/YAFdJn5d8s0/0/Aileron-Bold.d626942d7f2d1a723c211b79dc9.83a1bcd0ead0443eec51934c4bce7519.woff2);
}