Skip to content

Instantly share code, notes, and snippets.

View nickeykhem's full-sized avatar

Nickey nickeykhem

View GitHub Profile
@nickeykhem
nickeykhem / directmp3donwload
Created April 24, 2023 23:12
Download mp3 files instead of opening in browsers to play
<a href="https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3" download>Download MP3 file to your device</a>
@nickeykhem
nickeykhem / findStringAndRemoveRow.gs
Created May 21, 2021 06:13
Delete rows containing a certain string/text
function findStringAndRemoveRow() {
var sheet = SpreadsheetApp.getActiveSheet();
var data = sheet.getRange("A:A"); //Add the range you want to search, here it searches the whole column A
for (var i = 1; i < data.getLastRow(); i++) {
if(data.getCell(i,1).getValue().indexOf("text")!=-1){ //replace text with whatever string you are looking for
sheet.deleteRow(i);
}
}
}
@nickeykhem
nickeykhem / overflowDetect.js
Created April 21, 2021 01:09
Snippet for detecting overflow issues in CSS
var docWidth = document.documentElement.offsetWidth;
[].forEach.call(
document.querySelectorAll('*'),
function(el) {
if (el.offsetWidth > docWidth) {
console.log(el);
}
}
);
@nickeykhem
nickeykhem / chmod400-on-windows-powershell.cmd
Created February 1, 2021 03:57
How to CHMOD 400 on Windows Powershell for AWS .pem files
#Replace FILEname with the pem filename you are setting chmod400 for.
#Note that this implies that the pem file is in the active directory root
icacls.exe .\FILENAME.pem /reset
icacls.exe .\FILENAME.pem /grant:r "$($env:username):(r)"
icacls.exe .\FILENAME.pem /inheritance:r
@nickeykhem
nickeykhem / accessToCartObject.php
Last active February 1, 2021 03:57
WooCommerce: Easily Get Product Info (ID, SKU, $) from $product Object
<?php
// Get $product object from Cart object
$cart = WC()->cart->get_cart();
foreach( $cart as $cart_item ){
$product = wc_get_product( $cart_item['product_id'] );
// Now you have access to (see above)...