Skip to content

Instantly share code, notes, and snippets.

@gorobey
gorobey / wp-disable-plugin-update.php
Created April 3, 2019 10:21 — forked from rniswonger/wp-disable-plugin-update.php
WordPress - Disable specific plugin update check
/**
* Prevent update notification for plugin
* http://www.thecreativedev.com/disable-updates-for-specific-plugin-in-wordpress/
* Place in theme functions.php or at bottom of wp-config.php
*/
function disable_plugin_updates( $value ) {
if ( isset($value) && is_object($value) ) {
if ( isset( $value->response['plugin-folder/plugin.php'] ) ) {
unset( $value->response['plugin-folder/plugin.php'] );
}
@gorobey
gorobey / fix-git-line-endings
Created February 26, 2019 13:50 — forked from ajdruff/fix-git-line-endings
Forces all line endings to LF in your git repo.
#####################
#
# Use this with or without the .gitattributes snippet with this Gist
# create a fixle.sh file, paste this in and run it.
# Why do you want this ? Because Git will see diffs between files shared between Linux and Windows due to differences in line ending handling ( Windows uses CRLF and Unix LF)
# This Gist normalizes handling by forcing everything to use Unix style.
#####################
# Fix Line Endings - Force All Line Endings to LF and Not Windows Default CR or CRLF
@gorobey
gorobey / php-html-css-js-minifier.php
Created December 7, 2018 16:31 — forked from Rodrigo54/php-html-css-js-minifier.php
PHP Function to Minify HTML, CSS and JavaScript
<?php
/**
* -----------------------------------------------------------------------------------------
* Based on `https://github.com/mecha-cms/mecha-cms/blob/master/system/kernel/converter.php`
* -----------------------------------------------------------------------------------------
*/
// HTML Minifier
function minify_html($input) {
@gorobey
gorobey / rapidDefer.js
Created November 23, 2018 14:15 — forked from mouse0270/rapidDefer.js
Defer Inline Javascript
// With $script variable
$(document).ready(function() {
$('script[type="text/javascript/defer"]').each(function() {
var $script = $('<script type="text/javascript"/>').text($(this).clone().text());
$(this).after($script).remove();
});
});
// Without $script variable
$(document).ready(function() {
@gorobey
gorobey / gist:237fe068b4574177719e294ca3ec9596
Created November 20, 2018 16:50 — forked from dpapathanasiou/gist:4329613
Simple Social Media "Share" Buttons
<div><!-- social media share buttons -->
<a href="http://www.facebook.com/" onclick="window.location = 'http://www.facebook.com/share.php?u=' + encodeURIComponent(window.location); return false"><img src="http://i.imgur.com/aLnZg.png" alt="Share on Facebook" border="0" /></a>
<a href="http://twitter.com/" onclick="window.location = 'http://twitter.com/home/?status=' + encodeURIComponent(window.location); return false"><img src="http://i.imgur.com/oFrLG.png" alt="Tweet This" border="0" /></a>
<a href="http://www.linkedin.com/" onclick="window.location = 'http://www.linkedin.com/shareArticle?mini=true&url=' + encodeURIComponent(window.location); return false"><img src="http://i.imgur.com/mwHNU.png" alt="Share on LinkedIn" border="0" /></a>
<a href="https://plus.google.com/" onclick="window.location = 'https://plus.google.com/share?url=' + encodeURIComponent(window.location); return false"><img src="http://i.imgur.com/tzMMp.png" alt="Share on Google+" border="0" /></a>
@gorobey
gorobey / stripe-checkout.html
Created February 15, 2018 09:10 — forked from ziadoz/stripe-checkout.html
Custom Stripe Checkout Button
<form action="." method="post">
<noscript>You must <a href="http://www.enable-javascript.com" target="_blank">enable JavaScript</a> in your web browser in order to pay via Stripe.</noscript>
<input
type="submit"
value="Pay with Card"
data-key="PUBLISHABLE STRIPE KEY"
data-amount="500"
data-currency="cad"
data-name="Example Company Inc"
@gorobey
gorobey / encoding-video.md
Created November 28, 2017 09:20 — forked from glen-cheney/encoding-video.md
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
@gorobey
gorobey / websql.php
Created July 15, 2017 21:01 — forked from Yaffle/websql.php
Web SQL Database API for PHP
<?php
/* usage:
$db = new Database("mysql:host=" . Config::$dbHost . ";dbname=" . Config::$dbName . ";", Config::$dbName, Config::$dbUser, Config::$dbPass);
$db->changeVersion("", "1", function ($tx) {
$tx->executeSql("CREATE TABLE IF NOT EXISTS `examples` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`example` mediumtext,
PRIMARY KEY (`id`)
@gorobey
gorobey / JSONP_Example.php
Created July 15, 2017 20:55 — forked from therealklanni/JSONP_Example.php
Simple public Web API in PHP using JSONP
<?php
/* JSONP_Example.php
* Author: Kevin Lanni
* Description: Demonstrates how to create a simple public Web API using JSONP responses
* This is useful for opening Web APIs for public use without the need for proxying or other SOP work-arounds.
* This example does not demonstrate API keys or any other method of authentication.
*/
// Supply a header to set the proper expectation for the client browser
header('Content-Type: application/json');
@gorobey
gorobey / custom-action-url.php
Created July 5, 2017 08:45 — forked from jayllellis/custom-action-url.php
Custom Contact Form 7 action URL
<?php
// Place this in your functions.php file
add_filter('wpcf7_form_action_url', 'wpcf7_custom_form_action_url');
function wpcf7_custom_form_action_url(){
return 'send.php';// replace this with the new action url (excluding the 'http://')
}
?>