This file contains hidden or 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
#!/bin/bash | |
# tarball links of dicts | |
tcide=https://web.archive.org/web/20140917131745/http://abloz.com/huzheng/stardict-dic/dict.org/stardict-dictd_www.dict.org_gcide-2.4.2.tar.bz2 | |
jargon=https://web.archive.org/web/20140917131745/http://abloz.com/huzheng/stardict-dic/dict.org/stardict-dictd-jargon-2.4.2.tar.bz2 | |
foldc=https://web.archive.org/web/20140917131745/http://abloz.com/huzheng/stardict-dic/dict.org/stardict-dictd_www.dict.org_foldoc-2.4.2.tar.bz2 | |
merrian=https://web.archive.org/web/20140917131745/http://abloz.com/huzheng/stardict-dic/dict.org/stardict-merrianwebster-2.4.2.tar.bz2 | |
dictpath=/usr/share/stardict/dic | |
i=1 |
This file contains hidden or 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 from 'react'; | |
import ReactDOM from 'react-dom'; | |
import {Router} from 'react-router-dom'; | |
import './index.css'; | |
import App from './App'; | |
import {createBrowserHistory} from 'history'; | |
import TagManager from 'react-gtm-module' | |
const history = createBrowserHistory(); | |
const tagManagerArgs = { |
This file contains hidden or 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 puppeteer = require('puppeteer'); | |
(async () => { | |
const browser = await puppeteer.launch(); | |
const page = await browser.newPage(); | |
// Emitted when the DOM is parsed and ready (without waiting for resources) | |
page.once('domcontentloaded', () => console.info('✅ DOM is ready')); | |
// Emitted when the page is fully loaded |
This file contains hidden or 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 cluster = await Cluster.launch({ | |
concurrency: Cluster.CONCURRENCY_CONTEXT, | |
maxConcurrency: 3, | |
puppeteerOptions: { | |
headless: true, | |
args: ['--no-sandbox'] | |
} | |
}); |
This file contains hidden or 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
await page.evaluate(async() => { | |
await new Promise((resolve, reject) => { | |
var totalHeight = 0; | |
var distance = 100; | |
var timer = setInterval(() => { | |
var scrollHeight = document.body.scrollHeight; | |
window.scrollBy(0, distance); | |
totalHeight += distance; | |
if (totalHeight >= scrollHeight) { |
This file contains hidden or 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
var express = require('express'); | |
var router = express.Router(); | |
const millieCrawler = require('../crawler/millie'); | |
const ridiCrawler = require('../crawler/ridi'); | |
const yesCrawler = require('../crawler/yes'); | |
const {Cluster} = require('puppeteer-cluster'); | |
/* GET home page. */ | |
router.get('/', function (req, res) { | |
res.send('Home page opened up!'); |
This file contains hidden or 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 proxy = require('http-proxy-middleware'); | |
module.exports = function (app) { | |
app.use(proxy('/search', {target: 'http://localhost:8000/'})); | |
} |
This file contains hidden or 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
"scripts": { | |
"client": "npm start --prefix ./client", | |
"server": "nodemon server.js", | |
"dev": "concurrently \"npm run server\" \"npm run client\"" | |
} |
This file contains hidden or 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 App, { Container } from 'next/app' | |
import Router from 'next/router' | |
import React from 'react' | |
import withGA from 'next-ga' | |
import keys from '../config/keys' | |
class MyApp extends App { | |
static async getInitialProps({ Component, router, ctx }) { | |
let pageProps = {} | |
if (Component.getInitialProps) { | |
pageProps = await Component.getInitialProps(ctx) |
This file contains hidden or 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 matter from "gray-matter"; | |
import ReactMarkdown from "react-markdown"; | |
import Disqus from 'disqus-react'; | |
// components | |
import Layout from '../../components/Layout' | |
export default function BlogTemplate(props) { | |
function reformatDate(fullDate) { |
NewerOlder