Skip to content

Instantly share code, notes, and snippets.

View sionex-code's full-sized avatar
🎯
Focusing

sionex-code

🎯
Focusing
View GitHub Profile
@sionex-code
sionex-code / Youtube Duration Converstion
Created November 8, 2014 15:49
Youtube Accurate Duration Conversion PHP Snippet
function AccurateDuration($ytDuration) {
$di = new DateInterval($ytDuration);
// h i s
$dur = '';
if (!$di->h == 0){
if (strlen($di->h) == 1){
$dur .= '0'.$di->h.':';
}else{
$dur .= $di->h.':';
@sionex-code
sionex-code / addition.php
Created October 14, 2014 22:37
Simple Addition Function Without Arguments in php
<?php
/*
simple function to get addition of some or more varible at once without doing much coding
just use addition(2,3,4,3/4,2-1); you can use what ever you want
*/
function addition(){
$output = 0;
$arguments = func_get_args();
foreach ($arguments as $arg){
$output += $arg;
@sionex-code
sionex-code / Embed_Gen
Last active June 18, 2021 00:13
Videosharing Website Embed Code Generator PHP
<?php
/*
Snippet Name: Embed Code Generator
Author: Muhammad Yaser
Description: this is simple class that will generate videos embed tags. width and height is not included in iframe tags.
you need to use fitvid.js. fitvids is jQuery Plugin this will alow you to auto resize video player in a container.
you are allowed to use this file anywhere you want. you are allowed to modify this file without any restriction.
you are allowed to use this file in commerical project.
Supported filehost: only 7 videosharing website are supported.
/*
this simple snippets will give you downloadable url of soundcloud.
just slap soundcloud url like this way in csharp Download('Soundcloud url'); this will returned downloadable url
*/
public string Download(string songurl){
string returned = null;
HttpWebRequest hc = (HttpWebRequest)WebRequest.Create(songurl);
hc.UserAgent = "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36";
HttpWebResponse hresponse = (HttpWebResponse)hc.GetResponse();
System.IO.StreamReader sr = new System.IO.StreamReader(hresponse.GetResponseStream());