query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
price_y Y Coordinate of Price Display Line | def price_y
contents_height / 2 + line_height / 2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def y_offset; end",
"def gety\n (@lines[0...@str_idx].map(&:ymax).reduce(:+) || 0) + @str_y_idx - @start_y\n end",
"def gety\n (@lines[0...@str_idx].map(&:ymax).reduce(:+) || 0) + @str_y_idx - @start_y\n end",
"def get_y; \t\t@y \t\t\tend",
"def y\n @point[1]\n end",
"def get_... | [
"0.6412319",
"0.6365856",
"0.6365856",
"0.63216573",
"0.62925386",
"0.62829196",
"0.62035644",
"0.6203095",
"0.6194782",
"0.6138086",
"0.6113356",
"0.6100022",
"0.6065838",
"0.6064009",
"0.6064009",
"0.59176093",
"0.5915832",
"0.5915832",
"0.5915832",
"0.58863354",
"0.5877419... | 0.8033282 | 0 |
cursor_x Get X Coordinate of Cursor | def cursor_x
contents_width - cursor_width - 4
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cursor_x\n # x is \"0\" if cursor position at 0\n return -self.src_rect.x + 4 if !self.cursor_can_move_left?\n # find cursor position from text left from it\n display_text = get_display_text.scan(/./m)[0, @cursor_position].join\n cx = self.bitmap.text_size(display_text).width - self.src_rect.x\n... | [
"0.8237762",
"0.797302",
"0.7375041",
"0.71073616",
"0.71073616",
"0.704063",
"0.69977593",
"0.69816387",
"0.689482",
"0.6861083",
"0.6861083",
"0.6822474",
"0.6777218",
"0.6721411",
"0.6708059",
"0.6693021",
"0.66801214",
"0.66801214",
"0.6676603",
"0.6675173",
"0.6632291",
... | 0.8294393 | 0 |
Returns a valid language ID. Fall back to a default | def valid_language
locale = extract_locale_from_accept_language_header
logger.debug "* Extracted Locale ID: #{locale}"
if !locale.blank? &&
(locale == 'de' ||
locale == 'en')
locale
else
DEFAULT_LANGUAGE
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def language_id(language_name)\r\n return Language.find_by_english_name(language_name).id\r\n end",
"def select_language\n I18n.backend.send(:init_translations) unless I18n.backend.initialized?\n lang = PatientHelper.languages(primary_language)&.dig(:code)&.to_sym || :en\n lang = :en unless %i[en es... | [
"0.73757756",
"0.7124308",
"0.6820185",
"0.6820185",
"0.6820185",
"0.68095946",
"0.6779774",
"0.66502935",
"0.6619645",
"0.65484667",
"0.6487784",
"0.6398659",
"0.6382585",
"0.633495",
"0.63176286",
"0.63091326",
"0.6303108",
"0.6297619",
"0.6290945",
"0.62853515",
"0.6283793... | 0.7361971 | 1 |
These helper methods move the implementation of working out a date that is within the grace window, and one that is outside it here away from the tests that use them. What the tests are concerned with is what happens in these contexts so to simplify them we added these 2 helpers. | def date_inside_grace_window(expires_on)
(expires_on + Rails.configuration.registration_grace_window) - 1.day
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_closed_at?(evaluation_date = Date.today)\n get_end_date < evaluation_date\n end",
"def last_day_of_standard_grace_window\n (expiry_date + Rails.configuration.grace_window.days) - 1.day\n end",
"def expected_hand_in\n if self[:end_date].nil?\n Time.now.strftime('%Y-%m-%d')\n else\n... | [
"0.5871686",
"0.56952995",
"0.5662563",
"0.5660281",
"0.564145",
"0.56331193",
"0.56199604",
"0.5614249",
"0.5591849",
"0.55883396",
"0.5577942",
"0.55480623",
"0.55076617",
"0.55049485",
"0.55016774",
"0.5463668",
"0.54614824",
"0.5461197",
"0.5453296",
"0.5441938",
"0.54393... | 0.5983071 | 0 |
Find a subscription for the subscriber, optionally limited to the subscription level specified | def subscription_to(subscriber, subscription_level = nil)
matches = self.subscriptions_to.where(:"#{Sable.subscriber_relation_name.to_sym}_id" => subscriber.id)
matches = matches.where('level >= ?', subscription_level) unless subscription_level == nil
(matches.length > 0) ? matches.first : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscribe(subscriber, subscription_level = Subscription::Levels[:reader])\n\n if sub = subscription_to(subscriber)\n # no need for equine abuse post-mortem\n return if sub.level == subscription_level\n else\n # Build a subscription\n sub = self.subscriptions_to.build(Sable.subscriber_... | [
"0.712342",
"0.69359595",
"0.6777963",
"0.6734688",
"0.6603229",
"0.6567229",
"0.6522336",
"0.6420164",
"0.63708717",
"0.63693",
"0.6291355",
"0.6232107",
"0.6232107",
"0.62101996",
"0.62019193",
"0.61710405",
"0.607302",
"0.60382485",
"0.6033514",
"0.6004682",
"0.5962675",
... | 0.83735234 | 0 |
Perform an action on each subscriber subscribed to this resource +opts+ include: +:except+: omit a subscriber or array of subscribers | def each_subscriber(opts = {})
o = { :except => [] }.merge(opts)
o[:except] = [o[:except]] unless o[:except].kind_of?(Array)
subscribers.each do |subscriber|
yield subscriber unless o[:except].include?(subscriber)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify(*args)\n subscribers.values.each { |subscriber| subscriber.call(*args) }\n end",
"def notfiy_subscribers(params)\n subject = params[:subscribable]\n\n subject.subscribers.each do |subscriber|\n subscriber.notify(subject, params[:message])\n end\n\n continue(params)\n end",
... | [
"0.63276523",
"0.6102363",
"0.6055076",
"0.5984209",
"0.5984209",
"0.5984209",
"0.5943417",
"0.59265196",
"0.5918204",
"0.5859918",
"0.5817888",
"0.5758276",
"0.57460314",
"0.5696609",
"0.5672149",
"0.56606144",
"0.56440437",
"0.5620121",
"0.56159264",
"0.5601126",
"0.5583988... | 0.74375904 | 0 |
GET /problems GET /problems.json | def index
@problems = Problem.active.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @problems }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @problems = Problem.all\n\n render json: @problems\n end",
"def index\n @problems = Problem.paginate(page: params[:page], per_page: 10 ).order('created_at DESC')\n\n respond_with @problems\n end",
"def index\n @problems = Problem.all\n end",
"def index\n @problems = Problem.a... | [
"0.7947143",
"0.7285792",
"0.72317547",
"0.72317547",
"0.72317547",
"0.72139794",
"0.7034149",
"0.691131",
"0.67338294",
"0.67338294",
"0.67112756",
"0.66949713",
"0.6689205",
"0.65976644",
"0.6592729",
"0.65570456",
"0.64945644",
"0.6485792",
"0.64789176",
"0.6462276",
"0.64... | 0.7570094 | 1 |
GET /problems/new GET /problems/new.json | def new
@problem = Problem.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @problem }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @problem = Problem.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @problem }\n end\n end",
"def new\n @problem = Problem.new\n add_breadcrumb \"New Problem\"\n respond_with @problem\n end",
"def new\n @problem = Problem.new\n... | [
"0.7879823",
"0.74478865",
"0.73987305",
"0.7244166",
"0.7222335",
"0.7053533",
"0.7007913",
"0.70078534",
"0.698901",
"0.6941917",
"0.6937513",
"0.6918487",
"0.68769515",
"0.6857957",
"0.6855689",
"0.6852097",
"0.68172836",
"0.6816029",
"0.67819524",
"0.6780495",
"0.67234516... | 0.79232424 | 1 |
List of all Podings Match name and aliases to find the entry | def findName(podling, list)
if list.include?(podling.name)
return podling.name
end
podling.resourceAliases.each do |a|
if list.include? a
return a
end
end
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list()\n data = info()\n ret = []\n data[:aliases].each do |rid, aliases|\n aliases.each do |al|\n ret << {\n :alias => al,\n :rid => rid\n }\n end\n end\n\n ret\n end",
"def names\n @searches.names\n end",
"d... | [
"0.563049",
"0.56281805",
"0.55885637",
"0.5538019",
"0.54068816",
"0.53579974",
"0.53525865",
"0.5290147",
"0.5243596",
"0.5218356",
"0.5218356",
"0.5218356",
"0.5185069",
"0.51561475",
"0.5144925",
"0.5144712",
"0.513504",
"0.5129051",
"0.51286805",
"0.5123072",
"0.51161873... | 0.60901785 | 0 |
=begin rdoc Add or update a document in the searcher. options: :url: required, the URL for the document :title: required, the title of the document :body: required, the body of the document :tags: optional, the list of tags for the document. :remote_id: optional, but recommended, the id of the document in your system. ... | def add_document(opts={})
raise ArgumentError, ":title is required" if opts[:title].nil?
raise ArgumentError, ":body is required" if opts[:body].nil?
raise ArgumentError, ":url is required" if opts[:url].nil?
if opts[:tags].is_a?(Array)
opts[:tags] = opts[:tags].join(",")
en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def srch_add(opts={})\n\t\t\t\tsrch_client.add_document(opts)\n\t\t\tend",
"def solr_add(add_document)\n Solarize::Post.execute(Solr::Request::AddDocument.new(add_document))\n end",
"def index_document( url_string = 'http://localhost:8983/solr/update' )\n index_doc = create_base_add_doc\n ... | [
"0.73725635",
"0.6603121",
"0.6556618",
"0.65044063",
"0.64525497",
"0.6346885",
"0.6320749",
"0.6270886",
"0.62013346",
"0.6192185",
"0.6188499",
"0.6181822",
"0.6172249",
"0.6113471",
"0.60779727",
"0.6070456",
"0.60695523",
"0.60488385",
"0.60042757",
"0.59996706",
"0.5986... | 0.79897434 | 0 |
=begin rdoc Delete a document from the searcher. options: One of the following is required. :remote_id: The remote_id you set when adding the document. :index_id: The id returned by the system when you added the document =end | def destroy_document(opts={})
raise ArgumentError if opts[:remote_id].nil? && opts[:index_id].nil?
Srchio::Response.new(self.class.delete("/searchers/#{searcher_id}/documents", :query => opts))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def srch_destroy(opts={})\n\t\t\t\tsrch_client.destroy_document(opts)\n\t\t\tend",
"def delete_document index, id\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Delete.new(uri)\n run(uri, req)\n end",
"def cloud_search_delete_document(doc)\n doc.version += 1... | [
"0.7441303",
"0.73230594",
"0.72311515",
"0.7230691",
"0.68644637",
"0.68344504",
"0.681517",
"0.67653424",
"0.66985667",
"0.6650144",
"0.6630092",
"0.6585546",
"0.6581247",
"0.6521977",
"0.6495862",
"0.64450985",
"0.64383465",
"0.6417756",
"0.6409847",
"0.6360305",
"0.634577... | 0.8461177 | 0 |
=begin rdoc Searches your searcher! options: :query: A text string to search for. Searches title, body and tags for this string. :body: A query, searches just the body. :title: A query, searches just the title. :tags: An array of tags to search for. :remote_id: A remote_id to search for. :id: The id of the document you... | def search(opts={})
if opts[:query].nil? && opts[:body].nil? && opts[:title].nil? && opts[:tags].nil? && opts[:remote_id].nil? && opts[:id].nil?
raise ArgumentError, "Opts must contain at least one of: :query, :body, :title, :tags, :remote_id, :id"
end
if opts[:tags].is_a?(Array)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(query, options = {}); end",
"def search(q, options = {})\n h = {}\n h[:max_results] = 10\n h[:user_id] = 'all'\n h[:kind] = 'photo'\n # merge options over h, but merge q over options\n get(h.merge(options).merge(:q => q))\n end",
"def search(q, options={})\n build_object Do... | [
"0.71606255",
"0.6871171",
"0.6784457",
"0.66782296",
"0.6600834",
"0.65761334",
"0.653282",
"0.650937",
"0.6439422",
"0.6405969",
"0.6368396",
"0.63431776",
"0.6334651",
"0.63263476",
"0.6313103",
"0.6300115",
"0.62661695",
"0.62129253",
"0.62096584",
"0.6203448",
"0.6190812... | 0.7777162 | 0 |
POST /pages POST /pages.json | def create
respond_to do |format|
begin
@page = Page.create_page!
format.html { redirect_to "/#{@page.request_id}/inspect", notice: t('pages.create.success') }
format.json { render action: 'show', status: :created, location: @page }
rescue => e
format.html { render action... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @page = Page.new(page_params)\n\n if @page.save\n render json: @page, status: :created, location: @page\n else\n render json: @page.errors, status: :unprocessable_entity\n end\n end",
"def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @pag... | [
"0.7211315",
"0.6834769",
"0.68295294",
"0.68169403",
"0.6816336",
"0.6809005",
"0.6803334",
"0.6786953",
"0.6776035",
"0.67602175",
"0.6754758",
"0.6717724",
"0.6717724",
"0.6717724",
"0.6717724",
"0.6717724",
"0.6717724",
"0.66893786",
"0.6675025",
"0.66329163",
"0.6628282"... | 0.6897405 | 1 |
helper used throughout to verify if we're calling any of the store related actions | def store_action?(action)
%w(AddCard AddCardWithUniqueReference RemoveCard).include? action
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action_argument_required?\n !AVAILABLE_ACTIONS.empty?\n end",
"def should_check_user_store(user)\n if !user.store? and user.should_be_store?\n user.update(store: true)\n else\n # noop\n end\n rescue Exception => e\n end",
"def store_action\r\n return unless request.get?\r\n ... | [
"0.6192639",
"0.61282516",
"0.61198485",
"0.61056733",
"0.6101907",
"0.6100136",
"0.60759056",
"0.60753316",
"0.60233086",
"0.58949333",
"0.5808645",
"0.57919323",
"0.5780334",
"0.57710266",
"0.5758759",
"0.5755178",
"0.5744227",
"0.57158756",
"0.571328",
"0.56858695",
"0.568... | 0.6605098 | 0 |
For report mode instances, this is the default landing | def landing
redirect_to(root_url) && return unless ADMIN_OPTIONS['report_mode']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def landing() end",
"def landing\n end",
"def landing\n end",
"def landing\n \n end",
"def landing\n \n end",
"def auto\n redirect_to report_url(Report.key_for_area(Current.setting.area))\n end",
"def app_landing\n end",
"def set_layout\n\t \treturn \"landing\" if action_name == \"unr... | [
"0.6887342",
"0.6856611",
"0.6856611",
"0.66424805",
"0.66424805",
"0.65313065",
"0.6404312",
"0.6300908",
"0.5978132",
"0.59585637",
"0.58839285",
"0.5875722",
"0.5822101",
"0.5796066",
"0.578517",
"0.5710687",
"0.56941056",
"0.5682299",
"0.56559795",
"0.5647432",
"0.5646847... | 0.7813707 | 0 |
The monitoree already reported. Give them an update | def already_reported; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify_new_finding\n # TODO: make the method avoid the creation of a Notification record\n end",
"def notify_new_findings\n # TODO: make the method avoid the creation of a Notification record\n end",
"def low_frequency\n log \"Updating event status\"\n M2mhub::Event.open_or_recently_closed.ea... | [
"0.6451466",
"0.6234575",
"0.5899331",
"0.5770068",
"0.5679285",
"0.56232727",
"0.55749124",
"0.5565053",
"0.55188674",
"0.5487854",
"0.54832083",
"0.5463276",
"0.54552907",
"0.5434617",
"0.54053783",
"0.54053783",
"0.5394717",
"0.5391024",
"0.5379652",
"0.5379652",
"0.536787... | 0.6861688 | 0 |
Some oneboxes create iframes or other complicated controls. If you're using a live editor with HTML preview, rendering those complicated controls can be slow or cause flickering. This method allows engines to produce a placeholder such as static image frame of a video. By default it just calls `to_html` unless implemen... | def placeholder_html
to_html
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inner_html(options = T.unsafe(nil)); end",
"def to_html\n w = 400\n h = 300\n id = @url.match(REGEX)[1]\n embed_image = \"#{BASE_URL}/embed.html?mid=#{id}&width=#{w}&height=#{h}&etp=im\"\n embed_3d = \"#{BASE_URL}/embed.html?mid=#{id}&width=#{w}&height=#{h}\"\n <<HTM... | [
"0.64999765",
"0.64404213",
"0.6260329",
"0.62172484",
"0.62172484",
"0.62155676",
"0.61076814",
"0.6068494",
"0.60591793",
"0.60467196",
"0.6026627",
"0.5966067",
"0.59414756",
"0.5915693",
"0.5898607",
"0.5884192",
"0.5862636",
"0.5862636",
"0.5862636",
"0.5850024",
"0.5832... | 0.68608326 | 0 |
calculates a name for onebox using the class name of engine | def onebox_name
name.split("::").last.downcase.gsub(/onebox/, "")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_box_name(id)\n return @names[id]\n end",
"def engine_class_name(e)\n e.class.name.deconstantize # remove the ::Engine part\n end",
"def name_and_class\n @engine_name_and_class ||= Hash[*engines.collect { |e| [engine_name(e), engine_class_name(e)] }.flatten]\n ... | [
"0.6060897",
"0.5943132",
"0.58182013",
"0.5800719",
"0.5707666",
"0.5700313",
"0.56333953",
"0.56167465",
"0.5592456",
"0.55791914",
"0.55780673",
"0.55758125",
"0.55690044",
"0.556494",
"0.55319214",
"0.55142075",
"0.54625046",
"0.545979",
"0.5456302",
"0.5450264",
"0.54485... | 0.64933026 | 0 |
all the edges including external ones | def all_edges
@e.uniq
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edges\n in_edges + out_edges\n end",
"def edges\n @vertices.reduce(Set.new) { |edges, vertex| edges + vertex.edges }\n end",
"def edges\n Enumerator.new do |ss|\n blocks.each { |b|\n b.outgoing_edges.each { |e|\n ss << e\n }\n }\n e... | [
"0.7540253",
"0.7538433",
"0.73104393",
"0.72963375",
"0.72833776",
"0.7248349",
"0.724442",
"0.72159123",
"0.7187144",
"0.71373963",
"0.71373963",
"0.71035296",
"0.70729035",
"0.70363146",
"0.70284224",
"0.70197725",
"0.7015156",
"0.7007029",
"0.7002066",
"0.6928834",
"0.683... | 0.8037892 | 0 |
Pause processing of a specific topic partition. When a specific message causes the processor code to fail, it can be a good idea to simply pause the partition until the error can be resolved, allowing the rest of the partitions to continue being processed. If the `timeout` argument is passed, the partition will automat... | def pause(topic, partition, timeout: nil, max_timeout: nil, exponential_backoff: false)
if max_timeout && !exponential_backoff
raise ArgumentError, "`max_timeout` only makes sense when `exponential_backoff` is enabled"
end
pause_for(topic, partition).pause!(
timeout: timeout,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pause(topic, partition)\n args, kwargs = ApiAdapter.pause(topic, partition, consumer_group).values_at(:args, :kwargs)\n kafka_consumer.pause(*args, **kwargs)\n end",
"def pause(topic, partition)\n settings = ConfigAdapter.pausing(consumer_group)\n return false unless settings... | [
"0.68801916",
"0.6752325",
"0.6313603",
"0.609903",
"0.59617573",
"0.5847364",
"0.5776771",
"0.5524594",
"0.54301924",
"0.5182526",
"0.5156182",
"0.50386024",
"0.50080544",
"0.49685186",
"0.4871562",
"0.48351386",
"0.47858787",
"0.47623548",
"0.4761692",
"0.4738609",
"0.46897... | 0.8179935 | 0 |
Resume processing of a topic partition. | def resume(topic, partition)
pause_for(topic, partition).resume!
# During re-balancing we might have lost the paused partition. Check if partition is still in group before seek.
seek_to_next(topic, partition) if @group.assigned_to?(topic, partition)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resume(topic, partition)\n @mutex.lock\n\n return if @closed\n\n # Always commit synchronously offsets if any when we resume\n # This prevents resuming without offset in case it would not be committed prior\n # We can skip performance penalty since resuming should not happen ... | [
"0.8364555",
"0.7272159",
"0.67521995",
"0.6609337",
"0.6518007",
"0.64691997",
"0.64182323",
"0.6385326",
"0.63448924",
"0.63448924",
"0.63295686",
"0.6252355",
"0.6245832",
"0.62363636",
"0.6214809",
"0.62143725",
"0.6192747",
"0.6155107",
"0.6140732",
"0.6100271",
"0.61002... | 0.8494484 | 0 |
Whether the topic partition is currently paused. | def paused?(topic, partition)
pause = pause_for(topic, partition)
pause.paused? && !pause.expired?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paused?\n paused\n end",
"def paused?\n @paused > 0\n end",
"def paused?\n @paused == true\n end",
"def paused?\n @paused == true\n end",
"def paused?\n @paused == true\n end",
"def paused?\n @paused || paused.present?\n end",
"def paused?\n ... | [
"0.84401935",
"0.83799577",
"0.8293122",
"0.8293122",
"0.8293122",
"0.82511127",
"0.82511127",
"0.81947213",
"0.8194232",
"0.8118408",
"0.80674547",
"0.7831985",
"0.7796606",
"0.775211",
"0.7525968",
"0.7501971",
"0.7358915",
"0.7094985",
"0.7072319",
"0.70025784",
"0.6948395... | 0.89411503 | 0 |
DELETE /interventions/1 DELETE /interventions/1.json | def destroy
@intervention.destroy
respond_to do |format|
format.html { redirect_to interventions_url, notice: 'Intervention was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @intervention.destroy\n respond_to do |format|\n format.html { redirect_to interventions_url, notice: \"Intervention was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @intervention.destroy\r\n respond_to do |format|\r\n ... | [
"0.7238739",
"0.7174281",
"0.7094446",
"0.7014693",
"0.6972952",
"0.6965203",
"0.692514",
"0.6883052",
"0.6870373",
"0.6860288",
"0.68334925",
"0.6784678",
"0.6717114",
"0.67131644",
"0.6707018",
"0.670667",
"0.6696434",
"0.66502124",
"0.6630448",
"0.66114074",
"0.6604264",
... | 0.72428596 | 0 |
Returns true if placing the disc of current player at row,col is valid; else returns false | def isValidMove(row, col)
return isValidMoveForDisc(row, col, @disc)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid?(position)\n row, col = position\n position.all? {|i| i >= 0 && i< @grid.length}\n \n end",
"def isValidMove(row, col)\n return isValidMoveForDisc(row, col, @disc)\n end",
"def position_is_valid?(position)\r\n position.x < @col &&\r\n position.y < @row &&\r\n po... | [
"0.75937665",
"0.75354886",
"0.75309813",
"0.732391",
"0.7320446",
"0.73111796",
"0.7308032",
"0.72861654",
"0.7224004",
"0.7211812",
"0.72024614",
"0.71961975",
"0.71950793",
"0.7191397",
"0.7145335",
"0.7115999",
"0.70862406",
"0.70490366",
"0.7045009",
"0.698646",
"0.69854... | 0.7611331 | 0 |
Returns a JSON object containing the history of requests sent to the zombie. | def get_zombie_history
# validate nonce
nonce = @params['nonce'] || nil
raise WEBrick::HTTPStatus::BadRequest, "nonce is nil" if nonce.nil?
raise WEBrick::HTTPStatus::BadRequest, "nonce incorrect" if @session.get_nonce != nonce
# validate that the hooked browser's session has been sent
zomb... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_history\n @request_history = Request.history_request\n end",
"def history\n @agent.history\n end",
"def history\n rest.get stats_path(:history) do |response|\n response_handler response\n end\n end",
"def history\r\n []\r\n end",
"def history\n History\n ... | [
"0.7135725",
"0.65375096",
"0.6498258",
"0.6469189",
"0.6330849",
"0.6317082",
"0.63022196",
"0.6254604",
"0.6191924",
"0.6191924",
"0.61471105",
"0.61437917",
"0.61253196",
"0.61253196",
"0.61253196",
"0.60868114",
"0.6071356",
"0.60673106",
"0.6039339",
"0.6015712",
"0.6012... | 0.817751 | 0 |
Get desktop browser capabilities. | def get_desktop_browser_capabilities_using_get(opts = {})
data, _status_code, _headers = get_desktop_browser_capabilities_using_get_with_http_info(opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_desktop_browser_capabilities_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DevicesApi.get_desktop_browser_capabilities_using_get ...'\n end\n # resource path\n local_var_path = '/api/v2/devices/desktop-browse... | [
"0.69040096",
"0.64838773",
"0.64819115",
"0.64804214",
"0.6367558",
"0.6295252",
"0.6239627",
"0.6239627",
"0.6239627",
"0.621249",
"0.61834973",
"0.61834973",
"0.6125414",
"0.60959417",
"0.5945594",
"0.5840704",
"0.57913315",
"0.57673424",
"0.5727932",
"0.56749827",
"0.5598... | 0.78852725 | 0 |
Get desktop browser capabilities. | def get_desktop_browser_capabilities_using_get_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: DevicesApi.get_desktop_browser_capabilities_using_get ...'
end
# resource path
local_var_path = '/api/v2/devices/desktop-browser-capabili... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_desktop_browser_capabilities_using_get(opts = {})\n data, _status_code, _headers = get_desktop_browser_capabilities_using_get_with_http_info(opts)\n data\n end",
"def default_capabilities\n {\n :browserName => \"Chrome\",\n :version => nil,\n :platform => \"Li... | [
"0.78852725",
"0.64838773",
"0.64819115",
"0.64804214",
"0.6367558",
"0.6295252",
"0.6239627",
"0.6239627",
"0.6239627",
"0.621249",
"0.61834973",
"0.61834973",
"0.6125414",
"0.60959417",
"0.5945594",
"0.5840704",
"0.57913315",
"0.57673424",
"0.5727932",
"0.56749827",
"0.5598... | 0.69040096 | 1 |
Allows you to configure the grid options for all cells in a column. | def config_column(col, options = {})
TkGrid.columnconfigure content, col, options
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grid\n @grid ||= if @opts.key? \"grid\"\n @opts.slice(\"grid\", \",\")\n else\n %w[0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%]\n end\n end",
"def grid(*)\n super\n end",
"def grid *name_and_or_opts, &proc\n return unless ... | [
"0.64558303",
"0.63212305",
"0.6303581",
"0.6166956",
"0.5988611",
"0.59356344",
"0.59333014",
"0.59170336",
"0.5867887",
"0.5829143",
"0.58092153",
"0.577564",
"0.56921345",
"0.5673998",
"0.56640184",
"0.56379247",
"0.56320626",
"0.5599042",
"0.559884",
"0.5596657",
"0.55310... | 0.7166113 | 0 |
Allows you to configure the grid options for all cells in a row. | def config_row(row, options = {})
TkGrid.rowconfigure content, row, options
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_cells\n\t\teach_cell do |cell|\n\t\t\trow, col = cell.row, cell.column\n\n\t\t\tcell.north = self[row - 1, col]\n\t\t\tcell.south = self[row + 1, col]\n\t\t\tcell.east = self[row, col + 1]\n\t\t\tcell.west = self[row, col - 1]\n\t\tend\n\tend",
"def grid(*)\n super\n end",
"def grid(optio... | [
"0.6665863",
"0.6564863",
"0.6417819",
"0.6285998",
"0.6270872",
"0.61883813",
"0.61496216",
"0.6097441",
"0.6054287",
"0.60527956",
"0.6011894",
"0.59011817",
"0.58309907",
"0.5820225",
"0.5788466",
"0.57547164",
"0.5723824",
"0.57154536",
"0.56906587",
"0.56843644",
"0.5632... | 0.74481624 | 0 |
Gets all of the children on this window. | def children
TkWinfo.children(content)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_children()\n return @space.get_children()\n end",
"def get_children\n return children\n end",
"def find_all_children( window_handle )\n\n\t\t\t@log.debug(\"Finding all children for handle #{window_handle}\")\n\t\t\t\n\t\t\t# Process the parent window.\n\t\t\tif (@allChildren[win... | [
"0.7389771",
"0.7230989",
"0.71655977",
"0.70806885",
"0.70601064",
"0.69975096",
"0.6910936",
"0.6785425",
"0.6735896",
"0.6704331",
"0.6697999",
"0.6697999",
"0.6692519",
"0.665221",
"0.663263",
"0.66298",
"0.6619089",
"0.66109115",
"0.66109115",
"0.66095316",
"0.65889084",... | 0.7311491 | 1 |
Binds a method or Proc to a window event. event:: The event to bind to (eg "1", "Return", "Shift2") proc:: A predefined proc to bind to the event, only used if no block is provided. If a block is provided it will be bound, otherwise the +proc+ argument is looked at. If the proc argument specifies a Proc it will be boun... | def on(event, proc = nil, &block)
cmd = get_command proc, &block
root.bind(event) { cmd.call }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event(proc)\r\n ProcEvent.new(proc)\r\n end",
"def event(proc)\n ProcEvent.new(proc)\n end",
"def for_event(event = nil,&ruby_block)\n if event then\n # An event is passed as argument, use it.\n @mk_ev = proc { event.to_event }\n else\n ... | [
"0.6505047",
"0.6462149",
"0.6361374",
"0.6361374",
"0.56915444",
"0.5634497",
"0.56062144",
"0.5559539",
"0.55388266",
"0.5394879",
"0.53651184",
"0.5263578",
"0.523561",
"0.523085",
"0.52067095",
"0.5194497",
"0.5181764",
"0.5164627",
"0.51554924",
"0.5115646",
"0.5115646",... | 0.6574783 | 0 |
Adds a new label to the window. name:: A unique label for this item, cannot be nil. label_text:: The text to put in the label. If this is a Symbol, then a variable will be created with this value as its name. Otherwise the label will be given the string value as a static label. options:: Options for the label. Common o... | def add_label(name, label_text, options = {})
add_widget Tk::Tile::Label, name, label_text, options
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def label(text, options = {})\n Label.new(text, {parent: self}.merge!(options))\n end",
"def l(text=\"\", name=\"\")\n JLabel.new(text) #.tap{|jl| jl.name = name }\n end",
"def put_label name\n if @labels.key? name\n raise Errors::LabelAlreadyDefined, \"Label `#{name}` is already defined\"\... | [
"0.654046",
"0.6200569",
"0.6107271",
"0.6105838",
"0.59050024",
"0.5891895",
"0.586761",
"0.5818476",
"0.5726322",
"0.56810135",
"0.5633591",
"0.5581813",
"0.55706733",
"0.55312866",
"0.55220884",
"0.54486656",
"0.5446815",
"0.5433983",
"0.54004896",
"0.53515637",
"0.5346532... | 0.77727574 | 0 |
Adds a new image to the window. name:: A unique label for this item, cannot be nil. image_path:: The path to the image, can be relative or absolute. options:: Options for the image. Common options are :column, :row, and :sticky. | def add_image(name, image_path, options = {})
image = TkPhotoImage.new(file: image_path)
add_widget Tk::Tile::Label, name, nil, options.merge(image: image)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_image_button(name, image_path, options = {}, &block)\n options = options.dup\n image = TkPhotoImage.new(file: image_path)\n proc = get_command(options.delete(:command), &block) || ->{ $stderr.puts \"Button '#{name}' does nothing when clicked.\" }\n add_widget Tk::Tile::Button, name, nil... | [
"0.7057625",
"0.6720532",
"0.6513101",
"0.64242864",
"0.6274848",
"0.5957621",
"0.5951419",
"0.5900736",
"0.5783129",
"0.57641673",
"0.5728883",
"0.5713575",
"0.5707759",
"0.55100685",
"0.5508142",
"0.5478155",
"0.5333577",
"0.5296922",
"0.52967054",
"0.5295192",
"0.52815306"... | 0.76877713 | 0 |
Adds a new button to the window. name:: A unique label for this item, cannot be nil. label_text:: The text to put in the button. If this is a Symbol, then a variable will be created with this value as its name. Otherwise the button will be given the string value as a static label. options:: Options for the button. Comm... | def add_button(name, label_text, options = {}, &block)
options = options.dup
proc = get_command(options.delete(:command), &block) || ->{ $stderr.puts "Button '#{name}' does nothing when clicked." }
add_widget Tk::Tile::Button, name, label_text, options, &proc
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def button(text, options = {}, &block)\n Button.new(text, {parent: self}.merge!(options), &block)\n end",
"def add_label(name, label_text, options = {})\n add_widget Tk::Tile::Label, name, label_text, options\n end",
"def add_button(path:, name: :ADD.t, **args, &block)\n content = block ? ca... | [
"0.6887669",
"0.6211001",
"0.6159991",
"0.60236615",
"0.570303",
"0.56904304",
"0.56674063",
"0.5554339",
"0.5468458",
"0.534586",
"0.533486",
"0.5328738",
"0.5328546",
"0.532034",
"0.5309839",
"0.52965534",
"0.52680326",
"0.5264758",
"0.525589",
"0.5254584",
"0.5235799",
"... | 0.80267733 | 0 |
Adds a new image button to the window. name:: A unique label for this item, cannot be nil. image_path:: The path to the image, can be relative or absolute. options:: Options for the image button. Common options are :column, :row, :sticky, and :command. If a block is provided, it will be used for the button command. Oth... | def add_image_button(name, image_path, options = {}, &block)
options = options.dup
image = TkPhotoImage.new(file: image_path)
proc = get_command(options.delete(:command), &block) || ->{ $stderr.puts "Button '#{name}' does nothing when clicked." }
add_widget Tk::Tile::Button, name, nil, options.m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_image(name, image_path, options = {})\n image = TkPhotoImage.new(file: image_path)\n add_widget Tk::Tile::Label, name, nil, options.merge(image: image)\n end",
"def add_image_check_box(name, image_path, options = {}, &block)\n options = options.dup\n image = TkPhotoImage.new(file: ... | [
"0.69849795",
"0.6756643",
"0.6200739",
"0.6178716",
"0.6046602",
"0.567073",
"0.5611482",
"0.5560119",
"0.5532283",
"0.5511961",
"0.54709554",
"0.54444563",
"0.5407998",
"0.53885615",
"0.5381185",
"0.53761095",
"0.5360115",
"0.5356025",
"0.5331499",
"0.5317935",
"0.53164893"... | 0.8231663 | 0 |
Adds a new text box to the window. name:: A unique label for this item, cannot be nil. options:: Options for the text box. Common options are :column, :row, :sticky, :width, :value, and :password. Accepts a block or command the same as a button. Unlike the button there is no default proc assigned. The proc, if specifie... | def add_text_box(name, options = {}, &block)
options = options.dup
if options.delete(:password)
options[:show] = '*'
end
proc = get_command(options.delete(:command), &block)
item = add_widget Tk::Tile::Entry, name, nil, options.merge(create_var: :textvariable)
# FIXME: Should... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def text_input(method, options)\n basic_input_helper(:text_area, :text, method, options)\n end",
"def text_input(method, options)\n basic_input_helper(:text_area, :text, method, options)\n end",
"def text_input(method, options)\n basic_input_helper(:text_area, :text, method, option... | [
"0.5936674",
"0.5936674",
"0.5923289",
"0.58801425",
"0.5845166",
"0.5806135",
"0.57351524",
"0.57124853",
"0.5708682",
"0.568625",
"0.5608097",
"0.55455345",
"0.55117095",
"0.54974574",
"0.5488378",
"0.54852414",
"0.54723775",
"0.53878605",
"0.5382123",
"0.531811",
"0.531058... | 0.8246833 | 0 |
Adds a new check box to the window name:: A unique label for this item, cannot be nil. label_text:: The text to put in the button. If this is a Symbol, then a variable will be created with this value as its name. Otherwise the button will be given the string value as a static label. options:: Options for the check box.... | def add_check_box(name, label_text, options = {}, &block)
options = options.dup
proc = get_command(options.delete(:command), &block)
add_widget Tk::Tile::Checkbutton, name, label_text, options.merge(create_var: :variable), &proc
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_button(name, label_text, options = {}, &block)\n options = options.dup\n proc = get_command(options.delete(:command), &block) || ->{ $stderr.puts \"Button '#{name}' does nothing when clicked.\" }\n add_widget Tk::Tile::Button, name, label_text, options, &proc\n end",
"def add_label(name... | [
"0.666352",
"0.62135285",
"0.6209467",
"0.6161181",
"0.6088437",
"0.60785866",
"0.60785866",
"0.5913832",
"0.58498174",
"0.5689263",
"0.55638885",
"0.5451311",
"0.5431358",
"0.5422112",
"0.539649",
"0.5395467",
"0.5395467",
"0.53832895",
"0.5382997",
"0.53663826",
"0.5346781"... | 0.83190376 | 0 |
Adds a new image check box to the window name:: A unique label for this item, cannot be nil. image_path:: The path to the image, can be relative or absolute. options:: Options for the check box. Common options are :column, :row, :sticky, and :value. Accepts a block or command the same as a button. Unlike a button there... | def add_image_check_box(name, image_path, options = {}, &block)
options = options.dup
image = TkPhotoImage.new(file: image_path)
proc = get_command(options.delete(:command), &block)
add_widget Tk::Tile::Checkbutton, name, nil, options.merge(image: image, create_var: :variable), &proc
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_image_button(name, image_path, options = {}, &block)\n options = options.dup\n image = TkPhotoImage.new(file: image_path)\n proc = get_command(options.delete(:command), &block) || ->{ $stderr.puts \"Button '#{name}' does nothing when clicked.\" }\n add_widget Tk::Tile::Button, name, nil... | [
"0.71894604",
"0.6909346",
"0.64260066",
"0.6030556",
"0.59158087",
"0.53920144",
"0.53401417",
"0.52310014",
"0.5127632",
"0.5120563",
"0.50318253",
"0.50081575",
"0.500092",
"0.49173144",
"0.49128786",
"0.48930177",
"0.48813006",
"0.48678347",
"0.48486742",
"0.48468035",
"0... | 0.84218556 | 0 |
Adds a new radio button to the window. name:: A unique label for this item, cannot be nil. group:: The name of the variable this radio button uses. label_text:: The text to put in the button. If this is a Symbol, then a variable will be created with this value as its name. Otherwise the button will be given the string ... | def add_radio_button(name, group, label_text, options = {}, &block)
raise ArgumentError, 'group cannot be blank' if group.to_s.strip == ''
options = options.dup
group = group.to_sym
@stkw_var_list[group] ||= TkVariable.new
options[:variable] = @stkw_var_lis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fui_radio_button(name, id, text, options = {})\n fui_radio(name, id, text, options)\n end",
"def add_image_radio_button(name, group, image_path, options = {}, &block)\n raise ArgumentError, 'group cannot be blank' if group.to_s.strip == ''\n options = options.dup\n group ... | [
"0.70197827",
"0.69036335",
"0.6240829",
"0.61480606",
"0.6120654",
"0.6032041",
"0.5990889",
"0.5990075",
"0.5937002",
"0.58130044",
"0.5772246",
"0.57628584",
"0.5721623",
"0.57111305",
"0.5704787",
"0.56668824",
"0.5661138",
"0.5648909",
"0.5633443",
"0.54579663",
"0.53727... | 0.84441376 | 0 |
Adds a new radio button to the window. name:: A unique label for this item, cannot be nil. group:: The name of the variable this radio button uses. image_path:: The path to the image, can be relative or absolute. options:: Options for the check box. Common options are :column, :row, :sticky, :value, and :selected. Acce... | def add_image_radio_button(name, group, image_path, options = {}, &block)
raise ArgumentError, 'group cannot be blank' if group.to_s.strip == ''
options = options.dup
group = group.to_sym
@stkw_var_list[group] ||= TkVariable.new
options[:variable] = @stkw_v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_radio_button(name, group, label_text, options = {}, &block)\n raise ArgumentError, 'group cannot be blank' if group.to_s.strip == ''\n options = options.dup\n group = group.to_sym\n @stkw_var_list[group] ||= TkVariable.new\n options[:variable] = @st... | [
"0.73137814",
"0.6124109",
"0.601418",
"0.58373713",
"0.5731386",
"0.5530163",
"0.54794407",
"0.5419684",
"0.53981346",
"0.53897196",
"0.5310744",
"0.52623093",
"0.5255318",
"0.5254434",
"0.5197926",
"0.5194476",
"0.5179152",
"0.5137785",
"0.51260173",
"0.50768524",
"0.500616... | 0.8277177 | 0 |
Adds a new combo box to the window. name:: A unique label for this item, cannot be nil. options:: Options for the check box. Common options are :column, :row, :sticky, :value, and :values. The :values option will define the items in the combo box, the :value option sets the selected option if set. Accepts a block or co... | def add_combo_box(name, options = {}, &block)
options = options.dup
proc = get_command(options.delete(:command), &block)
item = add_widget Tk::Tile::Combobox, name, nil, options.merge(create_var: :textvariable)
if proc
item.bind('<ComboboxSelected>') { proc.call }
end
item
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_box(name, options={})\n @columns << CheckBoxColumn.new(self, name, options)\n end",
"def add_check_box(name, label_text, options = {}, &block)\n options = options.dup\n proc = get_command(options.delete(:command), &block)\n add_widget Tk::Tile::Checkbutton, name, label_text, opti... | [
"0.62074405",
"0.6017681",
"0.5544083",
"0.5497137",
"0.5406009",
"0.5207088",
"0.51606363",
"0.5095672",
"0.5081907",
"0.5077331",
"0.50519717",
"0.5020142",
"0.50053644",
"0.49868032",
"0.49438274",
"0.49137154",
"0.48940444",
"0.4859452",
"0.4832481",
"0.48111185",
"0.4744... | 0.8103843 | 0 |
Adds a new frame to the window. name:: A unique label for this item, cannot be nil. options:: Options for the frame. Common options are :column, :row, and :padding. A frame can be used as a subwindow. The returned object has all of the same methods as a Window so you can add other widgets to it and use it as a grid wit... | def add_frame(name, options = {}, &block)
name = name.to_sym
raise DuplicateNameError if @stkw_object_list.include?(name)
options = fix_position(options.dup)
@stkw_object_list[name] = SimpleTk::Window.new(options.merge(parent: content, stk___frame: true), &block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def box(name, options={}, &block)\n options.merge!(:body=>capture(&block))\n concat(render(:partial => \"shared/ubiquo/boxes/#{name}\", :locals => options), block.binding)\n end",
"def frame(options = {})\n raise Applitools::EyesIllegalArgument.new 'You must pass :index or :name_or_id or ... | [
"0.56424195",
"0.53803074",
"0.53631586",
"0.52786165",
"0.5262177",
"0.5090301",
"0.50346744",
"0.5032979",
"0.49691135",
"0.49192548",
"0.49042797",
"0.4830449",
"0.47703505",
"0.46742493",
"0.46277967",
"0.45902956",
"0.45642292",
"0.454173",
"0.45154905",
"0.4509565",
"0.... | 0.7717109 | 0 |
Sets the placement mode for this window. mode:: This can be either :free or :flow. The default mode for a new window is :free. Frames do not inherit this setting from the parent window. In free placement mode, you must provide the :column and :row for every widget. In flow placement mode, you must not provide the :colu... | def set_placement_mode(mode, options = {})
raise ArgumentError, 'mode must be :free or :flow' unless [ :free, :flow ].include?(mode)
if mode == :flow
first_col = options[:first_column]
col_count =
if (val = options[:last_column])
val - first_col + 1
elsi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mode(*modes, &block)\n fail_if_wrong_modes modes\n fail 'Block required' unless block_given?\n self.current_modes = modes\n instance_eval(&block)\n reset_modes\n end",
"def setRenderingMode(mode)\n unless /(?i)^(default|viewport)$/.match(mode)\n ... | [
"0.533975",
"0.52456236",
"0.5211744",
"0.5211744",
"0.5145717",
"0.5111742",
"0.51113564",
"0.50882745",
"0.4970894",
"0.49520534",
"0.49265268",
"0.489125",
"0.4862967",
"0.4844421",
"0.4806871",
"0.48012286",
"0.47958687",
"0.477751",
"0.47677127",
"0.4763651",
"0.47457623... | 0.7993357 | 0 |
Stop this controller frmo being documented | def no_doc!
@controller.doc = false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop_doc\n return unless @track_visibility\n\n @document_self = false\n @document_children = false\n end",
"def stop_soft\n @controller.stop if @controller\n stop\n end",
"def stop\n\t\t\tSystem.logger.info \"stopping #{@controller.name}\"\n\t\t\t@sys_lock.synchronize {\n... | [
"0.66489875",
"0.66217667",
"0.64799535",
"0.6441799",
"0.62605166",
"0.6250737",
"0.6220245",
"0.6216365",
"0.620303",
"0.6198584",
"0.6148132",
"0.6094282",
"0.6076871",
"0.6054366",
"0.6046189",
"0.6046189",
"0.60095155",
"0.600709",
"0.59961665",
"0.59961665",
"0.59961665... | 0.7381209 | 0 |
Set the friendly name for the controller | def friendly_name(string)
@controller.friendly_name = string
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def controller_name(name)\n @controller_class_name = \"#{name}_controller\".camelize\n end",
"def controller_name\n self.name.underscore.pluralize\n end",
"def pretty_controller_name(name = \"\")\n name.split('_').map(&:capitalize).join(' ').singularize\n end",
"def screen_nam... | [
"0.74072605",
"0.7166785",
"0.7066654",
"0.6949487",
"0.6945669",
"0.6906173",
"0.6906173",
"0.6880175",
"0.684592",
"0.6810002",
"0.67333305",
"0.6731542",
"0.67079824",
"0.6706837",
"0.66833895",
"0.6665587",
"0.66633165",
"0.6648625",
"0.6648625",
"0.66415143",
"0.6586586"... | 0.84667003 | 0 |
Set the description for the controller | def description(description)
@controller.description = description
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def description=(value)\n @description = value\n end",
"def description=(value)\n @description = value\n end",
"def description=(value)\n @description = value\n end",
"def description=(value)\n @description = value\n... | [
"0.74788505",
"0.74788505",
"0.74788505",
"0.74788505",
"0.74788505",
"0.74788505",
"0.74788505",
"0.74788505",
"0.74788505",
"0.74788505",
"0.74788505",
"0.74788505",
"0.74788505",
"0.74788505",
"0.74788505",
"0.74788505",
"0.74788505",
"0.74788505",
"0.74788505",
"0.74788505"... | 0.8812763 | 0 |
Defines a new action within the controller. | def action(name, &block)
action = Moonrope::Action.new(@controller, name)
action.dsl.instance_eval(&block) if block_given?
@controller.actions[name] = action
action
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action\n end",
"def action(klass)\n def_delegator :default, klass.action_name\n define_method klass.action_name do |*args, &block|\n new_action = klass.new self, action\n directives.values.each {|it| it.setup! new_action }\n new_action.setup! *args, &block\n new_actio... | [
"0.69823956",
"0.69753337",
"0.68979317",
"0.68015033",
"0.6768384",
"0.6749031",
"0.6729494",
"0.67265195",
"0.6714161",
"0.6714161",
"0.6714161",
"0.6714161",
"0.6714161",
"0.6637131",
"0.6598753",
"0.65931803",
"0.65925515",
"0.6572566",
"0.6572566",
"0.6572566",
"0.657256... | 0.71515316 | 0 |
Set the name of the authenticator to use for all actions in this controller | def authenticator(name)
@controller.authenticator = name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticator(name, &block)\n authenticator = Moonrope::Authenticator.new(name)\n dsl = Moonrope::DSL::AuthenticatorDSL.new(authenticator)\n dsl.instance_eval(&block) if block_given?\n @base.authenticators[name] = authenticator\n end",
"def set_authenticator\n @authentic... | [
"0.6848781",
"0.65764177",
"0.65355164",
"0.6011487",
"0.5904779",
"0.5848176",
"0.57550466",
"0.57242036",
"0.572251",
"0.5693284",
"0.56511253",
"0.55263424",
"0.54984725",
"0.54368454",
"0.5432521",
"0.5419545",
"0.5347769",
"0.5347769",
"0.5347769",
"0.5347769",
"0.534776... | 0.8869758 | 0 |
Set the name of the access rule to use for all actions in this controller | def access_rule(name)
if name.is_a?(Hash)
authenticator name.first[0]
access_rule name.first[1]
else
@controller.access_rule = name
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rule_name=(rule_name)\n @rule_name = rule_name.to_sym\n end",
"def rule_name=(rule_name)\n @rule_name = rule_name.to_sym\n end",
"def rule_name=(value)\n @rule_name = value\n end",
"def set_rule_name(opts)\n opts = check_params(opts,[:rule_names])\n sup... | [
"0.6648725",
"0.6648725",
"0.6629234",
"0.61360615",
"0.6119587",
"0.577268",
"0.5706243",
"0.56811625",
"0.5666583",
"0.5539556",
"0.55340743",
"0.54962033",
"0.54496604",
"0.5446366",
"0.5446366",
"0.53304815",
"0.52922684",
"0.52754277",
"0.5270416",
"0.5268976",
"0.526897... | 0.77490884 | 0 |
Defines a new before action within the controller. | def before(*actions, &block)
before_action = Moonrope::BeforeAction.new(@controller)
before_action.block = block
before_action.actions = actions
@controller.befores << before_action
before_action
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def before(action, &block)\n before_actions[action] = block if block_given?\n end",
"def before_action \n end",
"def b... | [
"0.71518177",
"0.70470697",
"0.6951678",
"0.6735917",
"0.66664475",
"0.653082",
"0.64840984",
"0.6408645",
"0.6401255",
"0.6314434",
"0.6279577",
"0.6114104",
"0.60442793",
"0.6028079",
"0.60004836",
"0.5982925",
"0.5975498",
"0.59147584",
"0.590386",
"0.587922",
"0.58228236"... | 0.71909976 | 0 |
Defines a new helper for this controller. | def helper(name, options = {}, &block)
if @controller.base.helper(name, @controller)
raise Moonrope::Errors::HelperAlreadyDefined, "Helper has already been defined with name `#{name}`"
end
@controller.base.helpers << Moonrope::Helper.new(name, @controller, options, &block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def helper\n @helper ||= Helpers.new\n end",
"def helper\n @helper ||= ApplicationController.helpers\n end",
"def helper\n @helper\n end",
"def helper\n @helper\n end",
"def set_helper\n @helper = Helper.find(params[:id])\n end",
"def set_helper\n @hel... | [
"0.75032955",
"0.74269533",
"0.7399248",
"0.7399248",
"0.7006782",
"0.7006782",
"0.6927495",
"0.6909045",
"0.6874677",
"0.675485",
"0.675485",
"0.675485",
"0.672839",
"0.6680891",
"0.6676899",
"0.6664695",
"0.6657174",
"0.66512865",
"0.6615865",
"0.661261",
"0.66089207",
"0... | 0.74388593 | 1 |
Define a shared action which can be used by any action | def shared_action(name, &block)
@controller.shared_actions[name] = block
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shared_action(name, &block)\n @base.shared_actions[name] = block\n end",
"def receive_action(action)\n self.define_singleton_method(:perform_action, &action)\n end",
"def process_action(...)\n send_action(...)\n end",
"def define_action_hook; end",
"def action; end",
"... | [
"0.7826941",
"0.709921",
"0.7014508",
"0.7007904",
"0.6961032",
"0.6961032",
"0.6961032",
"0.6961032",
"0.6961032",
"0.6911897",
"0.68993914",
"0.6874593",
"0.68649864",
"0.684385",
"0.6836971",
"0.67884636",
"0.67884636",
"0.67862964",
"0.6773419",
"0.6743367",
"0.670625",
... | 0.7827923 | 0 |
Ensure that a child topic can't have greater visibility than its parent. Yes, the pluralization of "editable_by" is disgusting. | def parent_has_greater_permissions
unless Topic.visible_tos[parent.visible_to] >= Topic.visible_tos[visible_to]
errors.add :visible_to, 'can’t be greater than parent'
end
unless Topic.editable_bies[parent.editable_by] >= Topic.editable_bies[editable_by]
errors.add :editable_by, 'can’t be greater... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parent_has_constraints_on_children?\n parent_tag[:definition][:only_allow] != nil\n end",
"def has_editable kind\n case kind\n when :children\n false\n else\n true\n end\n end",
"def authorize_manageable\n unless @project_group.is_child_of?(@project)\n deny_ac... | [
"0.57598543",
"0.5599601",
"0.5594619",
"0.5574033",
"0.55652875",
"0.55031776",
"0.5416692",
"0.5415538",
"0.5406059",
"0.5406059",
"0.5406059",
"0.53423595",
"0.5291928",
"0.529127",
"0.52853596",
"0.52753305",
"0.5267114",
"0.52454704",
"0.52454704",
"0.5242355",
"0.522601... | 0.8215898 | 0 |
Randomly create data to push to form values, depending on the name of the input field. We're trying to be clever about the sort of crap to push into the field. Todo: if an existing value is given, try mutating it. | def create_data(input, mutate = false)
value = mutate ? nil : input['value']
return value || case input['name']
when /amount/: rand(10000) - 5000
when /_id$/: rand(500)
when /uploaded_data/: # attachment_fu
nil
when nil
# wtf!
input['value']
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def faker_value_for_field(field, fills = {})\n field_name = [field.tag_name, field['type']].compact.join('_')\n attributes = field['name'].to_s.gsub(']', '').split('[') # user[something_attributes][last_name] => ['user', 'something_attributes', 'last_name']\n attribute = attributes.last.to_s\n\n fill_v... | [
"0.6211705",
"0.5683655",
"0.5581236",
"0.5529638",
"0.5513813",
"0.5502321",
"0.5463733",
"0.54514694",
"0.5446338",
"0.5388974",
"0.5382356",
"0.5376422",
"0.53713995",
"0.535219",
"0.5347656",
"0.5303412",
"0.52877134",
"0.5265491",
"0.5260497",
"0.52518564",
"0.5239061",
... | 0.6982048 | 0 |
Parse command line options (as specified by +argv+ passed to the constructor) | def parse_opts
option_parser.parse(@argv)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(argv)\n options = parser.process!(argv)\n validate_options(options)\n Revamp.logger.level = Logger::INFO unless options[:verbose]\n options\n end",
"def parse!(argv)\n\t\t$log.debug(\"#{self.class}.#{__method__}('#{argv.join(\" \")}'#{block_given? ? ',&block' : ''})\")\n\t\tif (argv.size =... | [
"0.791591",
"0.7894947",
"0.78680944",
"0.78454643",
"0.78320664",
"0.77594817",
"0.775235",
"0.7697533",
"0.7630487",
"0.75996166",
"0.75930315",
"0.7579586",
"0.7560917",
"0.7546087",
"0.7531527",
"0.7510175",
"0.7508475",
"0.7478744",
"0.7450706",
"0.742435",
"0.7421426",
... | 0.8110909 | 0 |
Main entry point. Updates the metadata cache with any new metadata files that have been published, then lists all of the packages in S3 and compares the MD5 given by S3 with the "correct" one in the metadata. Metadata files are themselves checked for correct MD5 as well. Diagnostic information is printed to STDOUT, tho... | def run
parse_opts
begin
MetadataCache.ensure_created
msg "total_releases: #{metadata_files.size}"
msg "known_releases: #{existing_files.size}"
msg "new_releases: #{new_files.size}"
fetch_new_release_metadata
verify_existing_release_metadata
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def s3_info()\n verbose_or_debug_msg(\"Checking S3 resources in all regions for profile \\\"#{$profile}\\\"\")\n s3_resource=Aws::S3::Resource.new(region: \"eu-west-1\", credentials: $credentials)\n if $audit_mode\n opfile=File.open(\"#{$audit_dir}/all/s3_buckets\",\"w\")\n else\n opfile=$stdout\n end\... | [
"0.62470114",
"0.5975561",
"0.5923803",
"0.58414304",
"0.57329404",
"0.5670421",
"0.5646606",
"0.5506068",
"0.53847736",
"0.53345066",
"0.5291038",
"0.52541274",
"0.5240312",
"0.52221656",
"0.5209865",
"0.5156566",
"0.51348144",
"0.51177436",
"0.50782245",
"0.50664866",
"0.50... | 0.6195779 | 1 |
Writes a success message. Exact output depends on whether nagios mode is enabled. | def success_message
if nagios_mode?
puts "OK: All packages match checksums"
else
msg "metadata_check: ok"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def success(message)\n log.info(message.to_s.green)\n end",
"def success(message, options = {})\n options[:prefix] ||= \" + \"\n options[:color] ||= :green\n output message, options\n end",
"def say_success(message)\n say \"Success\", message, :green\n end",
"def print_success_mess... | [
"0.7171248",
"0.71431273",
"0.7087086",
"0.6943945",
"0.6934399",
"0.69142663",
"0.6798649",
"0.67804486",
"0.6736836",
"0.67111975",
"0.6701273",
"0.66822064",
"0.6559729",
"0.6533122",
"0.64533126",
"0.6406115",
"0.63455683",
"0.63242054",
"0.6242815",
"0.61654544",
"0.6162... | 0.73427886 | 0 |
Writes an error message explaining that some unverifiable packages exist. Output depends on whether nagios mode is enabled. | def unverifiable_packages_message
if nagios_mode?
puts "CRIT: available metadata ok, but #{unverifiable_package_count} packages cannot be verified"
else
msg "unverifiable_packages: #{unverifiable_package_count}"
unverifiable_packages.each do |pkg|
msg "* #{pkg}"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error_message\n if nagios_mode?\n puts \"CRIT: #{invalid_metadata_files.size} metadata files and #{invalid_packages.size} packages with invalid checksums\"\n else\n invalid_metadata_files.each do |metadata|\n msg metadata.explain_error\n end\n invali... | [
"0.7536676",
"0.6597067",
"0.6138539",
"0.56292367",
"0.56172675",
"0.55925065",
"0.5546886",
"0.553032",
"0.553032",
"0.5524942",
"0.5479981",
"0.5477391",
"0.54632735",
"0.5443989",
"0.5408656",
"0.5392109",
"0.5387303",
"0.5365425",
"0.5364194",
"0.5354457",
"0.5348372",
... | 0.7457955 | 1 |
True if Nagios format output is configured, false otherwise. | def nagios_mode?
options[:nagios]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_format?(); @type == GRT_FORMAT; end",
"def human_format?\n @format == :human\n end",
"def text?\n @format == 0\n end",
"def supported?\n if is_simple_format?\n return true\n elsif is_advanced_format?\n return is_supported_advanced_format?\n else\n return... | [
"0.63795614",
"0.62558126",
"0.6231918",
"0.62263703",
"0.6169237",
"0.6098438",
"0.60614103",
"0.6056427",
"0.6043602",
"0.59661317",
"0.59607047",
"0.59396976",
"0.592466",
"0.5910584",
"0.5896695",
"0.58824396",
"0.580171",
"0.5801518",
"0.5798338",
"0.57947546",
"0.577522... | 0.6745942 | 0 |
Emit a message to STDOUT, when not in nagios mode. | def msg(message)
puts message unless nagios_mode?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def puts(msg)\n @out.puts msg unless @silent\n end",
"def message(msg)\n $stdout.puts(msg) unless $options['quiet']\nend",
"def message(msg)\n STDOUT.puts msg\n end",
"def print message=nil\n log(:info, message) unless Qcmd.silent?\n end",
"def output(message)\n return if disabl... | [
"0.74411434",
"0.7005267",
"0.6950126",
"0.6696261",
"0.6689913",
"0.66439474",
"0.65734965",
"0.6561918",
"0.6559337",
"0.6463975",
"0.64575773",
"0.6448673",
"0.64338195",
"0.63494873",
"0.6341365",
"0.6341365",
"0.63198143",
"0.6289677",
"0.6275439",
"0.6253748",
"0.622799... | 0.7545788 | 0 |
Returns an Integer number of packages that exist in S3 but do not have any metadata entry. | def unverifiable_package_count
published_packages.size - expected_cksums.size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_objects(key)\n\n puts \"Bucket: #{@bucket_name} - key: #{key}\\n\"\n\n files = @client.buckets[@bucket_name].\n objects.with_prefix(key)\n\n count = 0\n files.each do |o|\n co... | [
"0.62895864",
"0.61390674",
"0.611954",
"0.6018783",
"0.600844",
"0.6006622",
"0.59714127",
"0.59561944",
"0.5929077",
"0.5900708",
"0.5886503",
"0.5854074",
"0.5846306",
"0.58281523",
"0.5795023",
"0.5791322",
"0.57723254",
"0.5772193",
"0.5699789",
"0.56937027",
"0.5688242"... | 0.7261053 | 0 |
Gives an Array of package objects that do not have any corresponding metadata entries (as determined by comparing with expected_cksums) | def unverifiable_packages
published_packages.keys.select {|p| !expected_cksums.any? {|m| m["relpath"] == p } }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def packages_missing_candidates\n @packages_missing_candidates ||=\n begin\n missing = []\n each_package do |package_name, new_version, current_version, candidate_version, magic_version|\n missing.push(package_name) if magic_version.nil? && candidate_version.nil?\... | [
"0.6792082",
"0.64806193",
"0.64513594",
"0.60810244",
"0.59145814",
"0.58852816",
"0.5843508",
"0.58378816",
"0.5804301",
"0.5780305",
"0.56691194",
"0.56308275",
"0.56208336",
"0.54851675",
"0.54640514",
"0.54202735",
"0.5414539",
"0.54068875",
"0.540401",
"0.5393806",
"0.5... | 0.7312998 | 0 |
Iterates of the list of new_files, downloading the files from S3 to the local metadata cache. | def fetch_new_release_metadata
return false if new_files.empty?
msg "Caching metadata for new releases"
new_files.each {|f| f.fetch}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sync_down\n existing = list_files\n new_objects = []\n self.objects.each do |obj|\n filename = filename_from_key(obj.key)\n existing.delete( filename )\n file = directory + filename\n if !File.exists?(file)\n puts \"Downloading file #{file} with key #{obj.key})\"\n ne... | [
"0.6554021",
"0.6405121",
"0.63330954",
"0.6139512",
"0.61258817",
"0.61032254",
"0.6050929",
"0.6000503",
"0.5976631",
"0.5936875",
"0.58983797",
"0.5887734",
"0.5834607",
"0.58326906",
"0.57953703",
"0.5775314",
"0.5760707",
"0.56677777",
"0.56572205",
"0.5644302",
"0.56177... | 0.6507482 | 1 |
Returns an Array of MetadataFile objects representing all known metadata files. When first called, it also collects Arrays of existing (already cached) and new metadata files. | def metadata_files
return @metadata_files unless @metadata_files.nil?
@metadata_files = MetadataFile.all
@existing_files, @new_files = [], []
@metadata_files.each do |f|
if f.cached?
@existing_files << f
else
@new_files << f
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def existing_files\n metadata_files if @existing_files.nil?\n @existing_files\n end",
"def manifested_files\n manifest_files.inject([]) do |acc, mf|\n files = File.open(mf) { |io|\n io.readlines.map do |line|\n _digest, path = line.chomp.split(/\\s+/, 2)\n ... | [
"0.6895612",
"0.6566795",
"0.65140074",
"0.6511594",
"0.6491792",
"0.6432927",
"0.6349055",
"0.6293411",
"0.62303406",
"0.615565",
"0.6127994",
"0.61135787",
"0.6077343",
"0.603633",
"0.6029249",
"0.6021655",
"0.60202867",
"0.60175544",
"0.5991741",
"0.5991741",
"0.59901553",... | 0.86805665 | 0 |
Returns an Array of MetadataFile objects representing metadata files that have already been cached locally. | def existing_files
metadata_files if @existing_files.nil?
@existing_files
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def metadata_files\n return @metadata_files unless @metadata_files.nil?\n @metadata_files = MetadataFile.all\n @existing_files, @new_files = [], []\n @metadata_files.each do |f|\n if f.cached?\n @existing_files << f\n else\n @new_files << f\n ... | [
"0.85113466",
"0.65473974",
"0.6331899",
"0.62839013",
"0.6273114",
"0.6248961",
"0.6235113",
"0.6220998",
"0.620898",
"0.6186873",
"0.6141678",
"0.6089979",
"0.6084315",
"0.6059949",
"0.60082144",
"0.599378",
"0.5952205",
"0.59298843",
"0.5927284",
"0.59170854",
"0.5903759",... | 0.6749182 | 1 |
force http images to use https. If remote server cannot handle https a broken image is expected. The `alt` keyword argument is required for accessibility reasons and is a keyword argument instead of positional to match the syntax of `image_tag` which this wraps. | def force_https_image_tag(url, alt:)
image_tag(force_https(url), alt: alt)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_https\n return unless supports_https? && node['src'].present?\n node['src'] = node['src'].gsub(\"http:\", \"https:\")\n end",
"def update_image_src img, options = {}\n if FedenaSetting.s3_enabled? #and options[:s3].present? and options[:s3]) \n image_url = options... | [
"0.64393216",
"0.63904864",
"0.6343453",
"0.62025154",
"0.6165506",
"0.6124531",
"0.5997229",
"0.59634525",
"0.59546363",
"0.58647144",
"0.58125865",
"0.5796635",
"0.578715",
"0.5657186",
"0.5644356",
"0.56332135",
"0.5623552",
"0.559916",
"0.5580951",
"0.5579573",
"0.5564744... | 0.8517945 | 0 |
force scheme of a url to https if it is currently http. if it is not http just return the input with no changes | def force_https(url)
uri = URI(url)
return url unless uri.scheme == 'http'
uri.scheme = 'https'
uri.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_https(url)\n url\n .delete_prefix('http://')\n .delete_prefix('https://')\n .prepend('https://')\n end",
"def smart_add_url_protocol\n return if self.original.blank?\n unless self.original[/\\Ahttp:\\/\\//] || self.original[/\\Ahttps:\\/\\//]\n self.original = \"http://#{... | [
"0.77292275",
"0.7490238",
"0.7421429",
"0.74122053",
"0.73698187",
"0.7325292",
"0.72550493",
"0.719637",
"0.7131785",
"0.7073474",
"0.7073474",
"0.70003337",
"0.6939108",
"0.69335943",
"0.69147307",
"0.6887821",
"0.68749857",
"0.68504983",
"0.68115795",
"0.68098724",
"0.678... | 0.79166305 | 0 |
GET /feats GET /feats.xml | def index
#@feats = Feat.find(:all)
@feats = @character.feats.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @feats }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @feat = @person.feats.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feat }\n end\n end",
"def show\n #@feat = Feat.find(params[:id])\n @feat = @character.feats.find(params[:id])\n\n respond_to do |format|\n ... | [
"0.67098254",
"0.6627663",
"0.6551366",
"0.63833606",
"0.6354973",
"0.6196165",
"0.6051196",
"0.60146856",
"0.5907534",
"0.5895519",
"0.5882913",
"0.58725905",
"0.5856397",
"0.5852675",
"0.58494765",
"0.5843624",
"0.5821335",
"0.5821065",
"0.58195364",
"0.5806397",
"0.5796359... | 0.72626954 | 0 |
GET /feats/new GET /feats/new.xml | def new
#@feat = Feat.new
@feat = @character.feats.build
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @feat }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @feat = @person.feats.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feat }\n end\n end",
"def new\n @flight = Flight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @flight }\n ... | [
"0.7792837",
"0.6919636",
"0.68414694",
"0.67644715",
"0.67318636",
"0.6703561",
"0.6671743",
"0.6659867",
"0.6654842",
"0.66416556",
"0.6634941",
"0.6607091",
"0.6596537",
"0.65859646",
"0.6573193",
"0.6571277",
"0.6536782",
"0.6534156",
"0.6529434",
"0.65140235",
"0.6513901... | 0.71618956 | 1 |
POST /feats POST /feats.xml | def create
#@feat = Feat.new(params[:feat])
@feat = @character.feats.build(params[:feat])
respond_to do |format|
if @feat.save
flash[:notice] = 'Feat was successfully created.'
format.html { redirect_to(edit_character_path(@character)) }
format.xml { render :xml => @feat, :st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def feats_update\n if Config.exists?\n API.upload_feats\n end\n end",
"def create\n @feat = @person.feats.new(params[:feat])\n\n respond_to do |format|\n if @feat.save\n format.html { redirect_to([@person, @feat], :notice => 'Feat was successfully created.') }\n forma... | [
"0.6224699",
"0.6201416",
"0.5846991",
"0.58169234",
"0.5806979",
"0.5764626",
"0.55531573",
"0.55041045",
"0.54878134",
"0.54474247",
"0.53120303",
"0.5305739",
"0.53019416",
"0.5299154",
"0.52925545",
"0.523661",
"0.52243215",
"0.52231264",
"0.5200577",
"0.5195316",
"0.5174... | 0.62516695 | 0 |
PUT /feats/1 PUT /feats/1.xml | def update
#@feat = Feat.find(params[:id])
@feat = @character.feats.find(params[:id])
respond_to do |format|
if @feat.update_attributes(params[:feat])
flash[:notice] = 'Feat was successfully updated.'
format.html { redirect_to(edit_character_path(@character)) }
format.xml { h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def feats_update\n if Config.exists?\n API.upload_feats\n end\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update\n @feefile = Feefile.find(params[:id])\n\n respond_to do |format|\n ... | [
"0.6626324",
"0.6340307",
"0.5929797",
"0.5799284",
"0.5796765",
"0.57871735",
"0.5714316",
"0.5707226",
"0.5700979",
"0.5689943",
"0.568508",
"0.567215",
"0.5650989",
"0.5650989",
"0.5650393",
"0.56263465",
"0.5620273",
"0.5603062",
"0.55446535",
"0.55349493",
"0.55250823",
... | 0.64542544 | 1 |
DELETE /feats/1 DELETE /feats/1.xml | def destroy
#@feat = Feat.find(params[:id])
@feat = @character.feats.find(params[:id])
@feat.destroy
respond_to do |format|
format.html { redirect_to(edit_character_path(@character)) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @feat = @person.feats.find(params[:id])\n @feat.destroy\n\n respond_to do |format|\n format.html { redirect_to(person_feats_url(@person)) }\n format.xml { head :ok }\n end\n end",
"def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end",
"d... | [
"0.7096525",
"0.6720635",
"0.6483355",
"0.64824265",
"0.64355314",
"0.6425962",
"0.63788265",
"0.63184595",
"0.62908393",
"0.6274049",
"0.62526673",
"0.6238299",
"0.6185664",
"0.6182785",
"0.61751384",
"0.61470056",
"0.6141333",
"0.61347204",
"0.6134644",
"0.61006606",
"0.608... | 0.6855455 | 1 |
GET /client_profiles GET /client_profiles.json | def index
@client_profiles = ClientProfile.all
authorize ClientProfile
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @client_profiles = ClientProfile.all\n end",
"def profiles \n personid = params[:id]\n @response = JSON.parse(current_user.access_token.token.get('/api/v0/aspects/profiles?ids=['+params[:id]+']'))\n respond_to do |format|\n format.html\n format.json {render :json=... | [
"0.7600032",
"0.7010263",
"0.6964071",
"0.6911514",
"0.6817861",
"0.6725345",
"0.6717022",
"0.6716054",
"0.6711716",
"0.6673309",
"0.66695815",
"0.6627569",
"0.6627569",
"0.6571033",
"0.6540882",
"0.6501271",
"0.6496163",
"0.6483836",
"0.6454368",
"0.64317626",
"0.6431076",
... | 0.7066529 | 1 |
POST /client_profiles POST /client_profiles.json | def create
@client_profile = current_client.build_client_profile(client_profile_params)
authorize @client_profile
respond_to do |format|
if @client_profile.save
format.html { redirect_to @client_profile, notice: 'Client profile was successfully created.' }
format.json { render :show,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @client_profile = ClientProfile.new(client_profile_params)\n\n respond_to do |format|\n if @client_profile.save\n format.json { render :show, status: :created, location: @client_profile }\n else\n format.json { render json: @client_profile.errors, status: :unp... | [
"0.75950766",
"0.6989375",
"0.6530571",
"0.63997746",
"0.6383759",
"0.6372186",
"0.63159794",
"0.6270599",
"0.622642",
"0.620696",
"0.6149313",
"0.60813195",
"0.6047061",
"0.6032439",
"0.6006447",
"0.6002127",
"0.59745467",
"0.5973002",
"0.596753",
"0.5955531",
"0.59200394",
... | 0.7382159 | 1 |
PATCH/PUT /client_profiles/1 PATCH/PUT /client_profiles/1.json | def update
authorize @client_profile
respond_to do |format|
if @client_profile.update(client_profile_params)
format.html { redirect_to @client_profile, notice: 'Client profile was successfully updated.' }
format.json { render :show, status: :ok, location: @client_profile }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @client_profile.update(client_profile_params)\n format.json { render :show, status: :ok, location: @client_profile }\n else\n format.json { render json: @client_profile.errors, status: :unprocessable_entity }\n end\n end\n ... | [
"0.739365",
"0.6723318",
"0.657502",
"0.64624083",
"0.64601666",
"0.64480466",
"0.64459664",
"0.63586",
"0.6346588",
"0.6324564",
"0.6291774",
"0.62917554",
"0.6271877",
"0.6262125",
"0.6254571",
"0.6247829",
"0.6238143",
"0.62135655",
"0.6201705",
"0.6189819",
"0.6189684",
... | 0.72260207 | 1 |
DELETE /client_profiles/1 DELETE /client_profiles/1.json | def destroy
authorize @client_profile
@client_profile.destroy
respond_to do |format|
format.html { redirect_to client_profiles_url, notice: 'Client profile was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @client_profile.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, :notice => t('alerts.profiles.destroy') }\n format.json { hea... | [
"0.78070754",
"0.6958154",
"0.69051063",
"0.6901378",
"0.68842113",
"0.68839806",
"0.68839806",
"0.68639153",
"0.6858816",
"0.6858816",
"0.6858816",
"0.6857173",
"0.68426687",
"0.68426687",
"0.6828143",
"0.6821593",
"0.6821593",
"0.6821593",
"0.6821593",
"0.6821593",
"0.68215... | 0.757183 | 1 |
generates input output specification for specified radix and number of variables | def specification
0.upto(radix ** @target - 1).each do |target|
0.upto(radix ** number_of_inputs - 1).map do |i|
term = "%s%s" % [to_radix(i), to_radix(target, @target)]
truth = i >= target ? 1 : 0
@output << "%s %s" % [term, truth]
end
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def specification\n 0.upto(number_of_terms-1).map do |i|\n term = to_radix(i) \n truth = i >= constant ? 1 : 0\n output = \"%0#{number_of_outputs}d\" % truth\n\n \"%s %s\" % [term, output]\n end\n end",
"def gen_input_files(fileprefix, nbr_files, nbr_floor... | [
"0.65436643",
"0.5253535",
"0.5048954",
"0.50388724",
"0.5036385",
"0.49443242",
"0.48911846",
"0.48805815",
"0.487549",
"0.4862821",
"0.48586416",
"0.48482478",
"0.4821001",
"0.4809085",
"0.4798397",
"0.47957104",
"0.47906557",
"0.4748808",
"0.47382694",
"0.4738049",
"0.4703... | 0.64150053 | 1 |
PATCH/PUT /reports/1 PATCH/PUT /reports/1.json | def update
respond_to do |format|
if @report.update(report_params)
format.html { redirect_to @report, notice: 'Report was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @report.errors, status... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report}\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n ... | [
"0.6936786",
"0.68570864",
"0.68476593",
"0.68476593",
"0.6841573",
"0.6832132",
"0.6824728",
"0.68218154",
"0.67968696",
"0.6796351",
"0.67753536",
"0.676711",
"0.6761314",
"0.67367345",
"0.67303354",
"0.67303354",
"0.67303354",
"0.67303354",
"0.67303354",
"0.67303354",
"0.6... | 0.6860476 | 1 |
Check to see if the given field should be rendered in this context | def render_field?(field_config)
view_context.should_render_field?(field_config, document)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generic_should_render_field?(config_field, document, field)\n send(:\"should_render_#{config_field}?\", document, field)\n end",
"def generic_should_render_field?(config_field, document, field)\n send(:\"should_render_#{config_field}?\", document, field)\n end",
"def render_field?(field_cfg)\n ... | [
"0.75668985",
"0.75668985",
"0.7286871",
"0.7202176",
"0.71518844",
"0.6440066",
"0.6396924",
"0.6396289",
"0.63869435",
"0.62374616",
"0.61802846",
"0.61676013",
"0.6110263",
"0.5997714",
"0.59909254",
"0.5964404",
"0.59281087",
"0.5922927",
"0.5888646",
"0.5840315",
"0.5828... | 0.7850543 | 0 |
dropdown options to rate a project based on the question | def dropdown_criterion_question(count, answer = nil, questionnaire_min, questionnaire_max)
current_value = ''
current_value += 'data-current-rating =' + answer.answer.to_s unless answer.nil?
html = '<div><select id="responses_' + count.to_s + '_score" name="responses[' + count.to_s + '][score]" class="revie... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def complete(count, answer = nil, questionnaire_min, questionnaire_max, dropdown_or_scale)\n html = '<div><label for=\"responses_' + count.to_s + '\">' + txt + '</label></div>'\n question_advices = QuestionAdvice.where(question_id: id).sort_by(&:id)\n advice_total_length = 0\n question_advices.each do ... | [
"0.63261354",
"0.5610118",
"0.5549561",
"0.55279076",
"0.5524119",
"0.5464334",
"0.54555905",
"0.5408559",
"0.53878826",
"0.53865224",
"0.53836286",
"0.53587127",
"0.53391695",
"0.5334717",
"0.53260356",
"0.5320604",
"0.53030825",
"0.5297885",
"0.52975374",
"0.5296636",
"0.52... | 0.6534724 | 0 |
Calls block once for each key in container, passing the key as a parameter. If no block is given, an enumerator is returned instead. | def each_key(container, &block)
container.each_key(&block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each(&block)\n @items.each_key(&block)\n self\n end",
"def each(&block)\n keys.each(&block)\n end",
"def each_key(&block)\n keys.each(&block)\n end",
"def each(container, &block)\n container.map { |key, value| [key, value.call] }.each(&block)\n end",
"de... | [
"0.7596032",
"0.75672764",
"0.7530193",
"0.73944247",
"0.7199628",
"0.71614087",
"0.7160746",
"0.71513486",
"0.71411693",
"0.7106452",
"0.7061289",
"0.702384",
"0.69840187",
"0.689102",
"0.68664056",
"0.68502307",
"0.6845353",
"0.6736795",
"0.66980195",
"0.6684446",
"0.667790... | 0.7698432 | 0 |
Calls block once for each key in container, passing the key and the registered item parameters. If no block is given, an enumerator is returned instead. | def each(container, &block)
container.map { |key, value| [key, value.call] }.each(&block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each(&block)\n @items.each_key(&block)\n self\n end",
"def each(&block)\n keys.each(&block)\n end",
"def each_key(container, &block)\n container.each_key(&block)\n end",
"def each_key(&block)\n keys.each(&block)\n end",
"def each(&block)\n items.eac... | [
"0.77641773",
"0.74044466",
"0.72652036",
"0.71427983",
"0.71244127",
"0.71244127",
"0.71050763",
"0.70903563",
"0.70885664",
"0.69635767",
"0.6955477",
"0.6952276",
"0.6936168",
"0.69325215",
"0.69164723",
"0.69114643",
"0.6903545",
"0.68635434",
"0.6852625",
"0.68225616",
"... | 0.74380285 | 1 |
Output +string+ to +opts[:stream]+ using +opts[:method]+. | def output(string, opts = {})
opts[:method] ||= 'puts'
opts[:stream] ||= $stdout
opts[:stream].send(opts[:method], string)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write!( string )\n @stream << string\n end",
"def command( opts={} )\n # this allows a global @output var, but to also override that per call\n opts[:output] ||= @output\n\n if @curl\n curl(opts)\n else\n data = rest(opts)\n\n ... | [
"0.626026",
"0.5546882",
"0.5539819",
"0.5539819",
"0.54844624",
"0.5395244",
"0.5367894",
"0.53405845",
"0.53405845",
"0.532663",
"0.5296255",
"0.52955353",
"0.5292561",
"0.5283234",
"0.5264253",
"0.526042",
"0.52382034",
"0.52363914",
"0.52261347",
"0.52261347",
"0.52261347... | 0.7582081 | 0 |
GET /match_assignments GET /match_assignments.json | def index
#Visa endast de kommande matcherna
@matches = Match.where("datum >= ?",Date.today).order(:datum)
respond_to do |format|
format.html # index.html.erb
format.json { render json: @match_assignments }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_assignments\n assignment_ids =[]\n results = CONNECTION.execute(\"SELECT * FROM assignments_links WHERE link_id = #{@id};\")\n results.each do |hash|\n assignment_ids << hash[\"assignment_id\"]\n end\n Assignment.find_many(assignment_ids)\n end",
"def get_assignments(course_... | [
"0.60962063",
"0.6042076",
"0.5945125",
"0.5891926",
"0.5883118",
"0.586271",
"0.58331937",
"0.58286726",
"0.582091",
"0.58145165",
"0.58145165",
"0.58145165",
"0.58145165",
"0.58126104",
"0.5793595",
"0.5748963",
"0.57345164",
"0.5732276",
"0.57262427",
"0.57255656",
"0.5696... | 0.6181186 | 0 |
The constructor seldom need be called directly. There are convenience methods provided to obtain and compare existing population instances. If it becomes necessary to do so, the rank of a population determines its ordering. Those with a lower numerical rank value will be considered "lesser". The begin and end boundarie... | def initialize(rank, begin_, end_, label)
@rank = rank
@begin = begin_
@end = end_
@label = label
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(pos_start, pos_end, label)\n @label = label\n super(pos_start, pos_end)\n end",
"def init_population\n (0...@pop_size).each do\n chromosome = Chromosome.new\n (0...@num_genes).each do |i|\n if @beta_values == 'discrete'\n beta = rand(0..10) / 10.0\n ... | [
"0.5512809",
"0.52605206",
"0.5230921",
"0.52075183",
"0.51635784",
"0.5149068",
"0.51487523",
"0.5108078",
"0.50833356",
"0.49699488",
"0.4928819",
"0.49232534",
"0.48923308",
"0.48414996",
"0.4834074",
"0.47614008",
"0.47548717",
"0.47407442",
"0.47380027",
"0.47240296",
"0... | 0.59557474 | 0 |
Hanya display skill dengan bootstrap label Lain kegunaan nya dengan job_helpershow_required_skills | def skills_display_label
ret = ''
self.skills.each do |s|
ret += "<span class='label label-default label-type-1'>#{s.name}</span>"
end
return ret
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_skill_name\n \"#{skill_category} > #{skill_subcategory} > #{skill_description}\"\n end",
"def display_skill_tb(name)\n return @skill_disp_win.hide if name.nil?\n @skill_disp_win.text= name\n @skill_disp_win.show\n end",
"def matched_skill\n text = ''\n counter = 0.0\n skills = s... | [
"0.6923139",
"0.62266207",
"0.62176514",
"0.6167227",
"0.61218876",
"0.6088648",
"0.60362303",
"0.58682203",
"0.5845693",
"0.5829132",
"0.58130354",
"0.58034647",
"0.57128537",
"0.5709096",
"0.56885874",
"0.5677781",
"0.56500065",
"0.5623104",
"0.56035024",
"0.55829096",
"0.5... | 0.7537654 | 0 |
get locale based on country phone number | def locale
(self.country.blank? or self.country.indonesia?) ? :id : :en
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_phone_number(phone)\n parsed_phone = Phonelib.parse(phone)\n\n if parsed_phone.country == Phonelib.default_country\n parsed_phone.local_number\n else\n parsed_phone.full_international\n end\n end",
"def phone_number(nr)\n country_code = AppConfig['contact_info.default_country... | [
"0.73852223",
"0.73133117",
"0.71372986",
"0.69938475",
"0.69362015",
"0.6835804",
"0.6784247",
"0.6769231",
"0.67599916",
"0.6730269",
"0.6668719",
"0.6668466",
"0.6665473",
"0.66269165",
"0.66199696",
"0.6602579",
"0.6590162",
"0.6589116",
"0.6581794",
"0.65418947",
"0.6507... | 0.7566736 | 0 |
count workspace message unread | def workspace_unread_count
unread = 0
workspaces = WorkspaceLancer.or(
{ employer_username: self.username },
{ freelancer_username: self.username },
{ service_provider_username: self.username }
)
# Count each message as unread
if workspaces.any?
workspaces.each do |w|
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unread_count\n @status = Messenger.inbox_status(current_user)\n return_message(200, :ok, :count => @status[:unread])\n end",
"def unread_message_count\n eval 'messages.count(:conditions => [\"recepient_id = ? AND read_at IS NULL\", self.beamer_id])'\n end",
"def unread_messages_count\n ... | [
"0.78003794",
"0.7789848",
"0.7603618",
"0.7571877",
"0.7523162",
"0.7356069",
"0.7349882",
"0.7279969",
"0.72527635",
"0.7151038",
"0.7151038",
"0.7151038",
"0.7146436",
"0.7093433",
"0.7031792",
"0.7029249",
"0.7002605",
"0.6972878",
"0.6954677",
"0.6928026",
"0.69211596",
... | 0.84305745 | 0 |
check if user has one default payout method set | def has_default_payout_method?
self.payout_methods.active_only.each do |pm|
return true if pm.default?
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_default\n self.member.payout_methods.active_only.each do |pm|\n pm.update_attribute(:default, false) if pm.default?\n end\n self.update_attribute(:default, true)\n end",
"def payments?\n user_record? || payment_admin? || super_admin?\n end",
"def can_supply?\n payment_received? ||... | [
"0.6707176",
"0.6457045",
"0.64068586",
"0.637124",
"0.6347861",
"0.6345907",
"0.62136984",
"0.6200123",
"0.61762404",
"0.6169714",
"0.61073864",
"0.6105508",
"0.6051726",
"0.6050573",
"0.6034448",
"0.60127693",
"0.6003666",
"0.59891564",
"0.59866667",
"0.5980963",
"0.597748"... | 0.8382934 | 0 |
method to populate email validation key for new account | def generate_email_validation_key
self.email_validation_key = SecureRandom.base64(8) if !self.for_testing?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_email_validation_key\n # Auto activated for employer\n # self.email_validation_key = SecureRandom.base64(8)\n end",
"def email_key\n \"zDMSATq0W3hmA5p3rKTgD\"\n end",
"def generate_validation_key\n self.validation_key = SecureRandom.base64(8)\n end",
"def generate_email_token\... | [
"0.8172597",
"0.6907386",
"0.6733388",
"0.67147785",
"0.662316",
"0.66213244",
"0.6526713",
"0.6444124",
"0.63925415",
"0.63872343",
"0.63783383",
"0.6355427",
"0.62872106",
"0.62606186",
"0.6256889",
"0.6201581",
"0.61889845",
"0.6148379",
"0.6146447",
"0.6134833",
"0.609133... | 0.76723063 | 1 |
check if member is new and from short registration form | def new_and_short_form?
self.new_record? and self.short_registration_form?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isnew?\n if Admin.new\n return false \n else\n return true \n end \n end",
"def is_registered?\n # keep track of where we are: if no password in db\n # it means we still are at the registration step\n\n # Note that we use the \"_was\" suffix here (AR::Dirty) to chec... | [
"0.6633055",
"0.6591147",
"0.655743",
"0.6521311",
"0.6496671",
"0.64661074",
"0.64323527",
"0.64289826",
"0.6415758",
"0.64118004",
"0.6400712",
"0.6382694",
"0.63226295",
"0.6308698",
"0.62954867",
"0.6292804",
"0.6273043",
"0.6267122",
"0.6261048",
"0.6260377",
"0.62486464... | 0.74676174 | 0 |
make sure number of skills entered by freelancer is within range | def check_skills_count
if !self.new_record? and self.freelancer? and (self.skills.count > SKILLS_MAXIMUM or self.skills.count < SKILLS_MINIMUM)
errors.add(:skills, I18n.t('members.validation.maximum_skills', minimum: SKILLS_MINIMUM, maximum: SKILLS_MAXIMUM))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_skill_levels\n %w[beginner intermediate expert]\n end",
"def experience?(candidates)\n candidates[:years_of_experience] >= 2\nend",
"def isSkillUsable()\n if( @enemy != nil && @skill != nil )\n if(! @skill.isOverLimit ) \n if( @enemy.fire_magic >= @skill.fire_cost &&\n ... | [
"0.6638349",
"0.6438789",
"0.6423734",
"0.63554794",
"0.6333524",
"0.61865544",
"0.6175882",
"0.6111318",
"0.61032945",
"0.6094645",
"0.60636145",
"0.60523677",
"0.60197234",
"0.60130435",
"0.6011181",
"0.6001164",
"0.5990699",
"0.59829634",
"0.59571135",
"0.59364504",
"0.592... | 0.77568763 | 0 |
Removes a previous defined classlevel argument. If `:undefine` option is given, undefines accessors as well. | def remove_class_argument *names, undefine: false
remove_argument_from *names, scope: class_arguments, undefine: undefine
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_method_argument *names, undefine: false\n remove_argument_from *names, scope: method_arguments, undefine: undefine\n end",
"def remove( *args )\n args.each { |name|\n name = name.to_s.delete('=')\n code = <<-__\n undef_method :#{name} rescue nil\n undef_met... | [
"0.63200957",
"0.58921623",
"0.5713419",
"0.5545181",
"0.54056543",
"0.5344428",
"0.5275369",
"0.51576966",
"0.51334935",
"0.51166975",
"0.51166975",
"0.5106161",
"0.50921744",
"0.5001879",
"0.5001879",
"0.4973572",
"0.4973572",
"0.49494672",
"0.49358147",
"0.4925773",
"0.492... | 0.7234259 | 0 |
Removes a previous defined classlevel argument. If `:undefine` option is given, undefines accessors as well. | def remove_method_argument *names, undefine: false
remove_argument_from *names, scope: method_arguments, undefine: undefine
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_class_argument *names, undefine: false\n remove_argument_from *names, scope: class_arguments, undefine: undefine\n end",
"def remove( *args )\n args.each { |name|\n name = name.to_s.delete('=')\n code = <<-__\n undef_method :#{name} rescue nil\n undef_metho... | [
"0.7236237",
"0.5894596",
"0.5714844",
"0.5549619",
"0.54070365",
"0.5345424",
"0.5274625",
"0.5160617",
"0.5135999",
"0.5118377",
"0.5118377",
"0.5107531",
"0.5093708",
"0.50043756",
"0.50043756",
"0.4976068",
"0.4976068",
"0.49511942",
"0.49394697",
"0.49272165",
"0.4924236... | 0.6320947 | 1 |
GET /base_objectives GET /base_objectives.json | def index
@base_objectives = BaseObjective.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @objectives = current_user.objectives.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @objectives }\n end\n end",
"def index\n @objectives = @goal.objectives.all \n render json: @objectives \n end",
"def index\n @obj... | [
"0.72500247",
"0.71793973",
"0.6389835",
"0.62737876",
"0.59424025",
"0.5933897",
"0.5918472",
"0.5745863",
"0.5687788",
"0.56369877",
"0.5636856",
"0.56051445",
"0.55436903",
"0.5501866",
"0.5489028",
"0.5487635",
"0.548759",
"0.5460541",
"0.54602367",
"0.5459567",
"0.544811... | 0.7464064 | 0 |
POST /base_objectives POST /base_objectives.json | def create
@base_objective = BaseObjective.new(base_objective_params)
if @base_objective.save
head 200
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @objective = @goal.objectives.create(objective_params)\n render json: @objective\n end",
"def create\n @objective = Objective.new(objective_params)\n\n respond_to do |format|\n if @objective.save\n format.html { redirect_to objectives_path }\n format.json { ... | [
"0.6825394",
"0.64863807",
"0.6452908",
"0.64048207",
"0.63079864",
"0.61636907",
"0.5946038",
"0.57084256",
"0.5686148",
"0.56593084",
"0.56295085",
"0.5533651",
"0.5507142",
"0.53683156",
"0.53456235",
"0.53432775",
"0.52953374",
"0.529343",
"0.5232069",
"0.5218339",
"0.521... | 0.6815195 | 1 |
PATCH/PUT /base_objectives/1 PATCH/PUT /base_objectives/1.json | def update
if @base_objective.update(base_objective_params)
head 200
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def partial_update_object(object, objectID = nil, create_if_not_exits = true, request_options = {})\n client.post(Protocol.partial_object_uri(name, get_objectID(object, objectID), create_if_not_exits), object.to_json, :write, request_options)\n end",
"def update\n @objective = Objective.find(params[:i... | [
"0.6152966",
"0.60693026",
"0.60191107",
"0.6005519",
"0.5999466",
"0.5975532",
"0.59718496",
"0.5905444",
"0.58501023",
"0.58309805",
"0.5816491",
"0.5811117",
"0.5794356",
"0.57893544",
"0.5758258",
"0.5758258",
"0.57556456",
"0.5745412",
"0.5737614",
"0.57292956",
"0.57108... | 0.66952235 | 0 |
DELETE /base_objectives/1 DELETE /base_objectives/1.json | def destroy
@base_objective.destroy
respond_to do |format|
format.html { redirect_to base_objectives_url, notice: 'Base objective was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @objective = Objective.find(params[:id])\n @objective.destroy\n\n respond_to do |format|\n format.html { redirect_to objectives_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @objective = Objective.find(params[:id])\n @objective.destroy\n ... | [
"0.72966784",
"0.70100754",
"0.69939333",
"0.69767565",
"0.6938901",
"0.6906795",
"0.683966",
"0.6752534",
"0.67149276",
"0.67149276",
"0.67149276",
"0.67149276",
"0.663897",
"0.66253",
"0.6610453",
"0.66036075",
"0.6556331",
"0.65448517",
"0.651192",
"0.65097624",
"0.6488370... | 0.7553116 | 0 |
Extract web service port from the url. For example: " > 443 | def url_2_port (url)
puts "Retrieve service port on URL: #{url}" if @verbose
begin
ssl = (url =~ /https/i)
url = url.downcase.gsub(/(http:\/\/|https:\/\/)/, "")
record1 = url.split('/')
record2 = record1[0].split(':')
if (record2.length == 2)
puts "The service port: #{record2[1]}" if @verbose
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPort()\n return @uri.port\n end",
"def port_string\n (protocol == 'http://' && port == 80) || (protocol == 'https://' && port == 443) ? '' : \":#{port}\"\n end",
"def parse_url(url)\n unless V4_IP_REGEX === url\n uri = URI.parse(url)\n if uri.scheme && uri.host\n ra... | [
"0.71626866",
"0.6960445",
"0.68550605",
"0.67715466",
"0.67230743",
"0.6722909",
"0.66809666",
"0.6660402",
"0.6586451",
"0.65579957",
"0.6509193",
"0.6489236",
"0.6484594",
"0.64350766",
"0.63866776",
"0.6380416",
"0.63313985",
"0.6321138",
"0.62963736",
"0.628104",
"0.6251... | 0.8270688 | 0 |
Extract site in (host:port) format from a url: " > " | def url_2_site (url)
puts "Retrieve the web site base for url: #{url}" if @verbose
begin
url = url.downcase
url = url.sub(/^(.*?)http/i,'http')
entry = url.split(%r{\/\/})
prot=entry[0]
# step 1, extract the host:port pair from the url
host_port=entry[1].split(%r{\/})[0]
if host_port =~ /\:/
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_host_name(url)\n\tmatch = %r|(https?://)?(?<host>[^/]+)(/.*$)?|.match(url)\n\tmatch['host']\nend",
"def get_host_from_url(url)\n return url[0...url.index(\"/\")]\nend",
"def parse_url(url)\n if url.match(%r|([^/]+)(/.*)|)\n host = $1\n uri = $2\n end\n # Gegebenenfalls Host und Portnummer trennen... | [
"0.719812",
"0.7029715",
"0.7025208",
"0.7025208",
"0.6982407",
"0.685205",
"0.6664715",
"0.66066873",
"0.65793836",
"0.6557214",
"0.655143",
"0.65073967",
"0.6482678",
"0.64265645",
"0.64056057",
"0.63796145",
"0.63589287",
"0.63472515",
"0.63071954",
"0.6295614",
"0.624658"... | 0.70484 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.