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 |
|---|---|---|---|---|---|---|
PUT /card_font_alignments/1 PUT /card_font_alignments/1.json | def update
@card_font_alignment = CardFontAlignment.find(params[:id])
respond_to do |format|
if @card_font_alignment.update_attributes(params[:card_font_alignment])
format.html { redirect_to @card_font_alignment, notice: 'Card font alignment was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @card_font_alignment.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @card_font_alignment = CardFontAlignment.new(params[:card_font_alignment])\n\n respond_to do |format|\n if @card_font_alignment.save\n format.html { redirect_to @card_font_alignment, notice: 'Card font alignment was successfully created.' }\n format.json { render json: @card_f... | [
"0.6871999",
"0.6703782",
"0.66521555",
"0.6265116",
"0.58375394",
"0.579937",
"0.5797196",
"0.579588",
"0.575264",
"0.56762516",
"0.5571101",
"0.53469473",
"0.531404",
"0.5297938",
"0.5182652",
"0.51479363",
"0.51136196",
"0.5072741",
"0.50480294",
"0.5035415",
"0.5008951",
... | 0.75992566 | 0 |
DELETE /card_font_alignments/1 DELETE /card_font_alignments/1.json | def destroy
@card_font_alignment = CardFontAlignment.find(params[:id])
@card_font_alignment.destroy
respond_to do |format|
format.html { redirect_to card_font_alignments_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @card_font_family = CardFontFamily.find(params[:id])\n @card_font_family.destroy\n\n respond_to do |format|\n format.html { redirect_to card_font_families_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @alignment = Alignment.get(params[:id])\n ali... | [
"0.71274936",
"0.6468942",
"0.6320602",
"0.6299824",
"0.62126994",
"0.62065506",
"0.6121495",
"0.6116161",
"0.6101788",
"0.6070829",
"0.6050019",
"0.60187566",
"0.6017648",
"0.6014885",
"0.6010507",
"0.60102403",
"0.59999573",
"0.5997424",
"0.5997238",
"0.5990842",
"0.5975939... | 0.79836345 | 0 |
Provide the full list of features and tags | def route_list(library, paths)
if paths && !paths.empty? && paths.first =~ /^(?:features|tags)$/
case paths.shift
when "features"; cmd = Commands::ListFeaturesCommand
when "tags"; cmd = Commands::ListTagsCommand
end
cmd.new(final_options(library, paths)).call(request)
else
core_route_list(library,paths)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_features *args\r\n puts \"not implemented yet\"\r\n end",
"def listfeatures\n myfeatures=Array.new\n for f in self.features\n myfeatures << f.title\n myfeatures << f.description\n end\n return myfeatures.join(\" \")\n end",
"def features\n []\n end",
"def features\... | [
"0.769541",
"0.74670553",
"0.73784107",
"0.73259884",
"0.7012389",
"0.7011172",
"0.6973233",
"0.69281054",
"0.685066",
"0.6830926",
"0.6725033",
"0.67118484",
"0.6696911",
"0.66394097",
"0.6598604",
"0.6576555",
"0.6515748",
"0.6512176",
"0.64971125",
"0.64894074",
"0.6434925... | 0.0 | -1 |
create 2 int elements array from 9,9 or 9 | def split_number(s)
if s =~ /(\d+),(\d+)/
[$1.to_i,$2.to_i]
else
[s.to_i,s.to_i]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_int_array\n [first.time_to_int, last.time_to_int]\n end",
"def array_array(rn, cn, iv = 1)\n Array.new(rn) { Array.new(cn, iv) }\nend",
"def array_to_integer_array_method\n @card_integer_array = []\n @card_array.each do |integer|\n new_integer = integer.to_i\n @card_integer_arra... | [
"0.6767372",
"0.61888653",
"0.6142381",
"0.61267924",
"0.6008856",
"0.5995122",
"0.5972692",
"0.5951399",
"0.5947525",
"0.58859634",
"0.58641994",
"0.5814177",
"0.58049464",
"0.57993966",
"0.57968676",
"0.57758325",
"0.5775428",
"0.576886",
"0.5762753",
"0.57480526",
"0.57470... | 0.0 | -1 |
Very often the .to server returns a partial response, which is a response containing an empty line. It seems to be a very poorlydesigned throttle mechanism. | def response_incomplete?
content_for_scanner.strip == ""
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def throttled_response; end",
"def throttled_responder; end",
"def throttled_responder=(_arg0); end",
"def throttled_response_retry_after_header; end",
"def make_response_wrapper(tweet)\n response = model.make_response(meta(tweet).mentionless, meta(tweet).limit)\n retries ||= 0\n while response.en... | [
"0.66611904",
"0.6575084",
"0.6134941",
"0.60901916",
"0.5844265",
"0.5816639",
"0.56759536",
"0.5622337",
"0.5590571",
"0.55352026",
"0.54892385",
"0.5463631",
"0.5436551",
"0.5425716",
"0.5425716",
"0.53885895",
"0.536749",
"0.53576344",
"0.5345211",
"0.5335408",
"0.5324949... | 0.0 | -1 |
def set_user_info(user_info) self.city = user_info["city"] if self.city.blank? self.state = user_info["regionName"] if self.state.blank? self.pin_code = user_info["zip"] if self.pin_code.blank? self.save end | def seller?
self.has_role? :seller
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_info_params\n params.require(:user_info).permit(:user_id, :name, :tel, :address,:province,:city,:county,:is_default)\n end",
"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[:use... | [
"0.6915106",
"0.6828433",
"0.66585535",
"0.6629932",
"0.6568477",
"0.6528027",
"0.6522978",
"0.640044",
"0.6382904",
"0.63738525",
"0.6366468",
"0.634885",
"0.6348685",
"0.63207006",
"0.631028",
"0.6279979",
"0.6269031",
"0.6266146",
"0.6260505",
"0.6207813",
"0.6197286",
"... | 0.0 | -1 |
changed result=result.with_appended_backtrace(test_step.source.last) if test_step.respond_to?(:source) for result = result since the '.last' method is missing for the param sent to this class every last step of the test in : /Users/guillemsannicolas/.gem/ruby/2.1.1/gems/cucumbercore1.2.0/lib/cucumber/core/test/runner.rb opts = $default_d_caps imho its because of the gets.chomp, because when starting a test with arguments, the gets.chomp doesn't work in : /Users/guillemsannicolas/.gem/ruby/2.1.2/gems/appium_lib7.0.0/lib/appium_lib/driver.rb:296 | def desired_caps_real_device
desired_caps = {
caps: {
platformName: 'iOS',
versionNumber: '9.0',
deviceName: 'iPad de Guillem',
newCommandTimeout: 1000,
udid: '52257b7d0ae102e2d79f02448b5486aca8c6e715',
autoAcceptAlerts: true,
bundleId: 'com.kg.GoldenManager',
#newCommandTimeout: 10,
#app: APP_PATH,
fullReset: false,
fastReset: true
}
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_step; end",
"def step_result; end",
"def running_test_step; end",
"def test_steps; end",
"def test_steps; end",
"def add_test_step(step_result)\n current_executable.steps.push(step_result)\n @step_context.push(step_result)\n step_result\n end",
"def after_test_step(step,resul... | [
"0.6453773",
"0.62225586",
"0.6113109",
"0.6041522",
"0.6041522",
"0.59822506",
"0.5867729",
"0.5698059",
"0.56823534",
"0.56716484",
"0.56681186",
"0.56371284",
"0.5624875",
"0.5608675",
"0.5582108",
"0.5564949",
"0.54617673",
"0.5446146",
"0.543751",
"0.54187435",
"0.538089... | 0.0 | -1 |
Either return an instance of +Time+ with the same UTC offset as +self+ or an instance of +Time+ representing the same time in the local system timezone depending on the setting of on the setting of +ActiveSupport.to_time_preserves_timezone+. | def to_time
preserve_timezone ? getlocal(utc_offset) : getlocal
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_time\n if preserve_timezone\n @to_time_with_instance_offset ||= getlocal(utc_offset)\n else\n @to_time_with_system_offset ||= getlocal\n end\n end",
"def in_time_zone(zone = ::Time.zone)\n ActiveSupport::TimeWithZone.new(utc? ? self : getutc, ::Time.send!(:get_zone... | [
"0.7982158",
"0.7423729",
"0.7405696",
"0.71768165",
"0.71360373",
"0.70437497",
"0.69747937",
"0.68326616",
"0.6791432",
"0.6749216",
"0.67035496",
"0.66578543",
"0.66567254",
"0.6628229",
"0.65607",
"0.6537967",
"0.6536521",
"0.64913",
"0.6469843",
"0.6462923",
"0.6429882",... | 0.7869158 | 1 |
Implementing topological sort using both Khan's and Tarian's algorithms | def topological_sort(vertices)
sorted = []
queue = []
vertices.each do |vertex|
queue << vertex if vertex.in_edges.empty?
end
until queue.empty?
current = queue.shift
sorted << current
current.out_edges.dup.each do |edge|
next_vertex = edge.to_vertex
edge.destroy!
if next_vertex.in_edges.empty?
queue << next_vertex
end
end
end
sorted.count == vertices.count ? sorted : []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topological_sort(vertices)\n # kahn_sort(vertices)\n tarjan_sort(vertices)\nend",
"def topological_sort(vertices)\n # Khan's algorithm\n sorted_arr = []\n queue = Queue.new\n # in_edges = {}\n vertices.each do |vertex|\n if vertex.in_edges.empty?\n queue.enq(vertex)\n end\n end\n\n # ... | [
"0.8047923",
"0.794595",
"0.7768589",
"0.77582926",
"0.76280963",
"0.7583783",
"0.74990153",
"0.7447668",
"0.7444663",
"0.74279577",
"0.7419171",
"0.7347367",
"0.734007",
"0.73287576",
"0.72477597",
"0.72456425",
"0.72105026",
"0.71851456",
"0.7158905",
"0.715503",
"0.7134244... | 0.66951555 | 72 |
Namespaces is the merge of the framework and platform namespaces. The namespace sources are the config's keys 'paths' and 'ember => path_namespaces'. The ember.rb should fill in any gaps in the namespaces and they should be ordered hierarchily for Ember creation (e.g. create 'App.Platform' before 'App.Platform.Main'). | def find_by_namespace(name)
@namespaces.select {|ns| ns[:namespace] == name}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_namespaces(namespaces); end",
"def register_namespaces(namespaces); end",
"def package_namespaces\n namespaces = [EPUB2_NAMESPACES]\n namespaces << EPUB3_NAMESPACES if @target.epub_version >= 3\n namespaces << IBOOKS_NAMESPACES if @target.epub_version >= 3 && @target.ibooks?\n... | [
"0.6456702",
"0.6456702",
"0.6233856",
"0.6162102",
"0.60241044",
"0.5940189",
"0.5860923",
"0.5860923",
"0.5860923",
"0.5860923",
"0.58330727",
"0.58330727",
"0.57817405",
"0.56819135",
"0.5632387",
"0.56297344",
"0.5623337",
"0.56091136",
"0.5593876",
"0.5561845",
"0.555763... | 0.0 | -1 |
This method creates a new Micropost and associates it with the currently signed in user. The "before" flter ensures that there is a currently signed in user. | def create
@micropost = current_user.microposts.build(params[:micropost])
if @micropost.save
# Here on success. Already saved in the DB.
flash[:success] = "New post accepted"
# Now, redirect back to the root page to allow more new posts...
redirect_to root_url
else
# Bad data values. Back to home page with null feeds list
@feed_items = []
render 'static_pages/home'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n \t# Create a new micropsot object\n @micropost = current_user.microposts.build(micropost_params)\n # Save the micropsot to the database\n if @micropost.save\n flash[:success] = \"Micropost created!\"\n redirect_to root_url\n else\n # When there is an error in submitting a m... | [
"0.69614714",
"0.6949994",
"0.69288254",
"0.68862593",
"0.68854606",
"0.6883364",
"0.687577",
"0.6697888",
"0.6637483",
"0.6632141",
"0.65898186",
"0.6584668",
"0.65834266",
"0.6577411",
"0.65374804",
"0.6498302",
"0.6496112",
"0.6492521",
"0.6359921",
"0.6271584",
"0.6163394... | 0.64683676 | 18 |
Define a method to return whether the current user is the micropost's user | def correct_user
@post_to_go = current_user.microposts.find_by_id(params[:id])
redirect_to root_url if @post_to_go.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def correct_user\n check_owner_of(@micropost)\n end",
"def correct_user; redirect_to root_url, flash: {success: \"Permission denied!\"} unless current_user? load_micropost.user end",
"def twitter_user?\n return true if is_logged_in? && (session[:request_token] && session[:request_token_secret] && sessio... | [
"0.77155155",
"0.7076032",
"0.70516586",
"0.6958686",
"0.681317",
"0.6802739",
"0.6785529",
"0.6785529",
"0.6785529",
"0.6785529",
"0.6785529",
"0.6785529",
"0.6785529",
"0.67764467",
"0.6767026",
"0.6763558",
"0.6763558",
"0.6763558",
"0.6763558",
"0.6763558",
"0.6763558",
... | 0.0 | -1 |
GET /schedules/1 GET /schedules/1.xml | def show
@schedule = Schedule.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @schedule }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @schedules = Schedule.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @schedules }\n end\n end",
"def schedules\n params = init_params\n request_url = UrlGenerator.url_for(\"schedules\")\n asgn = SignatureGenerator.s... | [
"0.73682785",
"0.7360402",
"0.7280713",
"0.711103",
"0.70666844",
"0.7061428",
"0.69146025",
"0.6806414",
"0.6804336",
"0.67321527",
"0.67246646",
"0.6721426",
"0.66539335",
"0.66304797",
"0.65861034",
"0.65861034",
"0.65861034",
"0.65861034",
"0.65861034",
"0.65861034",
"0.6... | 0.7230664 | 3 |
GET /schedules/new GET /schedules/new.xml | def new
@schedule = Schedule.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @schedule }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n respond_to do |format|\n format.xml { render :xml => @schedule }\n end\n end",
"def new\n @schedule = Schedule.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @schedule }\n end\n end",
"def new\n @schedule = Schedule.n... | [
"0.80351675",
"0.7788479",
"0.778614",
"0.7468082",
"0.7426079",
"0.72847664",
"0.72740805",
"0.7225677",
"0.71897995",
"0.7117595",
"0.7099927",
"0.6972721",
"0.6843795",
"0.67839086",
"0.67081094",
"0.66808784",
"0.66796535",
"0.66249573",
"0.6609242",
"0.6603368",
"0.65847... | 0.77597374 | 3 |
POST /schedules POST /schedules.xml | def create
@schedule = Schedule.new(params[:schedule])
respond_to do |format|
if @schedule.save
format.html { redirect_to(@schedule, :notice => 'Schedule was successfully created.') }
format.xml { render :xml => @schedule, :status => :created, :location => @schedule }
else
format.html { render :action => "new" }
format.xml { render :xml => @schedule.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schedule\n POST \"https://www.googleapis.com/calendar/v3/calendars/#{calendar_id}/events\"\n render \"schedule\"\n end",
"def create\n @schedule = Schedule.new(params[:schedule])\n\n if @schedule.save\n render json: @schedule, status: :created, location: @schedule\n else\n render js... | [
"0.7189827",
"0.6615932",
"0.6597347",
"0.6574539",
"0.6525362",
"0.651203",
"0.64997774",
"0.6469093",
"0.6468536",
"0.6468107",
"0.6458748",
"0.6458",
"0.6428549",
"0.6393197",
"0.63538903",
"0.63437325",
"0.63199866",
"0.63099986",
"0.6307639",
"0.6297627",
"0.62874734",
... | 0.6714149 | 1 |
PUT /schedules/1 PUT /schedules/1.xml | def update
@schedule = Schedule.find(params[:id])
respond_to do |format|
if @schedule.update_attributes(params[:schedule])
format.html { redirect_to(@schedule, :notice => 'Schedule was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @schedule.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @schedule.update(schedule_params)\n end",
"def update\n @schedule = Schedule.find(params[:id])\n\n if @schedule.update(params[:schedule])\n head :no_content\n else\n render json: @schedule.errors, status: :unprocessable_entity\n end\n end",
"def update\n @schedule = S... | [
"0.6889635",
"0.6754661",
"0.6754633",
"0.6706276",
"0.6698275",
"0.6605363",
"0.65974164",
"0.65758055",
"0.6571536",
"0.6557505",
"0.6557505",
"0.6557505",
"0.6557505",
"0.6557505",
"0.6557505",
"0.6557505",
"0.65455604",
"0.65155226",
"0.6475559",
"0.6472355",
"0.6464864",... | 0.698327 | 0 |
DELETE /schedules/1 DELETE /schedules/1.xml | def destroy
@schedule = Schedule.find(params[:id])
@schedule.destroy
respond_to do |format|
format.html { redirect_to(schedules_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to(schedules_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @schedule = Schedule.find(params[:id])\n\n @schedule.destroy\n\n key = JobKey.new(@schedule.name, @schedule.group)\n if R... | [
"0.7514488",
"0.7332302",
"0.7264067",
"0.7165445",
"0.7112163",
"0.7077493",
"0.697315",
"0.6967041",
"0.6959388",
"0.69550914",
"0.69405305",
"0.69405305",
"0.69405305",
"0.69405305",
"0.69405305",
"0.6926803",
"0.69090253",
"0.6869087",
"0.6867715",
"0.68624055",
"0.686240... | 0.7531215 | 2 |
as arguments. This method should return true if the search value is in the array, false if not. You may not use .include? in your solution. | def include?(array, search_element)
array.each do |array_element|
if array_element == search_element
return true
end
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def include?(array, search)\n array.each do |value|\n return true if value == search\n end\n false\nend",
"def include?(arr, search_value)\n arr.each do |num|\n if num == search_value\n return true\n end\n end\n false\nend",
"def include? (array, search)\n array.each { |item| return true i... | [
"0.8135656",
"0.79325575",
"0.79059553",
"0.7866807",
"0.7827858",
"0.7816912",
"0.7813352",
"0.7780492",
"0.776406",
"0.77561796",
"0.77016073",
"0.76833194",
"0.76818454",
"0.7611247",
"0.7604292",
"0.7597185",
"0.7595516",
"0.7584448",
"0.749761",
"0.7324213",
"0.7304917",... | 0.766524 | 13 |
puts include?(arr1, 5) true (breaks out of iteration and return true due to explicit return) puts include?(arr1, 1) list of elements see below with 'p' p include?(arr1, 1) [2, 3, 4, 5, 6, 7, 8, 9] Does not return false. Instead returns the the return value of the .each call (the original array) Not correct output! Move false return value out of loop iteration.. | def include?(array, search_element)
array.each do |array_element|
if array_element == search_element
return true
end
end
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def include?(arr, num)\n arr.each{ |element| return true if element == num}\n return false\nend",
"def include?(arr, value)\n includes = false\n arr.each { |n| includes = true if n == value }\n includes\nend",
"def include?(array, integer)\r\n array.each do |element|\r\n return true if element == integ... | [
"0.7958506",
"0.78739953",
"0.7792143",
"0.76820433",
"0.7618613",
"0.7591033",
"0.7549037",
"0.75187314",
"0.74890625",
"0.7472271",
"0.74661076",
"0.7425164",
"0.73944294",
"0.73934376",
"0.73853475",
"0.7352196",
"0.7331383",
"0.72701406",
"0.7265875",
"0.72497183",
"0.721... | 0.7301507 | 17 |
true works.. LS > | def include?(array, value)
!!array.find_index(value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stand\r\n return true\r\n end",
"def ls_trivial?\n\t\t!@ls || @ls.clear?\n\tend",
"def check ; true ; end",
"def semact?; false; end",
"def pass\n checked_print ?.\n end",
"def scm_char?; SCM_FALSE; end",
"def truth\n\t\t\t\"You can't handle the truth\" ; true\n\t\tend",
"def suc... | [
"0.6583405",
"0.63511115",
"0.6176009",
"0.6108918",
"0.59303313",
"0.59110874",
"0.5868739",
"0.5740535",
"0.57060695",
"0.56924134",
"0.5673562",
"0.56699187",
"0.56699187",
"0.5660929",
"0.56531256",
"0.56525314",
"0.5647522",
"0.5606071",
"0.5585114",
"0.5585114",
"0.5583... | 0.0 | -1 |
Cantidad total del producto | def total_quantity
total = 0.0
self.quantities.each do |quantity|
total = total + quantity.number
end
total
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preco_total\n produto.preco * quantidade\n end",
"def total\n if @products.empty?\n return 0\n else\n total = (@products.values.sum * 1.075).round(2)\n end\n return total\n end",
"def total\n # TODO: implement total\n if products.length == 0\n return 0\n en... | [
"0.791601",
"0.7825717",
"0.78182995",
"0.7726436",
"0.77129453",
"0.77054805",
"0.7623513",
"0.76198786",
"0.7590958",
"0.75740606",
"0.75225776",
"0.7522329",
"0.7519567",
"0.7510527",
"0.74856323",
"0.7482087",
"0.74432284",
"0.74300873",
"0.73599863",
"0.735101",
"0.73462... | 0.68471897 | 70 |
Use callbacks to share common setup or constraints between actions. | def set_syllabus_language
@syllabus_language = SyllabusLanguage.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def syllabus_language_params
params.require(:syllabus_language).permit(:language_id, :syllabus_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.71207976",
"0.705222",
"0.69488335",
"0.69021654",
"0.67362636",
"0.6717561",
"0.6689192",
"0.6678948",
"0.66622657",
"0.6555007",
"0.6527569",
"0.64588845",
"0.64522904",
"0.6450812",
"0.6448551",
"0.6434285",
"0.6412147",
"0.6412147",
"0.6393719",
"0.6381976",
"0.6381976... | 0.0 | -1 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ App side methods (you can overwrite them) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | def manage
@comments = current_user.comcoms.with_users.active.max2min(:id).page(params[:page])
render template: 'the_comments/manage/manage'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app; @app; end",
"def initialize(app); end",
"def initialize!(app); end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def app; end",
"def appraisals; end",
"def appraisals; end",
"... | [
"0.674727",
"0.653247",
"0.63677347",
"0.6346448",
"0.6346448",
"0.6346448",
"0.6346448",
"0.6346448",
"0.6346448",
"0.6346448",
"0.6346448",
"0.6346448",
"0.6346448",
"0.6322179",
"0.6322179",
"0.61396915",
"0.6121104",
"0.6111894",
"0.6111894",
"0.60461473",
"0.60461473",
... | 0.0 | -1 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Restricted area ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | def edit
@comments = current_user.comcoms.where(id: params[:id]).page(params[:page])
render template: 'the_comments/manage/manage'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def area\n appellation.region.area\n end",
"def set_area\n @area = current_user.area || '-1'\n end",
"def area_wrt_ground ()\n \n end",
"def percent_protected\n protected_area / total_area * 100\n end",
"def current_area\n PoliticalArea.nyc\n end",
"def area\n return @a... | [
"0.68615115",
"0.67622304",
"0.6628989",
"0.6493552",
"0.6417966",
"0.63284135",
"0.6318681",
"0.63021207",
"0.61447865",
"0.61250067",
"0.610394",
"0.6103917",
"0.60800433",
"0.6063386",
"0.60493636",
"0.5987441",
"0.597351",
"0.5949657",
"0.59042996",
"0.58825976",
"0.58812... | 0.0 | -1 |
Sanitize a HTML file | def sanitize(input, options={})
return "" if input.nil? or input.empty?
# Only take elements inside of <body>
@doc = Hpricot(input)
@doc = Hpricot(@doc.at("body").inner_html) if @doc.at("body")
sanitized = Aqueduct::RailsSanitizer.white_list_sanitizer.sanitize(@doc.to_html)
# Start parsing sanitized doc
@doc = Hpricot(sanitized)
# Rewrite all id's to appened network_key
append_id(@options[:append]) unless @options[:append].nil?
@options[:formatted] == false ? @doc.to_html.gsub(/\r|\n/i,'') : @doc.to_html
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize(html)\n doc = Nokogiri::HTML::DocumentFragment.parse(html)\n if Mako.config.sanitize_images\n doc.css('img').each do |n|\n begin\n n.name = 'a'\n n.content = n['alt'] ? \"📷 #{n['alt']}\" : '📷 Image'\n n['href'] = URI.parse(n['src']).absoluti... | [
"0.7414484",
"0.7242845",
"0.7204977",
"0.7202476",
"0.7168088",
"0.7095999",
"0.7079836",
"0.7079836",
"0.7066949",
"0.7064357",
"0.7033279",
"0.7023007",
"0.70115083",
"0.70115083",
"0.69995487",
"0.6831037",
"0.67975205",
"0.6716664",
"0.66873735",
"0.66757107",
"0.6672944... | 0.6349797 | 27 |
== Local variable section in emacs | def rb2f90_emacs_readonly
mess = "!Local Variables:\n"
mess << <<-"__EOF__"
!mode: f90
!buffer-read-only: t
!End:
__EOF__
return mess
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def local_variables() end",
"def put_var_scope\nend",
"def global_variables() end",
"def k_var!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 26 )\n\n\n\n type = K_VAR\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - ... | [
"0.68682605",
"0.6309533",
"0.6301486",
"0.6167567",
"0.60794634",
"0.6078201",
"0.60412484",
"0.59860516",
"0.5967931",
"0.5958772",
"0.5948803",
"0.5931514",
"0.58843285",
"0.5855342",
"0.5853259",
"0.58524746",
"0.58410513",
"0.5830527",
"0.58228785",
"0.5813567",
"0.58058... | 0.6369953 | 1 |
Only allow a trusted parameter "white list" through. | def user_params
params.require(:user).permit(:username, :password, :password_confirmation)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
DELETE /users/1 DELETE /users/1.json | def destroy
@inativa = Matinativa.new
@inativa.aluno_id = @matricula.aluno_id
@inativa.curso_id = @matricula.curso_id
@inativa.data_matricula = @matricula.data_matricula
@inativa.termino_matricula = Date.today
@inativa.ano = @matricula.ano
@inativa.teoria_ano = @matricula.teoria_ano
@inativa.valor_mensal = @matricula.valor_mensal
@inativa.id_ativa = @matricula.id
if @matricula.horarios.size > 1
@inativa.professor_id = @matricula.horarios.first.professor_id
@inativa.dia_pratica = @matricula.horarios.first.dia[0]
@inativa.professor_teoria_id = @matricula.horarios.last.professor_id
@inativa.dia_teoria = @matricula.horarios.last.dia[0]
elsif !@matricula.horarios.first.nil?
@inativa.professor_id = @matricula.horarios.first.professor_id
@inativa.dia_pratica = @matricula.horarios.first.dia[0]
elsif !@matricula.horarios.last.nil?
@inativa.professor_teoria_id = @matricula.horarios.last.professor_id
@inativa.dia_teoria = @matricula.horarios.last.dia[0]
end
if @inativa.save
#gera_notificacao("admin",@matricula, action_name)
@matricula.destroy
respond_to do |format|
format.html { redirect_to matriculas_path }
end
end
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\n render json: User.delete(params[\"id\"])\n end",
"def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end",
"def delete\n render json: Users.delete(params[\"id\... | [
"0.78750724",
"0.77518034",
"0.7713981",
"0.7610077",
"0.747295",
"0.74073994",
"0.74073994",
"0.7369968",
"0.7346072",
"0.7340465",
"0.7328618",
"0.7309635",
"0.73095363",
"0.7306841",
"0.7297868",
"0.72917855",
"0.7291585",
"0.7289111",
"0.7284347",
"0.7250935",
"0.7250935"... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_matricula
@matricula = Matricula.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 matricula_params
params.require(:matricula).permit(:aluno_id, :curso_id, :data_matricula, :ano, :valor_mensal, :termino_matricula,
:teoria_ano)
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.6980629",
"0.67819995",
"0.67467666",
"0.67419875",
"0.67347664",
"0.65928614",
"0.6504013",
"0.6498014",
"0.64819515",
"0.64797956",
"0.64562726",
"0.64400834",
"0.6380117",
"0.6377456",
"0.63656694",
"0.6320543",
"0.63002014",
"0.62997127",
"0.629425",
"0.6293866",
"0.62... | 0.0 | -1 |
GET /items/1 GET /items/1.xml | def show
@item = Item.find(params[:id])
@feature = Feature.new
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @item }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @request = Request.find(params[:id])\n @items = @request.items\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.h... | [
"0.67883086",
"0.67824584",
"0.67824584",
"0.67824584",
"0.67824584",
"0.67824584",
"0.67824584",
"0.6725632",
"0.671724",
"0.66035503",
"0.65945554",
"0.6577324",
"0.65549666",
"0.647732",
"0.6476387",
"0.6447388",
"0.64292353",
"0.63994366",
"0.636686",
"0.6338798",
"0.6316... | 0.0 | -1 |
GET /items/new GET /items/new.xml | def new
@item = Item.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @item }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @item = Item.factory('local')\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }... | [
"0.7750405",
"0.7674057",
"0.7650397",
"0.7624482",
"0.7310945",
"0.7224427",
"0.7214633",
"0.71571666",
"0.7152413",
"0.71524066",
"0.71524066",
"0.71524066",
"0.71524066",
"0.71524066",
"0.71524066",
"0.71524066",
"0.71524066",
"0.71524066",
"0.71524066",
"0.71524066",
"0.7... | 0.7721567 | 5 |
POST /items POST /items.xml | def create
@item = Item.new(params[:item])
respond_to do |format|
if @item.save
flash[:notice] = 'Item was successfully created.'
format.html { redirect_to(@item) }
format.xml { render :xml => @item, :status => :created, :location => @item }
else
format.html { render :action => "new" }
format.xml { render :xml => @item.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to(items_path) }\n format.xml { render :xml => @item, :status => :created... | [
"0.6878987",
"0.68121386",
"0.6461912",
"0.6385658",
"0.63709396",
"0.63393664",
"0.63393664",
"0.6333269",
"0.62712324",
"0.6207085",
"0.617964",
"0.61328024",
"0.6087989",
"0.60817254",
"0.60677546",
"0.60674924",
"0.6064618",
"0.6062312",
"0.6056173",
"0.60460603",
"0.6037... | 0.6326739 | 9 |
PUT /items/1 PUT /items/1.xml | def update
@item = Item.find(params[:id])
respond_to do |format|
if @item.update_attributes(params[:item])
flash[:notice] = 'Item was successfully updated.'
format.html { redirect_to(@item) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @item.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to(@item)}\n f... | [
"0.6630569",
"0.6627824",
"0.6621275",
"0.6534779",
"0.64609754",
"0.6442224",
"0.64367634",
"0.64367634",
"0.6424991",
"0.63892907",
"0.63527155",
"0.63239944",
"0.63216454",
"0.6300074",
"0.6266376",
"0.6246194",
"0.6228602",
"0.62218153",
"0.62161434",
"0.6210292",
"0.6193... | 0.6492852 | 4 |
DELETE /items/1 DELETE /items/1.xml | def destroy
@item = Item.find(params[:id])
@item.destroy
respond_to do |format|
format.html { redirect_to(items_url) }
format.xml { head :ok }
format.js
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { r... | [
"0.70777845",
"0.70777845",
"0.70777845",
"0.70777845",
"0.70777845",
"0.70777845",
"0.7069073",
"0.7031392",
"0.6894484",
"0.6870741",
"0.683775",
"0.68257034",
"0.6819741",
"0.6802184",
"0.67975116",
"0.6779638",
"0.6778703",
"0.6772744",
"0.67490864",
"0.6748912",
"0.67385... | 0.0 | -1 |
Passing the required "name" parameter creates a folder with this name. Optionally, passing an "overwrite" parameter as true/false, will overwrite an existing folder if true. | def create(name)
url = prefix + "create" + "&name=#{name}"
return response(url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_folder(name)\n Dir.mkdir(\"#{name}\")\nend",
"def create_folder(name)\n folder = ROSRS::Folder.create(self, name)\n load unless loaded?\n @folders[folder.uri] = folder\n folder\n end",
"def create_folder(name, folder = 0)\n # Requires authorization\n raise PutioErro... | [
"0.7132006",
"0.7082928",
"0.6863603",
"0.6840631",
"0.67737246",
"0.67631376",
"0.6699661",
"0.6692752",
"0.6558048",
"0.64649916",
"0.63744944",
"0.6359679",
"0.6349082",
"0.63409466",
"0.6327305",
"0.63105977",
"0.6305249",
"0.6240773",
"0.6234909",
"0.6221404",
"0.6202932... | 0.0 | -1 |
Deletes a folder given the passed in "id" parameter and all children of this folder. | def delete
url = prefix + "delete"
return response(url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_folder(folder_id)\n perform_post_with_unparsed_response('/api/1.1/folders/delete', folder_id: folder_id)\n true\n end",
"def delete_folder folder_id\n delete(\"/projects/#{folder_id}\", code: 204)\n end",
"def delete_user_folder(id)\n @client.raw('delete', \"/helper... | [
"0.7575797",
"0.73996645",
"0.69512916",
"0.6664926",
"0.64769596",
"0.64564824",
"0.63483113",
"0.63026357",
"0.6298884",
"0.6243065",
"0.61222774",
"0.61151075",
"0.6058769",
"0.6047256",
"0.6047256",
"0.60314673",
"0.59556323",
"0.5888522",
"0.5857324",
"0.5840239",
"0.581... | 0.0 | -1 |
Passing the required "name" parameter will change a folders name to what is passed. | def rename(name)
url = prefix + "rename&name=#{name}"
return response(url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name_folder(name)\n Kamelopard::DocumentHolder.instance.current_document.folder.name = name\n return Kamelopard::DocumentHolder.instance.current_document.folder\n end",
"def rename(new_name)\n\n self.update_attribute(:name, new_name)\n\n folder = self.get_team_folder\n\n unless folder.nil... | [
"0.74881196",
"0.70607036",
"0.70495236",
"0.70100117",
"0.6783836",
"0.6705728",
"0.6571921",
"0.64381593",
"0.63509005",
"0.6318723",
"0.62641656",
"0.62009376",
"0.61694974",
"0.61659306",
"0.615026",
"0.6138195",
"0.61344975",
"0.60982823",
"0.60982823",
"0.60720223",
"0.... | 0.5614569 | 48 |
(not implemented) Calling this function will return a link directly to a specified folder given the "id" parameter of a folder. | def request_url(requirelogin=false, requireuserinfo=false, expirationdays=30, notifyonupload=false)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drive_folder_link\n\t\t\"https://drive.google.com/#folders/#{self.folder_id}\"\n\tend",
"def get_folder(folder_id)\n @folders[folder_id]\n end",
"def get_folder(folder_id)\n @folders[folder_id]\n end",
"def folder(id)\n Box::Folder.new(@api, nil, :id => id)\n end",
"def get_folder folde... | [
"0.7450053",
"0.72249484",
"0.72249484",
"0.7170387",
"0.70170796",
"0.69332033",
"0.6892542",
"0.68248606",
"0.66044796",
"0.6596108",
"0.65366524",
"0.6534565",
"0.6506531",
"0.6438451",
"0.6435177",
"0.6396507",
"0.6387204",
"0.6387204",
"0.63646686",
"0.63481534",
"0.6341... | 0.0 | -1 |
(not implemented) Grants folder privileges to the given user. | def grant(userid=nil, email=nil, download=true, upload=false, view=true, admin=false, delete=false, notifyupload=false, notifydownload=false) #(userid OR email) required
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def access_rights_for_user(usr)\n return unless usr\n return :all if administrator?(usr)\n\n rights = standard_authorized_user_rights\n \n user_groups = usr.send(Lockdown.user_groups_hbtm_reference)\n user_groups.each do |grp|\n permissions_for_user_group(grp).each do |perm|\... | [
"0.6458626",
"0.64164406",
"0.63195044",
"0.6302407",
"0.62864375",
"0.6193603",
"0.6145888",
"0.61149967",
"0.61095226",
"0.60716057",
"0.6060547",
"0.6048689",
"0.6034951",
"0.60318506",
"0.60236",
"0.6004368",
"0.600217",
"0.59809643",
"0.5973481",
"0.59724665",
"0.5960740... | 0.0 | -1 |
(not implemented) Revokes folder privileges from the given user | def revoke(userid=nil, email=nil) #(userid OR email) required
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drop_privileges(user, group)\n uid, gid = user_id(user) if user\n gid = group_id(group) if group\n\n Process::Sys.setgid(gid) if gid\n Process::Sys.setuid(uid) if uid\n rescue Errno::EPERM => e\n raise ServiceError, \"unable to drop privileges (#{e})\"\n end",
"def delete curre... | [
"0.65115905",
"0.6319871",
"0.6299845",
"0.6263596",
"0.62233466",
"0.61437553",
"0.61226535",
"0.6064314",
"0.60449004",
"0.60337406",
"0.600585",
"0.5873958",
"0.58720857",
"0.58468723",
"0.58057785",
"0.58057785",
"0.58040315",
"0.57888716",
"0.5787666",
"0.5762418",
"0.57... | 0.5345394 | 90 |
Returns a permission list for the given folder. | def getacl
url = prefix + "getacl"
return response(url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_permissions\n BrickFTP::API::Permission.all\n end",
"def list_permissions\n BrickFTP::API::Permission.all\n end",
"def all_permissions\n array = []\n @permissions.each { |_, permission| array << permission }\n @groups.each do |_, group|\n group.all_permissions.eac... | [
"0.6720204",
"0.6720204",
"0.62427324",
"0.6049742",
"0.6049742",
"0.6039531",
"0.5996304",
"0.589349",
"0.58625734",
"0.5857898",
"0.5839366",
"0.5838928",
"0.5835058",
"0.583343",
"0.5824475",
"0.5774759",
"0.5771925",
"0.5760927",
"0.57548547",
"0.57547843",
"0.57204574",
... | 0.0 | -1 |
populates Folder.children list. Can be done at initialize using include_children=true | def fetch_children
@children = []
for item in self.listex
if item["type"] == "folder" and item["id"]!=@id #sharefile API includes self in list
@children << Folder.new(item["id"], @authid, @subdomain, false, item)
elsif item["type"] == "file"
@children << File.new(item["id"], @authid, @subdomain, item)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_children(accummulator=[])\n return accummulator if children.size == 0\n children.each do |child_id|\n child = Folder.get(child_id)\n accummulator << child\n child.all_children(accummulator)\n end\n accummulator\n end",
"def fetch_children\n @children = []\n for item in s... | [
"0.7190435",
"0.70447356",
"0.6711489",
"0.64942795",
"0.64935386",
"0.6400081",
"0.639999",
"0.63813865",
"0.63761085",
"0.6356016",
"0.6356016",
"0.6356016",
"0.6356016",
"0.6347648",
"0.6298537",
"0.6259552",
"0.6251697",
"0.6223707",
"0.61692876",
"0.6168176",
"0.6153295"... | 0.77227366 | 0 |
Returns a list of all subfolders and files in the current folder with additional information. | def listex
url = prefix + "listex"
return response(url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_entries(dir, subfolder); end",
"def list_all_in_current_directory\n Dir.glob('**/*').sort\nend",
"def file_list tree_root=nil\n tree_root ||= self.tree_root\n file_list = []\n current_dir = tree_root\n visit_entries self.files do |type, name|\n case type\n when :directory\n ... | [
"0.69303924",
"0.69224375",
"0.670484",
"0.6701903",
"0.6562339",
"0.6547763",
"0.64995825",
"0.6338724",
"0.62775314",
"0.6265487",
"0.62319446",
"0.620115",
"0.6195857",
"0.6195348",
"0.61823523",
"0.618143",
"0.61789215",
"0.617667",
"0.61692274",
"0.616501",
"0.6143128",
... | 0.0 | -1 |
Returns a list of all subfolders and files in the current folder | def list
url = prefix + "list"
return response(url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_all_in_current_directory\n Dir.glob('**/*').sort\nend",
"def list(path='root')\n puts \"#list('#{path}')\"\n listed_files =[]\n @drive.folder = path\n children = @drive.children\n list_files_metadata(children)\n raise 'There are no files in director... | [
"0.7424879",
"0.7160962",
"0.7145911",
"0.7100264",
"0.70638174",
"0.70392877",
"0.7035852",
"0.6972089",
"0.6952065",
"0.6929919",
"0.69291836",
"0.6903333",
"0.6880258",
"0.68312097",
"0.68187004",
"0.6803622",
"0.6793606",
"0.6793606",
"0.67648256",
"0.6761874",
"0.6713602... | 0.0 | -1 |
Returns id of the current folder verifying it exists | def get
url = prefix + "get"
return response(url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def folder_id\n current.folder.id\n end",
"def root_folder_id\n self.root_folder\n end",
"def last_opened_folder_id(project)\n cooky = cookies[:folder_browsed_json]\n cooky ||= {}.to_json\n cooky = ActiveSupport::JSON.decode(cooky)\n folder_id = cooky[project.id.to_s]\n\n folder_id = nil... | [
"0.75070214",
"0.7159271",
"0.69213814",
"0.6866117",
"0.6857331",
"0.6830864",
"0.6808344",
"0.67132854",
"0.6700107",
"0.6572976",
"0.6526553",
"0.65000993",
"0.6376463",
"0.62645715",
"0.6229899",
"0.6183787",
"0.61743736",
"0.614659",
"0.61096394",
"0.60920227",
"0.606547... | 0.0 | -1 |
Returns all metadata of the requested folder id | def getex
url = prefix + "getex"
return response(url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list(folder)\n\t\tc = 0\n\t\tfolder = '/' + folder\t\t\t\n\t\tresp = @client.metadata(folder)\n\t\tputs \"\\n List of contents in \" + folder + \"\\n\"\n\t\tfor item in resp['contents']\t\t\n\t\t\tputs item['path']\n\n\t\t\tc=c+1\n\t\tend\t\n\t\t\n\tend",
"def get_directory_listing_for(params)\n # Get p... | [
"0.6633125",
"0.65705955",
"0.6556665",
"0.6538375",
"0.64779276",
"0.6292984",
"0.6292984",
"0.6275695",
"0.62209696",
"0.6160511",
"0.6083531",
"0.6073009",
"0.60697556",
"0.60639167",
"0.60281014",
"0.6023086",
"0.601532",
"0.5948098",
"0.5918275",
"0.5898173",
"0.58630055... | 0.0 | -1 |
Noop return self as cached environment. | def cached
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache\n @__cache ||= Cache.new self\n end",
"def cache\n @cache ||= build_cache\n end",
"def cache\n env[CACHE] ||= Hash.new {|hash, sha| hash[sha] = read(sha) }\n end",
"def cache!\n @@cache\n end",
"def cached\n raise NotImplementedError\n end",
"def cache\n ... | [
"0.6782927",
"0.67637193",
"0.668713",
"0.666474",
"0.6606244",
"0.6585674",
"0.63838744",
"0.6359243",
"0.6357623",
"0.63493055",
"0.63162357",
"0.6282738",
"0.6279236",
"0.62667125",
"0.62440324",
"0.62440324",
"0.6226499",
"0.62198174",
"0.62198174",
"0.6177602",
"0.617182... | 0.705013 | 0 |
Cache is immutable, any methods that try to clear the cache should bomb. | def mutate_config(*args)
raise RuntimeError, "can't modify immutable cached environment"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_cache; end",
"def clear_cache() @cache = {}; end",
"def update_cache\n # Does nothing...up to subclasses to implement.\n end",
"def clear_cache!\n # this should be overridden by concrete adapters\n end",
"def clear\n @cache.clear\n end",
... | [
"0.8214617",
"0.8058668",
"0.7711545",
"0.77013814",
"0.7688198",
"0.7676083",
"0.76349705",
"0.76349705",
"0.75374264",
"0.75326014",
"0.7507888",
"0.74924093",
"0.74765784",
"0.74576277",
"0.74576277",
"0.74576277",
"0.74576277",
"0.74576277",
"0.74576277",
"0.74576277",
"0... | 0.0 | -1 |
should have the same interface as a standard Action | def setup(stash, point)
@stash = stash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def process(action, *args); end",
"def process_action(...)\n send_action(...)\n end",
"def action\n end",
"def _call_action(action)\n send(action)\n end",
"def action\n end",
"def ... | [
"0.7629962",
"0.7629962",
"0.7629962",
"0.7629962",
"0.7629962",
"0.7489624",
"0.74622047",
"0.74260193",
"0.74098307",
"0.73540413",
"0.73185074",
"0.73185074",
"0.73170495",
"0.73167515",
"0.73167515",
"0.73167515",
"0.73167515",
"0.73167515",
"0.73167515",
"0.73034686",
"0... | 0.0 | -1 |
should have the same interface as a standard Action | def setup(stash, point)
@stash = stash
# ah, but this assumes that all Entity objects can be created without parameters
obj = @klass.new
obj[:physics].body.p = point
@space.entities.add obj
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def process(action, *args); end",
"def process_action(...)\n send_action(...)\n end",
"def action\n end",
"def _call_action(action)\n send(action)\n end",
"def action\n end",
"def ... | [
"0.76286364",
"0.76286364",
"0.76286364",
"0.76286364",
"0.76286364",
"0.7486982",
"0.7459622",
"0.7424345",
"0.74081314",
"0.73525256",
"0.7316452",
"0.7316452",
"0.7315694",
"0.7315694",
"0.7315694",
"0.7315694",
"0.7315694",
"0.7315694",
"0.73149925",
"0.7300853",
"0.72679... | 0.0 | -1 |
GET /company_dei_fields or /company_dei_fields.json | def index
@company_dei_fields = CompanyDeiField.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_fields()\n return @api.do_request(\"GET\", get_base_api_path() + \"/fields\")\n end",
"def company_info(company_id, *fields)\n get(\"/organizations/#{company_id}#{field_selector(fields)}\")\n end",
"def company_dei_field_params\n params.require(:company_dei_field).permit(:company... | [
"0.6915584",
"0.6612462",
"0.6463985",
"0.6064799",
"0.6005142",
"0.59954727",
"0.59470457",
"0.5917651",
"0.5806166",
"0.57818156",
"0.57804304",
"0.57792765",
"0.5778234",
"0.57095826",
"0.5691236",
"0.5673233",
"0.5663121",
"0.56511784",
"0.5641612",
"0.5613393",
"0.560827... | 0.6918577 | 0 |
GET /company_dei_fields/1 or /company_dei_fields/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @company_dei_fields = CompanyDeiField.all\n end",
"def get_fields()\n return @api.do_request(\"GET\", get_base_api_path() + \"/fields\")\n end",
"def company_info(company_id, *fields)\n get(\"/organizations/#{company_id}#{field_selector(fields)}\")\n end",
"def get_company_b... | [
"0.6785096",
"0.67532855",
"0.66428226",
"0.6371352",
"0.6326922",
"0.6217147",
"0.6013957",
"0.59897584",
"0.595333",
"0.5898151",
"0.5890971",
"0.58468264",
"0.5834416",
"0.5816103",
"0.580458",
"0.5790136",
"0.5779247",
"0.5774152",
"0.57724327",
"0.5749261",
"0.57450444",... | 0.0 | -1 |
POST /company_dei_fields or /company_dei_fields.json | def create
@company_dei_field = CompanyDeiField.new(company_dei_field_params)
respond_to do |format|
if @company_dei_field.save
format.html { redirect_to @company_dei_field, notice: "Company dei field was successfully created." }
format.json { render :show, status: :created, location: @company_dei_field }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @company_dei_field.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def company_dei_field_params\n params.require(:company_dei_field).permit(:company_id, :dei_field_id)\n end",
"def set_company_dei_field\n @company_dei_field = CompanyDeiField.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @company_dei_field.update(company_dei_field_... | [
"0.72969025",
"0.6398419",
"0.62034774",
"0.61678654",
"0.6144338",
"0.6108145",
"0.5874998",
"0.5843392",
"0.5749435",
"0.55539334",
"0.5551198",
"0.5519737",
"0.54990107",
"0.54640573",
"0.5462716",
"0.5446499",
"0.5444533",
"0.54161596",
"0.54046124",
"0.5365971",
"0.53527... | 0.7213538 | 1 |
PATCH/PUT /company_dei_fields/1 or /company_dei_fields/1.json | def update
respond_to do |format|
if @company_dei_field.update(company_dei_field_params)
format.html { redirect_to @company_dei_field, notice: "Company dei field was successfully updated." }
format.json { render :show, status: :ok, location: @company_dei_field }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @company_dei_field.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @company_field.update(company_field_params)\n format.html { redirect_to @company_field, notice: 'Company field was successfully updated.' }\n format.json { render :show, status: :ok, location: @company_field }\n else\n format.html { render ... | [
"0.6994824",
"0.6807052",
"0.6751275",
"0.6700451",
"0.6657556",
"0.65416217",
"0.6488208",
"0.62891513",
"0.6278091",
"0.6248317",
"0.62350494",
"0.6223402",
"0.6213506",
"0.62039375",
"0.6192445",
"0.61765975",
"0.6125867",
"0.61073005",
"0.60739475",
"0.6070091",
"0.606828... | 0.74518 | 0 |
DELETE /company_dei_fields/1 or /company_dei_fields/1.json | def destroy
@company_dei_field.destroy
respond_to do |format|
format.html { redirect_to company_dei_fields_url, notice: "Company dei field was successfully destroyed." }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @company_field.destroy\n respond_to do |format|\n format.html { redirect_to company_fields_url, notice: 'Company field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def DeleteField id\n \n APICall(path: \"ticket_fields/#{id}.json\... | [
"0.7297374",
"0.6985079",
"0.6941637",
"0.6892651",
"0.68521124",
"0.68208",
"0.68208",
"0.68130654",
"0.676764",
"0.67555934",
"0.6651101",
"0.66187036",
"0.6572903",
"0.6555761",
"0.6555592",
"0.65225166",
"0.6503332",
"0.64953595",
"0.6486551",
"0.64724094",
"0.64686763",
... | 0.76108295 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_company_dei_field
@company_dei_field = CompanyDeiField.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def company_dei_field_params
params.require(:company_dei_field).permit(:company_id, :dei_field_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.6948629",
"0.6813401",
"0.68012834",
"0.67958814",
"0.6745398",
"0.67409563",
"0.6526744",
"0.65207636",
"0.6492359",
"0.6433316",
"0.6433316",
"0.6433316",
"0.639903",
"0.6355392",
"0.63544166",
"0.63463736",
"0.6344045",
"0.6337686",
"0.632862",
"0.632862",
"0.632862",
... | 0.0 | -1 |
Creates a new channel. | def initialize
@queue = []
@waiting = []
@mutex = Mutex.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_channel\n AMQP::Channel.new(@amqp_client)\n end",
"def create_channel\n Channel.new @grpc_stub_class, endpoint: @endpoint, credentials: @credentials, channel_args: @channel_args,\n interceptors: @interceptors, on_channel_create: @config.on_channel_create\n end",
... | [
"0.7874659",
"0.7830494",
"0.7788502",
"0.75793046",
"0.75732815",
"0.7509736",
"0.7465657",
"0.74499625",
"0.74269646",
"0.7154961",
"0.71239",
"0.71239",
"0.704802",
"0.7027061",
"0.6885507",
"0.6869084",
"0.68489945",
"0.683869",
"0.683869",
"0.67796487",
"0.6772708",
"0... | 0.0 | -1 |
Pushes +obj+ to the queue. | def push(obj)
@mutex.synchronize do
@queue.push obj
begin
t = @waiting.shift
t.wakeup if t
rescue ThreadError
retry
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push(obj)\n @queue.put(obj)\n end",
"def push(obj)\n @q << obj\n @mutex.synchronize { @cv.signal }\n end",
"def push(obj)\n @mutex.synchronize{\n @que.push obj\n begin\n t = @waiting.shift\n t.wakeup if t\n rescue ThreadError\... | [
"0.9159362",
"0.8241774",
"0.8145581",
"0.8085834",
"0.8066046",
"0.7827684",
"0.77496",
"0.77180564",
"0.7461795",
"0.743241",
"0.73573846",
"0.7350464",
"0.73243284",
"0.7298629",
"0.68678147",
"0.68641174",
"0.6834116",
"0.6831325",
"0.6815872",
"0.6703816",
"0.6636854",
... | 0.83978677 | 1 |
Retrieves data from channel. If the channel is empty, the calling thread is suspended until data is pushed onto channel. | def pop
@mutex.synchronize do
loop do
if @queue.empty?
@waiting.push Thread.current
@mutex.sleep
else
return @queue.shift
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop!\n @mutex.synchronize do\n loop do\n if @queue.empty?\n raise ThreadError, \"Empty Channel\"\n @waiting.push Thread.current\n @mutex.sleep\n else\n return @queue.shift\n end\n end\n end\n end",
"def consume_... | [
"0.6664893",
"0.6316204",
"0.6220977",
"0.6169028",
"0.598539",
"0.5882281",
"0.5683792",
"0.56730545",
"0.561577",
"0.5589824",
"0.5589802",
"0.55678767",
"0.5525934",
"0.5509804",
"0.5461527",
"0.54573184",
"0.5452558",
"0.5403358",
"0.5378089",
"0.53726536",
"0.53661245",
... | 0.51369166 | 49 |
Retrieves data from channel like method +pop+, but if thread isn't suspended, and an exception is raised. | def pop!
@mutex.synchronize do
loop do
if @queue.empty?
raise ThreadError, "Empty Channel"
@waiting.push Thread.current
@mutex.sleep
else
return @queue.shift
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop\n @queue.pop(true)\n rescue ThreadError\n if closed?\n raise ClosedQueue if @raise_exception.true?\n return nil\n else\n sleep\n retry\n end\n end",
"def pop_non_blocking\n yield pop(timeout: 0)\n rescue TimeoutError\n nil\n end",
"def pop(non_b... | [
"0.65754336",
"0.65032303",
"0.6019673",
"0.5948217",
"0.5936031",
"0.5904673",
"0.5803188",
"0.58011866",
"0.57122463",
"0.5536105",
"0.5508935",
"0.54989034",
"0.54855925",
"0.5464009",
"0.5464009",
"0.5461388",
"0.54411006",
"0.5415646",
"0.5409868",
"0.53723055",
"0.53502... | 0.6866766 | 0 |
Retrieves all data from channel. If the channel is empty, the calling thread is suspended until data is pushed onto channel. | def flush
flushed_queue = nil
@mutex.synchronize do
flushed_queue = @queue.dup
@queue.clear
end
return flushed_queue
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop!\n @mutex.synchronize do\n loop do\n if @queue.empty?\n raise ThreadError, \"Empty Channel\"\n @waiting.push Thread.current\n @mutex.sleep\n else\n return @queue.shift\n end\n end\n end\n end",
"def consume_... | [
"0.6297687",
"0.6189377",
"0.59583265",
"0.5733964",
"0.5612976",
"0.5543242",
"0.5538771",
"0.54548746",
"0.5432199",
"0.5362863",
"0.5339628",
"0.5319087",
"0.5305985",
"0.5293969",
"0.5267787",
"0.5264247",
"0.5242485",
"0.52250355",
"0.51778543",
"0.51728153",
"0.5123976"... | 0.0 | -1 |
Redirect signal to other channel | def redirect_to(channel, callback_method=nil, *args)
value = self.pop
value.send(callback_method, *args) if callback_method
yield value if block_given?
channel << value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signal\n end",
"def signal; end",
"def signal; end",
"def signal\r\n Ragweed::Wrap32::set_event(@h)\r\n end",
"def signal(signum = nil)\n handle = Signal.new(@reactor)\n handle.progress &Proc.new if block_given?\n handle.start(signum) if signum\n handle\... | [
"0.64359486",
"0.6214351",
"0.6214351",
"0.61760473",
"0.60680985",
"0.6060385",
"0.6035328",
"0.6030367",
"0.5937584",
"0.58149874",
"0.5784314",
"0.5764498",
"0.5740301",
"0.5619997",
"0.55660635",
"0.54933643",
"0.5459661",
"0.5426095",
"0.5426095",
"0.53841525",
"0.538235... | 0.5146787 | 43 |
Returns +true+ if the channel is empty. | def empty?
@queue.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty?\n synchronize do\n return false if @publishing || @canceled || @stopping\n\n @items.empty? && @queue.empty?\n end\n end",
"def empty?\r\n @pack.empty?\r\n end",
"def empty?\n @buffer.empty? && stream_is_done?\n end",
"def empty?\... | [
"0.7453392",
"0.7448348",
"0.7414016",
"0.7358403",
"0.7333751",
"0.7321187",
"0.7308399",
"0.7301382",
"0.7269911",
"0.72513944",
"0.7245973",
"0.7245973",
"0.72450405",
"0.72348857",
"0.72291565",
"0.72291565",
"0.72291565",
"0.72291565",
"0.72275406",
"0.72266054",
"0.7214... | 0.73459053 | 5 |
Removes all objects from the channel. | def clear
@queue.clear
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def part_all()\n @channels.clear()\n end",
"def delete_all\n @objects.each do |o|\n o.delete \n end\n\n @objects.clear\n end",
"def clear\n channels = @channels.dup\n @channels.clear\n channels\n end",
"def remove_all\n @registry = []\n sync\n end",
"def disc... | [
"0.73680043",
"0.7194076",
"0.70066684",
"0.67201596",
"0.67042243",
"0.6634463",
"0.6616158",
"0.65271515",
"0.65169615",
"0.65155435",
"0.65082675",
"0.64597",
"0.6392306",
"0.63877296",
"0.6368209",
"0.63368434",
"0.6332407",
"0.62921876",
"0.6273184",
"0.6266815",
"0.6253... | 0.5931423 | 52 |
Returns the length of the channel. | def length
@queue.length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def channels_count\n channels.count\n end",
"def length\n @redis.llen @redis_name\n end",
"def length\n Integer(connection.write(\"get_length\", false))\n rescue ArgumentError\n 0\n end",
"def length\n Integer(connection.write(\"get_length\", false))\n rescue A... | [
"0.70875275",
"0.704053",
"0.7013968",
"0.7013968",
"0.7013968",
"0.69790536",
"0.69790536",
"0.6943149",
"0.6862032",
"0.6862032",
"0.6862032",
"0.68152434",
"0.678525",
"0.6733793",
"0.6723566",
"0.6700917",
"0.6669434",
"0.665001",
"0.6643052",
"0.65751904",
"0.6569529",
... | 0.6215591 | 80 |
Returns the number of threads waiting on the queue. | def waiting_size
@waiting.size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_waiting\n @queue.num_waiting\n end",
"def num_waiting\n @waiting.size + @queue_wait.size\n end",
"def num_waiting\n @waiting.size + @queue_wait.size\n end",
"def waiting_threads_count\n @waiting_threads_sleepers.length\n end",
"def num_waiting\n @pop_mutex.waiting_t... | [
"0.8595451",
"0.8447729",
"0.8447729",
"0.82736677",
"0.82481676",
"0.8178111",
"0.8178111",
"0.808434",
"0.8060422",
"0.78676134",
"0.78309554",
"0.78309554",
"0.77566427",
"0.7631757",
"0.7623891",
"0.75829625",
"0.75828606",
"0.7566508",
"0.7421118",
"0.7421118",
"0.740598... | 0.7499412 | 18 |
Method called only by selector to subscribe listeners, dont use it, unless you understand exactly what you're doing! | def subscribe(selector)
channel = self
@mutex.synchronize do
loop do
return selector.result unless selector.waiting?
if @queue.empty?
@waiting.push Thread.current
@mutex.sleep
else
selector.mutex.synchronize do
if selector.waiting?
result = selector.update_result(channel, @queue.shift)
yield result
end
end
selector.release_result
return selector.result
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscribed; end",
"def listener; end",
"def subscribed # :doc:\n # Override in subclasses\n end",
"def listeners; end",
"def subscriptions; end",
"def subscriptions; end",
"def subscriptions; end",
"def listener=(_arg0); end",
"def events=(_); end",
"def subscribe!\n # TODO... | [
"0.7055471",
"0.663558",
"0.65850717",
"0.65158284",
"0.63182604",
"0.63182604",
"0.63182604",
"0.630834",
"0.6292331",
"0.6276158",
"0.62591",
"0.62591",
"0.62591",
"0.62591",
"0.62591",
"0.62591",
"0.62591",
"0.62591",
"0.61430746",
"0.6075591",
"0.60528743",
"0.60528743"... | 0.0 | -1 |
Prepare Solr document hash for the record | def solr_doc_data
doc = {}
# To support indexing of records of different classes, create a unique id by concatenating
# class name (downcased and underscored) and record id (see solr_id below)...
doc[:id] = solr_id
# ... then record class name and record id as record_type, record_id
doc[:record_type] = self.class.to_s.underscore
doc[:record_id] = self.id
# This will add all attributes that correspond to database columns (make sure these are all in the schema, or modify)
attrs = self.class.column_names.map { |n| n.to_sym }
attrs.each do |a|
if a != :id
doc[a] = self[a]
end
end
######################################################
# Here you can add other elements to the doc as needed
#
# If you are indexing records from multiple models, it's a good idea to use a case statement here
# to specify which fields to index for which model, e.g.:
#
# case self
# when Foo
# doc['foo_attribute'] = self.foo_attribute
# when Boo
# doc['boo_attribute'] = self.boo_attribute
# end
#
######################################################
# remove nil/empty values
doc.delete_if { |k,v| nil_or_empty?(v) }
doc
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_solr_document\n super.tap do |solr_doc|\n solr_doc['member_works_count_isi'] = member_works_count\n solr_doc['title_ssort'] = sort_title\n solr_doc['creator_ssort'] = object.creator.first\n solr_doc['generic_type_sim'] = [\"Collection\"]\n solr_doc['banner_path_ss'] = banne... | [
"0.7082318",
"0.69476336",
"0.6747126",
"0.6719643",
"0.6717518",
"0.667712",
"0.6670328",
"0.6646686",
"0.66464996",
"0.66441804",
"0.6585215",
"0.64996094",
"0.63885593",
"0.6387329",
"0.6360765",
"0.6356486",
"0.6320859",
"0.6257694",
"0.6251336",
"0.6198756",
"0.6195765",... | 0.6798209 | 2 |
Updates the record in the Solr index | def update_index
self.reload
SearchIndex.update_record(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_index\n if should_be_in_index?\n mapper.process_with([record]) do |context|\n writer.put(context)\n end\n else\n writer.delete(record.send(Kithe.indexable_settings.solr_id_value_attribute))\n end\n end",
"def update_index\n SolrServi... | [
"0.7390287",
"0.73272127",
"0.7111259",
"0.6950299",
"0.68402314",
"0.6805661",
"0.6727868",
"0.6717224",
"0.6645422",
"0.6588524",
"0.65406764",
"0.6476195",
"0.6440991",
"0.64143896",
"0.638688",
"0.6378034",
"0.63408524",
"0.6333589",
"0.6333589",
"0.6333589",
"0.6333589",... | 0.6466994 | 13 |
Remove the record from the Solr index | def delete_from_index
SearchIndex.delete_record(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n remove_from_solr(@record.id)\n @record.destroy\n respond_to do |format|\n format.html {redirect_to records_url, notice: 'Record was successfully destroyed.'}\n format.json {head :no_content}\n end\n end",
"def immediate_remove(field_name,params={})\n ignore_editstore=param... | [
"0.7578597",
"0.71721876",
"0.70539045",
"0.70539045",
"0.7009655",
"0.6925817",
"0.6883",
"0.6850654",
"0.6721093",
"0.66939723",
"0.65985906",
"0.65911096",
"0.65450454",
"0.65390813",
"0.6448471",
"0.64478683",
"0.6439756",
"0.64228123",
"0.64186037",
"0.63828284",
"0.6353... | 0.75075793 | 2 |
Returns a string containing the header bytes for a bmp header with a dib header of size 40, i.e. a "BITMAPINFOHEADER". | def print_header
header = ""
Imgrb::BmpMethods::add_bmp_bytes(header, file_size, 4)
#Reserved, depends on application. Safe to set to 0s
header << 0.chr*4
#Offset. 40 (from DIB) + 14 (from header)
Imgrb::BmpMethods::add_bmp_bytes(header, 54, 4)
#Size of DIB-header
Imgrb::BmpMethods::add_bmp_bytes(header, 40, 4)
Imgrb::BmpMethods::add_bmp_bytes(header, @width, 4)
Imgrb::BmpMethods::add_bmp_bytes(header, @height, 4)
#Color planes, must be set to 1
Imgrb::BmpMethods::add_bmp_bytes(header, 1, 2)
#Bits per pixel. Always write 24-bit bmps.
Imgrb::BmpMethods::add_bmp_bytes(header, 24, 2)
#No compression
Imgrb::BmpMethods::add_bmp_bytes(header, 0, 4)
#Image size. Can be 0 for compression method 0.
Imgrb::BmpMethods::add_bmp_bytes(header, image_size, 4)
Imgrb::BmpMethods::add_bmp_bytes(header, @horizontal_res, 4)
Imgrb::BmpMethods::add_bmp_bytes(header, @vertical_res, 4)
#Default color palette
Imgrb::BmpMethods::add_bmp_bytes(header, 0, 4)
#All colors important
Imgrb::BmpMethods::add_bmp_bytes(header, 0, 4)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_bmp_header\n BmpHeader.new(@width, @height, 24, 0, 40, 1)\n end",
"def to_bmp_header\n self\n end",
"def header_fields\n IO.binread(@path, HEADER_SIZE, 0).unpack(\"N5C1\")\n end",
"def get_header_info\n @data.rewind\n \n #column_count_offset = 33, record_count_... | [
"0.7177002",
"0.70123804",
"0.65706635",
"0.6172991",
"0.61083895",
"0.6083339",
"0.60741735",
"0.60494256",
"0.59915286",
"0.59731185",
"0.59386057",
"0.58676624",
"0.583522",
"0.5761205",
"0.5745232",
"0.57157063",
"0.5712869",
"0.56481534",
"0.5647333",
"0.56419295",
"0.56... | 0.73300576 | 0 |
Ensure that refs can't be deleted | def check_deleted(newrev)
if newrev == "0000000000000000000000000000000000000000"
puts "[POLICY} You can not delete objects"
exit 1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_deletion_fixes \n # TO DO\n end",
"def ensure_not_referenced_by_any_user\n raise \"Cannot delete user '#{name}'. There are users referencing this user as manager.\" unless users.empty?\n end",
"def deref\n @_references_mutex.synchronize {\n if ((@_references -= 1) == 0)\... | [
"0.6657176",
"0.664143",
"0.6636281",
"0.6568882",
"0.6500159",
"0.6490205",
"0.6276947",
"0.62178034",
"0.6126645",
"0.60913014",
"0.6020338",
"0.6014881",
"0.60116506",
"0.59670717",
"0.594832",
"0.5933965",
"0.5860417",
"0.57997817",
"0.5787514",
"0.5780437",
"0.57633364",... | 0.0 | -1 |
enforced custom commit message format | def check_message_format(regex, oldrev, newrev)
missed_revs = `git rev-list #{oldrev}..#{newrev}`.split("\n")
bad_commits = ""
auth_fail = 0
missed_revs.each do |rev|
message = `git cat-file commit #{rev} | sed '1,/^$/d'`
if !regex.match(message) then
bad_commits += "#{rev}\n"
else
# Increment fail counter on failure
auth_fail += verify_authcode(msg)
end
end
if auth_fail > 0 or bad_commits.split("\n").nitems.to_i > 0 then
puts "[POLICY] Please ensure that your commit messages contain ticket or a current authorization numbers"
puts "The list of commits you sent were: "
puts bad_commits
exit 1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_format_rules(line_number, line)\n conventional_commit_conventions = [ 'feat(.*): ', 'fix(.*): ', 'chore(.*): ', 'install(.*): ', 'improvement(.*): ', 'ci(.*): ', 'ui(.*): ', 'style(.*): ' ] \n conventional_commit_check = conventional_commit_conventions.map{|x| line.match(x)}.compact\n errors = []\n ... | [
"0.6867213",
"0.67891467",
"0.6486706",
"0.6485641",
"0.6407927",
"0.6364972",
"0.6337242",
"0.6312838",
"0.62945247",
"0.62935954",
"0.6290685",
"0.6275102",
"0.62616163",
"0.61702865",
"0.61460716",
"0.6100219",
"0.60596275",
"0.60529584",
"0.6014856",
"0.6007999",
"0.59643... | 0.63859576 | 5 |
UTILITY FUNCTIONS Heavily borrowed from | def puts_red(str)
puts " \e[00;31m#{str}\e[00m"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def terpene; end",
"def stderrs; end",
"def berlioz; end",
"def identify; end",
"def user_os_complex\r\n end",
"def schubert; end",
"def rassoc(p0) end",
"def anchored; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end... | [
"0.60074234",
"0.57682276",
"0.56206393",
"0.5608972",
"0.55583733",
"0.5440724",
"0.54285514",
"0.54233104",
"0.5403705",
"0.5403448",
"0.5337924",
"0.5337924",
"0.5337924",
"0.5337924",
"0.5324698",
"0.5244067",
"0.5216036",
"0.51666224",
"0.51666224",
"0.51649314",
"0.5157... | 0.0 | -1 |
Detect if this is a mac | def mac?
RUBY_PLATFORM =~ /darwin/i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mac?\n @mac ||= is? /mac|darwin/\n end",
"def mac?\n !!(ua =~ /Mac OS X/ && !ios?)\n end",
"def not_a_mac\n if mac?\n return false\n else\n puts I18n.t(:mac_only)\n return true\n end\n end",
"def mac?\n Config... | [
"0.85978335",
"0.8535805",
"0.8425359",
"0.83924925",
"0.8218638",
"0.81557995",
"0.81468344",
"0.8109626",
"0.8014554",
"0.8002375",
"0.7950483",
"0.79282886",
"0.7722649",
"0.73446965",
"0.7280965",
"0.7272204",
"0.7223733",
"0.72038984",
"0.71829784",
"0.7152258",
"0.71484... | 0.7643965 | 13 |
Detect if this is linux | def linux?
RUBY_PLATFORM =~ /linux/i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def linux?\n !!(ua =~ /Linux/)\n end",
"def linux?\n /linux/.match(RUBY_PLATFORM)\n end",
"def linux?\n linux_internal?\n end",
"def linux?\n RUBY_PLATFORM.match(/linux/)\n end",
"def linux?\n RUBY_PLATFORM =~ /linux/\n end",
"def linux?\n @linux\n end",
... | [
"0.86334854",
"0.85851496",
"0.8558185",
"0.84766424",
"0.8427694",
"0.8426505",
"0.84171027",
"0.8415084",
"0.83394355",
"0.82977027",
"0.8236633",
"0.8225342",
"0.809217",
"0.80748117",
"0.79796696",
"0.78579587",
"0.783056",
"0.77966577",
"0.76531976",
"0.76133955",
"0.758... | 0.80588955 | 14 |
Create a symlink in the user's home directory from the files in ./home src file name of a file in .home/ dest name of the symlink to create in $HOME | def symlink_home(src, dest)
home_dir = ENV['HOME']
if( !File.exists?(File.join(home_dir, dest)) || File.symlink?(File.join(home_dir, dest)) )
# FileUtils.ln_sf was making odd nested links, and this works.
FileUtils.rm(File.join(home_dir, dest)) if File.symlink?(File.join(home_dir, dest))
FileUtils.ln_s(File.join(File.dirname(__FILE__), src), File.join(home_dir, dest))
puts_green " #{dest} -> #{src}"
else
puts_red " Unable to symlink #{dest} because it exists and is not a symlink"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_symlink(dest_path); end",
"def make_symlink( old ) File.symlink( old, expand_tilde ) end",
"def symlink(source, target=\".#{source}\")\n puts \"Symlinking #{dotfiles(source)} -> #{home(target)}\"\n if File.exist?(home(target))\n if user_confirms?(\"Overwrite\", home(target))\n File... | [
"0.7351746",
"0.7106921",
"0.69083774",
"0.67824507",
"0.6738418",
"0.67112315",
"0.6655533",
"0.6651139",
"0.6582127",
"0.65232766",
"0.64796585",
"0.6400774",
"0.63721466",
"0.63628507",
"0.6301997",
"0.6231396",
"0.6231396",
"0.6181049",
"0.60331607",
"0.60331607",
"0.6005... | 0.7957497 | 0 |
def initialize(layout, empty, goal) | def set_goal(x)
@layout[@goal[0]][@goal[1]] = '•'
@layout[x[0]][x[1]] = 'G'
@goal = x
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(layout:)\n @layout = layout\n @sides = Math.sqrt(layout.length).floor\n @pos = layout.index('5') + 1\n end",
"def layout=(_arg0); end",
"def initialize()\n get_dimensions()\n get_start_p()\n get_end_p()\n end",
"def initialize() end",
"def initialize(layout, components)\n... | [
"0.6669134",
"0.6650544",
"0.6416586",
"0.6313865",
"0.622126",
"0.6203751",
"0.6203751",
"0.6203751",
"0.6203751",
"0.6203751",
"0.6155479",
"0.6133175",
"0.6126528",
"0.61032385",
"0.60895616",
"0.6076829",
"0.6059787",
"0.6001044",
"0.59906507",
"0.59906507",
"0.5987982",
... | 0.0 | -1 |
This call won't be visible in `schema()` | def abstract!
GraphQL::SCHEMA.remove_call(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schema\n raise NotImplementedError\n end",
"def schema\n self\n end",
"def skip_schema_queries; end",
"def schema_definition\n of.schema_definition \n end",
"def schema\n self.class.schema\n end",
"def schema=(value); end",
"def functional_update_schema #... | [
"0.7710992",
"0.7041942",
"0.7025683",
"0.69620156",
"0.69408774",
"0.69123286",
"0.69082534",
"0.68427086",
"0.6771424",
"0.6739881",
"0.67018056",
"0.6696476",
"0.6696312",
"0.6696312",
"0.6688387",
"0.6642611",
"0.6570198",
"0.65092456",
"0.6500674",
"0.6486098",
"0.646311... | 0.64618486 | 21 |
Prawn's transparent function is wired backwards. A transparency of 1.0 is actually completely opaque, while 0.0 is fully transparent. Here is a new method, opacity, which behaves correctly. | def opacity(fill_o, stroke_o=nil, &block)
@prawn.transparent(fill_o, stroke_o || fill_o) do
yield
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transparent!\n @transparency = 1.0\n self\n end",
"def translucent_alpha\n return 160\n end",
"def transparent?\n alpha == ALPHA_TRANSPARENT\n end",
"def rgba\n rgb + [opacity]\n end",
"def opacity\n @opacity ||= @normalized.length == 3 ? 1.0 : @normalized.last\n ... | [
"0.7591453",
"0.7154349",
"0.7128903",
"0.7127573",
"0.6816985",
"0.6744407",
"0.668012",
"0.6657842",
"0.6600432",
"0.65268475",
"0.6472317",
"0.63767964",
"0.6374885",
"0.6374885",
"0.6290318",
"0.6203895",
"0.61447126",
"0.60796994",
"0.6077734",
"0.60453206",
"0.6018642",... | 0.6131058 | 17 |
Prawn's transparent function is wired backwards. A transparency of 1.0 is actually completely opaque, while 0.0 is fully transparent. Here we invert the options to transparent so that transparent 1.0 is actually fully transparent. | def transparent(fill_t, stroke_t=nil, &block)
@prawn.transparent(1.0-fill_t, 1.0-(stroke_t || fill_t)) do
yield
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transparent!\n @transparency = 1.0\n self\n end",
"def translucent_alpha\n return 160\n end",
"def transparent?\n alpha == ALPHA_TRANSPARENT\n end",
"def invert\n Color.new(255 - @red, 255 - @green, 255 - @blue, @alpha)\n end",
"def invert\n r = 1.0 - self.red\n g = 1.0... | [
"0.74207765",
"0.6997088",
"0.6789387",
"0.67167205",
"0.6661498",
"0.6592917",
"0.6565955",
"0.65284747",
"0.6423661",
"0.6328033",
"0.6328033",
"0.6292357",
"0.62793136",
"0.61363834",
"0.607293",
"0.60413915",
"0.59928936",
"0.5937802",
"0.5937802",
"0.5815012",
"0.5774961... | 0.58757037 | 19 |
get list of all of the paintings by specific artist | def list_paintings
Painting.all.select do |painting|
painting.artist == self
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paintings\n Painting.all.select {|p| p.artist == self}\n end",
"def artists\n paintings.collect do |p|\n p.artist \n end\n end",
"def paintings\n Painting.all.select {|painting| painting.artist == self}\n end",
"def paintings\n Painting.all.select {|painting| painting.artist =... | [
"0.83807814",
"0.8183065",
"0.81789553",
"0.81789553",
"0.81789553",
"0.81573445",
"0.8153511",
"0.81418484",
"0.8136609",
"0.8131651",
"0.811929",
"0.811929",
"0.80990595",
"0.8081278",
"0.80803007",
"0.79875827",
"0.7919767",
"0.78768665",
"0.7677567",
"0.7522961",
"0.74020... | 0.8317784 | 1 |
Get a list of all the galleries that a specific artist has paintings in | def list_galleries
list_paintings.map do |gallery_painting|
gallery_painting.gallery
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def galleries\n Painting.all.map do |painting_instance| \n if painting_instance.artist == self\n painting_instance.gallery\n end\n end.compact.uniq\n end",
"def all_artists_by_gallery\n paintings = Painting.all.select { |painting| painting.gallery == self }\n # paintings.map { |pai... | [
"0.8480682",
"0.832521",
"0.82131815",
"0.80622935",
"0.8029989",
"0.7934373",
"0.7934373",
"0.7934373",
"0.79326504",
"0.79094577",
"0.7883147",
"0.7845615",
"0.7817575",
"0.7720498",
"0.76563257",
"0.7621297",
"0.7353742",
"0.73248523",
"0.72613746",
"0.7208073",
"0.7180583... | 0.7944763 | 5 |
Get a list of all cities that contain galleries that a specific artist has paintings in | def list_cities
list_galleries.map do |gallery|
gallery.city
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cities\n Painting.all.map do |painting_instance| \n if painting_instance.artist == self\n painting_instance.gallery.city\n end\n end.compact.uniq\n end",
"def cities()\n self.galleries().map { | gallery | gallery.city }.uniq\n end",
"def galleries\n Painting.all.map do |paint... | [
"0.7548772",
"0.7131511",
"0.71006894",
"0.70397425",
"0.70397425",
"0.7035672",
"0.70278883",
"0.7004595",
"0.6989426",
"0.68765855",
"0.68765855",
"0.6871487",
"0.6863928",
"0.6824331",
"0.6794716",
"0.67617637",
"0.6715184",
"0.6708487",
"0.669699",
"0.6591813",
"0.6567921... | 0.66972464 | 18 |
To display output immediately on windows using git bash | def find_fibonacci_index_by_length(digits)
fibonacci_series = [1, 1]
while fibonacci_series.last < 10 ** (digits - 1)
fibonacci_series << fibonacci_series[-1] + fibonacci_series[-2]
end
fibonacci_series.size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prompt_git_branch\n if !is_git?\n return \"\"\n end\n stat = `git status`\n \"[#{stat.split(\"\\n\")[0].split(\" \")[-1]}]\".yellow\nend",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def prep_screen\n system(\"clear\... | [
"0.6219506",
"0.61200327",
"0.61200327",
"0.61200327",
"0.61200327",
"0.61200327",
"0.61200327",
"0.6103044",
"0.60350794",
"0.59949106",
"0.5973232",
"0.59097284",
"0.58951396",
"0.5886012",
"0.586864",
"0.58550465",
"0.582788",
"0.5807792",
"0.5802978",
"0.5773198",
"0.5745... | 0.0 | -1 |
A random animal has escaped! | def escape
choices = @animals.keys
@animals[choices[rand(choices.length)]]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_animal\n\t animals.sample\n end",
"def make_noise\n puts \"Making a generic animal noise... Meep.\"\n end",
"def hit( damage )\n p_up = rand( charisma )\n if p_up % 9 == 7\n @life += p_up / 4\n puts \"[#{ self.class } magick powers up #{ p_up }!]\"\n end\n @life -= damage... | [
"0.6798156",
"0.6408442",
"0.6360252",
"0.63510513",
"0.6194009",
"0.61634916",
"0.61489147",
"0.61195916",
"0.6066545",
"0.5979255",
"0.5964513",
"0.5946106",
"0.59340477",
"0.5855034",
"0.58448046",
"0.58423245",
"0.58343303",
"0.582192",
"0.5800945",
"0.57682335",
"0.57682... | 0.7901396 | 0 |
Since I wrote this on Windows I don't have fortune...but the internet does! | def get_fortune
open('http://www.coe.neu.edu/cgi-bin/fortune') do |page|
page.read.scan(/<pre>(.*)<\/pre>/m)[0][0].gsub("\t",' ')
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vanilla_windows?; end",
"def really_windows?; end",
"def private; end",
"def user_os_complex\r\n end",
"def ext; end",
"def ext; end",
"def executable_real?() end",
"def isWindows()\r\n # See: http://stackoverflow.com/questions/4871309\r\n require 'rbconfig'\r\n return (RbConfig::CONFIG... | [
"0.6202848",
"0.60501164",
"0.5667129",
"0.54712135",
"0.5391244",
"0.5391244",
"0.5362545",
"0.5347999",
"0.5334077",
"0.5266414",
"0.51972693",
"0.5186158",
"0.51754975",
"0.5160945",
"0.5160945",
"0.51428443",
"0.5122108",
"0.5111898",
"0.50940716",
"0.5092257",
"0.5077617... | 0.0 | -1 |
Initialize a Route from a XML::Node. | def initialize(opts = {})
if(opts[:gpx_file] and opts[:element])
rte_element = opts[:element]
@gpx_file = opts[:gpx_file]
@name = (rte_element.at("name").inner_text rescue nil)
@points = []
rte_element.search("rtept").each do |point|
@points << Point.new(:element => point, :gpx_file => @gpx_file)
end
else
@points = (opts[:points] or [])
@name = (opts[:name])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(xml_node)\n @xml = xml_node\n end",
"def initialize(xml_node)\n @xml = xml_node\n end",
"def initialize(xml_node)\n @xml = xml_node\n end",
"def initialize(xml_node, instance: nil)\n @xml_node = xml_node\n @instance = instance\n end",
"def initialize( nod... | [
"0.65647846",
"0.65647846",
"0.65647846",
"0.6071775",
"0.573555",
"0.5704915",
"0.5704915",
"0.5697585",
"0.56942225",
"0.5670697",
"0.56428957",
"0.56428957",
"0.56428957",
"0.56428957",
"0.5611898",
"0.5611898",
"0.55562955",
"0.55041456",
"0.5499941",
"0.54832435",
"0.547... | 0.0 | -1 |
Delete points outside of a given area. | def crop(area)
points.delete_if{ |pt| not area.contains? pt }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_area(area)\n points.delete_if{ |pt| area.contains? pt }\n end",
"def delete_area(area)\n reset_meta_data\n segments.each do |seg|\n seg.delete_area(area)\n update_meta_data(seg) unless seg.empty?\n end\n segments.delete_if { |seg| seg.empty? }\n end",
"de... | [
"0.8508142",
"0.6264223",
"0.6124254",
"0.6010757",
"0.5884434",
"0.5817747",
"0.5687705",
"0.5654825",
"0.55968916",
"0.55712456",
"0.5515255",
"0.5513358",
"0.54945576",
"0.5492532",
"0.54894036",
"0.5452016",
"0.5449933",
"0.54427755",
"0.5435893",
"0.54346335",
"0.5418061... | 0.80233586 | 1 |
Delete points within the given area. | def delete_area(area)
points.delete_if{ |pt| area.contains? pt }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crop(area)\n points.delete_if{ |pt| not area.contains? pt }\n end",
"def delete_area(area)\n reset_meta_data\n segments.each do |seg|\n seg.delete_area(area)\n update_meta_data(seg) unless seg.empty?\n end\n segments.delete_if { |seg| seg.empty? }\n end",
"def r... | [
"0.7838925",
"0.71845305",
"0.5964875",
"0.58766615",
"0.5810191",
"0.5728985",
"0.56989366",
"0.56181186",
"0.55151284",
"0.54429793",
"0.5421543",
"0.5416216",
"0.5416216",
"0.5377805",
"0.5377805",
"0.5373822",
"0.53577256",
"0.53577256",
"0.53577256",
"0.5337163",
"0.5323... | 0.8895161 | 0 |
outputs slides in the slides folders | def slides(folder = "slides")
results = []
Dir["./source/#{folder}/_*.{html,md}.*"].each do |slide_path|
slide_path = slide_path.gsub("./source/", "").gsub("/_", "/").gsub(/$_/, "")
results << slide_path
end
results
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def slides\n @file_manager.slide_files\n end",
"def latex(title, basedir = \"\")\n\t\t# Open the file to write\n\t\tbaseName = File.basename(@file.path, \".svg\")\n\t\tfile = File.new(baseName + \"#{@latex_file_count}\" + \".tex\", \"w\")\n\t\t\n\t\t# Print the \n\t\t(@latex_count..@count - 1).each ... | [
"0.6497139",
"0.61745334",
"0.61078626",
"0.5863233",
"0.5781155",
"0.5706453",
"0.5698531",
"0.56745404",
"0.5674443",
"0.56563073",
"0.5644831",
"0.5642305",
"0.5601661",
"0.5594342",
"0.5588806",
"0.5573301",
"0.55543184",
"0.5554176",
"0.5547611",
"0.5519717",
"0.5515841"... | 0.6691781 | 0 |
Supplies a slightly smaller designsystem approved column structure when set to false (as used in Evo), by default. DMS, however requires a simple 'col' (full width) layout and will have :full_width set to true manually while both apps coexist with slightly different page layouts. | def full_width
options.fetch(:full_width, false)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column_layout layout = nil\n @column_layout = layout if configurable? && layout\n @column_layout\n end",
"def enable_extended_mkcol?\n true\n end",
"def full_width_column(options={}, &block)\n row(options) do\n column(12, &block)\n end\n end",
"def is_flex... | [
"0.6297525",
"0.6269125",
"0.5987522",
"0.58625585",
"0.57018286",
"0.56802577",
"0.56232363",
"0.5596027",
"0.55496496",
"0.5507414",
"0.5501593",
"0.546916",
"0.5468187",
"0.54566157",
"0.54216945",
"0.54158646",
"0.53891265",
"0.5380275",
"0.53673005",
"0.5358285",
"0.5345... | 0.5603516 | 7 |
Aggregate RUM events. The API endpoint to aggregate RUM events into buckets of computed metrics and timeseries. | def aggregate_rum_events_with_http_info(body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: RUMAPI.aggregate_rum_events ...'
end
# verify the required parameter 'body' is set
if @api_client.config.client_side_validation && body.nil?
fail ArgumentError, "Missing the required parameter 'body' when calling RUMAPI.aggregate_rum_events"
end
# resource path
local_var_path = '/api/v2/rum/analytics/aggregate'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
# return_type
return_type = opts[:debug_return_type] || 'RUMAnalyticsAggregateResponse'
# auth_names
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]
new_options = opts.merge(
:operation => :aggregate_rum_events,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type,
:api_version => "V2"
)
data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: RUMAPI#aggregate_rum_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aggregateData(aggregator)\n @timeStamps = aggregator.aggregate(@timeStamps, ChartDirector::AggregateFirst)\n @highData = aggregator.aggregate(@highData, ChartDirector::AggregateMax)\n @lowData = aggregator.aggregate(@lowData, ChartDirector::AggregateMin)\n @openData = aggregator.agg... | [
"0.58588624",
"0.5748628",
"0.5659503",
"0.5616125",
"0.5546494",
"0.5440958",
"0.5415336",
"0.53665394",
"0.5350344",
"0.5343511",
"0.5333449",
"0.53042156",
"0.5278566",
"0.5257578",
"0.5244984",
"0.51538444",
"0.51509553",
"0.5149936",
"0.51383156",
"0.5130531",
"0.5121397... | 0.6942496 | 0 |
Create a new RUM application. | def create_rum_application(body, opts = {})
data, _status_code, _headers = create_rum_application_with_http_info(body, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_app()\n app = OpenShift::TestApplication.new(self)\n\n $logger.info(\"Created new application #{app.name} for account #{@name}\")\n\n @apps << app\n app\n end",
"def create(optional_params = {})\n response = Network.post(['Applications'], optional_params)\n Applica... | [
"0.7186294",
"0.70547825",
"0.70338064",
"0.701831",
"0.6746834",
"0.66851354",
"0.66716146",
"0.66530585",
"0.66254103",
"0.65305746",
"0.6517017",
"0.6496818",
"0.6442749",
"0.6436371",
"0.6429101",
"0.6402991",
"0.640036",
"0.6330293",
"0.63262284",
"0.63206416",
"0.630103... | 0.7512464 | 0 |
Create a new RUM application. Create a new RUM application in your organization. | def create_rum_application_with_http_info(body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: RUMAPI.create_rum_application ...'
end
# verify the required parameter 'body' is set
if @api_client.config.client_side_validation && body.nil?
fail ArgumentError, "Missing the required parameter 'body' when calling RUMAPI.create_rum_application"
end
# resource path
local_var_path = '/api/v2/rum/applications'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
# return_type
return_type = opts[:debug_return_type] || 'RUMApplicationResponse'
# auth_names
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]
new_options = opts.merge(
:operation => :create_rum_application,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type,
:api_version => "V2"
)
data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: RUMAPI#create_rum_application\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_rum_application(body, opts = {})\n data, _status_code, _headers = create_rum_application_with_http_info(body, opts)\n data\n end",
"def create_app()\n app = OpenShift::TestApplication.new(self)\n\n $logger.info(\"Created new application #{app.name} for account #{@name}\")\n\n ... | [
"0.7178384",
"0.70147586",
"0.6815873",
"0.67622834",
"0.67521447",
"0.6642485",
"0.66129655",
"0.6612849",
"0.6588232",
"0.6549338",
"0.65411854",
"0.6528765",
"0.6524624",
"0.65147203",
"0.6514295",
"0.64808077",
"0.64531267",
"0.6380511",
"0.6323178",
"0.6299824",
"0.62997... | 0.6462561 | 16 |
Delete a RUM application. | def delete_rum_application(id, opts = {})
delete_rum_application_with_http_info(id, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_application\n node.rm(new_resource.node_attribute, new_resource.resource_name, new_resource.name)\n end",
"def delete\n @bot.delete_application_command(@id, server_id: @server_id)\n end",
"def delete!\n execute_as_user(\"rm -rf #{app_dir}\")\n end",
"def delete_applicat... | [
"0.78835434",
"0.7242512",
"0.71606386",
"0.715505",
"0.7117837",
"0.7070221",
"0.7070221",
"0.7031122",
"0.69717515",
"0.6920511",
"0.6856351",
"0.6852581",
"0.6850262",
"0.6838399",
"0.6823661",
"0.6823661",
"0.67469877",
"0.6683238",
"0.6588499",
"0.658119",
"0.6567872",
... | 0.7144373 | 4 |
Delete a RUM application. Delete an existing RUM application in your organization. | def delete_rum_application_with_http_info(id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: RUMAPI.delete_rum_application ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling RUMAPI.delete_rum_application"
end
# resource path
local_var_path = '/api/v2/rum/applications/{id}'.sub('{id}', CGI.escape(id.to_s).gsub('%2F', '/'))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]
new_options = opts.merge(
:operation => :delete_rum_application,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type,
:api_version => "V2"
)
data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: RUMAPI#delete_rum_application\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_application\n node.rm(new_resource.node_attribute, new_resource.resource_name, new_resource.name)\n end",
"def delete_application(client, options)\n if !options[:application].nil?\n application = client.applications.get options[:application]\n application.delete\n puts \"Applicat... | [
"0.7603353",
"0.7136893",
"0.6951597",
"0.6941908",
"0.6941908",
"0.6932715",
"0.6810071",
"0.67844975",
"0.672111",
"0.66989803",
"0.6688652",
"0.6688652",
"0.66876274",
"0.6666599",
"0.6654056",
"0.659689",
"0.6592407",
"0.6591459",
"0.6558766",
"0.65534645",
"0.65356797",
... | 0.61046046 | 80 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.