Skip to content

Instantly share code, notes, and snippets.

View BryanHeath's full-sized avatar

Bryan Heath BryanHeath

  • California, USA
View GitHub Profile
@BryanHeath
BryanHeath / scrollTo_examples.md
Created September 20, 2017 21:04
Laravel Dusk scrollTo Macro Examples
    /** @test */
    public function can_register()
    {
        $this->browse(function (Browser $browser) {
            $browser->maximize();
            
            $fake = [
                'first_name' => $this->faker->firstNameMale,
 'last_name' => $this->faker->lastName,
@BryanHeath
BryanHeath / scrollTo.md
Last active March 13, 2019 11:26
Laravel Dusk scrollTo Macro
Browser::macro('scrollTo', function($selector) {
    $this->driver->executeScript("$(\"html, body\").animate({scrollTop: $(\"$selector\").offset().top}, 0);");
    return $this;
});
/** @test */
public function stripe_v3_example()
{
    $this->browse(function (Browser $browser) {
        $browser->visit('/testv3')
                ->waitFor('iframe[name=__privateStripeFrame3]')
                ->assertSee('Name')
                ->keys('input[name="cardholder-name"]', 'Test User')
 ->keys('input[placeholder="(123) 456-7890"]', '555 555 5555')
<div class="Fieldset-childLeftRight Fieldset-childTop Textbox Textbox--iconLeft can-setfocus"><div class="Textbox-inputRow"><label class="Textbox-label" for="1340dc70-60e3-11e7-9637-4d63652b5c74">Card number</label><input type="tel" class="Fieldset-input Textbox-control" id="1340dc70-60e3-11e7-9637-4d63652b5c74" value="" inputmode="numeric" placeholder="Card number" autocomplete="cc-number" autocorrect="no" autocapitalize="no" spellcheck="no"><div class="Textbox-iconLeft"><span class="Icon-wrapper"><svg role="img" class="Icon" fill="#2b2b2b" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30">
  <title>Credit Card</title>
  <path fill-rule="evenodd" transform="translate(8, 10)" d="M2.00585866,0 C0.898053512,0 0,0.900176167 0,1.99201702 L0,9.00798298 C0,10.1081436 0.897060126,11 2.00585866,11 L11.9941413,11 C13.1019465,11 14,10.0998238 14,9.00798298 L14,1.99201702 C14,0.891856397 13.1029399,0 11.9941413,0 L2.00585866,0 Z M2.00247329,1 C1.44882258,1 1,1.4463114 1,1.99754465 L1,9.002
/** @test */
public function stripe_v2_example()
{
    $this->browse(function (Browser $browser) {
        $browser->visit('/test')
                ->assertSee('Pay with Card')
                ->press('Pay with Card')
                ->waitFor('iframe[name=stripe_checkout_app]');
<script src="https://js.stripe.com/v2/"></script>
<script src="https://js.stripe.com/v3/"></script>
...
<script
    src="https://checkout.stripe.com/checkout.js" class="stripe-button"
    data-key="{{ env('STRIPE_KEY') }}"
    data-amount="100000000"
    data-name="TestSite.com"
 data-description="Donate to Taylor"
@BryanHeath
BryanHeath / Email Validation Class
Last active January 15, 2021 10:50
Email Validation Class
<?php
class EmailValidationService
{
/**
* @param string $address
*
* @return bool
*/
public function validEmail($address)
@BryanHeath
BryanHeath / my.zshrc
Last active October 12, 2016 18:05
my .zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
#ZSH_THEME="robbyrussell"