Skip to content

Instantly share code, notes, and snippets.

@chuck0523
chuck0523 / hatenablog-specific-word-counter.py
Last active Apr 15, 2018
任意のはてなブログを指定して、特定のワードの登場回数を調べる
View hatenablog-specific-word-counter.py
# 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"
View .zshrc
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/Users/ts-takashi.yoneyama/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="amuse"
View .hyper.js
// 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',
View tableFiltersByMultipleConditions.js
// 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
View google-ads-sample.slim
/ ./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"
View hatena-blog.css
.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;
}
View nodemailer-config.js
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)
View node-cron-asia_tokyo.js
const CronJob = require('cron').CronJob
new CronJob({
cronTime: '0 0 12 * * *',
onTick: () => { /* */ },
start: true,
timeZone: 'Asia/Tokyo',
})
View splice.js
let ary = [1, 2, 3, 4, 5]
// array[2]から3個の要素を6で埋める
ary.splice(2, 3, 6, 6, 6)
console.log(ary) // [1, 2, 6, 6, 6]
You can’t perform that action at this time.