List Code
Converting PHP to Javascript for State Extraction by numeric value Australian State Names
I cant even remember when i originally wrote this php function, but now i need to have it in javascript, should not be much change to it to get it working. The original function takes an austra..
Regions of New Zealand - In Dropdown Form
Split into north and south island lists Also added a combined list, with a disabled options for north and south. /your welcome! :)
A short unsplash image url
You will notice that if you copy the image source from unsplash you will end up with something like this: https://images.unsplash.com/photo-1582639590011-f5a8416d1101?ixlib=rb-1.2.1&ixid=MnwxMjA3..
highlight a button with an animation css
While i was downloading the latest AdoptJDK i noticed this button, and thought it was a nice effect. I wondered how hard it would be to replicate this. Copy the link html Check each class..
submit form with javascript
if you have a form with an id, you can submit it with the following javascript. usually this will be attached to an event or something similar like a button click. If i run this on the demo, it..
check url hash using javascript
What is a url hash? This is a URL Hash. You can add the # symbol on the end of a url and content after it, and this will not effect the content usually, unless the browser is intructed to do somet..
Uncaught TypeError: Cannot set properties of null (setting 'onclick')
I was just testing some code and noticed i had this error on my site. Locate the error in the site code I removed this script, so the whole thing is now not required, as i opted for the au..
php check if a class exists
check if a class exists in php. this can be used rather than assuming the class exists and then causing an error You can run the class_exists function on the class before loading it with the followi..
Fatal error: Uncaught Exception: Required extension GD is not loaded.
How to resolve the error: Fatal error: Uncaught Exception: Required extension GD is not loaded. This Error is ususally due to a php library or script requiring the GD php extention. On ubuntu ..
Core Function : list_search_by_class_return_links - List Searches by Class Type and Return Links
Function that list's the latest and top searches by the class name and return a list of links, with the search totals on them. I wanted to extract the top searches and the latest searches by da..
best way to write html into an existing page javascript
this probably isnt the "best way" but it is a way that works. say you want to add some elements to a page with javascript this is a method to do it. Add an element, before including the script..
how to write a javascript string over multiple lines
i remember learning this on freecodecamp while doing the ES6 training, and i could not remember exactly how to do it. I was using the \ at the end of each line but thats really a bit annoying.&..
test love like dislike script from api
just testing writing to page from javascript and api
console dir usage
the console.dir function shows a list of the properties or the target object. Usage console.dir(variable); Result Example
javascript attach a click event to an id not using jquery
I just wanted to bind a click to a button, not using JQuery, turns out its not that hard at all. Why am i using jquery for this stuff???...
No 'Access-Control-Allow-Origin' header is present on the requested resource.
add this to your php to allow requests from any source Access-Control-Allow-Origin php header
update value of element using javascript
using innerHTML to update the value of an element
javascript add class to element
how to add a class to an element in raw javascript I wrote a quick demo here showing how you can add a class to an element with an id on a button click
center a box in the middle of the screen
and then center everything in that box as well
Javascript Objects Notes
As javascript objects are used so often in javascript i thought i would write an overview and some notes on how they work, well how they work for me anyway. I guess how they work for me should be simi..
Lato font quick install
a quick code to install the font Lato from google, includes the stylesheet and also the @import links, just pick one.
html and css hoizontal simple timeline section in foundation
a horizontal simple timeline section example done in foundation grid with some custom styles. This also uses the Lato Font quick install! So Quick!.. :P Also works on responsive and mobile dev..
bouncing loader animation in css
uses css and keyframes animation to create a nice and smooth bouncing loader
Footer Design and Redesign
I never usually look this far down on the site, but its a bit average... Lets fix it! Some simple changes Just a few elements added and moved around a bit. Added another row to the f..
add a button to an existing link using :after css
Adding a button style to an existing link using :after and css. Preview
font similar to century gothic questrial google font quick install
I found this font to be closely related to the paid font "Century Gothic" the only issue i found with this font is that it only comes in regular weight. But Questrial is free to use, so that is..
using the :user-valid CSS pseudo-class
It seems this is currently only working in firefox. Here is a test of the code in firefox, you can see if you add a "valid" email address it will add a border and a green tick.
git basics - git init, git commit, git all, git *
create a new repository git init the following code can be typed in a terminal window, once you have installed git for your OS. This will create a directory called git-test assuming you already hav..
generate a new SSH key on mac for git
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
Auto Changing Image URL
Here is a picsum url that you can use to generate image sizes, just change the numbers in the url to change its generated size. Some examples of the sizes you can use are below.
Clear Youtube DL Cache to fix 403 Forbidden error, youtube-dl 403 forbidden
If you are getting the error: File "C:\Python\Python34\lib\urllib\request.py", line 588, in http_error_defaulturllib.error.HTTPError: HTTP Error 403: Forbidden It could be cache that is causing this..
Twitter Post Fetcher Script
Uses javascript to fetch a twitter feed from a user screen name. Totally stylable alternative to using the twitter embed code. Your Welcome...
truncate text with line clamp allow a certain number of lines
This shows how you can truncate text to a certain number of lines using the css property line-clamp. -webkit-line-clamp: 3; line-clamp:3;
Facebook HTML for Sharing a Link
just the html for the link, that is all. Replace kruxor.com with your url to share E.g: share to facebook
encode url with javascript
get the current url, encode it and log the encoded result to console
Get current URL and add a share to facebook share button with it
Combines this Facebook HTML for Sharing a Link and encode url with javascript this to make captan planet! Or... makes a share this post to facebook button.
linked in share link html only, linkedin, linked-in
share a post or url to linked in html only version
share to linked in current url button with javascript
Share the current page url to linked in with a button and javascript
share to twitter html link only
share to twitter the html version of the link only
share to twitter javascript button function open a new window
gets and encodes the current page url and opens a new window to share the link to twitter
add user to sudo group in ubuntu
Adds the user "username" to the sudo group usermod -aG sudo username
unable to write to a sqlite database with docker
turns out this was not a docker specific problem, i was getting the readonly database error. even if the database has full write permissions, the directory also needs to have write permissions ..
jquery load wait function
load something in jquery, wait for it to load then do something else
duplicate a line in vscode shortcut
if you ever wanted to duplicate a line in vscode, this is the shortcut for you. rather than doing the hightlight, and then CTRL + C and then CTRL + V you can use the following shortcut. just put you..
set a css grid to auto to make it stack on mobile
to make a grid stack when the screen size gets smaller you need to set the grid items to auto when it gets to the desired screen size. In this example once the screen size gets to 1024px or les..
floating message box on bottom right of screen with close button
A floating fixed message box on the bottom right hand side of the screen with a close button.
add a user and add the user to sudo group
basic adding of a user in linux and then adding the user to the sudo group to allow it to run super user commands like apt update or other potentially system breaking commands. Note: replace "usern..
flush dns on mac
sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder
Search Duplicating Bugs
Still having issues with the word above duplicating, not sure why. Search Page PHP - Get Search Value $search_value_encoded = htmlentities($search_value); Check for Search value, and then ..
Warning: Undefined variable $class_single_hero in /var/www/html/pages/section.page.php on line 177
This warning was caused by a dot in front of the equals $class_single_hero .= $code->hero_widget($t_uid = $class_single->uid,$t_class = $p2); Fixed version Easiest way to fix this is remo..