Skip to content

Instantly share code, notes, and snippets.

// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// Choose either "stable" for receiving highly polished,
// or "canary" for less polished but more frequent updates
updateChannel: 'stable',
@chuck0523
chuck0523 / hatenablog-specific-word-counter.py
Last active April 15, 2018 06:53
任意のはてなブログを指定して、特定のワードの登場回数を調べる
# coding: UTF-8
import urllib2
# "pip install beautifulsoup4" needs to be done
from bs4 import BeautifulSoup
# const
baseUrl = "ここにブログURL"
url = baseUrl + "/archive"
linkClass = "hatena-star-permalink"
entryClass = "entry-content"
The MIT License (MIT)
Copyright (c) [2015] [chuck]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
// What is this: Util funciton which filters table data
// behavior:
// First apply multiple filters to each cells with AND_OR consideration
// Then AND_OR to columns as well
const { promisify } = require('util')
const request = promisify(require('request'))
// Can be dynamic state by Redux or something
// node6.2.2で実行するため、es2015記法
// パッケージimport
const fetch = require('node-fetch')
// get
fetch('https://github.com/')
.then((res) => res.text()) // プレーンテキスト
.then((body) => {
// githubのHTMLソースが表示される。
render 'ads/hoge-ad'
/ ./app/views/ads/hoge_ad.slim
/ scriptのasyncを効かせるために、{ } で囲む必要がある。
script{ async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js" }
/ ad-name
ins.adsbygoogle
style="display:inline-block;width:336px;height:280px"
data-ad-client="hoge"
data-ad-slot="huga"
.urllist-title-link.recent-entries-title-link.urllist-title.recent-entries-title {
font-size: 0.9rem;
}
.urllist-title-link.entries-access-ranking-title-link.urllist-title.entries-access-ranking-title {
font-size: 0.9rem;
}
.hatena-module-body .hatena-urllist {
font-size: 0.9rem;
}
const smtpConfig = {
host: 'smtp.gmail.com',
secure: true, // use SSL
auth: {
user: process.env.GMAIL_ADDRESS,
pass: process.env.GMAIL_PASSWORD,
},
}
const transport = require('nodemailer').createTransport(smtpConfig)
const CronJob = require('cron').CronJob
new CronJob({
cronTime: '0 0 12 * * *',
onTick: () => { /* */ },
start: true,
timeZone: 'Asia/Tokyo',
})