Skip to content

Instantly share code, notes, and snippets.

@dennyscode
dennyscode / GA-GENERAL.md
Last active August 29, 2023 09:31
Google Analytics with React

Engagement rate vs. Bounce Rate A session is a period during which a user is engaged with your website or app. An engaged session is a session that lasts longer than 10 seconds, has a conversion event, or has at least 2 pageviews or screenviews. The engagement rate is the percentage of engaged sessions on your website or mobile app. The bounce rate is the opposite of the engagement rate. The bounce rate is the percentage of sessions that were not engaged.

@dennyscode
dennyscode / README.md
Created March 3, 2023 10:56
Mobile Debugging with Chrome

1.) Connect Phone with USB cable, it must be Android! 2.) Go to Settings -> About Phone -> Click "Build Number" 3 times! It will say "Now, you´re a developer!" 3.) Now, in System-Settings you will have a new option "Developer Settings" 4.) In this menu, enable USB-Debugging: This enables the PC to connect to the phone and control it 5.) Now, open Chrome on the notebook and open chrome. 6.) Enter chrome://inspect

@dennyscode
dennyscode / _readme.md
Created July 31, 2022 21:12
useScrollPosition-Hook React/NextJS

** This is two different approache of how to get the scroll position with React / NextJS:

1.) With a Hook-Function

2.) With a Function Call

@dennyscode
dennyscode / formatIsoDate.js
Last active July 29, 2022 11:28
Format to ISO Date Format
// vanillaJS
export function formatIsoDate(date: Date) {
const day = date.getDay() < 10 ? `0${date.getDay()}` : date.getDay()
const month = date.getMonth() < 10 ? `0${date.getMonth()}` : date.getMonth()
const year = date.getFullYear()
return `${year}-${month}-${day}`
}
@dennyscode
dennyscode / 00_start.md
Last active May 11, 2021 23:26
Wordpress Ajax
@dennyscode
dennyscode / 0
Last active April 28, 2021 00:36
Hardhat Tutorial
This is a tutorial from Eat The Blocks
https://www.youtube.com/watch?v=9Qpi80dQsGU&t=2000s
@dennyscode
dennyscode / Instruction
Created April 22, 2021 08:46
Web 1st interaction
Web3.js Intro · Web3.js · #1 Ethereum Blockchain Developer Crash Course
Dapp University
https://www.youtube.com/watch?v=t3wM5903ty0&t=18s
------------------------------------------------------------------------
### A: Setup local project and configure remote infura blockchain
1.) Setup npm
2.) npm install web3
3.) Register at infura.io
4.) Create an infura-project and copy its API-URL for Mainnet
@dennyscode
dennyscode / 1. setup
Last active April 19, 2021 21:40
integrate with web3
1.) truffle unbox react
--> this create simple smart contracts and a react environment
2.) [just info] that´s basically the setup within App.js, but it´s just an example and not used:
let web3;
if(window.ethereum) {
web3 = new Web3(window.ethereum)
await ethereum.enable();
// can use web3 with Metamask
} else if(window.web3) {
@dennyscode
dennyscode / generate_image.js
Created March 30, 2021 16:21
This is the attempt of storing a index.html inside a variable
// Example starts at line 16:
const nodeHtmlToImage = require('node-html-to-image')
const fs = require('fs');
const util = require("util");
const image = fs.readFileSync('./svb_card_frontside_1.jpg');
const base64Image = new Buffer.from(image).toString('base64');
const dataURI = 'data:image/jpeg;base64,' + base64Image
@dennyscode
dennyscode / _posts_teaser.html.erb
Created March 9, 2020 20:45
Grab ActiveStorage Images and display - example
<div class="posts_teaser">
<% @posts.each do |post| %>
<%= link_to(post_path(post), class: "posts_teaser__item") do %>
<div class="posts_teaser__box">
<p><%= post.title %></p><br>
<p><%= truncate(post.preview, length: 80) %></p><br>
</div>
<div class="posts_teaser__box">
<% post.content.embeds.each_with_index do |embeds, i| %>
<% if i === 0 %>