Skip to content

Instantly share code, notes, and snippets.

View onigetoc's full-sized avatar

Gino onigetoc

View GitHub Profile
@onigetoc
onigetoc / event.video.youtube.js
Created September 7, 2017 13:05 — 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);
};
// dropzoneWordpressForm is the configuration for the element that has an id attribute
// with the value dropzone-wordpress-form (or dropzoneWordpressForm)
// Install and activate the plugin, and use the `[dropzonejs]` shortcode to display the drop zone.
Dropzone.options.dropzoneWordpressForm = {
//acceptedFiles: "image/*", // all image mime types
acceptedFiles: ".jpg", // only .jpg files
maxFiles: 1,
uploadMultiple: false,
maxFilesize: 5, // 5 MB
//addRemoveLinks: true,
@onigetoc
onigetoc / gist:d499d56cdcea9a81eaa693901027d6f2
Created March 20, 2017 18:09
JavaScript: Sorting and filtering data with AngularJS
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>AngularJS Sorting &amp; Filtering Example</title>
<style type="text/css">
body{ font:12px arial, sans-serif; line-height:1.6em; margin:0 auto; max-width:960px; }
@onigetoc
onigetoc / index.html
Created February 20, 2017 21:58 — forked from anonymous/index.html
Youtube html5 audio Radio player
<div style="display:flex;justify-content:center;align-items:center;">
<div style="width:400px;height:300px;">
<div data-video="uNN6Pj06Cj8" data-autoplay="1" data-loop="1" id="youtube-audio"></div>
<div style="clear:both;margin:10px;text-align:center">
<p>The audio player is created with the YouTube API.</p>
<p>Read Tutorial: <a href="http://www.labnol.org/internet/youtube-audio-player/26740/">YouTube Audio Player</a></p>
</div>
</div>
</div>
@onigetoc
onigetoc / README.md
Created January 25, 2017 03:52 — forked from jlengstorf/README.md
Adds responsive embedding to WordPress oEmbed content.

Responsive Embeds in WordPress

This snippet filters oEmbed output in WordPress (the_content()) to force responsive embeds.

Usage

To use, add the contents of responseive_embeds.less to your site's stylesheet (if you're not using LESS, don't forget to move the iframe,object,embed rule outside of .embed-container and change it to .embed-container iframe,.embed-container object,.embed-container embed).

Then add the responsive_embed() function to your theme's functions.php and insert the add_filter() call in your theme's setup function.

@onigetoc
onigetoc / autoembed-example.php
Created January 24, 2017 01:19 — forked from joshhartman/autoembed-example.php
AutoEmbed PHP Class to parse a string for URLs on their own line and use oEmbed to embed remote content based on the URL
<!DOCTYPE html>
<html>
<head>
<title>AutoEmbed Examples</title>
</head>
<body>
<h1>AutoEmbed Examples</h1>
<?php
$content = "
<p>Have a laugh...</p>
@onigetoc
onigetoc / remove-billing.php
Created January 3, 2017 16:04 — forked from jgalea/remove-billing.php
Remove billing details from WooCommerce checkout.
<?php
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
unset($fields['billing']['billing_first_name']);
unset($fields['billing']['billing_last_name']);
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_address_1']);
unset($fields['billing']['billing_address_2']);
<?php
/**
* get_columns_array
*
* Columns for the loop, single function interface (limited)
*
* Copyright (c) 2011 hakre <http://hakre.wordpress.com/>, some rights reserved
*
* USAGE:
@onigetoc
onigetoc / get_hot_tag.html
Created December 1, 2016 08:34 — forked from hideokamoto/get_hot_tag.html
Get Plugin-Data fromWordPress.org API
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<div class="wp_org_api"></div>
<script>
//setUp Post Data
var actionType = 'hot_tags';
var number = 10;
var timeout = 15;
//Parse Post Data
var postData = {
@onigetoc
onigetoc / php-regex-favicon.php
Created November 1, 2016 16:09
How to PHP regex match an HTML document's declared favicon
<?php
function parseFavicon($html) {
// Get the 'href' attribute value in a <link rel="icon" ... />
// Also works for IE style: <link rel="shortcut icon" href="http://www.example.com/myicon.ico" />
// And for iOS style: <link rel="apple-touch-icon" href="somepath/image.ico">
$matches = array();
// Search for <link rel="icon" type="image/png" href="http://example.com/icon.png" />
preg_match('/<link.*?rel=("|\').*icon("|\').*?href=("|\')(.*?)("|\')/i', $html, $matches);
if (count($matches) > 4) {