Skip to content

Instantly share code, notes, and snippets.

@rojan
rojan / node_crypto.js
Last active March 19, 2023 15:14
Encrypt in nodejs and decrypt in php or vice versa
var crypto = require('crypto');
var key = 'MySecretKey12345';
var iv = '1234567890123456';
var cipher = crypto.createCipheriv('aes-128-cbc', key, iv);
var decipher = crypto.createDecipheriv('aes-128-cbc', key, iv);
var text = 'plain text';
var encrypted = cipher.update(text, 'utf8', 'binary');
encrypted += cipher.final('binary');
hexVal = new Buffer(encrypted, 'binary');
@rojan
rojan / Google map polygon
Created June 5, 2012 07:16
Google map polygon
<html>
<style>
html, body {
height: 100%;
margin: 0;
padding: 0;
}
@rojan
rojan / multiple marker Google map
Created May 30, 2012 17:22
multiple marker Google map api
<html>
<style>
html, body {
height: 100%;
margin: 0;
padding: 0;
}
#map_canvas {
@rojan
rojan / zip to lat, lng and address
Created May 30, 2012 17:16
converts zip_code to lat long and formatted address using google api.
https://developers.google.com/maps/faq#geocoder_limit
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script>
/*
*cannot send many query at a time. google api has query limit.
*https://developers.google.com/maps/faq#geocoder_limit
*/
var geocoder = new google.maps.Geocoder();