Skip to content

Instantly share code, notes, and snippets.

View ta1kt0me's full-sized avatar
🐢
slow

ta1kt0me

🐢
slow
View GitHub Profile
@ta1kt0me
ta1kt0me / sample.rb
Last active July 30, 2018 14:56
`on`で指定したcontextの時にだけ、html5 validationを有効にしたいケースのサンプルコード
require "bundler/inline"
gemfile do
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem "rails"
gem "html5_validators"
gem "sqlite3"
$ ls .
Dockerfile
$ cat Dockerfile
FROM ruby:2.5.1
RUN bundle init
RUN echo "gem 'bundler_diffgems'" >> Gemfile
RUN bundle install --path vendor/bundle
CMD ["/bin/bash"]
$ docker build .
@ta1kt0me
ta1kt0me / bundler_Dockerfile
Last active June 1, 2018 16:17
bundler docker-file
from ruby:2.5.1
RUn apt-get update -y && apt-get upgrade -y
RUN apt-get install graphviz groff-base -y
RUN apt-get install bsdmainutils -y
RUN git clone --depth 1 https://github.com/bundler/bundler
WORKDIR bundler
RUN ls -l
RUN bin/rake spec:deps
@ta1kt0me
ta1kt0me / Gemfile
Last active March 26, 2018 01:05
猫踏んじゃった
source "https://rubygems.org"
# gem "rails"
gem 'coreaudio'
@ta1kt0me
ta1kt0me / _form.html.erb
Last active February 6, 2018 00:47
Add `required` class in label when attribute checks presence validation
<%= form_with(model: task, local: true) do |form| %>
<% if task.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(task.errors.count, "error") %> prohibited this task from being saved:</h2>
<ul>
<% task.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
@ta1kt0me
ta1kt0me / level.rb
Created January 23, 2018 14:55
alias :| :yield_self
class BasicObject
def |(sym)
yield_self(&method(sym))
end
end
module CountUp
attr_accessor :count
def initialize
@ta1kt0me
ta1kt0me / thisInFunction.js
Last active December 20, 2017 02:51
what is `this` in function in function
class A {
constructor(value) {
this.value = value
}
foo() {
const fun = function() { console.log('fun: ', this) }
fun();
const bindFun = function() { console.log('bindFun: ', this) }.bind(this)
@ta1kt0me
ta1kt0me / custom-rails-ujs.js
Last active October 30, 2017 12:18
rails-ujs.js in 731ea4e3fb7250a28c55c664aff43459d83cdec1 . This includes #30513 and #29127 .
// git clone https://github.com/rails/rails.git && cd rails && git checkout ee44c1b6f1ca3a8ee685807a940cf02101ed5141 && cd actionview && bundle && npm install && npm run build
// rails-ujs.js v5.1.4 mergd #30513, #29127 and #31002
/*
Unobtrusive JavaScript
https://github.com/rails/rails/blob/master/actionview/app/assets/javascripts
Released under the MIT license
*/
(function() {
var context = this;
@ta1kt0me
ta1kt0me / StopMergingFixupCommit.js
Last active August 16, 2017 05:04
Stop merging fixup! commit
// ==UserScript==
// @name Stop merging fixup! commit
// @version 0.2
// @author ta1kt0me
// @match https://github.com/*/*/pull/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
@ta1kt0me
ta1kt0me / hook.zsh
Last active March 23, 2017 09:39
notify when complete command via terminal-notifier
function __what_command_execute() {
local cmd=$1
export __NOTIFY_COMMAND="$cmd"
}
function __notify_complete_command() {
local cmd=$__NOTIFY_COMMAND
if [[ $cmd =~ "(be |bundle exec |bin/)rspec|(rails test)" ]] ||
[[ $cmd =~ "(npm (test|install|run)|^mocha)" ]] ||
[[ $cmd =~ "rails db:(migrate|reset|seed_fu)" ]]; then