CLICK ME
yes, even hidden code blocks!
print("hello world!")
$dry_run = true | |
def clean_automation(klass) | |
puts "#{$dry_run ? 'DRY RUN' : 'Processing'} #{klass.name}" | |
klass.where(:state => %w[pending queued]).in_batches.each_with_index do |relation, batch_index| | |
ids = relation.pluck(:id) | |
queue_relation = MiqQueue.where(:class_name => klass.name, :instance_id => ids) | |
puts " Batch #{batch_index} Size #{ids.size} Queue Item Count: #{queue_relation.size}" |
<hash>
with your gist's hash):
# with ssh
git clone git@gist.github.com:<hash>.git mygist
# with https
git clone https://gist.github.com/.git mygist
Picking the right architecture = Picking the right battles + Managing trade-offs
require 'rails_helper' | |
RSpec.describe TodosController, :type => :controller do | |
describe "GET #index" do | |
#describe "POST #create" do | |
#describe "GET #show" do | |
#describe "PATCH #update" do (or PUT #update) | |
#describe "DELETE #destroy" do | |
#describe "GET #new" do |
Magic words:
psql -U postgres
Some interesting flags (to see all, use -h
or --help
depending on your psql version):
-E
: will describe the underlaying queries of the \
commands (cool for learning!)-l
: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)#!/usr/bin/env ruby | |
require 'octokit' | |
require 'highline/import' | |
require 'colorize' | |
require 'byebug' | |
require 'csv' | |
require 'active_support/time' | |
username = ask("Enter your Github username: ") { |q| q.echo = true } |
<%= render("shared/navbar") %> | |
<div class="container"> | |
<%= render("shared/alerts") %> | |
<%= render("shared/page_header") %> | |
<%= yield %> | |
<%= render("shared/footer") %> |