query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
GET /m_oils/new GET /m_oils/new.json | def new
@m_oil = MOil.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @m_oil }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @soil = Soil.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @soil }\n end\n end",
"def new\n @mi = Mi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mi }\n end\n end",
"def new... | [
"0.73216724",
"0.71293014",
"0.7102304",
"0.706758",
"0.7023546",
"0.6999681",
"0.6971603",
"0.69442105",
"0.69349366",
"0.6918159",
"0.6914589",
"0.6913109",
"0.6889369",
"0.6859659",
"0.68415374",
"0.6839296",
"0.68358785",
"0.68196553",
"0.6807955",
"0.68017983",
"0.679011... | 0.74146956 | 0 |
POST /m_oils POST /m_oils.json | def create
@m_oil = MOil.new(params[:m_oil])
respond_to do |format|
if @m_oil.save
#format.html { redirect_to @m_oil, notice: '登録されました。' }
format.html { redirect_to :controller => "m_oils", :action => "index" }
#format.html { redirect_to @m_oil }
format.json { render json:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @omise = Omise.new(omise_params)\n\n respond_to do |format|\n if @omise.save\n format.html { redirect_to @omise, notice: 'Omise was successfully created.' }\n format.json { render :show, status: :created, location: @omise }\n else\n format.html { render :new }\n ... | [
"0.5933756",
"0.59007525",
"0.582956",
"0.5705996",
"0.5663201",
"0.5632086",
"0.55803436",
"0.55232453",
"0.5511008",
"0.548565",
"0.5468753",
"0.5452623",
"0.54506063",
"0.54348236",
"0.5432796",
"0.54296315",
"0.5406277",
"0.538161",
"0.53723276",
"0.53723276",
"0.5364111"... | 0.62706417 | 0 |
PUT /m_oils/1 PUT /m_oils/1.json | def update
@m_oil = MOil.find(params[:id])
respond_to do |format|
if @m_oil.update_attributes(params[:m_oil])
input_check = params[:input][:check].to_i
format.html { redirect_to :controller => "m_oils", :action => "index",:input_check => input_check }
#format.html { redirect_to :c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @omise.update(omise_params)\n format.html { redirect_to @omise, notice: 'Omise was successfully updated.' }\n format.json { render :show, status: :ok, location: @omise }\n else\n format.html { render :edit }\n format.json { render js... | [
"0.6197484",
"0.6138124",
"0.61300033",
"0.61066455",
"0.60816675",
"0.60466754",
"0.5970001",
"0.596388",
"0.5961457",
"0.593115",
"0.58957905",
"0.58957905",
"0.5878967",
"0.587296",
"0.58546036",
"0.57983243",
"0.5769289",
"0.5766676",
"0.5766097",
"0.5763871",
"0.57538664... | 0.5926861 | 10 |
DELETE /m_oils/1 DELETE /m_oils/1.json | def destroy
@m_oil = MOil.find(params[:id])
#@m_oil.destroy
if @m_oil.deleted_flg == 1
@m_oil.update_attributes(:deleted_flg => 0)
else
@m_oil.update_attributes(:deleted_flg => 1, :deleted_at => Time.current)
end
respond_to do |format|
input_check = params[:input_check].to_i
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @odontologia1 = Odontologia1.find(params[:id])\n @odontologia1.destroy\n\n respond_to do |format|\n format.html { redirect_to odontologia1s_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @soil... | [
"0.68640167",
"0.6857645",
"0.68551254",
"0.67611456",
"0.66306376",
"0.6630475",
"0.6628412",
"0.6587279",
"0.65843594",
"0.65793216",
"0.65787166",
"0.65702224",
"0.65702224",
"0.65702224",
"0.65702224",
"0.6569993",
"0.6553732",
"0.6548923",
"0.65458655",
"0.65343803",
"0.... | 0.64103353 | 50 |
logging the user in | def create
user = User.find_by_credentials(params[:user][:name], params[:user][:password])
if user
#rails creates session cookie for us, session is a hash
#generate new session token and set our session to that token
login!(user)
redirect_to chirps_url
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_in\n end",
"def logging_in\n \t\t\n \tend",
"def logging_in\n end",
"def logged_in\r\n end",
"def login\n end",
"def login\n make_login_call\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
... | [
"0.8146371",
"0.8081984",
"0.7909557",
"0.7779473",
"0.766492",
"0.7623163",
"0.7572904",
"0.7572904",
"0.7572904",
"0.7572904",
"0.7572904",
"0.7572904",
"0.7572904",
"0.7572904",
"0.7572904",
"0.75316244",
"0.7513457",
"0.74986666",
"0.74983776",
"0.74896467",
"0.74429345",... | 0.0 | -1 |
log out, destroy current session | def destroy
logout!
redirect_to new_session_url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_out \n session.clear\n @current_user = nil\n end",
"def log_out\n reset_session\n @current_user = nil\n end",
"def log_out\n\t\tsession.delete(:id)\n\t\t@current_user = nil\n\t\tadmin_session(false)\n\tend",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n\n end... | [
"0.9001359",
"0.8918964",
"0.88838357",
"0.8882921",
"0.8881344",
"0.8876423",
"0.8876423",
"0.8876423",
"0.8876423",
"0.8876423",
"0.8876423",
"0.8876423",
"0.8876423",
"0.8876423",
"0.8876423",
"0.8876423",
"0.8876423",
"0.8876423",
"0.8876423",
"0.8876423",
"0.8876423",
... | 0.0 | -1 |
test manually with: curl i X GET H "ContentType: application/json" \ note: no form interface, so no "new" method | def show_by_translation
@translated_word = TranslatedWord.find_by_translation(params[:translation])
respond_to do |format|
format.json do
render :json => @translated_word.to_json(:include => :word )
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_should_create_link_via_API_JSON\r\n get \"/logout\"\r\n post \"/links.json\", :api_key => 'testapikey',\r\n :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert... | [
"0.64711094",
"0.63363796",
"0.6327781",
"0.6221436",
"0.6210617",
"0.61243993",
"0.61243993",
"0.6104757",
"0.6057333",
"0.60139817",
"0.60125667",
"0.60098994",
"0.60098994",
"0.60059613",
"0.5902172",
"0.5865567",
"0.5857654",
"0.5842902",
"0.5835976",
"0.5814794",
"0.5808... | 0.0 | -1 |
test manually with: curl i X GET H "ContentType: application/json" | def show_by_original_word
@translated_word = TranslatedWord.find_by_word_id(Word.find_by_text(params[:wordtext]))
respond_to do |format|
format.json do
render :json => @translated_word.to_json(:include => :word )
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_should_be_json_response\n get '/mock/example'\n assert_equal last_response.content_type, \"application/json\"\n end",
"def expect_json_content\n expect(content_type).to eq('application/json')\n end",
"def test_json_success\n c = Example::HaberdasherClient.new(conn_stub(\"/example.Haberda... | [
"0.67073447",
"0.662293",
"0.6447745",
"0.6333155",
"0.6333155",
"0.62591666",
"0.62381953",
"0.6222386",
"0.61427665",
"0.61290085",
"0.61290085",
"0.6076661",
"0.6074839",
"0.6068053",
"0.603943",
"0.603943",
"0.603081",
"0.6015321",
"0.5994307",
"0.5988953",
"0.59845257",
... | 0.0 | -1 |
test manually with: curl i X GET H "ContentType: application/json" GET an existing because this is for REST and not for the business logic, it shows the id see also the "lookup" methods | def show
@translated_word = TranslatedWord.find(params[:id])
respond_to do |format|
format.json do
# render :json => @translated_word.to_json(:include => { :word => { :only => :text } })
render :json => @translated_word.to_json(:include => :word )
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(type, id)\n info = json_get(@target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\",\n @key_style, headers)\n\n fake_client_id(info) if type == :client # hide client reply, not quite scim\n info\n end",
"def find_custom_data(endpoint, id)\n restHttpGet(\"#{endpoint}/#{id}/... | [
"0.65989393",
"0.63907164",
"0.6280287",
"0.62372005",
"0.6110296",
"0.6043694",
"0.60293335",
"0.60216975",
"0.5986097",
"0.5984059",
"0.59738046",
"0.5971782",
"0.59611577",
"0.5956619",
"0.59562635",
"0.5947918",
"0.59355646",
"0.58668053",
"0.5859903",
"0.58538896",
"0.58... | 0.0 | -1 |
test manually with: curl i X GET H "ContentType: application/json" PUT a new record for an existing only updates translation, not the word it's translating | def update
@translated_word = TranslatedWord.find(params[:id])
respond_to do |format|
if @translated_word.update_attributes(params[:translation])
format.json { head :no_content }
else
format.json { render :json => @translated_word.errors,
:status => :... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_translation(id, new_value)\n # puts(\"#{id} : #{new_value}\")\n # Add the following line to prevent ACTUAL changing of the translation:\n # return true\n new_value_json = { 'target' => new_value }.to_json\n # Note: This popen invocation does NOT go through the shell,\n # so we do not use shell esc... | [
"0.6730628",
"0.64275",
"0.63974774",
"0.6365767",
"0.6221738",
"0.6089963",
"0.6072051",
"0.5987049",
"0.5956404",
"0.594279",
"0.5922136",
"0.5767139",
"0.5754699",
"0.57471794",
"0.57467055",
"0.57326096",
"0.56724626",
"0.5643505",
"0.56130797",
"0.5584056",
"0.5583013",
... | 0.6352466 | 4 |
def turn(board) puts "Please enter 19:" position = gets.strip until valid_move?(board, position) puts "Please choose a Correct Position a Number Between 19!" position = gets.strip end move(board, position, char ="X") display_board(board) end | def turn(board)
puts "Please enter 1-9:"
input = gets.strip
if !valid_move?(board, input)
turn(board)
end
move(board, input, current_player(board))
display_board(board)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn(board)\n puts \"Please enter 1-9:\"\n position = gets.strip\n\n if valid_move?(board, position) #&& position_taken?(board, position)\n move(board, position, current_player = \"X\")\n puts \"Please enter 1-9 again:\"\n else\n puts \"Please enter a valid number\"\n turn(board)\n end\n\n di... | [
"0.9065998",
"0.8859854",
"0.8857207",
"0.88255787",
"0.8816577",
"0.8780752",
"0.8775149",
"0.87077",
"0.8675623",
"0.86621135",
"0.86252147",
"0.8623297",
"0.85532635",
"0.853814",
"0.8527756",
"0.852499",
"0.8520242",
"0.8500582",
"0.8465823",
"0.84608907",
"0.83950746",
... | 0.8362065 | 28 |
Test resolve_file_with_dir() and line_at() | def test_line_at
@cmdproc.settings[:directory] = ''
assert_equal(nil, @cmdproc.resolve_file_with_dir(@file))
if File.expand_path(Dir.pwd) == File.expand_path(File.dirname(__FILE__))
line = @cmdproc.line_at(@file, __LINE__)
assert_match(/line = @cmdproc.line_at/, line)
else
assert_equal... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_line_at\n @proc.settings[:directory] = ''\n assert_equal(nil, @proc.resolve_file_with_dir(@file))\n if File.expand_path(Dir.pwd) == File.expand_path(File.dirname(__FILE__))\n line = @proc.line_at(@file, __LINE__)\n assert_match(/line = @proc.line_at/, line)\n else\n assert_equal... | [
"0.8144407",
"0.6202443",
"0.5818244",
"0.5807433",
"0.58005416",
"0.57673174",
"0.5765686",
"0.57357264",
"0.56874764",
"0.5632436",
"0.5632436",
"0.56084424",
"0.5601543",
"0.5601543",
"0.5601543",
"0.5576068",
"0.55700946",
"0.5564307",
"0.5554072",
"0.5514295",
"0.5488025... | 0.80334336 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_answers_alterantive
@answers_alterantive = AnswersAlterantive.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def answers_alterantive_params
params.require(:answers_alterantive).permit(:history_id, :message, :score)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
shuffle integers There is a company that has a very creative way of managing its accounts. Every time they want to write down a number, they shuffle its digits in the following way: they alternatively write one digit from the front of the number and one digits from the back, then the second digits from the front and th... | def solution(a)
number = a.to_s.chars
first_arrays = []
(number.length/2).times do
first_arrays << number.shift
first_arrays << number.rotate(number.length-1).shift
number.pop
end
( first_arrays + number ).join("").to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_shuffle(number)\n number.to_s.chars.map { |c| c.to_i }.\n \n permutation.to_a.map { |set| set.join }.\n \n map { |str| str.to_i }.sort\n #number.to_s.chars.to_a.permutation.map(&:join).map(&:to_i)\nend",
"def number_shuffle(number)\n number.to_s.split('').permutation.to_a.map{|x| x.join('')... | [
"0.7789038",
"0.7757296",
"0.75036687",
"0.746979",
"0.7382345",
"0.72077125",
"0.7125467",
"0.7111545",
"0.65599096",
"0.649554",
"0.6419853",
"0.6297556",
"0.6283093",
"0.62789685",
"0.62530875",
"0.6251389",
"0.6231382",
"0.6132504",
"0.60927224",
"0.607994",
"0.604184",
... | 0.5685596 | 72 |
Normalizes arguments and options, and then delegates to render_to_body and sticks the result in self.response_body. Supported options depend on the underlying +render_to_body+ implementation. | def render(*args, &block)
options = _normalize_render(*args, &block)
rendered_body = render_to_body(options)
if options[:html]
_set_html_content_type
else
_set_rendered_content_type rendered_format
end
_set_vary_header
self.response_body = rendered_body
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_to_body(options); end",
"def render(*args, &block)\n\t options = _normalize_render(*args, &block)\n\t self.response_body = render_to_body(options)\n\t _process_format(rendered_format, options) if rendered_format\n\t self.response_body\n\t end",
"def render_to_body(options = {}... | [
"0.7884952",
"0.78043777",
"0.77017057",
"0.7696614",
"0.75307375",
"0.73426306",
"0.7262002",
"0.69690263",
"0.6642023",
"0.6610659",
"0.6550338",
"0.64536935",
"0.641212",
"0.6374584",
"0.63310945",
"0.6325569",
"0.62834805",
"0.6277126",
"0.6222812",
"0.617191",
"0.6146032... | 0.75342375 | 4 |
Similar to render, but only returns the rendered template as a string, instead of setting +self.response_body+. If a component extends the semantics of +response_body+ (as ActionController extends it to be anything that responds to the method each), this method needs to be overridden in order to still return a string. | def render_to_string(*args, &block)
options = _normalize_render(*args, &block)
render_to_body(options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_to_string(*)\n if self.response_body = super\n string = \"\"\n self.response_body.each { |r| string << r }\n string\n end\n ensure\n self.response_body = nil\n end",
"def render(*args, &block)\n\t options = _normalize_render(*args, &block)\n\t self.r... | [
"0.8046741",
"0.75988984",
"0.74522483",
"0.6957051",
"0.69142085",
"0.6835112",
"0.6819824",
"0.6738034",
"0.6633952",
"0.6612195",
"0.65472424",
"0.64675",
"0.6466903",
"0.64602727",
"0.64496624",
"0.6442821",
"0.6440433",
"0.6432384",
"0.6417857",
"0.6417857",
"0.64177924"... | 0.67503715 | 7 |
Performs the actual template rendering. | def render_to_body(options = {})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _render_template(options); end",
"def _render_template(options); end",
"def render_template(context, options); end",
"def do_render\n Mustache.render(template, self)\n end",
"def render\n case File.extname(@template_file)\n when '.erb'\n render_erb\n ... | [
"0.7752171",
"0.7752171",
"0.75884664",
"0.7482111",
"0.71266234",
"0.7088114",
"0.7072688",
"0.7011997",
"0.69956195",
"0.69499564",
"0.6949106",
"0.69289285",
"0.6888842",
"0.6851567",
"0.67942345",
"0.6792475",
"0.67895526",
"0.67724806",
"0.67547166",
"0.67479825",
"0.673... | 0.0 | -1 |
Returns +ContentType+ of rendered content. | def rendered_format
Mime[:text]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_content_type\n self.content_type\n end",
"def content_type\n return @content_type\n end",
"def content_type\n @content_type || object.content_type\n end",
"def content_type\n @content_type ||= @response_impl.entity.content_type.value\n end... | [
"0.811772",
"0.8007842",
"0.78442734",
"0.77517784",
"0.773644",
"0.77226776",
"0.7711552",
"0.7641614",
"0.76385474",
"0.7613591",
"0.76067644",
"0.75435096",
"0.74204147",
"0.7419784",
"0.73582315",
"0.73447144",
"0.73440665",
"0.7314425",
"0.7299885",
"0.72753173",
"0.7261... | 0.0 | -1 |
This method should return a hash with assigns. You can overwrite this configuration per controller. | def view_assigns
variables = instance_variables - _protected_ivars
variables.each_with_object({}) do |name, hash|
hash[name.slice(1, name.length)] = instance_variable_get(name)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assigns\n vars = Hash.new\n instance_variables.each do |var|\n if ![\"@view\", \"@action_name\", \"@block\"].include? var\n vars[var[1..-1]] = instance_variable_get(var)\n end\n end\n vars\n end",
"def assigns\n @assigns ||= { }\n end",
"def... | [
"0.7436197",
"0.697376",
"0.6517275",
"0.6273284",
"0.6273284",
"0.6273284",
"0.6273284",
"0.5985996",
"0.5944944",
"0.58683014",
"0.58683014",
"0.57475096",
"0.5730779",
"0.56537503",
"0.5635973",
"0.5635973",
"0.5634526",
"0.56169534",
"0.5596597",
"0.55145437",
"0.55083",
... | 0.6396883 | 3 |
Normalize args by converting render "foo" to render action: "foo" and render "foo/bar" to render file: "foo/bar". | def _normalize_args(action = nil, options = {}) # :doc:
if action.respond_to?(:permitted?)
if action.permitted?
action
else
raise ArgumentError, "render parameters are not permitted"
end
elsif action.is_a?(Hash)
action
else
options
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _normalize_args(action = T.unsafe(nil), options = T.unsafe(nil), &blk); end",
"def _normalize_args(action = T.unsafe(nil), options = T.unsafe(nil)); end",
"def _normalize_args(action = T.unsafe(nil), options = T.unsafe(nil)); end",
"def _normalize_args(action=nil, options={})\n\t if action.is_a? Has... | [
"0.66927296",
"0.6568717",
"0.6568717",
"0.64574635",
"0.63877684",
"0.6081608",
"0.59354377",
"0.57585007",
"0.5691551",
"0.5651763",
"0.56395507",
"0.56153333",
"0.5582649",
"0.54701746",
"0.5454074",
"0.544981",
"0.53376627",
"0.52491367",
"0.5219042",
"0.51706564",
"0.514... | 0.66988856 | 0 |
Process the rendered format. | def _process_format(format) # :nodoc:
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process\n convert\n render\n write\n end",
"def render\n @formatted_content.each &:render\n end",
"def _process_format(format); end",
"def _process_format(format); end",
"def render(*args, &block)\n\t options = _normalize_render(*args, &block)\n\t self.response_body ... | [
"0.71153796",
"0.70610374",
"0.6550989",
"0.6550989",
"0.63252085",
"0.626174",
"0.626174",
"0.6116141",
"0.6098836",
"0.6098836",
"0.60088074",
"0.5999082",
"0.59579855",
"0.5937131",
"0.5847822",
"0.5828007",
"0.5819556",
"0.58025825",
"0.579954",
"0.5773718",
"0.5736875",
... | 0.64096135 | 4 |
Normalize args and options. | def _normalize_render(*args, &block) # :nodoc:
options = _normalize_args(*args, &block)
_process_variant(options)
_normalize_options(options)
options
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_args(string, options_hash); end",
"def _normalize_options(options); end",
"def normalize_args(args)\n return args if args.nil?\n args.pop if args.size > 0 && args.last == '--'\n args\n end",
"def _normalize_args(action = T.unsafe(nil), options = T.unsafe(nil));... | [
"0.8043663",
"0.77764523",
"0.77240455",
"0.71689546",
"0.71689546",
"0.71331686",
"0.7039585",
"0.70012844",
"0.6612813",
"0.6612813",
"0.65497255",
"0.65311944",
"0.6496818",
"0.64835614",
"0.6467784",
"0.6411748",
"0.6411017",
"0.6387258",
"0.637591",
"0.6347297",
"0.63155... | 0.61257774 | 34 |
Render and deliver the chart | def getchart()
# The value to display on the meter
value = 27.48
# Create an AngularMeter object of size 200 x 115 pixels, with silver background
# color, black border, 2 pixel 3D border border and rounded corners
m = ChartDirector::AngularMeter.new(200, 115, ChartDirector::silv... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_chart\n assert_privileges(\"view_graph\")\n\n if params[:report]\n rpt = MiqReport.for_user(current_user).find_by(:name => params[:report])\n rpt.generate_table(:userid => session[:userid])\n else\n rpt = if session[:report_result_id]\n MiqReportResult.for_user(curre... | [
"0.73793256",
"0.71304905",
"0.70487463",
"0.7032319",
"0.69694126",
"0.69295007",
"0.69255656",
"0.69129133",
"0.69128174",
"0.68344223",
"0.6826156",
"0.68255234",
"0.6810791",
"0.6803158",
"0.6785608",
"0.67432153",
"0.67410535",
"0.6721165",
"0.67112935",
"0.67078435",
"0... | 0.6183519 | 61 |
repeatStr(6, "I") // "IIIIII" repeatStr(5, "Hello") // "HelloHelloHelloHelloHello" def repeat_str (n, s) your code here end My solution | def repeat_str (n, s)
s * n
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repeat_str (n, s)\n string = ''\n n.times do\n string << s\n end\n return string\nend",
"def repeat_str n, s\n s * n\nend",
"def repeat_str(n, s)\n return s * n\nend",
"def repeat_str (n, s)\r\n return s * n\r\nend",
"def repeat_str (n, s)\n s*n\nend",
"def repeat (n, s)\n\t\tres = \"\"\n\... | [
"0.9247326",
"0.91544354",
"0.90933585",
"0.9035614",
"0.90055954",
"0.8826627",
"0.8679414",
"0.86504924",
"0.86334264",
"0.8539802",
"0.85177904",
"0.8505025",
"0.84842575",
"0.84626216",
"0.8345981",
"0.8345565",
"0.8332241",
"0.8267085",
"0.82604957",
"0.8254701",
"0.8174... | 0.90949667 | 3 |
Location of template as Pathname. | def path
@directory.path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def template_path\n \"#{template_dir}/#{template_name}\"\n end",
"def template_path\n @template_path ||= @env[:templates_path] || default_settings[:templates_path]\n Pathname.new @template_path\n end",
"def template_name\n self.path.scan(/[^\\/]+$/).first\n end",
"def full_template_path\n ... | [
"0.8245432",
"0.7902741",
"0.787979",
"0.7851268",
"0.78340006",
"0.77536243",
"0.7745137",
"0.7724365",
"0.77109724",
"0.7684471",
"0.7635658",
"0.7623669",
"0.7609988",
"0.7579039",
"0.75371236",
"0.75065327",
"0.7473975",
"0.74541223",
"0.7421804",
"0.73753005",
"0.7360644... | 0.0 | -1 |
Copy script. Defaults to `copy all`. | def script
@script ||= Script.new(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_script\n\n end",
"def copy_scripts\n script_list.each do |name|\n source = File.join(__dir__, \"script/#{name}.bash\")\n dest = File.expand_path(\"~/.#{name}-goodies.bash\")\n puts \"Copy #{name}-goodies\".green\n `cp #{source} #{dest}`\n end\nend",
"def force_copy\n add option: \"... | [
"0.7693025",
"0.74485767",
"0.7076429",
"0.6983661",
"0.6767053",
"0.6724248",
"0.6695201",
"0.6658237",
"0.661276",
"0.65738016",
"0.6508598",
"0.6408054",
"0.6408054",
"0.6387292",
"0.63358897",
"0.6334249",
"0.63257706",
"0.6300805",
"0.627508",
"0.6274636",
"0.6274636",
... | 0.0 | -1 |
Contents of the README file. | def help(lang='en')
readme.to_s(lang)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about\n require \"github/markup\"\n @readme = GitHub::Markup.render(\"README.md\", File.read(\"README.md\")).html_safe\n end",
"def readme\n txt = File.open(Rails.root.join('README.rdoc'), 'r').read\n @readme = RDoc::Markup::ToHtml.new(RDoc::Options.new).convert(txt)\n end",
"def contstruct_r... | [
"0.8162381",
"0.8003672",
"0.75438374",
"0.753018",
"0.7500596",
"0.73758584",
"0.73612505",
"0.7360602",
"0.7320545",
"0.7320545",
"0.7314378",
"0.72794896",
"0.7256668",
"0.7255571",
"0.71777314",
"0.71777314",
"0.71777314",
"0.7144281",
"0.68728983",
"0.68539035",
"0.68043... | 0.65012366 | 28 |
Returns the list of template files, less files to be ignored for scaffolding. | def files
directory.files
#@files ||= (
# files = []
# Dir.recurse(directory.to_s) do |path|
# next if IGNORE_FILES.include?(File.basename(path))
# files << path.sub(directory.to_s+'/','')
# end
# files.reject{ |f| File.match?(CONFIG_FILE) }
#)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def template_files\n Pathname.glob(staged_root.join(\"**\", \"*.erb\")).select(&:file?)\n end",
"def excluded_files() = []",
"def ignore_assets\n ret = []\n ret << [\"assets/styles/atoms/flex\", \"assets/styles/atoms/flex/*\"]\n ret << [\"assets/styles/styleguide\", \"assets/styles/styleguide/... | [
"0.70727867",
"0.7039204",
"0.68385196",
"0.68137246",
"0.6812793",
"0.6812793",
"0.6783788",
"0.6721647",
"0.6658375",
"0.6633692",
"0.65697503",
"0.65453106",
"0.6534028",
"0.65176576",
"0.644419",
"0.64400697",
"0.6426168",
"0.63238835",
"0.6285689",
"0.6242322",
"0.621801... | 0.5544031 | 77 |
Returns the list of template directories, less those to be ignored for scaffolding. | def directories
directory.directoires
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ignore_paths\n Dir.glob(\"**/*\").select { |f| File.directory? f }\n .collect { |name| \"#{name}/\" }\n - [\"app/\",\n \"app/views/\",\n \"app/views/branded/\",\n \"app/views/branded/public_pages/\",\n \"app/views/branded/home/\",\n \"app/views/branded/contact_us/\",\n \"app/views... | [
"0.7254932",
"0.70662564",
"0.67702204",
"0.66111916",
"0.6483716",
"0.6454653",
"0.6436855",
"0.63758427",
"0.6363392",
"0.6337205",
"0.627696",
"0.6240614",
"0.62402505",
"0.62240416",
"0.6136382",
"0.6119492",
"0.61089784",
"0.6105665",
"0.6094523",
"0.60845965",
"0.606362... | 0.0 | -1 |
Pulls all of the repos | def pull_and_checkout
Dir.new('.').each do |directory|
next unless /[a-z]{2,3}\d{4}/.match(directory)
puts "Pulling repo for #{directory.cyan}"
g = Git.open(directory)
g.pull
date = CONFIG['extended']['dce'].include?(directory) ? CONFIG['extended']['due_date'] : CONFIG['due... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all(slug = @curry_with[0])\n response = @connection.get(\"/repos/#{slug}/pulls\", per_page: 100)\n PullRequest.parse(@connection, response.body)\n end",
"def find_repositories\n @repos = GithubApi.call :repos\n end",
"def repos\n client.repos({}, query: { sort: \"asc\" })\n end",
... | [
"0.7641887",
"0.7404195",
"0.72785354",
"0.71806604",
"0.71047056",
"0.7094951",
"0.6985756",
"0.69776404",
"0.6945612",
"0.69153136",
"0.69116384",
"0.69071597",
"0.6896295",
"0.68887764",
"0.68847984",
"0.68812686",
"0.6873889",
"0.683252",
"0.68162763",
"0.680023",
"0.6791... | 0.7306044 | 2 |
Looks at everyones activity journals | def activity_journals(file)
journals = YAML.load(file)
journals = '' unless journals
journals = {} if journals.empty?
Dir.new('.').each do |directory|
next unless /[a-z]{2,3}\d{4}/.match(directory) and journals[directory].nil?
journals[directory] = activity_journal_for(directory... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list\n @journals = Journal.all\n end",
"def journals\n subcomponents[\"VJOURNAL\"]\n end",
"def index\n @journals = Journal.all\n end",
"def index\n @journals = Journal.all\n end",
"def index\n @journals = Journal.all\n end",
"def show_answered_surveys(journals, conditions... | [
"0.62251455",
"0.6101461",
"0.59147483",
"0.59147483",
"0.59147483",
"0.5884259",
"0.5757293",
"0.56973034",
"0.5657459",
"0.56270224",
"0.55437624",
"0.553531",
"0.55105305",
"0.5502924",
"0.5480063",
"0.5414232",
"0.5412201",
"0.5393228",
"0.539166",
"0.5391391",
"0.5384329... | 0.5330292 | 28 |
looks at an activity journal for a specific user | def activity_journal_for(user)
results = {}
puts "Displaying activity journal for #{user.cyan}"
if File.exists?("#{user}/#{CONFIG['project_name']}/Activity_Journal.txt")
results['has_journal'] = 'yes'
journal = File.open("#{user}/#{CONFIG['project_name']}/Activity_Journal.txt").read
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_journal\n @journal = Journal.where({ id:params[:id], user_id: @user.id })\n return item_not_found\n end",
"def set_journal\n @journal = current_user.records.find(params[:id])\n end",
"def get_journal\n current_user.get_journal unless current_user.nil?\n end",
"def loa... | [
"0.6824183",
"0.65399516",
"0.6154012",
"0.6099576",
"0.6047772",
"0.59819406",
"0.58182484",
"0.5727154",
"0.5661306",
"0.5548571",
"0.55269235",
"0.55269235",
"0.55269235",
"0.55269235",
"0.55269235",
"0.55269235",
"0.55269235",
"0.55269235",
"0.55094975",
"0.5496609",
"0.5... | 0.7490929 | 0 |
View code for people | def view_code(file)
code = YAML.load(file)
code = '' unless code
code = {} if code.empty?
Dir.new('.').each do |directory|
next unless /[a-z]{2,3}\d{4}/.match(directory) and code[directory].nil?
code[directory] = view_code_for(directory)
end
ensure
file.write(YAM... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view; end",
"def view_people\r\n user = session[:user]\r\n @people = user.get_logged_in_users\r\n \r\n render_partial 'people', :people => @people\r\n \r\n rescue\r\n render_text ''\r\n end",
"def show_person( title, person )\n\n #puts \"#{title} #{person}\"\n puts \"#{title}\... | [
"0.66363597",
"0.6599907",
"0.65372264",
"0.64659715",
"0.64659715",
"0.64659715",
"0.64445734",
"0.6441338",
"0.6424562",
"0.63794315",
"0.6369046",
"0.63569856",
"0.63448936",
"0.631554",
"0.62655157",
"0.62655157",
"0.6260688",
"0.6257467",
"0.62404877",
"0.62404877",
"0.6... | 0.0 | -1 |
View code for a specific user | def view_code_for(user)
results = {}
puts "Displaying code for #{user.cyan}"
CONFIG['project_files'].each do |file|
if File.exists?("#{user}/#{CONFIG['project_name']}/#{file}")
puts "Displaying #{file.yellow}"
code = File.open("#{user}/#{CONFIG['project_name']}/#{file}").re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user\n access_code.user\n end",
"def view\n\t\trequest_user(params[:id])\n\tend",
"def show\n @user = current_user\n respond_to do |format|\n format.html # show.html.slim\n end\n end",
"def show\n @code = Code.find_by_id_and_user_id(params[:id], session[:user_id])\n\n respond_to ... | [
"0.68495303",
"0.68390846",
"0.65179414",
"0.6396101",
"0.6384207",
"0.6378756",
"0.6346626",
"0.6296279",
"0.62537414",
"0.6245088",
"0.6179302",
"0.61787146",
"0.61777544",
"0.61777544",
"0.617424",
"0.6169934",
"0.6164169",
"0.61546206",
"0.61448705",
"0.6121537",
"0.61020... | 0.7275124 | 0 |
GET /clients GET /clients.xml | def current_company
@current_company = current_user.companies.find(params[:company_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @client }\n end\n end",
"def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @client... | [
"0.75164795",
"0.7421057",
"0.70793927",
"0.7073821",
"0.70061374",
"0.70061374",
"0.7004871",
"0.69343954",
"0.68652415",
"0.68650943",
"0.68650943",
"0.6860498",
"0.68444675",
"0.671169",
"0.66155076",
"0.66055685",
"0.65987116",
"0.6563584",
"0.6563584",
"0.6563584",
"0.65... | 0.0 | -1 |
GET /clients/1 GET /clients/1.xml | def show
@client = clients.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @client }\n end\n end",
"def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @client... | [
"0.7380561",
"0.72592616",
"0.7090482",
"0.70330524",
"0.70330524",
"0.7031971",
"0.7010604",
"0.6810583",
"0.67577034",
"0.67046547",
"0.64271015",
"0.6409478",
"0.6336987",
"0.63019866",
"0.628176",
"0.628176",
"0.6277412",
"0.6277412",
"0.6263234",
"0.6247476",
"0.62283677... | 0.6495515 | 10 |
GET /clients/new GET /clients/new.xml | def new
@client = clients.new
@client.build_address
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @client = Client.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @client }\n end\n end",
"def new\n @client = Client.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @client }\n e... | [
"0.7748645",
"0.7748645",
"0.77040696",
"0.7698202",
"0.70474637",
"0.70474637",
"0.7045587",
"0.6926723",
"0.6926723",
"0.6926723",
"0.6926723",
"0.68343425",
"0.6808207",
"0.6792731",
"0.6771883",
"0.67642814",
"0.66724354",
"0.663395",
"0.6625911",
"0.6607059",
"0.6599925"... | 0.0 | -1 |
POST /clients POST /clients.xml | def create
@client = clients.new(params[:client])
if @client.save
flash[:notice] = 'Customer was successfully created.'
redirect_to(user_company_clients_url(current_company))
else
render :action => "new"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @client = Client.new(params[:client])\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to(@client, :notice => 'Client was successfully created.') }\n format.xml { render :xml => @client, :status => :created, :location => @client }\n else\n for... | [
"0.6368773",
"0.63398874",
"0.63257164",
"0.63076407",
"0.61417395",
"0.6058912",
"0.6037205",
"0.5923363",
"0.5910617",
"0.59095126",
"0.58913696",
"0.58880883",
"0.5886547",
"0.58861256",
"0.5885018",
"0.58621347",
"0.5829662",
"0.58111614",
"0.58111614",
"0.5807826",
"0.57... | 0.5613823 | 49 |
PUT /clients/1 PUT /clients/1.xml | def update
@client = clients.find(params[:id])
if @client.update_attributes(params[:client])
flash[:notice] = 'Client was successfully updated.'
redirect_to(user_company_clients_url(current_company))
else
render :action => "edit"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @client = Client.find(params[:id])\n respond_to do |format|\n if @client.update_attributes(params[:client])\n \n flash[:notice] = 'Client was successfully updated.'\n format.html { redirect_to(@client) }\n format.xml { head :ok }\n else\n format.html ... | [
"0.6487007",
"0.6445862",
"0.6419132",
"0.6412342",
"0.6340511",
"0.62911725",
"0.6252607",
"0.59888494",
"0.5980401",
"0.5974242",
"0.5943189",
"0.59288776",
"0.59017426",
"0.5896462",
"0.5886091",
"0.5875152",
"0.58707774",
"0.58701956",
"0.58583736",
"0.58583736",
"0.58570... | 0.57201695 | 34 |
DELETE /clients/1 DELETE /clients/1.xml | def destroy
@client = clients.find(params[:id])
@client.destroy
redirect_to(user_company_clients_url(current_company))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to(clients_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n ... | [
"0.73688173",
"0.72947896",
"0.72947896",
"0.7293422",
"0.7283783",
"0.7249372",
"0.7062806",
"0.68640953",
"0.67562115",
"0.67562115",
"0.67400753",
"0.66846204",
"0.6636265",
"0.6586786",
"0.65743816",
"0.65639204",
"0.65472543",
"0.6541973",
"0.6541973",
"0.65411144",
"0.6... | 0.65101266 | 30 |
TODO: ideally, we'd autogenerate preferences on model creation | def resolve(name:, address:, preferences:, total_space:)
matched = Rider.where(id: preferences)
if matched.length != preferences.length
{
driver: nil,
errors: ['There is an invalid id provided in the preferences.']
}
end
driver = Driver.create(
n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_right_preferences_path\n Mongoid::Preferences.configure do |config|\n # model preferences path to dummy model\n config.model_preferences_path = File.join(File.dirname(__FILE__), \"models_preferences\")\n end\nend",
"def preferences_field\n :preferences\n end",
"def set_wrong_preferences... | [
"0.70618826",
"0.6578846",
"0.6458585",
"0.6202629",
"0.58869755",
"0.58849216",
"0.58667374",
"0.58348864",
"0.5802141",
"0.5793709",
"0.5732527",
"0.57219154",
"0.5709169",
"0.5702506",
"0.5702506",
"0.5690447",
"0.56832117",
"0.5665195",
"0.56464356",
"0.5640944",
"0.56315... | 0.0 | -1 |
validates :part_detail, :material ,:uom , :thk_dia , :weight , presence: :true | def total_weight
if catogery_id == 1
fomular_1 * amount_qty
elsif category_id == 2
fomular_2 * amount_qty
elsif category_id == 3
fomular_3 * amount_qty
else
0
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def needs_units\n if (self.weight && (self.units).blank?)\n self.errors[:base] << 'Please specify the units for the exercise'\n elsif (self.distance && (self.units).blank?)\n self.errors[:base] << 'Please specify the units for the exercise'\n end\n end",
"def part_params\n params.require(:... | [
"0.64827603",
"0.63773054",
"0.6347117",
"0.6327982",
"0.6262159",
"0.6200026",
"0.6192366",
"0.617372",
"0.6146445",
"0.6139082",
"0.6125379",
"0.6119079",
"0.60548383",
"0.6040395",
"0.6034233",
"0.60102534",
"0.5999851",
"0.59962344",
"0.5962791",
"0.59519184",
"0.5927987"... | 0.0 | -1 |
Decide which object this instance will be. | def initialize
# Random number between 0 and 12
@x = rand(12) + 1
# We want vials and herbs to have higher chance to show up in rooms.
if @x >= 8 and @x < 10
@objX = $objs[4]
@x = 4
elsif @x >= 10
@objX = $objs[7]
@x = 7
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def object\n\t\t\t\t@object ||= @options[:object]\n\t\t\tend",
"def owner\n parent_class = self.class.to_s\n case parent_class\n when 'Post'\n user = :author\n when 'Photo'\n user = :poster\n else\n return false\n end\n self.send(user)\n end",
"def klass\n object.is_owne... | [
"0.6433698",
"0.6317087",
"0.6109075",
"0.61067426",
"0.59561944",
"0.59219784",
"0.5900199",
"0.589231",
"0.58861893",
"0.58703744",
"0.5825915",
"0.5812975",
"0.5792191",
"0.57664746",
"0.57548124",
"0.57137895",
"0.5703954",
"0.5703954",
"0.56940854",
"0.5684919",
"0.56643... | 0.0 | -1 |
Apply appropriate attributes for this object type. | def buildObject()
case @x
when 0
attrX = $doorAttr[rand(6)]
attrSX = $doorAttrS[rand(6)]
@obj_pickable = false
@combat_usability = false
when 1
attrX = $chestAttr[rand(3)]
attrSX = $chestAttrS[rand(3)]
@obj_pickable = false
@comba... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply\n scalar_attrs.each { |m| applicator(m) { |r| send(m, r) } }\n list_attrs.each { |m| applicator(m) { |r| send(m, *r) } }\n hash_attrs.each { |m| applicator(m) { |r| send(m).merge!(r) } }\n path_attrs.each { |m| applicator(m) { |r| send(\"#{m}=\", r) } }\n ... | [
"0.6844879",
"0.67731863",
"0.668495",
"0.6674069",
"0.65460646",
"0.6434773",
"0.64158994",
"0.6409315",
"0.63867795",
"0.6378621",
"0.6260233",
"0.6187262",
"0.6182947",
"0.6173255",
"0.6159212",
"0.6159212",
"0.6159212",
"0.6159212",
"0.61399233",
"0.6093679",
"0.6081216",... | 0.0 | -1 |
Print the object and it's attributes to the screen. | def inspect()
print @obj_name
print " which is "
print @obj_attr
print " & "
puts @obj_secondattr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def println obj\n echo(obj.to_s + \"\\n\")\n end",
"def print\n puts SEPARATOR\n puts @name\n puts SEPARATOR\n puts @desc\n if(@diagram)\n puts\n puts \"Diagram:\"\n puts\n puts @diagram\n end\n end",
"def print_object(object, threshold = '')\n out = '{' + \"\... | [
"0.7290486",
"0.71276164",
"0.7032887",
"0.702641",
"0.70192635",
"0.6989438",
"0.69572514",
"0.69297934",
"0.6863496",
"0.6803661",
"0.6754769",
"0.67510754",
"0.6739078",
"0.6720826",
"0.6713899",
"0.66966647",
"0.6650563",
"0.66297156",
"0.6617078",
"0.66093886",
"0.660577... | 0.68801355 | 8 |
Get the object's name. | def getName()
return @obj_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name\n @object.to_s\n end",
"def name\n object.name\n end",
"def name\n @name || object_id.to_s\n end",
"def name\n object[\"name\"]\n end",
"def object_name\n @object.name.split('::').last.downcase + 's'\n end",
"def name\n @name ||= self.class.non_namespaced_nam... | [
"0.8577764",
"0.8409581",
"0.8323293",
"0.830813",
"0.80365",
"0.7793175",
"0.777788",
"0.77636415",
"0.77636415",
"0.77636415",
"0.77636415",
"0.77366376",
"0.77028656",
"0.7673694",
"0.7650504",
"0.7631322",
"0.7631322",
"0.76080924",
"0.7602434",
"0.7602434",
"0.7602434",
... | 0.87941587 | 0 |
Return whether or not ths item can be added to the Player's inventory. | def getPickable()
return @obj_pickable
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_equip?(item, slot)\n item.allowed_slot == slot && items.include?(item)\n end",
"def inventoriable?\n inventory?\n end",
"def include?(item)\n return false if item == nil\n return false unless item.is_a?(RPG::EquipItem)\n return false if @slot_id < 0\n return false if item.etype_id !... | [
"0.7322076",
"0.7184947",
"0.7123719",
"0.7100683",
"0.7055049",
"0.69866925",
"0.6985957",
"0.681531",
"0.6809128",
"0.67806923",
"0.67806923",
"0.67506397",
"0.67458797",
"0.6718047",
"0.6697008",
"0.6652896",
"0.66214114",
"0.6618988",
"0.6602418",
"0.66008395",
"0.6597336... | 0.0 | -1 |
Get the first attribute of the object. | def getFAttr()
return @obj_attr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first(field)\n @attributes[field]\n end",
"def broham_attr attr\n [ broham_info[attr] ].flatten.first\n end",
"def getSAttr()\n return @obj_secondattr\n end",
"def reference_attribute\n\t\t\tsorted_attributes.first\n\t\tend",
"def first\n self['first']\n end",
"def get_attr... | [
"0.7527568",
"0.67201173",
"0.66713345",
"0.6502112",
"0.6389003",
"0.6335243",
"0.6287871",
"0.62009645",
"0.62009645",
"0.61633873",
"0.61619693",
"0.61511624",
"0.6112243",
"0.6111705",
"0.61103255",
"0.6085778",
"0.6085061",
"0.60841584",
"0.60694844",
"0.6058069",
"0.602... | 0.6470783 | 4 |
Get the second attribute of the object. | def getSAttr()
return @obj_secondattr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def second\n self[1]\n end",
"def second\n self[1]\n end",
"def second\n self[1]\n end",
"def extension_attribute2\n return @extension_attribute2\n end",
"def s2\n return self[:s2]\n end",
"def s2\n return self[:s2]\n end",
"def s2\n return self[:... | [
"0.6447526",
"0.6447526",
"0.6447526",
"0.6423978",
"0.63632333",
"0.63632333",
"0.63632333",
"0.63632333",
"0.63632333",
"0.63632333",
"0.63632333",
"0.6361894",
"0.6361894",
"0.6361894",
"0.6361894",
"0.6361894",
"0.6361894",
"0.6361894",
"0.6361894",
"0.6361894",
"0.636189... | 0.7756084 | 0 |
Determine if the item can be used in combat. | def getCUsability()
return @combat_usability
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def item_can_use?(item)\n return false unless item.is_a?(RPG::Item)\n return false if item_number(item) == 0\n if $game_temp.in_battle\n return item.battle_ok?\n else\n return item.menu_ok?\n end\n end",
"def item_usable?\r\n user.usable?(item) && item_effects_valid?\r\n end",
"de... | [
"0.7978117",
"0.77024597",
"0.7627014",
"0.74150056",
"0.74018663",
"0.73597866",
"0.71565336",
"0.71523213",
"0.7136992",
"0.7126884",
"0.7095826",
"0.7058597",
"0.7058597",
"0.698723",
"0.69752884",
"0.6974087",
"0.69637096",
"0.6956108",
"0.6952877",
"0.6947884",
"0.694512... | 0.0 | -1 |
PATCH/PUT /registrations/1 def update | def destroy
@registration.destroy
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @registry = @user.registries.find(params[:id])\n\n respond_to do |format|\n # if @registry.update_attributes(params[:registry])\n if @registry.update_attributes(registry_params)\n flash[:notice] = 'Registry was successfully updated.'\n format.html { redirect_to([@user,@reg... | [
"0.7590363",
"0.74545544",
"0.74252903",
"0.73766696",
"0.73668617",
"0.7336266",
"0.7320099",
"0.7286998",
"0.72721595",
"0.72676134",
"0.7226982",
"0.7203648",
"0.7155437",
"0.7155437",
"0.7155437",
"0.7142781",
"0.71301234",
"0.71165985",
"0.70900065",
"0.70867825",
"0.708... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_registration
@registration = Registration.find_by_id(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def registration_params
params.require(:registration).permit(:team_id, :tournament_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
for use in request specs | def login_user
@user = FactoryBot.create(:user)
login_as @user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def set_request; end",
"def req\n \n end",
"def generate_request\... | [
"0.70857376",
"0.70857376",
"0.70857376",
"0.70857376",
"0.70857376",
"0.70857376",
"0.70857376",
"0.70857376",
"0.70857376",
"0.70857376",
"0.70857376",
"0.69741803",
"0.69614553",
"0.6789596",
"0.6768089",
"0.6768089",
"0.66366637",
"0.6613908",
"0.6486048",
"0.64464825",
"... | 0.0 | -1 |
for use in request specs | def login_admin
@admin = FactoryBot.create(:user)
@admin_role = FactoryBot.create(:role, name: 'Admin')
FactoryBot.create(:authority, :authorizable => @admin, :role => @admin_role)
login_as @admin
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def set_request; end",
"def req\n \n end",
"def generate_request\... | [
"0.70857376",
"0.70857376",
"0.70857376",
"0.70857376",
"0.70857376",
"0.70857376",
"0.70857376",
"0.70857376",
"0.70857376",
"0.70857376",
"0.70857376",
"0.69741803",
"0.69614553",
"0.6789596",
"0.6768089",
"0.6768089",
"0.66366637",
"0.6613908",
"0.6486048",
"0.64464825",
"... | 0.0 | -1 |
of the array. The original array should not be modified. Do not use the method Arrayrotate or Arrayrotate! for your implementation. | def rotate_array(list)
list[1..-1] + [list[0]]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotor_array\n @rotor_array\n end",
"def rotate_array(aArray, off_x, off_y, rel_angle, change_in_place=false)\r\n # - - - - - - - - - - - - - - - - - - - - -\r\nend",
"def rotate_array(arr)\n\narr_new = arr.clone\narr_new.push(arr_new[0]).shift\narr_new\nend",
"def rotate_without_changing(arr)... | [
"0.7169914",
"0.7148036",
"0.7085472",
"0.6993678",
"0.69712174",
"0.68547106",
"0.68547106",
"0.6839444",
"0.68049234",
"0.6803386",
"0.67955846",
"0.6777156",
"0.6757332",
"0.6749189",
"0.6747036",
"0.67245114",
"0.6722098",
"0.6712948",
"0.67075545",
"0.67019475",
"0.66825... | 0.0 | -1 |
=> true Write a method that rotates a string instead of an array. Do the same thing for integers. You may use rotate_array from inside your new method. | def rotate_string(string)
string[1..-1] + string[0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate_string(string)\n rotate_array(string.chars).join\nend",
"def rotate_string(string)\n rotate_array(string.chars).join\nend",
"def rotate_string(string)\n rotate_array(string.chars).join\nend",
"def rotate_string(string)\n rotate_array(string.chars).join\nend",
"def rotate_string(string)\n ro... | [
"0.7445441",
"0.7445441",
"0.7445441",
"0.7445441",
"0.7445441",
"0.74433476",
"0.74433476",
"0.74433476",
"0.74109817",
"0.7399655",
"0.7376985",
"0.736011",
"0.73549795",
"0.73426926",
"0.73214483",
"0.72535783",
"0.7210659",
"0.7154097",
"0.713646",
"0.71105194",
"0.699033... | 0.7180192 | 18 |
quickly checks the number of sequences in a FASTA file. | def _check_nseq(file)
`grep "^>" #{file} | wc -l`.to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_csfasta(fasta)\n # length is the total read lengh + 2\n # cat *.csfasta | perl -ne 'next if /^#/;$i++;if ($i%2==0) {print unless \n # length($_)==52} else {print unless /^>\\d+_\\d+\\_\\d+\\_(F|R)(3|5)(-P2)*\\n$/}'\n # | more\n length = get_bp_length(fasta) + 2\n i = 0\n output = \"\"\n F... | [
"0.6773879",
"0.6748264",
"0.6737756",
"0.66978073",
"0.6652456",
"0.6071283",
"0.58596843",
"0.5740403",
"0.573871",
"0.57083046",
"0.5689284",
"0.56383234",
"0.5602102",
"0.55379593",
"0.5536224",
"0.553529",
"0.5530622",
"0.55216026",
"0.55193526",
"0.55035776",
"0.5499467... | 0.76277065 | 0 |
this function check for duplicated entries in GenBank files (same LOCUS, different version and GI) and writes a new file that only uses the latest version of an entry, and writes discarded version into a file. | def _check_duplicates_gb(file)
info "* check duplicates: " + file
system "./check_duplicates_gb.pl " + file
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_duplicate_entries\n File.open(\"#{output_directory_path}unique_ucf_lists.txt\", \"w+\") { |file|\n file.puts File.readlines(single_bad_ucf_file).uniq\n }\n end",
"def parse_to_file(outdir)\n z_unique = File.new(outdir+\"_unique\", 'w')\n z_non_unique = File.new(outdir+\"_non_unique\"... | [
"0.6662116",
"0.6598776",
"0.6520463",
"0.6194306",
"0.57971865",
"0.5704656",
"0.5559956",
"0.5530341",
"0.55095136",
"0.5455146",
"0.5436777",
"0.542615",
"0.54235023",
"0.53222406",
"0.532071",
"0.52208936",
"0.51930654",
"0.51824415",
"0.5173027",
"0.5159866",
"0.51586604... | 0.53061146 | 15 |
I worked on this challenge with: . 1. Solution Write your comments on what each thing is doing. If you have difficulty, go into IRB and play with the methods. | def north_korean_cipher(coded_message)
input = coded_message.downcase.split("") # Turning every letter into a lower case letter and then splitting it into array
decoded_sentence = []
cipher = {"e" => "a", # This is technically a shift of four letters...Can you think of a way to automate this? Is a hash
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution4(input)\n end",
"def challenge; end",
"def isLucky(n)\r\nhalf1 = []\r\nhalf2 = []\r\nn_string = n.to_s\r\n\r\n\r\nfirsthalf = (n_string.length / 2) - 1\r\nsecondhalfstart = (n_string.length / 2)\r\nsecondhalfend = (n_string.length - 1)\r\n(0..firsthalf).each do |idx|\r\n half1 << n_string[idx]... | [
"0.63616985",
"0.63327914",
"0.6077544",
"0.6076458",
"0.6030394",
"0.60145515",
"0.60030353",
"0.5958903",
"0.59007025",
"0.5872656",
"0.58573216",
"0.5845021",
"0.5787851",
"0.5784521",
"0.5775948",
"0.5758388",
"0.5750638",
"0.574735",
"0.57425356",
"0.5711823",
"0.5700254... | 0.0 | -1 |
It should load a source file successfully, and it has a three codes. | def test_load
assert @conv.load
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_source\n # subclasses must implement this method\n puts \"verify_source - not overloaded. file=#{filename}\"\n end",
"def load_source!\n @source = load_file_contents\n end",
"def formatted_source_file_loader(result, source_file)\n template(\"source_file_loader\").result(binding... | [
"0.6520042",
"0.63760096",
"0.6358763",
"0.6347688",
"0.63176817",
"0.62000084",
"0.6197283",
"0.6085082",
"0.6081358",
"0.6069913",
"0.60575175",
"0.59790325",
"0.5940226",
"0.5853974",
"0.5850638",
"0.5850592",
"0.58427364",
"0.5816061",
"0.5816061",
"0.5802394",
"0.5798145... | 0.0 | -1 |
Get the intcode for the given input array | def generate_intcode(input)
# i is acting as "outer" counter, which is used to loop through the inputValues
i = 0
until i == input.length - 1
value = input[i]
# Stop here if the value is 99
if value == 99
break
end
# Let's start working!
opcode = input[i]
num1 = input[input[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interface_code(int_idx, idx)\n sprintf(\"0x%x\", (int_idx || idx)).downcase\n end",
"def code_to_key\n @code[0..2]\n end",
"def binary_array_to_number(arr)\n arr.join(\"\").to_i(2)\nend",
"def binary_array_to_number(arr)\n arr.join(\"\").to_i(2)\nend",
"def get_code_for(i)\n if i.is_a?(Str... | [
"0.6432294",
"0.6256477",
"0.62104994",
"0.62104994",
"0.6178023",
"0.6140191",
"0.6139122",
"0.6105192",
"0.6012976",
"0.60096353",
"0.5929252",
"0.592915",
"0.58791727",
"0.58791727",
"0.5829457",
"0.5825509",
"0.5807566",
"0.5800782",
"0.5781898",
"0.5769812",
"0.57672495"... | 0.610517 | 8 |
Ensures the script is working as expected | def test
puts "Performing test tasks:"
puts "Test 1 " + (generate_intcode([1, 0, 0, 0, 99]) === [2, 0, 0, 0, 99] ? "succeeded": "failed") + "!"
puts "Test 2 " + (generate_intcode([2, 3, 0, 3, 99]) === [2, 3, 0, 6, 99] ? "succeeded": "failed") + "!"
puts "Test 3 " + (generate_intcode([2, 4, 4, 5, 99, 0]) === [... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def script; end",
"def script; end",
"def script\n\t\tputs \"You should extend script()\"\n\tend",
"def checks; end",
"def run\n raise \"Not implemented for this check.\"\n end",
"def precheck\n end",
"def validate_release \n if !system(\"origen examples\") #|| !system(\"origen specs\") \n ... | [
"0.64514494",
"0.64514494",
"0.6115834",
"0.6110651",
"0.6102198",
"0.6037402",
"0.599461",
"0.5938131",
"0.58511156",
"0.5850504",
"0.58234996",
"0.580333",
"0.5796429",
"0.57632726",
"0.5756194",
"0.57411367",
"0.57411367",
"0.57411367",
"0.57411367",
"0.57411367",
"0.57411... | 0.0 | -1 |
Reset the input data to its original state | def reset_memory
i = 0
for value in @original_values
@input_values[i] = @original_values[i]
i = i + 1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset\n @data = nil\n end",
"def reset\n ::Fiveruns::Dash.sync { @data = blank_data }\n end",
"def reset!\n self.user_values = {}\n\n # @inputs have to be nil, not an empty hash. otherwise\n # the memoized inputs will not pick up the changes.\n @inputs = nil\n end",
"def rese... | [
"0.81686896",
"0.7520381",
"0.72966367",
"0.7289637",
"0.7210736",
"0.7130823",
"0.7127011",
"0.7116774",
"0.7116774",
"0.71047604",
"0.7085164",
"0.70849437",
"0.70701796",
"0.70700777",
"0.7054431",
"0.7052605",
"0.7052605",
"0.7050924",
"0.7037215",
"0.7037215",
"0.7037215... | 0.650448 | 97 |
One in X chance to spawn a dragon per tick | def stats
{
'Living souls' => souls.where(alive: true).count,
'Dead souls' => souls.where(alive: false).count,
'Free souls' => players.sum(:free_souls),
'Players' => players.count,
'Rocks' => souls.where(alive: true, role: 'rock').count,
'Paper... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tick\n return if @pause\n\n @objects.each { |o| o.live if o.alive? }\n\n random_event(MONSTER_SPAWN_RATE * (1.1 ** @player.level)) { place_monster }\n random_event(FIRST_AID_DROP_RATE) { place_first_aid }\n end",
"def compute_damage\n rand(1..6)\n end",
"def touched_by bullet\n ([@width... | [
"0.6676161",
"0.6605174",
"0.6601093",
"0.6542334",
"0.65208066",
"0.6514545",
"0.6514545",
"0.64828175",
"0.6469511",
"0.6469511",
"0.64634085",
"0.6438785",
"0.6430709",
"0.64214194",
"0.6409536",
"0.638746",
"0.6369044",
"0.6313037",
"0.6298475",
"0.6269924",
"0.62503564",... | 0.0 | -1 |
Reload the queue data from the API | def queue_reload(queue)
raise NotImplementedError
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reload\n proxy_owner.queues(true)\n end",
"def reload\n reset\n fetch\n end",
"def reload\n reset\n fetch\n end",
"def refresh\n fetch_api_data\n self\n end",
"def reload_data\n self.class.new reinit_endpoint.do_get... | [
"0.75050575",
"0.6986017",
"0.6986017",
"0.69463676",
"0.67448676",
"0.66927177",
"0.66910833",
"0.66455877",
"0.65231866",
"0.64990914",
"0.64682555",
"0.64177835",
"0.6370899",
"0.63209075",
"0.6276226",
"0.62646836",
"0.6213685",
"0.6211698",
"0.6206876",
"0.6166801",
"0.6... | 0.7191393 | 1 |
Deliver message(s) to queue | def queue_deliver(queue, msg_or_msgs, options = {})
raise NotImplementedError
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deliver_messages\n ensure_threads_running!\n\n @queue << [:deliver_messages, nil]\n\n nil\n end",
"def deliver_to_queue\n @deliver_to_queue\n end",
"def deliver(message)\n @queue.push(message)\n end",
"def put_messages()\n #\n for i in 1..@max_msgs do\n... | [
"0.81748694",
"0.7678975",
"0.7469648",
"0.7132354",
"0.70398736",
"0.70381624",
"0.7025444",
"0.6626465",
"0.6607106",
"0.66027224",
"0.6558327",
"0.65466607",
"0.65451986",
"0.65404147",
"0.6535707",
"0.648556",
"0.64291495",
"0.6425577",
"0.640444",
"0.64010537",
"0.638756... | 0.6775302 | 7 |
Receive message(s) from queue | def queue_receive(queue, options = {})
raise NotImplementedError
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def receive\n raise \"No subscription to receive messages from\" if (@queue_names.nil? || @queue_names.empty?)\n start = @current_queue\n while true\n @current_queue = ((@current_queue < @queue_names.length-1) ? @current_queue + 1 : 0)\n sleep(@connection_options[:p... | [
"0.7709131",
"0.7654331",
"0.7619116",
"0.7500831",
"0.740826",
"0.72659534",
"0.72526044",
"0.71502185",
"0.71398234",
"0.7091747",
"0.70868975",
"0.70512223",
"0.6956682",
"0.6951703",
"0.69217825",
"0.6858873",
"0.68434775",
"0.67959946",
"0.6787479",
"0.6767381",
"0.67415... | 0.7008475 | 12 |
GET /group_events/1 GET /group_events/1.json | def show
@group_event = GroupEvent.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @group_event }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_events\n @group = Group.find(params[:groupId])\n @events = @group.events\n render \"api/events/group_events\"\n end",
"def show\n @group_event = GroupEvent.find params[:id]\n\n respond_to do |format|\n format.html { render :new }\n format.json { render json: @gro... | [
"0.80241066",
"0.765057",
"0.7565883",
"0.75191414",
"0.7460062",
"0.7250219",
"0.70384324",
"0.6891694",
"0.6865325",
"0.684201",
"0.66902626",
"0.6683239",
"0.6681606",
"0.66657126",
"0.66411114",
"0.6636252",
"0.6619168",
"0.65985674",
"0.6559769",
"0.6559007",
"0.6551211"... | 0.7781068 | 1 |
GET /group_events/new GET /group_events/new.json | def new
@group_event = GroupEvent.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @group_event }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n # @event is already loaded and authorized\n # @event = Event.new\n\n @groups = Group.all\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def new\n @project = Project.find(params[:project_id])\n @eventgroup = Eventgroup.new\n\n respond_to do |format|\... | [
"0.8103309",
"0.78407645",
"0.7827552",
"0.7689381",
"0.7613538",
"0.75516194",
"0.7518192",
"0.7502578",
"0.74775004",
"0.74775004",
"0.74775004",
"0.74775004",
"0.74775004",
"0.74775004",
"0.74775004",
"0.74775004",
"0.74775004",
"0.74775004",
"0.74775004",
"0.74775004",
"0... | 0.8493943 | 0 |
POST /group_events POST /group_events.json | def create
@group_event = GroupEvent.new(params[:group_event])
respond_to do |format|
if @group_event.save
format.html { redirect_to @group_event, notice: 'Groups event was successfully created.' }
format.json { render json: @group_event, status: :created, location: @group_event }
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @group_event = GroupEvent.new(group_event_params)\n\n respond_to do |format|\n if @group_event.save\n format.html { redirect_to @group_event, notice: 'Group event was successfully created.' }\n format.json { render :show, status: :created, location: @group_event }\n else\... | [
"0.7679999",
"0.7596514",
"0.73429585",
"0.7249151",
"0.71680295",
"0.71391046",
"0.70267564",
"0.67507607",
"0.6727875",
"0.6668374",
"0.6651771",
"0.66348547",
"0.66257167",
"0.66139084",
"0.65420526",
"0.6526086",
"0.6508799",
"0.64960104",
"0.64747274",
"0.646939",
"0.646... | 0.76607907 | 1 |
PUT /group_events/1 PUT /group_events/1.json | def update
@group_event = GroupEvent.find(params[:id])
respond_to do |format|
if @group_event.update_attributes(params[:group_event])
format.html { redirect_to @group_event, notice: 'Groups event was successfully updated.' }
format.json { head :no_content }
else
format.html ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @group_event.update(group_event_params)\n format.html { redirect_to @group_event, notice: 'Group event was successfully updated.' }\n format.json { render :show, status: :ok, location: @group_event }\n else\n format.html { render :edit }\n ... | [
"0.75302017",
"0.74790317",
"0.7444699",
"0.7426817",
"0.72747546",
"0.72540206",
"0.7238629",
"0.7180131",
"0.71115637",
"0.71115637",
"0.7085577",
"0.7063498",
"0.69301784",
"0.69203466",
"0.6906264",
"0.6852495",
"0.6843988",
"0.6822513",
"0.6762412",
"0.6736692",
"0.67202... | 0.75651586 | 0 |
DELETE /group_events/1 DELETE /group_events/1.json | def destroy
@group_event = GroupEvent.find(params[:id])
@group_event.destroy
respond_to do |format|
format.html { redirect_to groups_events_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @group_event.destroy\n respond_to do |format|\n format.html { redirect_to group_events_url }\n format.json { head :no_content }\n end\n end",
"def delete\n # @group_event.destroy\n @group_event = GroupEvent.find params[:id]\n\n @group_event.deleted = true\n @group_ev... | [
"0.7901338",
"0.77415466",
"0.7715437",
"0.76894045",
"0.76678026",
"0.7603119",
"0.74654275",
"0.72576827",
"0.7235068",
"0.72151923",
"0.72151923",
"0.72151923",
"0.7185575",
"0.7118383",
"0.7085966",
"0.7085571",
"0.7056731",
"0.70497686",
"0.70396245",
"0.703608",
"0.7018... | 0.79314476 | 0 |
Write a method `some?` that accepts an array and a block as arguments. The method should return a boolean indicating whether or not at least one of the elements of the array returns true when given to the block. Solve this using Arrayeach. | def some?(array, &prc)
array.each do |ele|
return true if prc.call(ele)
end
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def some?(arr, &blk)\n #arr.any? { |el| blk.call(el) }\n arr.each do |el| \n if blk.call(el)\n return true\n end\n end\n return false\nend",
"def some?(arr, &prc)\n arr.each { |el| return true if prc.call(el)}\n false\nend",
"def any?(array)\n array.each do |item|\n c... | [
"0.8666028",
"0.8117945",
"0.8071637",
"0.80268866",
"0.8025515",
"0.79678553",
"0.79678553",
"0.7856417",
"0.7844184",
"0.78344965",
"0.7521566",
"0.7487945",
"0.74801147",
"0.74789035",
"0.7464016",
"0.74581635",
"0.741904",
"0.7352739",
"0.7313714",
"0.73128223",
"0.730942... | 0.8301251 | 1 |
Write a method exactly? that accepts an array, a number (n), and a block as arguments. The method should return a boolean indicating whether or not there are exactly n elements that return true when given to the block. Solve this using Arrayeach. | def exactly?(arr, num, &prc)
count = 0
arr.each do |ele|
count += 1 if prc.call(ele)
end
count == num
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exactly?(arr, n , &prc)\n count = 0\n arr.each do |ele|\n count += 1 if prc.call(ele)\n end\n return true if n == count\n false\nend",
"def exactly?(arr, n, &blck)\n # n == arr.count { |el| blck.call(el) }\n counter = 0\n arr.each do |el|\n counter += 1 if blck.call(el)\n end... | [
"0.7966653",
"0.7921985",
"0.79105496",
"0.7709544",
"0.7673712",
"0.75601226",
"0.73847646",
"0.68880475",
"0.6810316",
"0.677986",
"0.674103",
"0.66859037",
"0.66476494",
"0.66247183",
"0.6617334",
"0.65398407",
"0.6509388",
"0.6502105",
"0.6497853",
"0.6454565",
"0.6427744... | 0.71358323 | 7 |
When called any future changes to the mode will be ignored | def freeze
@frozen = true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore_mode; end",
"def restore_mode; end",
"def fake_mode!\n switch_mode!(:fake)\n end",
"def mode() end",
"def mode; end",
"def mode; end",
"def mode; end",
"def mode; end",
"def set_mode(new)\n @mode = new\n end",
"def in_mode(mode)\n\t\t@mode = mode\n\t\tself\n\tend",... | [
"0.7701778",
"0.7701778",
"0.72092366",
"0.7107078",
"0.70919037",
"0.70919037",
"0.70919037",
"0.70919037",
"0.7089422",
"0.7059185",
"0.70377386",
"0.7037325",
"0.6954008",
"0.695375",
"0.69486505",
"0.68913966",
"0.686806",
"0.686806",
"0.6842375",
"0.68075114",
"0.6751014... | 0.0 | -1 |
Any mode which is not production will return true here, if you want to test for only debug mode use Origen.mode == :debug | def debug?
!production?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test?\n !production?\n end",
"def dev_or_test?\n development? || test?\n end",
"def development?\n !production?\n end",
"def development_mode?\n RAILS_ENV == 'development'\n end",
"def prod?\n !(Rails.env.development? || Rails.env.test?)\nend",
"def production?\n self.envi... | [
"0.77684164",
"0.77113765",
"0.76971084",
"0.7687626",
"0.7665379",
"0.7569987",
"0.7565946",
"0.75447965",
"0.74290025",
"0.74250954",
"0.7424641",
"0.74224865",
"0.7417773",
"0.7392097",
"0.7391401",
"0.7390356",
"0.7375685",
"0.73686266",
"0.73434746",
"0.7338907",
"0.7300... | 0.79221344 | 0 |
Deletes a product and all its associated sales | def destroy
product = Product.find(params[:id])
product.sales.each do |sale|
sale.destroy
end
product.delete
redirect_to controller: "products", action: "index"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n for product_sale in @sale.product_sale\n product_sale.destroy\n end\n @sale.destroy\n respond_to do |format|\n format.html { redirect_to sales_url, notice: \"Venda apagada com sucesso.\" }\n format.json { head :no_content }\n end\n end",
"def delete\n self.class.... | [
"0.73852646",
"0.7221845",
"0.7189175",
"0.7181479",
"0.7067997",
"0.70340264",
"0.6994277",
"0.6961843",
"0.6958522",
"0.6905979",
"0.6809742",
"0.6781888",
"0.6773053",
"0.6722831",
"0.67064935",
"0.6694609",
"0.6694609",
"0.66892505",
"0.66834545",
"0.6661602",
"0.6661488"... | 0.8084911 | 0 |
Only works for Android | def prepare_predefined_message(device_type)
{ default: 'Push' }.merge(
PushJsonBuilder.send(device_type.to_sym, message, data, n_type)
).to_json
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ios; end",
"def private; end",
"def user_os_complex\r\n end",
"def platform; end",
"def platform; end",
"def platform; end",
"def detect; end",
"def get_screen_size\r\n #obtenemos el tamaño de la ventana\r\n data_size_device = adb_exec(\"shell wm size\")\r\n size = Array.new\r\n size_device ... | [
"0.599193",
"0.5884829",
"0.535867",
"0.53190386",
"0.53190386",
"0.53190386",
"0.52731746",
"0.52006304",
"0.51772493",
"0.51652604",
"0.51652604",
"0.5137421",
"0.5132534",
"0.5132534",
"0.51315904",
"0.5107134",
"0.5086548",
"0.50855577",
"0.50855577",
"0.50610805",
"0.503... | 0.0 | -1 |
verfies if the chef credentials are correct, and if so creates the session for the chef | def create
chef = Chef.find_by(email: params[:email])
if chef && chef.authenticate(params[:password])
session[:chef] = chef.id
flash[:success] = "You login successfully"
redirect_to recipes_path
else
flash.now[:danger] = "Your email address or password does not match"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_credentials\n\n cmd = @config[:path] + @command_line_tool + \" \" + @@login_command\n\n Open3.popen3( cmd ) { |input, output, error|\n input.puts @config[:url]\n input.puts @config[:user]\n input.puts @config[:password]\n input.close\n } ... | [
"0.6486138",
"0.6328864",
"0.6191166",
"0.61513114",
"0.60165423",
"0.5864104",
"0.5848903",
"0.57893854",
"0.57573545",
"0.57374465",
"0.57255256",
"0.5719872",
"0.5686508",
"0.5659502",
"0.5655227",
"0.562922",
"0.5616078",
"0.5591484",
"0.55808705",
"0.5567919",
"0.5558755... | 0.6630966 | 0 |
destroy the current chef session | def destroy
session[:chef] = nil
flash[:success] = "You have logged out"
redirect_to root_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @session.clear\n end",
"def teardown\n nodes.each do |k,v|\n storage = RSpec.configuration.rs_storage[:nodes][k]\n\n next if storage.nil?\n\n ssh = storage[:ssh]\n ssh.close unless ssh.closed?\n end\n\n if destroy\n output << bold(color(\"localh... | [
"0.68906057",
"0.66458625",
"0.664138",
"0.66342205",
"0.66295874",
"0.66248715",
"0.6618118",
"0.6606686",
"0.65903324",
"0.65513486",
"0.65419227",
"0.6531353",
"0.6507052",
"0.6494292",
"0.64756906",
"0.64738023",
"0.6468613",
"0.64543694",
"0.6454006",
"0.6444523",
"0.644... | 0.72968316 | 0 |
GET /allies GET /allies.json | def index
@ally = Ally.first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @allies = Ally.all\n end",
"def index\n @alleys = Alley.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @alleys }\n end\n end",
"def loans\n url = \"#{LOANS_PATH}/pre-approved\"\n data = perform_get(url)\n ... | [
"0.7377413",
"0.6335594",
"0.60706735",
"0.6061048",
"0.6027263",
"0.6018956",
"0.5971805",
"0.5970696",
"0.59599847",
"0.59104717",
"0.585148",
"0.5822175",
"0.576764",
"0.57561123",
"0.57534194",
"0.57500976",
"0.57440186",
"0.57440186",
"0.57416385",
"0.57346",
"0.5730164"... | 0.5919443 | 9 |
GET /allies/1 GET /allies/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @allies = Ally.all\n end",
"def index\n @alleys = Alley.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @alleys }\n end\n end",
"def index\n @ally = Ally.first\n end",
"def show\n render json: Alien.find(params[\"id\"])\n ... | [
"0.72834235",
"0.66734535",
"0.6590745",
"0.63700986",
"0.63148636",
"0.62051016",
"0.61788",
"0.6175424",
"0.6175424",
"0.6170888",
"0.6155573",
"0.6140477",
"0.61363494",
"0.6101029",
"0.60812",
"0.6072605",
"0.60662967",
"0.6051712",
"0.60163206",
"0.59971815",
"0.59824157... | 0.0 | -1 |
POST /allies POST /allies.json | def create
@ally = Ally.new(ally_params)
respond_to do |format|
if @ally.save
format.html { redirect_to @ally, notice: 'Ally was successfully created.' }
format.json { render :show, status: :created, location: @ally }
else
format.html { render :new }
format.json { re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @ally = Ally.new(ally_params)\n\n respond_to do |format|\n if @ally.save\n format.html { redirect_to edit_ally_path(@ally), notice: 'Ally was successfully created.' }\n format.json { render :show, status: :created, location: @ally }\n else\n format.html { render :n... | [
"0.63075763",
"0.58432996",
"0.5754824",
"0.5683591",
"0.56811523",
"0.55975926",
"0.55176574",
"0.5486811",
"0.54329574",
"0.54120034",
"0.54031694",
"0.53916734",
"0.5367237",
"0.5359652",
"0.53512686",
"0.53072566",
"0.53072566",
"0.5292635",
"0.52681416",
"0.52634346",
"0... | 0.6427394 | 0 |
PATCH/PUT /allies/1 PATCH/PUT /allies/1.json | def update
respond_to do |format|
if @ally.update(ally_params)
format.html { redirect_to allies_url, notice: 'Ally was successfully updated.' }
format.json { render :show, status: :ok, location: @ally }
else
format.html { render :edit }
format.json { render json: @ally.er... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @ally.update(ally_params)\n format.html { redirect_to edit_ally_path(@ally), notice: 'Ally was successfully updated.' }\n format.json { render :show, status: :ok, location: @ally }\n else\n format.html { render :edit }\n format.json ... | [
"0.6704874",
"0.65532273",
"0.6433141",
"0.6364384",
"0.63487697",
"0.6322341",
"0.63139015",
"0.6298754",
"0.6288112",
"0.62302405",
"0.6219846",
"0.62185335",
"0.6185697",
"0.61626214",
"0.6157883",
"0.6157259",
"0.6151061",
"0.6147401",
"0.611977",
"0.60943025",
"0.6089664... | 0.6947252 | 0 |
DELETE /allies/1 DELETE /allies/1.json | def destroy
@ally.destroy
respond_to do |format|
format.html { redirect_to allies_url, notice: 'Ally was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @alley.destroy\n\n respond_to do |format|\n format.html { redirect_to alleys_url }\n format.json { head :no_content }\n end\n end",
"def delete_aos_ver... | [
"0.71540874",
"0.6976886",
"0.68888336",
"0.6767737",
"0.660522",
"0.66036284",
"0.6601783",
"0.6584467",
"0.65769106",
"0.657447",
"0.657145",
"0.6570525",
"0.656179",
"0.6555793",
"0.65305203",
"0.6522099",
"0.6513678",
"0.65122145",
"0.6509777",
"0.6497504",
"0.6483995",
... | 0.73565495 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_ally
@ally = Ally.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def ally_params
params.require(:ally).permit(:title, :description, :t1, :t2, :t3, :t4, :t5, :f1, :f2, :f3, :f4, :f5, :f6, :c1, :c2, :c3, :c4, :c5)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.629117... | 0.0 | -1 |
Get formatter class Author: Aman Date: Reviewed By: | def get_formatter_class
Formatter::V0::Customer
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def formatter; end",
"def formatter; end",
"def formatter; end",
"def formatter\n @formatter ||= HumanFormatter.new\n end",
"def formatters; end",
"def formatter()\n @formatter\n end",
"def formatter\n @formatter.formatter\n end",
"def formatter\n raise NotImplementedError\... | [
"0.70167553",
"0.70167553",
"0.70167553",
"0.67857873",
"0.67292255",
"0.6724553",
"0.67060304",
"0.66690207",
"0.6640879",
"0.6513238",
"0.64485484",
"0.63794017",
"0.63794017",
"0.6370423",
"0.6370423",
"0.6370423",
"0.6350604",
"0.63155454",
"0.63155454",
"0.63155454",
"0.... | 0.6805542 | 3 |
Max number photos per product | def photos_per_product
@photos_per_product ||= -1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_photos\n if photos.size > MAX_PHOTO\n errors.add(:photos, :too_many)\n end\n end",
"def max_image_count\n return nil if !@options\n if @options[:maximum_amount_of_images].blank?\n image_count = @options[:max_images]\n else\n image_count = @options[:maxim... | [
"0.7436993",
"0.67809224",
"0.6205897",
"0.61496127",
"0.6129836",
"0.61226887",
"0.60320395",
"0.5999116",
"0.5956428",
"0.59330726",
"0.59257334",
"0.5911861",
"0.5896144",
"0.58770007",
"0.58655864",
"0.58655095",
"0.5843805",
"0.5837803",
"0.58185524",
"0.5805386",
"0.577... | 0.793286 | 0 |
Return response on success or log failure and throw error. | def send(data, authorization)
@authorization = authorization
request.body = data if data
response = super(data)
fail_unless_expected_response response, Net::HTTPSuccess
response.body
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def response!\n return response if !response.errors?\n\n raise response.to_exception\n end",
"def error(output)\n respond_with(Response::Failure, output)\n end",
"def error(output)\n respond_with(Response::Failure, output)\n end",
"def failure\n {:response=>:failure}\n ... | [
"0.6829511",
"0.6671473",
"0.6671473",
"0.64184064",
"0.63992023",
"0.6385448",
"0.63760597",
"0.6341254",
"0.61564916",
"0.61501855",
"0.6145061",
"0.6140894",
"0.61275494",
"0.61178625",
"0.60231185",
"0.59907186",
"0.59892803",
"0.59594476",
"0.595286",
"0.5939012",
"0.593... | 0.0 | -1 |
Convert to a Resource::Form::Field, expanding any dynamic values | def to_resource(mapper)
Resource::Form::Field.new(
resource_attributes.each_with_object({}) do |attr, attrs|
attrs[attr] = mapper.expand_value(public_send(attr))
end.merge(options: options.map(&:to_resource))
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dynamic_form_fields(builder)\n # Allow dynamic fields in our Project to be processed by form_for\n create_virtual_attributes!\n\n @object.fields.each do |field|\n h.haml_concat process_field(builder, field)\n end\n end",
"def create_single_complex_registry_field(form,\n ... | [
"0.6685056",
"0.65621877",
"0.64673835",
"0.62359196",
"0.6214556",
"0.6112908",
"0.6081503",
"0.6069746",
"0.6048605",
"0.5984171",
"0.59796184",
"0.5930724",
"0.5925825",
"0.5908552",
"0.59075874",
"0.58910847",
"0.5830115",
"0.5826999",
"0.58156323",
"0.58096975",
"0.57969... | 0.6764398 | 0 |
All attributes that can be converted 1to1 to Resource::Form::Field | def resource_attributes
self.class.attributes.names - [:options]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multivalued_form_attributes(attributes)\n attributes.select { |_, v| v.respond_to?(:select) && !v.respond_to?(:read) }\n end",
"def multivalued_form_attributes(attributes)\n attributes.select { |_, v| v.respond_to?(:select) && !v.respond_to?(:read) }\n end",
"def form_attrib... | [
"0.65806216",
"0.65806216",
"0.65606725",
"0.6475033",
"0.64082074",
"0.6243902",
"0.61920553",
"0.61708575",
"0.61661",
"0.61319196",
"0.61225784",
"0.60891527",
"0.6082242",
"0.6059658",
"0.6059658",
"0.60544187",
"0.60544187",
"0.60323596",
"0.60323596",
"0.60323596",
"0.6... | 0.0 | -1 |
Given "I am interacting with an Environment" do | def setup_initial_state
state_a = State.new("a", 0)
state_b = State.new("b", 0)
state_c = State.new("c", 10)
move_to_b = Action.new("move_to_b", 1, state_b)
move_to_c = Action.new("move_to_c", 1, state_c)
state_a.actions = [move_to_b, move_to_c]
return state_a
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def environment(environment); end",
"def setup_environment; end",
"def test_env env=nil, nsteps=100\n env ||= gym.make('CartPole-v1')\n env.reset\n env.render\n nsteps.times do |i|\n act = env.action_space.sample\n env.step(act)\n env.render\n end\n env.reset\... | [
"0.61434287",
"0.60546726",
"0.60326916",
"0.5796487",
"0.5721561",
"0.56885374",
"0.56234974",
"0.553684",
"0.5490687",
"0.54503053",
"0.5449745",
"0.5448271",
"0.5424521",
"0.5420484",
"0.5414461",
"0.5403298",
"0.5403298",
"0.54031783",
"0.5402932",
"0.539488",
"0.5383369"... | 0.0 | -1 |
Return the Facebook version | def version
self.to_s[FACEBOOK_VERSION_REGEXP, 1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def facebook?(expected_version = nil)\n Facebook.new(ua).match? &&\n detect_version?(full_version, expected_version)\n end",
"def version\n return call('Bugzilla.version')\n end",
"def version\n ret = @client.call('Bugzilla.version')\n handle_faults(ret)\n ret['version']\n... | [
"0.72599304",
"0.6720109",
"0.6686488",
"0.66067344",
"0.65457964",
"0.65337044",
"0.6526061",
"0.65111935",
"0.65111935",
"0.651072",
"0.64968884",
"0.64968884",
"0.64968884",
"0.64968884",
"0.64968884",
"0.64968884",
"0.64968884",
"0.64968884",
"0.64968884",
"0.6487425",
"0... | 0.84048367 | 0 |
allow_events! (mode, time) grab_server! () ungrab_server! () query_pointer! (window) get_motion_events! (window, start, stop) translate_coordinates! (src_window, dst_window, src_x, src_y) warp_pointer! (src_window, dst_window, src_x, src_y, src_width, src_height, dst_x, dst_y) | def set_input_focus! (focus, time = 0, revert_to: INPUT_FOCUS_POINTER_ROOT)
super(revert_to, focus, time)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_events\n # When the left mouse button is clicked (as defined below in\n # setup_actors) call the teleport method in @lobo\n @cursor1.on(:click) do |x,y|\n @lobo.teleport(x,y)\n end\n # When the space bar is pressed (see below in setup_actors) call\n # the teleport method in @lobo\n... | [
"0.5891593",
"0.5863121",
"0.567796",
"0.55501306",
"0.5532346",
"0.5494091",
"0.53561187",
"0.5352564",
"0.5324694",
"0.53205687",
"0.52952325",
"0.5274159",
"0.52698416",
"0.525123",
"0.52423865",
"0.52283263",
"0.522625",
"0.5195219",
"0.51890254",
"0.51887697",
"0.5163961... | 0.0 | -1 |
get_input_focus! () query_keymap! () open_font! (fid, name) close_font! (font) query_font! (font) query_text_extents! (font, string) list_fonts! (max_names, pattern) list_fonts_with_info! (max_names, pattern) set_font_path! (font) get_font_path! () create_pixmap! (depth, pid, drawable, width, height) free_pixmap! (pixm... | def create_gc! (cid, drawable, **hash)
super(cid, drawable, *value_param(GC, hash))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_font\n self.contents.font.name = @window.fontName\n #self.recalculate_maxlength\n self.refresh\n end",
"def init_font(font)\n @font=font\n dc = Wx::WindowDC.new(self)\n dc.set_font(font)\n @asc_width, asc_h = dc.get_text_extent(\"@\")[0,2]\n @asc_width+2 # compact, b... | [
"0.6306647",
"0.62634563",
"0.5865191",
"0.5852404",
"0.5847278",
"0.5835672",
"0.5833917",
"0.57960546",
"0.5772435",
"0.5769602",
"0.57568944",
"0.5754979",
"0.5754651",
"0.57119966",
"0.5657605",
"0.5586949",
"0.55665094",
"0.5549555",
"0.55314976",
"0.5526222",
"0.5510849... | 0.0 | -1 |
copy_gc! (src_gc, dst_gc, value_mask) set_dashes! (gc, dash_offset, dashes) set_clip_rectangles! (ordering, gc, clip_x_origin, clip_y_origin, rectangles) free_gc! (gc) clear_area! (exposures, window, x, y, width, height) copy_area! (src_drawable, dst_drawable, gc, src_x, src_y, dst_x, dst_y, width, height) copy_plane! ... | def change_keyboard_control! (**hash)
super(*value_param(KB, hash))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test04()\n begin\n origModes = \"kCGBlendModeNormal kCGBlendModeMultiply kCGBlendModeScreen \"+\n \"kCGBlendModeOverlay kCGBlendModeDarken kCGBlendModeLighten \" + \n \"kCGBlendModeColorDodge kCGBlendModeColorBurn kCGBlendModeSoftLight \" +\n \"kCGBlendModeHardLight kCGBlendModeDifference kCGBlend... | [
"0.70742005",
"0.6288944",
"0.5984637",
"0.58436257",
"0.5782313",
"0.57543683",
"0.5753239",
"0.56850123",
"0.5644611",
"0.5644177",
"0.56249076",
"0.560291",
"0.5577521",
"0.5549388",
"0.55440325",
"0.5543117",
"0.5540257",
"0.5528169",
"0.5527765",
"0.5520447",
"0.55076677... | 0.0 | -1 |
get_keyboard_control! () bell! (percent) change_pointer_control! (acceleration_numerator, acceleration_denominator, threshold, do_acceleration, do_threshold) get_pointer_control! () set_screen_saver! (timeout, interval, prefer_blanking, allow_exposures) get_screen_saver! () change_hosts! (mode, family, address) list_ho... | def decode_configure_request_event (s)
e = super(s)
m = e[:value_mask]
e.delete(:x) if m & CONFIG_WINDOW_X == 0
e.delete(:y) if m & CONFIG_WINDOW_Y == 0
e.delete(:width) if m & CONFIG_WINDOW_WIDTH == 0
e.delete(:height) if m & CONFIG_WINDOW_HEIGHT == 0
e.delete(:b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_accelerators\n @window.signal_connect \"key_press_event\" do |widget, event|\n ctrl = Gdk::Window::ModifierType::CONTROL_MASK == event.state\n g = Gdk::Keyval\n k = Gdk::Keyval.to_lower(event.keyval)\n\n # Nerd Shortcuts\n # This is used to provide an alternative to the arrow k... | [
"0.6646868",
"0.6354185",
"0.63486415",
"0.6334627",
"0.632405",
"0.6209038",
"0.6103185",
"0.6100974",
"0.6084217",
"0.606573",
"0.60657",
"0.6057704",
"0.6035861",
"0.6035064",
"0.6035064",
"0.5989509",
"0.5989155",
"0.596889",
"0.5933315",
"0.5925678",
"0.5910877",
"0.58... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.