Skip to content

Instantly share code, notes, and snippets.

@mikesjewett
mikesjewett / non-programmers-cli-guide.md
Last active August 29, 2015 14:05
A non-programmer's guide to the command line

Why would you want to use the command line?

  1. It's cool, and people will think you're smart.
  2. Once you learn some basic commands, you'll be more efficient in it than in a visual directory.
  3. If you ever want to learn to code, you'll need to be comfortable on the command line, so you might as well start now.

How do you open the command line?

  • Mac users can use the Terminal program, which comes with OSX. Open the Terminal by typing "Terminal" into Spotlight.
@mikesjewett
mikesjewett / collaborative_blog.md
Last active August 29, 2015 14:04
The collaborative blog project

Purpose

Build a collaborative blog application that allows multiple users to contribute blogs under their own names.

Use Case

This is the first project for the Bloc Alumni Hacker's Club. The first group of about 6 members would like to collaboratively build a blog application to which they can all contribute.

Requirements

@mikesjewett
mikesjewett / jekyll_github_pages.md
Last active December 31, 2015 16:39
Creating a Jekyll blog hosted by Github Pages

After installing Jekyll, create a repo named username.github.io in your Github account. (username is your Github username). Then go to your terminal:

➜  code  jekyll new username.github.io
➜  code  cd username.github.io
➜  code  git init
➜  code  git add .
➜  code  git commit -m 'First commit'
➜  code  git remote add origin [email protected]:username/username.github.io.git
➜ code git push -u origin master
@mikesjewett
mikesjewett / jekyll_troubleshooting.md
Created December 18, 2013 00:12
Jekyll troubleshooting

Ran into a minor problem installing Jekyll. Not sure why it happened, but here's the situation and the fix:

➜  code  sudo gem install jekyll
Password:
Building native extensions.  This could take a while...
ERROR:  Error installing jekyll:
	ERROR: Failed to build gem native extension.

 /Users/mike/.rvm/rubies/ruby-2.0.0-p0/bin/ruby extconf.rb
@mikesjewett
mikesjewett / sidekicker.md
Last active December 28, 2015 19:49 — forked from eladmeidar/bloc.md

Purpose

Build an application that allows users to manage Sidekiq services. We'll call this application "Sidekicker", but you can name it anything you want.

Use case

Sidekiq is a background processing service that can be integrated into Rails applications. Basically, Sidekiq can make Rails applications much faster and more efficient. When you're maintaining many applications that use Sidekiq, it's cumbersome to manage each Sidekiq instance separately. Therefore we'll build the Sidekicker app, which will present a central location to manage Sidekiq services for all the apps that you are maintaining.

We'll assume that all of our applications will be built using Amazon's AWS servers, so the Sidekicker app will need a way to communicate with AWS, and run Sidekiq services on Amazon servers.

Requirements

  • As a user I should be able to sign in and out of Sidekicker.
@mikesjewett
mikesjewett / gemfile
Last active December 17, 2015 17:19
New Relic Logging
source 'https://rubygems.org'
gem 'rails', '3.2.12'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'bootstrap-sass', '~> 2.3.1.0'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
@mikesjewett
mikesjewett / gist:5596011
Created May 16, 2013 23:49
Heroku logs - email error
2013-05-15T20:35:41.399417+00:00 app[web.1]: Rendered devise/shared/_links.erb (0.6ms)
2013-05-15T20:35:41.399417+00:00 app[web.1]: Rendered devise/registrations/new.html.erb within layouts/application (6.3ms)
2013-05-15T20:35:41.399417+00:00 app[web.1]: Completed 200 OK in 12ms (Views: 11.0ms | ActiveRecord: 0.0ms)
2013-05-15T20:35:41.400658+00:00 heroku[router]: at=info method=GET path=/users/sign_up host=bloccit.herokuapp.com fwd="65.206.21.165" dyno=web.1 connect=0ms service=25ms status=200 bytes=3289
2013-05-15T20:35:41.399417+00:00 app[web.1]: Processing by Devise::RegistrationsController#new as HTML
2013-05-15T20:35:41.882902+00:00 heroku[router]: at=info method=GET path=/assets/application-770fe5755077bd5022e97daf1c747e09.js host=bloccit.herokuapp.com fwd="65.206.21.165" dyno=web.1 connect=5ms service=357ms status=304 bytes=0
2013-05-15T20:35:49.243880+00:00 app[web.1]: Started POST "/users" for 65.206.21.165 at 2013-05-15 20:35:47 +0000
2013-05-15T20:35:50.492979+00:00 heroku[router]: at=info met
@mikesjewett
mikesjewett / unix_commands.md
Created December 11, 2012 20:42
Unix Commands Explained

which

which prints out the full path of the command it's passed. For example, try typing which pwd into your command line. You should see /bin/pwd as the result. This simply means that the executable command for pwd is stored in the /bin directory.

Like Mike noted, if you run which psql, and the result is /usr/bin/psql it means that the executable command for your Postgresql database server is in the /usr/bin directory, which means Bash isn't going to run the Postgres.app database server.

Bash

Bash is an old Unix acronym, which stands for 'Bourne-Again Shell' As you can probably guess, it's just a pun on the name of Stephen Bourne, who authored the original Bourne shell, which is the foundation for the command line interface in Unix. (Mac OS is based on Unix).

The .bash_profile is a file that states which commands will be executed when you open your terminal. (aka Bash).

@mikesjewett
mikesjewett / update_path_for_pg.md
Created December 11, 2012 20:16
Postgresql Troubleshooting - updating PATH variable

For anyone using a Mac (Lion) and running into issues with Postgres as your database (with Postgres.app):

If you are using Postgres.app and getting errors…

  1. Type into terminal: which psql

If the the result is /usr/bin/psql you are using the Mac's built in postgres (not the one you want)

  1. You will need to update your .bash_profile
@mikesjewett
mikesjewett / activerecord_validations.md
Created December 10, 2012 16:11
Bloc Rails Cheatsheet

Common validation helper methods (called in model)

Presence: ensures that a field is present upon submission

validates :name, :email, presence: true

Acceptance: ensures that a checkbox has been checked

validates :terms_of_service, acceptance: true

Format: validates against regexp and returns message if it doesn't pass

validates :email, format: { with: /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i, message: "Valid email required" }