Skip to content

Instantly share code, notes, and snippets.

@azizultex
azizultex / Getting All Contact Form 7 Forms in a Select Option and Showing Selected Form Anywhere Wordpress
Created February 25, 2015 15:20
Getting All Contact Form 7 Forms in a Select Option and Showing Selected Form Anywhere Wordpress
// This is how I listed the forms in Piklist Select Option below:
$args = array('post_type' => 'wpcf7_contact_form', 'posts_per_page' => -1);
$cf7Forms = get_posts( $args );
// $post_ids = wp_list_pluck( $cf7Forms , 'ID' );
$form_titles = wp_list_pluck( $cf7Forms , 'post_title' );
piklist('field', array(
'type' => 'group'
,'field' => 'contact_form'
@kevinlisota
kevinlisota / google-analytics-author-tracking.php
Last active November 1, 2024 15:50
add WordPress author tracking using Google Analytics custom dimension
//Google Universal Analytics
function google_analytics() { ?>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'YOUR ANALYTICS PROPERTY ID HERE', 'auto');
<?php if (is_singular('post') :
@brandonsimpson
brandonsimpson / osx_uninstall_mysql_install_mariadb_homebrew.md
Last active June 12, 2024 16:00
OSX How To: Uninstall native MySQL and install MariaDB via Homebrew

OSX How To: Uninstall native MySQL and install MariaDB via Homebrew

This is a short overview on how to completely remove any old mysql server installs in OSX and upgrade to MariaDB without conflicts. Things can get a bit weird when you have various old installs of MySQL server floating around, and utilizing homebrew to install and upgrade MariaDB as a drop in replacement for MySQL has worked well, especially if you're used to managing MySQL installs via yum in linux.

First: Backup Your Data!

Backup all of your current databases with mysqldump

This isn't a tutorial on backups, and there are many ways to do it. You should know how to backup your data anyway. For this example, we'll do a full backup of our InnoDB databases.

@nicolasembleton
nicolasembleton / restart_bluetooth.sh
Last active May 11, 2024 17:43
Restart Bluetooth Daemon on Mac OS X without restarting
#!/bin/bash
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
@ericdouglas
ericdouglas / super-tip.txt
Last active October 6, 2024 18:28
Change 4 spaces to 2 spaces indentation and change tab to spaces - Vim tip
// 4 spaces to 2 spaces
%s;^\(\s\+\);\=repeat(' ', len(submatch(0))/2);g
// Tab to 2 spaces
:%s/\t/ /g
@Phonbopit
Phonbopit / MainActivity.java
Created May 21, 2014 07:49
Android Button OnClick Tutorial
package com.devahoy.android.sample.button;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class MainActivity extends ActionBarActivity implements View.OnClickListener {
@ntwb
ntwb / ntwb_bbp_bp_pm.php
Created March 31, 2014 07:54
bbPress - Add BuddyPress Private Message link after author reply details
<?php
/*
Plugin Name: bbPress - Add BuddyPress Private Message link after author reply details
Plugin URI: https://gist.github.com/ntwb/9887310
Description: bbPress - Add BuddyPress Private Message link after author reply details
Version: 0.1
Author: Stephen Edgar - Netweb
Author URI: http://netweb.com.au
*/
@jonathanpglick
jonathanpglick / dabblet.css
Created January 17, 2014 19:02
Vertical fill remaining area with flexbox.
/**
* Vertical fill remaining area with flexbox.
*/
html, body {
margin: 0;
padding: 0;
height: 100%;
}
body {
@leesmith
leesmith / simple-git-workflow.md
Last active December 30, 2023 23:37
Simple Git Workflow For Continuous Delivery

Simple Git Workflow For Continuous Delivery

Workflow guidelines:

  • master branch is always production-ready, deployable, 100% green test suite
  • New development is done on feature branches, with frequent rebasing onto master
  • Clean commit history by preferring to rebase instead of merge (git pull is configured to automatically rebase)

rebase workflow

Workflow

@chilts
chilts / alexa.js
Created October 30, 2013 09:27
Getting the Alexa top 1 million sites directly from the server, unzipping it, parsing the csv and getting each line as an array.
var request = require('request');
var unzip = require('unzip');
var csv2 = require('csv2');
request.get('http://s3.amazonaws.com/alexa-static/top-1m.csv.zip')
.pipe(unzip.Parse())
.on('entry', function (entry) {
entry.pipe(csv2()).on('data', console.log);
})
;