Skip to content

Instantly share code, notes, and snippets.

@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 / 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
@wpsmith
wpsmith / Setup.md
Created April 21, 2016 16:12 — forked from suvozy/Setup.md
Setup AWS EC2 and RDS (php5.5, apache2.4, mysql5.5, phpmyadmin)
@wpsmith
wpsmith / default.conf
Created April 20, 2016 18:20 — forked from cbmd/default.conf
nginx config - dynamic virtual hosts
server {
index index.php;
set $basepath "/var/www";
set $domain $host;
# check one name domain for simple application
if ($domain ~ "^(.[^.]*)\.dev$") {
set $domain $1;
set $rootpath "${domain}";
@wpsmith
wpsmith / aaa.nginxconf
Created April 20, 2016 17:31 — forked from markjaquith/aaa.nginxconf
Grab non-locally-existing production images from Photon for your local WordPress dev environment
location ~* \.(jpe?g|gif|png)$ {
try_files $uri @photon;
}
location @photon {
rewrite ^(.*)-([0-9]+)x([0-9]+)\.(jpe?g|gif|png)$ http://i0.wp.com/$host$1.$4?resize=$2,$3;
rewrite . http://i0.wp.com/$host$request_uri;
}
@wpsmith
wpsmith / WP on AWS.md
Created April 20, 2016 16:48 — forked from ericandrewlewis/gist:95239573dc97c0e86714
Setting up a WordPress site on AWS

Setting up a WordPress site on AWS

This tutorial walks through setting up AWS infrastructure for WordPress, starting at creating an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.

This tutorial assumes you're relatively comfortable on the command line and editing system configuration files. It is intended for folks who want a high-level of control and understanding of their infrastructure. It will take about half an hour if you don't Google away at some point.

If you experience any difficulties or have any feedback, leave a comment. 🐬

Coming soon: I'll write another tutorial on a high availability setup for WordPress on AWS, including load-balancing multiple application servers in an auto-scaling group and utilizing RDS.

@wpsmith
wpsmith / nginx.conf
Created April 20, 2016 13:54 — forked from markjaquith/nginx.conf
My WordPress Nginx setup
upstream phpfpm {
server unix:/var/run/php5-fpm.sock;
}
upstream hhvm {
server unix:/var/run/hhvm/hhvm.sock;
}
# SSL
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;