Skip to content

Instantly share code, notes, and snippets.

@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://')
}
?>
@gorobey
gorobey / responsive-align.less
Created June 15, 2017 08:43 — forked from ohryan/responsive-align.less
Bootstrap 3 Responsive Text Align
.text-xs-left { text-align: left; }
.text-xs-right { text-align: right; }
.text-xs-center { text-align: center; }
.text-xs-justify { text-align: justify; }
@media (min-width: @screen-sm-min) {
.text-sm-left { text-align: left; }
.text-sm-right { text-align: right; }
.text-sm-center { text-align: center; }
.text-sm-justify { text-align: justify; }
@gorobey
gorobey / countries.sql
Created June 2, 2017 13:02 — forked from adhipg/countries.sql
Sql dump of all the Countries, Country Codes, Phone codes.
CREATE TABLE IF NOT EXISTS `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iso` char(2) NOT NULL,
`name` varchar(80) NOT NULL,
`nicename` varchar(80) NOT NULL,
`iso3` char(3) DEFAULT NULL,
`numcode` smallint(6) DEFAULT NULL,
`phonecode` int(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@gorobey
gorobey / dump.sh
Created April 4, 2017 12:56 — forked from andsens/dump.sh
Backup all MySQL databases into separate files
#!/bin/sh
## backup each mysql db into a different file, rather than one big file
## as with --all-databases. This will make restores easier.
## To backup a single database simply add the db name as a parameter (or multiple dbs)
## Putting the script in /var/backups/mysql seems sensible... on a debian machine that is
## Create the user and directories
# mkdir -p /var/backups/mysql/databases
# useradd --home-dir /var/backups/mysql --gid backup --no-create-home mysql-backup
## Remember to make the script executable, and unreadable by others
@gorobey
gorobey / wordpress-change-domain-migration.sql
Created April 1, 2017 19:04 — forked from chuckreynolds/wordpress-change-domain-migration.sql
Use this SQL script when changing domains on a WordPress site. Whether you’re moving from an old domain to a new domain or you’re changing from a development domain to a production domain this will work. __STEP1: always backup your database. __STEP2: change the ‘oldsite.com’ and ‘newsite.com’ variables to your own. __STEP3: make sure your databa…
SET @oldsite='http://oldsite.com';
SET @newsite='http://newsite.com';
UPDATE wp_options SET option_value = replace(option_value, @oldsite, @newsite) WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, @oldsite, @newsite);
UPDATE wp_links SET link_url = replace(link_url, @oldsite, @newsite);
UPDATE wp_postmeta SET meta_value = replace(meta_value, @oldsite, @newsite);
/* only uncomment next line if you want all your current posts to post to RSS again as new */
#UPDATE wp_posts SET guid = replace(guid, @oldsite, @newsite);
@gorobey
gorobey / bootstrap-col-inset.css
Last active July 15, 2017 18:51 — forked from nathanpitman/gist:4038248
Responsive 'insets' / 'negative offsets' for Twitter Bootstrap
.col-xs-inset-12 {
margin-left: -100%;
}
.col-xs-inset-11 {
margin-left: -91.66666667%;
}
.col-xs-inset-10 {
margin-left: -83.33333333%;
}
.col-xs-inset-9 {