Skip to content

Instantly share code, notes, and snippets.

@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
@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 / 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 / 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 / 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;
# 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 / query-to-redirect.md
Last active September 6, 2018 06:06
Refactoring query-to-redirect

Don't hook into parse_query.

- add_action('parse_query', [$this, 'fixEmptyQueryString']);
- add_action('parse_query', [$this, 'filterBarQueryRedirect']);

+ add_action('wp', [$this, 'fixEmptyQueryString'], 5);
+ add_action('wp', [$this, 'filterBarQueryRedirect'], 5);
@tangrufus
tangrufus / github-zip.jpg
Last active October 16, 2018 13:54
Making wp plugin zip out of composer repo
github-zip.jpg

Keybase proof

I hereby claim:

  • I am tangrufus on github.
  • I am tangrufus (https://keybase.io/tangrufus) on keybase.
  • I have a public key whose fingerprint is CFBE 0B13 3B14 C437 56D0 0D34 5709 0746 B2C4 EAC7

To claim this, I am signing this object: