This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// YouTube API video uploader using JavaScript/Node.js | |
// You can find the full visual guide at: https://www.youtube.com/watch?v=gncPwSEzq1s | |
// You can find the brief written guide at: https://quanticdev.com/articles/automating-my-youtube-uploads-using-nodejs | |
// | |
// Upload code is adapted from: https://developers.google.com/youtube/v3/quickstart/nodejs | |
const fs = require('fs'); | |
const readline = require('readline'); | |
const assert = require('assert') | |
const {google} = require('googleapis'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fetchAuth = useCallback(() => { | |
(global as any).gapi.auth2 | |
.getAuthInstance() | |
.signIn({ scope: "https://www.googleapis.com/auth/youtubepartner" }) | |
.then( | |
() => { | |
console.log("Sign-in successful"); | |
(global as any).gapi.client.setApiKey(config.GOOGLE_API_KEY); | |
(global as any).gapi.client | |
.load( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect, useRef } from "react"; | |
import { has } from "lodash/object"; | |
import { SingletonRouter } from "next/router"; | |
interface IProps { | |
router: SingletonRouter; | |
} | |
const FbComment = ({ router }: IProps) => { | |
const fbRef = useRef(null); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const replace = require('@rollup/plugin-replace'); | |
const envKeys = () => { | |
const envRaw = require('dotenv').config().parsed || {}; | |
return Object.keys(envRaw).reduce( | |
(envValues, envValue) => ({ ...envValues, [`process.env.${envValue}`]: JSON.stringify(envRaw[envValue]) }), | |
{} | |
); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react'; | |
import { findDOMNode } from 'react-dom'; | |
import * as gaModel from '~/model/gaModel'; | |
import gaUtil from '~/util/gaUtil'; | |
interface props { | |
/** | |
* 頁面 | |
* e.q. (依據路由) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react'; | |
import * as gaModel from '~/model/gaModel'; | |
import gaUtil from '~/util/gaUtil'; | |
/** | |
* 為了省略不必要的div層去觸發ga event | |
* 會分成兩種做法 | |
* |