Skip to content

Instantly share code, notes, and snippets.

View albertkimdev's full-sized avatar
🏠
Working from home

Albert Kim albertkimdev

🏠
Working from home
View GitHub Profile
import { useCallback } from "react";
import { extendObservable, makeAutoObservable, toJS } from "mobx";
import debounce from "../utils/debounce";
import ComponentData from "../components/Templates/ComponentData";
class SiteState {
id = "";
subdomain = "";
components = {};
componentsList = [];
import styled from "styled-components";
export const Wrapper = styled.div`
padding: 2rem;
display: flex;
flex-direction: column;
position: relative;
z-index: 35;
background: ${(props) => props.color2};
export default {
["OnlyLinks"]: {
title: "Only Links",
subtitle:
"A simple page to show off your profile, social media, and external links.",
demoLinks: ["https://google.ca", "https://google.ca"],
tags: ["Link in bio", "Minimal", "Profile"],
inputCategories: ["Color", "Fonts", "Profile", "Social", "Content"],
inputs: {
Publish: {
export default {
["CoolText"]: {
title: "Cool Text",
subtitle: "Create a cool text animation.",
demoLinks: [
"https://cooltext-1.leavewithaweb.site/",
"https://cooltext-2.leavewithaweb.site/",
],
tags: ["Animation", "Minimal", "Profile"],
inputCategories: [
@albertkimdev
albertkimdev / BigPhoto.jsx
Created February 20, 2024 17:53
The React component which takes in input and outputs a customized React component which is a website.
import { toJS } from "mobx";
import { observer } from "mobx-react";
import React from "react";
import { siteState } from "../../stores/SiteState";
import styled from "styled-components";
import PrintSocial from "../../components/Templates/pure/PrintSocial";
import { uiState } from "../../stores/UiState";
const Wrapper = styled.div`
height: ${(props) => props.previewHeight};
@albertkimdev
albertkimdev / BigPhotoData.js
Created February 20, 2024 17:51
The JSON object which represents the template.
export default {
["BigPhoto"]: {
title: "Big Photo",
subtitle: "A huge website designed for leaving a big impression.",
demoLinks: [
"https://bigphoto-1.leavewithaweb.site/",
"https://bigphoto-2.leavewithaweb.site/",
],
tags: ["Photography", "Portfolio", "Link in bio"],
inputCategories: ["Color", "Fonts", "Profile", "Items", "Social"],
const Nightmare = require("nightmare");
const nightmare = Nightmare({ show: true });
nightmare
.goto("https://duckduckgo.com")
.type("#search_form_input_homepage", "web scraping")
.click("#search_button_homepage")
.wait(3000)
.evaluate(() => {
const results = document.getElementsByClassName(
const cheerio = require("cheerio");
const axios = require("axios");
const fs = require("fs");
const writeStream = fs.createWriteStream("hackernews.csv");
writeStream.write(`Title,Link \n`);
axios.get("https://news.ycombinator.com/").then((response) => {
let $ = cheerio.load(response.data);
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--[if !mso]><!-->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!--<![endif]-->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="format-detection" content="telephone=no">
<meta name="x-apple-disable-message-reformatting">