Chris West's Blog

  • Home
  • Site Search
  • About Me
  •  YourJS
  • Search for:

Tag: Function

Blog

JavaScript Snippet – suffixFileSize()

If you would like to convert the amount of bytes (or bits) into the corresponding measure when the size is a kilobyte or bigger (or a kilobit or bigger) you can use the following JavaScript function: Here are some examples of using it: If you would like to know how Read more…

By Chris West, 8 years ago April 6, 2018
Blog

JavaScript Snippet – isPowerOf(x, base)

After reading this reddit entry I decided to write up a little snippet with documentation: Feel free to use it whenever and wherever. Happy coding! 😎

By Chris West, 8 years ago March 20, 2018
Blog

JavaScript Snippet – Remove Duplicate Characters from Strings

If you ever need to remove all duplicate characters from a string you can use this snippet which takes advantage of how the String.prototype.replace() function works along with regular expressions: Feel free to use this function in your code. Happy coding 😎

By Chris West, 8 years ago January 6, 2018
Blog

HTML5 – Getting More Volume from the Web Audio API

Did you know that thanks to the Web Audio API it is possible to boost the volume up PAST 100% on <audio> tags & <video> tags? I wrote the following function to do just that: The above JavaScript function gives us the ability to amplify (or boost) the volume of Read more…

By Chris West, 9 years ago August 17, 2017
Blog

JavaScript Snippet – Select Text In Any Element

The following function takes one arguments, an element, and selects the text therein: Happpy coding! 😎

By Chris West, 9 years ago July 15, 2017
Blog

JavaScript Snippet – Get Video Frame As An Image

Lately I have dedicated a little more time to developing an electron app which saves a frame of every video it encounters as PNG images: Believe it or not the code to turn a frame of a video into an image element is not terribly complicated. Below is a simple Read more…

By Chris West, 9 years ago May 3, 2017
Blog

JavaScript Snippet – toggleFullscreen()

Making your web app toggle back and forth between full screen mode is a simple enough task as long as you do some feature testing. You can also use this handy function which will step through the 4 different feature tests: This code is based off of documentation found here Read more…

By Chris West, 9 years ago April 26, 2017
Blog

JavaScript Snippet – Convert HTML Table To 2D Array

A few days ago I was working on manipulating data that I found in Wikipedia. The data was in a table where the colspans and rowspans were making it difficult to simply programmatically pull data. Then I started looking into code to turn HTML table to JSON but for some Read more…

By Chris West, 10 years ago August 21, 2016
Blog

JavaScript Snippet – isValidVarName()

Now Available in YourJS Recently I was working on a function which needed to determine whether or not a string could be used as a variable name. Variable name validation can get tricky so instead of using a crazy regular expression which includes all keywords (which may change over time) Read more…

By Chris West, 10 years ago August 17, 2016
Blog

JavaScript – Detecting Infinite Loops

When allowing a user to input code that could potentially cause an infinite loop, it is nice to test the code first, right? Even, if the code doesn’t run infinitely, it would be nice to know if it takes longer than you would want. One way to nicely test for Read more…

By Chris West, 10 years ago March 16, 2016

Posts navigation

Previous 1 2 3 … 14 Next
Meta
  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
Archives
Categories
Blog (347) CSharp (1) Games (3) HTA (2) Java (5) JavaScript (220) JScript (149) Math (49) Microsoft Office (16) Movie Trailers (2) PHP (13) POW Answer (2) Problem of the Week (31) Python (15) Reporting (1) Salesforce (7) SQL (28) VBA (6) VBScript (8) Videos (10)
Tags
Apache (1) Apex (4) Array (37) Audio (2) Bash (3) Canvas (7) Chrome (3) CSS (12) CSS3 (2) Curry (1) Date (6) EcmaScript 6 (8) Encryption (2) Español (2) Excel (20) Function (136) GitHub (12) Hack (9) HTML (4) HTML5 (2) JasperReport (2) JasperServer (1) jPaq (35) JSON (2) JSONP (2) JW.org (5) Logic Puzzle (2) LWC (2) Mail Merge (1) Math (53) OAuth (2) OpenKM (2) PostgreSQL (27) Private Data (4) Problem of the Week (31) Prototype (41) Quirk (3) Recursion (10) Regular Expressions (22) Salesforce (2) String (62) Video (2) Wildcards (3) WScript (2) YourJS (18)
  • About Me
Hestia | Powered by WordPress