Skip to content

Instantly share code, notes, and snippets.

View b-ggs's full-sized avatar

boggs 🌊 b-ggs

View GitHub Profile
@b-ggs
b-ggs / rails-export-csv.rb
Created September 25, 2015 03:07 — forked from bcalloway/rails-export-csv.rb
Use FasterCSV to export an ActiveRecord object in Rails
### /config/environment.rb
config.gem 'fastercsv'
### /config/routes.rb
map.connect '/users/export', :controller => 'users', :action => 'export'
### /app/models/user.rb
# find all students and pass to controller export action for export to csv
def self.find_students
find_by_sql("select students.firstname, students.lastname, students.grade, students.homeroom, students.phone, students.email, students.relationship, users.firstname, users.lastname, accounts.school from students, users, accounts where students.user_id = users.id and accounts.id = users.account_id")
@b-ggs
b-ggs / .fonts.conf
Created December 7, 2015 15:14 — forked from silv3rm00n/.fonts.conf
Tweak .fonts.conf for better looking fonts http://www.binarytides.com/gorgeous-looking-fonts-ubuntu-linux/
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!--
Documented at
http://linux.die.net/man/5/fonts-conf
To check font mapping run the command at terminal
$ fc-match 'helvetica Neue'
@b-ggs
b-ggs / .tmux.conf
Created December 8, 2015 06:46 — forked from jikkujose/.tmux.conf
Change prefix key in tmux to back-tick and still type back-ticks
unbind C-b
set-option -g prefix `
bind ` send-prefix
namespace :figaro do
desc "SCP transfer figaro configuration to the shared folder"
task :setup do
on roles(:app) do
upload! "config/application.yml", "#{shared_path}/application.yml", via: :scp
end
end
desc "Symlink application.yml to the release path"
task :symlink do
@b-ggs
b-ggs / authentication_with_bcrypt_in_rails_4.md
Created April 19, 2016 04:08 — forked from thebucknerlife/authentication_with_bcrypt_in_rails_4.md
Simple Authentication in Rail 4 Using Bcrypt

#Simple Authentication with Bcrypt

This tutorial is for adding authentication to a vanilla Ruby on Rails app using Bcrypt and has_secure_password.

The steps below are based on Ryan Bates's approach from Railscast #250 Authentication from Scratch (revised).

You can see the final source code here: repo. I began with a stock rails app using rails new gif_vault

##Steps

@b-ggs
b-ggs / API.md
Created May 8, 2016 03:51 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@b-ggs
b-ggs / istat.sh
Created December 2, 2016 20:31 — forked from jasonkolb/gist:9211384
istat
rm ~/Library/Preferences/com.bjango.istatmenus.plist
@b-ggs
b-ggs / setup.md
Created January 26, 2017 02:02 — forked from dayvough/setup.md
Fresh Server Setup

Vars

app_dir = /home/deploy/app_name

Users, permissions, and services

https://www.codelitt.com/blog/my-first-10-minutes-on-a-server-primer-for-securing-ubuntu/
@b-ggs
b-ggs / Contract Killer 3.md
Created March 12, 2017 09:31
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

#!/bin/bash
# usage: ./remove-mkv-subtitles.sh [--no-dry] [path(s)]
# Script to find MKV files in the given paths and remove subtitle tracks from them. Dry run by default.
# (usually) non-default dependencies: mkvtoolnix, dc
remvsub(){
set -e