Skip to content

Instantly share code, notes, and snippets.

@AucT
AucT / event.video.youtube.js
Created January 12, 2016 15:23 — forked from benwong/event.video.youtube.js
YouTube iFrame API wrapper for event videos
var EventYouTubeVideo = (function(){
var module = {};
module.init = function(){
var tag = document.createElement('script');
tag.src = "http://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
};
@AucT
AucT / youtube-api-js.html
Created January 12, 2016 15:24
Youtube API js example
<iframe id="player" type="text/html" width="640" height="390"
src="https://www.youtube.com/embed/8tEyAAniu5U?enablejsapi=1"
frameborder="0"></iframe>
<iframe id="player2" type="text/html" width="640" height="390"
src="https://www.youtube.com/embed/pt8VYOfr8To?enablejsapi=1"
frameborder="0"></iframe>
<script>
@AucT
AucT / youtube_iframe.html
Created August 23, 2016 15:54
Youtube Iframe load on thumb click
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Youtube Iframe load on thumb click</title>
<style>
.youtube {
position: relative;
padding-bottom: 56.25%;
@AucT
AucT / page_generation_time.php
Last active September 3, 2016 16:57
simple page generation time
<?php
$time_start = microtime(true);
//Your Content (i use sleep 2 seconds to for demo)
sleep(2);
$time_end = microtime(true);
<?php
//Add 1 year
$future = date('Y-n-j', mktime(0,0,0, date('m'), date('d'), date('Y')+1));
echo $future;
<?
$time_start = microtime(true);
//Your Content (i use sleep 2 seconds to for demo)
sleep(2);
$time_end = microtime(true);
$time = $time_end - $time_start;
echo 'Page generated in: '.$time.' seconds';
@AucT
AucT / decompact.php
Last active December 12, 2019 10:03
decompact - replace php compact with array
<?php
function decompact(...$params)
{
$minimumParamsForNewLines = 4;
$newLine = "\n";
if (count($params) < $minimumParamsForNewLines) {
$newLine = '';
}
@AucT
AucT / bootstrap4-social-button-colors.css
Created January 13, 2020 12:04
css bootstrap 4 social buttons color
.btn-google {
color: #fff;
background-color: #dc4639;
border-color: #dc4639;
}
.btn-google:hover {
color: #fff;
background-color: #cb3124;
border-color: #c02f22;
}
<?php
/**
* Takes in a filename and an array associative data array and outputs a csv file
* @param string $fileName
* @param array $assocDataArray
*/
public function outputCsv($fileName, $assocDataArray)
{
ob_clean();
@AucT
AucT / php_interval_to_minutes_seconds.php
Created December 27, 2020 11:10
Convert php Interval (ISO8601) to seconds function, Convert php Interval (ISO8601) to minutes function
<?php
function ISO8601ToSeconds($ISO8601){
$interval = new \DateInterval($ISO8601);
return ($interval->d * 24 * 60 * 60) +
($interval->h * 60 * 60) +
($interval->i * 60) +
$interval->s;
}
function ISO8601ToMinutes($ISO8601){