Skip to content

Instantly share code, notes, and snippets.

@wpsmith
wpsmith / installing_cassandra.md
Created July 5, 2016 21:17 — forked from hkhamm/installing_cassandra.md
Installing Cassandra on Mac OS X

Installing Cassandra on Mac OS X

Install Homebrew

Homebrew is a great little package manager for OS X. If you haven't already, installing it is pretty easy:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@wpsmith
wpsmith / perform-basic-bid-management.js
Created June 4, 2016 01:22 — forked from daniel-c05/perform-basic-bid-management.js
AdWords Scripts - Perform Basic Bid Management
var workingDateRange = "LAST_14_DAYS";
function main() {
lowerBidsToTopKeywords();
raiseBidsToMidPositionKeywords();
raiseBidsToLowPositionKeywords();
}
@wpsmith
wpsmith / minimize-over-delivery.js
Created June 4, 2016 01:22 — forked from daniel-c05/minimize-over-delivery.js
AdWords Scripts - Minimize Overdelivery
//Edit this based on the max amount you want to spend on a given day.
var maxSpend = 1000;
function main () {
var currentAccount = AdWordsApp.currentAccount();
var stats = currentAccount.getStatsFor("TODAY");
var cost = stats.getCost();
Logger.log("Account has spent " + cost + " so far.");
if (cost > maxSpend) {
campaign.pause();
@wpsmith
wpsmith / evaluate-ad-text-line-performance.js
Created June 4, 2016 01:22 — forked from daniel-c05/evaluate-ad-text-line-performance.js
AdWords Scripts - Evaluate Ad Text Line Performance
// Comma-separated list of recipients. Comment out to not send any emails.
var RECIPIENT_EMAIL = 'YOUR_EMAIL';
// URL of the default spreadsheet template. This should be a copy of http://goo.gl/pxaZio
var SPREADSHEET_URL = 'SPREADSHEET_URL';
/**
* This script computes an Ad performance report
* and outputs it to a Google spreadsheet
*/
/*********************************************
* Automated Creative Testing With Statistical Significance
* Version 2.1
* Changelog v2.1
*   - Fixed INVALID_PREDICATE_ENUM_VALUE
* Changelog v2.0
*   - Fixed bug in setting the correct date
*   - Script now uses a minimum visitors threshold
*        per Ad instead of AdGroup
*   - Added the ability to add the start date as a label to AdGroups
@wpsmith
wpsmith / gist:d7b500d018dafb85325fe8d70fb6568c
Created May 27, 2016 15:50 — forked from dberesford/gist:28876b39d26b02b7683a
Sample node.js leak detection using memwatch and heapdump
var http = require('http');
var util = require('util');
var heapdump = require('heapdump');
var memwatch = require('memwatch');
var server = http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
for (var i=0; i<1000; i++) {
server.on('request', function leakyfunc() {
@wpsmith
wpsmith / Setup WordPress Multi-tenant infrastructure
Created April 20, 2016 13:53 — forked from BjornW/Setup WordPress Multi-tenant infrastructure
A short description of how I've setup a WordPress Multi-Tenant architecture. This is based on the excellent post by Jason McCreary http://jason.pureconcepts.net/2013/04/updated-wordpress-multitenancy/ and the great ascii art explanations by Wes Koop (https://gist.github.com/weskoop/3796570) & Mark Jaquith (https://gist.github.com/markjaquith/622…
I'm using Ubuntu 12.04 and I'm following the Debian/Ubuntu way of dealing with config files. I presume you know how to work with sudo and such
- Install last stable version of WordPress (in my case 3.6) with Subversion into /opt/wordpress/3.6
- create a symlink /opt/wordpress/stable ==> /opt/wordpress/3.6
- create a directory sites in /var/www/sites
- create a directory specific for your site using the domain name e.g. /var/www/sites/example.com
- create a directory wp-content in /var/www/sites/example.com
- create a directory wordpress in /etc
- create a directory named as you site's domain name, e.g. in /etc/wordpress
- copy from /opt/wordpress/stable/wp-config-sample.php to /etc/wordpress/example.com/wp-config.php
@wpsmith
wpsmith / webfont-localstorage.js
Last active May 10, 2016 15:36 — forked from mattboon/webfont-localstorage.js
webfont-localstorage.js
(function(window, document) {
"use strict";
function supportsWoff2() {
/*global FontFace*/
// Source: https://github.com/filamentgroup/woff2-feature-test
if (!window.FontFace) {
return false;
} else {
var f = new FontFace('t', 'url("data:application/font-woff2,") format("woff2")', {});
@wpsmith
wpsmith / Amazon-Linux-AMI PHP55
Created April 21, 2016 16:12 — forked from sl-digital/Amazon-Linux-AMI PHP55
Install Apache, MySQL and PHP 5.5 on Amazon Linux AMI
:: UPDATE YUM ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
sudo yum update -y
:: INSTALL WEBSERVER :::::::::::::::::::::::::::::::::::::::::::::::::::::::::
sudo yum install httpd24
sudo service httpd start
sudo chkconfig httpd on
chkconfig --list httpd