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
# Description: | |
# hubot scrapbox notification | |
# | |
# Author: | |
# @shokai <[email protected]> | |
config = | |
room: "news" | |
header: ":sake:" |
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
// pre saveはcreateでも実行される | |
import mongoose from 'mongoose' | |
(async () => { | |
await mongoose.connect('mongodb://localhost/shokai') | |
const userSchema = mongoose.Schema({ | |
name: { | |
type: String, |
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
// updateする時に、runValidators: false` だったら、modelの `required: true` はどう動くか | |
import mongoose from 'mongoose' | |
(async () => { | |
await mongoose.connect('mongodb://localhost/shokai') | |
const userSchema = mongoose.Schema({ | |
name: { | |
type: String, |
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
// updateする時に、runValidators: false` だったら、modelの `required: true` はどう動くか | |
import mongoose from 'mongoose' | |
(async () => { | |
await mongoose.connect('mongodb://localhost/shokai') | |
const userSchema = mongoose.Schema({ | |
name: { | |
type: String, |
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
export class Component extends React.Component{ | |
mapState(state){ | |
return state; | |
} | |
shouldComponentUpdate(nextProps, nextState){ | |
if(Object.keys(nextState).length !== Object.keys(this.state).length || | |
Object.keys(nextProps).length !== Object.keys(this.props).length){ | |
return true; |
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
#!/usr/bin/osascript -l JavaScript | |
function input(emoji){ | |
var app = Application("System Events"); | |
app.includeStandardAdditions = true; | |
var currentClipboard = app.theClipboard(); | |
app.setTheClipboardTo(emoji); | |
app.keystroke("v", {using: "command down"}); | |
delay(1); | |
app.setTheClipboardTo(currentClipboard); |
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
javascript:(function(){var sty=document.createElement("style");sty.innerHTML="img:hover{-webkit-filter: brightness(0.5) saturate(2) contrast(1.5) !important;}";document.getElementsByTagName("body")[0].appendChild(sty);})(); |
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
#!/usr/bin/env ruby | |
now = Time.now | |
s = now.min == 0 ? "#{now.hour}時" : "#{now.hour}時#{now.min}分" | |
cmd = "say #{s} #{ARGV.join ' '}" | |
puts cmd | |
system cmd |
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
#!/usr/bin/env node | |
"use strict"; | |
var path = require("path"); | |
var fs = require("fs"); | |
var spawn = require("child_process").spawn; | |
var async = require("async"); | |
var pkgs = fs.readdirSync(path.resolve(__dirname + "/../packages/")); | |
var each = async.eachSeries; |
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
print("start"); | |
function isSpam(page){ | |
if(page.text.trim() === "(empty)") return true; | |
var desc = page.text | |
.replace(/\[{2,3}([^\[\]]+)\]{2,3}/g, "") | |
.replace(/[\n\s\t]/g, ""); | |
if(desc.length < 1) return true; // gyazz-tag 以外に解説文が無ければspam | |
if(!(/\[\[.+\]\]/.test(page.text))) return true; // 他ページへのリンクが無いページはspam | |
if(/\n/.test(page.text)) return false; // 本文が2行以上あればok |