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
webshot(URL, targetResolvedPath, options, function(err) { | |
fs.readFile(targetResolvedPath, function (err, data) { | |
if (err) {return; } | |
else{ | |
var base64data = new Buffer(data, 'binary'); | |
var s3 = new AWS.S3(); | |
s3.putObject({ | |
Bucket: s3BucketName, | |
Key: targetPath, //Replace with path in s3 | |
Body: base64data, |
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
var cron = require('node-cron'); | |
cron.schedule('* * 2 * *', function(){ | |
console.log("start"); //every 2 o'clock | |
}); |
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
var ses = new AWS.SES(); | |
ses.sendEmail({ | |
Source : mailOptions.from, | |
Destination : { ToAddresses: [mailOptions.to] }, | |
Message:{ | |
Subject : { | |
Data: mailOptions.subject, | |
Charset : 'utf-8' | |
}, | |
Body: { |
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
router.post('/', upload.single('imgfile'), function (req, res) { | |
var fextention = path.extname(req.file.originalname).toLowerCase(); | |
var targetPath = uuid.v4() + fextention; | |
var tempPath = req.file.path, | |
targetResolvedPath = path.resolve('./uploads/'+targetPath); | |
//tempPathに置かれている画像ファイルをeasyimgのrescropでwidthを1000にする. | |
if ( fextention === '.png' || fextention === '.jpg' || fextention === '.bmp') { | |
easyimg.rescrop({ | |
src:tempPath, dst:targetResolvedPath, width:1000 | |
}).then(function(image){ |
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
router.post('/base64', upload.single('imgfile'), function (req, res) { | |
var targetPath = uuid.v4() + ".png"; | |
var base64Data = req.body.imgBase64.replace(/^data:image\/png;base64,/, ""); | |
var targetResolvedPath = path.resolve('./uploads/'+targetPath); | |
require("fs").writeFile(targetResolvedPath, base64Data, 'base64', function(err) { | |
res.json({image_url:targetPath}); | |
}); | |
}); |
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 curses | |
def PrintDocument(stdscr): #pを押されたときに実行される関数 | |
stdscr.addstr(10, 10, "Hey") #座標でx:10,y:10のところにHeyと表示 | |
stdscr.refresh() #これを呼ばないと画面に反映されない | |
#Part 1:初期化(設定変更) | |
stdscr = curses.initscr() #まずは初期化 | |
curses.noecho() #Teminalでデフォルトでキー入力を表示してしまうのを停止 | |
curses.cbreak() #通常のターミナルでは入力をバッファに溜めて動作するがそれを無効化。入力にすぐに反応 |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
var bcrypt = require('bcrypt'); | |
//hashを生成して保存 | |
var hash = bcrypt.hashSync(password, salt); //saltとパスワードを設定してhashを生成 | |
//保存してたhashとパスワードを比較する | |
bcrypt.compareSync(password, hash) |
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
//画面遷移しようとする前に確認ダイアログを出す. | |
window.onbeforeunload = function() { | |
//Chromeでは動かない.デフォルトの文言が表示される. | |
return '編集中です。本当に他のページに移動しますか?'; | |
}; | |
//画面遷移しようとする前に確認ダイアログを出さない | |
window.onbeforeunload = 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
.deg0cap { transform: translate(8em); } | |
.deg60cap { transform: rotate(60deg) translate(8em) rotate(-60deg); } | |
.deg120cap { transform: rotate(120deg) translate(8em) rotate(-120deg);} | |
.deg180cap { transform: translate(-8em); } | |
.deg240cap { transform: rotate(240deg) translate(8em) rotate(-240deg);} | |
.deg300cap { transform: rotate(300deg) translate(8em) rotate(-300deg); } |
OlderNewer