Skip to content

Instantly share code, notes, and snippets.

@staycreativedesign
staycreativedesign / application.js
Created January 30, 2020 23:37
I get this error Uncaught TypeError: $(...).isotope is not a function
// This file is automatically compiled by Webpack, along with any other files
// present in this directory. You're encouraged to place your actual application logic in
// a relevant structure within app/javascript and only use these pack files to reference
// that code so it'll be compiled.
require("@rails/ujs").start()
require("turbolinks").start()
require("@rails/activestorage").start()
require("channels")
require('jquery')
@staycreativedesign
staycreativedesign / create.js.erb
Last active January 16, 2020 03:42
Here is what is happening If the user gets a card error on AttachPaymentMethodService.new(@current_user.stripe_id,params[:cc]).call) it returns the error message which is on the bottom of donations_controller.rb how so it returns "Your card has insufficient funds." How can I return the error as well and exit out of the method?
<% if @message == 'success' %>
$(location).attr('href', '/thank-you');
<% else %>
$(".outcome-status").hide();
$("#poker_button").attr("disabled", false);
$("#poker_button").html('Donate');
$("#poker_button").css('background-color', '#293B57');
$(".outcome").append("<div class='outcome-status alert alert-danger'> <%= @failure_message %><div>")
<% end %>
@staycreativedesign
staycreativedesign / donations_controller.rb
Created December 31, 2019 02:42
when successful it sends a rails ajax post to donations
class DonationsController < ApplicationController
def new
end
def create
amount = CorrectMoneyService.new(params[:amount]).call
@current_user = FindMemberService.new(params).call
session[:user_id] = @current_user.id
#begin
AttachPaymentMethodService.new(@current_user.stripe_id, params[:cc]).call
@staycreativedesign
staycreativedesign / new.haml
Last active December 28, 2019 20:29
How do I send the params from the form to the ajax and then to controller?
= form_tag donations_path, id: "payment-form", remote: true do
%h5.uppercase.mt-5
%strong Credit Card information
%hr
.row
.col-md-4
%label
Card number
#card-number-element.field.form-control
.col-md-4
@staycreativedesign
staycreativedesign / error.log
Created December 14, 2019 20:09
What do I replace card with since I have different card elements? Line #42
Uncaught (in promise) ReferenceError: card is not defined
at new:565
@staycreativedesign
staycreativedesign / donations_controller.rb
Last active December 14, 2019 17:32
what am i expecting to happen : When I run the fetch it returns a client secret which than can be used for down the rabbit hole
class DonationsController < ApplicationController
def new
end
def create_payment_intent
amount = CorrectMoneyService.new("$400.00").call
intent = Stripe::PaymentIntent.create({
amount: amount,
currency: 'usd',
})
@staycreativedesign
staycreativedesign / new.haml
Created December 14, 2019 07:03
what am i expecting to happen : When I run the fetch it returns a client secret which than can be used for down the rabbit hole
var form = document.getElementById('payment-form');
form.addEventListener('submit', function(event) {
event.preventDefault();
if ($('#amount').not(':empty')){
$("#poker_button").attr("disabled", true);
$("#poker_button").html('We are processing your donation, please wait');
$("#poker_button").css('background-color', '#28a745');
};
var response = fetch('/donations/create_payment_intent')
function stripetokenhandler(token) {
// insert the token id into the form so it gets submitted to the server
var form = document.getelementbyid('payment-form');
var hiddeninput = document.createelement('input');
hiddeninput.setattribute('type', 'hidden');
hiddeninput.setattribute('name', 'stripetoken');
hiddeninput.setattribute('value', token.id);
form.appendchild(hiddeninput);
// submit the form
https://blueskybio.com/store/register/?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=?update=yes&back=
Create hexagon map
Each hexagon will have attributes attached to it which it modifies the game chit.
Example Hexagon Tile:
Clear
Road +1 Extra Movement Point
Example Hexagon Tile:
Forest -2 Movement Points
Chit