query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
before_filter :check, :only=>[:create] crudify :'refinery/ships/ship', :xhr_paging => true before_filter :all_collections, :only=>[:new, :edit] | def index
if client_signed_in?
@ships = Refinery::Ships::Ship.includes(:translations, :page_status).where(:client_id=>current_client.id).order('updated_at DESC')
@all = @ships
@moderate = @ships.select{|ship| ship.page_status.id == 1}
@publishe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:company_id] == nil\n render status: 422, json: {errors: ['company_id is required']}\n else\n @shipments = filter(params)\n @shipments = sort_accordingly_to_params(params, @shipments)\n @shipments = make_pagination(params, @shipments)\n ... | [
"0.594476",
"0.59187573",
"0.58799136",
"0.5827994",
"0.5777794",
"0.5753862",
"0.5714483",
"0.5603547",
"0.55215657",
"0.55150557",
"0.55035037",
"0.54972976",
"0.54972976",
"0.5497178",
"0.5485776",
"0.5481498",
"0.54684716",
"0.54476863",
"0.5432035",
"0.54228103",
"0.5413... | 0.6284054 | 0 |
Here we verify if a preference is true. | def test_should_verify_if_is_true
a_preference = preferences(:store_use_inventory_control)
assert a_preference.is_true?
a_preference = preferences(:store_require_login)
assert !a_preference.is_true?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_pref?(preference)\n !prefs[preference].to_s.empty?\nend",
"def pref?\n type? 'PREF'\n end",
"def prescriptively_ok?\n acceptance & PRESCRIPTIVE == PRESCRIPTIVE\n end",
"def has_dietary_preferences?\n return self.dietary_preference.present?\n end",
"def display_checked?(_prefere... | [
"0.7398408",
"0.7188429",
"0.694314",
"0.6846657",
"0.6842776",
"0.64817506",
"0.6453544",
"0.6366312",
"0.63659054",
"0.62658584",
"0.6238055",
"0.61952966",
"0.6189725",
"0.6163909",
"0.6163411",
"0.61403745",
"0.61381257",
"0.6134576",
"0.61083555",
"0.6105409",
"0.610343"... | 0.7983518 | 0 |
GET /draft_lists/new GET /draft_lists/new.xml | def new
@draft_list = DraftList.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @draft_list }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @draft = SmsOnRails::Draft.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @draft }\n end\n end",
"def new\n @draft = @compare.drafts.build \n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml... | [
"0.69568026",
"0.6762843",
"0.67102605",
"0.670306",
"0.66820025",
"0.6679832",
"0.66745394",
"0.6630775",
"0.65615577",
"0.65440714",
"0.6540415",
"0.6540345",
"0.6521184",
"0.6509956",
"0.6496252",
"0.6495337",
"0.6472967",
"0.6470149",
"0.6447194",
"0.64383936",
"0.6425332... | 0.80648017 | 0 |
PUT /draft_lists/1 PUT /draft_lists/1.xml | def update
@draft_list = DraftList.find(params[:id])
respond_to do |format|
if @draft_list.update_attributes(params[:draft_list])
flash[:notice] = 'Draft list was successfully updated.'
format.html { redirect_to(draft_lists_path) }
format.xml { head :ok }
else
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_list(list_id, name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"patch\", \"lists/#{list_id}\", data)\n end",
"def update_list(id, list)\n record \"/todos/update_list/#{id}\", :list => list\n end",
"def update\n @list = List.find(params[:id])\n @show_list =... | [
"0.63704234",
"0.6353446",
"0.6287557",
"0.6285754",
"0.6237817",
"0.6230982",
"0.6184482",
"0.6094058",
"0.6075279",
"0.6065166",
"0.6065166",
"0.60512656",
"0.6043054",
"0.6038768",
"0.6019874",
"0.6018788",
"0.60174894",
"0.6013198",
"0.59993565",
"0.59912586",
"0.5988361"... | 0.765184 | 0 |
DELETE /draft_lists/1 DELETE /draft_lists/1.xml | def destroy
@draft_list = DraftList.find(params[:id])
errorMessage = ""
if !@draft_list.league_memberships.empty?
errorMessage += 'Cannot delete the list named ' + @draft_list.name +
' because it is being used by the following memberships: ' +
@dr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_list(list_id)\n rest(\"delete\", \"lists/#{list_id}\")\n\n return true\n end",
"def destroy\n @checklist = Checklist.find(params[:id])\n @checklist.destroy\n\n respond_to do |format|\n format.html { redirect_to(checklists_url) }\n format.xml { head :ok }\n end\n end",
... | [
"0.6686314",
"0.663948",
"0.66389483",
"0.65358526",
"0.6514827",
"0.6477018",
"0.6456549",
"0.64453",
"0.6440348",
"0.64037955",
"0.63965863",
"0.6386861",
"0.63488877",
"0.634262",
"0.6325674",
"0.6303573",
"0.6302348",
"0.630143",
"0.6289629",
"0.62745905",
"0.6265695",
... | 0.6921329 | 0 |
if target is _, returns false if we've guessed the word's char already if target is az, returns false if our word has a different char | def char_valid?(char, guesses, target)
if target == '_'
return !guesses.include?(char)
end
char == target
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_a_letter?(guess)\n return true if @word.include?(guess)\n return false\n end",
"def check_winner\n @word.downcase.chars == @guess\n end",
"def guessed?\n \t(word.split('') - selected_letters).empty?\n\tend",
"def win?\n if word_guessed.select{|x| x!=\"_ \"}.count == @word.length\n \t\t... | [
"0.7235492",
"0.71536624",
"0.70810634",
"0.70719945",
"0.6917247",
"0.6909202",
"0.68957025",
"0.6866008",
"0.6855387",
"0.6817434",
"0.68087834",
"0.68041897",
"0.67244977",
"0.6707401",
"0.666795",
"0.6667471",
"0.666238",
"0.6646481",
"0.66432536",
"0.66403455",
"0.662629... | 0.7721092 | 0 |
Create new connection between BeaconCtrl and BeaconClient New oauth token should be returned by server. | def connect!
@connection = user ? connection_for_user : connection_for_application
@auth_token = @connection.token
BeaconClient.logger.debug("Client token: #{@auth_token}") if BeaconClient.config.debug?
@auth_token
rescue OAuth2::Error => error
BeaconClient.logger.error(error.message)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def oauth2_client(token, params = {})\n @oauth2_client = RubyLokaliseApi::OAuth2Client.new token, params\n end",
"def init\n\t\tuser_credentials = {\n\t\t\t:access_token => access_token,\n\t\t\t:refresh_token => refresh_token,\n\t\t\t:expires_at => Time.now + expires_in\n\t\t}\n\n client_id = '694fc2f... | [
"0.6380972",
"0.62495327",
"0.6106842",
"0.6075413",
"0.6040838",
"0.594724",
"0.5946612",
"0.59366834",
"0.5933798",
"0.58959275",
"0.58607024",
"0.583236",
"0.58179176",
"0.5784521",
"0.5774283",
"0.5768779",
"0.5752608",
"0.57318664",
"0.5723591",
"0.5723143",
"0.57165766"... | 0.7369405 | 0 |
Connect as an User Require ApplicationID, ApplicationSecret, UserEmail, UserPassword | def connection_for_user
BeaconClient.logger.debug([user.email.inspect, user.password.inspect].join(' : '))
oauth_client.password.get_token(
user.email, user.password,
email: user.email
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login\n client.login(\n params[:user],\n params[:password],\n authParams: {\n scope: 'openid name email'\n },\n connection: 'Username-Password-Authentication'\n )\n end",
"def connect\n @user = User.where(:email => params[:user][:email]).first\n # If there is no u... | [
"0.64241004",
"0.6331916",
"0.62217134",
"0.6183177",
"0.61571425",
"0.6136779",
"0.61230576",
"0.6118697",
"0.611587",
"0.61028427",
"0.6061592",
"0.5996285",
"0.59956163",
"0.59897864",
"0.5960525",
"0.59489065",
"0.5941224",
"0.59311044",
"0.59311044",
"0.59311044",
"0.593... | 0.6625705 | 0 |
GET /time/time_reports GET /time/time_reports.json | def index
@time_time_reports = Time::TimeReport.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @time_report = TimeReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_report }\n end\n end",
"def index\n @timecharts = Timechart.find(:all, order: \"stop_time DESC\")\n\n respond_to do |format|\n format.h... | [
"0.7129789",
"0.6651742",
"0.6524392",
"0.6520537",
"0.64876735",
"0.6469547",
"0.64045674",
"0.6402486",
"0.63891643",
"0.637867",
"0.6360271",
"0.6352883",
"0.6333305",
"0.6322239",
"0.6311603",
"0.6298278",
"0.6296576",
"0.6294042",
"0.62818474",
"0.6249144",
"0.6238625",
... | 0.76245445 | 0 |
POST /time/time_reports POST /time/time_reports.json | def create
@time_time_report = Time::TimeReport.new(time_time_report_params)
respond_to do |format|
if @time_time_report.save
format.html { redirect_to @time_time_report, notice: 'Time report was successfully created.' }
format.json { render :show, status: :created, location: @time_time_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @time_report = TimeReport.new(params[:time_report])\n\n respond_to do |format|\n if @time_report.save\n format.html { redirect_to @time_report, notice: 'Time report was successfully created.' }\n format.json { render json: @time_report, status: :created, location: @time_report... | [
"0.70921266",
"0.6761054",
"0.64973444",
"0.6496163",
"0.62217873",
"0.62083626",
"0.61755913",
"0.6170444",
"0.61321265",
"0.59996265",
"0.59521925",
"0.5950501",
"0.591422",
"0.59066695",
"0.5901786",
"0.58856946",
"0.5881303",
"0.5850961",
"0.5844043",
"0.58260477",
"0.582... | 0.7346389 | 0 |
PATCH/PUT /time/time_reports/1 PATCH/PUT /time/time_reports/1.json | def update
respond_to do |format|
if @time_time_report.update(time_time_report_params)
format.html { redirect_to @time_time_report, notice: 'Time report was successfully updated.' }
format.json { render :show, status: :ok, location: @time_time_report }
else
format.html { render :... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @time_report = TimeReport.find(params[:id])\n\n respond_to do |format|\n if @time_report.update_attributes(params[:time_report])\n format.html { redirect_to @time_report, notice: 'Time report was successfully updated.' }\n format.json { head :no_content }\n else\n ... | [
"0.7290955",
"0.6576943",
"0.64213574",
"0.6377546",
"0.63269603",
"0.62979215",
"0.628985",
"0.6274075",
"0.62733537",
"0.6249891",
"0.6246424",
"0.6219413",
"0.62069434",
"0.62032944",
"0.6199899",
"0.6196775",
"0.61851215",
"0.6164271",
"0.61478305",
"0.61432433",
"0.61336... | 0.7261616 | 1 |
DELETE /time/time_reports/1 DELETE /time/time_reports/1.json | def destroy
@time_time_report.destroy
respond_to do |format|
format.html { redirect_to time_time_reports_url, notice: 'Time report was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @time_report = TimeReport.find(params[:id])\n @time_report.destroy\n\n respond_to do |format|\n format.html { redirect_to time_reports_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy!\n render json: {status: :ok}\n end",
"def des... | [
"0.772896",
"0.7103305",
"0.7072272",
"0.695569",
"0.6955369",
"0.69498515",
"0.6926362",
"0.6880567",
"0.68741995",
"0.6863329",
"0.6863329",
"0.68536603",
"0.68531406",
"0.68531406",
"0.68531406",
"0.67923605",
"0.6771732",
"0.67691076",
"0.67691076",
"0.67691076",
"0.67691... | 0.7533543 | 1 |
shims from Blacklight 6 controller fetch to BL 7 search service | def search_service
Blacklight::SearchService.new(config: blacklight_config, user_params: {})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_custom_search_params; end",
"def service\n :search\n end",
"def search(builder)\n send_and_receive connection_config[:url], builder.blacklight_params\n end",
"def search_implementation(args)\n\n # 'args' should be a normalized search arguments hash including the following eleme... | [
"0.6300988",
"0.6218276",
"0.616826",
"0.60939366",
"0.5896516",
"0.5875381",
"0.585296",
"0.5824424",
"0.57832783",
"0.5767981",
"0.5749384",
"0.5748537",
"0.5744475",
"0.570369",
"0.56970006",
"0.569167",
"0.56652063",
"0.5658615",
"0.5651207",
"0.56440043",
"0.56440043",
... | 0.68247706 | 0 |
:only=>[:edit, :index, :new, :show] GET /user_device_configurations GET /user_device_configurations.json | def index
@user_device_configurations = UserDeviceConfiguration.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @user_device_configurations }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @user_device_configuration = UserDeviceConfiguration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_device_configuration }\n end\n end",
"def new\n @user_device_configuration = UserDeviceConfiguration.new\n\n resp... | [
"0.77152336",
"0.68687224",
"0.6436471",
"0.64328855",
"0.625644",
"0.62446505",
"0.6229039",
"0.6210126",
"0.62084097",
"0.6168424",
"0.6168424",
"0.6134404",
"0.6129831",
"0.6116969",
"0.6111193",
"0.6098484",
"0.6050534",
"0.6049359",
"0.6025359",
"0.6021061",
"0.60040593"... | 0.7609758 | 1 |
GET /user_device_configurations/1 GET /user_device_configurations/1.json | def show
@user_device_configuration = UserDeviceConfiguration.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @user_device_configuration }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @user_device_configurations = UserDeviceConfiguration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_device_configurations }\n end\n end",
"def new\n @user_device_configuration = UserDeviceConfiguration.new\n\n respond_to do ... | [
"0.7492147",
"0.6698003",
"0.64019376",
"0.636954",
"0.6290901",
"0.62316716",
"0.6173154",
"0.60930663",
"0.6080835",
"0.60617256",
"0.6031278",
"0.5986048",
"0.59786606",
"0.5911146",
"0.58746797",
"0.58695865",
"0.5857259",
"0.5846473",
"0.5846473",
"0.5844806",
"0.5790104... | 0.7543941 | 0 |
GET /user_device_configurations/new GET /user_device_configurations/new.json | def new
@user_device_configuration = UserDeviceConfiguration.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @user_device_configuration }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @user_device_configuration = UserDeviceConfiguration.new(params[:user_device_configuration])\n\n respond_to do |format|\n if @user_device_configuration.save\n format.html { redirect_to @user_device_configuration, notice: 'User device configuration was successfully created.' }\n ... | [
"0.7416002",
"0.6693734",
"0.6640873",
"0.66044855",
"0.6557954",
"0.6548632",
"0.648198",
"0.642695",
"0.64139533",
"0.64139533",
"0.64139533",
"0.6399564",
"0.63916725",
"0.639119",
"0.6353396",
"0.63454413",
"0.63220626",
"0.6315711",
"0.62958187",
"0.6291078",
"0.62852484... | 0.7832908 | 0 |
POST /user_device_configurations POST /user_device_configurations.json | def create
@user_device_configuration = UserDeviceConfiguration.new(params[:user_device_configuration])
respond_to do |format|
if @user_device_configuration.save
format.html { redirect_to @user_device_configuration, notice: 'User device configuration was successfully created.' }
format.js... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @user_device_configuration = UserDeviceConfiguration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_device_configuration }\n end\n end",
"def index\n @user_device_configurations = UserDeviceConfiguration.all\n\n respond_to do |fo... | [
"0.6286393",
"0.6214254",
"0.6205987",
"0.6070616",
"0.60648894",
"0.60373116",
"0.59652203",
"0.5938822",
"0.59274423",
"0.5905517",
"0.58977926",
"0.5889703",
"0.588639",
"0.58825624",
"0.5842152",
"0.5767097",
"0.576701",
"0.5760106",
"0.5741859",
"0.57213974",
"0.5700535"... | 0.72387016 | 0 |
PUT /user_device_configurations/1 PUT /user_device_configurations/1.json | def update
@user_device_configuration = UserDeviceConfiguration.find(params[:id])
respond_to do |format|
if @user_device_configuration.update_attributes(params[:user_device_configuration])
format.html { redirect_to @user_device_configuration, notice: 'User device configuration was successfully up... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update!(**args)\n @device_configs = args[:device_configs] if args.key?(:device_configs)\n end",
"def update!(**args)\n @device_configs = args[:device_configs] if args.key?(:device_configs)\n end",
"def create\n @user_device_configuration = UserDeviceConfiguration.new(para... | [
"0.65472317",
"0.65472317",
"0.64532495",
"0.62633395",
"0.62229526",
"0.616681",
"0.6139146",
"0.61142075",
"0.60482115",
"0.6007381",
"0.5962633",
"0.59482735",
"0.5906064",
"0.5891318",
"0.5853674",
"0.5834662",
"0.58281314",
"0.58265907",
"0.5818131",
"0.57997096",
"0.579... | 0.70914483 | 0 |
DELETE /user_device_configurations/1 DELETE /user_device_configurations/1.json | def destroy
@user_device_configuration = UserDeviceConfiguration.find(params[:id])
@user_device_configuration.destroy
respond_to do |format|
format.html { redirect_to user_device_configurations_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @device.user_id = nil\n @device.save\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @graphium_configuration.destroy\n respond_to do |format|\n format.html { redirect_to graphium_configurations_url, notice: 'Configuration was suc... | [
"0.6859505",
"0.6803306",
"0.66347903",
"0.66031045",
"0.6595982",
"0.6521107",
"0.64514136",
"0.64363354",
"0.63970107",
"0.6394089",
"0.63729304",
"0.6359964",
"0.63501835",
"0.63125575",
"0.62923324",
"0.6290117",
"0.62786174",
"0.6268358",
"0.6236461",
"0.62357044",
"0.62... | 0.7800072 | 0 |
Save output to the output file (one paragraph per line). Include additional HTML and CSS if attr additional_html = true | def save_to_file
File.open(@output, 'w+') do |file|
file.puts HEADER if @additional_html
file.puts @data_for_output.join("\n")
file.puts FOOTER if @additional_html
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_to_file\n\t\tFile.open(@output, \"w+\") do |file|\n\t\t\tfile.puts \"[b][align=center]\"\n\t\t\trandomize if @random\n\t\t\t@output_data.each_line { |line| line.delete('\\n') }\n\t\t\tfile.puts @output_data\n\t\t\tfile.puts \"[/align][/b][align=center][sup]Made with [user]kryszanek[/user]'s [url=http://gi... | [
"0.69958144",
"0.6527814",
"0.651571",
"0.64858437",
"0.6472231",
"0.6387234",
"0.6373998",
"0.6227278",
"0.6227233",
"0.6194358",
"0.61680895",
"0.61304563",
"0.61276233",
"0.6038381",
"0.6024614",
"0.6015311",
"0.59880507",
"0.5960089",
"0.59393054",
"0.5933858",
"0.5930584... | 0.7856954 | 0 |
Actions for Fulfillment Rights subform | def add_fulfillment_rights_row
@organization = Organization.find(params[:organization_id])
@new_fr_identity = Identity.find_or_create(params[:new_fr_identity_id])
@fulfillment_rights = fulfillment_rights(@organization_id)
set_registrar_enabled(@organization)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def single_item_action_form_fields(form, document, action)\n render '/collections/single_item_action_fields', form: form, document: document, action: action\n end",
"def reseller_allow_edit(permission)\n return reseller_right(permission) == 2\n end",
"def update\n # this action is not provided f... | [
"0.5582562",
"0.55035233",
"0.5486686",
"0.53779143",
"0.5373652",
"0.53297323",
"0.53215307",
"0.5253843",
"0.52380574",
"0.5212609",
"0.5211989",
"0.509528",
"0.50839174",
"0.5064582",
"0.50536174",
"0.5030007",
"0.5000622",
"0.5000622",
"0.5000622",
"0.5000622",
"0.5000622... | 0.562831 | 0 |
Temporarily merges the migration files by copying them over and then deletes them. Sequel's migration class cannot work with migrations in different directories even if sequelrails can. This is the simplest solution that works until ::Sequel::Migrator supports merging of multiple migration directories. | def temporarily_merge_migration_files(explanation=nil)
copy_files = []
Rails.application.config.paths["db/migrate"].expanded.each do |specified_migration_dir|
if migrations_dir.to_s != specified_migration_dir
Dir[File.join(specified_migration_dir, '*')].each do |file_name|
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_migration_files\n migration_templates = Dir.children(File.join(TEMPLATES, 'migrations')).sort\n migration_templates.each do |template_file|\n destination_file = template_file.match(/^\\d*_(.*\\.rb)/)[1] # 01_create_good_jobs.rb.erb => create_good_jobs.rb\n migration_template \"mi... | [
"0.64950824",
"0.6446832",
"0.6330297",
"0.61446697",
"0.61125183",
"0.6087638",
"0.60875565",
"0.6055927",
"0.5956392",
"0.58962667",
"0.58298993",
"0.5826711",
"0.579875",
"0.566398",
"0.566398",
"0.5635069",
"0.56145006",
"0.5608341",
"0.5579934",
"0.55681324",
"0.55277866... | 0.72574717 | 0 |
Returns the Zlist to the list of comments for this config item. | def _zlist
@config.ffi_delegate.comments
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comments\n get_ticket_property_list(\"comments\" , Unfuddled::Comment)\n end",
"def comments\n @comments\n end",
"def comments\n @comments\n end",
"def comments\n pull_comments\n @comments_list\n end",
"def getComments\r\n\t\t\t\t\treturn @comments\r\n\t\t\t\tend",
... | [
"0.6938066",
"0.6897551",
"0.688011",
"0.6876297",
"0.684835",
"0.6825231",
"0.6788851",
"0.67877203",
"0.67877203",
"0.67596716",
"0.67596716",
"0.67596716",
"0.6717209",
"0.67012393",
"0.6682884",
"0.66785896",
"0.6668563",
"0.6597387",
"0.6597387",
"0.65674895",
"0.6529552... | 0.75143844 | 0 |
Last push button helper. push_job_class is FtpPushJob, RhnStagePushJob or RhnLivePushJob | def last_push_link(push_job_class, errata)
if (last_push = push_job_class.last_push(errata))
push_job_link(last_push, 'Last job')
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_prepush_link(push_job_class, errata)\n jobs_since_respin = errata.push_jobs_since_last_state(push_job_class, 'NEW_FILES')\n if (job = jobs_since_respin.nochannel.order('id desc').first)\n push_job_link(job, 'Pre-push')\n end\n end",
"def push_history_link(push_job_class, errata)\n if p... | [
"0.6802253",
"0.61952704",
"0.5845433",
"0.55359304",
"0.5486763",
"0.5283278",
"0.527172",
"0.5262423",
"0.5229707",
"0.51936495",
"0.5119092",
"0.50789666",
"0.50741094",
"0.50379235",
"0.50308204",
"0.50261736",
"0.50074834",
"0.5000444",
"0.49806094",
"0.49791196",
"0.496... | 0.757782 | 0 |
Shows link to last nochannel job, if any. This is represented to the user as a "prepush" of the live content | def last_prepush_link(push_job_class, errata)
jobs_since_respin = errata.push_jobs_since_last_state(push_job_class, 'NEW_FILES')
if (job = jobs_since_respin.nochannel.order('id desc').first)
push_job_link(job, 'Pre-push')
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_push_link(push_job_class, errata)\n if (last_push = push_job_class.last_push(errata))\n push_job_link(last_push, 'Last job')\n end\n end",
"def latest_comic\r\n \tif sorted_articles.index(item) == 0\r\n\t\t\t# apply the inactive html and css\r\n\t\t\t'<h7 id=\"last-comic\" title=\"This is t... | [
"0.6312599",
"0.6038397",
"0.58215123",
"0.5786872",
"0.5678297",
"0.5531721",
"0.5429605",
"0.52930015",
"0.52412164",
"0.5236328",
"0.5225987",
"0.5205947",
"0.5195419",
"0.51747936",
"0.5166242",
"0.5154464",
"0.5154326",
"0.51509583",
"0.5146319",
"0.51402384",
"0.5121867... | 0.68830806 | 0 |
Won't show the link if here are no pushes of the given type since having the button there tends to imply there might be a relevant push job to look at. | def push_history_link(push_job_class, errata)
if push_job_class.for_errata(errata).any?
workflow_action_link("Push History", { :controller => 'push', :action => 'push_history_for_errata', :id => errata })
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push_variant_target_disabled_warning(errata, type)\n variants = errata.release_variants.uniq\n unsupported = variants.reject{|v| v.supported_push_types.include?(type)}.sort_by(&:name)\n return if unsupported.none? || unsupported.count == variants.count\n\n popover = block_render('shared/help_popove... | [
"0.59146005",
"0.5837964",
"0.580161",
"0.55455494",
"0.551946",
"0.55175835",
"0.54928124",
"0.5478899",
"0.54756474",
"0.5400246",
"0.5371835",
"0.52965075",
"0.5287611",
"0.52856845",
"0.5276128",
"0.5229828",
"0.5210949",
"0.519913",
"0.5198304",
"0.51646775",
"0.5105727"... | 0.584095 | 1 |
People that merged (not necessarily through pull requests) up to months_back from the time the built PR was created. if months_back is nil, don't take create time into consideration | def merger_team(pr, months_back = nil)
recently_merged = prs.find_all do |b|
close_reason[b[:github_id]] != :unknown and
(months_back.nil? ? true : b[:created_at].to_i > (pr[:created_at].to_i - months_back * 30 * 24 * 3600))
end.map do |b|
b[:github_id]
end
q = <<-QUERY
select... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merger_team(pr, months_back)\n @close_reason.map do |k,v|\n created_at = @prs.find{|x| x[:github_id] == k}\n [created_at[:created_at], v[2]]\n end.find_all do |x|\n x[0].to_i > (pr[:created_at].to_i - months_back * 30 * 24 * 3600)\n end.map do |x|\n x[1]\n end.select{|x| x != '... | [
"0.7629515",
"0.6281422",
"0.6254648",
"0.6060206",
"0.5967748",
"0.59566426",
"0.57506216",
"0.57431036",
"0.570729",
"0.56563514",
"0.56417954",
"0.5641268",
"0.5569643",
"0.552081",
"0.5494232",
"0.54296106",
"0.53806823",
"0.53354704",
"0.5262917",
"0.5236211",
"0.5223105... | 0.7125968 | 1 |
GET /insider_deals/1 GET /insider_deals/1.json | def show
@insider_deal = InsiderDeal.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @insider_deal }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def meals\n get(\"/user/#{@user_id}/meals.json\")\n end",
"def show_deal(id)\n get(\"deals/#{id}\")\n end",
"def deal_detail(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"deals/#{id}\", params)\n end",
"def index\n... | [
"0.7412967",
"0.71145",
"0.67918414",
"0.669748",
"0.6598033",
"0.6585533",
"0.6582518",
"0.6530764",
"0.6454494",
"0.64372647",
"0.64152926",
"0.64152926",
"0.64152926",
"0.64042854",
"0.63962364",
"0.6380398",
"0.63709396",
"0.6348071",
"0.63344115",
"0.6306824",
"0.6272823... | 0.7190072 | 1 |
GET /insider_deals/new GET /insider_deals/new.json | def new
@insider_deal = InsiderDeal.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @insider_deal }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @deal = Deal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @deal }\n end\n end",
"def new\n @meal = Meal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal }\n end\n end",
"d... | [
"0.7199966",
"0.7170282",
"0.7170282",
"0.711566",
"0.70683414",
"0.69980395",
"0.69536483",
"0.6943725",
"0.6940352",
"0.69215024",
"0.68828124",
"0.68227285",
"0.6812683",
"0.6812683",
"0.681171",
"0.6795089",
"0.67920256",
"0.6788213",
"0.67855793",
"0.6744758",
"0.6739235... | 0.76673234 | 0 |
DELETE /insider_deals/1 DELETE /insider_deals/1.json | def destroy
@insider_deal = InsiderDeal.find(params[:id])
@insider_deal.destroy
respond_to do |format|
format.html { redirect_to insider_deals_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_deals(**args)\n params = parameters(args) do\n required_params :ids\n optional_params :ids\n end\n request(:delete, 'deals', params)\n end",
"def delete_deal(id)\n delete(\"deals/#{id}\")\n end",
"def destroy\n @indication_for_meal.destroy\n... | [
"0.72750014",
"0.7159613",
"0.7132272",
"0.70671576",
"0.69881845",
"0.6947858",
"0.6928096",
"0.6927918",
"0.69083047",
"0.68798894",
"0.68449533",
"0.68394977",
"0.68361306",
"0.68330336",
"0.6819761",
"0.681649",
"0.681649",
"0.6807833",
"0.68037516",
"0.68017596",
"0.6776... | 0.7527548 | 0 |
disable the callbacks that are used for workflow; this ensures that we control sgtate changes, etc better during ingest, and various other | def disable_workflow_callbacks
# disable the allocate DOI callback
LibraWork.skip_callback( :save, :after, :allocate_doi )
LibraWork.skip_callback( :update, :before, :update_doi )
# disable the email send callback
LibraWork.skip_callback( :save, :after, :determine_email_behavior )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disable_callback_methods\n StashEngine::Resource.skip_callback(:create, :after, :init_state_and_version)\n # StashEngine::Resource.skip_callback(:create, :after, :create_share)\n end",
"def disable_after_run_callback\n @after_run_callback_disabled = true\n end",
"def replicate_disabl... | [
"0.7336373",
"0.69859374",
"0.66282904",
"0.6617495",
"0.6591407",
"0.65790856",
"0.650868",
"0.64940804",
"0.6459439",
"0.6358537",
"0.6334271",
"0.62552506",
"0.6249956",
"0.6248471",
"0.6225756",
"0.61620253",
"0.6152404",
"0.6111194",
"0.60100377",
"0.5995013",
"0.5961907... | 0.84497714 | 0 |
construct a default email address given a computing Id | def default_email( cid )
return "#{cid}@#{DEFAULT_DOMAIN}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_generated_mail_id\n if is_hr_or_info\n formatted_domain = website.gsub(/https:\\/\\/|http:\\/\\//, \"\").gsub(/www\\./, \"\")\n fname = first_name.gsub(/\\s/, \"\")\n lname = last_name.gsub(/\\s/, \"\")\n self.generated_mail_id1 = fname + \".\" + lname + \"@\" + formatted_domain\n... | [
"0.67331576",
"0.6715855",
"0.6645171",
"0.6630673",
"0.6395465",
"0.63555706",
"0.6354021",
"0.63397956",
"0.63042146",
"0.62972015",
"0.6291707",
"0.6291707",
"0.6281802",
"0.6241662",
"0.6191692",
"0.6167345",
"0.61480343",
"0.6112714",
"0.6111396",
"0.6093498",
"0.6084712... | 0.7266355 | 0 |
get a work by the specified ID | def get_work_by_id( work_id )
begin
return LibraWork.find( work_id )
rescue => e
end
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_work\n client.make_request('/get-work', 'post', params: {})\n end",
"def find_work\n work_id = params[:id]\n @work = Work.find_by_id(params[:id])\n head :not_found unless @work\nend",
"def get_work(data=nil)\n request('getwork', data)\n end",
"def get_work\n works = batched_get(... | [
"0.70607543",
"0.7024595",
"0.69218475",
"0.6889775",
"0.6687124",
"0.66437113",
"0.65612954",
"0.65611994",
"0.6551745",
"0.65248555",
"0.6515824",
"0.6504505",
"0.6499102",
"0.6499102",
"0.6499102",
"0.6499102",
"0.6499102",
"0.6499102",
"0.6499102",
"0.6499102",
"0.6499102... | 0.801705 | 0 |
download a random cat image | def get_random_image( )
print "getting image... "
dest_file = "#{File::SEPARATOR}tmp#{File::SEPARATOR}#{SecureRandom.hex( 5 )}.jpg"
Net::HTTP.start( "lorempixel.com" ) do |http|
resp = http.get("/640/480/cats/")
open( dest_file, "wb" ) do |file|
file.write( resp.body )
end
en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def choose_image\n \"banners/#{ rand(35) + 1 }.jpg\"\n end",
"def cover_url\n [\"condition_headache.jpeg\",\"condition_chair.jpeg\",\"condition_time.jpeg\",\"condition_med.jpeg\"][rand(4)] \n end",
"def randomOctocat\n\t\tcURL($baseURL+\"?random\")\n\tend",
"def random_image(query = 'safe, cute'... | [
"0.6988688",
"0.6918402",
"0.6712526",
"0.66827035",
"0.65710175",
"0.65266716",
"0.65016913",
"0.6251399",
"0.6185399",
"0.6150518",
"0.60608083",
"0.6057675",
"0.60356116",
"0.6012253",
"0.6006735",
"0.5994157",
"0.5989509",
"0.5982584",
"0.59241086",
"0.58936983",
"0.58634... | 0.79044473 | 0 |
get user information from an email address | def user_info_by_email( email )
id = User.cid_from_email( email )
return user_info_by_cid( id )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_by_email(email)\n get(\"get_user_by_email&email=#{email}\")\n end",
"def getUserBy_email( email)\n params = Hash.new\n params['email'] = email\n return doCurl(\"get\",\"/user/by_email\",params)\n end",
"def by_email address, options={}, headers={}\n params = options.merg... | [
"0.77538776",
"0.7613378",
"0.75917184",
"0.7409586",
"0.7385936",
"0.7366133",
"0.73501873",
"0.7350163",
"0.73037636",
"0.72684425",
"0.7234839",
"0.7199344",
"0.716516",
"0.71455127",
"0.7140261",
"0.71402013",
"0.71342325",
"0.712018",
"0.71042573",
"0.7077971",
"0.704588... | 0.80510473 | 0 |
get user information from a computing id | def user_info_by_cid( id )
print "Looking up user details for #{id}..."
# lookup the user by computing id
user_info = Helpers.lookup_user( id )
if user_info.nil?
puts "not found"
return nil
end
puts "done"
return user_info
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_user(id)\n client.user(id)\n end",
"def user; User.find_by_id(user_id); end",
"def get_user_by_id(id)\n $r.hgetall(\"user:#{id}\")\n end",
"def user(id)\n @users[id.resolve_id]\n end",
"def user\n user_id.get_object\n end",
"def user(id)\n self.class.get(\"/us... | [
"0.71896064",
"0.69202936",
"0.691275",
"0.6888319",
"0.68710905",
"0.6865562",
"0.6799513",
"0.6727998",
"0.6717491",
"0.67016494",
"0.66736007",
"0.6673272",
"0.66628355",
"0.6644424",
"0.66267776",
"0.66216415",
"0.6586932",
"0.65833235",
"0.6575809",
"0.65728354",
"0.6570... | 0.7585293 | 0 |
lookup a user by computing id and create their account if we locate them | def lookup_and_create_account( id )
# lookup locally with the default email
user = User.find_by_email( User.email_from_cid( id ) )
return user if user.present?
# if we cannot find them, lookup in LDAP
user_info = user_info_by_cid( id )
return nil if user_info.nil?
# now look them up with ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_user_account\n Account.create(user_id: self.id) \t\n end",
"def associate_with_user\n if user_id.nil? || user.email == Address::PLACEHOLDER_EMAIL\n self.user_id = User.find_or_create_by_details(\n email: email_address, name: billing_full_name\n ).id\n end\n end",
"def cre... | [
"0.67742336",
"0.6773403",
"0.668789",
"0.6681846",
"0.6617749",
"0.6611668",
"0.65838003",
"0.6583433",
"0.6515639",
"0.6507259",
"0.64511025",
"0.6434905",
"0.6411974",
"0.6391272",
"0.63751304",
"0.637097",
"0.6344418",
"0.63415676",
"0.6316173",
"0.6314543",
"0.6310543",
... | 0.81069696 | 0 |
batch process a group of SOLR works | def batched_process_solr_works( solr_works, &f )
solr_works.each do |gw_solr|
begin
gw = LibraWork.find( gw_solr['id'] )
f.call( gw )
rescue => e
puts e
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_bulk; end",
"def send_batch(batch)\n return if batch.empty?\n json_package = JSON.generate(batch.map { |c| c.output_hash })\n begin\n resp = @http_client.post @solr_update_url, json_package, \"Content-type\" => \"application/json\"\n rescue StandardError => exception\n end\n\n if e... | [
"0.61693203",
"0.60873973",
"0.6084905",
"0.59042245",
"0.5902048",
"0.58922154",
"0.5884926",
"0.58821285",
"0.5831383",
"0.5831383",
"0.581307",
"0.57927036",
"0.5787895",
"0.57803464",
"0.5716339",
"0.57033634",
"0.57032394",
"0.5653601",
"0.5645989",
"0.56376886",
"0.5618... | 0.7796205 | 0 |
show full details of a libra work | def show_libra_work( work )
return if work.nil?
j = JSON.parse( work.to_json )
j.keys.sort.each do |k|
val = j[ k ]
if k.end_with?( '_id' ) == false && k.end_with?( '_ids' ) == false
show_field( k, val, ' ' )
end
end
show_field( 'visibility', work.visibility, ' ' )
A... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def workspace_info\n link_to_workspace_info(\"http://library.nyu.edu/info/myworkspace.html\", \"left\")\n end",
"def show_details(workspace)\n begin\n puts workspace.show_details\n rescue => exception\n puts \"Error: #{exception.message}\"\n end\nend",
"def show\n render_default_forma... | [
"0.6527745",
"0.6361649",
"0.6350302",
"0.62399715",
"0.6149119",
"0.6148327",
"0.6130828",
"0.6034295",
"0.6028256",
"0.6017531",
"0.5982396",
"0.5982396",
"0.592682",
"0.591022",
"0.5899939",
"0.58746207",
"0.5872047",
"0.58624816",
"0.58400434",
"0.58334535",
"0.58300734",... | 0.72610444 | 0 |
show the contents of a person subfield | def show_person( title, person )
#puts "#{title} #{person}"
puts "#{title}"
show_field( 'ix', person.index, ' ' )
show_field( 'cid', person.computing_id, ' ' )
show_field( 'first_name', person.first_name, ' ' )
show_field( 'last_name', person.last_name, ' ' )
show_field( 'department... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def field_content\n f = ''\n subfields.each do |sf|\n f += \"|#{sf.code}#{sf.value}\"\n end\n f\n end",
"def add_show_field(*) super end",
"def render_person_info(person)\n partial :sidebar_person_info, :locals => {:person => person}\n end",
"def subfield(tag)\n subfi... | [
"0.6345041",
"0.5971252",
"0.5925871",
"0.57882094",
"0.57867664",
"0.56752175",
"0.56466365",
"0.564341",
"0.56142503",
"0.5609505",
"0.55953133",
"0.55819607",
"0.5578387",
"0.55635995",
"0.5549511",
"0.54991406",
"0.54991406",
"0.54991406",
"0.54991406",
"0.5495332",
"0.54... | 0.7020725 | 0 |
show a field if it is not empty | def show_field( name, val, indent )
return if val.nil?
return if val.respond_to?( :empty? ) && val.empty?
puts "#{indent}#{name} => #{val}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty?()\n fields.empty?\n end",
"def empty?\n @fields.empty?\n end",
"def empty?\n\t\treturn self.fields.empty?\n\tend",
"def empty?\n @fields.values.empty?\n end",
"def field?\n false \n end",
"def blank?\n true\n end",
"def text_field?(field_name); end... | [
"0.6946621",
"0.69020337",
"0.6788965",
"0.65098995",
"0.6470843",
"0.6434844",
"0.6415562",
"0.6391451",
"0.6364682",
"0.631447",
"0.631447",
"0.631447",
"0.6312858",
"0.6284911",
"0.6277242",
"0.6248132",
"0.62451744",
"0.62451744",
"0.62451744",
"0.6243429",
"0.6243429",
... | 0.7372356 | 0 |
upload the specified file to the specified work on behalf of the specified user | def upload_file( user, work, filename, title, visibility )
print "uploading #{filename}... "
fileset = ::FileSet.new
fileset.title << title unless title.nil?
file_actor = ::CurationConcerns::Actors::FileSetActor.new( fileset, user )
file_actor.create_metadata( work )
file_actor.create_content(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload(file, someone)\n end",
"def file_upload(params_userfile)\n content_upload(params_userfile.read)\n end",
"def creator_upload(username, file_name, file)\r\n dir = \"creators/#{username}\"\r\n file.original_filename = file_name + (File.extname file.original_filename)\r\n return write(di... | [
"0.77202815",
"0.6761699",
"0.67311305",
"0.66025543",
"0.6534689",
"0.6488298",
"0.6375653",
"0.63280386",
"0.6318654",
"0.631007",
"0.6294155",
"0.6236812",
"0.6234402",
"0.6234402",
"0.6152242",
"0.6110015",
"0.61081517",
"0.61026263",
"0.61013734",
"0.6051725",
"0.6035774... | 0.6789401 | 1 |
load a file containing xml data and return an oga document | def load_xml_doc( filename )
File.open( filename, 'r') do |file|
return Oga.parse_xml( file )
end
puts "ERROR: loading #{filename}"
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_xml file\n f = File.open file\n doc = Nokogiri::XML f\n f.close\n doc\n end",
"def load_xml_document file_name\n xml_file = File.new file_name, \"r\"\n return Document.new xml_file\n end",
"def load_xml(file_path)\n # Read the source XML file.\n puts \"file_path: #{file_path}\"\n... | [
"0.8043625",
"0.7516769",
"0.73990804",
"0.7349184",
"0.68753755",
"0.6873936",
"0.6824196",
"0.6785871",
"0.6611146",
"0.6534131",
"0.6530477",
"0.64658266",
"0.6459023",
"0.64540166",
"0.6415907",
"0.63967764",
"0.6384703",
"0.63408023",
"0.6334972",
"0.62992394",
"0.625030... | 0.8251758 | 0 |
DELETE /ab_teams/1 DELETE /ab_teams/1.json | def destroy
@ab_team.destroy
respond_to do |format|
format.html { redirect_to ab_teams_url, notice: 'Record was destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @team = @club.teams.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to club_teams_url(@club.id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n team.destroy\n\n respond_to do |format|\n format.html { redirect_... | [
"0.7415762",
"0.7352768",
"0.725395",
"0.72512186",
"0.72512186",
"0.72512186",
"0.72512186",
"0.72512186",
"0.72512186",
"0.72512186",
"0.72512186",
"0.72512186",
"0.72512186",
"0.72512186",
"0.72512186",
"0.7239285",
"0.7222529",
"0.7222529",
"0.7222529",
"0.7222529",
"0.71... | 0.7438262 | 0 |
Denies access for public users to private projects | def require_proj_access
if params[:gr]
@project ||= Group.find(params[:gr]).project
else
@project = Project.find(params[:id] || params[:pr])
end
if ((not is_logged?) || current_user.is_public?) && @project.is_private?
flash_msgs(1, "Access denied.")
redirect_to root_path
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_unauthorized_proc\n # no-op\n end",
"def define_global_privileges\n can :read, Project, public_can_view?: true\n can :index, Project\n can :read, Group\n end",
"def authorize_manageable\n unless @project_group.is_child_of?(@project)\n deny_access\n end\n true\n end",
... | [
"0.7277191",
"0.7218941",
"0.7210982",
"0.7198158",
"0.7187759",
"0.7020269",
"0.7002725",
"0.6990869",
"0.6851059",
"0.67871827",
"0.6787141",
"0.6766111",
"0.67153335",
"0.67153335",
"0.67153335",
"0.6681467",
"0.6669373",
"0.6658646",
"0.66570187",
"0.66124827",
"0.6602400... | 0.75092643 | 0 |
GET /step_commands GET /step_commands.json | def index
@step_commands = StepCommand.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n \n @steps = @quest.steps\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @steps }\n end\n end",
"def states_to_commands(states, timestep)\n diff_states = objectify_json(states_to_diff_states(refine_states(states), timestep).to_json)\n... | [
"0.6461117",
"0.6175543",
"0.61444855",
"0.60349464",
"0.6008792",
"0.5862901",
"0.5835542",
"0.57502186",
"0.5742752",
"0.571677",
"0.5697392",
"0.5643747",
"0.56167805",
"0.5600292",
"0.5594215",
"0.55886674",
"0.5573473",
"0.55557066",
"0.55469584",
"0.55469584",
"0.554695... | 0.7444896 | 0 |
POST /step_commands POST /step_commands.json | def create
@step_command = StepCommand.new(step_command_params)
respond_to do |format|
if @step_command.save
format.html { redirect_to @step_command, notice: 'Step command was successfully created.' }
format.json { render :show, status: :created, location: @step_command }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step_command_params\n params.require(:step_command).permit(:step_id, :command_id)\n end",
"def create\n @step = Step.new(params[:step])\n\n respond_to do |format|\n if @step.save\n format.html { redirect_to @step.phase_template, notice: 'Step was successfully added.' }\n form... | [
"0.67982787",
"0.6147115",
"0.61442214",
"0.61372846",
"0.61294156",
"0.60697025",
"0.60692036",
"0.6057771",
"0.60301673",
"0.59866357",
"0.594803",
"0.59067166",
"0.58722496",
"0.58406174",
"0.5789548",
"0.5762389",
"0.5720796",
"0.57131755",
"0.5712075",
"0.5710178",
"0.57... | 0.7359506 | 0 |
PATCH/PUT /step_commands/1 PATCH/PUT /step_commands/1.json | def update
respond_to do |format|
if @step_command.update(step_command_params)
format.html { redirect_to @step_command, notice: 'Step command was successfully updated.' }
format.json { render :show, status: :ok, location: @step_command }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @step = Step.find(params[:id])\n\n respond_to do |format|\n if @step.update_attributes(params[:step])\n format.html { redirect_to @step, notice: 'Step was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n... | [
"0.6554455",
"0.6538388",
"0.6530585",
"0.6492778",
"0.6480338",
"0.6408168",
"0.6397069",
"0.6397069",
"0.6358154",
"0.63412404",
"0.6307371",
"0.62299204",
"0.6205627",
"0.61104476",
"0.6104414",
"0.6048825",
"0.6005242",
"0.59993017",
"0.59847736",
"0.5973864",
"0.5953699"... | 0.69682074 | 0 |
DELETE /step_commands/1 DELETE /step_commands/1.json | def destroy
@step_command.destroy
respond_to do |format|
format.html { redirect_to step_commands_url, notice: 'Step command was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @step = Step.find(params[:id])\n @step.status = \"deleted\"\n @step.save!\n\n respond_to do |format|\n format.json { render :json => \"success\" }\n end\n end",
"def destroy\n @step = Step.find(params[:id])\n @step.destroy\n\n respond_to do |format|\n format.html ... | [
"0.7437388",
"0.7244521",
"0.7208565",
"0.70813864",
"0.6999222",
"0.69943357",
"0.69943357",
"0.69943357",
"0.69943357",
"0.69869477",
"0.6973408",
"0.6933595",
"0.68245447",
"0.6823274",
"0.68181705",
"0.6816827",
"0.6814283",
"0.6811396",
"0.6802149",
"0.67974985",
"0.6762... | 0.7589281 | 0 |
Connect to the SmartView provider and obtain a session id. Two methods of connection are supported: 1. Userid and password 2. SSO token If only a single parameter is passed, the SSO method is assumed; if two parameters are passed, these are assumed to be userid and password. | def connect(user_or_sso, password = nil)
if @provider
raise AlreadyConnected, "Cannot change provider once connected" if @provider
end
# Obtain a session id
if password.nil?
# Connect via SSO token
@sso = user_or_sso
@logger.info "Connecti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect\n configuration = VSphereAutomation::Configuration.new.tap do |c|\n c.host = config[:vcenter_host]\n c.username = config[:vcenter_username]\n c.password = config[:vcenter_password]\n c.scheme = \"https\"\n c.verify_ssl = config[:vcenter_disable_ssl_ve... | [
"0.66164184",
"0.64917696",
"0.63756776",
"0.63701886",
"0.6324099",
"0.63041717",
"0.62165165",
"0.62163514",
"0.6191902",
"0.61862093",
"0.61747026",
"0.6160866",
"0.614915",
"0.61008275",
"0.60882986",
"0.60718054",
"0.60709864",
"0.59751415",
"0.59738153",
"0.5973302",
"0... | 0.6722323 | 0 |
Close the connection to the current application cube. | def close_app
if @session_id && @app
@logger.info "Disconnecting from #{@app}.#{@cube}"
@req.Logout do |xml|
xml.sID @session_id
end
invoke
@app = nil
@cube = nil
@dimensions = nil
@default_pov = nil
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close()\n\t\t@connection.disconnect\n\t\t@connection = nil\n\tend",
"def close\n inactive!\n close_connections\n end",
"def close\n @ole_connection.Close\n end",
"def close!\n live_queries = @volt_app.channel_live_queries[@channel]\n\n if live_queries\n live_queries.each do |l... | [
"0.67616844",
"0.6703403",
"0.670213",
"0.66807425",
"0.66695905",
"0.6618604",
"0.6584358",
"0.6582413",
"0.64775676",
"0.64548224",
"0.63691366",
"0.63080263",
"0.62713736",
"0.62651277",
"0.6244815",
"0.624187",
"0.624187",
"0.624187",
"0.624187",
"0.6206425",
"0.61956555"... | 0.7440572 | 0 |
Retrieve a list of dimensions for the current connection. | def get_dimensions
check_attached
@logger.info "Retrieving list of dimensions"
@req.EnumDims do |xml|
xml.sID @session_id
xml.alsTbl @preferences.alias_table
end
@dimensions = []
invoke.search('//res_EnumDims/dimList/dim').each do |dim|
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dimensions\n @dimensions ||= extract_dimensions\n end",
"def dimensions\n data[:dimensions]\n end",
"def dimensions\n return @dimensions if @dimensions\n @dimensions = {}\n (raw['Dimensions'] || {}).each do |name, values|\n values = [values] unless Array === values... | [
"0.7612927",
"0.7491795",
"0.7119689",
"0.7065461",
"0.69859594",
"0.6833041",
"0.6635644",
"0.65700686",
"0.6449944",
"0.63648355",
"0.6354532",
"0.62309235",
"0.6223252",
"0.62107784",
"0.6142987",
"0.61411935",
"0.6124049",
"0.6081948",
"0.60598814",
"0.60243237",
"0.60033... | 0.8324431 | 0 |
Returns a list of available member filters for the specified dimension. A filter can be used to restrict a member query to a certain subset of members, such as the members in a member list. | def get_filters(dimension, force = false)
check_attached
if @fiters && @filters[dimension] && !force
@logger.debug "Retrieving filters for #{dimension} from cache"
filters = @filters[dimension]
else
@logger.info "Retrieving list of available member filters fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_members(dimension, filter_spec = nil, all_gens = true)\n check_attached\n\n @logger.info \"Retrieving list of members for #{dimension}\"\n filter_name, filter_args = process_filter(dimension, filter_spec)\n @req.EnumMembers do |xml|\n xml.sID @session_id\n ... | [
"0.66000456",
"0.6113546",
"0.5663793",
"0.558727",
"0.5541264",
"0.5440236",
"0.5352249",
"0.5334504",
"0.5318193",
"0.52901834",
"0.5235585",
"0.51865315",
"0.5149339",
"0.50871384",
"0.5058165",
"0.5041862",
"0.504061",
"0.50391406",
"0.50339425",
"0.50339425",
"0.5019519"... | 0.6618161 | 0 |
Retrieves a list of members for the specified dimension, optionally satisfying a filter. | def get_members(dimension, filter_spec = nil, all_gens = true)
check_attached
@logger.info "Retrieving list of members for #{dimension}"
filter_name, filter_args = process_filter(dimension, filter_spec)
@req.EnumMembers do |xml|
xml.sID @session_id
xml.dim dimens... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter(arg, members)\n begin\n rescue\n members = []\n end\n\n return members\n end",
"def find_member(dimension, pattern, filter_spec = nil)\n check_attached\n\n @logger.info \"Finding members of #{dimension} matching '#{pattern}'\"\n filter_name, filter_ar... | [
"0.6106037",
"0.5892731",
"0.5737507",
"0.5628034",
"0.5616825",
"0.54674816",
"0.5147688",
"0.50660956",
"0.50398475",
"0.5007623",
"0.50068593",
"0.5006542",
"0.49880135",
"0.49544948",
"0.49335697",
"0.4933323",
"0.492662",
"0.490732",
"0.48770645",
"0.48370168",
"0.481069... | 0.7164167 | 0 |
Search for the specified member name or pattern in a dimension. Returns an array of arrays, each inner array representing a path to a matching member. | def find_member(dimension, pattern, filter_spec = nil)
check_attached
@logger.info "Finding members of #{dimension} matching '#{pattern}'"
filter_name, filter_args = process_filter(dimension, filter_spec)
@req.FindMember do |xml|
xml.sID @session_id
xml.dim dimen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def children_lookup(cube_unique_name, member = nil, recursive = false)\n return dimensions cube_unique_name if member.nil?\n\n if member.split(\".\").length == 1\n cube(cube_unique_name).get_dimensions.reject { |dimension| dimension.get_unique_name != member }.first.get_hierarchies.map { |hierarch... | [
"0.58633673",
"0.50954473",
"0.50358456",
"0.49046034",
"0.48188692",
"0.47691846",
"0.47646478",
"0.47630084",
"0.47506502",
"0.47243878",
"0.46803775",
"0.46600533",
"0.45607966",
"0.45484754",
"0.45322666",
"0.45157522",
"0.45046684",
"0.44887182",
"0.44867975",
"0.44701588"... | 0.6749866 | 0 |
Sets the current POV | def pov=(new_pov)
new_pov
@pov = pov.merge(new_pov)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_pv\n @pv = Pv.find(params[:id])\n end",
"def set_vprob\n @vprob = Vprob.find(params[:id])\n end",
"def set_officev\n @officev = Officev.find(params[:id])\n end",
"def set_poset\n @poset = Poset.find(params[:id])\n end",
"def set_votacion\n @votacion = Votacion.f... | [
"0.6170124",
"0.58831656",
"0.5805392",
"0.57393426",
"0.5681483",
"0.56764996",
"0.55454487",
"0.55406404",
"0.55344963",
"0.54906285",
"0.5462184",
"0.5428256",
"0.54158354",
"0.5414618",
"0.5406406",
"0.5395552",
"0.53927726",
"0.53619075",
"0.53532916",
"0.53532916",
"0.5... | 0.61672235 | 1 |
Get the default POV | def default_pov
# Make sure we are connected
check_attached
@logger.info "Retrieving default POV"
@req.GetDefaultPOV do |xml|
xml.sID @session_id
xml.getAtts '0'
xml.alsTbl @preferences.alias_table
end
doc = invoke
dims = doc.a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pov\n default_pov unless @pov\n @pov\n end",
"def default\n find(\"Default\")\n end",
"def get_default\n if self.current_defaults\n self.current_defaults.first\n else\n raise \"Cette instance ne possède de #{self.class.name} par default\"\n end\n ... | [
"0.5939354",
"0.59290737",
"0.5922274",
"0.5554738",
"0.55447453",
"0.55122954",
"0.5501516",
"0.55004627",
"0.5482217",
"0.54771745",
"0.54033804",
"0.53995204",
"0.5362484",
"0.5357589",
"0.5341343",
"0.5334122",
"0.5328234",
"0.53162336",
"0.53162336",
"0.5245872",
"0.5224... | 0.7644387 | 0 |
Gets a default grid with the specified POV | def default_grid
# Make sure we are attached to a cube
check_attached
@logger.info "Retrieving default grid"
@req.GetDefaultGrid do |xml|
xml.sID @session_id
@preferences.inject_xml xml, @provider_type
xml.backgroundpov do |xml|
pov.ea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_grid\n Array.new(7) { Array.new(6) { Cell.new } }\n end",
"def default_pov\n # Make sure we are connected\n check_attached\n\n @logger.info \"Retrieving default POV\"\n @req.GetDefaultPOV do |xml|\n xml.sID @session_id\n xml.getAtts ... | [
"0.5971977",
"0.5965197",
"0.575852",
"0.5713396",
"0.53836936",
"0.53076774",
"0.524211",
"0.5237517",
"0.5233897",
"0.52206445",
"0.51251656",
"0.50248826",
"0.49595135",
"0.48569524",
"0.48031297",
"0.47750446",
"0.4755351",
"0.46816182",
"0.46778807",
"0.4622908",
"0.4622... | 0.65902126 | 0 |
Refresh a grid from the current provider | def refresh(grid)
# Make sure we are attached to a cube
check_attached
@logger.info "Refreshing grid"
@req.Refresh do |xml|
xml.sID @session_id
@preferences.inject_xml xml, @provider_type
grid.to_xml(xml)
end
doc = invoke
Grid.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @grid.update\n end",
"def refresh\n\t\t@frame.updateGrid\n\t\tself.update\n\t\treturn self\n\tend",
"def refresh!\n raise NotImplementedError, \"#refresh! is not implemented on #{@provider}:#{@type}\"\n end",
"def refresh(provider)\n $evm.log(\"info\", \"Refreshing provider #{pr... | [
"0.7269299",
"0.7165706",
"0.6832801",
"0.66368824",
"0.6595634",
"0.65622294",
"0.65622294",
"0.6493063",
"0.640858",
"0.6334815",
"0.63031816",
"0.63031816",
"0.62334484",
"0.62334484",
"0.62175953",
"0.61877894",
"0.6185085",
"0.6173953",
"0.61363024",
"0.6100245",
"0.6078... | 0.7629953 | 0 |
Return a grid for the spcified rows and columns and optional POV The rows must be a hash whose key is a single dimension name, or array of dimension names. The value of the hash must be an array containing tuples of member names for the dimension(s) in the rows. The cols must be a hash whose key is a single dimension n... | def free_form_grid(rows, cols, grid_pov=nil)
# Make sure we are attached to a cube
check_attached
get_dimensions unless @dimensions
# Update the POV if one is specified
if grid_pov
self.pov = grid_pov
end
grid = Grid.define(@dimensions, pov, rows, co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grid\n @grid ||=\n {\n rows: lines_to_ranges(lines[:horizontal]),\n columns: lines_to_ranges(lines[:vertical])\n }\n end",
"def create_grid\n @grid = {\"1a\" => \" \", \"1b\" => \" \", \"1c\" => \" \", \"1d\" => \" \", \"1e\" => \" \",\n ... | [
"0.64313143",
"0.61897457",
"0.61006105",
"0.59698695",
"0.59622866",
"0.594811",
"0.5921769",
"0.5847691",
"0.5672701",
"0.55957943",
"0.55472404",
"0.55231",
"0.55002207",
"0.54943144",
"0.5494288",
"0.5479013",
"0.54585916",
"0.54568464",
"0.54427224",
"0.54367685",
"0.540... | 0.67455137 | 0 |
Checks to see that a session has been established, raising a NotConnected exception if one has not. | def check_connected
raise NotConnected unless @session_id && @sso && @provider
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_server_connection\n\t\tsession[:foo] = \"bar\" unless session.id \n\t\traise \"session.id is nil\" unless session.id\n\t\tunless @client = ClientConnections.get(session.id.public_id)\n\t\t\tredirect_to root_path, flash: { error: \"Please connect to a formulary server\" }\n\t\tend\n\tend",
"def check... | [
"0.68034667",
"0.68034667",
"0.67881316",
"0.67881316",
"0.67720455",
"0.677098",
"0.6672164",
"0.66430384",
"0.6632717",
"0.66123366",
"0.66106296",
"0.6603487",
"0.6565453",
"0.6565453",
"0.6543456",
"0.6520118",
"0.6489656",
"0.6470741",
"0.6449875",
"0.6448576",
"0.643180... | 0.79844135 | 0 |
Checks that a cube is open, raising a NotAttached exception if one is not. | def check_attached
check_connected
raise NotAttached unless @app && @cube
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attached?\n interface.status == 'in-use'\n end",
"def attached?\n\t\tCommon.device_status(@handle);\n end",
"def attached?\n not self.info.nil?\n end",
"def attached?\n not send(self.class.container_name).nil?\n end",
"def check()\n # check if teh volume still exists\n ... | [
"0.544216",
"0.53384924",
"0.53176224",
"0.52649313",
"0.5184758",
"0.51149905",
"0.50992036",
"0.5036669",
"0.501715",
"0.49898186",
"0.49860623",
"0.49706852",
"0.49439564",
"0.49264377",
"0.48942304",
"0.48936844",
"0.48797712",
"0.48647383",
"0.48555163",
"0.4828772",
"0.... | 0.78451747 | 0 |
Sends the current request XML to the SmartView provider, and parses the response with hpricot. If an exception was returned, an SmartViewException is raised with the details of the error. | def invoke
resp = nil
ms = Benchmark.realtime do
resp = @http.post @url, @req.to_s
end
@logger.info 'SmartView request %s completed in %.1fs' % [@req.method, ms]
doc = Hpricot::XML(resp.body.content)
if !doc.at("//res_#{@req.method}")
@logger.error... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_xml(xml)\n connection.ProcessRequest(session, xml)\n rescue => e\n puts \"ERROR processing request:\\n#{xml}\"\n raise # Reraises the original error, only this way we got the xml output\n end",
"def send_request( xml )\n write( xml )\n read\n end",
"def send... | [
"0.6339378",
"0.6231344",
"0.61522204",
"0.60964334",
"0.600724",
"0.597375",
"0.58602387",
"0.579789",
"0.5697041",
"0.5680977",
"0.5674398",
"0.5653115",
"0.5624577",
"0.55661297",
"0.55544704",
"0.5521125",
"0.5497294",
"0.5478834",
"0.54606766",
"0.54162884",
"0.54162884"... | 0.67916286 | 0 |
Insert filter arguments to a request | def insert_filter_args(xml, filter_args)
if filter_args
filter_args.each_with_index do |filter_arg, i|
xml.arg({'id' => "#{i}"}, filter_arg)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_parameters=(_arg0); end",
"def filter_parameters=(_arg0); end",
"def add_filters(filters); end",
"def filter_parameters; end",
"def filter_parameters; end",
"def Filter=(arg0)",
"def filters=(_arg0); end",
"def filters=(_arg0); end",
"def query_parameters\n params = {}\n params... | [
"0.7019112",
"0.7019112",
"0.69137275",
"0.6784069",
"0.6784069",
"0.6692211",
"0.6600999",
"0.6600999",
"0.64978456",
"0.6479139",
"0.64715946",
"0.6457765",
"0.64549553",
"0.6385913",
"0.6374145",
"0.6365863",
"0.63474315",
"0.6326313",
"0.6320585",
"0.62886226",
"0.6262696... | 0.7094534 | 0 |
store the countries information and create region list | def store_countries
Countries::Data.get_data
@regions = Countries::Country.create_region_list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def countries_list\n [\n ['Afghanistan', 'Afghanistan'],\n ['Albania', 'Albania'],\n ['Algeria', 'Algeria'],\n ['American Samoa', 'American Samoa'],\n ['Andorra', 'Andorra'],\n ['Angola', 'Angola'],\n ['Antigua and Barbuda', 'Antigua and Barbuda'],\n ['Arg... | [
"0.6857831",
"0.68053675",
"0.6796844",
"0.6672254",
"0.65704274",
"0.6566891",
"0.6477582",
"0.6476874",
"0.64247",
"0.6422858",
"0.6376245",
"0.633171",
"0.62361586",
"0.62327844",
"0.6219856",
"0.6216796",
"0.62142414",
"0.6202572",
"0.6197147",
"0.6186581",
"0.61776906",
... | 0.8644318 | 0 |
get the country list of given region | def country_list_by_region(region)
# select list of countries based on the region
@countries = Countries::Country.find_by_region(region)
# print the list of countries as table format
Table.display_as_table(@countries)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def country_list\n return [] if type == \"state\"\n return countries if type == \"country\"\n members.collect { |zone| zone.country_list }.flatten\n end",
"def get_countries\n countries=[]\n @locations.each do |loc|\n countries << loc.country.capitalize if loc.country\n end\n countries... | [
"0.7619613",
"0.7324609",
"0.72546595",
"0.7250403",
"0.7059625",
"0.7008309",
"0.6882325",
"0.687028",
"0.6860345",
"0.6838286",
"0.6737262",
"0.6724257",
"0.66977495",
"0.66964805",
"0.66939497",
"0.6610382",
"0.6607012",
"0.65989596",
"0.6598801",
"0.65600556",
"0.6545739"... | 0.78170156 | 0 |
country details based on region and country | def country_details(region, input)
country = @countries[input - 1]
Table.display_as_summary(country)
browse_online(country)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_country\n @single_city_data[\"sys\"][\"country\"]\n end",
"def country\n data['country']\n end",
"def represented_country; end",
"def registered_country; end",
"def country; end",
"def country; end",
"def country; end",
"def region_of_country(country_code = 'JP')\n result = @re... | [
"0.76016486",
"0.7420104",
"0.7379968",
"0.7351726",
"0.72804105",
"0.72804105",
"0.72804105",
"0.72547114",
"0.7232474",
"0.71334577",
"0.7127241",
"0.71272",
"0.7089775",
"0.708491",
"0.70717144",
"0.70615244",
"0.7058763",
"0.7039556",
"0.70295686",
"0.70279956",
"0.702027... | 0.78632003 | 0 |
Convert a cart into an order go through and check each cart entry, if in stock and valid then convert to an order entry. If the order is valid after the creation of the entry then ammend stock levels. Once all valid entries are generated save the whole thing and clear the shopping cart | def create
candidateOrder = Order.new(email: params[:order][:Email],
totalCost: cart_total,
user: curr_user)
cart.each do |pId, info|
if (prod = Product.find_by(id: pId))
if prod.stockCount > info["Num"].to_i
candidateOrder.order_entries.new(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n # create new order object from form parameters\n @order = Order.new(order_params)\n\n # get the contents of the cart\n @cart = Cart.find(current_user.cart_id)\n\n # for security reasons, calculate the total amount from the actual cart (instead of taking a parameter)\n @total_amount, ... | [
"0.6655813",
"0.64634234",
"0.62644565",
"0.62572646",
"0.62338233",
"0.6221731",
"0.6160598",
"0.60869896",
"0.60228485",
"0.5998863",
"0.59857064",
"0.59836817",
"0.59468913",
"0.59129775",
"0.58774203",
"0.5873198",
"0.5858518",
"0.58464986",
"0.582184",
"0.5810873",
"0.58... | 0.6795797 | 0 |
Empty the user's shopping cart | def clear_cart
update_cart({})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_carts\n current_user.carts.each_with_index do |cart, i|\n cart.delete if i != current_user.carts.length - 1\n end\n end",
"def empty_cart\n self.each do |item|\n item.cart_id = nil\n item.save!\n end\n end",
"def empty_cart\n puts \"========= Emptying Cart\"\n @b.go... | [
"0.8031044",
"0.77986765",
"0.7593933",
"0.7593933",
"0.739813",
"0.7364413",
"0.7336975",
"0.7253655",
"0.72161233",
"0.71335286",
"0.70281833",
"0.6977616",
"0.69772935",
"0.69201314",
"0.68642545",
"0.6854456",
"0.6851387",
"0.68240815",
"0.6815093",
"0.67398065",
"0.67084... | 0.78453743 | 1 |
returns first of the given paths that exists, or the last one if none exists | def first_existing(*paths)
last_path = nil
paths.each do |path|
last_path = path
break if @io.exist?(path)
end
last_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_first(*paths)\n xpath(*paths).first\n end",
"def common_path(paths)\n return nil if paths.empty?\n strs = paths.map do |path|\n unless path.absolute?\n raise ArgumentError, \"Paths must be absolute #{path}\"\n end\n path... | [
"0.72064084",
"0.6627912",
"0.65136635",
"0.6481619",
"0.638956",
"0.6097864",
"0.6002848",
"0.5953102",
"0.5939572",
"0.5894156",
"0.58747023",
"0.58626807",
"0.57939816",
"0.57574594",
"0.57429886",
"0.57225275",
"0.5713313",
"0.5698395",
"0.56867754",
"0.5674942",
"0.56405... | 0.8213236 | 0 |
matt's sweet code def clamp_to_edgeeee(node, x, y base=BASE) originX = node % base originY = node / base if originX + x > base node = originX + x base end if originY + y > base node = base (originY + y base) end return node end | def clamp_to_edge(node, x, y, base=BASE)
while base - (node % base) < x
node -= 1
end
while (node + (base*(y-1))) >= (base*base)
node -= base
end
return node
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clamp; end",
"def clamp(x, low, hi)\n x = low if x < low\n x = hi if x > hi\n return x\n end",
"def h(node)\n (node.x - @end.x).abs + (node.y - @end.y).abs\n end",
"def limit\n @nodes.each do |node|\n norm = normal(node.disposition.x, node.disposition.y)\n ... | [
"0.60007447",
"0.59062517",
"0.5570146",
"0.5416254",
"0.53874373",
"0.5354287",
"0.53438634",
"0.5325704",
"0.53165317",
"0.529577",
"0.5265072",
"0.52428883",
"0.51784825",
"0.51435274",
"0.50972915",
"0.50513065",
"0.5031904",
"0.50245386",
"0.50062066",
"0.5004022",
"0.50... | 0.9105717 | 0 |
Public: serves as the getter and setter for the Array of Symbol column names. Union join the existing column names with those passed Example: ``` header.columns :name, :age, :location ``` `args` Array of Symbol arguments passed Returns as Array of Symbols | def columns(*args)
@columns = @columns | args.map(&:to_sym)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column(name, *args)\n define_method name do\n instance_variable_get(\"@_#{name}\")\n end\n define_method \"#{name}=\" do |val|\n instance_variable_set(\"@_#{name}\", val)\n end\n self.columns = columns.concat([[name].concat(args)])\n end",
"def named_columns( names )\n @colum... | [
"0.67176396",
"0.6573496",
"0.6359476",
"0.63251394",
"0.6318875",
"0.6301126",
"0.6283622",
"0.62174606",
"0.6158545",
"0.61454654",
"0.61317384",
"0.6100073",
"0.60494655",
"0.60126406",
"0.6001964",
"0.59973043",
"0.59882694",
"0.59270465",
"0.58921254",
"0.5890751",
"0.58... | 0.81415546 | 0 |
Public: converts columns and mappings into mapped columns ready for encoding. If a mapped value is found that is used, else the Symbol column name is humanized by default or can be specified with header_inflector option Returns an Array of Strings | def mapped_columns
@columns.map do |column|
@mappings[column] || column.to_s.send(@inflector)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column_names(column_mappings)\n column_mappings.map { |c| (c['column'] || c['standard_mapping']).downcase }\n end",
"def make_column_mapping\n self.column_mapping = Hash.new.tap do |mapping|\n headers.collect { |h| canonicalize_header(h) }.each.with_index do |header, index|\n raise Run... | [
"0.6813702",
"0.6511555",
"0.646128",
"0.6441469",
"0.6000217",
"0.5928535",
"0.5883122",
"0.58591306",
"0.5849231",
"0.5843938",
"0.58433",
"0.5836539",
"0.58239007",
"0.5813955",
"0.58128095",
"0.580976",
"0.57861865",
"0.5762714",
"0.57607377",
"0.5745558",
"0.5744659",
... | 0.76826763 | 0 |
GET /tipo_convenios/1 GET /tipo_convenios/1.json | def show
@tipo_convenio = TipoConvenio.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @tipo_convenio }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @tipo_contrato = TipoContrato.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_contrato }\n end\n end",
"def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to ... | [
"0.7094906",
"0.67918247",
"0.67725545",
"0.6759573",
"0.67560804",
"0.6745839",
"0.65608364",
"0.6555574",
"0.6537344",
"0.65112025",
"0.64990485",
"0.6467223",
"0.6427331",
"0.6426641",
"0.6419957",
"0.6419957",
"0.6414807",
"0.63988423",
"0.6375387",
"0.63596445",
"0.63534... | 0.7124635 | 0 |
GET /tipo_convenios/new GET /tipo_convenios/new.json | def new
@tipo_convenio = TipoConvenio.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @tipo_convenio }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @tipo_negocio = TipoNegocio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_negocio }\n end\n end",
"def new\n @tipo_pensum = TipoPensum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render ... | [
"0.77312815",
"0.7632935",
"0.7581101",
"0.7501306",
"0.7468367",
"0.74403334",
"0.74272454",
"0.7398976",
"0.73842394",
"0.7372472",
"0.7366392",
"0.733274",
"0.73322",
"0.7308771",
"0.7290168",
"0.7282418",
"0.7263765",
"0.7245985",
"0.72378975",
"0.72123754",
"0.7205718",
... | 0.7872798 | 0 |
DELETE /tipo_convenios/1 DELETE /tipo_convenios/1.json | def destroy
@tipo_convenio = TipoConvenio.find(params[:id])
@tipo_convenio.destroy
respond_to do |format|
format.html { redirect_to tipo_convenios_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @tipo_contrato = TipoContrato.find(params[:id])\n @tipo_contrato.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_contratos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @consumo = Consumo.find(params[:id])\n @consumo.destroy\n... | [
"0.7294594",
"0.7150272",
"0.70917165",
"0.70767593",
"0.7062537",
"0.7028968",
"0.70284116",
"0.70270693",
"0.7021605",
"0.70079625",
"0.69910973",
"0.6971971",
"0.69699985",
"0.6962163",
"0.6960114",
"0.6957955",
"0.6947555",
"0.69464463",
"0.6946137",
"0.69455266",
"0.6932... | 0.7368083 | 0 |
PATCH/PUT /faxes/1 PATCH/PUT /faxes/1.json | def update
respond_to do |format|
if @fax.update(fax_params)
format.html { redirect_to @fax, notice: 'Fax was successfully updated.' }
format.json { render :show, status: :ok, location: @fax }
else
format.html { render :edit }
format.json { render json: @fax.errors, statu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n\n format.json { render json: Axis.find(params[:id]).update( name: params[:name]) }\n end\n\n # end\n end",
"def update\n @fax_typ = FaxTyp.find(params[:id])\n\n respond_to do |format|\n if @fax_typ.update_attributes(params[:fax_typ])\n forma... | [
"0.6405743",
"0.6095538",
"0.5998256",
"0.5961049",
"0.5931614",
"0.58949435",
"0.5893845",
"0.5871725",
"0.58678293",
"0.5815141",
"0.5793186",
"0.5777657",
"0.577376",
"0.57529545",
"0.57525903",
"0.57495207",
"0.5748024",
"0.57470715",
"0.5735325",
"0.5734178",
"0.571494",... | 0.62733513 | 1 |
DELETE /faxes/1 DELETE /faxes/1.json | def destroy
@fax.destroy
respond_to do |format|
format.html { redirect_to faxes_url, notice: 'Fax was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end",
"def destroy\n @axis.destroy\n respond_to do |format|\n format.html { redirect_to axes_url, notice: 'Axis was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n ... | [
"0.668589",
"0.6590102",
"0.6529944",
"0.64363027",
"0.6378425",
"0.6369021",
"0.6350011",
"0.634973",
"0.6342679",
"0.63381755",
"0.63297445",
"0.6305522",
"0.6300163",
"0.62862",
"0.62728167",
"0.6258868",
"0.62525505",
"0.6238768",
"0.6234341",
"0.6230245",
"0.6223411",
... | 0.666336 | 1 |
GET /descuento_adicionals GET /descuento_adicionals.json | def index
@descuento_adicionals = DescuentoAdicional.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @item_adicionals = ItemAdicional.all\n end",
"def destroy\n @descuento_adicional.destroy\n respond_to do |format|\n format.html { redirect_to descuento_adicionals_url, notice: 'Descuento adicional was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
... | [
"0.6345408",
"0.6147245",
"0.6063977",
"0.6063977",
"0.5915792",
"0.5871646",
"0.585145",
"0.5846302",
"0.5790004",
"0.5759359",
"0.5753114",
"0.57437164",
"0.5739775",
"0.57258624",
"0.57",
"0.5699348",
"0.5662103",
"0.5654298",
"0.56452703",
"0.5627805",
"0.56223935",
"0.... | 0.769354 | 1 |
POST /descuento_adicionals POST /descuento_adicionals.json | def create
@descuento_adicional = DescuentoAdicional.new(descuento_adicional_params)
respond_to do |format|
if @descuento_adicional.save
format.html { redirect_to @descuento_adicional, notice: 'Descuento adicional fue creado exitosamente.' }
format.json { render :show, status: :created, l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @descuento_adicional = DescuentoAdicional.new(descuento_adicional_params)\n\n respond_to do |format|\n if @descuento_adicional.save\n format.html { redirect_to @descuento_adicional, notice: 'Descuento adicional was successfully created.' }\n format.json { render :show, status:... | [
"0.6745028",
"0.6544405",
"0.6544405",
"0.6464977",
"0.64624697",
"0.6201955",
"0.605923",
"0.5940895",
"0.58948404",
"0.58948404",
"0.58737224",
"0.57324123",
"0.57091653",
"0.567408",
"0.5621925",
"0.55859756",
"0.55783",
"0.5558731",
"0.55469257",
"0.5537962",
"0.55377775"... | 0.6690199 | 1 |
PATCH/PUT /descuento_adicionals/1 PATCH/PUT /descuento_adicionals/1.json | def update
respond_to do |format|
if @descuento_adicional.update(descuento_adicional_params)
format.html { redirect_to @descuento_adicional, notice: 'Descuento adicional fue actualizado exitosamente.' }
format.json { render :show, status: :ok, location: @descuento_adicional }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @descuento_adicional.update(descuento_adicional_params)\n format.html { redirect_to @descuento_adicional, notice: 'Descuento adicional was successfully updated.' }\n format.json { render :show, status: :ok, location: @descuento_adicional }\n else\... | [
"0.68740344",
"0.6508011",
"0.6374225",
"0.634008",
"0.6299347",
"0.6268326",
"0.62560046",
"0.6252494",
"0.6252113",
"0.6248781",
"0.6247315",
"0.62207776",
"0.6206411",
"0.6186919",
"0.61850315",
"0.617283",
"0.6169775",
"0.6152704",
"0.6147492",
"0.6146387",
"0.61308557",
... | 0.6687972 | 1 |
DELETE /descuento_adicionals/1 DELETE /descuento_adicionals/1.json | def destroy
@descuento_adicional.destroy
respond_to do |format|
format.html { redirect_to descuento_adicionals_url, notice: 'Descuento adicional fue eliminado exitosamente.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @descuento_adicional.destroy\n respond_to do |format|\n format.html { redirect_to descuento_adicionals_url, notice: 'Descuento adicional was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item_adicional.destroy\n respond_to do |... | [
"0.7584859",
"0.7107488",
"0.69920623",
"0.6938006",
"0.68970776",
"0.68573004",
"0.68464035",
"0.68457973",
"0.6844119",
"0.6829674",
"0.6827674",
"0.6827197",
"0.68189293",
"0.68072635",
"0.67916226",
"0.67914766",
"0.6785067",
"0.67733",
"0.67674804",
"0.67585856",
"0.6753... | 0.7483473 | 1 |
Creates a pipeline on AWS Elastic Transcoder | def create_pipeline name, input_bucket, output_bucket, role
begin
@elastictranscoder.create_pipeline(
name: name,
input_bucket: input_bucket,
output_bucket: output_bucket,
role: role
)
rescue
#Raise informative exception
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_pipeline(**args)\n params = parameters(args) do\n optional_params :name, :deal_probability, :order_nr, :active\n end\n request(:post, 'pipelines', params)\n end",
"def pipeline(name)\n return PipelineT.new(name)\n end",
"def to_pipeline\n p = Pipel... | [
"0.652446",
"0.64508605",
"0.6340263",
"0.63075244",
"0.62349594",
"0.621768",
"0.6021814",
"0.58086044",
"0.5745947",
"0.5608509",
"0.5604101",
"0.5568337",
"0.5525445",
"0.55089235",
"0.5487428",
"0.546316",
"0.5413003",
"0.53632617",
"0.5357884",
"0.53394645",
"0.53355235"... | 0.74993247 | 0 |
Deletes a pipeline on AWS Elastic Transcoder given an id | def delete_pipeline id
begin
@elastictranscoder.delete_pipeline(id: id)
rescue
#Raise informative exception
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_pipeline(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:delete, \"pipelines/#{id}\", params)\n end",
"def delete_pipeline(id)\n delete(\"dealGroups/#{id}\")\n end",
"def delete_pipeline(id, opts = {})\n data, status_... | [
"0.831177",
"0.80013835",
"0.72955346",
"0.7219937",
"0.70177466",
"0.6564606",
"0.62814873",
"0.626145",
"0.5979849",
"0.58549",
"0.57210433",
"0.57043666",
"0.56821215",
"0.56635123",
"0.56628966",
"0.5651034",
"0.5632525",
"0.5617103",
"0.55874884",
"0.5555457",
"0.5543756... | 0.9011064 | 0 |
Tells if a free trial is defined in the price group | def has_free_trial?
return (trial and trial.free?)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trial?\n (plan_type == 'free_trial')\n end",
"def free?\n cost == 0.0 || payment_not_required\n end",
"def premium?\n \t! free?\n end",
"def trial?\n price_is_zero = price_amount_micros == 0\n price_is_zero && payment_received?\n end",
"def has_chosen_free_ite... | [
"0.7206481",
"0.6949126",
"0.6887819",
"0.6801576",
"0.67869574",
"0.67436624",
"0.6724147",
"0.6675729",
"0.6661419",
"0.6626156",
"0.6622098",
"0.65532976",
"0.65111524",
"0.6496665",
"0.6491064",
"0.6484405",
"0.6484405",
"0.64556193",
"0.6430888",
"0.64216447",
"0.6409723... | 0.74790967 | 0 |
sieve of eratosthenes page 16 for each i, a[i] true if prime for each i, setting array element corresponding to each multiple of i to false then loop through again, printing them out | def primes
arr=Array.new
arr[1]=false
(2..1000).each {|i| arr[i]=true}
(2..1000).each {|i| (i/2).floor
(2..1000).each {|j| (j/i).floor
arr[i*j] = false
}}
for i in 1..1000
if arr[i] == true
puts i
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def primeArray(number)\n @sieve = Array.new(number)\n \n for count in 2..Math.sqrt(number)\n next if @sieve[count]\n \n for inner_count in 2..number/count\n @sieve[count * inner_count] = true\n end\n end\n @sieve\nend",
"def sieve_of_eratosthenes(max)\n list = Array.new(max + 1, true)\n l... | [
"0.7301977",
"0.71271074",
"0.707012",
"0.70455533",
"0.6976294",
"0.69156003",
"0.6885897",
"0.6862523",
"0.6739983",
"0.6675054",
"0.6634471",
"0.6627764",
"0.6622075",
"0.66204506",
"0.66199076",
"0.6608538",
"0.65779424",
"0.6569534",
"0.6550073",
"0.6532301",
"0.6477396"... | 0.78390974 | 0 |
3.1 fill in 2d array of bools by setting a[i,j] to true if gcd i,j is 1 and false otherwise uses ruby's built in gcd function | def twoDArray(m,n)
arr = Hash.new
for m in 0..m
for n in 0..n
if m.gcd(n) == 1
arr[[m,n]] = true
else
arr[[m,n]] = false
end
end
end
for m in 0..m
for n in 0..n
if arr[[m,n]] == true
puts "#{m} :m and #{n} :n"
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iterate(arr)\n newArr = []\n (0...arr.size).each do |row|\n newArr[row] = []\n (0...arr.size).each do |col|\n num_neighbors = num_neighbors(row,col,arr)\n if arr[row][col]\n if num_neighbors == 2 || num_neighbors == 3\n newArr[row][col] = true\n else\n newArr[r... | [
"0.5793098",
"0.5723635",
"0.56556046",
"0.5555622",
"0.5550151",
"0.54802334",
"0.5469398",
"0.5458594",
"0.54552",
"0.53868484",
"0.53839964",
"0.5356436",
"0.5348506",
"0.53313214",
"0.53196746",
"0.5301599",
"0.5231826",
"0.5228158",
"0.5216013",
"0.5214886",
"0.5181425",... | 0.60851043 | 0 |
3.4 solve the josephus problem with an array N people have decided to commit mass suicide by arranging themselves in a circle and killing the mth person around the circle, closing ranks as each person drops out of the circle. find out the order in which the people die | def josephus(n,m)
arr = Array.new
order = Array.new
for i in 1..n
arr[i] = i
end
arr.compact!
for i in 0..n-1
arr= arr.rotate(m-1)
order << arr[0]
arr[0] = nil
arr.compact!
end
puts "order: #{order.to_s}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def josephus_survivor(n,k)\n # (1..n) people are put into the circle\n items = (1..n).to_a\n Array.new(n){items.rotate!(k-1).shift}.last\nend",
"def josephus_survivor(n,k)\n result = 1\n for i in 1...n + 1\n result = (result + k - 1) % i + 1\n end\n \n result\nend",
"def josephus(n,m)\n\... | [
"0.66888964",
"0.64809626",
"0.62024534",
"0.61218816",
"0.6038506",
"0.59638137",
"0.59411454",
"0.57927346",
"0.5771708",
"0.5732769",
"0.5724178",
"0.5691598",
"0.5691496",
"0.5671533",
"0.56611985",
"0.5651968",
"0.56341136",
"0.5632547",
"0.55832565",
"0.5575646",
"0.554... | 0.6649804 | 1 |
load the lines from the file, remove comments, blank lines, whitespace, set the ivar | def load_lines file
lines = Array.new
lines = @file.split("\n")
#fuck that, i dont like the dyanmic feed, just pre-parse it
lines.map! do |line| #map overwrites the old array
if line.include? '#'
split = line.split '#'
#puts split.to_s
split.shift
else
line
end
end
#removing blan... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load\n @lines.select! do |line|\n line.strip.length != 0\n end.select! do |line|\n line[0] != '#'\n end.map! do |line|\n line.split(\" \")\n end\n\n self\n end",
"def load_data\n self.open if @io.nil?\n @lines = @io.readlines\n ... | [
"0.764171",
"0.6941673",
"0.6830841",
"0.6649386",
"0.65957516",
"0.6537128",
"0.6452292",
"0.6394172",
"0.63447845",
"0.6273264",
"0.6243285",
"0.62396884",
"0.62376386",
"0.6186814",
"0.6100277",
"0.6082232",
"0.6042146",
"0.6033296",
"0.5975077",
"0.5934803",
"0.5925693",
... | 0.6953415 | 1 |
primary access control point: returns all tenant permissions for user currently not used as user will only have one tenant with current implementation | def current_tenant_permissions
if current_or_guest_user
current_or_guest_user.tenant_ids
else
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def primary_tenant_permission\n if current_or_guest_user\n current_or_guest_user.tenant_ids.first\n else\n nil\n end\n end",
"def permission_grants\n return @permission_grants\n end",
"def quota_view_only\n return Quotum.none if @force_empty\n if @user.presen... | [
"0.678953",
"0.6761816",
"0.67237586",
"0.665139",
"0.6650796",
"0.65495807",
"0.64620364",
"0.64181876",
"0.63737065",
"0.63718957",
"0.6366822",
"0.6157869",
"0.6147857",
"0.6081552",
"0.607618",
"0.60743785",
"0.60458297",
"0.6045226",
"0.6023286",
"0.601517",
"0.59624994"... | 0.78868496 | 0 |
returns primary (base) tenant permission for user | def primary_tenant_permission
if current_or_guest_user
current_or_guest_user.tenant_ids.first
else
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_tenant_permissions\n if current_or_guest_user\n current_or_guest_user.tenant_ids\n else\n nil\n end\n end",
"def current_tenant\n Tenant.find_by_domain! current_user.email_domain\n end",
"def current_tenant\n MultiTenant.current_tenant\n end",
"def curr... | [
"0.73966545",
"0.6493027",
"0.64182276",
"0.6390949",
"0.6390949",
"0.6390949",
"0.6390889",
"0.638754",
"0.6242775",
"0.6242775",
"0.6242775",
"0.6242775",
"0.61415726",
"0.6112098",
"0.6027526",
"0.59923315",
"0.5970421",
"0.59339327",
"0.5917308",
"0.589589",
"0.58301973",... | 0.8528185 | 0 |
Parses the given stream and returns a node tree | def load(stream, root_class = nil)
root_class ||= PrisonParser::Node
line_num = 0
nodes = []
@tokens = []
current_node = root_class.new
while !stream.eof? do
line = stream.readline.strip
line_num += 1
tokenize(line)
next if tokens... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(stream, encoding=nil)\n _parse(stream, false, encoding)\n @tree.get_document\n end",
"def decode( inputstream)\n #Helper method on inputstream to read single bits\n class << inputstream\n def init\n @byte = 0\n @bit_count = 0\n end\n def rea... | [
"0.7480541",
"0.63556576",
"0.63311917",
"0.6061552",
"0.6050684",
"0.5991325",
"0.5863618",
"0.582962",
"0.5777376",
"0.5757155",
"0.5756618",
"0.56822157",
"0.5677197",
"0.56628925",
"0.5604052",
"0.5592924",
"0.5585131",
"0.55820906",
"0.5558012",
"0.55352855",
"0.5532359"... | 0.6902235 | 1 |
Retrieves all entity type identifiers related to a given type identifier | def get_entity_types_related_to(type_identifier)
Occi::Log.debug("Getting entity type identifiers related to #{type_identifier}")
collection = @model.get type_identifier
collection.kinds.collect { |kind| kind.type_identifier }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_entity_type_identifiers\n get_entity_types_related_to Occi::Core::Entity.kind.type_identifier\n end",
"def get_entity_type_identifiers\n get_kind_type_identifiers_related_to Occi::Core::Entity.kind.type_identifier\n end",
"def get_resource_type_identifiers\n get_ent... | [
"0.7796788",
"0.74293005",
"0.69550896",
"0.68346107",
"0.6783869",
"0.67296726",
"0.67119765",
"0.6372826",
"0.6372268",
"0.6317861",
"0.6317861",
"0.6285354",
"0.62398446",
"0.6012297",
"0.5992851",
"0.59634304",
"0.5936028",
"0.5860965",
"0.5858274",
"0.57935256",
"0.57421... | 0.8358175 | 0 |
Retrieves all available entity types. | def get_entity_types
Occi::Log.debug("Getting entity types ...")
@model.kinds.collect { |kind| kind.term }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_entity_types\n get_types(Occi::Core::Entity.kind)\n end",
"def entity_types\n @entity_types ||= metadata.xpath('//EntityType').collect {|entity| entity.attributes['Name'].value}\n end",
"def index\n @entity_types = EntityType.all\n end",
"def list(type)\n get(resource_path_... | [
"0.82866675",
"0.7752563",
"0.75918645",
"0.7248464",
"0.7244958",
"0.7227515",
"0.72221315",
"0.72221315",
"0.7029091",
"0.7029091",
"0.6950121",
"0.68591714",
"0.6712268",
"0.6696491",
"0.6655576",
"0.6602504",
"0.6525311",
"0.64333314",
"0.6367737",
"0.63387257",
"0.627506... | 0.82484925 | 1 |
Retrieves all available entity type identifiers. | def get_entity_type_identifiers
get_entity_types_related_to Occi::Core::Entity.kind.type_identifier
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_entity_types\n get_types(Occi::Core::Entity.kind)\n end",
"def get_entity_type_identifiers\n get_kind_type_identifiers_related_to Occi::Core::Entity.kind.type_identifier\n end",
"def get_entity_types\n Occi::Log.debug(\"Getting entity types ...\")\n @model.kind... | [
"0.7877693",
"0.7785234",
"0.7623249",
"0.74239135",
"0.70781195",
"0.70505285",
"0.70373416",
"0.7035693",
"0.7035693",
"0.6972683",
"0.6924417",
"0.6717979",
"0.6654311",
"0.6612976",
"0.6455192",
"0.6455192",
"0.6282917",
"0.6266731",
"0.6251797",
"0.6141238",
"0.61367184"... | 0.80748206 | 0 |
Retrieves all available resource types. | def get_resource_types
Occi::Log.debug("Getting resource types ...")
collection = @model.get Occi::Core::Resource.kind
collection.kinds.collect { |kind| kind.term }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource_types\n get_types(Occi::Core::Resource.kind)\n end",
"def all_of_type\n Resource::AllOfType.new(type)\n end",
"def list_resource_types(feed_id = nil)\n if feed_id.nil?\n ret = http_get('/resourceTypes')\n else\n the_feed = hawk_escape_id feed_id\n ... | [
"0.8586148",
"0.7548137",
"0.73330396",
"0.7196875",
"0.71729606",
"0.69619936",
"0.69221973",
"0.6907189",
"0.6850253",
"0.68476236",
"0.66748494",
"0.6610756",
"0.6590624",
"0.6531334",
"0.6490618",
"0.64234513",
"0.6422633",
"0.63303614",
"0.62601733",
"0.6220727",
"0.6213... | 0.8548611 | 1 |
Retrieves all available resource type identifiers. | def get_resource_type_identifiers
get_entity_types_related_to Occi::Core::Resource.kind.type_identifier
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource_types\n get_types(Occi::Core::Resource.kind)\n end",
"def get_resource_types\n Occi::Log.debug(\"Getting resource types ...\")\n collection = @model.get Occi::Core::Resource.kind\n collection.kinds.collect { |kind| kind.term }\n end",
"def get_reso... | [
"0.7927595",
"0.7786789",
"0.7720512",
"0.6979698",
"0.68479896",
"0.67314774",
"0.66892487",
"0.6682988",
"0.6543309",
"0.6467696",
"0.63946545",
"0.6316076",
"0.6258884",
"0.6214816",
"0.62119234",
"0.6149411",
"0.61451304",
"0.61367136",
"0.61224055",
"0.60580385",
"0.6056... | 0.78809315 | 1 |
Retrieves all available link types. | def get_link_types
Occi::Log.debug("Getting link types ...")
collection = @model.get Occi::Core::Link.kind
collection.kinds.collect { |kind| kind.term }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_link_types\n get_types(Occi::Core::Link.kind)\n end",
"def get_link_type_identifiers\n get_entity_types_related_to Occi::Core::Link.kind.type_identifier\n end",
"def get_link_type_identifiers\n get_kind_type_identifiers_related_to Occi::Core::Link.kind.type_identifier... | [
"0.81939846",
"0.69282293",
"0.67540115",
"0.6429698",
"0.63668627",
"0.6271843",
"0.6156096",
"0.60497063",
"0.604643",
"0.59481764",
"0.59287405",
"0.588149",
"0.5840851",
"0.5813125",
"0.5807189",
"0.5807189",
"0.5807189",
"0.5793381",
"0.57657623",
"0.5747395",
"0.5736831... | 0.83286625 | 0 |
Retrieves all available link type identifiers. | def get_link_type_identifiers
get_entity_types_related_to Occi::Core::Link.kind.type_identifier
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_link_types\n get_types(Occi::Core::Link.kind)\n end",
"def get_link_types\n Occi::Log.debug(\"Getting link types ...\")\n collection = @model.get Occi::Core::Link.kind\n collection.kinds.collect { |kind| kind.term }\n end",
"def get_link_type_identifiers\n ... | [
"0.78509283",
"0.7835411",
"0.7781284",
"0.6346669",
"0.6222234",
"0.6172147",
"0.60230136",
"0.60179436",
"0.5991234",
"0.58334816",
"0.57899904",
"0.57544655",
"0.5732094",
"0.56883484",
"0.56710947",
"0.56587434",
"0.5650522",
"0.5612827",
"0.5600657",
"0.5600102",
"0.5558... | 0.78948075 | 0 |
Looks up a mixin using its name and, optionally, a type as well. Will return mixin's full location (a link) or a description. | def find_mixin(name, type = nil, describe = false)
Occi::Log.debug("Looking for mixin #{name} + #{type} + #{describe}")
# is type valid?
if type
raise "Unknown mixin type! [#{type}]" unless @mixins.has_key? type.to_sym
end
# TODO: extend this code to supp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lookup_mixin(name)\n @mixins.fetch(name.to_s) { |k| @parent ? @parent.lookup_mixin(k) : nil }\n end",
"def resolve_mixin(mixin, cur_tool, loader)\n mod =\n case mixin\n when ::String\n cur_tool.lookup_mixin(mixin)\n when ::Symbol\n l... | [
"0.68363106",
"0.62106866",
"0.59954774",
"0.5880233",
"0.5870427",
"0.5768124",
"0.54502344",
"0.5387423",
"0.53281236",
"0.5076696",
"0.4999048",
"0.49348515",
"0.47635597",
"0.47428054",
"0.47157726",
"0.46905813",
"0.4618577",
"0.46107185",
"0.45893195",
"0.45359218",
"0.... | 0.7950162 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.