Skip to content

Instantly share code, notes, and snippets.

@dennyscode
dennyscode / README.txt
Created June 11, 2019 09:53
Modifying nodes on the fly
How can I modify a node on my rails app?
(I am showing a calendar with the current month, when clicking next month,
it has to delete the old nodes and go through the function again of displaying my calendar.)
I have been using content_tag for creating the nodes with ruby. Just the issue of deleting nodes on the fly..
When using JavaScript it seemed much easier but there has to be a way with ruby, right?
It´s all about the show_calendar - method. It´s taking a date as an argument, so it will render the appropriate month.
@dennyscode
dennyscode / instruction.txt
Created May 14, 2019 09:54
Crypto-Calculator by zayne
Here is the official YouTube-Video from "zayne"
https://www.youtube.com/watch?v=dpYPLUO3QcI
This is a step by step tutorial of the video above.
-- ## -- ## -- ## -- ## -- ## -- ## -- ## -- ## -- ## -- ## -- ## -- ## -- ## -- ## -- ## -- ## -- ## -- ## -- ## --
-- STARTING WITH THE RAILS SECTION -- -- STARTING WITH THE RAILS SECTION -- -- STARTING WITH THE RAILS SECTION --
-- ## -- ## -- ## -- ## -- ## -- ## -- ## -- ## -- ## -- ## -- ## -- ## -- ## -- ## -- ## -- ## -- ## -- ## -- ## --
1.) $rails new crypto-calc --webpack=react --database=postgresql
2.) $rake db:create
@dennyscode
dennyscode / image_stuffer.rb
Created February 7, 2019 11:49
IMAGE-STUFFING
## IMAGE-STUFFING
##
## The Product-Model column 'image_url' only keeps one image at a time.
## This script takes a text and slices it into elements by seperating
## names by prefix '#$#' and deleting the ', ' when needed.
##
## MainFunction: img_api running on api_choice which is a while-loop menu.
## Functions: - R Read available Images
## - C Count number of Images
## - W Write / Add a new Image
@dennyscode
dennyscode / log rails routes
Created February 1, 2019 13:39
Mailer-Problem
Prefix Verb URI Pattern Controller#Action
new_user_session GET /login(.:format) devise/sessions#new
user_session POST /login(.:format) devise/sessions#create
destroy_user_session GET /logout(.:format) devise/sessions#destroy
new_user_password GET /password/new(.:format) devise/passwords#new
edit_user_password GET /password/edit(.:format) devise/passwords#edit
user_password PATCH /password(.:format) devise/passwords#update
@dennyscode
dennyscode / log.txt
Created January 22, 2019 08:38
Error-Code when starting
$ rails s
/home/chocolope/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/railties-5.2.2/lib/rails/app_loader.rb:53: warning: Insecure world writable dir /home/chocolope/.rbenv/versions/2.5.3 in PATH, mode 040777
/home/chocolope/.rbenv/versions/2.5.3/lib/ruby/2.5.0/fileutils.rb:90: warning: already initialized constant FileUtils::VERSION
/home/chocolope/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fileutils-1.1.0/lib/fileutils.rb:92: warning: previous definition of VERSION was here
/home/chocolope/.rbenv/versions/2.5.3/lib/ruby/2.5.0/fileutils.rb:1188: warning: already initialized constant FileUtils::Entry_::S_IF_DOOR
/home/chocolope/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fileutils-1.1.0/lib/fileutils.rb:1267: warning: previous definition of S_IF_DOOR was here
/home/chocolope/.rbenv/versions/2.5.3/lib/ruby/2.5.0/fileutils.rb:1446: warning: already initialized constant FileUtils::Entry_::DIRECTORY_TERM
/home/chocolope/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fileutils-1.1.0/lib/fileutils.rb:1541
@dennyscode
dennyscode / log.txt
Created January 21, 2019 13:22
CF 6.8 Brakeman Log
$ brakeman webshop
Loading scanner...
Processing application in /mnt/c/users/chocolope/careerfoundry/6/webshop/webshop
Processing gems...
[Notice] Detected Rails 5 application
Processing configuration...
[Notice] Escaping HTML by default
Parsing files...
Processing initializers...
Processing libs...ed
@dennyscode
dennyscode / factory_bot.rb
Last active January 18, 2019 14:42
6.4 CF Error Factory not registered
RSpec.configure do |config|
config.include FactoryBot::Syntax::Methods
end
@dennyscode
dennyscode / fix.txt
Last active January 18, 2019 12:34
RSpec-Question regarding Path
context 'when a user is not logged in' do
it 'redirects to root' do
get :show, params: { id: user_one.id }
expect(response).to redirect_to(root)
end
end
@dennyscode
dennyscode / _form.html.erb
Created January 17, 2019 18:04
Menu-App: Nested Routes
This file is located in app/views/orders/..
--> The problem must be the path in line 4 model: "xxxxx" <--
--> See log file in log.txt <--
<%= form_with(model: customer_orders, local: true) do |form| %>
<% if order.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(order.errors.count, "error") %> prohibited this order from being saved:</h2>
@dennyscode
dennyscode / contact_mailer-error.txt
Created January 13, 2019 15:16
Contact Mailer Error
2019-01-13T15:13:33.354955+00:00 heroku[router]: at=info method=GET path="/simple_pages/contact" host=enigmatic-meadow-72765.herokuapp.com request_id=06830673-8d5e-4da5-b0b5-e3b956834207 fwd="95.91.246.143" dyno=web.1 connect=1ms service=11ms status=200 bytes=6701 protocol=https
2019-01-13T15:13:33.344462+00:00 app[web.1]: I, [2019-01-13T15:13:33.344353 #4] INFO -- : [06830673-8d5e-4da5-b0b5-e3b956834207] Started GET "/simple_pages/contact" for 95.91.246.143 at 2019-01-13 15:13:33 +0000
2019-01-13T15:13:33.345545+00:00 app[web.1]: I, [2019-01-13T15:13:33.345480 #4] INFO -- : [06830673-8d5e-4da5-b0b5-e3b956834207] Processing by SimplePagesController#contact as HTML
2019-01-13T15:13:33.346659+00:00 app[web.1]: I, [2019-01-13T15:13:33.346584 #4] INFO -- : [06830673-8d5e-4da5-b0b5-e3b956834207] Rendering simple_pages/contact.html.erb within layouts/application
2019-01-13T15:13:33.348072+00:00 app[web.1]: I, [2019-01-13T15:13:33.347988 #4] INFO -- : [06830673-8d5e-4da5-b0b5-e3b956834207] Rendered simple_pa