Skip to content

Instantly share code, notes, and snippets.

View cdowebcast's full-sized avatar
🏠
Working from home

CDOWEBCAST cdowebcast

🏠
Working from home
View GitHub Profile
@cdowebcast
cdowebcast / gist:70413e3ffe779c6c3f9d
Created January 7, 2016 05:57 — forked from supermethod/gist:913394
Convert a PHP array into XML file using SimpleXML
class ArrayToXML
{
/**
* The main function for converting to an XML document.
* Pass in a multi dimensional array and this recrusively loops through and builds up an XML document.
* Based on: http://snipplr.com/view/3491/convert-php-array-to-xml-or-simple-xml-object-if-you-wish/
*
* @param array $data
* @param string $rootNodeName - what you want the root node to be - defaultsto data.
* @param SimpleXMLElement $xml - should only be used recursively
@cdowebcast
cdowebcast / parse youtube url
Created May 19, 2016 17:58 — forked from saxap/parse youtube url
parse youtube url and return video id
function parse_youtube_url($url) {
$pattern = '#^(?:https?://)?(?:www\.)?(?:youtu\.be/|youtube\.com(?:/embed/|/v/|/watch\?v=|/watch\?.+&v=))([\w-]{11})(?:.+)?$#x';
preg_match($pattern, $url, $matches);
return (isset($matches[1])) ? $matches[1] : false;
}
@cdowebcast
cdowebcast / youtube_iframe.py
Created May 19, 2016 17:59 — forked from ryonsherman/youtube_iframe.py
Parse Youtube URL, extract video ID, and provide embed iframe.
from urlparse import urlparse, parse_qs
url = urlparse('https://www.youtube.com/watch?v=XXXXXXXXXXX')
if 'youtube' in url.netloc.lower():
video_id = parse_qs(url.query).get('v', [False])[0]
if video_id:
print '<iframe width="560" height="315" src="http://www.youtube.com/embed/{0}" frameborder="0" allowfullscreen></iframe>'.format(video_id)
@cdowebcast
cdowebcast / .htaccess
Created November 17, 2016 23:46 — forked from fael/.htaccess
Exemplo PHPMailer + Tratamento de erros via HTACCESS + Qualquer console JS
# PHP error handling for production servers
# disable display of startup errors
php_flag display_startup_errors off
# disable display of all other errors
php_flag display_errors off
# disable html markup of errors
php_flag html_errors off
@cdowebcast
cdowebcast / AC_RunActiveContent.js
Created November 27, 2016 23:51
Flash Player Version Detection v1.7
//v1.7
// Flash Player Version Detection
// Detect Client Browser type
// Copyright 2005-2007 Adobe Systems Incorporated. All rights reserved.
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
function ControlVersion()
{
@cdowebcast
cdowebcast / JSON_Search
Created February 12, 2017 14:26 — forked from idrisjafer/JSON_Search
JSON Seach by Key or Value or Both
;Transcoder configuration file
;Made with the SHOUTcast 2 Configuration Builder
shuffledebug=1
shoutcastdebug=1
uvoxdebug=1
gaindebug=1
playlistdebug=1
mp3encdebug=1
mp3decdebug=1
@cdowebcast
cdowebcast / parseTitleString.js
Created January 27, 2018 18:47 — forked from martindale/parseTitleString.js
Parse a string, such as a YouTube video title, for artist and track information.
// TODO: provide an array of potential separators
// var SEPARATORS = [' - ', ' – ', ' -- ']
// note that these can have spaces, but sometimes do not
// TODO: output a testing dataset for changes to this function.
var TRACK_SEPARATOR = ' - ';
function parseTitleString(string, partsCallback) {
var artist, title, credits = [];
var string = string || '';
@cdowebcast
cdowebcast / short-number-format.php
Created January 31, 2018 04:20 — forked from RadGH/short-number-format.php
Short Number Formatter for PHP (1000 to 1k; 1m; 1b; 1t)
<?php
// Converts a number into a short version, eg: 1000 -> 1k
// Based on: http://stackoverflow.com/a/4371114
function number_format_short( $n, $precision = 1 ) {
if ($n < 900) {
// 0 - 900
$n_format = number_format($n, $precision);
$suffix = '';
} else if ($n < 900000) {
@cdowebcast
cdowebcast / meta-tags.md
Created October 5, 2018 14:07 — forked from lancejpollard/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">