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 ubuntu | |
# | |
# prepare | |
# | |
RUN apt-get update && \ | |
apt-get upgrade -y | |
# | |
# utils |
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#file_new | |
= file_field_tag :files, multiple: true, 'v-on:change' => 'fileInputChange' | |
= submit_tag 'Upload', 'v-on:click.prevent' => 'fileUpload' |
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
Vue.directive 'numeric', | |
twoWay: true | |
bind: -> | |
$(@el) | |
.autoNumeric('init', aPad: false) | |
.on 'change', => | |
@set $(@el).autoNumeric('get') | |
update: (value) -> | |
el = $(@el).autoNumeric('set', value) | |
el.trigger('change') if el? |
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
$ -> | |
Vue.directive 'select', | |
twoWay: true | |
priority: 1000 | |
params: ['options'] | |
bind: -> | |
self = @ | |
$(@el) |
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
@mixin shadow($depth: 1) { | |
@if $depth == 0 { | |
box-shadow: none; | |
} @else if $depth == 1 { | |
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12); | |
} @else if $depth == 2 { | |
box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.20), 0 6px 20px 0 rgba(0, 0, 0, 0.19); | |
} @else if $depth == 3 { | |
box-shadow: 0 12px 15px 0 rgba(0, 0, 0, 0.24), 0 17px 50px 0 rgba(0, 0, 0, 0.19); | |
} @else if $depth == 4 { |
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
module ScreenshotTaker | |
SCREENSHOT_ROOT_DIR = Rails.root.join('tmp', 'rspec_screenshots') | |
@screenshot_dir = '' | |
def self.setting! | |
@screenshot_dir = SCREENSHOT_ROOT_DIR.join(Time.zone.now.strftime('%Y%m%d-%H%M%S')) | |
FileUtils.mkdir_p(@screenshot_dir) | |
puts "\e[32mtake screenshot to `#{@screenshot_dir}`\e[0m" | |
end |
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
Task.select( | |
Arel::Nodes::NamedFunction.new( | |
'to_char', | |
[ | |
Task.arel_table[:created_at], | |
Arel::Nodes.build_quoted('YYYY') | |
] | |
).as('year') | |
) | |
# => SELECT to_char("tasks"."created_at", 'YYYY') AS year FROM "tasks" |
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 Api::ApiController < ApplicationController | |
rescue_from Exception , with: :handle_internal_server_error if Rails.env.production? | |
rescue_from ActiveRecord::RecordNotFound, with: :handle_not_found | |
def handle_internal_server_error(_ = nil) | |
render_internal_server_error_message | |
end | |
def handle_not_found(_ = nil) | |
render_not_found_message |
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
Bundler.require(:development, :test, :qa) | |
namespace :db do | |
namespace :sample do | |
desc "Fill database with sample data" | |
task populate: :environment do | |
ActiveRecord::Base.transaction do | |
%w(projects attrs tasks).each { |table| populate(table) } | |
end | |
end |
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
begin | |
require 'scss_lint/rake_task' | |
SCSSLint::RakeTask.new do |t| | |
t.config = '.scss_lint.yml' | |
t.files = %w(app/assets/stylesheets) | |
t.quiet = false | |
end | |
rescue LoadError | |
puts 'scss_lint load error' |