Skip to content

Instantly share code, notes, and snippets.

View potato4d's full-sized avatar
💭
It's not so easy to be consistent

Takuma HANATANI potato4d

💭
It's not so easy to be consistent
View GitHub Profile
@potato4d
potato4d / d_and_d_and_manual.php
Created January 25, 2016 05:30
D&Dとファイル選択が可能な、 https://gist.github.com/potato4d/9215eb2645eecc2117a1 の強化版
<?php
$uploaddir = __DIR__."/";
$uploadfile = $uploaddir . basename($_FILES['file']['name']);
if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {
// バージョン依存問題の解消
if(function_exists("http_response_code")){
http_response_code(200);
}else{
header('HTTP', true, 200);
}
@potato4d
potato4d / calender.html
Created February 1, 2016 05:44
カレンダーの画像作る奴。holidayを変えたら色が変わり、右クリで保存が可能
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>CalendarMaker</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.4.21/p5.min.js"></script>
<script src="sketch.js"></script>
</head>
<body>
</body>
@potato4d
potato4d / style.scss
Last active December 20, 2018 01:25
CSSで画像の四隅に三角をつけてイイカンジの枠組みっぽくする ref: https://qiita.com/potato4d/items/b31aefb7114ed9b348ea
.image{
overflow:hidden;
// 残りのコード
}
@potato4d
potato4d / gulpfile.js
Last active December 20, 2018 01:25
Gulpを用いてサクッとS3に静的Webサイトをデプロイする ref: https://qiita.com/potato4d/items/c0248b6b216d2a32bbba
var s3 = require("gulp-s3-upload")(require("./iam.json"));
var
gulp.task("deploy2s3", function(){
return gulp.src([]) // デプロイ時にアップロードしたいファイル群
.pipe(s3({
Bucket: "バケット名",
ACL: "public-read"
}))
@potato4d
potato4d / formData
Last active December 20, 2018 01:27
Botkitを利用してSlack上の発言からGitHubのIssueを作成するBotを作る ref: https://qiita.com/potato4d/items/81e9e8aef6cd57c234af
{
"title": "Issueの題名",
"body" : "IssueのDesciption"
}
@potato4d
potato4d / file2.txt
Last active October 23, 2019 13:16
Firebaseを用いて5分でセキュアなWebサイトを公開する ref: https://qiita.com/potato4d/items/95eaf2e41404711e621e
$ firebase init
You're about to initialize a Firebase project in this directory:
/path/to/project-dir
? What Firebase CLI features do you want to setup for this folder? (Press <space> to select)
◯ Database: Deploy Firebase Realtime Database Rules
❯◉ Hosting: Configure and deploy Firebase Hosting sites
@potato4d
potato4d / terminal
Created August 17, 2016 04:52
Atomを利用したターミナル in エディタによるQoL向上計画 ref: http://qiita.com/potato4d/items/0931126f9fb0ea558f1e
$ apm install terminal-plus
@potato4d
potato4d / main.js
Last active August 24, 2016 10:34
Node.jsでユーザーのホームディレクトリのパスを取得する ref: http://qiita.com/potato4d/items/7131028497de53ceb48e
const path = require("path");
const userHome = process.env[process.platform == "win32" ? "USERPROFILE" : "HOME"];
console.log(path.join(userHome, "Desktop"));
// /Users/foo/Desktop
console.log(path.join(userHome, "Documents"));
// /Users/foo/Documents
@potato4d
potato4d / CompA.vue
Created September 5, 2016 05:22
Vue.js vue-routerのページに対してコンポーネントを大量に読み込むのがつらい問題を解消する ref: http://qiita.com/potato4d/items/a82be294225cea2ead8b
<template lang="html">
<p>Hello.</p>
</template>
<style lang="css"></style>
<script>
module.exports = {};
</script>
@potato4d
potato4d / file3.txt
Last active March 4, 2019 07:09
npmモジュール`pre-commit`を利用してチーム全体で低品質なコードをコミットできないようにする ref: https://qiita.com/potato4d/items/5dfebb9da1c5fe400809
/path/to/pre-commit-sample/index.js
1:1 error Unexpected var, use let or const instead no-var
✖ 1 problem (1 error, 0 warnings)
pre-commit:
pre-commit: We've failed to pass the specified git pre-commit hooks as the `test`
pre-commit: hook returned an exit code (1). If you're feeling adventurous you can
pre-commit: skip the git pre-commit hooks by adding the following flags to your commit:
pre-commit: