Skip to content

Instantly share code, notes, and snippets.

class CheckIfDonorIsMemberService
def call
if Membership.find_by(email: @email)
@current_user = Membership.find_by(email: @email)
else
false
end
end
"url(\"https://www.premierleague.com/resources/prod/c88a89e-636/i/sprites/[email protected]\")"
to
"https://www.premierleague.com/resources/prod/c88a89e-636/i/sprites/[email protected]"
Error detected while processing function <SNR>46_HighlightEOLWhitespaceExceptCurrentLine:
line 1:
E461: Illegal variable name: a:exclude_current_line_eol_whitespace_pattern
Press ENTER or type command to continue
Error detected while processing function <SNR>46_HighlightEOLWhitespaceExceptCurrentLine:
line 3:
E121: Undefined variable: a:exclude_current_line_eol_whitespace_pattern
Press ENTER or type command to continue
Started GET "/presign?filename=bar.jpg" for 127.0.0.1 at 2019-03-16 17:47:32 -0500
Started GET "/presign?filename=foo.pdf" for 127.0.0.1 at 2019-03-16 17:47:32 -0500
Started PATCH "/admin/courses/foobar/lessons/part-1-introduction-to-fun-stuff" for 127.0.0.1 at 2019-03-16 17:48:20 -0500
Processing by Admin::LessonsController#update as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"/5MUr1oLT/vaBhy2wnxiZONrx6c21PYshnIdrZAv8uahgoPglKbNujCTu9tXFB2eakk5Doy5ChyNGYRzHAQPxQ==", "lesson"=>{"title"=>"Part 1: Introduction to Fun stuff", "video_link"=>"https://player.vimeo.com/video/316481875?byline=0&portraitrtrait=0", "documents_attributes"=>{"graphic"=>"{\"id\":\"171e46b1408211f235a504146b72e321.pdf\",\"storage\":\"cache\",\"metadata\":{\"size\":361072,\"filename\":\"TheRealMessiah.pdf\",\"mime_type\":\"application/pdf\"}}"}, "description"=>"<p>This is going to be intrsi</>eresting</p>"}, "uploading_image"=>"", "commit"=>"Update Lesson", "course_id"=>"kaballah-of-you", "id"=>"part-1-introduction-to-fun-stuff
module ApplicationHelper
def login_logout
if current_user.role == 'none'
content_tag :li do
link_to "Login", login_path
end
else
content_tag :li do
link_to "logout", logout_path
@staycreativedesign
staycreativedesign / foo.haml
Created February 20, 2019 15:40
how do i make this work in production?
.membership-benefits.background-image-holder-login{:style => "background: url(/assets/create-membership-min.jpg);"}
@staycreativedesign
staycreativedesign / foo.rb
Last active January 22, 2019 18:09
I want to route to the specific post like this /knowledge/:of_type/:id . get '/knowledge/:of_type/:id', to: 'posts#show', as: 'post' but the :of_type isnt enforced i can literally put anything on there . how can i make it that it adds whatever is in of_type into the url structure?
here is the schema of my post model
# == Schema Information
#
# Table name: posts
#
# id :bigint(8) not null, primary key
# author :string
# content :text
# title :string
# excerpt :text
function reloadSubCategories (category, submenu) {
if (category && submenu) {
$.getScript('/admin/categories/'+ category +'/submenus/'+ submenu +'/subcategories', function(){
var subcat = $('#post_subcategory_id').val();
$("#new_subcategory").attr("action", '/admin/categories/' + category + '/submenus/' + submenu + '/subcategories')
$('#new_post').attr('action', '/admin/categories/' + category + "/submenus/" + submenu + '/subcategories/' + subcat + '/posts')
});
} else {
console.log("miss1")
$('#post_subcategory_id').empty();
.col-sm-4
= f.label :subcategory_id
= f.select "subcategory_id", @submenu.subcategories.collect { |o| [ o.title, o.id ] }
%button.btn.btn-secondary{"data-target" => "#createsubcategory", "data-toggle" => "modal", :type => "button"}
Create Subcategory
$('#post_subcategory_id').on('change', function(e){
console.log("I caught the change of the subcategory")
var subcatVal = $(this).val();
var category = $(this).closest("form").find("#post_category_id").val();
@staycreativedesign
staycreativedesign / _form.haml
Last active December 8, 2018 03:11
the subcategories aren't getting updated correctly when I switch to other categories
.row
.col-sm-4
= f.label :category_id
= f.select :category_id, Category.all.collect { |o| [ o.title, o.id ] }, { selected: @category.id }
%button.btn.btn-secondary{"data-target" => "#createcategory", "data-toggle" => "modal", :type => "button"}
Create Category
.col-sm-4
= f.label :submenu_id
= f.select :submenu_id, @category.submenus.collect { |o| [ o.title, o.id ] }
%button.btn.btn-secondary{"data-target" => "#createsubmenu", "data-toggle" => "modal", :type => "button"}