要約:
Devinをジュニアエンジニアのように扱ってください。十分で明確な指示があれば、ジュニアエンジニアやインターンでも解決できるタスクをDevinに任せられます。人間の同僚に与えるのと同じレベルの詳細な指示を与えることを忘れないでください。
- TODOリストの整理:
import openai | |
import numpy as np | |
from transformers import AutoTokenizer, AutoModel | |
# OpenAI APIキーを設定 | |
openai.api_key = "your_api_key" | |
def get_completion(prompt, model="gpt-3.5-turbo"): | |
messages = [{"role": "user", "content": prompt}] | |
response = openai.ChatCompletion.create( |
require "rack/proxy" | |
module Webpack | |
class DevServerProxy < Rack::Proxy | |
def perform_request(env) | |
if Rails.env.development? && env['PATH_INFO'].start_with?('/assets') | |
env["HTTP_HOST"] = env["HTTP_X_FORWARDED_HOST"] = 'localhost' | |
env["HTTP_X_FORWARDED_SERVER"] = 'localhost:3035' | |
env["HTTP_PORT"] = env["HTTP_X_FORWARDED_PORT"] = '3035' | |
env["HTTP_X_FORWARDED_PROTO"] = env["HTTP_X_FORWARDED_SCHEME"] = 'http' |
Hello, world! |
module Kramdownable | |
extend ActiveSupport::Concern | |
include ActionView::Helpers::TextHelper | |
def autolink_filter(content) | |
auto_link(content, html: {target: '_blank'}, sanitize: false) | |
end | |
def kramdown | |
Kramdown::Document.new(body || '', kramdown_options) |
# Rails 3.2.13以前のバージョン + Ruby2.0の組み合わせだと適切にDirectiveをパースできない不具合がある | |
# ref: https://github.com/sstephenson/sprockets/issues/352 | |
directive_pattern = / | |
^ \W* = \s* (\w+.*?) (\*\/)? $ | |
/x | |
Sprockets::DirectiveProcessor.class_eval do | |
remove_const(:DIRECTIVE_PATTERN) | |
const_set(:DIRECTIVE_PATTERN, directive_pattern) | |
def directives |
require 'ruby-jmeter' | |
test name: 'JMX Sample' do | |
threads count: 5, loops: 5 do | |
cookies | |
visit name: 'Login Page', url: 'http://0.0.0.0:3000/users/sign_in' do | |
extract name: 'csrf-token', xpath: "//meta[@name='csrf-token']/@content", tolerant: true | |
extract name: 'csrf-param', xpath: "//meta[@name='csrf-param']/@content", tolerant: true | |
end | |
http_header_manager name: 'X-CSRF-Token', value: '${csrf-token}' |
source 'https://rubygems.org' | |
gem 'rails', '4.1.7' | |
gem 'pg', group: :production | |
gem 'rails_12factor', group: :production | |
gem 'uglifier', '>= 1.3.0' | |
gem 'jbuilder', '~> 2.0' | |
gem 'enumerize' | |
gem 'inherited_resources' |
class ProjectsController < ApplicationController | |
def index | |
@projects = Project.all | |
end | |
def show | |
@project = Project.find(params[:id]) | |
end | |
end |
require 'benchmark' | |
require 'mongo' | |
def generate_parts(size) | |
area_patterns = [['main'], ['sub'], ['header', 'footer']] | |
enable_patterns = [true, false] | |
level_patterns = ['/level1', '/level1/level2', '/level1/level2/level3'] | |
(1..size).map do |n| | |
{ |