Skip to content

Instantly share code, notes, and snippets.

@hiphopsmurf
hiphopsmurf / gist:d6caabdf76a48a75a320
Created January 6, 2016 22:12 — forked from rjacoby/gist:46f7ceb900f97b0cc8f4
Facebook STOP! console code
__d("Chromedome", ["fbt"], function(a, b, c, d, e, f, g) {
f.start = function(h) {
if (h.off || top !== window ||!/(^|\.)facebook\.com$/.test(document.domain))
return;
var i = h.stop || "Stop!", j = h.text || "This is a browser feature intended for developers. If someone told you to copy-paste something here to enable a Facebook feature or \"hack\" someone's account, it is a scam and will give them access to your Facebook account.", k = h.more || g._("For more information, see {url}.", [g.param("url", 'https://www.facebook.com/selfxss')]);
if ((window.chrome || window.safari)&&!h.textonly) {
var l = 'font-family:helvetica; font-size:20px; ';
[[i, h.c1 || l + 'font-size:50px; font-weight:bold; ' + 'color:red; -webkit-text-stroke:1px black;'], [j, h.c2 || l], [k, h.c3 || l], ['', '']].map(function(r) {
setTimeout(console.log.bind(console, '\n%c' + r[0], r[1]));
});
@hiphopsmurf
hiphopsmurf / woocommerce-disable-paypal-for-subscriptions.php
Created February 14, 2016 01:33 — forked from thenbrent/woocommerce-disable-paypal-for-subscriptions.md
Using WooCommerce and want to disable PayPal for subscription purchases, but still offer it as an option for buying one-off products? Activate this plugin.
<?php
/**
* Plugin Name: WooCommerce Disable PayPal for Subscriptions
* Plugin URI: https://gist.github.com/thenbrent/6641526
* Description: Want to disable PayPal for subscription purchases, but still offer it as an option for buying one-off products? Activate this plugin. It will also disable PayPal for subscription renewal. Requires WooCommerce 2.2 or newer.
* Author: Brent Shepherd
* Author URI: http://find.brentshepherd.com/
* Version: 1.0
*
* This program is free software: you can redistribute it and/or modify
@hiphopsmurf
hiphopsmurf / echo-wc-sku.php
Created February 15, 2016 09:36 — forked from bekarice/echo-wc-sku.php
Print WC Product SKU
/**
* Echos the SKU for the product when used on a single product page
* Can optionally pass in the ID to echo the SKU for a product elsewhere
* Use [wc_sku] or [wc_sku id="ID"]
* Tutorial: http://www.skyverge.com/blog/output-woocommerce-sku/
**/
function skyverge_get_product_sku( $atts ) {
global $product;
@hiphopsmurf
hiphopsmurf / mysqldump-backup.sh
Created April 8, 2016 15:44 — forked from tony4d/mysqldump-backup.sh
Backup all databases on a mysql server, excluding information_schema and performance_schema. Most useful scheduling this on a slave db.
#!/bin/bash
# No username or passwords in this script, you should use mysql_config_editor
# to store it securely. The login-path in this script is set to "local-backup" so when you create
# your .mylogin.cnf with the mysql-config-editor make sure it is set the same
# See http://dev.mysql.com/doc/refman/5.6/en/mysql-config-editor.html
# An example to create your config for a mysql user "backup":
# shell> sudo mysql_config_editor set --login-path=local-backup --host=localhost --user=backup --password
# The backup user in the mysql server needs these privileges: SELECT, RELOAD, SHOW DATABASES, REPLICATION CLIENT
@hiphopsmurf
hiphopsmurf / starting_library_project_AS.md
Created May 19, 2016 17:32 — forked from daniellevass/starting_library_project_AS.md
Getting Started with a library project in Android Studio

Getting Started with a library project in Android Studio

So we're working on creating Android Material Awesome, a library which will hopefully incorperate the benefits of Material Design, Twitter's Bootstrap, and FontAwesome. What we really wanted is a project other people can easily include into their projects using gradle dependencies. To do this we needed to create a standalone library project so we could make it as lightweight as possible for including as a dependency, and a sample app that would use it for testing. These are the steps we took to get started in Android Studio (version 1.1).

Create Projects

The first thing we needed to do was to create two new projects, with all the default settings (Blank Activity etc). One for our sample app, and one for our library. We added both of ours into the same GitHub repo, however you can save them wherever you like.

Fix Up Library Project

@hiphopsmurf
hiphopsmurf / .readme.md
Created September 10, 2016 01:25 — forked from morganestes/.readme.md
Create multiple sites with wp-cli in WordPress multisite for testing.

These commands will install multiple dummy sites in a WordPress Multisite environment.

I wrote this to easily create an environment to work on https://core.trac.wordpress.org/ticket/15317.

Usage

Shell

In the terminal, inside your WordPress directory: simply copy, paste, and run the one-line command.

You can also add it to a location available in your $PATH and invoke the script from the shell.

@hiphopsmurf
hiphopsmurf / MakeOpenVPN.sh
Last active October 10, 2016 21:04 — forked from laurenorsini/MakeOpenVPN.sh
MakeOpenVPN.sh by Eric Jodoin
#!/bin/bash
# Default Variable Declarations
DEFAULT="Default.txt"
FILEEXT=".ovpn"
CRT=".crt"
KEY=".3des.key"
CA="ca.crt"
TA="ta.key"
@hiphopsmurf
hiphopsmurf / server.conf
Last active October 10, 2016 20:36 — forked from laurenorsini/server.conf
OpenVPN configuration for /etc/openvpn/server.conf
#local prevents openvpn from starting automagically
#local 192.168.2.0 # SWAP THIS NUMBER WITH YOUR RASPBERRY PI IP ADDRESS
dev tun
proto udp #Some people prefer to use tcp. Don't change it if you don't know.
port 1194
ca /etc/openvpn/easy-rsa/keys/ca.crt
cert /etc/openvpn/easy-rsa/keys/Server.crt # SWAP WITH YOUR CRT NAME
key /etc/openvpn/easy-rsa/keys/Server.key # SWAP WITH YOUR KEY NAME
dh /etc/openvpn/easy-rsa/keys/dh1024.pem # If you changed to 2048, change that here!
server 10.8.0.0 255.255.255.0
@hiphopsmurf
hiphopsmurf / wordpress-disable-distraction-free.php
Created October 27, 2016 15:38 — forked from jwondrusch/wordpress-disable-distraction-free.php
Disable Distraction Free Writing Mode and Full Height Editor editor based on a list of post types.
<?php
/**
* Disable Distraction Free Writing Mode and the "Auto Expanding"
* height of the editor based on a list of post types.
*
* @return void
*/
function my_deregister_editor_expand($val, $post_type)
{
@hiphopsmurf
hiphopsmurf / collection-filter.js
Created October 31, 2016 23:27 — forked from danielbachhuber/collection-filter.js
Add a custom taxonomy dropdown filter to the WordPress Media Library
(function(){
/**
* Create a new MediaLibraryTaxonomyFilter we later will instantiate
*/
var MediaLibraryTaxonomyFilter = wp.media.view.AttachmentFilters.extend({
id: 'media-attachment-taxonomy-filter',
createFilters: function() {
var filters = {};
// Formats the 'terms' we've included via wp_localize_script()