Skip to content

Instantly share code, notes, and snippets.

@darkbushido
darkbushido / sinatra_proxy
Created September 25, 2020 15:34 — forked from burgalon/ sinatra_proxy
Testing client side app (like BackboneJS) with Capybara, VCR, webmock, factory girl
Testing client side app (like BackboneJS) with Capybara, VCR, webmock, factory girl
def base_method_name(params)
if Flipper.enabled?(:feature_flag)
base_method_name_feature_enabled(params)
else
base_method_name_feature_disabled(params)
end
end
def base_method_name_feature_enabled(params)
# How it behaves with the feature flag enabled
function highlight_part {
parameter SP, SM.
if not SM:HASDATA and not SM:INOPERABLE { HIGHLIGHT(SP, BLUE). return true. }
else if SM:HASDATA { HIGHLIGHT(SP, GREEN). }
else { HIGHLIGHT(SP, YELLOW). return false. }
}
function collect_science {
local SL to lex(). local SMS to lex().
local DMMS to list("ModuleScienceExperiment", "DMModuleScienceAnimate", "DMBathymetry").
for module_name in DMMS {
function landing_pos { return latlng(p["LND"]["LatLng"]:lat,p["LND"]["LatLng"]:lng). }
function R_ship { return ship:body:position. }
function angle_diff_h { return VANG(-R_ship(), landing_pos():position - R_ship()). }
function dist_diff_h { return (angle_diff_h()/360) * 2 * constant:pi()*R_ship():mag. }
function velocity_h_norm { return VCRS(VCRS(R_ship(),ship:velocity:orbit),R_ship()):normalized. }
function speed_h { return VDOT(velocity_h_norm(),ship:velocity:orbit). }
function position_speed_h { return landing_pos():altitudevelocity(altitude):orbit:mag. }
function speed_diff_h { return speed_h() - position_speed_h(). }

Keybase proof

I hereby claim:

  • I am DarkBushido on github.
  • I am darkbushido (https://keybase.io/darkbushido) on keybase.
  • I have a public key whose fingerprint is 10FB EA08 25C8 AF7E FD87 D7A8 3922 EB70 FB80 E8DD

To claim this, I am signing this object: