List Code

Showing page 4 of 9 in latest. Total Items: 436
A Collection of Code
javascript
basic for loop odd numbers
...

a basic for loop with odd numbers adding to an array

6:20 am, July 31, 2019
javascript
check if something is an array
...

this function will check if something is an array

5:26 am, July 31, 2019
apache
apache redirect to https ssl from normal
...

good if you have apache and access to htaccess file to redirect requests to https version of the site. this one also includes a rewrite to index.php so if you don't need this remove the last line.

1:20 am, July 31, 2019
javascript
getType function for js
...

this function returns the type of item, array object string number etc

11:50 pm, July 29, 2019
javascript
Objects in javascript
...

creating and using an object in javascript, the full version of this testing is on codepen

11:25 pm, July 29, 2019
javascript
card counting example from fcc
...

here is a solved version of the card counting function from free code camp you can test it using console log.

2:00 am, July 29, 2019
javascript
using switch with multiple identical cases
...

this can be used if you have several outcomes where the return value will be the same by omitting the break from the cases before the final

1:32 am, July 29, 2019
javascript
using switch in a function
...

This shows an example using the switch to select multiple options in a function, you can return from the switch with break, or you can end the whole function with return.

11:19 pm, July 28, 2019
php
IP Address
...

this uses php $_SERVER['REMOTE_ADDR'] to show your IP address

1:30 am, July 26, 2019
javascript
js function to calculate golf scores
...

this function will return the score name depending on the par and strokes for golf

1:48 am, July 24, 2019
javascript
compare non equality function
...

this will check if two values are not equal

11:15 pm, July 23, 2019
javascript
compare equality function
...

this will check if two values are exactly equal

10:57 pm, July 23, 2019
javascript
JS Using typeof to check on string types
...

you can use the typeof operator to check what kind of variables you have.

2:38 am, July 23, 2019
javascript
testing equality
...

showing the difference between == and === operators

5:57 am, July 22, 2019
javascript
defining a variable inside a function without using var will create a global variable
...

here is an example showing a variable defined within a function showing how it becomes a global variable if not defined with var

5:15 am, July 22, 2019
javascript
add something to the start of an array with unshift
...

unshift is the opposite of push where push adds to the end of an array unshift will add to the start of the array.

2:40 am, July 19, 2019
javascript
remove the first element in an array with shift
...

like pop but shift does the 1st element in an array

2:37 am, July 19, 2019
javascript
document ready javascript standalone version no jquery
...

this is a version of a dom ready or document ready that does not require jquery

1:14 am, July 17, 2019
javascript
add a class to a div with an id javascript
...

a one liner to add a class name to an element with a specific id, for this to run it seems to need a document ready.

1:11 am, July 17, 2019
javascript
using local storage rather than cookies to store data (localStorage)
...

you can see what is stored in local storage by typing this into your browser console. localStorage Adding something You can add something to local storage by using the setItem function.

11:31 pm, July 16, 2019
javascript
remove something from the end of an array with pop
...

pop is the opposite of push and will remove the last item in an array, it also returns the value so you can assign it to a variable

5:58 am, July 16, 2019
javascript
add something to the end of an array with push
...

you can easily add to the end of a javascript array with the .push function.

5:49 am, July 16, 2019
javascript
Multidimensional Array
...

sounds complex, but it's not really here is an example of a Multidimensional Array in javascript. It's just one array nested in another.

4:50 am, July 16, 2019
javascript
get the last letter of a string
...

you can use the .length and the index of a string to get its last value

4:40 am, July 16, 2019
javascript
accessing part of a variable using its index
...

you can access part of a string variable using its index[1]

4:34 am, July 16, 2019
css
using transform scale in css to zoom on hover over
...

using a css transform will not effect other elements that surround it, so when you mouse over this div (or press it on your phone/tablet) it should scale to 1.5 times its original size.

2:57 am, July 16, 2019
javascript
js check the length of a string
...

using the javascript .length property

2:04 am, July 16, 2019
html
Bootstrap Card Formatting HTML and CSS - Header and Footer
...

just a bootstrap card format with header and footer elements, makes a piece of content neat easily

2:38 am, July 10, 2019
css
Move any element with css offsets
...

Make any element moveable without moving other items around by making it position: relative;

2:31 am, July 9, 2019
css
CSS Improve Compatibility with Browser Fallbacks
...

when using css variables to increase compatibility you should also include a normal color as a default.

2:04 am, July 9, 2019
php
PHP Finding the position of a string in another string using strpos
...

$dot_location = strpos($my_string,"."); The first version of this does not seem to work in all cases, so i have updated this with a working version here.

12:00 am, July 9, 2019
php
PHP str_replace - find and replace part of a string
...

basic usage for the str_replace php function str_replace ( mixed $search , mixed $replace , mixed $subject)

11:52 pm, July 8, 2019
css
using scroll-behavior: smooth css
...

This is a nice example of smooth scroll using just css. You can add it to the page by adding it to the html element html { scroll-behavior: smooth; } for this demo I will add some padding to ..

2:33 am, July 8, 2019
jquery
jquery click function
...

Bind something to a click event on an element using jquery. Needs to be combined with a document ready.

5:33 am, July 3, 2019
css
using a css grid area template
...

here we can specify areas for the grid. using grid-template-areas. once the areas are defined we can add the items into each area with grid-area: header in each element Use grid-area Without Creatin..

2:26 am, July 3, 2019
css
grid column and row spacing
...

here we add some additional spacing to our grid, we can get certain cells to take up 2 parts of the grid using grid-column: 1 / 3; to get box number 5 to take up 2 cols we can add grid-column: 2 / 4..

2:14 am, July 3, 2019
php
Random string generator function in php suniqid
...

Here is a a smaller version of the built in php function uniqid() uses letters and numbers and specify the length of the random string.

1:13 am, July 3, 2019
css
CSS Grid - Basic Columns
...

Here is a basic demo showing the usage for css grid columns. You just need to add the display:grid property and then add the grid-template-columns: adding the size of each column, adding a value for e..

5:59 am, July 2, 2019
css
flex shorthand css
...

flex can be short handed under the flex property. For example, flex: 2 0 20px; will set the item to flex-grow: 2;, flex-shrink: 0;, and flex-basis: 20px;. The following class examples both do the sa..

2:24 am, July 2, 2019
css
using flexbox to align elements in a row
...

flexbox is so good at aligning elements, yes i used to use float left and then percentages and overflow auto or hidden the surrounding div, but now with flex you can just do something like this.

1:37 am, July 2, 2019
css
Viewport width and height calculations
...

Rather than using px and em you can also use the vw and vmin to resize elements which depend on the width and height of the display.

12:30 am, July 2, 2019
css
Making Images Retina Display Friendly
...

Have you ever noticed images look a bit blurry on your high res screen? Sometimes this is referred to as a "Retina" display... Its probably because the image used is exactly the pixels made for a regu..

12:14 am, July 2, 2019
css
Making an image responsive using css
...

the following css will make an image display 100% its size and keep its aspect ratio if the screen size or element size gets smaller than the containing image. you should be able to drag the edge of t..

12:03 am, July 2, 2019
html
Applied Accessibility - Tab Index
...

using the tabindex property on elements allows you to press the tab key while on the page and tab through the elements depending on the order specified by the tabindex. tab index can be applied to man..

11:52 pm, July 1, 2019
html
Applied Accessibility - Access Keys
...

Access keys can be applied to link elements and in chrome you can access them by pressing ALT+ SHIFT + [accesskey] for some reason when testing this in chrome the a key was not accessible, but g and ..

11:40 pm, July 1, 2019
css
Applied Accessibility - Screen reader only css
...

This is how a screen reader only css markup can be added. The content will still be available to screen reader clients.

11:24 pm, July 1, 2019
html
Dropdown Box with Searchable Text
...

Here we have a dropdown select box, that you can type into to search the available options. No Javascript Required for this the browser does all the work. Press into the text box, and you will see a..

11:57 pm, June 30, 2019
jquery
Change link target with JQuery
...

this will change the link href target to # on document load rather than its original link

12:17 am, June 28, 2019
css
Drop Down Menu Swapping Left align to Right
...

this is useful if you have a nav that hits the right side of the screen and you want it to open on the left rather than the right side. you can see on the very right drop down item opens with its item..

5:36 am, June 26, 2019
tools
Whois Lookup
...

1:00 am, June 24, 2019
Welcome

This is my test area for webdev. I keep a collection of code snippits here, mostly for my reference. Also if i find a good site, i usually add it here.

âĪðŸ‘Đ‍ðŸ’ŧðŸ•đ

Random Quote
In this case my anchor this week becomes driving almost 2hrs outside of Atlanta to one of my favorite hard core gyms in the world.. MetroFlex aka The Dungeon. The gym owners turn the heat way up so it becomes a fun sweat box and the gym members just watch from afar and leave me alone. I happily drive myself long distances to find MY ANCHOR. Our anchor allows us to have balance, focus and be as productive as possible. And if you're in the middle of a heavy set and your headphones start to fall off your head, like mine did here.. well.. f*ck the headphones. Let em break and fall. You can always get a new pair, but the iron ain't ever gonna lift itself.
Unknown