Skip to content

Instantly share code, notes, and snippets.

View hazrulazhar's full-sized avatar

Haz AJ hazrulazhar

View GitHub Profile

Keybase proof

I hereby claim:

  • I am hazrulazhar on github.
  • I am hazrulazhar (https://keybase.io/hazrulazhar) on keybase.
  • I have a public key ASA_VHWsfT1fTihuzOKoCJMK_moqePl1W17C8V-8yijWbwo

To claim this, I am signing this object:

@hazrulazhar
hazrulazhar / gs-postalcode2coords
Created November 13, 2018 21:50
Google Apps Script to Geocode a Postal Code and Save the result in Google Sheets
function FillLatitudexLongitude() {
var spreadsheet = SpreadsheetApp.getActive();
var postalcodes = spreadsheet.getRange('F:F').activate().getValues();
for(var i = 1; i < postalcodes.length; i++)
{
postalcode = postalcodes[i];
url = 'https://developers.onemap.sg/commonapi/search?searchVal='+postalcode+'&returnGeom=Y&getAddrDetails=N&pageNum=1';
var response = UrlFetchApp.fetch(url, {'muteHttpExceptions': true});
@hazrulazhar
hazrulazhar / htaccess-wpredirect.txt
Last active June 27, 2018 15:17
Redirect everything to new domain except root and wp-* directories for WordPress sites
<IfModule mod_rewrite.c>
# BEGIN redirect to homepage
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/$
RewriteCond %{REQUEST_URI} !\.(gif|jpe?g|png|css|js|php)$
RewriteCond %{REQUEST_URI} !^/wp-admin [NC]
RewriteRule .* https://www.newdomain.com [L,R=301]
#END redirect to homepage
</IfModule>