This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/app/views/surveys/create_answer.js.erb | |
$("#survey-#{@survey.id}").html("<div><p>You have submitted the form successfully!</p></div>"); | |
alert('what the fuck'); | |
console.log('why is this working.'); | |
# Controller action | |
def create_answer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class='main-container'> | |
<%= form_tag('/surveys', method: :post) do %> | |
<%= label_tag 'question' %> | |
<%= text_field_tag :question %> | |
<%= submit_tag 'Submit' %> | |
<% end %> | |
<div class='existing-surveys'> | |
<% @surveys.each do |survey| %> | |
<h2> <%= survey.question %> </h2> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
So what you would do is find any letters within the string that show up at least twice. From there you look at the next letter beside it and save that in some sort of entry. That is the substring to beat. Then you run through the rest of the letters to see if anything can beat that record. | |
You do that so on and so forth until you reach the end of your substrings and then return the longest one the program found. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Grade | |
include Comparable | |
attr_reader :grade | |
def initialize(string) | |
@grade = string.downcase | |
end | |
def ==(other_grade) | |
@grade == other_grade.grade |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form method="POST" action="https://payflowlink.paypal.com"> | |
<input type="hidden" name="TYPE" value="S"> | |
<input type="hidden" name="USER1" value="<%= payment_transaction.id %>"> | |
<input type="hidden" name="INVOICE" value="<%= payment_transaction.invoice_code %>"> | |
<input type="hidden" name="NAME" value="<%= payment_transaction.user %>"> | |
<input type="hidden" name="ADDRESS" value="<%="#{billing_address.address_line_1} #{billing_address.address_line_2}" %>"> | |
<input type="hidden" name="CITY" value="<%= billing_address.city %>"> | |
<input type="hidden" name="STATE" value="<%= billing_address.state %>"> | |
<input type="hidden" name="ZIP" value="<%= billing_address.postcode %>"> | |
<input type="hidden" name="COUNTRY" value="<%= billing_address.country %>"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sort_files(file_params, ar_object) # Active Record Object | |
if file_params.values.count >= 2 # <- If there are more than two files being submitted. | |
tmp_filename = "#{Rails.root}/tmp/" << Time.now.strftime('%Y-%m-%d-%H%M%S-%N').to_s << ".zip" # <- Unique file name | |
file_count = 0 | |
Zip::File.open(tmp_filename, Zip::File::CREATE) do |zipfile| # <- Find or create a file with this name | |
file_params.values.each do |file| # <- Loop over all the files in the array. | |
new_filename = "#{file_count += 1}-#{file.original_filename}" | |
puts new_filename | |
zipfile.add(new_filename, file.path) # <- Add file to zip. | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2018-01-05T22:08:07.966404+00:00 app[worker.1]: 4 TID-3otzo WARN: Terminating 1 busy worker threads | |
2018-01-05T22:08:07.968557+00:00 app[worker.1]: 4 TID-3otzo WARN: Work still in progress [#<struct Sidekiq::BasicFetch::UnitOfWork queue="queue:default", job="{\"class\":\"Sidekiq::Extensions::DelayedClass\",\"args\":[\"---\\n- !ruby/class 'Shop'\\n- :import_products\\n- - '1'\\n\"],\"retry\":true,\"queue\":\"default\",\"jid\":\"a11e1afe7d2ba185b877a4b9\",\"created_at\":1515187913.9918175,\"enqueued_at\":1515187913.9923136}">] | |
2018-01-05T22:08:07.969558+00:00 app[worker.1]: 4 TID-3otzo INFO: Pushed 1 jobs back to Redis | |
2018-01-05T22:08:07.970867+00:00 app[worker.1]: 4 TID-vwfvg Sidekiq::Extensions::DelayedClass JID-a11e1afe7d2ba185b877a4b9 INFO: fail: 2173.958 sec | |
2018-01-05T22:08:07.972118+00:00 app[worker.1]: 4 TID-3otzo INFO: Bye! | |
2018-01-05T22:08:08.253807+00:00 heroku[worker.1]: Process exited with status 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const firebase = require('firebase-admin'); | |
function get_artist_by_username(username){ | |
firebase.database().ref('artists').where('artist_name', '==', data['vendor']).then(res => { | |
return res | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function send_to_stripe(billing_data) { | |
console.log(billing_data) | |
stripe.customers.create({ | |
email: billing_data['email'] | |
}).then(customer => { | |
const res = client.query('UPDATE customers SET stripe_customer_id=$1 WHERE email=$2', [ customer.id, billing_data['email'] ]) | |
return stripe.customers.createSource(customer.id, { | |
source: "" // <- What do I put here? | |
object: "card", | |
name: billing_data['first_name'] + billing_data['last_name'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
router.get('/', add_site_form) | |
.get('/auth/', auth) | |
.get('/verify/:app_id', verify) | |
.get('/webhooks/:shop_id', go_webhooks) | |
.post('/webhooks/:action/:shop_id', go_webhook) | |
.post('/products/create/:shop_id', product_create); | |
.post('/customers/create/:shop_id', customer_create); | |
/mnt/c/Users/Matt/Desktop/NodeProjects/myapp/app.js:10 | |
.post('/customers/create/:shop_id', customer_create); |
NewerOlder