Author: nertblox

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

Change Product Key Office

It can be done via the command line.  Open up a Command Prompt (Press the Windows Button and type CMD or navigate to All Programs -> Accessories -> Command Prompt).  Then you just need to use the command below that matches your OS.   For 32 bit Windows: cscript “C:\Program Files\Microsoft Office\Office15\OSPP.VBS” /inpkey:yourkeygoeshere   For […]

Read more

Zoom in with Mouse Wheel Unity 3d

Tested and Works CSharp <code> private float ZoomAmount = 0; //With Positive and negative values private float MaxToClamp = 10; private float ROTSpeed = 10; void Update(){ ZoomAmount += Input.GetAxis(“Mouse ScrollWheel”); ZoomAmount = Mathf.Clamp(ZoomAmount, -MaxToClamp, MaxToClamp); var translate = Mathf.Min(Mathf.Abs(Input.GetAxis(“Mouse ScrollWheel”)), MaxToClamp – Mathf.Abs(ZoomAmount)); gameObject.transform.Translate(0,0,translate * ROTSpeed * Mathf.Sign(Input.GetAxis(“Mouse ScrollWheel”))); } </code> Javascript <code> var […]

Read more

Woocommerce Action List

Template Hooks Actions HOOK FILE(S) get_product_search_form woocommerce-template.php woocommerce_.$product->product_type._add_to_cart woocommerce-template.php woocommerce_after_main_content archive-product.php, single-product.php woocommerce_after_shop_loop archive-product.php, loop-shop.php, woocommerce-template.php woocommerce_after_shop_loop_item content-product.php woocommerce_after_shop_loop_item_title content-product.php woocommerce_after_single_product content-single-product.php woocommerce_after_single_product_summary content-single-product.php woocommerce_after_subcategory content-product_cat.php woocommerce_after_subcategory_title content-product_cat.php woocommerce_archive_description archive-product.php, woocommerce-template.php woocommerce_before_main_content archive-product.php, single-product.php woocommerce_before_shop_loop archive-product.php, loop-shop.php, woocommerce-template.php woocommerce_before_shop_loop_item content-product.php woocommerce_before_shop_loop_item_title content-product.php woocommerce_before_single_product content-single-product.php woocommerce_before_single_product_summary content-single-product.php woocommerce_before_subcategory content-product_cat.php woocommerce_before_subcategory_title content-product_cat.php woocommerce_product_thumbnails product-image.php woocommerce_sidebar archive-product.php, single-product.php […]

Read more

Woocommerce Conditional Tags

Introduction The Conditional Tags of both WooCommerce and WordPress can be used in your Template files to change what content is displayed based on what conditions that page matches. For example, you might want to display a snippet of text above the shop page. With the is_shop() Conditional Tag you can. Since WooCommerce uses custom post types you can […]

Read more