Note: Office only
mso-ansi-font-size: large | larger | <length> | medium | <percentage> | small | smaller | x-large | x-small | xx-large | xx-small
#/spec/support/controller_helpers.rb | |
module ControllerHelpers | |
def login_devise_user(options = {}) | |
@request.env["devise.mapping"] = Devise.mappings[:user] | |
user = FactoryGirl.create(:user, options) | |
sign_in user | |
user | |
end | |
def login_omniauth_user(provider) |
#/spec/controllers/home_controller_spec.rb | |
require 'rails_helper' | |
describe HomeController do | |
shared_examples_for "home controller" do | |
it "should have a current_user" do | |
expect(subject.current_user).to_not eq(nil) | |
end | |
it "should get index" do |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Accept</title> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8"> | |
<meta name="viewport" content="width=320, user-scalable=no"> | |
<% if Accounting.config.gateway == :production %> | |
<script type="text/javascript" src="https://js.authorize.net/v1/Accept.js" charset="utf-8"></script> |
/** | |
* Accept.js Webview implementation HOC | |
* | |
* Inspired by https://gist.github.com/mingca/3bc6e349a80a2957dfdc4b59c7154bec | |
*/ | |
import React, { Component } from 'react'; | |
import PropTypes from 'prop-types'; | |
import { | |
ScrollView, |
/* services/billing.js */ | |
/* Convert Accept.js XmlHttpRequest to Promise */ | |
function createPaymentAsync(data) { | |
return new Promise(resolve => { | |
window.Accept.dispatchData(data, resolve); | |
}); | |
} | |
/* Parse Accept Errors */ |
# File: app.rb | |
require 'date' | |
require 'test/unit' | |
CITY_ABBREVS = { | |
'LA' => 'Los Angeles', | |
'NYC' => 'New York City' | |
}.freeze |
# "Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: | |
# 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... | |
# By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms." | |
# Instructions: | |
# Construct a solution using Ruby that could be incorporated into a larger project. Solutions will be evaluated for readability, testability, and extensibility. | |
# Calculate sum of even-valued terms in fibonacci | |
class Fibonacci | |
attr_accessor :limit |
/** | |
* Created by Guy Blank on 3/9/17. | |
* | |
* This is a sample provides an API to send & receive messages to and from the React-Native WebView (using postMessage/onMessage WebView API). | |
* | |
* webViewBridge.send('functionToInvoke', {mydata: 'test'}, function(){console.log('success')},function(){console.log('error')}); | |
* | |
* The API is designed to be similar to the Cordova exec API so migration to it should be almost seamless. | |
* The API also provides solution to a React-Native WebView bug in iOS which causes sending consecutive postMessage calls to override each other. | |
* |
/* | |
Flatten Array - exactly same with Ruby's Array#flatten | |
Example: | |
flatten([[1, 2, 3], [4, 5]]); // [1, 2, 3, 4, 5] | |
*/ | |
function flatten(arr) { | |
return arr.reduce(function (flat, toFlatten) { | |
return flat.concat(Array.isArray(toFlatten) ? flatten(toFlatten) : toFlatten); | |
}, []); | |
} |