This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $start_time = Time.now.to_f | |
| def stamp(label = '') | |
| puts "%.3f\t%s" %[ | |
| Time.now.to_f - $start_time, | |
| label | |
| ] | |
| end | |
| stamp "start" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Read about factories at https://github.com/thoughtbot/factory_girl | |
| FactoryGirl.define do | |
| factory :user do | |
| sequence(:email) { |n| "example#{n}@example.com" } | |
| sequence(:name) { |n| "name#{n}" } | |
| sequence(:username) { |n| "username#{n}" } | |
| password 'changeme' | |
| password_confirmation 'changeme' | |
| confirmed_at { Time.now } | |
| biography <<-EOS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'spec_helper' | |
| describe ConferenceController do | |
| let(:user) { create(:user) } | |
| describe 'testing user' do | |
| it 'checks for admin user' do | |
| expect(user.is_admin).to be_falsey | |
| sign_in user | |
| expect(controller.current_user).to be_truthy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| git clone --depth 1 "$1" temp-linecount-repo && | |
| printf "('temp-linecount-repo' will be deleted automatically)\n\n\n" && | |
| cloc temp-linecount-repo && | |
| rm -rf temp-linecount-repo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| lsof -i :5000 | |
| sudo kill -9 <pid> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\] \[\033[33;1m\]\w\[\033[m\] (\$(git branch 2>/dev/null | grep '^*' | colrm 1 2)) \$ " | |
| # gives me: | |
| wayne ~/dev/lrn (master) $ # my name in green, curr dir in yellow, and branch in green |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ** Invoke db:create (first_time) | |
| ** Invoke db:load_config (first_time) | |
| ** Execute db:load_config | |
| ** Execute db:create | |
| ** Invoke db:drop (first_time) | |
| ** Invoke db:load_config | |
| ** Execute db:drop | |
| ** Invoke db:setup (first_time) | |
| ** Invoke db:schema:load_if_ruby (first_time) | |
| ** Invoke db:create |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rake test TEST=path_to_file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| RSpec.configure do |config| | |
| config.before(:suite) do | |
| FactoryGirl.lint | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Project.joins(“LEFT OUTER JOIN comments | |
| ON comments.polycomment_id = projects.id | |
| AND comments.polycomment_type=’project’ | |
| LEFT OUTER JOIN issues ON issues.project_id = projects.id | |
| AND issues.status=1”) | |
| .where(‘comments.created_at > ? | |
| OR issues.updated_at > ?’, 10.days.ago, 10.days.ago) | |
| .group(‘projects.id’) | |
| .order(‘count(comments.polycomment_id)+4*count(issues.project_id) | |
| desc’) |
OlderNewer