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 |
|---|---|---|---|---|---|---|
Use callbacks to share common setup or constraints between actions. | def set_step_comment
@step_comment = StepComment.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.6163754",
"0.6045816",
"0.5944853",
"0.59169096",
"0.58892167",
"0.58342934",
"0.5776148",
"0.57057375",
"0.57057375",
"0.56534296",
"0.56209534",
"0.54244673",
"0.54101455",
"0.54101455",
"0.54101455",
"0.53951085",
"0.5378493",
"0.53563684",
"0.53399915",
"0.5338049",
"0... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def step_comment_params
params.require(:step_comment).permit(:step_id, :text, :user_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.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.629117... | 0.0 | -1 |
GET /auth/users/1 GET /auth/users/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n ... | [
"0.7780559",
"0.7614818",
"0.7589379",
"0.73425686",
"0.73268265",
"0.72848445",
"0.72212046",
"0.71915764",
"0.71829534",
"0.7122379",
"0.711543",
"0.71077293",
"0.7075646",
"0.7057039",
"0.7019066",
"0.69830513",
"0.6979536",
"0.6977397",
"0.69742227",
"0.6973741",
"0.69689... | 0.0 | -1 |
POST /auth/users POST /auth/users.json | def create
# Should pass in external_id to link to auth system
@auth_user = Auth::User.find_or_initialize_by(auth_user_params)
if @auth_user.save
render :show, status: :created, location: @auth_user
else
render json: @auth_user.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end",
"def create_user(params:)\n parse(JSON.parse(connection.post(\"users\", params.to_json).body))\n end",
"def post body=nil, headers={... | [
"0.75048167",
"0.72580373",
"0.7255851",
"0.7226666",
"0.72002476",
"0.7091924",
"0.69367486",
"0.6896399",
"0.68563026",
"0.6854747",
"0.68491673",
"0.6838952",
"0.68238",
"0.6803279",
"0.6791051",
"0.6783138",
"0.67792505",
"0.67774403",
"0.67234075",
"0.6719018",
"0.671637... | 0.0 | -1 |
PATCH/PUT /auth/users/1 PATCH/PUT /auth/users/1.json | def update
if @auth_user.update(auth_user_params)
render :show, status: :ok, location: @auth_user
else
render json: @auth_user.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end",
"def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end",
"de... | [
"0.7189047",
"0.7096239",
"0.70504117",
"0.6936533",
"0.68797207",
"0.68713844",
"0.68713844",
"0.6868728",
"0.68400115",
"0.6829106",
"0.67944413",
"0.6793843",
"0.67922133",
"0.67706513",
"0.6762174",
"0.6760761",
"0.6753037",
"0.6692626",
"0.6666354",
"0.664821",
"0.664675... | 0.0 | -1 |
DELETE /auth/users/1 DELETE /auth/users/1.json | def destroy
@auth_user.destroy
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end",
"def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def delete\n render json: Users.delete(params[\"id\... | [
"0.7953574",
"0.77955025",
"0.779231",
"0.75977445",
"0.7548759",
"0.75391984",
"0.75012046",
"0.7479926",
"0.7469476",
"0.7469476",
"0.7459896",
"0.74544805",
"0.742226",
"0.7420787",
"0.74059457",
"0.74037236",
"0.7400367",
"0.7398843",
"0.7398657",
"0.7386222",
"0.7386222"... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_auth_user
@auth_user = Auth::User.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 auth_user_params
params.require(:auth_user).permit(:external_id, :email)
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 |
these are the most used methods | def initialize()
@User32 = DL.dlopen("user32")
# we must determine the path we are in
@path_to_clicker = File.expand_path(File.dirname(__FILE__))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def operations; end",
"def operations; end",
"def who_we_are\r\n end",
"def schubert; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def formation; end",
"def suivre; end",
"def stderrs; end",
"def berlioz; end",... | [
"0.7338062",
"0.7013442",
"0.6909701",
"0.6909701",
"0.6860245",
"0.6795021",
"0.6664028",
"0.6664028",
"0.6664028",
"0.6664028",
"0.6645654",
"0.6550384",
"0.6478853",
"0.6449703",
"0.6433753",
"0.6409435",
"0.6409435",
"0.63902384",
"0.63248676",
"0.62973654",
"0.6276065",
... | 0.0 | -1 |
we may need to play with the default try count. 3 is a reasonably safe value. | def setFileRequesterFileName( textToSet, tryCount = 3 )
for i in (1..tryCount)
# first set the Choose File Window to be active
hWnd = getWindowHandle("Choose file" )
if hWnd != -1
makeWindowActive(hWnd)
setTextValueForFileNameField( hWnd , textToSet)
clickWindowsButton_hwnd(hWnd, "&Open")
return true
end
end
puts 'File Requester not found'
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def try_three_times\n tries = 0\n begin\n yield\n rescue Exception => e\n tries += 1\n @log.error(\"Error: #{e.message}\")\n if tries < 3\n @log.error(\"Trying again\")\n retry\n end\n @log.error(\"Tried 3 times without success, aborting.\"... | [
"0.7917219",
"0.6844583",
"0.6572336",
"0.6527265",
"0.6520381",
"0.6442181",
"0.63053644",
"0.6254392",
"0.62000376",
"0.6149598",
"0.6123304",
"0.61182034",
"0.61182034",
"0.61182034",
"0.609044",
"0.6041658",
"0.6041658",
"0.6019381",
"0.5938347",
"0.5915112",
"0.59017015"... | 0.0 | -1 |
use this method to launch a clicker in a new process | def clickJSDialog_NewProcess(button = "OK" )
myapp = "#{@path_to_clicker}clickJSDialog.rb #{button}"
log "Starting win clicker in a new process. Looking for button #{button}"
log "Starting app: #{myapp}"
winsystem( "start #{myapp}" )
#if winsystem( myapp ) == false
# log "Clicker failed to start..."
# log $? # some sort of lasterror ?????
#end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def launch(cmd, &block)\n\t\tself.class.launch(cmd, &block)\n\tend",
"def click locator\r\n command 'click', locator\r\n end",
"def click locator\r\n command 'click', locator\r\n end",
"def start\n synchronize {\n return if @app\n info(\"Starting datapath #{name}\")\n\n if File::exi... | [
"0.6039112",
"0.5964908",
"0.5964908",
"0.5954022",
"0.5864889",
"0.57437724",
"0.5649777",
"0.56112206",
"0.5609932",
"0.55949086",
"0.5510027",
"0.5508537",
"0.5504066",
"0.54921377",
"0.54878646",
"0.54862577",
"0.547488",
"0.54729706",
"0.54704666",
"0.5465399",
"0.543494... | 0.707743 | 0 |
the following methods are used internally, they may have uses elsewhere | def getParent (childhWnd )
# pass a hWnd into this function and it will return the parent hWnd
getParentWindow = @User32['GetParent' , 'II' ]
puts " Finding Parent for: " + childhWnd.to_s
a , b = getParentWindow.call(childhWnd )
#puts "a = " a.to_s , b.to_s
return a
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def internal; end",
"def probers; end",
"def implementation; end",
"def implementation; end",
"def custom; end",
"def custom; end",
"def operations; end",
"def operations; end",
"def who_we_are\r\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def sp... | [
"0.78722006",
"0.6926005",
"0.68370104",
"0.6697256",
"0.6697256",
"0.6520656",
"0.6520656",
"0.64994377",
"0.64994377",
"0.6454254",
"0.64422375",
"0.64422375",
"0.64422375",
"0.64422375",
"0.6409463",
"0.6287022",
"0.6179347",
"0.6161899",
"0.6161899",
"0.6161899",
"0.61618... | 0.0 | -1 |
this clicks the button with the name in the window with the caption. It keeps looking for the button until until the timeout expires | def clickWindowsButton (windowCaption , buttonCaption , maxWaitTime=30 )
sleep 1
hwnd = -1
begin
timeout(maxWaitTime) do
hwnd = getWindowHandle(windowCaption)
while hwnd == -1
hwnd = getWindowHandle(windowCaption)
sleep 0.5
end
makeWindowActive(hwnd)
end
rescue
puts "clickWindowsButton: Cant make window active in specified time ( " + maxWaitTime.to_s + ") - no handle"
return false
end
puts ' Window handle is : ' + hwnd.to_s
if hwnd != -1
puts "clickWindowsButton: Handle for window: " + windowCaption + " is: " + hwnd.to_s
makeWindowActive(hwnd)
else
end
d = getChildHandle( hwnd , buttonCaption )
puts ("clickWindowsButton: handle for button: " + buttonCaption + " is " + d.to_s )
if d != -1
makeWindowActive(hwnd)
clickButtonWithHandle (d)
else
return false
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def click_button_with_caption(caption, opts={})\r\n all_buttons = button_elements\r\n matching_buttons = all_buttons.select{|x| x.attribute('value') == caption}\r\n if matching_buttons.size > 0\r\n\r\n if opts && opts[:index]\r\n\t\t\t\t\t\tthe_index = opts[:index].to_i() - 1\r\n ... | [
"0.7261088",
"0.72316587",
"0.7108287",
"0.6864899",
"0.68457514",
"0.6715484",
"0.662788",
"0.6571178",
"0.65666336",
"0.656589",
"0.65562236",
"0.6541233",
"0.6508422",
"0.6505997",
"0.6464979",
"0.6403175",
"0.6399658",
"0.6386602",
"0.63815856",
"0.6370695",
"0.6346198",
... | 0.74699324 | 0 |
GET /filedownloads GET /filedownloads.json | def index
@filedownloads = Filedownload.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def downloaded\n files_list = []\n files = session[:user].x_files.all(:downloads.gte => 1, uploaded: true)\n files.each { |file| files_list.push(file.description(session[:user])) }\n @result = { files: files_list, success: true }\n end",
"def index\n @downloads = Download.all\n\n respond_to do... | [
"0.7433353",
"0.72571015",
"0.66483337",
"0.6559502",
"0.65507066",
"0.6530331",
"0.6526594",
"0.65199715",
"0.6494309",
"0.64163625",
"0.6391174",
"0.6378473",
"0.6352937",
"0.63415736",
"0.6287291",
"0.617931",
"0.6170435",
"0.61511993",
"0.61511993",
"0.61457556",
"0.60993... | 0.7018391 | 2 |
GET /filedownloads/1 GET /filedownloads/1.json | def show
@comment = Comment.new
@comments = Filedownload.find(params[:id]).comments
@fileupload = Filedownload.find(params[:id]).fileupload
set_filedownload
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @downloads = Download.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @downloads }\n end\n end",
"def downloaded\n files_list = []\n files = session[:user].x_files.all(:downloads.gte => 1, uploaded: true)\n files.each { |file| fi... | [
"0.7197087",
"0.7023735",
"0.68899465",
"0.68652624",
"0.65787673",
"0.655461",
"0.6549607",
"0.6511879",
"0.6424217",
"0.6393585",
"0.6380963",
"0.6366917",
"0.6354698",
"0.63475806",
"0.63286334",
"0.6309904",
"0.6289815",
"0.62579656",
"0.6207562",
"0.620334",
"0.61948997"... | 0.0 | -1 |
POST /filedownloads POST /filedownloads.json | def create
if !user_signed_in?
redirect_to :root
end
@filedownload = Filedownload.new(filedownload_params)
if @filedownload.save
download_file @filedownload
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def downloaded\n files_list = []\n files = session[:user].x_files.all(:downloads.gte => 1, uploaded: true)\n files.each { |file| files_list.push(file.description(session[:user])) }\n @result = { files: files_list, success: true }\n end",
"def post_attachment(file_s)\n setup\n @req = Net::HTTP:... | [
"0.63973075",
"0.6243058",
"0.6230724",
"0.6206405",
"0.6206405",
"0.6131827",
"0.6098799",
"0.6098799",
"0.6079264",
"0.60696065",
"0.59997284",
"0.5953853",
"0.59362274",
"0.59155303",
"0.5910239",
"0.5909404",
"0.59062517",
"0.5892315",
"0.5880002",
"0.5879975",
"0.5869713... | 0.59040415 | 17 |
PATCH/PUT /filedownloads/1 PATCH/PUT /filedownloads/1.json | def update
if !user_signed_in?
redirect_to :root
else
if current_user.user?
redirect_to :root
end
end
download_file @filedownload
if @filedownload.update(filedownload_params)
download_file @filedownload
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @treq = Treq.find(params[:id])\n\n respond_to do |format|\n unless params[:treq_files].blank?\n params[:treq_files]['file'].each do |a|\n @treq_file = @treq.treq_files.create!(:file => a, :treq_id => @treq.id)\n end\n end\n if @treq.update_attributes... | [
"0.6385997",
"0.6333129",
"0.6289418",
"0.6272004",
"0.62420696",
"0.6236801",
"0.61715454",
"0.61715454",
"0.6128991",
"0.60880625",
"0.60696733",
"0.59872395",
"0.59698194",
"0.5969428",
"0.5936919",
"0.59314525",
"0.5914602",
"0.5887697",
"0.5886367",
"0.5845627",
"0.58385... | 0.55985004 | 73 |
DELETE /filedownloads/1 DELETE /filedownloads/1.json | def destroy
if !user_signed_in?
redirect_to :root
else
if current_user.user?
redirect_to :root
end
end
@filedownload.destroy
respond_to do |format|
format.html { redirect_to filedownloads_url, notice: 'Filedownload was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @download = Download.find(params[:id])\n @download.destroy\n\n respond_to do |format|\n format.html { redirect_to downloads_url }\n format.json { head :no_content }\n end\n end",
"def delete_file(filename,repo)\n curl_delete(\"#{self.host}/api2/repos/#{repo}/file/?p=#{f... | [
"0.74407715",
"0.7393359",
"0.72684795",
"0.71887046",
"0.71855366",
"0.7180174",
"0.7180174",
"0.7161444",
"0.71491575",
"0.71491575",
"0.71463937",
"0.714537",
"0.70664513",
"0.70410764",
"0.7037067",
"0.7036907",
"0.7020807",
"0.6989612",
"0.69761616",
"0.6975089",
"0.6973... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_filedownload
@filedownload = Filedownload.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 filedownload_params
params.require(:filedownload).permit(:user_id, :fileupload_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 |
Write a method that takes an Array, and returns a new Array with the elements of the original list in reverse order. Do not modify the original list. You may not use Arrayreverse or Arrayreverse!, nor may you use the method you wrote in the previous exercise. | def reverse(array)
new_array = array.dup
counter, finish, max = 0, -1, (array.length)
while counter < max
new_array[finish] = array[counter]
counter += 1
finish -= 1
end
new_array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reverse_array (array) \n return array.reverse\nend",
"def reverse_array(array)\n array.reverse!\n array\nend",
"def reverse_array(array)\n array.reverse \nend",
"def reverse_array(array)\n array.reverse\nend",
"def reverse_array(array)\n array.reverse\nend",
"def reverse_array(array)\n a... | [
"0.87987494",
"0.879732",
"0.87934077",
"0.8792125",
"0.8770343",
"0.8770343",
"0.8770343",
"0.8770343",
"0.8770343",
"0.8770343",
"0.8770343",
"0.8770343",
"0.8770343",
"0.8770343",
"0.8770343",
"0.8770343",
"0.8770343",
"0.8770343",
"0.8770343",
"0.8770343",
"0.8770343",
... | 0.8101571 | 82 |
=> true Their solution | def reverse(array)
result_array = []
array.reverse_each { |element| result_array << element }
result_array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solved?\n end",
"def hook_solution?(a); end",
"def solvable?\n find_solution > 0\n end",
"def is_solution? \n zero= false\n 0.upto(@width-1) do |x|\n 0.upto(@height-1) do |y|\n if @pole[x][y]==0\n zero = true\n break\n end\n end\n ... | [
"0.7213032",
"0.72042745",
"0.7147273",
"0.6671373",
"0.66422814",
"0.66339314",
"0.6606109",
"0.6595073",
"0.65751165",
"0.65733445",
"0.65693575",
"0.6557264",
"0.6556489",
"0.6536566",
"0.6511492",
"0.6495304",
"0.6490308",
"0.6478009",
"0.647185",
"0.6446214",
"0.6435418"... | 0.0 | -1 |
only want a getter for id | def initialize(radius)
@radius = radius
@@no_of_circles += 1
@id = @@no_of_circles
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getId\n @id\n end",
"def get_id\n @id\n end",
"def get_id\n @id\n end",
"def get_id\n @id\n end",
"def get_id\n @id\n end",
"def id\n read_attr :id\n end",
"def id\n get_val(:id)\n end",
"def id\n raise NotImplementedError\n end",
"def id\n @id\n end",
... | [
"0.8109212",
"0.80488175",
"0.80488175",
"0.80488175",
"0.80488175",
"0.79631495",
"0.7886711",
"0.7851558",
"0.7845599",
"0.7845599",
"0.7834811",
"0.7834811",
"0.7834811",
"0.7834811",
"0.7834811",
"0.7834811",
"0.7834811",
"0.7834811",
"0.7834811",
"0.7834811",
"0.7834811"... | 0.0 | -1 |
Make a lister object | def initialize
@lister = Lister.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @list = List.new\n end",
"def new\n @list = List.new\n end",
"def list\n @list_helper ||= ListWrapper.new(self)\n end",
"def ll_create()\n return Linked_List.new()\nend",
"def make_item_list\n end",
"def initialize(list)\n @list = list\n end",
"def define_list(&block... | [
"0.67835563",
"0.6697592",
"0.66566557",
"0.66327673",
"0.66038543",
"0.6459204",
"0.6423228",
"0.6391089",
"0.6343296",
"0.6298108",
"0.627719",
"0.6273962",
"0.6191686",
"0.6157543",
"0.61096525",
"0.60762787",
"0.6074127",
"0.60600424",
"0.60361046",
"0.6005389",
"0.599682... | 0.75148654 | 0 |
navigate the browser to the specified page in unittests/html IF the browser is not already on that page. | def uses_page page # only works with IE
new_url = self.class.html_root + page
browser.goto new_url unless browser.url == new_url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def go_to_page(url)\n Logbook.step(\"Open start page #{url} :)\")\n @browser.get url\n sleep 2\n\n @browser\n end",
"def goto_page(page)\r\n perform_operation {\r\n @web_browser.goto_page(page) if @web_browser\r\n }\r\n end",
"def goto_page(path)\r\n @browser.navigate.to(si... | [
"0.6712769",
"0.6571098",
"0.64729154",
"0.6414517",
"0.64034927",
"0.6390275",
"0.6364903",
"0.6344106",
"0.6303299",
"0.6289431",
"0.6273137",
"0.62605923",
"0.6252683",
"0.6224054",
"0.62178963",
"0.61873055",
"0.618326",
"0.6145946",
"0.6143529",
"0.60129833",
"0.60027015... | 0.77090365 | 0 |
Add a filter that excludes tests matching the provided block | def filter_out &block
@@filter << Proc.new do |test|
block.call(test) ? false : nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reject(&block)\n append(Filter.new { |value| ! block.call(value) })\n end",
"def reject(&block)\n raise \"Missing block\" unless block\n raise \"filter already called on this experiment\" if @request_filter_block\n\n @request_filter_block = block\n end",
"def add_ignor... | [
"0.67062145",
"0.65631884",
"0.654185",
"0.6503376",
"0.6344545",
"0.6221438",
"0.6221438",
"0.6144309",
"0.60691065",
"0.5948653",
"0.5946014",
"0.5916034",
"0.5846463",
"0.5798338",
"0.5789739",
"0.57885885",
"0.5738468",
"0.5733258",
"0.5717807",
"0.57037026",
"0.5698095",... | 0.7507568 | 0 |
Return true if user is logged in and is admin, otherwise false | def admin_loggedin?
@logged_in_user and @logged_in_user.admin?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin_user?\n (current_user.role == 'admin') if logged_in?\n end",
"def admin_logged_in?\n current_user && current_user.admin?\n end",
"def admin?\n logged_in? && current_user.admin\n end",
"def user_admin?\n user_logged_in? && @current_user.type == 'Admin'\n end",
"def admin?\n... | [
"0.9006266",
"0.89871573",
"0.89631957",
"0.89399177",
"0.8936093",
"0.8918442",
"0.8912148",
"0.8906252",
"0.88987774",
"0.88987774",
"0.8898165",
"0.8872551",
"0.8869719",
"0.8869719",
"0.8869719",
"0.8869719",
"0.8869719",
"0.88288486",
"0.8825027",
"0.8820877",
"0.8814835... | 0.91415846 | 0 |
Return true if user is authorized for controller/action, otherwise false | def authorize_for(controller, action)
User.current.allowed_to?({:controller => controller, :action => action}, @project)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorized?(user, action)\n\t\ttrue\n\tend",
"def authorized?\n\n return false unless current_user\n\n %w{ show index }.include?(action_name) || current_user.is_admin?\n end",
"def authorized\n\t\tif current_user\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend",
"def authorized?(u... | [
"0.8821572",
"0.851938",
"0.84383655",
"0.8383618",
"0.82895786",
"0.8257351",
"0.8255241",
"0.82199913",
"0.8163098",
"0.81484413",
"0.8125656",
"0.81225866",
"0.81006545",
"0.80979246",
"0.80933136",
"0.8081543",
"0.80402017",
"0.7984064",
"0.7982193",
"0.7971386",
"0.79683... | 0.7393703 | 89 |
Display a link if user is authorized | def link_to_if_authorized(name, options = {}, html_options = nil, *parameters_for_method_reference)
link_to(name, options, html_options, *parameters_for_method_reference) if authorize_for(options[:controller], options[:action])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_link_if_authorized(name, options = {}, html_options = {})\n enable_link = html_options.has_key?(:disabled) ? !html_options[:disabled] : true\n if enable_link and authorized_for(options)\n link_to(name, options, html_options)\n else\n \"\"\n end\n end",
"def authorized_user\n ... | [
"0.74770385",
"0.74501",
"0.7437615",
"0.713281",
"0.7044694",
"0.7027027",
"0.70091563",
"0.7007427",
"0.6963713",
"0.6894855",
"0.6894855",
"0.687588",
"0.687588",
"0.6856463",
"0.6842122",
"0.6824928",
"0.6798522",
"0.67855287",
"0.6783497",
"0.67810726",
"0.6750315",
"0... | 0.7087628 | 4 |
Display a link to user's account page | def link_to_user(user)
link_to user.name, :controller => 'account', :action => 'show', :id => user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_link\n return link_to I18n.t('user.show'), user_path(current_user) if current_user?\n link_to I18n.t('navigation.sign_up'), new_user_path\n end",
"def link_to_user(user, options={})\r\n (user) ? link_to(user.name, :controller => 'account', :action => 'show', :id => user) : 'Anonymous'\r\n ... | [
"0.8221475",
"0.77453506",
"0.72267216",
"0.7221705",
"0.71912205",
"0.7129192",
"0.7129192",
"0.7129192",
"0.7128953",
"0.7107922",
"0.7091459",
"0.70658004",
"0.70333105",
"0.6904434",
"0.6891453",
"0.6866869",
"0.6862216",
"0.68415177",
"0.68193305",
"0.67767006",
"0.67390... | 0.7850186 | 1 |
textilize text according to system settings and RedCloth availability | def textilizable(text, options = {})
return "" if text.blank?
# different methods for formatting wiki links
case options[:wiki_links]
when :local
# used for local links to html files
format_wiki_link = Proc.new {|title| "#{title}.html" }
when :anchor
# used for single-file wiki export
format_wiki_link = Proc.new {|title| "##{title}" }
else
if @project
format_wiki_link = Proc.new {|title| url_for :controller => 'wiki', :action => 'index', :id => @project, :page => title }
else
format_wiki_link = Proc.new {|title| title }
end
end
# turn wiki links into textile links:
# example:
# [[link]] -> "link":link
# [[link|title]] -> "title":link
text = text.gsub(/\[\[([^\]\|]+)(\|([^\]\|]+))?\]\]/) {|m| "\"#{$3 || $1}\":" + format_wiki_link.call(Wiki.titleize($1)) }
# turn issue ids into links
# example:
# #52 -> <a href="/issues/show/52">#52</a>
text = text.gsub(/#(\d+)(?=\b)/) {|m| link_to "##{$1}", :controller => 'issues', :action => 'show', :id => $1}
# turn revision ids into links (@project needed)
# example:
# r52 -> <a href="/repositories/revision/6?rev=52">r52</a> (@project.id is 6)
text = text.gsub(/(?=\b)r(\d+)(?=\b)/) {|m| link_to "r#{$1}", :controller => 'repositories', :action => 'revision', :id => @project.id, :rev => $1} if @project
# when using an image link, try to use an attachment, if possible
attachments = options[:attachments]
if attachments
text = text.gsub(/!([<>=]*)(\S+\.(gif|jpg|jpeg|png))!/) do |m|
align = $1
filename = $2
rf = Regexp.new(filename, Regexp::IGNORECASE)
# search for the picture in attachments
if found = attachments.detect { |att| att.filename =~ rf }
image_url = url_for :controller => 'attachments', :action => 'show', :id => found.id
"!#{align}#{image_url}!"
else
"!#{align}#{filename}!"
end
end
end
# finally textilize text
@do_textilize ||= (Setting.text_formatting == 'textile') && (ActionView::Helpers::TextHelper.method_defined? "textilize")
text = @do_textilize ? auto_link(RedCloth.new(text, [:hard_breaks]).to_html) : simple_format(auto_link(h(text)))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def textilize(text) \n text = swear_generator(text)\n RedCloth.new(text).to_html.html_safe unless text.blank? \n end",
"def textilize\n\t\tunless self.blank?\n\t\t RedCloth.new(self, [:filter_styles, :no_span_caps]).to_html\n\t\telse\n\t\t \"\"\n\t end\n\tend",
"def curate_text\n # FIXME: G... | [
"0.6897595",
"0.6880315",
"0.6573881",
"0.65119267",
"0.65119267",
"0.64870036",
"0.6464905",
"0.6462265",
"0.6320604",
"0.624526",
"0.6223479",
"0.6202646",
"0.6193414",
"0.6114752",
"0.6096727",
"0.6002246",
"0.5995452",
"0.59811145",
"0.59321886",
"0.58702654",
"0.5870237"... | 0.0 | -1 |
Same as Rails' simple_format helper without using paragraphs | def simple_format_without_paragraph(text)
text.to_s.
gsub(/\r\n?/, "\n"). # \r\n and \r -> \n
gsub(/\n\n+/, "<br /><br />"). # 2+ newline -> 2 br
gsub(/([^\n]\n)(?=[^\n])/, '\1<br />') # 1 newline -> br
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def simple_format(text)\r\n text.gsub!(/(\\r\\n|\\n|\\r)/, \"\\n\") # lets make them newlines crossplatform\r\n text.gsub!(/\\n\\n+/, \"\\n\\n\") # zap dupes\r\n text.gsub!(/\\n\\n/, '</p>\\0<p>') # turn two newlines into paragraph\r\n text.gsub!(/([^\\n])(\\n)([^\\n])/, '\\1\\2<br />\\... | [
"0.7800862",
"0.7501086",
"0.7493744",
"0.7461001",
"0.74175787",
"0.7408535",
"0.7404922",
"0.7360612",
"0.7294569",
"0.7277922",
"0.7271212",
"0.7256887",
"0.72188926",
"0.7188242",
"0.7184766",
"0.7152508",
"0.7119017",
"0.70971596",
"0.70598924",
"0.69938254",
"0.6985308"... | 0.71736246 | 15 |
Return data about the user | def show
# If data has not changed, return a 304
if stale? etag: EtagCalculator.etag(current_user.user_data_updated_at),
last_modified: current_user.user_data_updated_at
@user = current_user
respond_with @user
end
rescue => e
handle_error e
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_information\n { \"username\": @user.username, \"email\": @user.email, \"id\": @user.id }\n end",
"def user_info\n response = from_server \"api/user.json\"\n response.data\n end",
"def user_data\n User.user_data login\n end",
"def user_data\n {\n user_id... | [
"0.79430676",
"0.79050034",
"0.7826551",
"0.7660359",
"0.76307505",
"0.75950813",
"0.7590208",
"0.7560377",
"0.75514215",
"0.74657786",
"0.74541306",
"0.7439667",
"0.7417854",
"0.741621",
"0.7351133",
"0.7322742",
"0.72971773",
"0.7294925",
"0.728571",
"0.7275753",
"0.7241422... | 0.67259675 | 76 |
Returns an Hash, name => Input that have actually been mentioned | def list_inputs_for_profile(profile)
inputs_by_profile[profile] = {} unless profile_known?(profile)
inputs_by_profile[profile]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token_inputs\n { :id => _id, :name => name }\n end",
"def gather_input\n name = name_check\n email = email_check\n\n {user: {name: name, email: email}}\n end",
"def mentions\n result_hash['mention']\n end",
"def about_me_data\n hash = {}\n target_div = self.div(:class=>\"s3d-... | [
"0.6011164",
"0.58362365",
"0.5785023",
"0.5665485",
"0.54464704",
"0.5426751",
"0.5405365",
"0.53743607",
"0.53416777",
"0.53404313",
"0.5303107",
"0.52481544",
"0.52458924",
"0.52432436",
"0.5235303",
"0.5216935",
"0.5155673",
"0.51518404",
"0.5125319",
"0.5115605",
"0.5103... | 0.0 | -1 |
Returns an Array of input names. This includes input names that plugins may be able to fetch, but have not actually been mentioned in the control code. | def list_potential_input_names_for_profile(profile_name)
input_names_from_dsl = inputs_by_profile[profile_name].keys
input_names_from_plugins = plugins.map { |plugin| plugin.list_inputs(profile_name) }
(input_names_from_dsl + input_names_from_plugins).flatten.uniq
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keys\n @inputs.keys\n end",
"def inputs\n @input_map.values\n end",
"def missing_step_inputs inputs\n inputs_names = inputs.keys\n inputs_names ||= []\n results = []\n @steps.each do |step|\n output_names = step.outputs\n missing = step.missing_inputs inputs_na... | [
"0.6446192",
"0.6128526",
"0.61251813",
"0.6062047",
"0.5970186",
"0.5937791",
"0.59070957",
"0.58926237",
"0.5858797",
"0.58195966",
"0.5802963",
"0.5774128",
"0.5768677",
"0.574806",
"0.57018155",
"0.57004577",
"0.5690715",
"0.5650696",
"0.56451714",
"0.56385326",
"0.563843... | 0.6835255 | 0 |
Support for Individual Inputs | def find_or_register_input(input_name, profile_name, options = {})
if profile_alias?(profile_name) && !profile_aliases[profile_name].nil?
alias_name = profile_name
profile_name = profile_aliases[profile_name]
handle_late_arriving_alias(alias_name, profile_name) if profile_known?(alias_name)
end
# Find or create the input
inputs_by_profile[profile_name] ||= {}
if inputs_by_profile[profile_name].key?(input_name)
inputs_by_profile[profile_name][input_name].update(options)
else
inputs_by_profile[profile_name][input_name] = Inspec::Input.new(input_name, options)
poll_plugins_for_update(profile_name, input_name)
end
inputs_by_profile[profile_name][input_name]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def input; end",
"def input; end",
"def input; end",
"def input; @input; end",
"def input; @input; end",
"def get_input;\t@input \t\tend",
"def input\n @all[:input]\n end",
"def key_inputs; end",
"def input=(_arg0); end",
"def input(inputItem)\n @input = inputItem\n end",
"def _i... | [
"0.7133706",
"0.7133706",
"0.7133706",
"0.69815034",
"0.69815034",
"0.6976655",
"0.68278015",
"0.6794576",
"0.6758513",
"0.6755741",
"0.6733793",
"0.67062247",
"0.6675508",
"0.662595",
"0.6598063",
"0.65556556",
"0.6485966",
"0.6417572",
"0.6384566",
"0.6382844",
"0.6378813",... | 0.0 | -1 |
It is possible for a wrapper profile to create an input in metadata, referring to the child profile by an alias that has not yet been registered. The registry will then store the inputs under the alias, as if the alias were a true profile. If that happens and the child profile also mentions the input, we will need to move some things all inputs should be stored under the true profile name, and no inputs should be stored under the alias. | def handle_late_arriving_alias(alias_name, profile_name)
inputs_by_profile[profile_name] ||= {}
inputs_by_profile[alias_name].each do |input_name, input_from_alias|
# Move the inpuut, or if it exists, merge events
existing = inputs_by_profile[profile_name][input_name]
if existing
existing.events.concat(input_from_alias.events)
else
inputs_by_profile[profile_name][input_name] = input_from_alias
end
end
# Finally, delete the (now copied-out) entry for the alias
inputs_by_profile.delete(alias_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_or_register_input(input_name, profile_name, options = {})\n if profile_alias?(profile_name) && !profile_aliases[profile_name].nil?\n alias_name = profile_name\n profile_name = profile_aliases[profile_name]\n handle_late_arriving_alias(alias_name, profile_name) if profile_known?(a... | [
"0.642458",
"0.6039672",
"0.5622837",
"0.5337885",
"0.51691747",
"0.5141211",
"0.51398903",
"0.5109073",
"0.50197875",
"0.49288085",
"0.49254084",
"0.47826207",
"0.47814548",
"0.47640523",
"0.47108576",
"0.4703834",
"0.4639667",
"0.4620416",
"0.4612552",
"0.45758677",
"0.4575... | 0.61976737 | 1 |
Support for Binding Inputs This method is called by the Profile as soon as it has enough context to allow binding inputs to it. | def bind_profile_inputs(profile_name, sources = {})
inputs_by_profile[profile_name] ||= {}
# In a more perfect world, we could let the core plugins choose
# self-determine what to do; but as-is, the APIs that call this
# are a bit over-constrained.
bind_inputs_from_metadata(profile_name, sources[:profile_metadata])
bind_inputs_from_input_files(profile_name, sources[:cli_input_files])
bind_inputs_from_runner_api(profile_name, sources[:runner_api])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def binding; super end",
"def binding_params\n params.require(:binding).permit(:name)\n end",
"def binding() end",
"def binding() end",
"def _binding() binding end",
"def _binding() binding end",
"def binding_required\n RPH::FormAssistant::Rules.binding_required?\n end",
"def poin... | [
"0.5870866",
"0.5777124",
"0.57056695",
"0.57056695",
"0.56662333",
"0.56662333",
"0.5526916",
"0.54964525",
"0.54933286",
"0.54439497",
"0.5415394",
"0.54066247",
"0.5405824",
"0.53582567",
"0.5299367",
"0.52472603",
"0.5230458",
"0.5219061",
"0.5219061",
"0.5216818",
"0.520... | 0.6283797 | 0 |
define_routes do |map| map.connect 'admin/restricted_page/:action', :controller => 'admin/restricted_page' end | def activate
RestrictedPage
# admin.tabs.add "Restricted Page", "/admin/restricted_page", :after => "Layouts", :visibility => [:all]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def custom_routes; end",
"def redirect_non_admins_to\n \"/\"\n end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def au... | [
"0.6592593",
"0.64062065",
"0.62806445",
"0.62806445",
"0.62806445",
"0.62806445",
"0.62806445",
"0.62806445",
"0.62806445",
"0.62806445",
"0.62806445",
"0.62806445",
"0.62806445",
"0.6252098",
"0.62498134",
"0.6201263",
"0.61841875",
"0.6182865",
"0.6170474",
"0.6170209",
"0... | 0.6227124 | 15 |
for dashboard sort order dropdown | def dashboard_positions_collection
(1..(self.owned_dashboards.count + 1)).collect do |i|
[i, i.ordinalize]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_sort_options\n sortDropdown = \"\"\n eds_info.fetch('AvailableSearchCriteria', {}).fetch('AvailableSorts', []).each do |sort_option|\n sortDropdown << \"<li><a href='#{eds_action_url sort_option[\"AddAction\"].to_s}'>#{sort_option[\"Label\"].to_s}</a></li>\"\n end\n sortDropdown.html_safe... | [
"0.7423516",
"0.6901179",
"0.6773407",
"0.66874635",
"0.66575116",
"0.66575116",
"0.66575116",
"0.66575116",
"0.66575116",
"0.66575116",
"0.66575116",
"0.66575116",
"0.66575116",
"0.66365606",
"0.65909183",
"0.6531794",
"0.6492255",
"0.64122015",
"0.64122015",
"0.64122015",
"... | 0.0 | -1 |
instance method Memberships > helper method already here Use gym method to calculate the total_cost copied gyms over and grabbed different data | def total_cost
# binding.pry
self.memberships.map{|membership| membership.cost }.sum
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gym_cost\n \t\tgym_cost = memberships.map{|member|member.cost}\n \t\tgym_cost.sum\n end",
"def gym_cost\n all_gym_costs = self.memberships.map {|membership| membership.cost}\n all_gym_costs.sum\n end",
"def total_cost\n# Get the total cost of a specific lifter's gym memberships\n membs_cost... | [
"0.74773026",
"0.7434873",
"0.71482503",
"0.6845507",
"0.6833258",
"0.6731029",
"0.67225283",
"0.6720775",
"0.6714132",
"0.6648505",
"0.6617876",
"0.6609175",
"0.6596286",
"0.6590236",
"0.65676945",
"0.65666795",
"0.65232843",
"0.6480827",
"0.6434227",
"0.64257246",
"0.641666... | 0.6464142 | 18 |
init new shopping cart. shopping cart total = 0 on init b/c when u first get a cart it is empty set discount var = parameter update total w/ discount if discount is available each new cash register opens its own Arr to count items (itemsArr) | def initialize(discount=0)
@total = 0
@discount = discount
@@itemsArr = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(discount=0)\n #total begin at 0\n @total = 0\n @discount = discount\n #creats an array to hold all the items\n @items = []\n end",
"def initialize(discount = 0) #sets an instance variable @total on initialization to zero\n @total = 0\n @discount = discount\n @items = [... | [
"0.7827145",
"0.768751",
"0.7675431",
"0.7600939",
"0.7558931",
"0.75550175",
"0.75550175",
"0.7534328",
"0.75153726",
"0.749409",
"0.7440594",
"0.7409793",
"0.7361006",
"0.7276608",
"0.7209185",
"0.7191093",
"0.7079432",
"0.7038033",
"0.70128894",
"0.69411945",
"0.6855938",
... | 0.75410765 | 7 |
Converts start_date from date to formatted string | def format_start_date()
if Date.valid_date?(self.year, self.month, self.day)
return self.month.to_s + '/' + self.day.to_s
else
raise "Invalid start date specified."
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_date_as_string\n as_string @start_date\n end",
"def started_at_date\n if !@started_at_date_string\n @started_at_date_string = self.start_date_time.strftime(\"%A %-m/%d/%Y\")\n end\n @started_at_date_string\n end",
"def start_date_us_format\n start_date.nil? ? nil : start_date.st... | [
"0.8160785",
"0.7442491",
"0.7329497",
"0.7235785",
"0.7235785",
"0.7188197",
"0.71047133",
"0.7033409",
"0.6925191",
"0.69035953",
"0.6902345",
"0.6895235",
"0.6865498",
"0.68448955",
"0.68046355",
"0.68045515",
"0.6742429",
"0.6731903",
"0.66923594",
"0.6673317",
"0.6667872... | 0.7895876 | 1 |
Logs in to spike using mechanize | def spike_login()
agent = Mechanize.new
login = agent.get(self.spike_root_url) #Go to login page
loginform = agent.page.forms.first #Select login form
loginform.username = self.username
loginform.password = self.password
gsr = agent.submit(loginform, loginform.buttons.first) #Submit form and log in
return {'agent' => agent, 'gsr' => gsr}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login\n @agent = Mechanize.new\n @page = @agent.get 'https://p.eagate.573.jp/gate/p/login.html'\n @page.encoding = 'utf-8'\n\n form = @page.forms[0]\n form.KID = Config::USER\n form.pass = Config::PASS\n @page = @agent.submit(form)\n end",
"def login_clark\n top_login_button.click\n ... | [
"0.71823096",
"0.6895674",
"0.68202424",
"0.6819441",
"0.6817707",
"0.67974794",
"0.675984",
"0.6757397",
"0.66372603",
"0.6636575",
"0.6634858",
"0.66064996",
"0.6589525",
"0.658098",
"0.65631187",
"0.65556586",
"0.652325",
"0.6514132",
"0.6514132",
"0.6501627",
"0.64757055"... | 0.77333397 | 0 |
Reserves the GSR requirements is an optional hash with keys: floor (string [F, G, 2, 3]), start_time (Time), duration (integer, minutes [30,60, or 90]) | def reserve(requirements)
#Check if we have a non-kosher floor and revert to default
requirements['floor'] = "" if !(requirements['floor'].nil?) and
!(["", "F", "G", "2", "3"].include? requirements['floor'])
#Default args
default_options = {'floor' => "", 'start_time' => Time.now, 'duration' => 90}
args = default_options.merge(requirements)
#Convert start_date and start_time from date and time to correct form format
start_time = args['start_time'].format_start_time
start_date = args['start_time'].format_start_date
#Duration logic - round to 30, 60, or 90 (nearest)
unless requirements['duration'].nil?
if args['duration'] <= 30
args['duration'] = 30
elsif args['duration'] <= 60
args['duration'] = 60
else
args['duration'] = 90
end
end
agent = spike_login()['agent'] # Mechanize agent at successful login page
gsr = spike_login()['gsr'] # Mechanize page = successful login page
gsrform = gsr.form_with(:action => 'https://spike.wharton.upenn.edu/m/gsr.cfm') #Select GSR form
#Input GSR info
gsrform.preferred_floor = args['floor']
gsrform.start_date = start_date
gsrform.start_time = start_time
gsrform.duration = args['duration']
#Submit reservation
submit = agent.submit(gsrform, gsrform.buttons.first)
#Check if successful
raise "Error reserving GSR. Check supplied parameters." if submit.link_with(:text => 'Cancel').nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_reserves(r, g, code, acc)\n puts @commodity\n ore = r.send(code).to_f * @@unit_codes[r.unit_quantity]\n grade = g.send(code).to_f * @@unit_codes[g.unit_grade]\n mineral = calculate_contained_mineral(r, g, code)\n resource = {:ore=>ore,:grade=>grade,:mineral=>mineral}\n\n classes=Hash[\"#... | [
"0.550141",
"0.52857476",
"0.5210287",
"0.5091597",
"0.49956608",
"0.49509576",
"0.494589",
"0.4930274",
"0.48956558",
"0.48749998",
"0.4869684",
"0.4851811",
"0.4851811",
"0.4851811",
"0.4851811",
"0.48497412",
"0.48331437",
"0.48194134",
"0.48029304",
"0.48008162",
"0.47957... | 0.78593034 | 0 |
Cancels most recent GSR reservation | def cancel()
agent = spike_login()['agent'] # Mechanize agent at successful login page
gsr = spike_login()['gsr'] # Mechanize page = successful login page
cancel = gsr.link_with(:text => 'Cancel')
if (cancel.nil?)
raise "Error: You have no GSR reservation to cancel."
else
gsr = cancel.click
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancel\n if @reservation.can_cancel?\n @reservation.cancel!\n redirect_to reservations_path, notice: \"Shipment cancelled.\"\n else\n redirect_to reservations_path, alert: \"That gift is marked as #{@reservation.state} and cannot have its shipment cancelled.\"\n end\n end",
"def canc... | [
"0.6567334",
"0.63440967",
"0.6334557",
"0.6264343",
"0.62481153",
"0.6086395",
"0.59218377",
"0.58901006",
"0.58809793",
"0.5846443",
"0.5813662",
"0.5811262",
"0.57679886",
"0.57604814",
"0.57596177",
"0.5755809",
"0.5751465",
"0.5656997",
"0.5653987",
"0.5652591",
"0.56344... | 0.64147335 | 1 |
create sorting key for spine shelfkey asc, then by sorting title asc, then by pub date desc note: pub_date must be inverted for descending sort | def spine_sort_key
sort_pub_date = if document[:pub_date].blank?
'9999'
else
document[:pub_date].tr('0123456789', '9876543210')
end
[
shelfkey,
document[:title_sort].to_s,
sort_pub_date,
document[:id].to_s
]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_docs_by_key!; end",
"def sort_by_key(ascending=true, num_partitions=nil)\n self.sort_by('lambda{|(key, _)| key}')\n end",
"def tie_breaking_sort\n { \"content_id\" => { order: \"asc\" } }\n end",
"def shelfkey_field\n BlacklightBrowseNearby::Engine.config.sortkey_field\n end",
... | [
"0.7155198",
"0.6455457",
"0.64018995",
"0.6365749",
"0.6293348",
"0.62139124",
"0.60377485",
"0.59831303",
"0.5977322",
"0.594738",
"0.59368134",
"0.5934026",
"0.5925707",
"0.58931106",
"0.58879006",
"0.5885446",
"0.58733815",
"0.5843365",
"0.5843365",
"0.5829353",
"0.580288... | 0.8361876 | 0 |
LiveLookup::Folio uses the item UUID, while LiveLookup::Sirsi uses the barcode for identifying items. | def live_lookup_item_id
id || folio_item&.id || barcode
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_retrieve_barcode_items(items:)\n show do \n title 'Get and scan items'\n note 'Instructions to go get items and scan them to make sure they are the right item'\n end\n return items\n end",
"def item_from_uuid(id)\n @items.find { |i| i[:id].to_s == id } || raise(\"Una... | [
"0.58946085",
"0.58753365",
"0.58134776",
"0.57156694",
"0.57020855",
"0.5676319",
"0.5674367",
"0.56346536",
"0.55630356",
"0.55586815",
"0.5558028",
"0.5558028",
"0.55567676",
"0.5556617",
"0.55320203",
"0.55110997",
"0.55090547",
"0.5484748",
"0.5463848",
"0.546343",
"0.54... | 0.6875679 | 0 |
is in the list of stackmappable libraries | def stackmapable_library?
settings = Settings.libraries[library]
return settings.stackmap_api.present? if settings
Honeybadger.notify("Called stackmapable_library? on an unknown library", context: { library: })
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_for_libraries; end",
"def libs; end",
"def load_libs; end",
"def library?\n sort == ::LIBRARY\n end",
"def is_libname?(); @type == GRT_LIBNAME; end",
"def library_defined?( klass )\n library_handler.defined?(klass)\n end",
"def library_loaded?(library_name)\n @loaded_libr... | [
"0.7045222",
"0.7030966",
"0.6904873",
"0.665474",
"0.65388656",
"0.64830786",
"0.64216906",
"0.63636583",
"0.63499194",
"0.6227508",
"0.62100744",
"0.6208882",
"0.6197436",
"0.6197436",
"0.6195862",
"0.61070204",
"0.6083855",
"0.6079339",
"0.6032996",
"0.6003345",
"0.5997110... | 0.7164153 | 0 |
supports a global and local skip list for home_location | def stackmapable_location?
return false if Settings.global_ignored_stackmap_locations.include?(home_location)
Array(Settings.libraries[library].ignored_stackmap_locations).exclude?(home_location)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_as_home?(loc)\n case loc\n when 'RESERVES'\n true\n when /^RSRV-/\n true\n when 'NEWBOOKS'\n true\n else\n false\n end\n end",
"def go_home?\n @in_coffin\n end",
"def at_home?\n\t\tif(@locat... | [
"0.63051665",
"0.60309064",
"0.5560959",
"0.55003375",
"0.544661",
"0.5428176",
"0.5410222",
"0.5372451",
"0.5370359",
"0.5354926",
"0.53421366",
"0.5336708",
"0.5278951",
"0.52434087",
"0.5238855",
"0.52334976",
"0.52325445",
"0.5218511",
"0.51907116",
"0.519002",
"0.517064"... | 0.62294424 | 1 |
Will apply all the advices to a given target based on provided options | def apply
invoke_deferred_logics
return if advices.empty?
define_methods_for_advice_blocks
add_to_instances unless @options[:existing_methods_only]
apply_to_methods unless @options[:new_methods_only]
add_method_hooks unless @options[:existing_methods_only]
# TODO: clear deferred logic results if they are not used in any advice
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply(klass)\n if klass.respond_to? :advices\n for a in klass.advices\n klass.send(*a) \n end\n end\n end",
"def apply(target, method, options = nil)\n select_filters(target, options).each{|block| target.send(method, &block) }\n end",
"def apply(target, ... | [
"0.6330174",
"0.61906034",
"0.59897614",
"0.5954072",
"0.56728244",
"0.56644815",
"0.5491761",
"0.5458612",
"0.54508173",
"0.54369336",
"0.5419999",
"0.5393293",
"0.53866446",
"0.5366385",
"0.5357472",
"0.5341207",
"0.5288952",
"0.5256857",
"0.5230847",
"0.5184082",
"0.517373... | 0.66121686 | 0 |
Applies advices to a given method | def apply_to_method(method)
filtered_advices = filter_advices advices, method
return if filtered_advices.empty?
logger.debug 'apply-to-method', method
scope ||= context.instance_method_type(method)
recreate_method method, filtered_advices, scope
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recreate_method(method, advices, scope)\n context.instance_variable_set(:@aspector_creating_method, true)\n\n raw_advices = advices.select(&:raw?)\n\n if raw_advices.size > 0\n raw_advices.each do |advice|\n if @target.is_a?(Module) && !@options[:class_methods]\n @targ... | [
"0.7648207",
"0.6994054",
"0.69872606",
"0.68058354",
"0.667943",
"0.6528093",
"0.6401591",
"0.6356267",
"0.62963307",
"0.62855166",
"0.6282382",
"0.6277836",
"0.61600405",
"0.60641927",
"0.6047109",
"0.6044892",
"0.60318",
"0.6018247",
"0.6011038",
"0.5994803",
"0.58881307",... | 0.8010577 | 0 |
Defines on a target element new methods that will contain advices logic as long as their blocks. Then we can invoke advices logic as a normal methods In a way it just casts a block to methods for peformance reasons If we have advices that just execute already existing methods, this won't create anything | def define_methods_for_advice_blocks
advices.each do |advice|
next if advice.raw?
next unless advice.advice_block
context.send :define_method, advice.with_method, advice.advice_block
context.send :private, advice.with_method
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recreate_method(method, advices, scope)\n context.instance_variable_set(:@aspector_creating_method, true)\n\n raw_advices = advices.select(&:raw?)\n\n if raw_advices.size > 0\n raw_advices.each do |advice|\n if @target.is_a?(Module) && !@options[:class_methods]\n @targ... | [
"0.64263105",
"0.61722565",
"0.60865355",
"0.5983527",
"0.5957012",
"0.59151226",
"0.5901045",
"0.590061",
"0.5887445",
"0.58872324",
"0.5800133",
"0.5790733",
"0.5788497",
"0.5783206",
"0.5777021",
"0.5774688",
"0.5755855",
"0.5738448",
"0.569398",
"0.56928456",
"0.5688207",... | 0.7259201 | 0 |
context is where advices will be applied (i.e. where methods are modified), can be different from target because when the target is an instance and we want to apply to instance methods, we need to use element singleton_class | def context
return @target if @target.is_a?(Module) && !@options[:class_methods]
@target.singleton_class
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_context_class\n SingletonMethodContext\n end",
"def with_target(method)\n target_context.push method\n yield\n target_context.pop\n nil # should not chain\n end",
"def target_singleton_class\n class << @obj; self; end\n end",
"def context(klass, options={... | [
"0.65689147",
"0.61773473",
"0.61422235",
"0.61082655",
"0.6062417",
"0.5952698",
"0.58629405",
"0.58293253",
"0.5783653",
"0.57080096",
"0.57080096",
"0.5666626",
"0.5666626",
"0.5666626",
"0.5666626",
"0.5666626",
"0.5666626",
"0.5666626",
"0.5666626",
"0.5666626",
"0.56666... | 0.72678584 | 0 |
Will apply all the advices to all methods that match | def apply_to_methods
# If method/methods option is set and all are String or Symbol, apply to those only, instead of
# iterating through all methods
methods = [@options[:method] || @options[:methods]]
methods.compact!
methods.flatten!
if !methods.empty? && methods.all?{ |method| method.is_a?(String) || method.is_a?(Symbol) }
methods.each do |method|
apply_to_method(method.to_s)
end
return
end
context.public_instance_methods.each do |method|
apply_to_method(method.to_s)
end
context.protected_instance_methods.each do |method|
apply_to_method(method.to_s)
end
if @options[:private_methods]
context.private_instance_methods.each do |method|
apply_to_method(method.to_s)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply\n invoke_deferred_logics\n return if advices.empty?\n\n define_methods_for_advice_blocks\n add_to_instances unless @options[:existing_methods_only]\n apply_to_methods unless @options[:new_methods_only]\n add_method_hooks unless @options[:existing_methods_only]\n # TODO:... | [
"0.7176866",
"0.7164645",
"0.69395727",
"0.6714365",
"0.6611936",
"0.6503142",
"0.6167824",
"0.6162257",
"0.6095147",
"0.6061606",
"0.5897823",
"0.5886512",
"0.58475137",
"0.57358885",
"0.5715129",
"0.5664622",
"0.56351256",
"0.563122",
"0.56157434",
"0.5587915",
"0.55843025"... | 0.68345153 | 3 |
Invokes deferred logics blocks on a target element and stores deferred logic invokations results | def invoke_deferred_logics
logics = @aspect.class.storage.deferred_logics
return if logics.empty?
logics.each do |logic|
result = logic.apply context, aspect
if advices.detect { |advice| advice.use_deferred_logic? logic }
@deferred_logic_results ||= {}
@deferred_logic_results[logic] = result
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perform(&block); end",
"def invoke!\n _log { \"@facade=@#{@facade.object_id}\" }\n @result = @facade._active_target.__send__(@selector, *@arguments)\n @block.call(@result) if @block\n rescue Exception => exc\n @thread.raise(@exception = exc)\n end",
"def do... | [
"0.6206423",
"0.6025843",
"0.5788921",
"0.54939765",
"0.5484688",
"0.5432538",
"0.5371301",
"0.5371126",
"0.5368522",
"0.533302",
"0.52972907",
"0.52972907",
"0.5256347",
"0.5251021",
"0.5236958",
"0.5221937",
"0.5216857",
"0.52070487",
"0.5194013",
"0.51838833",
"0.51806986"... | 0.56801754 | 3 |
Saves references to interceptions on a given target (its context) level The reference is stored there only for advices that are not being applied for existing methods only. The storage is used to remember interceptions that should be applied for methods that were defined after the aspect was applied | def add_to_instances
# Store only those interceptions that are not marked to be used for existing methods only
return if options[:existing_methods_only]
interceptions_storage = context.instance_variable_get(:@interceptions_storage)
unless interceptions_storage
interceptions_storage = InterceptionsStorage.new
context.instance_variable_set(:@interceptions_storage, interceptions_storage)
end
interceptions_storage << self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save\n # FIXME: find a way to handle errors?\n # FIXME: what if multiple objects are created in the course of a save operation?\n result = self\n updated_aspects.each do |hash|\n result = result.send(hash[:message], *hash[:parameters])\n end\n result\n end",
"def to_ta... | [
"0.5285715",
"0.50471276",
"0.49795493",
"0.49265394",
"0.4895788",
"0.47972715",
"0.47864982",
"0.4730801",
"0.47208726",
"0.47111705",
"0.47088307",
"0.47039062",
"0.4685857",
"0.46609876",
"0.461885",
"0.46156207",
"0.46098816",
"0.46031362",
"0.45923108",
"0.45919448",
"0... | 0.6575026 | 0 |
Redefines singleton_method_added and method_added methods so they are monitored If new method is added we will apply to it appropriate advices | def add_method_hooks
eigen_class = @target.singleton_class
if @options[:class_methods]
return unless @target.is_a?(Module)
orig_singleton_method_added = @target.method(:singleton_method_added)
eigen_class.send :define_method, :singleton_method_added do |method|
aspector_singleton_method_added(method)
orig_singleton_method_added.call(method)
end
else
if @target.is_a? Module
orig_method_added = @target.method(:method_added)
else
orig_method_added = eigen_class.method(:method_added)
end
eigen_class.send :define_method, :method_added do |method|
aspector_instance_method_added(method)
orig_method_added.call(method)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def singleton_method_added(*) end",
"def singleton_method_added(singleton_method_name)\n\n # Skip any methods that are excluded. See @@wrap_exclusions for more information.\n if @@wrap_exclusions.include?(singleton_method_name.to_sym)\n return\n end\n\n # A method that was once wrappe... | [
"0.7894509",
"0.74474734",
"0.7189963",
"0.69014126",
"0.69014126",
"0.6895234",
"0.68446606",
"0.66808563",
"0.6630644",
"0.6584446",
"0.65313387",
"0.6472396",
"0.6472396",
"0.64259815",
"0.640863",
"0.63657355",
"0.63479894",
"0.6284832",
"0.6273978",
"0.62111485",
"0.6164... | 0.74417263 | 2 |
Picks only advices that should be applied on a given method | def filter_advices(advices, method)
advices.select do |advice|
advice.match?(method, self)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_to_method(method)\n filtered_advices = filter_advices advices, method\n return if filtered_advices.empty?\n\n logger.debug 'apply-to-method', method\n\n scope ||= context.instance_method_type(method)\n\n recreate_method method, filtered_advices, scope\n end",
"def filter_for... | [
"0.6336751",
"0.62602973",
"0.6071282",
"0.6062795",
"0.5745472",
"0.5691043",
"0.5660224",
"0.56551737",
"0.5646539",
"0.5609067",
"0.5589034",
"0.5573313",
"0.5549959",
"0.5548296",
"0.5489218",
"0.5451588",
"0.54499704",
"0.5394869",
"0.5389217",
"0.53849775",
"0.5378489",... | 0.7670876 | 0 |
Recreates a given method applying all the advices one by one | def recreate_method(method, advices, scope)
context.instance_variable_set(:@aspector_creating_method, true)
raw_advices = advices.select(&:raw?)
if raw_advices.size > 0
raw_advices.each do |advice|
if @target.is_a?(Module) && !@options[:class_methods]
@target.class_exec method, self, &advice.advice_block
else
@target.instance_exec method, self, &advice.advice_block
end
end
return if raw_advices.size == advices.size
end
begin
@wrapped_methods[method] = context.instance_method(method)
rescue
# ignore undefined method error
if @options[:existing_methods_only]
logger.log Logging::WARN, 'method-not-found', method
end
return
end
before_advices = advices.select(&:before?) + advices.select(&:before_filter?)
after_advices = advices.select(&:after?)
around_advices = advices.select(&:around?)
(around_advices.size - 1).downto(1) do |i|
advice = around_advices[i]
recreate_method_with_advices method, [], [], advice
end
recreate_method_with_advices(
method,
before_advices,
after_advices,
around_advices.first
)
context.send scope, method if scope != :public
ensure
context.send :remove_instance_variable, :@aspector_creating_method
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_to_method(method)\n filtered_advices = filter_advices advices, method\n return if filtered_advices.empty?\n\n logger.debug 'apply-to-method', method\n\n scope ||= context.instance_method_type(method)\n\n recreate_method method, filtered_advices, scope\n end",
"def recreate_m... | [
"0.70947",
"0.6992034",
"0.65402186",
"0.62656176",
"0.6254525",
"0.6171117",
"0.60551274",
"0.60474396",
"0.60280454",
"0.6026717",
"0.60186446",
"0.598405",
"0.5962616",
"0.5958731",
"0.5929918",
"0.58024573",
"0.5802076",
"0.5775439",
"0.5749406",
"0.57193476",
"0.5718491"... | 0.77004355 | 0 |
Recreates method with given advices. It applies the MethodTemplate::TEMPLATE | def recreate_method_with_advices(
method,
before_advices,
after_advices,
around_advice
)
aspect = @aspect
logger = @logger
interception = self
orig_method = get_wrapped_method_of method
code = MethodTemplate::TEMPLATE.result(binding)
logger.debug 'generate-code', method, code
context.class_eval code, __FILE__, __LINE__ + 4
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recreate_method(method, advices, scope)\n context.instance_variable_set(:@aspector_creating_method, true)\n\n raw_advices = advices.select(&:raw?)\n\n if raw_advices.size > 0\n raw_advices.each do |advice|\n if @target.is_a?(Module) && !@options[:class_methods]\n @targ... | [
"0.74144757",
"0.6008221",
"0.59498465",
"0.5917926",
"0.57983017",
"0.5769362",
"0.5757189",
"0.5757189",
"0.5637639",
"0.5609364",
"0.55754036",
"0.55291194",
"0.549209",
"0.54768276",
"0.5447743",
"0.5445574",
"0.54445654",
"0.539872",
"0.53967315",
"0.5389736",
"0.5375296... | 0.7434634 | 0 |
attr_reader :eventID , :eventName , :venueID , :artist | def search_by_venue(venueID)
all.select do |event|
event.venue == venueID
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def artist=(artist) #attr_accessor setter part\n @artist = artist\n end",
"def artist\n @artist\n end",
"def artist\n @artist\n end",
"def artist=(artist)\n @artist = artist\n end",
"def set_event\n @event = Event.find(params[:event_id])\n\tend",
"def initialize(name, artist, ge... | [
"0.652129",
"0.631156",
"0.631156",
"0.630341",
"0.62859756",
"0.62822676",
"0.627848",
"0.62309605",
"0.6205675",
"0.6205675",
"0.6205675",
"0.6205675",
"0.6188716",
"0.6173842",
"0.615338",
"0.61501163",
"0.6143194",
"0.61408955",
"0.61333",
"0.6112157",
"0.61078805",
"0.... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_help_product
@help_product = HelpProduct.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 help_product_params
params.require(:help_product).permit(:size, :quantity, :product_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 |
Detect first instance tht is "alive?" and return it. | def detect
self.detected ||= self.providers.inject(nil) do |instance, provider_class|
instance || (p = provider_class.new; p.alive? ? p : nil)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def alive?; @alive end",
"def is_alive?\n\t\treturn @alive\n\tend",
"def alive?\n @alive\n end",
"def alive?\n self.alive\n end",
"def alive?\n self.alive\n end",
"def is_alive\n @state == ALIVE\n end",
"def alive?() end",
"def running?; @alive end",
"def is_alive;\t@alive \t\te... | [
"0.7432806",
"0.72030985",
"0.71985346",
"0.714765",
"0.714765",
"0.7135995",
"0.71074426",
"0.7041711",
"0.7026465",
"0.6692234",
"0.6692234",
"0.66455203",
"0.65863466",
"0.6559587",
"0.6521306",
"0.64828664",
"0.6400565",
"0.63332355",
"0.6318709",
"0.6318709",
"0.6310926"... | 0.0 | -1 |
if the conversation has unshown messages, show a button to get them | def load_private_messages(conversation)
if conversation.messages.count.positive?
'private/conversations/conversation/messages_list/link_to_previous_messages'
else
'shared/empty_partial'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n if user_signed_in?\n @message_has_been_sent = conversation_exist?\nend\n end",
"def update_message?\r\n # If message window is showing\r\n return $game_temp.message_window_showing\r\n end",
"def show\n @conversation.mark_messages_as_read\n end",
"def update_message?\r\n # If... | [
"0.706515",
"0.6800231",
"0.6739564",
"0.66459954",
"0.65984035",
"0.6543243",
"0.6461486",
"0.6342614",
"0.632319",
"0.63179916",
"0.62586445",
"0.62457705",
"0.6240147",
"0.62106246",
"0.6168053",
"0.6154414",
"0.6123792",
"0.61105925",
"0.6080912",
"0.6057217",
"0.6050708"... | 0.61639315 | 15 |
Read informations from the package location. | def read_package_info
PackageInfo.load((@location + "pione-package.json").read)
rescue Location::NotFound
raise InvalidPackage.new(self, "pione-package.json not found in %s" % @location.uri)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_packages\n LockfileParser.read(lockfile_path)\n end",
"def read\n self.read_layout\n self.read_directories\n end",
"def set_package_info\n download_and_extract_package\n parse_package_description\n @package_hash = filter_into_package @package_desc\n ... | [
"0.62074226",
"0.6178352",
"0.61530983",
"0.612891",
"0.6078561",
"0.6057359",
"0.6013473",
"0.5926016",
"0.585084",
"0.5741427",
"0.5741217",
"0.5726793",
"0.5708997",
"0.5705164",
"0.56732786",
"0.56667453",
"0.56386065",
"0.5611418",
"0.5609847",
"0.5588111",
"0.55838484",... | 0.78803205 | 0 |
Find scenarios from the package location. | def find_scenario_paths(scenarios)
return [] if scenarios.nil?
scenarios.select do |path|
(@location + path + "scenario.yml").exist?
end.uniq.compact
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all\n load_paths.inject([]) do |all_scenarios, load_path|\n Dir[ File.join(load_path, '**', '*.rb') ].each do |found_scenario_file|\n all_scenarios << EolScenario.new(found_scenario_file)\n end\n all_scenarios\n end\n end",
"def find\r\n scanner = DirectoryScanne... | [
"0.62577295",
"0.5909766",
"0.5802115",
"0.57888496",
"0.56192535",
"0.56188816",
"0.56129926",
"0.5586194",
"0.5585163",
"0.5574785",
"0.55555236",
"0.5518321",
"0.55122715",
"0.5511279",
"0.5508449",
"0.543644",
"0.5404544",
"0.5360441",
"0.5353924",
"0.53418946",
"0.533946... | 0.62683797 | 0 |
Return true if the location represents git package. | def git?(location)
location.location_type == :git_repository
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def git?\n dir? '.git'\n end",
"def git?\n dir? '.git'\n end",
"def git?\n !!git_directory\n end",
"def is_git_directory?\n Dir.entries('.').include? '.git'\n end",
"def git_repository?\n @root.join('.git').directory?\n end",
"def is_git_repo?\n Pkg::Util.... | [
"0.7732274",
"0.7732274",
"0.7623563",
"0.75630575",
"0.75073117",
"0.7345243",
"0.7278617",
"0.7242528",
"0.72076964",
"0.7065626",
"0.7064987",
"0.7053291",
"0.69275385",
"0.6889123",
"0.6806448",
"0.6767872",
"0.67522055",
"0.67009026",
"0.66813934",
"0.6646484",
"0.659509... | 0.8281275 | 0 |
Return true if the location represents archive package. | def archive?(location)
location.file? and location.extname == ".ppg"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_archive?\n NfsStore::Archive::Mounter.has_archive_extension? self\n end",
"def archive_ok?\n #todo, we lack any real heuristic for this.\n true\n end",
"def __packed?\n FILES.each do |fn|\n return true if fn.end_with? 'tar.gz' and File.exist?(File.join(@path, fn))\n e... | [
"0.7328261",
"0.71951234",
"0.70864654",
"0.703229",
"0.70181",
"0.67357296",
"0.67357296",
"0.6674209",
"0.6654429",
"0.66379756",
"0.6625592",
"0.65775025",
"0.65537316",
"0.6510524",
"0.63998294",
"0.639039",
"0.6358176",
"0.63414925",
"0.63180476",
"0.6286576",
"0.6283349... | 0.7758724 | 0 |
Return true if the location represents document package. | def document?(location)
location.file? and location.extname == ".pione"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_doc_subpkg?\n @has_doc_subpkg ||= @metadata[:contents].index RPM::Spec::SPEC_DOC_SUBPACKAGE_MATCHER\n end",
"def docbook_doc?\n node_type == DOCB_DOCUMENT_NODE\n end",
"def document?\n self.type == \"Document\"\n end",
"def document?\n node_type == DOCUMENT_NODE... | [
"0.66473526",
"0.6530627",
"0.6502818",
"0.6478357",
"0.64644593",
"0.63815355",
"0.6373631",
"0.6362836",
"0.63617224",
"0.6297842",
"0.6268616",
"0.6217026",
"0.6217026",
"0.62146246",
"0.62026024",
"0.6194379",
"0.6191171",
"0.610001",
"0.610001",
"0.6087052",
"0.6087052",... | 0.7422088 | 0 |
Only (absence of) sideeffects can be tested, but it's not typical in this project, so only exit/errorfree execution is tested. | def test_jump
jit.compile method(:jump)
assert_equal 1, jit.compiled_methods
assert_equal 0, jit.executed_methods
assert_equal 0, jit.exits
jit.enable!
v = jump
jit.disable!
assert_nil v
assert_equal 1, jit.compiled_methods
assert_equal 1, jit.executed_methods
assert_equal 0, jit.exits
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exit(res=0) end",
"def exit!(res=0) end",
"def final_test\n return unless MiniApivore.all_test_ran?\n\n @errors = MiniApivore.prepare_untested_errors\n assert(@errors.empty?, @errors.join(\"\\n\"))\n\n # preventing duplicate execution\n MiniApivore.runnable_list << \"#{self.class}::#{__metho... | [
"0.6601568",
"0.656865",
"0.6567596",
"0.6515219",
"0.6489851",
"0.64598274",
"0.6454641",
"0.6454641",
"0.64477354",
"0.6437747",
"0.6428497",
"0.641862",
"0.6409833",
"0.6406142",
"0.63991445",
"0.6370883",
"0.63695025",
"0.6310651",
"0.63074505",
"0.6292349",
"0.6282159",
... | 0.0 | -1 |
GET /user_replay_rates GET /user_replay_rates.json | def index
@user_replay_rates = UserReplayRate.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_replay_rate_params\n params[:user_replay_rate]\n end",
"def set_user_replay_rate\n @user_replay_rate = UserReplayRate.find(params[:id])\n end",
"def get_rates(options={})\n post 'rates/full', options\n end",
"def refresh_rates\n read_from_url\n end",
"def up... | [
"0.7066756",
"0.7037153",
"0.6801838",
"0.6743512",
"0.66839683",
"0.666803",
"0.65838313",
"0.65838313",
"0.65749365",
"0.63650453",
"0.63481253",
"0.6341929",
"0.62581956",
"0.62306154",
"0.6151297",
"0.6101033",
"0.60885626",
"0.60839593",
"0.60796666",
"0.60796666",
"0.60... | 0.78944045 | 0 |
GET /user_replay_rates/1 GET /user_replay_rates/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @user_replay_rates = UserReplayRate.all\n end",
"def set_user_replay_rate\n @user_replay_rate = UserReplayRate.find(params[:id])\n end",
"def user_replay_rate_params\n params[:user_replay_rate]\n end",
"def refresh_rates\n read_from_url\n end",
"def update\n r... | [
"0.7698664",
"0.71356815",
"0.69212407",
"0.67786187",
"0.6750991",
"0.67318165",
"0.6653109",
"0.66087306",
"0.65766144",
"0.64695656",
"0.64695656",
"0.6468932",
"0.64064825",
"0.636226",
"0.6308389",
"0.63001555",
"0.6222862",
"0.61996347",
"0.61081064",
"0.60520273",
"0.6... | 0.0 | -1 |
POST /user_replay_rates POST /user_replay_rates.json | def create
@user_replay_rate = UserReplayRate.new(user_replay_rate_params)
respond_to do |format|
if @user_replay_rate.save
format.html { redirect_to @user_replay_rate, notice: 'User replay rate was successfully created.' }
format.json { render :show, status: :created, location: @user_replay_rate }
else
format.html { render :new }
format.json { render json: @user_replay_rate.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_replay_rate_params\n params[:user_replay_rate]\n end",
"def set_user_replay_rate\n @user_replay_rate = UserReplayRate.find(params[:id])\n end",
"def index\n @user_replay_rates = UserReplayRate.all\n end",
"def update\n respond_to do |format|\n if @user_replay_rate.update(... | [
"0.7084286",
"0.7017949",
"0.69792366",
"0.6794691",
"0.6002614",
"0.5925174",
"0.5925174",
"0.5860097",
"0.5822333",
"0.580386",
"0.58022004",
"0.5710187",
"0.5710187",
"0.5710187",
"0.5705242",
"0.56836456",
"0.56677824",
"0.564418",
"0.56001455",
"0.55919987",
"0.55731195"... | 0.7658798 | 0 |
PATCH/PUT /user_replay_rates/1 PATCH/PUT /user_replay_rates/1.json | def update
respond_to do |format|
if @user_replay_rate.update(user_replay_rate_params)
format.html { redirect_to @user_replay_rate, notice: 'User replay rate was successfully updated.' }
format.json { render :show, status: :ok, location: @user_replay_rate }
else
format.html { render :edit }
format.json { render json: @user_replay_rate.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_user_replay_rate\n @user_replay_rate = UserReplayRate.find(params[:id])\n end",
"def update\n o = OvertimeRate.find(params[:id])\n \n if o.update_attributes(:duration => params[:duration], :year => params[:year], \n :pay_rate => params[:pay_rate])\n render ... | [
"0.6987778",
"0.6448134",
"0.63794136",
"0.6323562",
"0.6320676",
"0.63205343",
"0.63205343",
"0.6319075",
"0.6308471",
"0.6276674",
"0.61704654",
"0.61139137",
"0.6054664",
"0.60069895",
"0.599287",
"0.59876406",
"0.59828204",
"0.5928616",
"0.59199834",
"0.58716744",
"0.5856... | 0.78083956 | 0 |
DELETE /user_replay_rates/1 DELETE /user_replay_rates/1.json | def destroy
@user_replay_rate.destroy
respond_to do |format|
format.html { redirect_to user_replay_rates_url, notice: 'User replay rate was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @run_at_rate = RunAtRate.find(params[:id])\n @run_at_rate.destroy\n\n respond_to do |format|\n format.html { redirect_to run_at_rates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rate.destroy\n respond_to do |format|\n format.html { redire... | [
"0.6771414",
"0.6596707",
"0.64395386",
"0.64395386",
"0.64395386",
"0.6438836",
"0.64387035",
"0.64272636",
"0.64252335",
"0.64243805",
"0.641901",
"0.6331",
"0.6276618",
"0.6273889",
"0.62690526",
"0.6262315",
"0.6203361",
"0.6188416",
"0.617274",
"0.6133552",
"0.61078846",... | 0.7823529 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_user_replay_rate
@user_replay_rate = UserReplayRate.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 user_replay_rate_params
params[:user_replay_rate]
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 |
Check for module dependencies | def deps_satisfied?(deps)
deps.each do |dep|
if dep.to_s =~ /^no_(.*)$/
return false if @used_legos.include?( $1 )
else
return false unless @used_legos.include?( dep.to_s )
end
end
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dependency_met?\n true\n end",
"def check_dependencies\n fetch_module_dependencies.map do |dependency, constraint|\n dependency = dependency.sub('-', '/')\n current = dependency == @updated_module ? SemanticPuppet::Version.parse(@updated_module_version) : @forge.get_current_version... | [
"0.7469291",
"0.73867995",
"0.71928084",
"0.70493835",
"0.69741946",
"0.69655323",
"0.69309723",
"0.6928205",
"0.6843548",
"0.66797256",
"0.6620412",
"0.6598533",
"0.65965253",
"0.65965253",
"0.6593377",
"0.6576324",
"0.6566145",
"0.65631026",
"0.65631026",
"0.65631026",
"0.6... | 0.6515221 | 21 |
set connected user email | def set_connected_user(email)
session[:sos_note_email] = email
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_user_email\n @user_email = UserEmail.find(params[:id])\n end",
"def email=(value)\n @email = value\n end",
"def email=(value)\n @email = value\n end",
"def setUserEmail(userName, email)\n\n if(userName == nil)\n return\n ... | [
"0.7321109",
"0.7273806",
"0.7273806",
"0.72019994",
"0.7167905",
"0.70991266",
"0.705817",
"0.7031993",
"0.69933826",
"0.6902191",
"0.6902191",
"0.69010174",
"0.68979424",
"0.6891279",
"0.6888119",
"0.6867096",
"0.68651444",
"0.6823775",
"0.67643917",
"0.6731746",
"0.6716311... | 0.7610383 | 0 |
get connected user email | def get_connected_user
session[:sos_note_email]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def me_user_email\n email = Email.find_primary(me).take if auth?\n email.email || ''\n end",
"def email\n connect\n user = self.class.query('CMD_API_SHOW_USER_CONFIG',\n :user => resource[:username]\n )\n return user[\"email\"]\n end",
"def get_user_email\n user = User.find(self... | [
"0.82437533",
"0.8161065",
"0.8090853",
"0.7911201",
"0.78919166",
"0.7829586",
"0.7722517",
"0.76856303",
"0.7678804",
"0.76639706",
"0.75592095",
"0.75398266",
"0.75137013",
"0.7491778",
"0.74177593",
"0.7388965",
"0.73133177",
"0.7279351",
"0.72617507",
"0.72548544",
"0.72... | 0.7401336 | 15 |
set connected user info | def set_connected_user_info(info)
session[:sos_note_usr_info] = info
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_user_info\n @user_info = UserInfo.find_by_user_id(session[:user_id])\n if (@user_info == nil)\n @user_info = UserInfo.new(:user_id =>session[:user_id]).save\n end\n end",
"def set_user\n @cUser = current_user\n puts \"***#{@cUser}\"\n end",
"def connect\n \t\t#Se ... | [
"0.7202709",
"0.70007515",
"0.6991788",
"0.6925736",
"0.6879016",
"0.6831878",
"0.6815716",
"0.68014985",
"0.6759938",
"0.67076916",
"0.66932416",
"0.6626982",
"0.6626982",
"0.6626982",
"0.65837073",
"0.6550969",
"0.6513593",
"0.64640427",
"0.64576983",
"0.64519584",
"0.64307... | 0.80988294 | 0 |
get connected user info | def get_connected_user_info
session[:sos_note_usr_info]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_info\n response = send_method(:get_user_info)\n user_from(response)\n end",
"def info()\n get(:session, {:method => \"user.getInfo\"})\n end",
"def user_info\n response = from_server \"api/user.json\"\n response.data\n end",
"def get_user_info\n get(\"/... | [
"0.76400703",
"0.74459463",
"0.7355106",
"0.7275488",
"0.7262913",
"0.718221",
"0.7176103",
"0.7149034",
"0.71016514",
"0.7023256",
"0.69898844",
"0.6930295",
"0.69272333",
"0.68805486",
"0.6867621",
"0.68593943",
"0.6850829",
"0.6847901",
"0.68413734",
"0.68260705",
"0.68232... | 0.7899744 | 0 |
tell if a user is connected or not | def is_connected
begin
if session.key?(:sos_note_email)
true
else
false
end
rescue Exception => e
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ready?\n @connected && @logged_in\n end",
"def connected?\n authenticated? && !@user.jid.bared?\n end",
"def connected?\n @status == :connected\n end",
"def on_connect(m)\n User(m.user.nick).monitor\n end",
"def connected?\n !!@connected_to\n end",
"def is_connected?\n... | [
"0.72578055",
"0.7223828",
"0.7223012",
"0.7148623",
"0.7134449",
"0.7123473",
"0.71161515",
"0.71161515",
"0.71161515",
"0.71161515",
"0.71161515",
"0.71161515",
"0.7106515",
"0.70904803",
"0.7078677",
"0.70669353",
"0.7031481",
"0.7025584",
"0.7011002",
"0.70093614",
"0.700... | 0.7218294 | 3 |
set connected user kcode | def set_nbre_connexion(val)
session[:sos_note_nbre_connexion] = val
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_connected_user_info(info)\n session[:sos_note_usr_info] = info\n end",
"def set_ClientKey(value)\n set_input(\"ClientKey\", value)\n end",
"def set_ClientKey(value)\n set_input(\"ClientKey\", value)\n end",
"def set_ClientKey(value)\n set_input(\"ClientKey\", value)... | [
"0.58786607",
"0.5876259",
"0.5876259",
"0.5876259",
"0.5876259",
"0.5876259",
"0.5876259",
"0.5832375",
"0.57322866",
"0.5680325",
"0.5661247",
"0.56536996",
"0.56536996",
"0.56536996",
"0.56536996",
"0.56536996",
"0.56536996",
"0.56536996",
"0.56536996",
"0.56536996",
"0.56... | 0.0 | -1 |
get connected user kcode from | def get_nbre_connexion
session[:sos_note_nbre_connexion]? session[:sos_note_nbre_connexion] : 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user\n\t\tdatastore['IRCNICK']\n\tend",
"def usercode\n \n #Put the device into IDCode retrival mode.\n self.instruction = :usercode\n\n #And attempt to retrieve the 32-bit IDcode.\n usercode_packed = receive_data(32).reverse\n\n #Return the usercode as a... | [
"0.6274434",
"0.6142678",
"0.5995816",
"0.59263515",
"0.58448964",
"0.57945746",
"0.57641596",
"0.57358766",
"0.57302994",
"0.5702458",
"0.56575686",
"0.5645474",
"0.56383735",
"0.56125295",
"0.55801153",
"0.5572088",
"0.55636233",
"0.55601954",
"0.5546814",
"0.5541967",
"0.5... | 0.0 | -1 |
redis.sismember doesn't work here for some reason | def member_of?(key, value)
val = get(key)
val and val.include?(value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_member?(key, member)\n timeout_retry(3, 3){\n write \"SISMEMBER #{key} #{member.to_s.size}\\r\\n#{member}\\r\\n\"\n case integer_reply\n when 1\n true\n when 0\n false\n when -2\n raise RedisError, \"key: #{key} contains a non set value\"\n end\n }\n... | [
"0.68294793",
"0.6709657",
"0.6699098",
"0.6699098",
"0.625494",
"0.6120317",
"0.6120317",
"0.60745203",
"0.6047589",
"0.6006521",
"0.59946245",
"0.5993607",
"0.591393",
"0.591393",
"0.58939993",
"0.5865689",
"0.58338654",
"0.58301437",
"0.58205867",
"0.58021504",
"0.57654834... | 0.0 | -1 |
Added by Tejaswini Patil To render the sync category view Last modified 13/11/014 | def sync_category
@market_places = Spree::MarketPlace.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uhook_category_partial category\n locale = ::Locale.find_by_iso_code(category.locale)\n content_tag(:dt, ::Category.human_attribute_name(\"locale\") + ':') +\n content_tag(:dd, (locale.native_name.capitalize.html_safe rescue t('ubiquo.category.any')))\n end",
"def fr... | [
"0.63161165",
"0.6278825",
"0.6248407",
"0.618058",
"0.6123281",
"0.6100376",
"0.604755",
"0.6038776",
"0.5978811",
"0.59113497",
"0.5873567",
"0.58686954",
"0.5868625",
"0.5863508",
"0.58398026",
"0.58348817",
"0.5762343",
"0.5750503",
"0.5748712",
"0.5739892",
"0.5739297",
... | 0.0 | -1 |
Added by Tejaswini Patil To import the category file Last modified 13/11/014 | def import_categories
market_place = Spree::MarketPlace.find_by_id(params[:market_place])
case market_place.code
when 'qoo10'
smp = Spree::SellerMarketPlace.where("market_place_id=? AND api_key IS NOT NULL", params[:market_place]).try(:first)
@message = sync_all_category_qoo10(smp)
when 'lazada', 'zalora'
if !(File.extname(params[:file].original_filename) == ".csv")
redirect_to sync_category_admin_taxonomies_url, notice: "Please upload a valid csv file"
return
else
@message = Spree::MarketPlaceCategoryList.import(params[:file],params[:market_place].to_i)
end
end
redirect_to sync_category_admin_taxonomies_url, notice: @message
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addCategories(filename)\n\t# Open the file with categories\n\tcategoryTypes = File.open(Rails.root.join(\"db\", \"seed_data\", filename))\n\t# Each line of the file contains a category description. Iterate through the file and create a classification for each line.\n\tcategoryTypes.each do |curCategoryType|\n\... | [
"0.704737",
"0.647",
"0.642393",
"0.6251863",
"0.6174126",
"0.61668193",
"0.6157207",
"0.612537",
"0.61147535",
"0.6080325",
"0.6061848",
"0.6036914",
"0.5919957",
"0.590267",
"0.58853686",
"0.58544326",
"0.5848729",
"0.5848647",
"0.58415484",
"0.5836321",
"0.5832093",
"0.5... | 0.61079544 | 9 |
Return attributes of searched process based on name or cmdline | def search_by_name(process_name)
if process_name =~ /^\/.*\/$/
process_name.slice!(0)
process_name = Regexp.new(/#{process_name.chop}/)
find_all
else
find_by_name(process_name)
end
process_list = Array.new
@proc_table.each do |process|
if process_name.is_a? Regexp
process_list << process if process.name =~ process_name || process.commandline =~ process_name
else
process_list << process if process.name.to_s.downcase == "#{process_name.to_s.downcase}" || process.commandline.to_s.downcase == "#{process_name.to_s.downcase}"
end
end
process_list = nil if process_list.empty?
return process_list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collect_process_info\n process = {}\n cmdline_file = \"/proc/#{Process.pid}/cmdline\"\n\n # If there is a /proc filesystem, we read this manually so\n # we can split on embedded null bytes. Otherwise (e.g. OSX, Windows)\n # use ProcTable.\n if File.exist?(cmdline_file... | [
"0.6800683",
"0.5995378",
"0.5967374",
"0.5966888",
"0.5862136",
"0.58052105",
"0.56689954",
"0.56125855",
"0.55757743",
"0.55709285",
"0.5566594",
"0.5546195",
"0.55381644",
"0.5511111",
"0.54921895",
"0.5486798",
"0.5461204",
"0.54258204",
"0.5418271",
"0.5418271",
"0.53818... | 0.6221578 | 1 |
Return attributes of searched by process | def search_by_condition(args)
find_all
attrs = args[:attr]
oper = args[:oper]
value = args[:value]
process_list = Array.new
@proc_table.each do |process|
if oper == '>'
process_list << process if process[:"#{attrs}"] > value
elsif oper == '<'
process_list << process if process[:"#{attrs}"] < value
elsif oper == '>='
process_list << process if process[:"#{attrs}"] >= value
elsif oper == '<='
process_list << process if process[:"#{attrs}"] <= value
elsif oper == '=='
process_list << process if process[:"#{attrs}"] == value
elsif oper == '!='
process_list << process if process[:"#{attrs}"] != value
end
end
process_list = nil if process_list.empty?
return process_list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collect_process_info\n process = {}\n cmdline_file = \"/proc/#{Process.pid}/cmdline\"\n\n # If there is a /proc filesystem, we read this manually so\n # we can split on embedded null bytes. Otherwise (e.g. OSX, Windows)\n # use ProcTable.\n if File.exist?(cmdline_file... | [
"0.6759233",
"0.6588619",
"0.62905294",
"0.6185644",
"0.61523664",
"0.59133583",
"0.59067285",
"0.5866945",
"0.58595836",
"0.5856453",
"0.58534",
"0.58111066",
"0.58020717",
"0.57938397",
"0.57938397",
"0.5793342",
"0.5779606",
"0.5744862",
"0.574476",
"0.5741819",
"0.5729230... | 0.55224025 | 33 |
Return all process instances | def proc_table
find_all
return @proc_table
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def processes\n request('getAllProcessInfo')\n end",
"def processes\n\t\tRush::ProcessSet.new(\n\t\t\tconnection.processes.map do |ps|\n\t\t\t\tRush::Process.new(ps, self)\n\t\t\tend\n\t\t)\n\tend",
"def processes\n\t\tRush::ProcessSet.new(\n\t\t\tconnection.processes.map do |ps|\n\t\t\t\tRush::Process... | [
"0.7527345",
"0.75235903",
"0.752247",
"0.736236",
"0.7211262",
"0.7117533",
"0.70830244",
"0.70424074",
"0.70278054",
"0.6989813",
"0.6966409",
"0.6771014",
"0.67286986",
"0.6705405",
"0.66980076",
"0.6628469",
"0.6611296",
"0.6609742",
"0.6540987",
"0.6517242",
"0.6462892",... | 0.0 | -1 |
Refresh processes array by pid | def find_by_pid(pid)
@proc_table = Array.new
ProcFetch.get_process(:processid => pid).each do |proc_attrs|
@proc_table.push(ProcInfo.new(proc_attrs))
end
childs_tree
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def [](pid)\n pid = pid.to_i\n @running_processes[pid] ||= find_by_pid(pid)\n end",
"def reap\n out = []\n @children.each do |key,child|\n pid = child.waitpid\n out << child.info\n\n # dead or missing processes, forget about them\n if pid == -1 or pi... | [
"0.66761625",
"0.6265211",
"0.6208515",
"0.60648817",
"0.6044282",
"0.604084",
"0.60358065",
"0.60131884",
"0.5999804",
"0.59431237",
"0.58074385",
"0.5803107",
"0.5792366",
"0.57901394",
"0.5750044",
"0.57070816",
"0.5698267",
"0.5629712",
"0.561515",
"0.5601135",
"0.5579671... | 0.60177565 | 7 |
Refresh processes array by name | def find_by_name(name)
@proc_table = Array.new
ProcFetch.get_process({:name => name}).each do |proc_attrs|
@proc_table.push(ProcInfo.new(proc_attrs))
end
childs_tree
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_names\n @processes.map { |p| @names[p] }\n end",
"def initialize\n @processes = []\n end",
"def find_pids(name)\n\tproc_pid = []\n\t@client.sys.process.get_processes.each do |proc|\n\t\tif proc['name'].downcase == name.downcase\n\t\t\tproc_pid << proc['pid']\n\t\tend\n\tend\n\treturn pr... | [
"0.6636087",
"0.6293215",
"0.6247031",
"0.60906535",
"0.6079917",
"0.60459346",
"0.59596324",
"0.5951458",
"0.5847173",
"0.58413684",
"0.58294046",
"0.58280474",
"0.57166106",
"0.5686468",
"0.56626993",
"0.56095254",
"0.5541982",
"0.5523421",
"0.5523421",
"0.5484591",
"0.5484... | 0.5619263 | 15 |
Public: Instantiate new validator. ldap: GitHub::Ldap object groups: Array of Net::LDAP::Entry group objects options: Hash of options | def initialize(ldap, groups, options = {})
@ldap = ldap
@groups = groups
@options = options
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(ldap, options = {})\n @ldap = ldap\n @options = options\n end",
"def initialize(options ={})\n\n\t\t\tif @@users.find {|user| user.dn == options[:dn] } #We dont want duplicated in our array so lets see if the group cn already exists\n\t\t\t\treturn #Have a think about t... | [
"0.65478474",
"0.6146484",
"0.6015433",
"0.578501",
"0.54253036",
"0.53735954",
"0.53672916",
"0.53383934",
"0.5251778",
"0.5208341",
"0.5143915",
"0.5135047",
"0.51321775",
"0.5077246",
"0.50710386",
"0.50683707",
"0.50511223",
"0.50211394",
"0.4979283",
"0.49726018",
"0.494... | 0.7811679 | 0 |
Abstract: Performs the membership validation check. Returns Boolean whether the entry's membership is validated or not. def perform(entry) end Internal: Domains to search through. Returns an Array of GitHub::Ldap::Domain objects. | def domains
@domains ||= ldap.search_domains.map { |base| ldap.domain(base) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate\n @domains.each do |d|\n raise 'domain definition error' unless d.class == Domain\n end\n @domains.map(&:validate)\n end",
"def validate(name = nil, type = nil)\n entries = self.find(name, type)\n entries.each {|entry| entry.validate if entry.result.n... | [
"0.66350836",
"0.5494677",
"0.54691434",
"0.5414926",
"0.5329835",
"0.5298492",
"0.5298492",
"0.5282905",
"0.5226897",
"0.5118723",
"0.5099441",
"0.50865674",
"0.5049014",
"0.5010165",
"0.5010113",
"0.49424082",
"0.49314117",
"0.4911187",
"0.4903844",
"0.48994917",
"0.4875844... | 0.515643 | 10 |
Returns the total size of the collection | def size
@size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size\n @collection.size\n end",
"def size\n @collection.size\n end",
"def total_entries\n collection.total_count\n end",
"def length\n collection.size\n end",
"def item_count\n @collection.size\n end",
"def total_size\n self._total_size(self, 0)\... | [
"0.861388",
"0.8570518",
"0.8094186",
"0.80713415",
"0.79772496",
"0.79199165",
"0.7815172",
"0.7807105",
"0.77512455",
"0.77512455",
"0.7730802",
"0.7681315",
"0.7659885",
"0.76533085",
"0.76533085",
"0.7638222",
"0.7600094",
"0.7578195",
"0.75481516",
"0.75284404",
"0.75235... | 0.7398332 | 58 |
Returns the first element in the collection | def first(count = nil)
if count.nil?
@collection.first
else
out = []
@collection.first(count).each do |item|
out << item
end
out
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first\n @adapter.first(collection)\n end",
"def first\n items.compact.first\n end",
"def first\n to_a.first\n end",
"def first\n self.take(1)[0]\n end",
"def first\n @items.first\n end",
"def first\n @enumerable.first\n end",
"def first\n\n ... | [
"0.8337687",
"0.8166826",
"0.7993741",
"0.7954845",
"0.7938503",
"0.7877971",
"0.78752124",
"0.78629726",
"0.78285104",
"0.7748127",
"0.7680794",
"0.7679129",
"0.76598513",
"0.76598513",
"0.76598513",
"0.76598513",
"0.7644316",
"0.7644316",
"0.7637628",
"0.7633756",
"0.763375... | 0.7294362 | 38 |
Returns the last element in the collection | def last
out = nil
each {|i| out = i }
out
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last\n @collection.size - 1\n end",
"def last\n items.compact.last\n end",
"def last\r\n self[-1]\r\n end",
"def last\n to_a.last\n end",
"def last\n self[-1]\n end",
"def last\n @adapter.last(collection)\n end",
"def last\n at(-1)\n e... | [
"0.8525428",
"0.82765186",
"0.82759434",
"0.82302743",
"0.82209146",
"0.82165337",
"0.8150907",
"0.81046563",
"0.80847",
"0.8076785",
"0.7970714",
"0.7931447",
"0.7908546",
"0.7905934",
"0.78784925",
"0.78712374",
"0.78453964",
"0.78453964",
"0.7837728",
"0.78023064",
"0.7787... | 0.7968361 | 11 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.