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
server { | |
listen 80; | |
server_name localhost; | |
#charset koi8-r; | |
#access_log /var/log/nginx/host.access.log main; | |
location / { | |
root /usr/share/nginx/html; | |
index index.html index.htm; |
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
namespace App\Http\Controllers; | |
use GuzzleHttp\Client; | |
use Illuminate\Http\Request; | |
use Illuminate\Http\Response; | |
use Illuminate\Support\Facades\Log; | |
class SlackController extends Controller | |
{ | |
const BOT_TOKEN = 'YOUR_TOKEN'; |
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
<?php | |
namespace App\Http\Controllers; | |
use GuzzleHttp\Client; | |
use Illuminate\Http\Request; | |
use Illuminate\Http\Response; | |
use Illuminate\Support\Facades\Log; | |
class SlackController extends Controller |
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
<?php | |
namespace App\Http\Controllers; | |
use GuzzleHttp\Client; | |
use Illuminate\Http\Request; | |
use Illuminate\Http\Response; | |
use Illuminate\Support\Facades\Log; | |
class SlackController extends Controller |
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
{ | |
"manifest_version": 2, | |
"name": "Amazon Link Shortener", | |
"version": "1.0.0", | |
"description": "Amazonのリンクを短くして、好きなアフィリエイトタグを追加します", | |
"permissions": [ | |
"tabs" | |
], | |
"browser_action": { | |
"default_popup": "popup.html" |
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
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8"> | |
<style type="text/css"> | |
#message { | |
width: 150px; | |
} | |
</style> | |
<title>AmazonLinkShortener</title> |
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
chrome.tabs.getSelected(null, function(tab) { | |
let url = tab.url.split('?')[0] | |
// AmazonのURLじゃない時は何もせずに注意書きを表示する | |
if (!url.match(/amazon.co.jp/)) { | |
let message = document.getElementById('message') | |
message.innerText = 'Amazonの商品ページでご利用ください' | |
return | |
} | |
// gp/product など色々な形式のURLがあるので最もシンプルな dp に統一 | |
const replacedUrl = url.replace(/\/gp\/product\/|\/exec\/obidos\/ASIN\/|\/o\/ASIN\/|\/exec\//g, '/dp/') |
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 save = document.getElementById('save') | |
save.addEventListener('click', function () { | |
let message = document.getElementById('message') | |
localStorage['amazonLinkAffiliateTag'] = message.value | |
}, false) | |
// 既に登録済みなら登録しているタグを表示する | |
if (localStorage['amazonLinkAffiliateTag']) { | |
let message = document.getElementById('message') |
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
/** | |
* ツイートを順番に選択する処理 | |
* 処理の中で前回の番号を保持していくことは出来ないので | |
* 投稿された回数をシートに保存しておき、一番投稿された回数が少ない記事を次の記事にする | |
**/ | |
function pickUpTweet() { | |
var titleRow = 1; // 『投稿内容』とか書いている部分の行数 | |
var startRow = 1 + titleRow; // 1行目は『投稿内容』とか書いているので2行目から | |
var startCol = 1; | |
var endRow = sheetData.getLastRow() - titleRow; // 最後の行まで(2行目から始まっているので-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
// 認証用インスタンス | |
var twitter = TwitterWebService.getInstance( | |
'*****************', // 作成したアプリケーションのConsumer Key | |
'************************************************' // 作成したアプリケーションのConsumer Secret | |
); | |
// 認証 | |
function authorize() { | |
twitter.authorize(); | |
} |