Skip to content

Instantly share code, notes, and snippets.

View manafire's full-sized avatar

Brad Carson manafire

View GitHub Profile
@manafire
manafire / factorybot_faker_demo.md
Created November 16, 2023 04:28 — forked from jfangonilo/factorybot_faker_demo.md
FactoryBot/Faker Demo

FactoryBot/Faker Demo

For Turing BE Mod2 - MiniShop

https://github.com/turingschool-examples/mini_shop

Are you sick of writing fake data for tests? If you are, then your test files probably look something like this. This is what your index spec probably looks like for a project like MiniShop. You create 3 merchants and 3 items for each merchant and make sure those items show up on your index page...

#index_spec.rb
require "rails_helper"
git ls-files | grep '\.dart' | xargs wc -l |sort -n
@manafire
manafire / gist:c385b40031309af1c9d6
Last active August 29, 2015 14:01
Ubuntu + rbenv + github + Rails + Ruby + nginx + passenger + ec2
# IN AMAZON EC2 SERVER #
########################
sudo su
apt-get -y update && apt-get -y upgrade
apt-get install vim git-core curl openssh-server openssh-client python-software-properties build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev libcurl4-openssl-dev aptitude
/usr/sbin/groupadd wheel
/usr/sbin/visudo
(paste bottom)
%wheel ALL=(ALL) ALL
@manafire
manafire / gist:7949060
Last active December 31, 2015 06:39
Change directory by substituting a string in current working directory with another. Throw this in your aliases file or your rc, or profile file and enjoy.
#
# CD substitution
# usage: cds [target] [substitution]
#
# if you have a current working directory like this:
# ~/code/myproject/en/images/
# and you type: cds en fr
# you will change to this directory:
# ~/code/myproject/fr/images/
@manafire
manafire / gist:6543773
Created September 12, 2013 21:04
AWS Full bucket access
{
"Statement": [
{
"Effect": "Allow",
"Action": "s3:ListAllMyBuckets",
"Resource": "arn:aws:s3:::*"
},
{
"Effect": "Allow",
"Action": "s3:*",
@manafire
manafire / gist:6370017
Created August 28, 2013 19:13
Amazon Everyone Read-only public bucket policy
{
"Version":"2008-10-17",
"Statement":[{
"Sid":"AllowPublicRead",
"Effect":"Allow",
"Principal": {
"AWS": "*"
},
"Action":["s3:GetObject"],
"Resource":["arn:aws:s3:::BUCKET_NAME/*"
@manafire
manafire / gist:6251199
Created August 16, 2013 16:07
Sublime Keymap
[
{ "keys": ["ctrl+shift+r"], "command": "reindent" , "args": {"single_line": false}},
{ "keys": ["super+v"], "command": "paste_and_indent" },
{ "keys": ["super+shift+v"], "command": "paste" },
// vintage - mode control
// exit insert mode
{ "keys": ["j", "j"], "command": "exit_insert_mode",
"context":
[
@manafire
manafire / gist:6232957
Created August 14, 2013 16:45
Override read-only in vim with :w!!
# add to .vimrc
cmap w!! %!sudo tee > /dev/null %
(function () {
var scriptName = "embed.js"; //name of this script, used to get reference to own tag
var jQuery; //noconflict reference to jquery
var jqueryPath = "http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js";
var jqueryVersion = "1.8.3";
var scriptTag; //reference to the html script tag
/******** Get reference to self (scriptTag) *********/
var allScripts = document.getElementsByTagName('script');
@manafire
manafire / gist:5729868
Created June 7, 2013 14:58
Autoload Hirb whenever you're in Rails console
# config/initializers/hirb.rb
Hirb.enable if Rails.env.development?