Blog

Order Array By Int, Float, Text Value Javascript

  var arrayVar = [ { name: ‘Bobby’, someValue: 123123 }, { name: ‘Phillip’, someValue: 123 } ]; arrayVar = arrayVar.sort((a, b) => {return a.someValue – b.someValue}); // save the sort result // (a – b) = Ascending sort, (b – a) = Descending sort console.log(arrayVar); console.log(hon);  

Read more

How To Get Public IP Address from Command line

  curl http://ipecho.net/plain  

Read more

Speech Recognition With Javascript

  var grammar = ‘#JSGF V1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | […]

Read more

Books Without Batteries

Read more

Extract JSON String from Page Element with Javascript

var somePageElement = ‘{ “name”:”John”, “age”:30, “car”:”Tesla” }’; var jsonString = ‘[‘ + somePageElement.split(‘[‘)[1].somePageElement(‘]’)[0] + ‘]’;

Read more

Fix Screen Flickering Issus with Lenovo Yoga 2 in Windows

Turn off Adaptive Brightness in Windows power settings.   Turn off Display Power Saving Technology in Intel HD Graphics dialogue.

Read more

Find and Replace Blank Lines VS Code

Press Ctrl + H In “Find” Section type ^(\s)*$\n\n In the Replace Section make sure it’s blank Click Replace Go have a cup of coffee

Read more

Recursively Fix Non-ASCII Characters with Windows Power Shell

Simnple replace “your-directory” with the path you want. Or can you run in the directory you are currently in by using “.” no quotes. Happy coding. gci -recurse your-directory | where {$_.Name -match “[^\u0000-\u007F]”} | rename-item -newname {$_.name -replace “[^\u0000-\u007F]”,”1″}

Read more
PHP Functions

Randomly Generate Readable Password

function auth_pwgen(){ $pw = ”; $c = ‘bcdfghjklmnprstvwz’; //consonants except hard to speak ones $v = ‘aeiou’; //vowels $a = $c.$v; //both //use two syllables… for($i=0;$i < 2; $i++){ $pw .= $c[rand(0, strlen($c)-1)]; $pw .= $v[rand(0, strlen($v)-1)]; $pw .= $a[rand(0, strlen($a)-1)]; } //... and add a nice number $pw .= rand(10,99); return $pw; }

Read more

Convert GPT to MBR Windows

Master boot record (MBR) disks use the standard BIOS partition table. GUID partition table (GPT) disks use unified extensible firmware interface (UEFI). MBR disks do not support more than four partitions on each disk. The MBR partition method is not recommended for disks larger than 2 terabytes. You can change a disk from GPT to […]

Read more