Skip to content

Instantly share code, notes, and snippets.

View karlclement's full-sized avatar

Karl Clement karlclement

View GitHub Profile
@karlclement
karlclement / nginx.conf
Created May 14, 2019 17:12 — forked from thoop/nginx.conf
Official prerender.io nginx.conf for nginx
# Change YOUR_TOKEN to your prerender token
# Change example.com (server_name) to your website url
# Change /path/to/your/root to the correct value
server {
listen 80;
server_name example.com;
root /path/to/your/root;
index index.html;
### Keybase proof
I hereby claim:
* I am karlclement on github.
* I am karlclement (https://keybase.io/karlclement) on keybase.
* I have a public key ASB3Q2ONGOqL-gu0vXPRIPUuMOQ10Xbth_9hsR5QkfWErQo
To claim this, I am signing this object:
@karlclement
karlclement / pg_import_csv_to_heroku.sh
Created November 30, 2017 14:39 — forked from jboesch/pg_import_csv_to_heroku.sh
Importing a CSV dump of Postgres data into Heroku
# You have your csv data and it looks like so... It's in a file named "my_data.csv" and we want to import it into a table named "my_things".
"1", "Something", "0.50", "2013-05-05 10:00:00"
"2", "Another thing", "1.50", "2013-06-05 10:30:00"
# Now you want to import it, go to the command line and type:
$ PGPASSWORD=PWHERE psql -h HOSTHERE -U USERHERE DBNAMEHERE -c "\copy my_things FROM 'my_data.csv' WITH CSV;"
# Voila! It's impoted. Now if you want to wipe it out and import a fresh one, you would do this:
@karlclement
karlclement / gulpfile.js
Created October 9, 2017 03:18
Standard static Gulp file
// Imports
var gulp = require('gulp');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var concat = require('gulp-concat');
var concatCss = require('gulp-concat-css');
var runSeq = require('run-sequence');
// Compile Sass and move to dist
gulp.task('sass', function () {
@karlclement
karlclement / Vagrantfile
Created August 15, 2017 22:42
WP Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "forwarded_port", guest: 80, host: 80, auto_correct: true
config.vm.network "forwarded_port", guest: 3306, host: 3309
# Private IP --> Add `192.168.68.9 your_domain_here.dev` to /etc/hosts file
@karlclement
karlclement / pr-template
Created June 26, 2017 12:23
Assign this template to a hotkey on your development machine to create new PRs
### WHAT?
Explanation of PRs functionality
### WHAT'S THE STORY?
Links to the stories included
### HOW?
@karlclement
karlclement / circle.yml
Created April 10, 2017 22:36 — forked from tashian/circle.yml
Rails/Heroku CircleCI deploy script
checkout:
post:
- git submodule sync
- git submodule update --init # use submodules
deployment:
production:
branch: production
commands:
- ./bin/heroku_deploy.sh yerdle:
timeout: 300
@karlclement
karlclement / git-aliases.zsh
Last active June 14, 2016 21:17
Aliases for Git
### Git
alias gc='git commit -m'
alias gf='git fetch'
alias gpl='git fetch;git pull'
alias gph='git push'
alias gcb='git checkout'
alias gnb='git checkout -b'
alias gcl='git clone'
alias gm='git merge'
alias gs='git status'
@karlclement
karlclement / gist:938bd531b64f82c43613109260fd3294
Created March 29, 2016 17:28 — forked from dhh/gist:1014971
Use concerns to keep your models manageable
# autoload concerns
module YourApp
class Application < Rails::Application
config.autoload_paths += %W(
#{config.root}/app/controllers/concerns
#{config.root}/app/models/concerns
)
end
end
@karlclement
karlclement / base_controller.rb
Created February 15, 2016 16:24 — forked from dhoelzgen/base_controller.rb
CORS in Rails 4 APIs
class API::V1::BaseController < ApplicationController
skip_before_filter :verify_authenticity_token
before_filter :cors_preflight_check
after_filter :cors_set_access_control_headers
def cors_set_access_control_headers
headers['Access-Control-Allow-Origin'] = '*'
headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'