-
名前(任意)
- 平田 大地
-
Twitter or Facebookのアカウント or HN等
-
@Daic_h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun consult-git-status--git-status () | |
(let ((status (with-output-to-string | |
(with-current-buffer standard-output | |
(process-file "git" nil t nil "status" "--porcelain"))))) | |
(cl-remove-if #'string-blank-p (split-string status "\n")))) | |
(defun consult-git-status--file-path (line) | |
(let ((path (car (last (split-string line " "))))) | |
(concat (expand-file-name (project-root (project-current))) path))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/turntable_ext.rb | |
module TurntableExt | |
def target_shard?(shard_name) | |
(shard_name.nil? && target_shards.blank?) || Array.wrap(target_shards).include?(shard_name) | |
end | |
end | |
ActiveRecord::Migration.prepend(TurntableExt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' | |
gem 'rails', '~> 5.0.0' | |
# Use mysql as the database for Active Record | |
gem 'mysql2', '>= 0.3.18', '< 0.5' | |
# Use Puma as the app server | |
gem 'puma', '~> 3.0' | |
# Use SCSS for stylesheets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
require 'pp' | |
require 'fileutils' | |
require 'mongo' | |
require 'yaml' | |
module Sample | |
class Mongo | |
BASE_DATA_PATH = '/tmp/mongodb' | |
LOG_FILE_PATH = "#{BASE_DATA_PATH}/log" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Lokka | |
module HelloGem | |
def self.registered(app) | |
app.get "/admin/plugins/hello_gem" do | |
haml view_path('test.haml'), :layout => :"admin/layout" | |
end | |
app.helpers do | |
def view_path(name) | |
view_path = File.expand_path(File.dirname(__FILE__) + "/path/to/view/#{name}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:user_name: YOUR NAME | |
:list_name: LIST NAME | |
:consumer_key: CONSUMER KEY | |
:consumer_secret: CONSUMER SECRET | |
:oauth_token: ACCESS TOKEN | |
:oauth_token_secret: ACCESS SECRET TOKEN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
COLORS = | |
{ :red => 31, :green => 32, :yellow => 33, :blue => 34, :magenta => 35, :cyan => 36, :white => 27, :default => 39 } | |
@@command_list = {} | |
def with_color(state = :default) | |
puts "\e[#{COLORS[state]}m#{yield}\e[0m" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :pry do | |
def pry_setting(args) | |
libs ||= [] | |
libs << %( -r "#{RAILS_ROOT}/config/environment") | |
libs << " -r console_app" | |
libs << " -r console_with_helpers" | |
if args.sandbox | |
libs << " -r console_sandbox" if args.sandbox | |
puts "Loading #{ENV['RAILS_ENV']} environment in sandbox (Rails #{Rails.version})" | |
puts "Any modifications you make will be rolled back on exit" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Sample | |
def hello | |
return "Hello World!" | |
end | |
end | |
s = Sample.new | |
s.hello #=> "Hello World!" |