Skip to content

Instantly share code, notes, and snippets.

View pradipchitrakar's full-sized avatar

Pradip pradipchitrakar

View GitHub Profile
@pradipchitrakar
pradipchitrakar / BsToAdConverter.ts
Created July 9, 2020 20:48
Converts date in Bikram Sambat to A.D. and vice versa in typescript/javascript.
export class NepaliDateConverterService {
nums = {
0: '०',
1: '१',
2: '२',
3: '३',
4: '४',
5: '५',
6: '६',
7: '७',
@pradipchitrakar
pradipchitrakar / NepaliToEnglishDateConverter.php
Created July 9, 2020 20:39
Converts date in Bikram Sambat (B.S.) to A.D. and vice versa.
<?php
class NepaliDateConverter
{
// Data for nepali date
private $_bs = array(
0 => array(2000,30,32,31,32,31,30,30,30,29,30,29,31),
1 => array(2001,31,31,32,31,31,31,30,29,30,29,30,30),
2 => array(2002,31,31,32,32,31,30,30,29,30,29,30,30),
3 => array(2003,31,32,31,32,31,30,30,30,29,29,30,31),
4 => array(2004,30,32,31,32,31,30,30,30,29,30,29,31),
@pradipchitrakar
pradipchitrakar / decrypt.js
Last active November 4, 2021 19:07
AES Encrypt data in php and decrypt in node js.
//require cyrpto module
var crypto=require('crypto');
//key and iv should be same as the one in encrypt.php
var decipher=crypto.createDecipheriv('aes-256-cbc','12345678901234561234567890123456','1234567890123456');
//since we have already added padding while encrypting, we will set autopadding of node js to false.
decipher.setAutoPadding(false);
// copy the output of encrypt.php and paste it below