Skip to content

Instantly share code, notes, and snippets.

View remoharsono's full-sized avatar

Remo Harsono remoharsono

View GitHub Profile
var locations = [
['Bondi Beach', -33.890542, 151.274856, 4],
['Coogee Beach', -33.923036, 151.259052, 5],
['Cronulla Beach', -34.028249, 151.157507, 3],
['Manly Beach', -33.80010128657071, 151.28747820854187, 2],
['Maroubra Beach', -33.950198, 151.259302, 1]
];
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 10,
//Check if the placeholder is inside an iframe(nested iframe due to some sites auto refresh feature,
//if true redirect to targetUrl.
if(typeof targetUrl === 'undefined' || targetUrl === null){
targetUrl = decodeURIComponent(params["a"]);
}
if (self !== top) {
self.location.href = targetUrl;
}
//Begin:Global Parameters
@remoharsono
remoharsono / detect_change_on_range.vb
Last active August 29, 2015 14:20
Excel VBA script to detect change on certain range of cells
Private Sub Worksheet_Change(ByVal Target As Range)
Dim WatchRange As Range
Dim IntersectRange As Range
Set WatchRange = Range("A1:A10")
Set IntersectRange = Intersect(Target, WatchRange)
If IntersectRange Is Nothing Then
Else
rowNumber = Target.Row
@remoharsono
remoharsono / phpAccessBrowser.php
Last active August 29, 2015 14:20
Simple snippets to browse field information of MS Access database
<!DOCTYPE html>
<html>
<head><title>phpAccessBrowser</title>
<style>
hr {border:1px solid #ccc;}
table th,td {border:solid 1px #ccc;padding:5px;}
table tr:hover {background-color:#00ffff;}
.tablename {font-size:larger;font-weight:bold;margin-bottom:10px;background-color:#ccc;padding:5px;margin-top:-5px;}
</style>
</head>
@remoharsono
remoharsono / undoCellEntry.vb
Created May 24, 2015 09:38
Undo or change user entered value on MS Excel cell change event
Private Sub Worksheet_Change(ByVal Target As Range)
Dim columnNumber As Integer
columnNumber = Target.Column
If columnNumber = 10 Then
Application.EnableEvents = False
'Application.Undo
Target.Value = 0
Application.EnableEvents = True
Debug.Print "OK"
End If
<!DOCTYPE html>
<html>
<head><title></title></head>
<body>
<h3>PROVINSI</h3>
<select>
<option value="">Semua Lokasi</option><option value="17">Aceh</option>
<option value="13">Bali</option>
<option value="15">Bangka-Belitung</option>
<option value="8">Banten</option>
<?php
include 'Classes/PHPExcel.php';
$objPHPExcel = new PHPExcel();
$objPHPExcel->getActiveSheet()->setTitle('The Title');
$objPHPExcel->setActiveSheetIndex(0);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(10);
@remoharsono
remoharsono / download.py
Created August 25, 2015 04:39
download a file using requests
import requests
url = 'http://example.com/file.zip'
local_filename = url.split('/')[-1]
r = requests.get(url, stream=True)
with open(local_filename, 'wb') as f:
for chunk in r.iter_content(chunk_size=1024):
if chunk:
f.write(chunk)
f.flush()
@remoharsono
remoharsono / aes_example.py
Last active June 25, 2016 03:01
Python AES two-way encryption/decryption example
from Crypto.Cipher import AES
import base64
import os
# the block size for the cipher object; must be 16, 24, or 32 for AES
BLOCK_SIZE = 32
# the character used for padding--with a block cipher such as AES, the value
# you encrypt must be a multiple of BLOCK_SIZE in length. This character is
# used to ensure that your value is always a multiple of BLOCK_SIZE
@remoharsono
remoharsono / serialize_deserialize_json.vb
Last active June 25, 2016 03:00
VB.NET Utility Class to Serialize Deserialize Json String
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Runtime.Serialization.Json
Imports System.IO
Imports System.Text
Imports System.Text.RegularExpressions
''' <summary>
''' JSON Serialization and Deserialization Assistant ClassS