Skip to content

Instantly share code, notes, and snippets.

# roles/deploy/hooks/build-after.yml
- debug:
msg: "Before Gzip static assets: {{lookup('pipe', 'date')}}"
- name: Gzip static assets
shell: "gzip --best --keep --force {{ static_assets | map(attribute='path') | join(' ') }}"
when: project.gzip_assets_on_deploy | default(gzip_assets_on_deploy)
- debug:
@tangrufus
tangrufus / example.conf
Last active July 19, 2017 12:35
static nginx site
# Add this one along with your other nginx config files
# Do not change any existing site config file
# This example use port 8080
# Maybe you have to change to another port
# See also: https://www.nginx.com/resources/admin-guide/serving-static-content/
server {
listen 8080;
@tangrufus
tangrufus / get_emoji_names.rb
Last active August 29, 2015 14:26
Make a name list of GitHub/gemoji supported emoji
require 'json'
require 'net/http'
def fetch(url)
resp = Net::HTTP.get_response(URI.parse(url))
data = resp.body
JSON.parse(data)
end
results = fetch "https://cdn.rawgit.com/github/gemoji/master/db/emoji.json"
@tangrufus
tangrufus / Gemfile
Last active August 29, 2015 14:18
get pages theme works with turbolinks
gem 'turbolinks'
gem 'jquery-turbolinks', '~> 2.1.0'
# Pages Theme - Gems for twitter LESS -> CSS and JS support
gem 'therubyracer', '~> 0.12.2', platforms: :ruby
gem 'yui-compressor', '~> 0.12.0'
gem 'less-rails', '~> 2.6.0'
@tangrufus
tangrufus / smtp.php
Last active August 29, 2015 14:14
10 Things I Wish I Knew before Hosting WordPress on Heroku
add_action( 'phpmailer_init', 'wph_phpmailer_init' );
function wph_phpmailer_init( PHPMailer $phpmailer ) {
$phpmailer->IsSMTP();
$phpmailer->SMTPAuth = true; // enable SMTP authentication
$phpmailer->Port = 587; // set the SMTP server port
$phpmailer->Host = 'smtp.mandrillapp.com'; // SMTP server
$phpmailer->Username = 'MANDRILL_USERNAME'; // SMTP server username
$phpmailer->Password = 'MANDRILL_API_KEY'; // SMTP server password
}
@tangrufus
tangrufus / cat.sh
Last active August 29, 2015 14:13
How to add SSL to Nginx WordPress Servers https://www.wphuman.com/add-ssl-nginx-wordpress-servers/
$ sudo cat your_domain.crt COMODORSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt > ssl-bundle.crt
$ sudo chmod 600 /etc/nginx/ssl
<?php
// Skipping lots of array elements above.....
$settings['your_tab_slug']['user_email'] = array(
'name' => __( 'Your Email', $this->plugin_name ),
'type' => 'email'
);
$settings['your_tab_slug']['user_plan'] = array(
'name' => __( 'Select a plan', $this->plugin_name ),
$ curl --data "author=YourName&amp;email=you@your-domain.com&amp;url=http://www.your-domain.com&amp;comment=Testing-Zero-Spam&amp;comment_post_ID=123456789" http://your-domain.com/wp-comments-post.php
$ adduser deployer
$ gpasswd -a deployer sudo
$ gpasswd -a deployer www-data
$ sudo usermod -g www-data deployer
# Install dependencies
#
# * checkinstall: package the .deb
# * libpcre3, libpcre3-dev: required for HTTP rewrite module
# * zlib1g zlib1g-dbg zlib1g-dev: required for HTTP gzip module
apt-get install checkinstall libpcre3 libpcre3-dev zlib1g zlib1g-dbg zlib1g-dev && \
mkdir -p ~/sources/ && \
# Compile against OpenSSL to enable NPN