Skip to content

Instantly share code, notes, and snippets.

@dennyscode
dennyscode / Websites, ..
Last active February 26, 2020 14:18
Keywords, ..
- https://medium.com/
- https://www.websiteboosting.com/
- https://www.reddit.com/r/webdev/
- https://t3n.de/
- https://hackernoon.com/
- https://www.heise.de/
- https://www.smashingmagazine.com/
- https://dzone.com/refcardz
- https://css-tricks.com/
- https://morioh.com/
@dennyscode
dennyscode / instruction.txt
Last active April 28, 2021 00:38
Docker and VSCODE
https://code.visualstudio.com/docs/remote/containers
https://www.youtube.com/watch?v=TVcoGLL6Smo
@dennyscode
dennyscode / Dockerfile
Last active February 25, 2020 23:11
working docker on my renteninfo-project
FROM ruby:2.6.4
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev apt-utils
RUN mkdir /renteninfo
WORKDIR /renteninfo
COPY Gemfile /renteninfo/Gemfile
@dennyscode
dennyscode / snippet.html.erb
Created February 3, 2020 21:35
Active Storage Image Analyzer
<% @posts.each do |post| %>
<%= post.title %><br>
<% post.content.embeds.each do |embeds| %>
<%= url_for(embeds) %><br>
<%= image_tag(embeds, size: "#{embeds.metadata[:width] == nil ? (ActiveStorage::Analyzer::ImageAnalyzer.new(embeds).metadata[:width]) : embeds.metadata[:width]}x#{embeds.metadata[:height] == nil ? (ActiveStorage::Analyzer::ImageAnalyzer.new(embeds).metadata[:height]) : embeds.metadata[:height]}") %><br>
<% end %>
<%= post.content.embeds.length %><br>
<hr>
<% end %>
@dennyscode
dennyscode / #instruction.txt
Last active February 23, 2020 23:56
Basic Docker Setup for a Rails Application
1.) Prepare the 4 files: Dockerfile, Gemfile, Gemfile.lock, docker-compose.yml
2.) Generate the app: $ docker-compose run web rails new . --force --database=postgresql --skip-bundle
3.*) If in Linux: sudo chown _R $USER:$USER .
Finally: )
Run:
docker-compose up
If you have any issues with missing gems and any time you cahnge your Gemfile or Dockerfile, run:
@dennyscode
dennyscode / #instruction.txt
Last active March 13, 2020 21:35
Base: Webpacker with Dev-Server
1.) create directory: $ mkdir appname
2.) enter directory $ cd appname
3.) initialise npm $ npm init
4.) install webpack $ npm install webpack webpack-cli webpack-dev-server css-loader html-webpack-plugin style-loader --save-dev
5.) add script in package.json: "start:dev": "webpack-dev-server"
6.) Add webpack-config including script (from this Gist)
7.) add folder "dist" + index.html & bundle.js (including content associated with files from this Gist)
8.) add folder "src" + index.js & style.css (including content associated with files from this Gist)
9.) Import stylesheet import "./style.css"
10.) In index.html <script src="bundle.js"></script>
dasdasdas
@dennyscode
dennyscode / Gemfile
Last active January 5, 2020 22:57
Problem starting local environment on "rails s"
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.6.3'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.0.1'
gem 'actiontext'
# Use postgresql as the database for Active Record
gem 'pg', '>= 0.18', '< 2.0'
gem "figaro"
@dennyscode
dennyscode / Main.java
Last active November 4, 2019 12:25
Scrape the content of a folder and all its directories with this Java Snippet
package de.producto.tbw.page.v5;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
@dennyscode
dennyscode / error.txt
Last active August 11, 2019 10:06
Problem Deploying Rails6 to Heroku
$git push heroku master
--> works fine until:
remote: [1/4] Resolving packages...
remote: [2/4] Fetching packages...
remote: info There appears to be trouble with your network connection. Retrying...
remote: info There appears to be trouble with your network connection. Retrying...
remote: info There appears to be trouble with your network connection. Retrying...
remote: info There appears to be trouble with your network connection. Retrying...
remote: error An unexpected error occurred: "https://registry.yarnpkg.com/material-design-icons/-/material-design-icons-3.0.1.tgz: ESOCKETTIMEDOUT".