Skip to content

Instantly share code, notes, and snippets.

View chiastolite's full-sized avatar

Hiroyuki Morita chiastolite

View GitHub Profile
@chiastolite
chiastolite / git-wip
Created August 26, 2014 03:23
git-wip
#!/bin/sh
if ! hash hub 2>/dev/null; then
echo 'command not found: hub'
echo ''
echo 'hub is needed for create pull-request.'
echo ''
echo 'see: https://github.com/github/hub'
exit 1
fi
@chiastolite
chiastolite / gist:a47225d3e0b3359bfed3
Last active August 29, 2015 14:04
Middleman調べてた

Markdownでの画像ファイルの表示について

middleman/middleman-core/lib/middleman-core/renderers/kramdown.rbのconvert_imgでパスの書き換えが行われてる
redcarpetの場合もこれやらないとダメぽい middleman/middleman-core/lib/middleman-core/renderers/redcarpet.rbがあった

逆に↓この説明通りにやるとしくじるのでは…

http://middlemanapp.com/jp/basics/pretty-urls/

function peco-git-log () {
if [ -d ".git" ]; then
local git_hash=$(git log --oneline | peco --query "$LBUFFER"|cut -d' ' -f1)
if [ -n "$git_hash" ]; then
BUFFER="git ${git_hash}"
fi
zle clear-screen
fi
}
@chiastolite
chiastolite / gist:9246215
Created February 27, 2014 08:08
focuslight log
17:07:47 web.1 | started with pid 62564
17:07:47 worker1.1 | started with pid 62565
17:07:47 worker2.1 | started with pid 62566
17:07:47 web.1 | I, [2014-02-27T17:07:47.201378 #62564] INFO -- : listening on addr=0.0.0.0:5125 fd=9
17:07:47 web.1 | I, [2014-02-27T17:07:47.201553 #62564] INFO -- : worker=0 spawning...
17:07:47 web.1 | I, [2014-02-27T17:07:47.203146 #62564] INFO -- : master process ready
17:07:47 web.1 | I, [2014-02-27T17:07:47.206611 #62567] INFO -- : worker=0 spawned pid=62567
17:07:47 web.1 | I, [2014-02-27T17:07:47.207565 #62567] INFO -- : Refreshing Gem list
17:07:47 worker1.1 | "/Users/chiastolite/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/focuslight-0.1.2/focuslight/.env" is not found. Run `focuslight new` first
17:07:47 worker2.1 | "/Users/chiastolite/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/focuslight-0.1.2/focuslight/.env" is not found. Run `focuslight new` first
@chiastolite
chiastolite / gist:8519728
Created January 20, 2014 13:19
Redcarptでgfmしたときの
def md(content)
gfm.render(content).html_safe
end
private
class XHTMLwithPygments < Redcarpet::Render::XHTML
def block_code(code, language)
::Pygments.highlight(code, lexer: language)
end
@chiastolite
chiastolite / application.html.slim
Last active December 26, 2015 18:49
rails-templates
doctype 5
html
head
title = content_for?(:title) ? yield(:title) : (controller.controller_name + " : " + controller.action_name)
= stylesheet_link_tag :application
= javascript_include_tag :application
= csrf_meta_tags
/[ if lt IE 9 ]
script src="//html5shiv.googlecode.com/svn/trunk/html5.js"
body
source "https://rubygems.org"
gem "veewee", github: 'jedi4ever/veewee'
gem "vagrant", github: 'mitchellh/vagrant', :tag => 'v1.1.4'
gem "rspec-rails", :group => "test"
generate "rspec:install"
gem "slim-rails"
gem_group :development do
gem 'pry-rails'
gem 'pry-remote'
end
# -*- coding:utf-8 -*-
require 'bundler/setup'
Bundler.require
require 'redcarpet'
class DenDen < Redcarpet::Render::HTML
def normal_text text
text.gsub(/\^([^\^]+?)\^/) do |_|
"<span class='tcy'>#{$1}</span>"
end.gsub(%r!{([^|]+)\|(.+)}!) do |_|
guard 'rspec' do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
end