Skip to content

Instantly share code, notes, and snippets.

Avatar

ken mcfadden eaglerockdude

View GitHub Profile
@eaglerockdude
eaglerockdude / format$PATH command
Created May 9, 2018
echo $PATH | tr ":" "\n" | nl
View format$PATH command
makes it easier to read
@eaglerockdude
eaglerockdude / rails-postgres-backbone-bootstrap-bootswatch
Created Aug 29, 2017 — forked from sionc/rails-postgres-backbone-bootstrap-bootswatch
Instructions on creating a new app using Ruby on Rails, Postgresql, Backbone.js, Twitter Boostrap, Bootstwatch
View rails-postgres-backbone-bootstrap-bootswatch
- Check rails version
$ rails -v
- To update rails
$ gem update rails
- Creating a new rails app using postgresql
$ mkdir rails_projects
$ cd rails_projects
$ rails new myapp --database=postgresql
@eaglerockdude
eaglerockdude / gist:8722fb018c472e55435031f852c194e1
Last active Aug 16, 2017
Set up fresh rails environment on UBUNTU
View gist:8722fb018c472e55435031f852c194e1
ken@ken-XPS-M1330:~$ cat /etc/*-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=17.04
DISTRIB_CODENAME=zesty
DISTRIB_DESCRIPTION="Ubuntu 17.04"
NAME="Ubuntu"
VERSION="17.04 (Zesty Zapus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 17.04"
View railsport
lsof -wni tcp:3000
then kill it.
View gist:0cbc6df055b2ad0bdc6aa532e1e160aa

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

@eaglerockdude
eaglerockdude / rspec_model_testing_template.rb
Created Apr 25, 2016 — forked from kyletcarlson/rspec_model_testing_template.rb
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
View rspec_model_testing_template.rb
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@eaglerockdude
eaglerockdude / tdo.rb
Last active Aug 27, 2015 — forked from sirupsen/tdo.rb
Gist for "What I Wish a Ruby Programmer Had Told Me One Year Ago".
View tdo.rb
class TodoList < Array
def self.load(file)
# read the file, create a list, create items, add them to the list, return the list
list = TodoList.new
File.read(file).each_line do |line|
list << line.chomp
end
list
end
@eaglerockdude
eaglerockdude / removedir
Created Aug 15, 2015
How to remove a nonempty directory with force : linux
View removedir
rm -rf <directory name>
@eaglerockdude
eaglerockdude / bootstrap_CDN
Created Jul 2, 2015
Boostrap based responsive NavBar with CDN links
View bootstrap_CDN
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap Navigation Bar</title>
<!-- Bootstrap -->
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">