Skip to content

Instantly share code, notes, and snippets.

@thattimc
thattimc / application_helper.rb
Created July 5, 2015 05:08
Embedded SVG to Rails
def embedded_svg(filename, options = {})
assets = Rails.application.assets
file = assets.find_asset(filename).body.force_encoding("UTF-8")
doc = Nokogiri::HTML::DocumentFragment.parse file
svg = doc.at_css "svg"
if options[:class].present?
svg["class"] = options[:class]
end
raw doc
end
@thattimc
thattimc / Contract Killer 3.md
Created March 25, 2016 11:18 — forked from malarkey/Contract Killer 3.md
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

@thattimc
thattimc / HOWTO.md
Created April 28, 2017 06:27 — forked from cvan/HOWTO.md
How to serve a custom HTTPS domain on GitHub Pages with CloudFlare: *FREE*, secure and performant by default

Instructions

CloudFlare is an awesome reverse cache proxy and CDN that provides DNS, free HTTPS (TLS) support, best-in-class performance settings (gzip, SDCH, HTTP/2, sane Cache-Control and E-Tag headers, etc.), minification, etc.

  1. Make sure you have registered a domain name.
  2. Sign up for CloudFlare and create an account for your domain.
  3. In your domain registrar's admin panel, point the nameservers to CloudFlare's (refer to this awesome list of links for instructions for various registrars).
  4. From the CloudFlare settings for that domain, enable HTTPS/SSL and set up a Page Rule to force HTTPS redirects. (If you want to get fancy, you can also enable automatic minification for text-based assets [HTML/CSS/JS/SVG/etc.], which is a pretty cool feature if you don't want already have a build step for minification.)
  5. If you
@thattimc
thattimc / gist:9a8d6f91bb547d461f9a4bfd5c54e115
Created May 27, 2017 12:18
Install PostgreSQL Using Brew On OSX
# update & install
brew update
brew install postgres
# create postgres db
postgres -D /usr/local/var/postgres
create your username db
createdb `whoami`
# editorconfig.org
root = true
[*]
charset = utf-8
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
@thattimc
thattimc / _Instructions
Created October 5, 2018 14:53 — forked from benmccallum/_Instructions.md
nuxtjs, vue-bootstrap with custom bootstrap build
1. Install bootstrap as a dev dependency, and its dependencies (node-sass and sass-loader)
`npm install --save-dev bootstrap@4.0.0-beta.2 node-sass sass-loader`
2. Install nuxt plugin of bootstrap vue (includes bootstrap-vue as a dependency)
`npm install @nuxtjs/bootstrap-vue`
3. Register plugin as module in nuxt.config.js (see below)
4. Create app.scss entry point (see below)
@thattimc
thattimc / revert-a-commit.md
Created January 9, 2019 01:22 — forked from gunjanpatel/revert-a-commit.md
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}'

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

@thattimc
thattimc / model.template.txt
Created June 21, 2019 00:45 — forked from joshuapinter/model.template.txt
Rails Model Template
class [Your Class Here] < ActiveRecord::Base
##################################################################################################
### Attributes ###################################################################################
##################################################################################################
### Constants ####################################################################################
@thattimc
thattimc / .editorconfig
Created July 25, 2019 10:42
editorconfig
root = true
[*]
charset = utf-8
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
@thattimc
thattimc / .gitignore
Created July 25, 2019 10:47
Terraform's gitignore
# Compiled files
*.tfstate
*.tfstate.backup
*.tfstate.lock.info
# logs
*.log
# Directories
.terraform/