Skip to content

Instantly share code, notes, and snippets.

View kazu69's full-sized avatar
:octocat:
⭐️ 🚀 🍻 🍶

kazu69 kazu69

:octocat:
⭐️ 🚀 🍻 🍶
View GitHub Profile
@kazu69
kazu69 / database_clenaer.rb
Last active October 13, 2023 14:44
Such as setting when you write a test of parallel processing in ActiveRecord
# spec_helper.rb
RSpec.configure do |config|
...
# テスト完了後一度だけ実行される
config.after(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
# 各テスト実行前に実行される
config.before(:each) do |spec|
@kazu69
kazu69 / main.js
Created April 25, 2018 16:06
Vue.js reactive object pattern
// Vue.js like reactive object pattern
// show detail https://github.com/vuejs/vue/blob/master/src/core/observer/index.js
const Watcher = function() {}
Watcher.prototype.update = function () {
console.log('Watcher update')
}
const Dep = function(watcher) {
this.id = this.id ? this.id ++ : 0
this.subs = []
@kazu69
kazu69 / docker.sh
Last active May 29, 2022 13:22
docker container stop, remove and remove images on line
# stop all container
# -a=false: Show all containers. Only running containers are shown by default.
# -q=false: Only display numeric IDs
sudo docker stop $(docker ps -a -q)
# remove all container
sudo docker rm $(docker ps -a -q)
# remove all images
# -a=false: show all images
@kazu69
kazu69 / alias_method.rb
Last active October 22, 2021 13:08
ruby method overwrite (monkey patch pattern)
class Country
def home
'Japan'
end
end
# -----
module ExtendContry
def new_home
/*!
* jquery.addrule.js 0.0.1 - https://gist.github.com/yckart/5563717/
* Add css-rules to an existing stylesheet.
*
* @see http://stackoverflow.com/a/16507264/1250044
*
* Copyright (c) 2013 Yannick Albert (http://yckart.com)
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php).
* 2013/05/12
**/
@kazu69
kazu69 / http_accept_language.php
Created July 2, 2013 16:52
wordpressで言語設定を取得して振り分けるときの例
<?php
// WordPressの読み込みが完了し、ヘッダーが送信される前に実行する。
add_action( 'init', 'init' );
function init() {
// 言語設定が日本語でなく、パラメーター付与されていないとき針ダイレクト
if(!is_Ja() && $_GET["lang"] != "en"):
$url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . "?lang=en";
header("Location: $url");
exit;
@kazu69
kazu69 / uninstall.sh
Last active April 30, 2019 08:15
Uninstalling all gems Ruby 2.0.0
for i in `gem list --no-versions`; do gem uninstall -aIx $i; done

訳注

これは超訳です。

CSSLintは「なんでこんなルールなんだ…」とイラっとすることが多いですけど、それぞれにそれなりに理由があります。まぁ勿論無視するべきなルールとかもあります。例えば見出し要素の再定義禁止とかはHTML5に対するCSSなら無理な話です。そんなわけでどんな理由なのかを簡単に訳しました。無視するかどうかは自分で決めましょう!

この訳はCSSLintと同じライセンスで提供されます。

Possible Errors

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
custom-checkbox {
@kazu69
kazu69 / Vagrantfile
Created February 2, 2015 05:14
Modern.IE Vagrant Boxes
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.provider :virtualbox do |vb|
vb.gui = true