Skip to content

Instantly share code, notes, and snippets.

View yamaaki's full-sized avatar

Yamaya Akihiro yamaaki

  • Tokyo, Japan
View GitHub Profile
# Every time assets:precompile is called, trigger assets:create_non_digested_assets.
Rake::Task["assets:precompile"].enhance do
Rake::Task["assets:create_non_digested_assets"].invoke
end
namespace :assets do
logger = Logger.new($stderr)
task :create_non_digested_assets => :"assets:environment" do
@yamaaki
yamaaki / base.sass
Last active January 17, 2016 09:03
$roboto-font-path: 'materialize/font/roboto/'
@import 'materialize/sass/materialize'
.toast
border-radius: 4px
html
font-family: 'Roboto', '游ゴシック', YuGothic, 'ヒラギノ角ゴ ProN W3', 'Hiragino Kaku Gothic ProN', 'メイリオ', Meiryo, sans-serif
#body
background-color: #fcfcfc
$(document).ready ->
$('.button-collapse').sideNav()
rightNav = $('.u-right-nav')
if rightNav.length
rightNav.pushpin
top: rightNav.offset().top
$('.scrollspy').scrollSpy()
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
doctype html
html
head
meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"
title タイトル
link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
= javascript_include_tag 'application', 'data-turbolinks-track' => true
= csrf_meta_tags
{
"name": "Awesome extension name",
"version": "0.1",
"manifest_version": 2,
"description": "Blah blah blah..",
"icons": {"48": "icon48.png"},
"permissions": [
"tabs", "cookies", "*://*/*"
],
"content_scripts": [
// turbolinks で画面遷移したときにコールされる (reload 時にはコールされない)
// DOM へのイベントのバインドは turbolinks だと毎回バインドしなおす必要があるのでコチラで
// 何度も呼ばれる場合があるので .off() してから .on() する
bindClick = function () {
$('.p-link').off('click').on('click', function (e) {
var that = $(this)
, params = {}
// 以下の構成の場合、i が e.target になるので i に p-no-jump を add
// (3) myscript.js から伝達されてきたセッション情報を受け取る
chrome.runtime.onMessage.addListener(function (req, sender) {
// (4) セッション情報を書き換える
chrome.cookies.getAll({
domain: '.airbnb.jp'
}, function (cookies) {
var str = 'START:';
for (var i = 0; i < cookies.length; i++) {
str += ' ' + cookies[i].name
require 'bundler/setup'
Bundler.require
# Driver 設定
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, {js_errors: false, timeout: 1000})
end
Capybara.default_selector = :xpath
page = Capybara::Session.new(:poltergeist)
class DeviseCreateAdmins < ActiveRecord::Migration
def change
create_table(:admins) do |t|
t.string :email, null: false, default: ""
t.string :encrypted_password, null: false, default: ""
t.integer :sign_in_count, default: 0, null: false
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.string :current_sign_in_ip
t.string :last_sign_in_ip