Skip to content

Instantly share code, notes, and snippets.

View Chuloo's full-sized avatar

William Chuloo

View GitHub Profile
@Chuloo
Chuloo / home.jsx
Created October 31, 2021 07:17
Home component for a live-stream simulation player
import Head from "next/head";
import React, { useState } from "react";
import { MemoizedVideoPlayer } from "../component/video-player";
import styles from "../styles/Home.module.css";
const Home = () => {
const [startTime, setStartTime] = useState(1633538276355);
const [controls, setControls] = useState(true);
const [ended, setEnded] = useState(false);
const [duration, setDuration] = useState(null);
@Chuloo
Chuloo / post-checkout.js
Created October 28, 2021 00:01
Post checkout page template for shoppable video
import router from "next/router";
export default function Checkout() {
return (
<div
style={{
display: "flex",
justifyContent: "center",
}}
>
import React, { useState } from "react";
import { Helmet } from "react-helmet";
import TransformVideo from "../components/video";
const App = () => {
const [videoPublicId, setVideoPublicId] = useState("");
const [alt, setAlt] = useState("");
const [audioPublicId, setAudioPublicId] = useState("");
const [textValue, setTextValue] = useState(" ");
const [color, setColor] = useState("green");
@Chuloo
Chuloo / product_data.js
Created July 4, 2021 14:44
Shoppable video product data
const data = [
{
id: "forest_bike",
name: "Forest Bike",
imageUrl:
"https://res.cloudinary.com/dwbggi96z/image/upload/v1622914696/0efbcdf473436391b6a5a731a000fadc_rs6z0z.jpg",
price: "$400",
},
{
@Chuloo
Chuloo / sea_turtle.js
Created July 4, 2021 14:30
Shoppable video configuration for a sea turtle
var sea_turtle = {
shoppable: {
showPostPlayOverlay: true,
transformation: {
crop: "pad",
aspect_ratio: "1",
},
products: [
{
productId: 1,
@Chuloo
Chuloo / forest_bike.js
Created July 4, 2021 14:29
Shoppable video configuration for a forest bike
var forest_bike = {
shoppable: {
showPostPlayOverlay: true,
transformation: {
crop: "pad",
aspect_ratio: "1",
},
products: [
{
productId: 1,
@Chuloo
Chuloo / rafting.js
Created July 4, 2021 14:19
Shoppable product video description for a rafting product
const rafting = {
shoppable: {
transformation: {
crop: "pad",
aspect_ratio: "1",
},
products: [
{
productId: 1,
// New string
const words = "the house, the car, the book, the mac and the cheese"
// Specify search item
const searchTerm = "the"
// Search the string
let lastIndexOfWord = words.lastIndexOf(searchTerm)
// Display last index
@Chuloo
Chuloo / string-lastindex-method.js
Created March 27, 2019 13:45
Last similar name
// List of names
const names = "sean, becky, liz, wale, blue, becky, john"
const searchItem = "becky"
// Find last occurrence of "becky"
const lastSimilarName = names.lastIndexOf(searchItem)
// Display result
console.log(lastSimilarName)
@Chuloo
Chuloo / string-match-method.js
Last active March 27, 2019 13:30
Fetch emails
// Create a string
const email = 'hello@john.com is my email, but i also use sign@john.com or help@sweets.com';
// Create a regex to match all email
const re = /([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi;
// Find emails in string
const matches = email.match(re);
// Display output