Blog Posts
Setting a variable value as an object key in Javascript
You sometimes may find yourself needing to assign an attribute to an object based off the value of another variable. I show you the easiest way.
Building a GraphQL API with NestJS and Prisma
In this tutorial I will show you how to create a GraphQL API using Nest.JS with a Prisma.IO database. In my recent project at work we are using all three of these technologies and I thought it would be great to provide a walkthrough on how you can get this stack working…
Fixing ERR_INVALID_THIS error on Vercel using PNPM
Fixing ERR_INVALID_THIS error on Vercel using PNPM I was in the beginning stages of creating my application using T3 and Clerk when I ran into a peculiar error when attempting to deploy in Vercel. I was trying to deploy my application in vercel when I was running into…
Solving the Module Not Found error when using NextJS and MonoRepos
I’m using the T3 stack to begin work on my movie application and I wanted to use ShadCN for the baseline of my components. I had another package called ui in which I was going to store all of my ShadCN components and then reference those in my nextJS application. I went…
SEO with Gatsby and React-Helmet
React-Helmet is a way of managing all of the changes that are made to the head of an HTML document. With this component you can control the head using their react component. This allows you to add attributes to their component that will be added to the static HTML pages…
Fixing ECONNREFUSED error in Rails and NextJS Docker Containers
I’m in the early stages of creating my application that uses NextJs as a frontend and Rails as the Api backend, when I realized that I couldn’t NextJs to talk to my api: At first I thought i had something misconfigured, on the NextJs side - but this is actually on the…
How to install packages from GitHub using NPM
Using the npm registry is not the only source that we can use to install packages into our applications. NPM also has the ability to install from a remote git url as long as the repository has a package.json file in it’s root directory. Installing from GitHub For…
Fixing the MDB_PROBLEM: Unexpected problem - txn should abort in Gatsby
While I was preparing to work locally on my website, I did the typical and was met with this error: Error: MDB_PROBLEM: Unexpected problem - txn should abort Eh? MDB_PROBLEM? That’s a strange error … At first I thought I had made a mistake with my markdown files, so I…
Adding drafts to your blog posts in Gatsby
In this article I will teach you how to add a draft system to your Gatsby site so that you can prevent incomplete or unpublished posts from being visible to the public.
Fixing multiple renders with NextJs and tRPC
A post about how to fix multiple rendering issues when using NextJS and tRPC
How to add redirects to a Netlify site in Gatsby
Previous this website was built in Wordpress, but now I’ve built it using Gatsby. In my migration to Gatsby I felt like I needed to change the url structure of the pages and not have any broken links. On my old webhost I did this using .htaccess and just define my…
Sorting an array of objects by a property value in javascript
Sorting using sort() Lets say that you have an array of objects that you wanted to sort by: You can use the sort() method of the Array that uses a callback function. The function takes 2 parameters in the array (commonly called a and b) When the callback function…
BooleanInput not saving in React-Admin
So I was having an issue in react-admin where the value of BooleanInput (e.g. a checkbox slider) was not saving to my backend. Specifically when I left the input as unchecked when creating a new entry it wouldn’t pass the parameter of that checkbox (unchcked so false or…
Fixing Netlify form problems in Gatsby
After having a ton of issues getting Netlify’s form submission to work, I have some tips on how to get it working if you’re running into any trouble Do not forget the method attribute in the form tag I’ve wasted quite a few build minutes on Netlify on this small…
Sticky Sidebar in React
How to do it Now you could use something like react-sticky to do something like this, but it’s so much easier to just define your sidebar using css. You can change the top position to be any amount that would include your fixed header if you wanted to.
Fixing Polyglot.transformPhrase expects argument #1 to be string in react-admin
What does transformPhrase even mean? So sometimes when I’m trying to save a form in react-admin I see this really annoying error: Uncaught TypeError: Polyglot.transformPhrase expects argument #1 to be string The reason why this happens is because the translateChoice…
How to extend types in Typescript
When working with TypeScript, you’ll frequently encounter scenarios where you need to merge or enhance existing types to craft a new, specialized one. Fortunately, TypeScript makes this process straightforward and user-friendly. To extend a type in Typescript, you have…
Fixing Foundation 5’s Unrecognized Expression Syntax Error
I was working on a new marketplace theme in Magento, and I kept getting a peculiar javascript error message. The exact error message that you might receive could vary – but the one I got was: Uncaught Error: Syntax error, unrecognized expression: [data-‘Times New Roman…
How to check if a jquery plugin is installed or available
Most Jquery plugins act a lot like functions. They are attached to the main Jquery object, so essentially all we have to do is check that the function exists and is defined.
Strip Whitespace on save with Aptana
So recently I had a coworker get slightly annoyed with me and my trailing whitespaces at the end of lines. I’m using Aptana and not anything crazy like vim to do my programming work, I don’t actually see the whitespace I’m leaving around. However, they do show up in the…
How to install Paperclip in Rails 3
Paperclip is a plugin/gem created by the talented folks at ThoughtBot. It will make using attachments and uploads in your rails application ridiculously easy to implement. Let’s get started! Things you’ll need installed Before we start there is only one thing that you…
Fixing the error 0xe800400c or (-48) when syncing to Itunes
Imagine how disappointed I was when I had plugged in my brand new iPad 2 and only to realize that it simply cannot sync with my iTunes. If you’re getting an error messages or weird stuff like: Device Timed Out error message Internal device error An unknown error has…
Installing Ruby on Rails 3 in Windows
So last week I got a little tired of having to reboot my computer to dual-boot in a linux environment so that I could work on Rails stuff. Then I decided to try using Rails in Windows. Here’s a step by step guide on how to install rails in Windows. Install Ruby 1.9 To…
How to read remote files using PHP
When I was implementing pingback functionality in my custom blogging software, I needed to read files from a remote server. As long as allow_url_fopen is enabled in your php.ini configuration you can use HTTP and FTP urls with a majority of the functions that use a…
Changing the pointer into the hand cursor in AS3
One of the problems that I ran into while migrating from Actionscript 2 (AS2) to ActionScript 3 (AS3) was the fact that not only was setting a mouse event of a MovieClip different, so does how the mouse cursor acts. In AS2, setting the onPress event for a MovieClip…
Using Jquery to disable the enter key
There are times that you do not want a form to automatically submit when a user hits the enter key. Or if you want to do some validation via javascript before you allow the submit to go through. By returning false in the keypress function it tells the browser not to…
Removing empty elements from an array
When dealing with tag inputs from users, I find myself having to make sure they they don’t enter in any blank or empty tags. Then I realized that I needed to find out how to remove undesirable elements not only from the Php side, but also from the Javascript side as…
Case-insensitive replaceAll in Java
How to use a case-insensitive replaceAll in javascript
No more updates to Google Notebook
One of the only Google app (apart from Gmail) that I use the most Google Notebook will have no more updates. Before I signed up to Google I used to keep all of the websites that I thought were useful in my bookmarks and that became really messy really quickly. Also with…
Remove Anchors from a Url in Javascript
Here is something useful that I discovered in my programming for my personal websites. I needed to strip out the anchor portion of a link and leave the rest of the url intact. For example I wanted: http://jelaniharris.com/I-love-apple-pies#comments To look like: http…
Adding a delay to JQuery Functions
Recently I was working on a few functions that I didn’t want to have activated immediately after hovered over a div. I neededthe functions to activate after a half a second of hovering by the user. To do this I created this this piece of code. Let’s go through line by…
First Post!
Well, this is the start to my blog. Hopefully I’ll post here often, but hopefully with something useful each time. I just don’t want to have one of those blogs where you just post because you haven’t posted in awhile. That always leads to apologizing at the beginning of…