Skip to content

Instantly share code, notes, and snippets.

View fullstackmafia's full-sized avatar

Raphael Ugwu fullstackmafia

  • Nautical Commerce
  • Toronto, Ontario
View GitHub Profile
<svelte:head>
<title>Giftcards</title>
</svelte:head>
<script>
import { onMount } from 'svelte';
const accessToken = 'Bearer ACCESS_TOKEN'
package com.example.restapi;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
package com.example.restapi;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.List;
@JsonIgnoreProperties(ignoreUnknown = true)
public class Countries {
import React, { useReducer } from "react";
const myStyle = {
color: "white",
fontSize: "20px"
};
export default function Recipe() {
const initialState = {
RecipePrice: 0,
import useLockBodyScroll from "./useLockBodyScroll";
export default function Landing() {
useLockBodyScroll();
const [data, setData] = useState([]);
useEffect(() => {
fetch(URL)
.then(response => response.json())
.then(data => setData(data));
}, []);
import { useLayoutEffect } from "react";
export default function useLockBodyScroll() {
useLayoutEffect(() => {
// Get original value of body overflow
const originalStyle = window.getComputedStyle(document.body).overflow;
// Prevent scrolling on mount
document.body.style.overflow = "hidden";
// Re-enable scrolling when component unmounts
return () => (document.body.style.overflow = originalStyle);
import React from "react";
import { useArray } from "react-hanger";
const myStyle = {
color: "white"
};
export default function App() {
const todos = useArray(["35cl", "50cl", "60cl"]);
return (
<div style={myStyle}>
import React from "react";
import Purchase from "./components/Purchase";
import Landing from "./components/Landing";
import HomePage from "./components/HomePage";
const Routes = {
"/": () => <HomePage />,
"/purchase": () => <Purchase />,
"/landing": () => <Landing />
};
import React from "react";
import useForm from "react-hook-form";
const active = {
fontSize: "15px"
};
export default function Purchase() {
const { register, handleSubmit, errors } = useForm();
const onSubmit = data => { // upload the data retreived from the form to a database, return value to a user, etc
console.log(data);
import React, { useState, useEffect } from "react";
const URL = "https://api.punkapi.com/v2/beers";
export default function Landing() {
const [beer, setBeer] = useState([]);
useEffect(() => {
fetch(URL)
.then(response => response.json())
.then(beer => setBeer(beer));
}, {});