query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Returns a list of projects for the given account | def projects
return [] unless basecamp
@projects ||= basecamp.projects
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_by_account(account)\n raise SecurityError if account.nil?\n projects = []\n if(account.is_a? Worker)\n account.worker_groups.each do |group| #TODO convert to this to a JOIN model to avoid N^2 hits to the db\n group.projects.each do |project|\n projects << project... | [
"0.78678536",
"0.77663654",
"0.7715734",
"0.750573",
"0.73739934",
"0.73426306",
"0.7341505",
"0.7304716",
"0.7261574",
"0.7152481",
"0.7112637",
"0.70168626",
"0.7016141",
"0.7012475",
"0.69722277",
"0.6960922",
"0.694568",
"0.69422114",
"0.69133073",
"0.6894679",
"0.6892038... | 0.64030164 | 78 |
Returns a list of todos for the given account and project_id. TODO: Can we return a blank project id and get all todo lists for all objects??? | def todos(project_id)
return [] if project_id.blank? || !basecamp
@todos[project_id] ||= Basecamp::TodoList.all(project_id, false)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lists(project_id, complete=nil)\n records \"todo-list\", \"/projects/#{project_id}/todos/lists\", :complete => complete\n end",
"def get_items(projectid, todolistid)\n get(\"projects/#{projectid}/todolists/#{todolistid}.json\")\n end",
"def get_all_withassigned(projectid)\n get(\"projects/#{proj... | [
"0.704227",
"0.69164544",
"0.6630713",
"0.66013193",
"0.6564256",
"0.6552887",
"0.65388757",
"0.6512203",
"0.62591076",
"0.62354654",
"0.6223964",
"0.6217156",
"0.6206288",
"0.6192626",
"0.618925",
"0.61635625",
"0.6134018",
"0.6092453",
"0.6082023",
"0.6072686",
"0.60657704"... | 0.8015326 | 0 |
Create a new time entry for a todo item | def create_todo(fact, todo_id = nil)
response = basecamp_connection.post("/todo_items/#{todo_id}/time_entries.xml",
"<time-entry>
<person-id>#{fact.activity.category.account.user_id}</person-id>
<date>#{fact.start_time.to_date}</date>
<hours>#{fact.hours}</hours>
<description>#{fact.description.gsub(/\&/, "&")}</description>
</time-entry>", "Content-Type" => "application/xml")
if response.code == '201'
time_entry_id = response['location'].split('/').last
fact.time_entry.update_attribute(:time_entry_id, time_entry_id)
return true
else
puts response.inspect
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n\t\t@project = Project.find(get_stored_project_id)\n\t\t@time_entry = @project.time_entries.build(params[:time_entry])\n\t\tif @time_entry.save\n\t\t\tflash[:success] = \"New entry saved!\"\n\t\t\tredirect_to project_path(@project)\n\t\telse\n\t\t\trender project_path(@project)\n\t\tend\n\tend",
"def... | [
"0.6905482",
"0.67226046",
"0.67226046",
"0.67226046",
"0.6716773",
"0.65780985",
"0.6569305",
"0.6525802",
"0.6366464",
"0.6357043",
"0.6357043",
"0.6354616",
"0.6339933",
"0.6269349",
"0.623345",
"0.62332565",
"0.6230968",
"0.62197655",
"0.6199245",
"0.61868274",
"0.6108667... | 0.74935913 | 0 |
Destroy a time entry | def destroy_time_entry(time_entry_id)
response = basecamp_connection.delete("/time_entries/#{time_entry_id}.xml")
if response.code == '200'
return true
else
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_time_entry(id)\n send(:delete, \"time_entries/#{id}\")\n end",
"def destroy\n @time_slot.destroy\n end",
"def destroy\n @timeslot.destroy\n end",
"def destroy\n @time_entry = TimeEntry.find(params[:id])\n @time_entry.destroy\n\n respond_to do |format|\n format.htm... | [
"0.77992654",
"0.7590809",
"0.74623907",
"0.7444488",
"0.7444488",
"0.7431935",
"0.7351253",
"0.72916806",
"0.7277229",
"0.6959602",
"0.69578123",
"0.69498515",
"0.689085",
"0.68891627",
"0.6864954",
"0.6813109",
"0.6696011",
"0.6674523",
"0.6649583",
"0.664586",
"0.6645859",... | 0.7660365 | 1 |
Fast way of fetching the value of the cell table.get("my_id", :info, :name) => "Bob" | def get(id, column_family_name, column_name)
get_cell(id, column_family_name, column_name).try :value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(field)\n # Get the first/only row as a Hash.\n result = CONNECTION.execute(\"SELECT * FROM #{table_name} WHERE id = #{@id}\").first\n\n # Return only the value for the key of the field we're seeking.\n return result[field]\n end",
"def get(field)\n result = CONNECTION.execute(\"SELECT * F... | [
"0.68539226",
"0.68029714",
"0.66870934",
"0.661898",
"0.6324234",
"0.62525666",
"0.6139114",
"0.61344707",
"0.61344707",
"0.6111823",
"0.6079337",
"0.6046893",
"0.5973868",
"0.59589195",
"0.5905197",
"0.5905197",
"0.59026295",
"0.59010977",
"0.5898378",
"0.5893262",
"0.58923... | 0.67367584 | 2 |
Fast way of fetching one cell | def get_cell(id, column_family_name, column_name)
if cell = connection.get(name, id, "#{column_family_name.to_s}:#{column_name.to_s}", {}).first
MassiveRecord::Wrapper::Cell.populate_from_tcell(cell)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCell(row,col)\n the_row = @rows[row]\n the_cell = the_row.cells[col]\n return the_cell\n end",
"def get_cell(cell)\n query_cell_info '/cell/get', cell\n end",
"def getCell(x, y)\n return @grid.getCell(x,y)\n end",
"def cellAt(row, col)\n\t\treturn @rows[row][col]\n\tend",
"... | [
"0.71015996",
"0.7073971",
"0.67323005",
"0.65704304",
"0.65683",
"0.65674895",
"0.65606177",
"0.6556301",
"0.6523695",
"0.6518354",
"0.6427422",
"0.637553",
"0.63638777",
"0.6358243",
"0.6358243",
"0.6349126",
"0.62587553",
"0.62312526",
"0.62265885",
"0.6224499",
"0.6175319... | 0.6730931 | 3 |
Finds one or multiple ids Returns nil if id is not found | def find(*args)
return nil unless exists?
options = args.extract_options!.symbolize_keys
what_to_find = args.first
if column_families_to_find = options[:select]
column_families_to_find = column_families_to_find.collect { |c| c.to_s }
end
if what_to_find.is_a?(Array)
connection.getRowsWithColumns(name, what_to_find, column_families_to_find, {}).collect do |t_row_result|
Row.populate_from_trow_result(t_row_result, connection, name, column_families_to_find)
end
else
if t_row_result = connection.getRowWithColumns(name, what_to_find, column_families_to_find, {}).first
Row.populate_from_trow_result(t_row_result, connection, name, column_families_to_find)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_entity_by_id(id_list_or_array)\n end",
"def find(*args)\n ids = args.__find_args__\n raise_invalid if ids.any?(&:nil?)\n for_ids(ids).execute_or_raise(ids, args.multi_arged?)\n end",
"def find(id, optional = {})\n find_all([id], optional).first\n end",
"d... | [
"0.7570017",
"0.7398689",
"0.726684",
"0.71803963",
"0.7139692",
"0.7104075",
"0.71003926",
"0.70953596",
"0.7009323",
"0.6995737",
"0.69626355",
"0.6958065",
"0.69563603",
"0.69534457",
"0.6945278",
"0.6941221",
"0.6940916",
"0.6938451",
"0.69252723",
"0.692153",
"0.69206136... | 0.0 | -1 |
attr_accessor :players, :start_timer, :started, :finish_flag attr_reader :starting_sound, :music, :game_over_sound def initialize(players=1) | def game_over_text
Text.new("Game Over", color: 'orange', x: Window.width / 6, y: Window.height / 3, z: 1, size: 80) # need to find a way to make it centered and scaled with window size
Text.new("Press 'R' to restart", color: 'orange', x: (Window.width / 6) + 45, y: (Window.height / 3) + 85, z: 1, size: 40)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n self.player_hash = {}\n self.user_hash = {}\n self.playing_user_names=[]\n self.started = false\n self.disks_for_each_player=4#default\n self.shuffle_names = true\n end",
"def initialize(player)\n @player = player\n end",
"def initialize\n\n # On startup, assume mus... | [
"0.73524517",
"0.73506916",
"0.7229037",
"0.7215733",
"0.7198782",
"0.7171421",
"0.7103103",
"0.709612",
"0.7083085",
"0.70784146",
"0.7077692",
"0.70731634",
"0.70674944",
"0.7024349",
"0.7016983",
"0.696958",
"0.6967857",
"0.69076544",
"0.6904993",
"0.68827",
"0.68266225",
... | 0.0 | -1 |
GET /icomes/1 GET /icomes/1.json | def show
@icome = Icome.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @icome }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @experiment_biomechanical = ExperimentBiomechanical.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment_biomechanical }\n end\n end",
"def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # i... | [
"0.63075227",
"0.626157",
"0.62382036",
"0.6234618",
"0.6215815",
"0.6206675",
"0.61918247",
"0.6173541",
"0.6132568",
"0.6129017",
"0.6121705",
"0.6095726",
"0.6084141",
"0.60785836",
"0.60707396",
"0.6066736",
"0.6065762",
"0.60516524",
"0.6047337",
"0.60449815",
"0.6039095... | 0.7091643 | 0 |
GET /icomes/new GET /icomes/new.json | def new
@icome = Icome.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @icome }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @thing = Thing.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n end",
"def new\n @interesting = Interesting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interest... | [
"0.7360428",
"0.73581916",
"0.73581624",
"0.72970355",
"0.7215863",
"0.712866",
"0.7015207",
"0.7011244",
"0.70019805",
"0.6997052",
"0.6980332",
"0.6963859",
"0.69465125",
"0.69465125",
"0.6940887",
"0.6933443",
"0.69254947",
"0.6889972",
"0.6880738",
"0.68654084",
"0.686118... | 0.7676254 | 0 |
POST /icomes POST /icomes.json | def create
@icome = Icome.new(params[:icome])
respond_to do |format|
if @icome.save
format.html { redirect_to @icome, notice: 'Icome was successfully created.' }
format.json { render json: @icome, status: :created, location: @icome }
else
format.html { render action: "new" }
format.json { render json: @icome.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createCharities\n\tcharity_list = [\"Direct Relief\", \"Catholic Medical Mission Board\", \"MAP International\", \"United Nations Foundation\", \"The Rotary Foundation of Rotary International\", \"Samaritan's Purse\", \"Institute of International Education\", \"International Rescue Committee\", \"Compassion In... | [
"0.5795012",
"0.5752791",
"0.5645945",
"0.55474675",
"0.5447112",
"0.5443642",
"0.5397432",
"0.5395905",
"0.53814924",
"0.53669167",
"0.53457403",
"0.53420395",
"0.53363365",
"0.53102446",
"0.53069204",
"0.5304057",
"0.52766067",
"0.52694386",
"0.5268545",
"0.52385765",
"0.52... | 0.65722305 | 0 |
PUT /icomes/1 PUT /icomes/1.json | def update
@icome = Icome.find(params[:id])
respond_to do |format|
if @icome.update_attributes(params[:icome])
format.html { redirect_to @icome, notice: 'Icome was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @icome.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def put(*args)\n request :put, *args\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def put(id, json)\n with_endpoint do |endpoint|\n url = [en... | [
"0.622978",
"0.6066552",
"0.60259026",
"0.5992352",
"0.5986322",
"0.5944172",
"0.5943403",
"0.59099716",
"0.5884617",
"0.58782387",
"0.58176047",
"0.5701883",
"0.56877875",
"0.5642806",
"0.5615466",
"0.55889285",
"0.5588622",
"0.5584942",
"0.558493",
"0.55839026",
"0.55822134... | 0.64691037 | 0 |
DELETE /icomes/1 DELETE /icomes/1.json | def destroy
@icome = Icome.find(params[:id])
@icome.destroy
respond_to do |format|
format.html { redirect_to icomes_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @anything.destroy\n respond_to do |format|\n format.... | [
"0.71528244",
"0.6851649",
"0.68198633",
"0.6779597",
"0.67709005",
"0.67559874",
"0.6736724",
"0.67078704",
"0.6707748",
"0.6697663",
"0.66600794",
"0.66600794",
"0.66600794",
"0.66600794",
"0.66583514",
"0.6635848",
"0.6631323",
"0.6629502",
"0.6588127",
"0.6585304",
"0.655... | 0.722648 | 0 |
TO MACIG STUFF oN INIT | def index
@conversations = Conversation.involving(current_user)
conversations_new_message = Array.new
unread = 0
@conversations.each do |conversation|
conversation.last_message = ActionView::Base.full_sanitizer.sanitize(conversation.messages.order('created_at').last.body[0..75])
conversation.last_message_date = conversation.messages.order('created_at').last.created_at
conversation.count_unread = conversation.messages.unread(conversation.id, current_user).size
size = conversation.messages.unread(conversation.id, current_user).size
if size > 0
conversations_new_message.push(conversation)
unread = unread + size
end
@subs=current_user.subscribtions
end
conversations_new_message.each do |conversation|
set_messages_receive(conversation, false)
end
if unread > 0
if unread == 1
flash[:info] = t('welcome.you_have') + unread.to_s + t('welcome.unread_message')
else
flash[:info] = t('welcome.you_have') + unread.to_s + t('welcome.unread_messages')
end
end
@invites = Invite.by_recipient_id(current_user.id).order('id');
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def padding=(_arg0); end",
"def transform; end",
"def initialize\n\t@mac11 = Array.new\n\t@mac12 = Array.new\n\t@mac13 = Array.new\n\t@mac14 = Array.new\n\n @istr = String.new\n\ti = 0\n while ( i < CM_CMC_MSG_SIZE )\n @istr = @istr + ' '\n i = i + 1\n end\n end",
"d... | [
"0.56415665",
"0.55726504",
"0.54921144",
"0.547879",
"0.5465153",
"0.54463214",
"0.5415224",
"0.54039025",
"0.53972965",
"0.53878456",
"0.5378107",
"0.53609616",
"0.53578717",
"0.53529555",
"0.5344296",
"0.53322005",
"0.53272355",
"0.5301774",
"0.52455276",
"0.5243467",
"0.5... | 0.0 | -1 |
Returns true or false if the user is logged in. | def logged_in?
!!current_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_is_logged_in()\n user = get_user()\n if user != nil\n true\n else\n false\n end\n end",
"def logged_in?\n user._logged_in?\n end",
"def logged_in?\n if session[:username]\n if session[:logged_in?]\n return true\n end\n else\n r... | [
"0.8973362",
"0.8775968",
"0.8709158",
"0.8675256",
"0.8641435",
"0.8633322",
"0.86329544",
"0.8615168",
"0.86115885",
"0.86115885",
"0.86064714",
"0.8586828",
"0.858408",
"0.8578593",
"0.8565856",
"0.8565856",
"0.85308635",
"0.8526328",
"0.8526328",
"0.85232234",
"0.851801",... | 0.84752476 | 36 |
Accesses the current user from the session. Future calls avoid the database because nil is not equal to false. | def current_user
@current_user ||= login_from_session unless @current_user == false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user\n return nil if !session[:user]\n @user ||= fetch_user(session[:user])\n end",
"def user\n return nil if !session[:user]\n @user ||= fetch_user(session[:user])\n end",
"def user\n return nil if !session[:user]\n @user ||= fetch_user(session[:user])\n end",
"def... | [
"0.7964859",
"0.7964859",
"0.7964859",
"0.79274297",
"0.79269207",
"0.79119223",
"0.7894338",
"0.7890374",
"0.7885992",
"0.78757757",
"0.78721076",
"0.7864955",
"0.7859212",
"0.78524804",
"0.7850172",
"0.7841541",
"0.7833592",
"0.7831202",
"0.78277004",
"0.7819963",
"0.781797... | 0.7840912 | 16 |
Called from current_user. First attempt to login by the user id stored in the session. | def login_from_session
self.current_user = User.find_by_id(session[:user_id]) if session[:user_id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login_from_session\n self.current_user = User.find(session[:user_id]) if session[:user_id]\n end",
"def login_from_session\n self.current_user = User.find(session[:user_id]) if session[:user_id]\n end",
"def login_from_session\n self.current_user = User.find_by_id( session[ :user_id ] ) ... | [
"0.84740376",
"0.84740376",
"0.8404325",
"0.8352608",
"0.8280006",
"0.7980598",
"0.78989327",
"0.7846605",
"0.7675138",
"0.7612057",
"0.7590172",
"0.7568378",
"0.75255775",
"0.74937797",
"0.74930966",
"0.74859357",
"0.74751997",
"0.7442288",
"0.73781353",
"0.733913",
"0.73246... | 0.854995 | 0 |
POST /comments/watch?commentable_type=&commentable_id= DELETE /comments/watch?commentable_type=&commentable_id= | def watch
klass = params[:commentable_type].constantize
@commentable = klass.find(params[:commentable_id])
authorize! :read, @commentable
if request.post?
User.create_action(:watch_comment, target: @commentable, user: current_user, action_option: "watch")
else
User.create_action(:watch_comment, target: @commentable, user: current_user, action_option: "ignore")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @commentable = @comment.commentable\n @comment.destroy\n respond_to do |format|\n format.js\n end\n end",
"def destroy\n if @commentable.comments.find(params[:id]).destroy\n render json: { success: true }\n end\n end",
"def destroy\n @comment = @commentabl... | [
"0.65277755",
"0.6377914",
"0.63224655",
"0.63129306",
"0.61909795",
"0.6085293",
"0.60674876",
"0.5994362",
"0.589722",
"0.5810435",
"0.57966363",
"0.5791599",
"0.5781984",
"0.5760412",
"0.5753952",
"0.57530266",
"0.57439554",
"0.5743916",
"0.5708132",
"0.5698728",
"0.569828... | 0.76093477 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_comment
@comment = Comment.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def comment_params
params.require(:comment).permit(:commentable_type, :commentable_id, :parent_id, :body, :body_sml)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
Each subarray will have strings which are anagrams of each other Time Complexity: O(n) Space Complexity: O(n) | def grouped_anagrams(strings)
anagram_hash = Hash.new
strings.each do |word|
sorted_string = word.chars.sort.join
#Check if key exists with the sorted string already
#In case of yes, add the word to the array value of the key
if anagram_hash[sorted_string]
anagram_hash[sorted_string] += [word]
#If not, set it as a new key/value pair in the hash
else
anagram_hash[sorted_string] = [word]
end
end
return anagram_hash.valuesend
# This method will return the k most common elements
# in the case of a tie it will select the first occuring element.
# Time Complexity: O(n)
# Space Complexity: O(n)
def top_k_frequent_elements(list, k)
result = []
hash = Hash.new
list.each do |letter|
if hash[letter]
hash[letter] += 1
else
hash[letter] = 1
end
end
k.times do
max = nil
hash.each do |num, value|
if value && (max.nil? || value > max)
max = num
end
end
if max
hash[max] = nil
result << max
end
end
return result end
# This method will return the true if the table is still
# a valid sudoku table.
# Each element can either be a ".", or a digit 1-9
# The same digit cannot appear twice or more in the same
# row, column or 3x3 subgrid
# Time Complexity: ?
# Space Complexity: ?
def valid_sudoku(table)
raise NotImplementedError, "Method hasn't been implemented yet!"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def anagrams(string, array)\nend",
"def group_anagrams(arr)\n hash = Hash.new { |h, k| h[k] = [] }\n arr.each do |str|\n hash[str.chars.sort] << str\n end\n\n hash.values.map(&:sort)\nend",
"def anagrams(array)\n copy_array = array.dup\n result_array = []\n iteration_idx = 0\n until copy_array.empty... | [
"0.82607365",
"0.8116609",
"0.8013546",
"0.7961589",
"0.7948613",
"0.79357815",
"0.7876695",
"0.78764564",
"0.7827808",
"0.7822503",
"0.7812935",
"0.77536184",
"0.7747899",
"0.77344936",
"0.77337384",
"0.7730931",
"0.7728759",
"0.77082986",
"0.7702456",
"0.7702253",
"0.767874... | 0.0 | -1 |
This method will return the k most common elements in the case of a tie it will select the first occuring element. Time Complexity: O(n) Space Complexity: O(n) | def top_k_frequent_elements(list, k)
result = []
hash = Hash.new
list.each do |letter|
if hash[letter]
hash[letter] += 1
else
hash[letter] = 1
end
end
k.times do
max = nil
hash.each do |num, value|
if value && (max.nil? || value > max)
max = num
end
end
if max
hash[max] = nil
result << max
end
end
return result end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top_k_frequent_elements(list, k)\n results = []\n\n return list if list.length == k\n return results if list.length == 0 \n\n list = list.sort.uniq\n\n i = 0\n k.times do \n results << list[i]\n i += 1\n end \n return results\nend",
"def top_k_frequent_elements(list, k)\n result_arr = []\n re... | [
"0.8274519",
"0.8235083",
"0.82255286",
"0.8201063",
"0.8198959",
"0.81717825",
"0.81675684",
"0.8158951",
"0.81535006",
"0.8152905",
"0.81302035",
"0.81290895",
"0.81058466",
"0.80998975",
"0.8096886",
"0.8062835",
"0.8052698",
"0.8042175",
"0.8035827",
"0.80031466",
"0.7986... | 0.8150817 | 10 |
This method will return the true if the table is still a valid sudoku table. Each element can either be a ".", or a digit 19 The same digit cannot appear twice or more in the same row, column or 3x3 subgrid Time Complexity: ? Space Complexity: ? | def valid_sudoku(table)
raise NotImplementedError, "Method hasn't been implemented yet!"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_sudoku(table)\n table.each do |row|\n row_map = {}\n row.each do |elem|\n if elem != '.'\n if row_map[elem] \n return false\n else\n row_map[elem] = 1\n end\n end\n end\n end\n \n i = 0\n 9.times do\n column_map = {}\n table.each do |row|\n... | [
"0.8212062",
"0.8189767",
"0.81472987",
"0.80699843",
"0.80013365",
"0.7923469",
"0.78971994",
"0.76089597",
"0.7595211",
"0.73546684",
"0.7339686",
"0.7301575",
"0.7012136",
"0.6995036",
"0.697842",
"0.69175667",
"0.6853357",
"0.6807671",
"0.6776444",
"0.6755473",
"0.6710372... | 0.6490444 | 49 |
Places robot on the table | def place(x, y, buddy)
# Skip invalid states, when the buddy may fall down from the table
if validate_pos(x, y)
buddy.x = x
buddy.y = y
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def place_robot(new_place, direction)\n if @table_top.move_robot(new_place)\n @toy_place = new_place\n @toy_direction = direction\n end\n end",
"def place_robot(robot, x, y, direction)\n return false unless position_valid?(x, y)\n\n robot.remove if robot.table\n\n robot.instance_v... | [
"0.71289927",
"0.660013",
"0.65822315",
"0.65517014",
"0.65369964",
"0.6439933",
"0.63989305",
"0.63843757",
"0.6320665",
"0.63050216",
"0.62543577",
"0.6253614",
"0.6249276",
"0.62326777",
"0.62162423",
"0.6211203",
"0.6197198",
"0.616257",
"0.6147079",
"0.6128484",
"0.61132... | 0.0 | -1 |
Moves the robot one unit according the its current facing | def move(buddy)
x = buddy.x
y = buddy.y
case
when buddy.orient == Buddy::NORTH then y += 1
when buddy.orient == Buddy::SOUTH then y -= 1
when buddy.orient == Buddy::EAST then x += 1
when buddy.orient == Buddy::WEST then x -= 1
end
if validate_pos(x, y)
# Set buddy position only if the future is valid
buddy.x = x
buddy.y = y
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_forward\n new_location = @location + facing_direction.coordinate_component\n \n if !surface.within_bounds?(new_location)\n raise OutOfBoundaryError, \"The movement has put the robot out of boundaries\"\n end\n \n @location = new_location\n self\n end",
"def f... | [
"0.7247961",
"0.7131725",
"0.7057966",
"0.704066",
"0.69752014",
"0.69297004",
"0.68995297",
"0.67977434",
"0.6795773",
"0.66788924",
"0.66527456",
"0.6635252",
"0.6599254",
"0.65729797",
"0.654845",
"0.654327",
"0.6513447",
"0.64954364",
"0.6485316",
"0.64700204",
"0.6470020... | 0.0 | -1 |
Validates coordinated according to table sizes | def validate_pos(x, y)
return x.between?(0, @size_x - 1) && y.between?(0, @size_y - 1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_size\n @num_mines <= MAX_SIZE\n end",
"def check_params(x,y)\n if (x.to_i > self.table_size_x || x.to_i < 0) || (y.to_i > self.table_size_y || y.to_i < 0)\n return false\n else\n return true\n end\n end",
"def validate_entry_sizes; end",
"def validate_entry_sizes=(_arg0);... | [
"0.6683595",
"0.6487267",
"0.6484596",
"0.6236838",
"0.62367046",
"0.6098932",
"0.60927933",
"0.60679364",
"0.5877272",
"0.5874671",
"0.58619785",
"0.58619785",
"0.58619785",
"0.5829751",
"0.58282715",
"0.5826025",
"0.57742274",
"0.57713485",
"0.5735161",
"0.57350624",
"0.563... | 0.0 | -1 |
Execute the step on a given set of records | def perform(messages = nil, params = {}, &block)
logger.debug "#{self}(#{params.inspect}) <- #{messages}"
return to_enum(:perform, messages, params) unless block_given?
wrap_input(messages).each do |m|
run_callbacks :perform do
logger.debug "#{object_id} -> #{m}"
result = perform_one(m, params)
handle_result(m, result, &block)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute(step)\n end",
"def process_batch(records)\n benchmarks[:processing] << Benchmark.realtime do\n records.each do |record|\n next if skip_before_transform?(record)\n invoke_callback(:before_each, record)\n attrs = transformer.run(record)\n n... | [
"0.6176198",
"0.6162629",
"0.60867375",
"0.60436374",
"0.59226406",
"0.5849183",
"0.5819848",
"0.58031684",
"0.57502186",
"0.57264334",
"0.57128054",
"0.56950057",
"0.5691858",
"0.56801975",
"0.56704354",
"0.5600656",
"0.55922997",
"0.5591342",
"0.5585435",
"0.55600095",
"0.5... | 0.0 | -1 |
GET /projects/1 GET /projects/1.xml | def show
if params[:unit_id]
@project = Unit.find(params[:unit_id]).project
else
@project = Project.find(params[:id])
end
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @project }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html\n format.xml { render xml: @projects } # index.html.erb\n end\n end",
"def index\n @projects = @client.projects\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @p... | [
"0.7413227",
"0.7349132",
"0.7223439",
"0.7223439",
"0.72199285",
"0.7193906",
"0.7157614",
"0.7023897",
"0.70230466",
"0.7021735",
"0.7011579",
"0.69437915",
"0.69343835",
"0.69343835",
"0.69343835",
"0.69343835",
"0.69343835",
"0.69343835",
"0.69343835",
"0.69343835",
"0.69... | 0.0 | -1 |
Download the specified gem and return the binary file contents as a string | def download_gem(name, version)
cached = GemCache.get(name, version)
return cached unless cached.nil?
client.url = "https://rubygems.org/gems/#{name}-#{version}.gem"
client.follow_location = true
client.http_get
gemf = client.body_str
GemCache.set(name, version, gemf)
gemf
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_gem\n self.class.download_gem @name, @version\n end",
"def download_gem\n self.class.download_gem @name, @version\n end",
"def download\n open(download_url, \"rb\")\n end",
"def download(spec, dir=Dir.pwd)\n fetcher = Gem::RemoteFetcher.fetcher\n fetcher.downloa... | [
"0.75472873",
"0.7486909",
"0.6622866",
"0.6573864",
"0.64689964",
"0.63826466",
"0.63501334",
"0.6331256",
"0.63282627",
"0.62561774",
"0.6245985",
"0.6192359",
"0.61806095",
"0.6175835",
"0.6166896",
"0.6119817",
"0.6119169",
"0.611227",
"0.61119896",
"0.60937846",
"0.60874... | 0.6456606 | 5 |
Download the specified gem / version from rubygems and return instance of Polisher::Gem class corresponding to it | def from_rubygems(name, version)
download_gem name, version
from_gem downloaded_gem_path(name, version)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upstream_gem\n @gem ||= Polisher::Gem.from_rubygems gem_name, version\n end",
"def download_gem\n self.class.download_gem @name, @version\n end",
"def fetch_gem(name, version)\n http_get(host + \"/gems/#{name}-#{version}.gem\").body\n end",
"def download_gem\n self.... | [
"0.7318445",
"0.7236806",
"0.7141415",
"0.7096529",
"0.6908627",
"0.6807149",
"0.67806834",
"0.6585169",
"0.6513129",
"0.6316885",
"0.62922263",
"0.62437034",
"0.6154554",
"0.609442",
"0.609442",
"0.60709417",
"0.6057071",
"0.6012145",
"0.60067034",
"0.60067034",
"0.60067034"... | 0.6783137 | 6 |
Returns path to downloaded gem | def downloaded_gem_path(name, version)
# ensure gem is downloaded
download_gem name, version
GemCache.path_for(name, version)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gem_path\n @path || downloaded_gem_path\n end",
"def downloaded_gem_path\n self.class.downloaded_gem_path @name, @version\n end",
"def gem_path\n @path || downloaded_gem_path\n end",
"def downloaded_gem_path\n self.class.downloaded_gem_path @name, @version\n end",
... | [
"0.8588547",
"0.8568333",
"0.8475193",
"0.8451593",
"0.75416505",
"0.75260943",
"0.720036",
"0.712495",
"0.7109253",
"0.70687413",
"0.70687413",
"0.69560844",
"0.69488424",
"0.6894721",
"0.68525195",
"0.6821006",
"0.6809589",
"0.6809589",
"0.67988205",
"0.67939615",
"0.669767... | 0.76494867 | 4 |
Retrieve latest gem metadata and contents from rubygems.org | def retrieve_latest(name)
client.url = "https://rubygems.org/api/v1/gems/#{name}.json"
client.http_get
spec = client.body_str
gem = parse spec
gem
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_gem(name, version)\n http_get(host + \"/gems/#{name}-#{version}.gem\").body\n end",
"def gem_info(gem, client)\n gem_data = {}\n uri = (\n Gems.info(gem)['source_code_uri'] || Gems.info(gem)['homepage_uri']).sub!(%r{http.*com/}, '')\n repo = repository(uri, client)\n contributo... | [
"0.6909436",
"0.67987716",
"0.6710202",
"0.66781497",
"0.6618561",
"0.6537107",
"0.6537107",
"0.6492002",
"0.6484249",
"0.6458951",
"0.6332161",
"0.63310087",
"0.632336",
"0.6286475",
"0.6163504",
"0.6142461",
"0.61202216",
"0.6107243",
"0.609859",
"0.60928434",
"0.6092",
"... | 0.7547621 | 0 |
Retrieve specified metadata and contents for gem version from rubygems.org | def retrieve_version(name, version)
path = downloaded_gem_path name, version
parse :gem => path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_gem(name, version)\n http_get(host + \"/gems/#{name}-#{version}.gem\").body\n end",
"def gem_info(gem, client)\n gem_data = {}\n uri = (\n Gems.info(gem)['source_code_uri'] || Gems.info(gem)['homepage_uri']).sub!(%r{http.*com/}, '')\n repo = repository(uri, client)\n contributo... | [
"0.71865034",
"0.7092944",
"0.70280266",
"0.6797405",
"0.6755265",
"0.66122746",
"0.65205914",
"0.6501583",
"0.64017546",
"0.6397741",
"0.6397741",
"0.6397741",
"0.6397741",
"0.6397741",
"0.6397741",
"0.6392963",
"0.6392963",
"0.6373492",
"0.6294051",
"0.626325",
"0.62624896"... | 0.6815901 | 3 |
Retrieve gem metadata and contents from rubygems.org | def retrieve(name, version=nil)
version.nil? ? retrieve_latest(name) : retrieve_version(name, version)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gem_info(gem, client)\n gem_data = {}\n uri = (\n Gems.info(gem)['source_code_uri'] || Gems.info(gem)['homepage_uri']).sub!(%r{http.*com/}, '')\n repo = repository(uri, client)\n contributors_count = contributors(uri).css('span.num.text-emphasized').children[2].text.to_i\n used_by_count = d... | [
"0.7005347",
"0.6759509",
"0.6674162",
"0.6654798",
"0.64056635",
"0.6361099",
"0.6296212",
"0.6260598",
"0.6250646",
"0.6250646",
"0.6250646",
"0.6250646",
"0.6250646",
"0.6250646",
"0.6250646",
"0.6250646",
"0.6243775",
"0.62309426",
"0.6191825",
"0.6189159",
"0.6166987",
... | 0.0 | -1 |
Retrieve latest version of gem matching dep | def latest_matching(dep)
version = latest_version_matching(dep)
raise RuntimeError, "no version found" if version.nil?
retrieve dep.name, version
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def latest_version_matching(dep)\n version = versions_matching(dep).collect { |v| ::Gem::Version.new v }.max\n version.nil? ? nil : version.to_s\n end",
"def latest_version(gem_name, pre: false)\n return versions(gem_name).first if pre\n versions(gem_name).find { |version| !versi... | [
"0.8244557",
"0.7792762",
"0.76194817",
"0.7469064",
"0.74484146",
"0.73296195",
"0.7291352",
"0.71392804",
"0.70718825",
"0.70357835",
"0.70006084",
"0.6985557",
"0.6905778",
"0.6897987",
"0.68828255",
"0.6881632",
"0.6877673",
"0.68730646",
"0.6867428",
"0.6809918",
"0.6798... | 0.8405214 | 0 |
Retrieve earliest version of gem matching dep | def earliest_matching(dep)
version = earliest_version_matching(dep)
raise RuntimeError, "no version found" if version.nil?
retrieve dep.name, version
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def earliest_version_matching(dep)\n version = versions_matching(dep).collect { |v| ::Gem::Version.new v }.min\n version.nil? ? nil : version.to_s\n end",
"def latest_version_matching(dep)\n version = versions_matching(dep).collect { |v| ::Gem::Version.new v }.max\n version.nil? ... | [
"0.88362706",
"0.7383093",
"0.72318274",
"0.6998485",
"0.69249725",
"0.6920941",
"0.6867914",
"0.67370117",
"0.6648179",
"0.6630547",
"0.6561474",
"0.64380574",
"0.6429268",
"0.6398479",
"0.63848245",
"0.6306309",
"0.6301754",
"0.6299568",
"0.62795097",
"0.62770534",
"0.62758... | 0.84916043 | 1 |
Retrieve gem version matching target | def matching_target(dep, target)
version = version_matching_target(dep, target)
raise RuntimeError, "no matching version" if version.nil?
retrieve dep.name, version
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def version_matching_target(dep, target)\n version = versions_in_target(dep.name, target).select { |v| dep.match? dep.name, v }\n .collect { |v| ::Gem::Version.new v }.max\n version.nil? ? nil : version.to_s\n end",
"def latest_version_in... | [
"0.77710587",
"0.7648248",
"0.72615856",
"0.7225043",
"0.7225043",
"0.6770758",
"0.67486954",
"0.64922297",
"0.64316857",
"0.63674563",
"0.63640505",
"0.6348724",
"0.63398993",
"0.63303256",
"0.6328526",
"0.63195586",
"0.631123",
"0.6306422",
"0.6300118",
"0.62801117",
"0.618... | 0.7471806 | 2 |
Retrieve version of gem matching dep and specifier | def matching(dep, specifier)
case specifier
when LATEST_SPECIFIER
latest_matching(dep)
when EARLIEST_SPECIFIER
earliest_matching(dep)
else
matching_target(dep, specifier)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def latest_version_matching(dep)\n version = versions_matching(dep).collect { |v| ::Gem::Version.new v }.max\n version.nil? ? nil : version.to_s\n end",
"def get_version_req(dep)\n req = get_key_or_sym(dep, :version_requirement)\n req ||= get_key_or_sym(dep, :version_range)\n req\n e... | [
"0.73891175",
"0.7324341",
"0.7212548",
"0.7115163",
"0.7008669",
"0.70082515",
"0.69223344",
"0.68237895",
"0.6801502",
"0.67808264",
"0.6700113",
"0.6700113",
"0.6687725",
"0.6654289",
"0.66480625",
"0.66310465",
"0.6622294",
"0.66155773",
"0.6593339",
"0.65726244",
"0.6545... | 0.0 | -1 |
Retrieve latest version of gem in target | def latest_in_target(name, target)
version = latest_version_in_target(name, target)
raise RuntimeError, "no matching version" if version.nil?
retrieve name, version
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def latest_version_in_target(name, target)\n versions_in_target(name, target).collect { |v| ::Gem::Version.new v }.max\n end",
"def latest_version(module_name)\n versions(module_name).last\n end",
"def latest_version(gem_name, pre: false)\n return versions(gem_name).first if pre\n ... | [
"0.7854426",
"0.74819744",
"0.7322488",
"0.72508657",
"0.7245595",
"0.7161212",
"0.7131202",
"0.71140045",
"0.706569",
"0.7040538",
"0.70030904",
"0.69820124",
"0.6968745",
"0.69412816",
"0.69284654",
"0.6922672",
"0.69146144",
"0.69102955",
"0.69070584",
"0.6899313",
"0.6899... | 0.7759147 | 1 |
module ClassMethods Download the local gem and return it as a string | def download_gem
self.class.download_gem @name, @version
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_gem\n self.class.download_gem @name, @version\n end",
"def gem_path\n @path || downloaded_gem_path\n end",
"def downloaded_gem_path\n self.class.downloaded_gem_path @name, @version\n end",
"def gem_path\n @path || downloaded_gem_path\n end",
"def downloa... | [
"0.7213154",
"0.6753743",
"0.6710639",
"0.66692287",
"0.6586051",
"0.6453498",
"0.6374388",
"0.63688445",
"0.61961573",
"0.61261266",
"0.6104272",
"0.60967845",
"0.6090408",
"0.6082866",
"0.6081862",
"0.60184836",
"0.59918666",
"0.59887403",
"0.5980656",
"0.59715223",
"0.5948... | 0.73404676 | 0 |
Return path to downloaded gem | def downloaded_gem_path
self.class.downloaded_gem_path @name, @version
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gem_path\n @path || downloaded_gem_path\n end",
"def gem_path\n @path || downloaded_gem_path\n end",
"def downloaded_gem_path\n self.class.downloaded_gem_path @name, @version\n end",
"def downloaded_gem_path(name, version)\n # ensure gem is downloaded\n downl... | [
"0.86328757",
"0.8511787",
"0.8444249",
"0.764266",
"0.7624339",
"0.7498303",
"0.71763456",
"0.70950896",
"0.70950896",
"0.7091811",
"0.7047844",
"0.7008313",
"0.7005286",
"0.69122773",
"0.6885031",
"0.6885031",
"0.68829566",
"0.68764734",
"0.6868022",
"0.68548036",
"0.678479... | 0.8569027 | 1 |
Return user's full name for display | def name(formatter = :first_last)
if formatter
eval('"' + (USER_FORMATS[formatter] || USER_FORMATS[:first_name_last_name]) + '"')
else
@name ||= eval('"' + (USER_FORMATS[Setting.user_format] || USER_FORMATS[:first_name_last_name]) + '"')
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_name\n if user_data\n \"#{user_data['first_name']&.downcase&.capitalize} #{user_data['last_name']&.downcase&.capitalize}\"\n end\n end",
"def user_full_name\n if user\n user.first_name + ' ' + user.last_name\n else\n 'Anonymous'\n end\n end",
"de... | [
"0.8776414",
"0.868374",
"0.8585989",
"0.85622734",
"0.85540235",
"0.8520409",
"0.8489057",
"0.8476972",
"0.836573",
"0.8358091",
"0.8353521",
"0.8322302",
"0.8317349",
"0.8301317",
"0.82975614",
"0.82645774",
"0.8261927",
"0.82473344",
"0.82256263",
"0.8222661",
"0.8221144",... | 0.0 | -1 |
This only formats MMYYYY | def format_month_year(date)
date.strftime("%Y-%b")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_date(month, year)\n \"#{format(month,:two_digits)}/#{format(year, :two_digits)}\"\n end",
"def format_date(month, year)\n \"#{format(month,:two_digits)}/#{format(year, :two_digits)}\"\n end",
"def format_ap_date(date_obj)\n date_obj = DateTime.parse(date_obj) unless date_obj... | [
"0.71196556",
"0.71196556",
"0.6733248",
"0.67012584",
"0.6603148",
"0.65891355",
"0.65476215",
"0.6544962",
"0.6523477",
"0.6468496",
"0.6459266",
"0.64371973",
"0.6404232",
"0.6392666",
"0.63622385",
"0.6317562",
"0.6307046",
"0.62962246",
"0.6293782",
"0.62904775",
"0.6253... | 0.713793 | 0 |
The return reserved word is not required in order to return something from a method | def just_assignment(number)
foo = number + 3
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def returns; end",
"def return_value; end",
"def return_a_value\n \"Nice\"\nend",
"def method_with_explicit_return\n :a_non_return_value\n return :return_value\n :another_non_return_value\n end",
"def return_type; end",
"def return_type; end",
"def return_type; end",
"def a \n return 1\... | [
"0.83451164",
"0.7845633",
"0.75585055",
"0.75006557",
"0.7370031",
"0.7370031",
"0.7370031",
"0.73550564",
"0.7283366",
"0.71213615",
"0.7119428",
"0.7034524",
"0.7026671",
"0.7023651",
"0.70214653",
"0.7007164",
"0.70053715",
"0.69983065",
"0.6961716",
"0.6961716",
"0.69617... | 0.0 | -1 |
Determines all of the attributes defined for a controller, then, calls the handler method on the controller to generate and return an Array of Hashes representing all of the url nodes to be included in the sitemap for the current route being processed. | def sitemap_setup(options = {})
rows = []
DuckMap.logger.debug "sitemap_setup: action_name => #{options[:action_name]} source => #{options[:source]} model => #{options[:model]}"
attributes = self.sitemap_attributes(options[:action_name])
DuckMap.logger.debug "sitemap_setup: attributes => #{attributes}"
if attributes.kind_of?(Hash) && attributes[:handler].kind_of?(Hash) && !attributes[:handler][:action_name].blank?
config = {handler: attributes[:handler]}.merge(options)
rows = self.send(attributes[:handler][:action_name], config)
end
return rows
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_controller_parameters\n generate_routes_file\n controller_files, paths_to_hit = fetch_controllers, []\n controller_files.each do |file_name|\n file, controller = File.expand_path(file_name, \"#{Rails.root}/app/controllers\"), file_name.split('_controller').first\n paths_to_hi... | [
"0.59049433",
"0.57854116",
"0.5594955",
"0.55681175",
"0.5511554",
"0.5492239",
"0.54193693",
"0.54131967",
"0.53821677",
"0.53550595",
"0.53530216",
"0.5347042",
"0.53442514",
"0.53152317",
"0.53100294",
"0.5307648",
"0.5292911",
"0.52542704",
"0.52397615",
"0.5237427",
"0.... | 0.5457129 | 6 |
Returns the date / time value from config/locale/sitemap.yml associated with the current controller / action. The static date/times are actual timestamps extracted from the date of the view on disk and from a .git repository if used. Be sure to run the generator or rake task: duck_map:sync to populate the locale file at: config/locale/sitemap.yml | def sitemap_static_lastmod(my_controller_name = nil, my_action_name = nil)
value = nil
unless my_controller_name.blank? || my_action_name.blank?
unless my_controller_name.blank?
my_controller_name = my_controller_name.underscore
my_controller_name = my_controller_name.gsub("/", ".")
end
begin
value = I18n.t("#{my_controller_name.downcase}.#{my_action_name.downcase}", default: "", locale: :sitemap)
rescue Exception => e
DuckMap.logger.exception(e)
end
value = value.blank? ? nil : LastMod.to_date(value)
end
return value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schedule_info\n\n Time.at(@at)\n end",
"def system_modified_dtsi\n Time.parse get('system_modified_dtsi')\n end",
"def deployed_at() ; info_time(:deployed_datetime) ; end",
"def deployed_at() ; info_time(:deployed_datetime) ; end",
"def get_request_timestamp\n\t\treturn @... | [
"0.57362396",
"0.5731056",
"0.5713031",
"0.5713031",
"0.56561637",
"0.56265986",
"0.5583622",
"0.548209",
"0.53863734",
"0.53863734",
"0.53863734",
"0.5386075",
"0.53558856",
"0.53481543",
"0.5327672",
"0.53198487",
"0.5304827",
"0.52979004",
"0.5290553",
"0.5285355",
"0.5278... | 0.71463656 | 0 |
j=job job remainder email | def sitter_request_remainder
# puts "puts remainder====================="
jobs_to_send = Job.find(:all, :conditions => ["date_from <= ? AND notification_sent IS NOT true", 2.days.from_now])
jobs_to_send.each do |j|
unless j.parent_id.nil? || j.sitter_id.nil? || (j.status == 'cancelled')
parent = Parent.find(j.parent_id)
sitter = Sitter.find(j.sitter_id)
if parent.profile.text_message
#Notifications.deliver_parent_job_sms_reminder(parent, sitter, j)
end
if parent.profile.email
Notifications.deliver_parent_job_reminder(parent, sitter, j)
end
if sitter.profile.text_message
#Notifications.deliver_sitter_job_sms_reminder(parent, sitter, j)
end
if sitter.profile.email
Notifications.deliver_sitter_job_reminder(parent, sitter, j)
end
j.notification_sent = true
j.save
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_job_result(jlh)\n return unless email_result?(jlh)\n email_expression = Regexp.new('EMAIL_RESULT_BELOW:(.*)EMAIL_RESULT_ABOVE',Regexp::MULTILINE)\n match = email_expression.match(jlh[:job_result])\n jmd = jlh[:jmd]\n jle = jlh[:jle]\n if (match.nil?)\n $logger.debug(\"The output fo... | [
"0.7358816",
"0.7157537",
"0.6881045",
"0.67670995",
"0.67127216",
"0.66852236",
"0.6666788",
"0.65974325",
"0.6585557",
"0.64286643",
"0.64198047",
"0.6322806",
"0.63017726",
"0.62776107",
"0.62386376",
"0.62378985",
"0.6217127",
"0.6202325",
"0.6202325",
"0.62008697",
"0.61... | 0.6372643 | 11 |
copy from the key's data using the glob pattern | def nuspec_copy(key, glob)
puts "key: #{key}, glob: #{glob}, proj dir: #{PROJECTS[key][:dir]}"
FileList[File.join(FOLDERS[:binaries], PROJECTS[key][:dir], glob)].collect{ |f|
to = File.join( FOLDERS[:"#{key}"][:nuspec], "lib", FRAMEWORK )
FileUtils.mkdir_p to
cp f, to
# return the file name and its extension:
File.join(FRAMEWORK, File.basename(f))
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_tree_to(key, source_root, source_key)\n source_root.unprefixed_subtree_keys(source_key).each do |unprefixed_key|\n copy_content_to(File.join(key, unprefixed_key), source_root, File.join(source_key, unprefixed_key))\n end\n end",
"def nuspec_copy(key, glob)\r\n puts \"key: #{key}, glob: #{... | [
"0.6027272",
"0.5952779",
"0.5875576",
"0.5826581",
"0.5565297",
"0.5502867",
"0.54241097",
"0.53902346",
"0.53886354",
"0.53438026",
"0.53034526",
"0.52869344",
"0.5276853",
"0.5276853",
"0.52369374",
"0.5235098",
"0.51434904",
"0.5128714",
"0.5125614",
"0.5124747",
"0.51005... | 0.60046256 | 1 |
API methods api/campaigns (all campaigns) api/campaigns/active (all active campaigns) api/:country/campaigns (campaigns in country) api/:country/campaigns/active (active campaigns in country) | def api_index
campaigns = Campaign.all
campaigns = campaigns.for_country(params[:country].presence) if params[:country]
campaigns = campaigns.active if 'active' == params[:status]
respond_to do |format|
format.json { render json: campaigns }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def campaigns(options={})\n response = connection.get do |req|\n \treq.url \"campaigns\", options\n end\n return_error_or_body(response)\n \tend",
"def campaign_find_active\n call_api(:campaign_find_active)\n end",
"def get_campaigns_with_http_info(opts = {})\n if @api_cli... | [
"0.70781124",
"0.6772431",
"0.6720626",
"0.6612099",
"0.6534977",
"0.64728206",
"0.6457495",
"0.63592166",
"0.6358737",
"0.62297285",
"0.619548",
"0.6191473",
"0.61860263",
"0.6166906",
"0.6166906",
"0.6166906",
"0.61664605",
"0.6122602",
"0.6113763",
"0.61098367",
"0.6097153... | 0.8253609 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_campaign
@campaign = Campaign.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def campaign_params
params[:campaign].permit(:name, :budget, :start_date, :end_date, :in_pause, :link, :country_code, :creative, :advertiser_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Updates the both Event and Idea/Transportation/Notes models. Idea model's title is copied from Event model. | def update
@event = Event.find(params[:id])
if @event.eventable_type == "Activity" or @event.eventable_type == "Hotel" or @event.eventable_type == "Foodanddrink"
@idea = Idea.find(@event.eventable_id)
respond_to do |format|
if @event.update_attributes(params[:event]) and @idea.update_attributes(params[:idea])
format.html { redirect_to show_new_visitor_trip_path(:id => @trip, :view => params[:view]) } if new_visitor_created_trip?
format.html { redirect_to trip_path(:id => @trip, :view => params[:view]) }
format.js
else
flash[:error] = "There seems to be an error updating the note."
format.html { redirect_to trip_path(:id => @trip, :view => params[:view]) }
end
end
elsif @event.eventable_type == "Transportation"
@transportation = Transportation.find(@event.eventable_id)
@event.title = CGI::escapeHTML(params[:transportation][:from]) + " → " + CGI::escapeHTML(params[:transportation][:to])
respond_to do |format|
if @transportation.update_attributes(params[:transportation]) and @event.update_attributes(params[:event])
format.html { redirect_to show_new_visitor_trip_path(:id => @trip, :view => params[:view]) } if new_visitor_created_trip?
format.html { redirect_to trip_path(:id => @trip, :view => params[:view]) }
format.js
else
flash[:error] = "There seems to be an error updating the transportation."
format.html { redirect_to trip_path(:id => @trip, :view => params[:view]) }
end
end
elsif @event.eventable_type == "Notes"
@notes = Notes.find(@event.eventable_id)
tmp_notes = Notes.new(params[:notes])
@event = tmp_notes.create_notes(@event, @trip)
respond_to do |format|
if @event.update_attributes(params[:event]) and @notes.update_attributes(params[:notes])
format.html { redirect_to show_new_visitor_trip_path(:id => @trip, :view => params[:view]) } if new_visitor_created_trip?
format.html { redirect_to trip_path(:id => @trip, :view => params[:view]) }
format.js
else
flash[:error] = "There seems to be an error updating your note."
format.html { redirect_to trip_path(:id => @trip, :view => params[:view]) }
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @idea_event = IdeaEvent.find(params[:id])\n\n respond_to do |format|\n if @idea_event.update_attributes(params[:idea_event])\n format.html { redirect_to @idea_event, notice: 'Idea event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { ... | [
"0.6033221",
"0.5766155",
"0.5753449",
"0.5753449",
"0.5720658",
"0.56744754",
"0.5643645",
"0.56246233",
"0.561939",
"0.5604081",
"0.5591615",
"0.5591615",
"0.5591615",
"0.5591615",
"0.5579878",
"0.55676687",
"0.5543988",
"0.55154854",
"0.55154854",
"0.551388",
"0.5500097",
... | 0.6241192 | 0 |
This will read a given test case and pass that into the test_case_processor. A test case is defined as the number of lines_per_test_case Can optionally pass in a line_processor that will process a line before adding it to the buffer. Will stop reading after we hit the number of test cases defined in the file Assumption: Number of test cases is defined in the first line | def parse(test_case_processor, line_processor = nil)
(raise ArgumentError.new('Missing input filename to parse')) unless @filename
line_counter = -1
test_cases_read = 0
test_cases = 0
line_buffer = []
IO.foreach(@filename) do |line|
line.strip!
# read number of cases
if line_counter == -1
test_cases = line.to_i
# if unable to parse or we get 0, blow up
raise ArgumentError.new('Missing number of test cases on first line') if test_cases == 0
line_counter = 0
# process the test case
elsif line_counter == (lines_per_test_case - 1)
line = line_processor.call(line) if line_processor
line_buffer << line
test_cases_read += 1
test_case_processor.call(line_buffer, test_cases_read)
line_buffer = []
line_counter = 0
return if test_cases_read == test_cases
# keep reading
else
line = line_processor.call(line) if line_processor
line_buffer << line
line_counter += 1
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_testcase(line_buffer)\n line_buffer\n end",
"def process_block(line_buffer, test_number)\n if (@custom_processor && @custom_processor.class.method_defined?(:process_testcase))\n @custom_processor.process_testcase line_buffer\n else\n line_buffer\n end\n end",
"de... | [
"0.6840313",
"0.6714628",
"0.61795497",
"0.6089046",
"0.56071186",
"0.5429095",
"0.53580374",
"0.5227789",
"0.51999575",
"0.5108008",
"0.5098291",
"0.5067358",
"0.5023306",
"0.5021187",
"0.498296",
"0.49813312",
"0.4975683",
"0.497382",
"0.49237415",
"0.4920486",
"0.4916869",... | 0.8160645 | 0 |
Method that takes a block | def block_print
puts "Before the block!"
yield(10)
puts "After the block!"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end"... | [
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916",
"0.87174916"... | 0.0 | -1 |
Creates a space based on space_form data and returns new space | def call(space_form)
Space.transaction do
space = build_space(space_form)
org_dxs = [space.host_dxorg, space.guest_dxorg].uniq.compact
create_orgs(org_dxs)
space.save!
add_leads(space, space_form)
if space.review?
create_reviewer_cooperative_project(space)
create_reviewer_confidential_space(space, space_form)
else
remove_pfda_admin_user(org_dxs)
end
send_emails(space)
space
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @space_form = Space::Form.new(space: current_team.spaces.new,\n user: current_user,\n attributes: space_params)\n\n authorize @space_form.space, :create?\n\n respond_to do |format|\n if @space_form.save\n format.htm... | [
"0.755812",
"0.69455516",
"0.69427603",
"0.6942391",
"0.6913779",
"0.6910277",
"0.6823532",
"0.6768969",
"0.676327",
"0.6729226",
"0.6698937",
"0.6673427",
"0.65308267",
"0.6499143",
"0.6481824",
"0.6397734",
"0.6379258",
"0.63743234",
"0.63512933",
"0.6318011",
"0.62970346",... | 0.6158449 | 34 |
Provision Host and Guest orgs | def create_orgs(orgs_dxs)
orgs_dxs.each { |dxorg| OrgService::Create.call(api, dxorg) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def provision\n @logger.notify \"Provisioning OpenStack\"\n\n @hosts.each do |host|\n host[:vmhostname] = generate_host_name\n @logger.debug \"Provisioning #{host.name} (#{host[:vmhostname]})\"\n options = {\n :flavor_ref => flavor(host[:flavor]).id,\n :image_ref =... | [
"0.710348",
"0.70939255",
"0.7039509",
"0.69078016",
"0.6874276",
"0.6793122",
"0.676956",
"0.6749985",
"0.6619524",
"0.6586047",
"0.6524973",
"0.6469665",
"0.641902",
"0.63955194",
"0.6378395",
"0.6365725",
"0.63513553",
"0.6338087",
"0.62785935",
"0.6226664",
"0.62037456",
... | 0.0 | -1 |
Add host and guest leads as ADMINs | def add_leads(space, space_form)
form_host_lead_dxuser = space_form.host_lead_dxuser
add_lead(
space,
User.find_by!(dxuser: form_host_lead_dxuser),
SpaceMembership::SIDE_HOST,
)
return if guest_blank?(space, space_form)
form_guest_lead_dxuser = space_form.guest_lead_dxuser
add_lead(
space,
space.review? ? space_form.space_sponsor : User.find_by!(dxuser: form_guest_lead_dxuser),
SpaceMembership::SIDE_GUEST,
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_admin oid\n self.admins << oid if Character && !admin?(oid)\n end",
"def add_admin\n @email = :email\n User.invite!(:email => @email, :ngo => current_user.ngo)\n end",
"def add_admin(arg)\n chg_permission(admins, arg, :add)\n end",
"def fAddAdmin (name, email, pwd)\n @users.ad... | [
"0.68553394",
"0.649806",
"0.6411531",
"0.635145",
"0.62299734",
"0.61694586",
"0.6144791",
"0.61242074",
"0.6117006",
"0.61087453",
"0.60904396",
"0.6081031",
"0.60487014",
"0.60484904",
"0.6041076",
"0.6026751",
"0.6018488",
"0.6000979",
"0.6000979",
"0.6000979",
"0.6000979... | 0.0 | -1 |
Remove pfda admin from orgs Skip if the host user is actual ADMIN_USER | def remove_pfda_admin_user(orgs_dxs)
return if user.dxid == ADMIN_USER
orgs_dxs.each { |dxorg| papi.call(dxorg, "removeMember", user: ADMIN_USER) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_pfda_admin_user(space, space_form)\n return if user.dxid == ADMIN_USER\n\n unless space_form.host_admin.dxid == ADMIN_USER\n admin_api.org_remove_member(space.host_dxorg, ADMIN_USER)\n end\n\n return if space_form.guest_admin.nil? || space_form.guest_admin&.dxid == ADMIN_USER\... | [
"0.73185605",
"0.6716337",
"0.65860397",
"0.6558528",
"0.65524524",
"0.64814305",
"0.6458961",
"0.6430686",
"0.6403793",
"0.6403793",
"0.63285977",
"0.63171566",
"0.631586",
"0.62212825",
"0.62212825",
"0.61993843",
"0.6192403",
"0.6179935",
"0.61742574",
"0.61648476",
"0.616... | 0.7002545 | 1 |
Send an activation email to all space leads | def send_emails(space)
space.leads.find_each do |lead|
notification_mailer.space_activation_email(space, lead).deliver_now!
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_activation_email\n ensure_activation_token_set\n UserMailer.account_activation(self, activation_token).deliver_later unless activated?\n end",
"def send_activation_or_reset_mail\n end",
"def activation\n @greeting = \"Hi\"\n\n mail :to => \"john@synapticmishap.co.uk\"\n end",
"def sen... | [
"0.7594372",
"0.75799966",
"0.7558296",
"0.744841",
"0.74068123",
"0.7365573",
"0.7356083",
"0.7335921",
"0.73024637",
"0.7287065",
"0.7273054",
"0.72715235",
"0.7268526",
"0.7264571",
"0.72345513",
"0.7231706",
"0.72259665",
"0.7212751",
"0.7186972",
"0.7186972",
"0.7186972"... | 0.78956795 | 1 |
Create a project of a cooperative review space. | def create_reviewer_cooperative_project(space)
if ADMIN_USER != user.dxid
papi.call(
space.host_dxorg, "invite",
invitee: user.dxid,
level: "ADMIN",
suppressEmailNotification: true
)
end
project_dxid = api.call(
"project", "new",
name: "precisionfda-space-#{space.id}-HOST",
billTo: user.billto,
)["id"]
api.call(
project_dxid, "invite",
invitee: space.host_dxorg,
level: "CONTRIBUTE",
suppressEmailNotification: true,
suppressAllNotifications: true
)
api.call(
project_dxid, "invite",
invitee: space.guest_dxorg,
level: "CONTRIBUTE",
suppressEmailNotification: true,
suppressAllNotifications: true
)
api.call(
project_dxid, "invite",
invitee: Setting.review_app_developers_org,
level: "CONTRIBUTE",
suppressEmailNotification: true,
suppressAllNotifications: true,
)
space.host_project = project_dxid
space.save!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_project (project, pledge_goal)\n Project.new(project, self, pledge_goal)\n end",
"def create\n name = shift_argument\n unless name\n error(\"Usage: mortar projects:create PROJECTNAME\\nMust specify PROJECTNAME\")\n end\n\n args = [name,]\n is_public = false \n if optio... | [
"0.68930215",
"0.65978414",
"0.65761304",
"0.6571514",
"0.65533745",
"0.65262187",
"0.65135425",
"0.64749277",
"0.64422035",
"0.6402188",
"0.64003485",
"0.63773036",
"0.6349652",
"0.63400304",
"0.6294244",
"0.62593",
"0.6241359",
"0.6240975",
"0.62366915",
"0.6218934",
"0.620... | 0.78070325 | 0 |
Create a project of a confidential review space. | def create_reviewer_confidential_space(shared_space, space_form)
space = shared_space.confidential_spaces.create!(
name: shared_space.name,
description: shared_space.description,
space_type: shared_space.space_type,
cts: shared_space.cts,
state: shared_space.state,
host_dxorg: shared_space.host_dxorg,
restrict_to_template: space_form.restrict_to_template,
)
project_dxid = api.call(
"project", "new",
name: "precisionfda-space-#{space.id}-REVIEWER-PRIVATE",
billTo: user.billto,
)["id"]
space.host_project = project_dxid
space.save!
api.call(
project_dxid, "invite",
invitee: space.host_dxorg,
level: "CONTRIBUTE",
suppressEmailNotification: true,
suppressAllNotifications: true,
)
api.call(
project_dxid, "invite",
invitee: Setting.review_app_developers_org,
level: "CONTRIBUTE",
suppressEmailNotification: true,
suppressAllNotifications: true,
)
apply_space_template(space)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_reviewer_cooperative_project(space)\n if ADMIN_USER != user.dxid\n papi.call(\n space.host_dxorg, \"invite\",\n invitee: user.dxid,\n level: \"ADMIN\",\n suppressEmailNotification: true\n )\n end\n\n project_dxid = api.call(\n \"pro... | [
"0.7335935",
"0.6795813",
"0.6783607",
"0.66679525",
"0.660702",
"0.66031194",
"0.657976",
"0.6578428",
"0.64866793",
"0.64284116",
"0.642025",
"0.6387912",
"0.6385298",
"0.63733757",
"0.63611037",
"0.6322394",
"0.6314972",
"0.629425",
"0.62862074",
"0.6258832",
"0.62580514",... | 0.67534244 | 3 |
TODO: to be refactored Apply space_template to the space if space_template exists | def apply_space_template(space)
parent_space = space.space
return if parent_space.blank?
template = parent_space.space_template
return if template.blank?
template.space_template_nodes.each do |n|
node = n.node
case node
when UserFile
copy_service.copy(node, space.uid)
when App
copy_service.copy(node, space.uid)
else
raise("Space template #{template.id} has Unexpected node #{n.id} of #{node.class} class")
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_space_type(template, clim, building_type, spc_type)\n #OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.Model', \"Adding space type: #{template}-#{clim}-#{building_type}-#{spc_type}\")\n\n # Get the space type data\n data = self.find_object(self.standards['space_types'], {'template'=>te... | [
"0.57424045",
"0.555385",
"0.54832",
"0.53907865",
"0.5252938",
"0.52402824",
"0.52234554",
"0.5207747",
"0.5174894",
"0.5164923",
"0.51312476",
"0.5115307",
"0.50710034",
"0.50550723",
"0.50517523",
"0.5044105",
"0.5026249",
"0.5018389",
"0.50085974",
"0.5006663",
"0.4985411... | 0.77530843 | 0 |
Formula provided by Michael Sokol and Julien Paroche | def bucket_date
self.created_at.beginning_of_week.beginning_of_day
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def formula() @ob.get_formula end",
"def secret_formula(started)\r\n\tjelly_beans = started * 500\r\n\tjars = jelly_beans / 1000\r\n\tcrates = jars / 100\r\n\treturn jelly_beans, jars, crates\r\nend",
"def secret_formula(started)\n# Assigns variables, each building on the other.\n jelly_beans = started * 50... | [
"0.68520945",
"0.6568194",
"0.65528095",
"0.6551659",
"0.65434635",
"0.65023327",
"0.63993376",
"0.63993376",
"0.63993376",
"0.63993376",
"0.6372778",
"0.6358174",
"0.6358174",
"0.6358174",
"0.6303005",
"0.6181995",
"0.61236477",
"0.61163014",
"0.6093724",
"0.60769886",
"0.60... | 0.0 | -1 |
GET /ins_co_offices/1 GET /ins_co_offices/1.xml | def show
@ins_co_office = InsCoOffice.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @ins_co_office }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @offices = current_user.offices\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @offices }\n end\n end",
"def index\n @offices = Office.all\n #Office.lets_scrape\n end",
"def list_branch_offices\n\t\t\txml = \"<?xml version='1.0' e... | [
"0.6778899",
"0.6207084",
"0.61900645",
"0.61384565",
"0.60676956",
"0.59978044",
"0.5992629",
"0.59857357",
"0.597969",
"0.59686255",
"0.5964498",
"0.5959601",
"0.5952478",
"0.5948258",
"0.585986",
"0.5850791",
"0.5834076",
"0.57208395",
"0.5718783",
"0.571761",
"0.5711841",... | 0.6586802 | 1 |
GET /ins_co_offices/new GET /ins_co_offices/new.xml | def new
@ins_co_office = InsCoOffice.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @ins_co_office }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @office = Office.new\n\t\t\n\t\t\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @office }\n end\n end",
"def new\n @officer = Officer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @off... | [
"0.6782288",
"0.6741558",
"0.66297346",
"0.66275966",
"0.65640706",
"0.6553684",
"0.6552235",
"0.65375686",
"0.65375686",
"0.6515558",
"0.6482163",
"0.64396846",
"0.6438755",
"0.64386404",
"0.64208925",
"0.6417984",
"0.64154696",
"0.6386465",
"0.6380879",
"0.63801163",
"0.637... | 0.7053239 | 0 |
POST /ins_co_offices POST /ins_co_offices.xml | def create
@ins_co_office = InsCoOffice.new(params[:ins_co_office])
respond_to do |format|
if @ins_co_office.save
format.html { redirect_to(@ins_co_office, :notice => 'Office was successfully created.') }
format.xml { render :xml => @ins_co_office, :status => :created, :location => @ins_co_office }
else
format.html { render :action => "new" }
format.xml { render :xml => @ins_co_office.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @office = current_user.offices.build(params[:office])\n\n respond_to do |format|\n if @office.save\n flash[:notice] = 'Office was successfully created.'\n format.html { redirect_to(root_path) }\n format.xml { render :xml => @office, :status => :created, :location => @o... | [
"0.5972843",
"0.58993775",
"0.5696602",
"0.5676932",
"0.5502328",
"0.5480036",
"0.5472551",
"0.5425959",
"0.54230785",
"0.53897434",
"0.5375659",
"0.53277665",
"0.53269917",
"0.52758044",
"0.52560896",
"0.5250543",
"0.52231205",
"0.52176917",
"0.52162737",
"0.52116734",
"0.52... | 0.628173 | 0 |
PUT /ins_co_offices/1 PUT /ins_co_offices/1.xml | def update
@ins_co_office = InsCoOffice.find(params[:id])
respond_to do |format|
if @ins_co_office.update_attributes(params[:ins_co_office])
format.html { redirect_to(@ins_co_office, :notice => 'Office was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @ins_co_office.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @office.update(office_params)\n head :no_content\n end",
"def update\n @office = Office.find(params[:id])\n\n respond_to do |format|\n if @office.update_attributes(params[:office])\n format.html { redirect_to offices_path, notice: 'Office was successfully updated.' }\n ... | [
"0.61209834",
"0.58853495",
"0.5862495",
"0.5802529",
"0.57994395",
"0.5777615",
"0.57137275",
"0.5679202",
"0.56741464",
"0.56029654",
"0.5584538",
"0.5583037",
"0.5563727",
"0.5562154",
"0.54945403",
"0.54758495",
"0.5463382",
"0.54628986",
"0.54586387",
"0.54527646",
"0.54... | 0.64627606 | 0 |
DELETE /ins_co_offices/1 DELETE /ins_co_offices/1.xml | def destroy
@ins_co_office = InsCoOffice.find(params[:id])
@ins_co_office.destroy
respond_to do |format|
format.html { redirect_to(ins_co_offices_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @office = Office.find(params[:id])\n @off... | [
"0.6583533",
"0.6518735",
"0.64920455",
"0.6396862",
"0.6299352",
"0.6170572",
"0.6164077",
"0.6160628",
"0.61012083",
"0.60825944",
"0.6075309",
"0.6060401",
"0.60582286",
"0.6047363",
"0.60300773",
"0.6015298",
"0.60115176",
"0.6001922",
"0.59869945",
"0.5981915",
"0.597664... | 0.6935799 | 0 |
This is made caseinsensitive by downcasing everything. That's a bummer; it would be better for the stopword filter to be caseinsensitive. | def extract
@tweets.each do |tweet|
sw_filter(tweet.lang)
.filter(tweet.attrs[:full_text].split.map { |w| w.downcase } )
.each do |token|
next unless is_word? token
@working_space[token] << tweet.user.id
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reduce_case_insensitive(_production, _range, _tokens, _children)\n Regexp::IGNORECASE\n end",
"def words_to_skip_capitalization_of\n\t\t[ \n\t\t'of','a','the','and','an','or','nor','but','if','then','else','when','up','at','from','by','on',\n\t\t'off','for','in','out','over','to'\n\t\t]\n\tend",
"d... | [
"0.7214392",
"0.71627814",
"0.70379704",
"0.7018476",
"0.66996205",
"0.66654193",
"0.66247535",
"0.662042",
"0.6574865",
"0.6517637",
"0.651462",
"0.6495328",
"0.6472453",
"0.6435291",
"0.6393078",
"0.6382332",
"0.63339794",
"0.6262782",
"0.6260746",
"0.6245256",
"0.6232074",... | 0.0 | -1 |
Inserta un valor al principio de la lista. | def push_head(value)
if value.class == Nodo
added_node = value
else
added_node = Nodo.new(value)
end
added_node.prev = nil
added_node.next = @head
@head.prev = added_node unless @head.nil?
@head = added_node
@tail = added_node if @tail.nil?
@sz = @sz + 1
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(clave, valor)\r\n @grafo[clave] = valor\r\n end",
"def insert(value) \n self.head.nil? ? insert_empty_list(value) : insert_on_end(value)\n\n print \"=> Result insertion: \"\n print_simple_list(self.last)\n end",
"def insertar_lista_principio(referencia)\n if... | [
"0.6882546",
"0.647175",
"0.6304506",
"0.6233017",
"0.6184128",
"0.61449575",
"0.6086783",
"0.60759825",
"0.6065893",
"0.603101",
"0.59160805",
"0.5886279",
"0.5756945",
"0.57322973",
"0.5661064",
"0.56537473",
"0.5653499",
"0.56130576",
"0.559679",
"0.55945355",
"0.55945355"... | 0.0 | -1 |
Inserta un valor al final de la lista. | def push_tail(value)
if value.class == Nodo
added_node = value
else
added_node = Node.new(value)
end
added_node.next = nil
added_node.prev = @tail
@tail.next = added_node unless @tail.nil?
@tail = added_node
@head = added_node if @head.nil?
@sz = @sz + 1
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_last(value)\n \n end",
"def insertar_lista_final(referencia)\n if @final != nil\n @final = Nodo.new(referencia, nil, @final)\n n = @final.anterior\n n.siguiente = @final\n else\n @principio = Nodo.new(referenci... | [
"0.6595191",
"0.6525332",
"0.65043175",
"0.6497196",
"0.60536987",
"0.5965677",
"0.59122384",
"0.5894111",
"0.5880826",
"0.5820758",
"0.5809455",
"0.578125",
"0.5775184",
"0.5722138",
"0.57116556",
"0.5693691",
"0.56821203",
"0.5681494",
"0.56771696",
"0.5665815",
"0.5651628"... | 0.522523 | 58 |
Elimina un elemento al principio de la lista. | def pop_head
if(@head == nil)
return nil
else
val= @head
node = @head.next
@head = node
if @head != nil
@head.prev = nil
else
@tail = nil
end
@sz = @sz -1
end
return val
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete elemento\n borrar = []\n borrar << elemento\n @@Ordenadores = @@Ordenadores - borrar\n end",
"def remove_element(name)\n @element_list.delete_if{|e|\n e.name == name\n }\n end",
"def delete_element(element); end",
"def delete element\n self.delete_at index_of(element) ... | [
"0.72610664",
"0.69059485",
"0.6837261",
"0.6740732",
"0.6740732",
"0.6642234",
"0.6482326",
"0.64353716",
"0.6434944",
"0.64272183",
"0.64153594",
"0.6406409",
"0.6401825",
"0.639435",
"0.6384169",
"0.63716197",
"0.63714886",
"0.6367462",
"0.63538873",
"0.6352113",
"0.634761... | 0.0 | -1 |
Elimina un elemento del final de la lista. | def pop_tail
if(@tail == nil)
return nil
else
val= @tail
node = @tail.prev
@tail = node
if @tail != nil
@tail.next = nil
else
@head = nil
end
@sz = @sz -1
end
return val
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_last_child\n @elements.pop\n end",
"def remove_last\n raise 'No such element' if @size == 0\n elt = @tail.value\n if @size == 1\n @head = nil\n @tail = nil\n else\n @tail = @tail.previous\n @tail.next.previous = nil\n ... | [
"0.67286783",
"0.6566167",
"0.6516636",
"0.6512531",
"0.6476442",
"0.6436082",
"0.64167106",
"0.6372489",
"0.62897867",
"0.6251727",
"0.62279505",
"0.6204038",
"0.61898106",
"0.61898106",
"0.61263144",
"0.6085789",
"0.6070083",
"0.60444593",
"0.60370696",
"0.6025497",
"0.5984... | 0.0 | -1 |
Muestra la salida formateada de los elementos de la lista | def to_s
s = ""
each {|i| s += "#{i.nombre_alimento.to_s}\n"}
s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clasificar_por_sal (lista)\n \n sal_recomendada = Lista.new()\n sal_excesiva = Lista.new()\n \n nodo = lista.extract\n \n while !(nodo.nil?)\n \n if nodo.value.sal > 6\n sal_excesiva.insert(nodo.value.sal)\n else\n sal_recomendada.insert(nodo.value.sal)\n... | [
"0.6974224",
"0.66611624",
"0.64479166",
"0.59883237",
"0.5746366",
"0.55472875",
"0.541903",
"0.5385529",
"0.53465086",
"0.5268247",
"0.51594764",
"0.5157395",
"0.5152861",
"0.51268274",
"0.51021373",
"0.51011205",
"0.50794977",
"0.50656784",
"0.5064048",
"0.50478065",
"0.50... | 0.4759796 | 62 |
Metodo para enumerar la lista, poder aplicarle metodos de ordenacion, como collect,sort... todos del modulo enumerable | def each
iterator = @head
while iterator != nil do
yield iterator.value
iterator = iterator.next
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each(&block)\n @@list.each(&block)\n end",
"def each\n return enum_for(:each) unless block_given?\n @list.each do |item|\n yield item\n end\n end",
"def each(&block)\n @list.each(&block)\n end",
"def all_items\n all_items = []\n collections.eac... | [
"0.59900475",
"0.59386235",
"0.57080483",
"0.5618742",
"0.551421",
"0.5466715",
"0.5462922",
"0.53820074",
"0.53797877",
"0.53553206",
"0.53399265",
"0.5308958",
"0.5299828",
"0.5285202",
"0.52692133",
"0.52680117",
"0.5261699",
"0.52409166",
"0.5221012",
"0.52178836",
"0.521... | 0.0 | -1 |
GET /online_judges/1 GET /online_judges/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @judges = Judge.all\n end",
"def index\n @game_judges = GameJudge.all\n end",
"def index\n authorize Judge\n @judges = Judge.all\n @title = I18n.t('judges.index.title')\n end",
"def new_judgings(n = 100)\n\t\tresult = api_get('judgings', cid: contest_id, limit: n,\n\t\t ... | [
"0.62971824",
"0.61262345",
"0.6072168",
"0.603899",
"0.5925974",
"0.5668425",
"0.56333584",
"0.5567288",
"0.54829997",
"0.5468081",
"0.5459955",
"0.5444159",
"0.5419589",
"0.54134595",
"0.53835493",
"0.53771144",
"0.53731656",
"0.53531194",
"0.5345417",
"0.5342932",
"0.53423... | 0.0 | -1 |
POST /online_judges POST /online_judges.json | def create
@online_judge = OnlineJudge.new(online_judge_params)
@online_judge.user = current_user
respond_to do |format|
if @online_judge.save
format.html { redirect_to current_user, notice: 'Online judge was successfully created.' }
format.json { render :show, status: :created, location: @online_judge }
else
format.html { render :new }
format.json { render json: @online_judge.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_judgings(n = 100)\n\t\tresult = api_get('judgings', cid: contest_id, limit: n,\n\t\t fromid: last_judging)\n\t\tself.last_judging = result.last['id'] + 1 unless result.empty?\n\t\tresult\n\tend",
"def create\n @judge = @competition.judges.build(judge_params)\n authorize ... | [
"0.58430684",
"0.5757473",
"0.56651497",
"0.54522693",
"0.5367972",
"0.5334164",
"0.5315734",
"0.5271995",
"0.5180628",
"0.51660585",
"0.51344687",
"0.50466317",
"0.50420463",
"0.5015169",
"0.4998017",
"0.49963892",
"0.4977875",
"0.491329",
"0.4897295",
"0.4892257",
"0.488237... | 0.5990504 | 0 |
PATCH/PUT /online_judges/1 PATCH/PUT /online_judges/1.json | def update
respond_to do |format|
if @online_judge.update(online_judge_params)
format.html { redirect_to current_user, notice: 'Online judge was successfully updated.' }
format.json { render :show, status: :ok, location: @online_judge }
else
format.html { render :edit }
format.json { render json: @online_judge.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @badge = Badge.find(params[:id])\n\n respond_to do |format|\n if @badge.update_attributes(params[:badge])\n format.html { redirect_to @badge, notice: 'Badge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit... | [
"0.5928994",
"0.59072495",
"0.5810702",
"0.58060664",
"0.580363",
"0.5769774",
"0.57471496",
"0.5739974",
"0.5702337",
"0.56777084",
"0.56761044",
"0.5673122",
"0.5670219",
"0.5668757",
"0.566013",
"0.5654656",
"0.56453514",
"0.56266946",
"0.5622915",
"0.5618859",
"0.5608668"... | 0.6276049 | 0 |
DELETE /online_judges/1 DELETE /online_judges/1.json | def destroy
@online_judge.destroy
respond_to do |format|
format.html { redirect_to current_user, notice: 'Online judge was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @nudge.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message ... | [
"0.69018865",
"0.6886463",
"0.66399264",
"0.66161466",
"0.6552659",
"0.6510419",
"0.6502761",
"0.6501989",
"0.6499238",
"0.6486003",
"0.64774436",
"0.6473374",
"0.64520854",
"0.643434",
"0.6402962",
"0.6402962",
"0.6402962",
"0.6402962",
"0.6402254",
"0.63799936",
"0.63739085... | 0.6682734 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_online_judge
@online_judge = OnlineJudge.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def online_judge_params
params.require(:online_judge).permit(:site, :account_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
returns whether reorientation was necessary | def orient! direction, edge
return false if edge_to_the(direction) == edge
ensure_unplaced
2.times do
DIRECTIONS.count.times do
rotate!
return true if edge_to_the(direction) == edge
end
flip!
end
raise "Could not orient piece so that edge matched."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def correct_orientation?\n if !Move::ORIENTATIONS.include?(orientation)\n errors.add(:orientation, :orientation_error) \n end\n end",
"def needs_rotate?\n false\n end",
"def mirror_move_affected?\n return data.mirror_move\n end",
"def restore?\n @restore || false\n end... | [
"0.67039275",
"0.65398735",
"0.65112996",
"0.6160939",
"0.6143824",
"0.6066446",
"0.5943404",
"0.5929524",
"0.5890769",
"0.58271396",
"0.5803456",
"0.5768338",
"0.5752867",
"0.57504946",
"0.5737701",
"0.572663",
"0.57239765",
"0.57108",
"0.5702612",
"0.5664312",
"0.5653063",
... | 0.0 | -1 |
This method is used to return portable data, which describes some attribute of an Invoice == Outputs Returns a hash value with all concrete_charges | def portable_format
# an invoice basic information
invoice_hash = {}
invoice_hash[:id] = self.id
invoice_hash[:start_date] = self.start_date
invoice_hash[:end_date] = self.end_date
invoice_hash[:issue_date] = self.issue_date
invoice_hash[:total_charges] = self.total
invoice_hash[:distribution_loss_factor] = self.distribution_loss_factor
invoice_hash[:marginal_loss_factor] = self.marginal_loss_factor
invoice_hash[:total_loss_factor] = self.distribution_loss_factor + self.marginal_loss_factor
invoice_hash[:discount] = self.retail_plan.discount
invoice_hash[:generated_at] = self.created_at
# all concrete charges of an invoice
daily_charges = []
global_charges = []
supply_charges = []
metering_charges = []
capacity_charges = []
certificate_charges = []
all_concrete_charges = ConcreteCharge.where("invoice_id = ?", self.id)
all_concrete_charges.each do |item|
if item.charge_factory.specific.is_a?(DailyUsageCharge)
daily_charges << eval(item.charge_attributes) # string to hash
elsif item.charge_factory.specific.is_a?(GlobalUsageCharge)
global_charges << eval(item.charge_attributes) # string to hash
elsif item.charge_factory.specific.is_a?(SupplyCharge)
supply_charges << eval(item.charge_attributes) # string to hash
elsif item.charge_factory.specific.is_a?(MeteringCharge)
metering_charges << eval(item.charge_attributes) # string to hash
elsif item.charge_factory.specific.is_a?(CapacityCharge)
capacity_charges << eval(item.charge_attributes) # string to hash
else
certificate_charges << eval(item.charge_attributes) # string to hash
end
end
meters_in_dailycharges = []
daily_charges.each do |daily|
meters_in_dailycharges << daily[:meters]
end
meters_in_dailycharges.uniq! # uniq meters occur in daily charges
daily_bymeter= {}
meters_in_dailycharges.each do |meter|
daily_bymeter[meter] = []
daily_charges.each do |daily|
if daily[:meters] == meter
daily_bymeter[meter] << daily
end
end
end
concrete_charges = {daily_charges: daily_bymeter, global_charges: global_charges,
supply_charges: supply_charges, metering_charges: metering_charges,
capacity_charges: capacity_charges, certificate_charges: certificate_charges}
invoice_hash[:concrete_charges] = concrete_charges
return invoice_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [unit_of_measure, pricing_component_type, charge_type, period_start, period_end, created, changed_by, updated, id, invoice_id, unit_of_measure_id, subscription_id, product_rate_plan_id, public_product_rate_plan_name, product_rate_plan_name, product_id, public_product_name, product_name, organizatio... | [
"0.64053595",
"0.6355245",
"0.6251433",
"0.6180573",
"0.61086524",
"0.60006726",
"0.59608144",
"0.5927735",
"0.5782559",
"0.5766123",
"0.5764404",
"0.5759244",
"0.57399523",
"0.5724937",
"0.57041246",
"0.5682993",
"0.56768644",
"0.5669663",
"0.56549877",
"0.5641062",
"0.56340... | 0.71880966 | 0 |
GET /firms/1 GET /firms/1.json | def show
@firm = Firm.includes(:purchase_interests, :sale_interests).find(params[:id])
@title = t('view.firms.show_title', firm: @firm.nombre)
@purchase_interests = @firm.purchase_interests
@sale_interests = @firm.sale_interests
respond_to do |format|
format.html # show.html.erb
format.json { render json: @firm }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @firms = Firm.all\n end",
"def show\n @firm = Firm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @firm }\n end\n end",
"def index\n @firms = Firm.all\n \n respond_to do |format|\n format.html # index.htm... | [
"0.7018747",
"0.6852658",
"0.6608477",
"0.64353496",
"0.63154423",
"0.6314451",
"0.6282768",
"0.6275277",
"0.6249425",
"0.6238645",
"0.6197469",
"0.6121839",
"0.6101825",
"0.6101825",
"0.6055197",
"0.6044669",
"0.6039131",
"0.60341763",
"0.6030308",
"0.6029244",
"0.6003676",
... | 0.63953817 | 4 |
GET /firms/new GET /firms/new.json | def new
@title = t('view.firms.new_title')
@firm = Firm.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @firm }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @firm = Firm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @firm }\n end\n end",
"def create\n @title = t('view.firms.new_title')\n @firm = Firm.new(params[:firm])\n\n respond_to do |format|\n if @firm.save\n format.htm... | [
"0.7751174",
"0.73691654",
"0.72218347",
"0.70463496",
"0.70351094",
"0.7019751",
"0.6977956",
"0.6952969",
"0.6941487",
"0.693557",
"0.69337404",
"0.69330966",
"0.69117504",
"0.68867517",
"0.68782175",
"0.6877839",
"0.6862913",
"0.6859532",
"0.68418276",
"0.6840955",
"0.6815... | 0.7993061 | 0 |
POST /firms POST /firms.json | def create
@title = t('view.firms.new_title')
@firm = Firm.new(params[:firm])
respond_to do |format|
if @firm.save
format.html { redirect_to @firm, notice: t('view.firms.correctly_created') }
format.json { render json: @firm, status: :created, location: @firm }
else
format.html { render action: 'new' }
format.json { render json: @firm.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @firm = Firm.new(firm_params)\n\n respond_to do |format|\n if @firm.save\n format.html { redirect_to @firm, notice: 'Firm was successfully created.' }\n format.json { render :show, status: :created, location: @firm }\n else\n format.html { render :new }\n fo... | [
"0.62247837",
"0.6170513",
"0.6169376",
"0.5966475",
"0.57999766",
"0.5772246",
"0.57486314",
"0.5708599",
"0.5675701",
"0.5633",
"0.5628051",
"0.5567741",
"0.5546342",
"0.5545006",
"0.5536649",
"0.5527791",
"0.5500777",
"0.5473998",
"0.5466345",
"0.5433702",
"0.5415413",
"... | 0.65028435 | 0 |
PUT /firms/1 PUT /firms/1.json | def update
@title = t('view.firms.edit_title')
@firm = Firm.find(params[:id])
respond_to do |format|
if @firm.update_attributes(params[:firm])
format.html { redirect_to @firm, notice: t('view.firms.correctly_updated') }
format.json { head :ok }
else
format.html { render action: 'edit' }
format.json { render json: @firm.errors, status: :unprocessable_entity }
end
end
rescue ActiveRecord::StaleObjectError
redirect_to edit_firm_url(@firm), alert: t('view.firms.stale_object_error')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @firm.update(firm_params)\n format.html { redirect_to @firm, notice: 'Firm was successfully updated.' }\n format.json { render :show, status: :ok, location: @firm }\n else\n format.html { render :edit }\n format.json { render json: @... | [
"0.63847166",
"0.63450944",
"0.6249478",
"0.6192724",
"0.6176736",
"0.6117501",
"0.6064383",
"0.6054021",
"0.6053476",
"0.6045763",
"0.6023448",
"0.60054237",
"0.60054237",
"0.60054237",
"0.5990374",
"0.5963498",
"0.59465086",
"0.59461033",
"0.5930213",
"0.5893923",
"0.588484... | 0.6102161 | 6 |
DELETE /firms/1 DELETE /firms/1.json | def destroy
@firm = Firm.find(params[:id])
@firm.destroy
respond_to do |format|
format.html { redirect_to firms_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @firm = Firm.find(params[:id])\n @firm.destroy\n\n respond_to do |format|\n format.html { redirect_to firms_url }\n format.json { head :no_content }\n end\n end",
"def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end",
"def delete\n ren... | [
"0.6951848",
"0.68777543",
"0.68197554",
"0.68169296",
"0.68006384",
"0.68006384",
"0.67076325",
"0.6698469",
"0.6665981",
"0.6618573",
"0.6585148",
"0.64497644",
"0.64468896",
"0.6389992",
"0.6383792",
"0.6374941",
"0.6362597",
"0.6361317",
"0.6357924",
"0.635509",
"0.635073... | 0.69620305 | 0 |
creo que esto se puede ir | def add_product
@firm = Firm.find(params[:id])
render partial: 'add_product', content_type: 'text/html'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crear\n if user_signed_in?\n unless current_user.employee.nil?\n @permiso_crear = false\n @security_role_type = Security::RoleType.find_by(name: \"Crear\").name\n current_user.employee.security_profile.security_role.security_role_menus.each do |security_role_menu| \n if s... | [
"0.6444827",
"0.63993233",
"0.6339595",
"0.6336596",
"0.6326339",
"0.6259272",
"0.6151846",
"0.614463",
"0.6140908",
"0.61345065",
"0.6113508",
"0.60907173",
"0.6078508",
"0.60778344",
"0.6067026",
"0.6048962",
"0.6033119",
"0.6001856",
"0.5981397",
"0.5965884",
"0.5959202",
... | 0.0 | -1 |
Sample names Get sample names containing a substring | def get_sample_names(substring)
inputs = Dir.glob("inputs/#{$jobid}/*.txt")
inputs = inputs.select {|x| x.include? substring}
inputs = inputs.map{|x| File.basename(x).sub(".txt", "")}
return inputs
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sample_names(substring)\n inputs = Dir.glob(\"inputs/#{$jobid}/*.txt\").select {|x| x.include? substring}\n inputs = inputs.map{|x| File.basename(x).sub(\".txt\", \"\")}\n return inputs\nend",
"def get_sample_names(substring)\n inputs = Dir.glob(\"inputs/#{$jobid}/*.txt\").select {|x| x.include? subs... | [
"0.7544055",
"0.7544055",
"0.7544055",
"0.7544055",
"0.7541987",
"0.7073276",
"0.6378959",
"0.6314352",
"0.6258772",
"0.6256963",
"0.6181172",
"0.6140425",
"0.60791445",
"0.6078461",
"0.6075472",
"0.60706043",
"0.6051366",
"0.58784837",
"0.5877926",
"0.5872074",
"0.58698726",... | 0.76673555 | 0 |
Function to get the .root files for an analyzer and samples | def get_analyzer_results(analyzer, the_samples)
output = Array.new
analyzer_base = analyzer.sub('.py', '')
the_samples.each do |sample|
output << "results/#{$jobid}/#{analyzer_base}/#{sample}.root"
end
return output
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_analyzer_results(analyzer, the_samples)\n output = Array.new\n analyzer_base = analyzer.sub('.py', '')\n puts the_samples\n puts analyzer\n the_samples.each do |sample|\n output << \"results/#{$jobid}/#{$selection}#{$jetcorrection}/iso#{$isolation}/#{analyzer_base}/#{sample}.root\"\n #output << ... | [
"0.69281185",
"0.6593671",
"0.65053207",
"0.629359",
"0.6245648",
"0.61364573",
"0.60480756",
"0.60313416",
"0.6030906",
"0.5993595",
"0.5981229",
"0.5954594",
"0.59488773",
"0.58552146",
"0.58543193",
"0.58522147",
"0.5799286",
"0.57409644",
"0.57221437",
"0.5694884",
"0.568... | 0.71319383 | 4 |
Recipes for adding stat. error shapes. Makes a new file task: input_file_stat_errors.root => input_file.root | def add_fake_errors(input_file, channel, prefix)
output_file = "#{File.dirname(input_file)}/#{channel}_shapes_#{prefix}_statshapes.root"
output_sys_list = output_file.sub('.root', ".txt")
file output_file => [input_file] do |t|
sh "add_stat_shapes.py #{input_file} #{output_file} --filter '#{prefix}/fakes' --prefix CMS_vhtt_#{$period}_#{prefix}_fakeshape > #{output_sys_list}"
end
return output_file
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_fake_errors(input_file, prefix)\n output_file = input_file.sub('.root', '_statshapes.root')\n output_sys_list = input_file.sub('.root', '_statshapes.txt')\n file output_file => [input_file] do |t|\n sh \"add_stat_shapes.py #{input_file} #{output_file} --filter '#{prefix}/fakes' --prefix CMS_vhtt_#{$p... | [
"0.713875",
"0.5739326",
"0.56185156",
"0.53063333",
"0.52506006",
"0.5243376",
"0.5230361",
"0.5130129",
"0.51293904",
"0.51293904",
"0.51293904",
"0.5126742",
"0.50969017",
"0.5093162",
"0.50008947",
"0.49912214",
"0.49550954",
"0.49535787",
"0.49491897",
"0.49491897",
"0.4... | 0.69926775 | 1 |
cardmasses.each do |mass| task :cards => make_datacard_task(mass, 'mmt') task :cards => make_datacard_task(mass, 'emt') task :cards => make_datacard_task(mass, 'eet') task :cards => combine_channels(mass) task :cards => make_datacard_task(mass, 'llt', '') end Recipes to make limits targets: limit_mmt limit_emt limit_eet limit_llt limits | def make_limit_task(channel)
limit_timestamp = "#{$carddir}/#{channel}/.limits_computed"
carddir = $carddir #makes a copy so that if $cardir changes this does not
file limit_timestamp => "#{$carddir}/#{channel}/.creation_timestamp" do |t|
chdir("#{carddir}/#{channel}") do
sh "ls -d [0-9]* | xargs -n 1 -P 10 -I {} compute_significance.sh {} #{$blind}"
end
sh "compute_limits.sh #{carddir}/#{channel} 10 #{$blind}"
end
return limit_timestamp
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_todoist_tasks(cards)\n cards = filter_tasks(cards)\n if cards\n cards.each do |card|\n create_todoist_task(card.name, false, card.id)\n create_subtasks(card)\n end\n end\n end",
"def make_json_limit_task(channel)\n samples_map = Hash['mmt' => 'data_DoubleMu', \n ... | [
"0.65122205",
"0.57840717",
"0.5569774",
"0.55144083",
"0.54795414",
"0.54754573",
"0.5371252",
"0.53610396",
"0.52705884",
"0.5234533",
"0.51880157",
"0.51639295",
"0.5133813",
"0.5116906",
"0.5099535",
"0.5091702",
"0.5090558",
"0.5079809",
"0.5051377",
"0.5040625",
"0.5037... | 0.52829516 | 8 |
Recipes to harvest limits targets: harvest_limit_mmt harvest_limit_emt harvest_limit_eet harvest_limit_llt harvest_limits | def make_json_limit_task(channel)
samples_map = Hash['mmt' => 'data_DoubleMu',
'eet' => 'data_DoubleElectron',
'emt' => 'data_MuEG',
'llt' => 'data_DoubleMu',
]
carddir = $carddir #makes a copy so that if $cardir changes this does not
json_stamp = "#{$carddir}/#{channel}/.limit_harvested"
file json_stamp => "#{$carddir}/#{channel}/.limits_computed" do |t|
sh "harvest_limits.py #{carddir}/#{channel}"
sh "touch #{t.name}"
sh "add_tag_to_json.py #{carddir}/#{channel}/*.json -l jobid -t #{$jobid}"
sh "add_tag_to_json.py #{carddir}/#{channel}/*.json -l lumi -t #{get_lumi(samples_map[channel], $jobid)}"
end
return json_stamp
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def miter_limit(limit)\n end",
"def limits(limit,bust)\n @limit = limit\n @bust = bust\n end",
"def planted_bombs_limit(action = :increment)\n @bomb_manager.planted_bombs_limit action\n end",
"def limit_rubies\n @limits = [[1, 1], [2, 2], [1, 1], [0, 3], [3, 0], [2, 2], [2, 2]]\n end"... | [
"0.5931172",
"0.5904957",
"0.5888078",
"0.5715984",
"0.5539332",
"0.5521522",
"0.5501443",
"0.54668885",
"0.53805864",
"0.5379604",
"0.53373045",
"0.53369284",
"0.5294135",
"0.527094",
"0.5233742",
"0.52039456",
"0.52034837",
"0.51781416",
"0.51719743",
"0.5101237",
"0.509554... | 0.5111062 | 19 |
Backgroundonly f3 postfit plots, to convince yourself and the others (but mostly the others) that the background estimation is fine | def make_f3_postfit_shapes_task(channel)
shape_file = "results/#{$jobid}/plots/#{channel}/f3/postfit/#{channel}_f3_postfit_shapes.root"
carddir = $carddir #makes a copy so that if $cardir changes this does not
file shape_file => "#{$carddir}/#{channel}/.pulls_computed" do |t|
sh "mkdir -p `dirname #{t.name}`"
sh "cp #{carddir}/#{channel}/shapes.root #{t.name}" #FIXME this may create to rake some problems if next command fails!
sh "#{ENV['CMSSW_BASE']}/src/HiggsAnalysis/HiggsToTauTau/test/postfit.py #{t.name} #{$carddir}/#{channel}/120/vhtt_#{channel}.txt --verbose --bins #{$categories_map[channel].join(' ')} --fitresults #{$carddir}/#{channel}/120/out/mlfit.txt"
end
return shape_file
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup\n \n size 640, 360, P3D\n \n no_stroke\n color_mode RGB, 1\n fill 0.4\n \nend",
"def setup\n \n size 640, 360, P3D\n \n no_stroke\n fill 204\n \nend",
"def isDarkBackground(background,rect=nil)\n return true if !background || background.disposed?\n rect=background.rect if !rect\n retu... | [
"0.4743561",
"0.47419527",
"0.47257483",
"0.46603736",
"0.46493506",
"0.4614793",
"0.46024135",
"0.4591362",
"0.4574945",
"0.45665178",
"0.45201406",
"0.4444853",
"0.44337168",
"0.4412197",
"0.44014347",
"0.43813077",
"0.43722656",
"0.4347139",
"0.432628",
"0.42809024",
"0.42... | 0.43629375 | 17 |
GET /user_groups/1 GET /user_groups/1.json | def show
@user_group = UserGroup.find(params[:id])
@tweets=Tweet.find_by_sql(['select * from tweets where user_id in
(select user_id from user_group_follows where user_group_id=?);',params[:id]]);
respond_to do |format|
format.js { render :json => @tweets}
format.html # show.html.erb
format.json { render json: @user_group}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def groups\n \n \n @groups = @current_user.groups\n render 'groups.json.jbuilder', status: :ok\n end",
"def index\n @groups = current_user.groups\n render json: @groups\n end",
"def groups\n UserGroups.new(:id => id).get.items\n end",
"def show\n @user_group =... | [
"0.80773",
"0.77169454",
"0.7606095",
"0.7559645",
"0.75594455",
"0.7309739",
"0.72886956",
"0.7267894",
"0.72248393",
"0.7154069",
"0.7127444",
"0.7122355",
"0.7102212",
"0.70825654",
"0.70650345",
"0.7024051",
"0.7005877",
"0.7002135",
"0.69946086",
"0.699059",
"0.6974067",... | 0.0 | -1 |
GET /user_groups/new GET /user_groups/new.json | def new
@user_group = UserGroup.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @user_group }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @user = User.find(params[:user_id])\n @groups = @user.groups.new\n\n #@group = Group.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @user_group = UserGroup.new\n @users = User.all\n\n respon... | [
"0.8310889",
"0.81497216",
"0.8142499",
"0.7712325",
"0.77065724",
"0.7702905",
"0.7702905",
"0.7702905",
"0.7702905",
"0.7702905",
"0.7702905",
"0.7702905",
"0.7702905",
"0.7655521",
"0.7640157",
"0.7623279",
"0.7622778",
"0.7622778",
"0.75998354",
"0.7594935",
"0.758957",
... | 0.8208239 | 1 |
POST /user_groups POST /user_groups.json | def create
@user_group = UserGroup.new(params[:user_group])
respond_to do |format|
if @user_group.save
format.html { redirect_to @user_group, notice: 'User group was successfully created.' }
format.json { render json: @user_group, status: :created, location: @user_group }
else
format.html { render action: "new" }
format.json { render json: @user_group.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n #logger.info \"Post parameters: #{params}\"\n @group = Group.new(name: params[:group][:name], expiration: params[:group][:expiration], owner: current_user)\n if @group.save\n @group.memberships.create!(user: current_user, admin: true)\n if params[:group][:users]\n params[:gro... | [
"0.7620012",
"0.7490094",
"0.73576283",
"0.7339031",
"0.7214107",
"0.7198815",
"0.7198815",
"0.7193646",
"0.71699816",
"0.70594156",
"0.70528823",
"0.69945705",
"0.6989121",
"0.6954357",
"0.69419956",
"0.68917257",
"0.68747854",
"0.68747854",
"0.68452394",
"0.6844827",
"0.683... | 0.71942973 | 8 |
PUT /user_groups/1 PUT /user_groups/1.json | def update
@user_group = UserGroup.find(params[:id])
respond_to do |format|
if @user_group.update_attributes(params[:user_group])
format.html { redirect_to @user_group, notice: 'User group was successfully updated.' }
format.json { head :ok }
else
format.html { render action: "edit" }
format.json { render json: @user_group.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @user_group = UserGroup.find(params[:id])\n\n respond_to do |format|\n if @user_group.update_attributes(params[:user_group])\n format.html { redirect_to @user_group, notice: 'User group was successfully updated.' }\n format.json { head :no_content }\n else\n format... | [
"0.72298145",
"0.71930164",
"0.702065",
"0.7013743",
"0.70038235",
"0.6998484",
"0.69377214",
"0.6921055",
"0.69135416",
"0.6888388",
"0.6864287",
"0.6783159",
"0.6760395",
"0.67462766",
"0.67376494",
"0.6737197",
"0.6737197",
"0.6723572",
"0.6694551",
"0.6662927",
"0.6653735... | 0.7262623 | 0 |
DELETE /user_groups/1 DELETE /user_groups/1.json | def destroy
@user_group = UserGroup.find(params[:id])
@user_group.destroy
respond_to do |format|
format.html { redirect_to user_groups_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @user_group = UserGroup.find_by_id(params[:id])\n @user_group.destroy\n render :json=>{:status =>t('users.destroy.success')}\n end",
"def destroy\n @user_group = UserGroup.find(params[:id])\n @user_group.destroy\n\n respond_to do |format|\n format.html { redirect_to user_gro... | [
"0.7891348",
"0.78831",
"0.7809744",
"0.75663036",
"0.75447077",
"0.7542565",
"0.75411755",
"0.75356305",
"0.75271446",
"0.752069",
"0.75115293",
"0.75049376",
"0.7468739",
"0.74383307",
"0.73791003",
"0.7348354",
"0.7343422",
"0.73423296",
"0.7331332",
"0.7329655",
"0.732965... | 0.7893964 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.