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
FROM ruby:2.5.0 | |
ENV LANG C.UTF-8 | |
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs | |
RUN mkdir /app_name | |
WORKDIR /app_name | |
ADD Gemfile /app_name/Gemfile | |
ADD Gemfile.lock /app_name/Gemfile.lock | |
RUN bundle install |
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
<template> | |
<div> | |
<input type="file" multiple accept="image/jpeg" @change="detectFiles($event.target.files)"> | |
<div class="progress-bar" :style="{ width: progressUpload + '%'}">{{ progressUpload }}%</div> | |
<img v-bind:src="image"/> | |
</div> | |
</template> | |
<script> | |
import firebase from 'firebase' |
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
# config/initializers/active_storage.rb | |
Rails.application.config.to_prepare do | |
# Provides the class-level DSL for declaring that an Active Record model has attached blobs. | |
ActiveStorage::Attached::Macros.module_eval do | |
def has_one_attached(name, dependent: :purge_later, acl: :private) | |
class_eval <<-CODE, __FILE__, __LINE__ + 1 | |
def #{name} | |
@active_storage_attached_#{name} ||= ActiveStorage::Attached::One.new("#{name}", self, dependent: #{dependent == :purge_later ? ":purge_later" : "false"}, acl: "#{acl}") | |
end | |
def #{name}=(attachable) |
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
version: 2 | |
workspace_root: &workspace_root | |
~/YOUR-PROJECT/docs | |
defaults: &defaults | |
docker: | |
- image: circleci/node:8 | |
working_directory: *workspace_root |
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
class GraphqlController < ActionController::Base | |
include Knock::Authenticable | |
before_action :authenticate | |
def execute | |
# snip... | |
context = { | |
# Query context - +current_user+ is available when authenticated: | |
current_user: current_user, |
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
class GraphqlController < ActionController::Base | |
include Knock::Authenticable | |
before_action :authenticate | |
def execute | |
# snip... | |
context = { | |
# Query context - +current_user+ is available when authenticated: | |
current_user: current_user, |
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
// ヘッダー付きtableのカラムを増やすjQuery | |
$('table').find('tr').each(function(){ | |
if ($('table').index(this)) { | |
$(this).find('th:last-child').after('<th>new column added</th>'); | |
} | |
$(this).find('td:last-child').after('<td>new cell added</td>'); | |
}); |
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
# attr_writer使う場合 attr_*があいまいな人 https://qiita.com/Rudiments/items/c2c5251bcf49dfd7ce7a | |
# 想定される状況:DBには郵便番号は1カラムで保存されているが、表示するときに2つにしたい | |
# == Schema Information | |
# | |
# Table name: stores | |
# | |
# id :integer not null, primary key | |
# name :string(191) not null | |
# zip_code :string(191) not 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
(function(window, $) { | |
//'use strict'; | |
var Device = function() { | |
var u = window.navigator.userAgent.toLowerCase(); | |
return { | |
isTablet: (u.indexOf("windows") != -1 && u.indexOf("touch") != -1) || u.indexOf("ipad") != -1 || (u.indexOf("android") != -1 && u.indexOf("mobile") == -1) || (u.indexOf("firefox") != -1 && u.indexOf("tablet") != -1) || u.indexOf("kindle") != -1 || u.indexOf("silk") != -1 || u.indexOf("playbook") != -1, | |
isMobile: (u.indexOf("windows") != -1 && u.indexOf("phone") != -1) || u.indexOf("iphone") != -1 || u.indexOf("ipod") != -1 || (u.indexOf("android") != -1 && u.indexOf("mobile") != -1) || (u.indexOf("firefox") != -1 && u.indexOf("mobile") != -1) || u.indexOf("blackberry") != -1 | |
}; | |
}; |
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
machine: | |
timezone: | |
Asia/Tokyo | |
ruby: | |
version: | |
2.3.1 | |
hosts: | |
hogehoge.local: 127.0.0.1 | |
fugafuga.local: 127.0.0.1 | |
dependencies: |
NewerOlder