Skip to content

Instantly share code, notes, and snippets.

@wtnabe
wtnabe / npmfile
Created May 3, 2014 14:35
npm install helper ( ruby script )
# -*- mode: ruby -*-
def main
if npm_installed?
list = npm_list
DATA.to_a.map(&:chomp).select {|l|
l.size > 0
}.each {|pkg|
if list.include?(pkg)
@wtnabe
wtnabe / config.ru
Last active August 29, 2015 14:04
Sinatra + Sinatra::Sprockets + rails-asset.org + append paths
require 'find'
map "/#{Sinatra::Sprockets.config.prefix}" do
env = Sinatra::Sprockets.environment
installed_assets = Bundler.definition.resolve.select {|e|
e.name =~ /^rails-assets/
}.map {|e|
spec = e.instance_variable_get(:@specification)
[spec.name, spec.version].join('-')
@wtnabe
wtnabe / .gitignore
Last active August 29, 2015 14:04
gulp + coffee + sass + watch + minify + cache buster sample
/node_modules
*.map
/bower_components
@wtnabe
wtnabe / example.html.php
Last active August 29, 2015 14:04
asset helper for limonade-php
<html>
<head>
<?= javascript_include_tag(); ?>
<?= stylesheet_include_tag(); ?>
</head>
<body>
<p>body</p>
</body>
</html>
@wtnabe
wtnabe / Rakefile
Created August 26, 2014 12:30
rake task that make any test tools exclude a specific pattern
Rake::TestTask.new do |t|
test_files = FileList['test/**/*_test.rb']
test_files -= FileList['test/**/*_request_test.rb'] unless ENV['FORCE_REQUEST']
t.test_files = test_files
end
@wtnabe
wtnabe / Rakefile
Last active August 29, 2015 14:06
rake dependencies for starting server outside ruby ( e.g. PythonSimpleHTTPServer ) and cleanup
require "rake/testtask"
Rake::TestTask.new do |t|
t.description = nil
t.pattern = 'spec/**/*_spec.rb'
end
desc 'start server and do spec and cleanup'
task :spec => :test do
Process.kill(:INT, @pid)
@wtnabe
wtnabe / gist:51950ea51c7860569ae3
Last active August 29, 2015 14:11
Kanazawa.rb meetup28 LT大会 演目
ical2gcalがGoogle Calendar API v3対応したよ
AndroidWearドヤぁ
モデリングしてますか?
Riemoh
RubyKaigiとYAPC::Asia
俺とDockerfileとtDiaryとKubernets
Webの歴史をふり返る
EngineYard触ってみた
5分でわかるオブジェクト指向
ライフゲーム最後まで作ってみました
@wtnabe
wtnabe / gist:7f8747f14f8a34d826a9
Created February 1, 2015 00:04
artisan commandに追加しとくとよさげなもの
command:test
system(__DIR__.'/../../vendor/bin/phpunit');
command:untracked
system('git ls-files -o --exclude-per-directory=.gitignore');
@wtnabe
wtnabe / gist:bc74acd1ea60a90486ec
Created February 8, 2015 07:33
How to extract pdf from showoff 0.9.10+ with /print path and wkhtmltopdf
wkhtmltopdf -O landscape -s Letter http://localhost:9090/print pdf.pdf
@wtnabe
wtnabe / gist:4469825d23e919745538
Created March 2, 2015 13:35
Rails' allow_concurrency
def allow_concurrency?
if config.allow_concurrency.nil?
config.cache_classes && config.eager_load
else
config.allow_concurrency
end
end