Skip to content

Instantly share code, notes, and snippets.

View Kudratullah's full-sized avatar

Kudratullah Kudratullah

View GitHub Profile
@Kudratullah
Kudratullah / setup_video_player.php
Last active August 29, 2015 14:05
SetUp Video Player For Browser
<?php
/*
* This Function Is InComplete.
* @param video url string;
* @return mixed;
**/
//$url="https://www.youtube.com/embed/Tgb0jK143MI";
//$url = 'https://www.youtube.com/embed/FblnhqYEae0';
$url ="https://www.youtube.com/watch?v=Hg8Fa_EUQqY&index=23&list=PLDu39zhqv26ILpsfB1INvhqqsBvSdI6wG";
//$url = 'http://vimeo.com/channels/staffpicks/97916782';
// jQuery Headers support for $.ajax
$.ajax({
beforeSend: function(xhrObj){
xhrObj.setRequestHeader("Content-Type","application/json");
xhrObj.setRequestHeader("Accept","application/json");
}
type: "POST",
url: "/article",
processData: false,
#!/usr/bin/php
<?php
/*
* Convert JSON file to CSV and output it.
*
* JSON should be an array of objects, dictionaries with simple data structure
* and the same keys in each object.
* The order of keys it took from the first element.
*
* Example:
@Kudratullah
Kudratullah / unicode2html.php
Last active February 22, 2017 20:16
Convert UniCode Escape Character to UTF-8
<?php
// Works Perfict
function uni2html($string){
//preg_replace(): Compilation failed: PCRE does not support \L, \l, \N{name}, \U, or \u at offset 1.
//so can't use $string = preg_replace('/\\u([0-9A-Za-z]+)/', '&#x$1;', $string); directly.
$string = explode('\\', $string);
$string = implode('%', $string);
$string = preg_replace('/%u([0-9A-Za-z]+)/', '&#x$1;', $string);
return html_entity_decode($string, ENT_COMPAT, 'UTF-8');