Skip to content

Instantly share code, notes, and snippets.

View halgatewood's full-sized avatar

Hal Gatewood halgatewood

View GitHub Profile
@mikoim
mikoim / README.md
Last active November 14, 2024 02:07
[Updated! Aug 14 2020] YouTube recommended encoding settings on ffmpeg (+ libx264)

Parameters

Container: MP4

Parameter YouTube recommends setting
-movflags faststart moov atom at the front of the file (Fast Start)

Video codec: H.264

@cklosowski
cklosowski / edd-subsections-example.php
Last active January 7, 2016 22:38
Using EDD 2.5 Setting Tab Subsections
<?php
/**
* Register our settings section
*
* @return array
*/
function ck_edd_settings_section( $sections ) {
// Note the array key here of 'ck-settings'
$sections['ck-settings'] = __( 'Example EDD Extension', 'example-edd-extension' );
@halgatewood
halgatewood / yt_get_video_url.php
Last active August 29, 2015 14:15
Get the streaming video (mp4) for your public YouTube videos. -- Download YouTube videos PHP script.
function get_youtube_video_url( $youtube_id )
{
$data = trim(urldecode(file_get_contents('https://youtube.com/get_video_info?video_id=' . $youtube_id)));
$d = parse_str($data, $info);
$stream_map = trim($info['url_encoded_fmt_stream_map']);
if( !$stream_map ) return false;
if( substr( $stream_map, 0, 4 ) != "url=" )
@hadl
hadl / microtime_diff.php
Last active March 5, 2021 04:05
PHP Microtime Diff -- Calculate a precise time difference
<?php
/**
* Calculate a precise time difference.
* @param string $start result of microtime()
* @param string $end result of microtime(); if NULL/FALSE/0/'' then it's now
* @return flat difference in seconds, calculated with minimum precision loss
*/
function microtime_diff($start, $end = null)
{
if (!$end) {
@yagitoshiro
yagitoshiro / push_notifications.js
Last active August 13, 2016 17:29
apple push notification sample (Titanium Mobile)
//////////////////////push_notifications.js///////////////////////
var apns = function(){
var pref = require('preferences').preferences;
Titanium.Network.registerForPushNotifications({
types: [
Titanium.Network.NOTIFICATION_TYPE_BADGE,
Titanium.Network.NOTIFICATION_TYPE_ALERT
],
success:function(e)
@jakebellacera
jakebellacera / ICS.php
Last active October 11, 2024 10:58
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
<?php
/**
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*