I've been following this blog post on how to set up an api-only Rails 5 application. One of the sections talks about creating a subdomain for your api
Rails.application.routes.draw do
constraints subdomain: "api" do
scope module: "api" do
import SwiftUI | |
struct Dial: View { | |
@Binding public var value: Double | |
public var minValue: Double = 0 | |
public var maxValue: Double = .greatestFiniteMagnitude | |
public var divisor: Double = 1 | |
public var stepping: Double = 1 | |
@State private var dialAngle: Angle = .zero | |
@State private var dialShadowAngle: Angle = .zero |
I've been following this blog post on how to set up an api-only Rails 5 application. One of the sections talks about creating a subdomain for your api
Rails.application.routes.draw do
constraints subdomain: "api" do
scope module: "api" do
var touchstartX = 0; | |
var touchstartY = 0; | |
var touchendX = 0; | |
var touchendY = 0; | |
var gesuredZone = document.getElementById('gesuredZone'); | |
gesuredZone.addEventListener('touchstart', function(event) { | |
touchstartX = event.screenX; | |
touchstartY = event.screenY; |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
# Outputs this at warn log level: | |
# 1.2.3.4 GET /path 200 OK BlahController#action HTML 938.2 (DB 11.8, View 719.7) {params} {optional params from flash[:log]} | |
# | |
# Save as config/initializers/oneline_detailed_logging.rb. Consider | |
# decreasing the log level from "info" to "warn" (in production.rb) so | |
# the one-line log message replaces the standard request logs. | |
# override process_action to add 2 things to the payload: | |
# - remote IP |
I'm a fan of MiniTest::Spec. It strikes a nice balance between the simplicity of TestUnit and the readable syntax of RSpec. When I first switched from RSpec to MiniTest::Spec, one thing I was worried I would miss was the ability to add matchers. (A note in terminology: "matchers" in MiniTest::Spec refer to something completely different than "matchers" in RSpec. I won't get into it, but from now on, let's use the proper term: "expectations").
Let's take a look in the code (I'm specifically referring to the gem, not the standard library that's built into Ruby 1.9):
# minitest/spec.rb
module MiniTest::Expectations
// An example of how to use stack introspection to determine the | |
// filename of a calling script. | |
// | |
// node stack1.js | |
// | |
function blah() { | |
require('./stack2'); | |
} |