- You MUST NOT try and generate a Rails app from scratch on your own by generating each file. For a NEW app you MUST use
rails newfirst to generate all of the boilerplate files necessary. - Create an app in the current directory with
rails new . - Use Tailwind CSS for styling. Use
--css tailwindas an option on therails newcall to do this automatically. - Use Ruby 3.2+ and Rails 8.0+ practices.
- Use the default Minitest approach for testing, do not use RSpec.
- Default to using SQLite in development.
rails newwill do this automatically but take care if you write any custom SQL that it is SQLite compatible. - An app can be built with a devcontainer such as
rails new myapp --devcontainerbut only do this if requested directly. - Rails apps have a lot of directories to consider, such as app, config, db, etc.
- Adhere to MVC conventions: singular model names (e.g., Product) map to plural tables (products); controllers are plural.
- Guard against incapable browsers accessing controllers with `allo
Go has a number of low-level crypto APIs which check off marketing bullet-points (got FIPS supprt, check!) but is missing an high-level API usable by mere mortal programmers. Imagine you want to create a document, sign it and verify that document later. Now check out Go's crypto APIs and give up in frustration after an hour of Googling.
The API should encapsulate a half-dozen common operations and make them as easy as possible. Avoid choice where possible, just pick something reasonably secure in 2014 for me and use it! I'm speaking specifically of a few basic actions (yes, this API is very naive/non-idiomatic), call it crypto/easy:
- Create me a public/private key pair and save it to the filesystem.
// create and persist a keypair to the current directory.
// this is just a one-time operation, now we have a keypair to use.
easy.CreateKeyPair()| ### spec/serializers/building_spec.rb | |
| require "spec_helper" | |
| describe BuildingSerializer do | |
| include Rails.application.routes.url_helpers | |
| let(:room) { create :room } | |
| let(:building) { room.building } | |
| let(:hash) { BuildingSerializer.new(building).serializable_hash } |
Hi there!
The docker cheat sheet has moved to a Github project under https://github.com/wsargent/docker-cheat-sheet.
Please click on the link above to go to the cheat sheet.
Dashing widget to show the build status of a CircleCI project.
- Get a Circle API Token from your Account Dashboard and set it in your environment as
CIRCLE_CI_AUTH_TOKEN - Add the
httpartyto your Gemfile and runbundle install
Then:
| #!/bin/bash | |
| git checkout master | |
| git pull | |
| git branch --remotes --merged | grep origin > .master_merged | |
| git checkout release-staging | |
| git pull | |
| git branch --remotes --merged | grep origin > .staging_merged | |
| diff .master_merged .staging_merged | |
| rm .master_merged .staging_merged |
| # config/initializers/tumbz_init.rb | |
| Tumbz.configure do |config| | |
| config.access_key = "foo" | |
| config.access_secret = "bar" | |
| end | |
| # lib/tumbz.rb | |
| module Tumbz | |
| def self.configure | |
| @options = OpenStruct.new |
| get '/travis/:id/status' do |id| | |
| token = "token!!" | |
| http = Net::HTTP.new('magnum.travis-ci.com', 443) | |
| http.use_ssl = true | |
| path = "/Readmill/#{id}.png?token=#{token}" | |
| response = http.head(path, nil) | |
| if response['Content-Disposition'].include?('failing') | |
| @message = "The build failed." |
| require 'java' | |
| require 'JLink.jar' | |
| # Java::ComWolframJlink::KernelLink | |
| # http://reference.wolfram.com/mathematica/JLink/ref/java/com/wolfram/jlink/KernelLink.html | |
| # http://reference.wolfram.com/mathematica/JLink/ref/java/com/wolfram/jlink/MathLink.html | |
| # Java::ComWolframJlink::MathLinkException | |
| # Java::ComWolframJlink::MathLinkFactory | |
| # http://reference.wolfram.com/mathematica/JLink/ref/java/com/wolfram/jlink/MathLinkFactory.html |
| git rev-parse HEAD | tr -d '\n' | pbcopy |