Skip to content
  • home
  • portfolio
  • web design journal
  • blog
    • adventure
    • san diego
    • urbanity & architecture
    • projects
    • website design

javascript

Getting Data from Multiple .then Statements in Javascript

September 18, 2023   |   Web Dev

I always have a hard time pulling data through multiple .then statements in javascript. This method works sufficiently well. Basically, define an array/object, and then as data is collected, add content to that array. All of the collected content should be available in the final .then statement. Something like this (all the data is collected […]

Read More

Gulp Minify Javascript

December 8, 2022   |   Quickbits

This will put a copy of the minified js file in the same folder in which it was found. It will require the following: useref, gulpif gulp.task(‘jsminify’, function() {   return gulp.src([     “!node_modules/**/*.js”,     “**/wp-content/themes/**/*.js”,     “!**/**.min.js”   ], { base: “./” })   .pipe(useref())   .pipe(gulpIf(‘*.js’, uglify()))   .pipe(rename({suffix: ‘.min’}))   .pipe(gulp.dest(‘./’)); });

Read More

Get Current Clicked on Element in Javascript

August 27, 2022   |   Quickbits

event.currentTarget

Read More

Javascript Does String Contain Substring

August 27, 2022   |   Quickbits

var str = “Some haystack text goes here that contains needlestring”;   str.includes(‘needlestring’); If you get an error, like “TypeError: e.includes is not a function”, it probably means that you’re trying to do a search on something that isn’t a string or an array.   Fix this by converting the variable to a string, like: element.toString().includes(“#”);

Read More

Javascript Replace String in String

August 27, 2022   |   Quickbits

let text = “The dogs barked loudly”; let result = text.replace(“dogs”, “cats”); Replace all instances: let text = “The dogs barked loudly”; let result = text.replace(“dogs/g”, “cats”);

Read More

Javascript Capture Camera on Phone Doesn’t Work on iPhone

June 9, 2022   |   Quickbits

On an iphone you need to add a ‘playsinline’ parameter. I think it works by placing it either in the javascript, or as part of the HTML tag — I just added it to both to be safe, and it resolved the issue so I called it good. In javascript as part of the getUserMedia […]

Read More

Document Ready in Vanilla Javascript

June 3, 2022   |   Quickbits

To wait until the document is ready, similiar to the $(document).ready functionality in jQuery, just do this: document.addEventListener( ‘DOMContentLoaded’, function(e) {    Stuff Here })

Read More

Javascript – Show or Hide an Element

May 24, 2022   |   Web Dev

Showing or hiding an element with javascript: (use “#” for elements by ID, or “.” for elements by class) document.querySelector(“#element”).style.display = ‘block’; document.querySelector(“#element”).style.display = ‘none’;

Read More

PHP JSON Returned As Object Instead of Array

May 14, 2016   |   Web Dev

I was returning, what I thought was an array from PHP, but it kept returning it as a json object, so I had something like: $listItem[0][0] = “Jan 1”; $listItem[0][1] = 100; $listItem[1][0] = “Jan 2”; $listItem[1][1] = 120; $listItem[2][0] = “Jan 2”; $listItem[2][1] = 120; …etc… This would return in javascript those an array, […]

Read More

A Simple Slideout Menu

December 18, 2015   |   Web Dev

I just wanted an easy slideout menu.  Click on a link, and the menu slides out from the left side of the screen.  Click on the link again, or somewhere else on the page, and the menu slides back in.  Here it is: HTML Code data-openwidth is the width in pixels of however wide you […]

Read More

Posts navigation

Older posts
  • Adventure

    • adventure
    • gravelgrinding
    • hiking
    • running
  • The Built Environment

    • architecture
    • urbanity
  • Locations

    • san diego
    • portland
  • Freelance Life

    • freelancing
    • productivity
  • Web Dev

    • css
    • entrepreneurship
    • git
    • handlebars
    • html
    • inkscape
    • photoshop
    • php
    • sass
    • web design
    • web development
    • saphire

drempd | san diego, ca


home contact

adventures san diego urbanity and architecture projects stream website design

portfolio resume san diego web design freelance web designer

custom web design responsive web design website maintenance