Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Htain Lin Shwe saturngod

💭
I may be slow to respond.
View GitHub Profile
@saturngod
saturngod / BunnyVOD.php
Last active Oct 13, 2020 — forked from ToshY/BunnyVOD.php
BunnyCDN VOD HLS Token Authentication V2 with directory tokens
View BunnyVOD.php
<?php
function sign_bcdn_url($url, $securityKey, $expiration_time = 3600, $user_ip = NULL, $is_directory_token = false, $path_allowed = NULL, $countries_allowed = NULL, $countries_blocked = NULL)
{
if(!is_null($countries_allowed))
{
$url .= (parse_url($url, PHP_URL_QUERY) == "") ? "?" : "&";
$url .= "token_countries={$countries_allowed}";
}
if(!is_null($countries_blocked))
@saturngod
saturngod / shouldupdate.kt
Created Jul 24, 2019
Check version compare to update or not
View shouldupdate.kt
fun shouldUpgrade(server_version: String, app_version: String): Boolean {
if (server_version == app_version) {
return false
}
val versions = server_version.split(".")
val apps = app_version.split(".")
@saturngod
saturngod / binhex.kt
Last active Apr 6, 2018
bin2hex and hex2bin
View binhex.kt
//bin2hex and hex2bin with Kotlin
import javax.xml.bind.DatatypeConverter
fun bin2hex(byteArray: ByteArray): String {
return DatatypeConverter.printHexBinary(byteArray);
}
fun hex2bin(binary: String): ByteArray {
return DatatypeConverter.parseHexBinary(binary)
@saturngod
saturngod / en2mmno.kt
Created Nov 28, 2017
English Number to Myanmar Number
View en2mmno.kt
/**
* Created by saturngod on 28/11/17.
*/
fun main(args:Array<String>) {
var k = "49085678237896"
print(getMMNumber(k))
View bubblesort.mm
NSMutableArray *res2 = [[NSMutableArray alloc] initWithArray:@[@2,@34,@452,@45,@234,@6,@3,@1,@343,@543,@23,@2,@34,@452,@45,@234,@6,@3,@1,@343,@543,@23,@2,@34,@452,@45,@234,@6,@3,@1,@343,@543,@23,@2,@34,@452,@45,@234,@6,@3,@1,@343,@543,@23]];
int passnum = res2.count -1 ;
BOOL exchange = YES;
NSDate *date = [NSDate date];
while (passnum >0 && exchange) {
exchange = false;
for (int i = 0 ; i < passnum ; i++)
View uibarbuttonwithimage.mm
UIImage *chatImage = [UIImage imageNamed:@"08-chat.png"];
UIButton *chatButton = [UIButton buttonWithType:UIButtonTypeCustom];
[chatButton setBackgroundImage:chatImage forState:UIControlStateNormal];
[chatButton setTitle:@"Chat" forState:UIControlStateNormal];
chatButton.frame = (CGRect) {
.size.width = 100,
.size.height = 30,
};
View VerbalExpressions_Math.js
var tester = VerEx()
.then( "http" )
.maybe( "s" )
.then( "://" )
.maybe( "www." )
.anythingBut( " " );
// Create an example URL
var testMe = "This is testing. https://www.google.com is a URL. http://www.facebook.com also URL.";
var result = testMe.match(tester);
@saturngod
saturngod / myanmartext.js
Created Feb 13, 2013
check myanmar text or not
View myanmartext.js
var regexMM = new RegExp("[\u1000-\u109f\uaa60-\uaa7f]+");
var text = "မြန်မာ";
if (!regexMM.test(text)) {
console.log("not myanmar text");
}
else {
console.log("myanmar text");
}
View mahabote.php
<?php
$arr[0] ="အဓိပတိ";
$arr[1] = "ဘင်္ဂ";
$arr[2] = "မရဏ";
$arr[3] = "အထွန်း";
$arr[4] = "သိုက်";
$arr[5] = "ရာဇ";
$arr[6] = "ပုတိ";
$n = 5; // modulo
@saturngod
saturngod / samplepush.php
Created Jan 24, 2013
apple sample push notification
View samplepush.php
<?php
$deviceToken = '0a7d65e6 b621fbf2 7fb43b23 cb673af5 d689fdfa d2f9a8b2 59d2f507 f1e72a9c';
$payload['aps'] = array('alert' => 'push message suppose to be here but not here yet', 'title' =>'Im Title', 'badge' => 1, 'sound' => 'default', 'category' => 'notification');
$payload = json_encode($payload);
echo $payload."<br/>";
You can’t perform that action at this time.