Skip to content

Instantly share code, notes, and snippets.

Avatar

ChihiroMazda chihirokaasan

View GitHub Profile
@chihirokaasan
chihirokaasan / default.conf
Created May 9, 2019
MySQL5.7のデフォルトのmy.cnfを複製
View default.conf
server {
listen 80;
root /var/www/html;
index index.html index.htm index.php;
server_name localhost;
location / {
# First attempt to serve request as file, then
View index.vue
<script>
export default {
head () {
return {
title: 'トップページ',
//titleTemplate: '', hide titleTemplate
}
}
}
</script>
View Vue.jsでクリックでClass追加
<p v-on:click="toggleMenu">menuの開閉</p>
<div id="navMenu" :class="{'is-active': isActive}">
<menu>
<ul class="menu">
<li><a href="#">menu1</a></li>
<li><a href="#">menu2</a></li>
<li><a href="#">menu3</a></li>
<li><a href="#">menu4</a></li>
</ul>
</menu>
View Rails database.yml MySQL
development:
adapter: mysql2
encoding: utf8
database: <%= ENV['DATABASE_DEV_NAME'] %>
pool: 5
username: <%= ENV['DATABASE_DEV_USER'] %>
password: <%= ENV['DATABASE_DEV_PASSWORD'] %>
host: <%= ENV['DATABASE_DEV_HOST'] %>
@chihirokaasan
chihirokaasan / doorkeeper.vue
Created May 18, 2018
doorkeeper apiからイベントを取得して表示
View doorkeeper.vue
*pagesディレクトリに設置
<template>
<v-card class="mt-4 mb-4 pa-3">
<v-layout row wrap>
<v-flex xs4 v-for="(item,i) in data" :key="i">
<v-card class="blue ma-2">
<v-card-text><img :src="item.event.banner" width="100%"></v-card-text>
<v-card-text>{{item.event.title}}</v-card-text>
</v-card>
</v-flex>
@chihirokaasan
chihirokaasan / HTML
Last active Mar 19, 2018
Vue.jsによるformのselectによるリンクメニューの実装
View HTML
<div id="target">
<select v-model="selected" v-on:change="jump">
<option v-for="option in options" v-bind:value="option.value">
{{ option.text }}
</option>
</select>
</div>
@chihirokaasan
chihirokaasan / HTML
Created Mar 19, 2018
formのselectによるリンクの遷移 jQuery
View HTML
<select id="target">
<option value="https://www.yahoo.co.jp/">Yahoo!</option>
<option value="https://www.google.co.jp/">Google</option>
</select>
View Axios get
Axios.get('/post_url', {
params: {
// getで指定したいパラメータを記載
id: 123,
name: 'hoge',
}
})
.then(response => {
//200 status header etc...
// console.log(response)
View Axiosを使ったajax post
import Vue from 'vue'
import Axios from 'axios'
import VueAxios from 'vue-axios'
Vue.use(VueAxios, Axios)
//以下コードをVue componentの中でよしなにつかってください
var token = 'csrf_token here'
@chihirokaasan
chihirokaasan / jQueryののajax post
Created Mar 13, 2018
jQueryのAjax postのサンプル
View jQueryののajax post
$('#selector').on('click',function(){
$.ajax({
url:'post/hogehoge',
type:'POST',
data:{
'data1': 'hogehoge',
'data2': ''hogehoge,
}
})
.done(function(data){