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 |
|---|---|---|---|---|---|---|
Description Main page of the section 'elements'. When it's called via ajax it's because of the application of filters, paginations, or after an operation that changed the number of items in the page. Mode Html + Ajax Specific filters ApplicationControllerinitialize_layout MediaElementsControllerinitialize_paginator | def index
get_own_media_elements
if @page > @pages_amount && @pages_amount != 0
@page = @pages_amount
get_own_media_elements
end
render_js_or_html_index
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @page_elements = @page.page_elements\n if (@page)\n @mainelements = @page.page_elements.where(visible: true,sidebar: false)\n @sidebarelements = @page.page_elements.where(visible:true,sidebar: true)\n end\n if(@mainelemnents) && (@mainelements.count > 1)\n @mainelements = @ma... | [
"0.625409",
"0.61387765",
"0.6132003",
"0.6017818",
"0.59001946",
"0.5831664",
"0.5740247",
"0.5725626",
"0.5712588",
"0.5699596",
"0.5685144",
"0.5675316",
"0.56638634",
"0.5645248",
"0.55774915",
"0.5576835",
"0.5566876",
"0.55541265",
"0.5545101",
"0.55389386",
"0.55271435... | 0.64609236 | 0 |
Description Opens the general page of the elements editor: the video icon redirects to VideoEditorControllernew the audio icon redirects to AudioEditorControllernew the image icon redirects to GalleriesControllerimage_for_image_editor (and successively to ImageEditorControlleredit) Mode Html | def new
render :layout => 'media_element_editor'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preview\n \n # @lg = PageTag::PageGenerator.previewer( @menu, @theme, {:resource=>(@resource.nil? ? nil:@resource),:controller=>self})\n # html = @lg.generate\n # css,js = @lg.generate_assets \n #insert css to html\n # style = %Q!<style type=\"text/css\">#{css}</style>!\n ... | [
"0.6211096",
"0.5943301",
"0.584834",
"0.5838946",
"0.5833649",
"0.57943696",
"0.57561123",
"0.57561123",
"0.5717198",
"0.56711775",
"0.5628239",
"0.5617931",
"0.5597701",
"0.5596176",
"0.557289",
"0.55670696",
"0.55634266",
"0.5531548",
"0.5519143",
"0.5514199",
"0.5507684",... | 0.63153374 | 0 |
Description Adds a link of this element to your section. found: reloads the element in compact mode compact: [this action doesn't occur] expanded: removes the element and reloads the whole page Mode Ajax + Json Specific filters ApplicationControllerinitialize_media_element ApplicationControllerinitialize_media_element_... | def add
@ok_msg = t('other_popup_messages.correct.add.media_element')
if @ok
if !current_user.bookmark('MediaElement', @media_element_id)
@ok = false
@error = I18n.t('activerecord.errors.models.bookmark.problem_creating_for_media_element')
end
else
@error = I18n.t('activere... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_new_content_link(element)\n\t\t\t\tlink_to_overlay_window(\n\t\t\t\t\trender_icon('create') + t('add new content'),\n\t\t\t\t\talchemy.new_admin_element_content_path(element),\n\t\t\t\t\t{\n\t\t\t\t\t\t:size => '335x70',\n\t\t\t\t\t\t:title => t('Select an content'),\n\t\t\t\t\t\t:overflow => true\n\t\t... | [
"0.5843755",
"0.5815826",
"0.57196784",
"0.5506087",
"0.53053194",
"0.5248692",
"0.5224908",
"0.51986885",
"0.51724136",
"0.51460075",
"0.50608623",
"0.50183207",
"0.49998343",
"0.4998185",
"0.49402708",
"0.49364203",
"0.49209848",
"0.4889916",
"0.48832592",
"0.48704955",
"0.... | 0.5955865 | 0 |
Description Removes the link of this element from your section. found: reloads the element in compact mode compact: removes the element and reloads the whole page expanded: removes the element and reloads the whole page Mode Ajax + Json Specific filters ApplicationControllerinitialize_media_element ApplicationControlle... | def remove
@ok_msg = t('other_popup_messages.correct.remove.media_element')
if @ok
bookmark = Bookmark.where(:user_id => current_user.id, :bookmarkable_type => 'MediaElement', :bookmarkable_id => @media_element_id).first
if bookmark.nil?
@ok = false
@error = I18n.t('activerecord.erro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @element = @page.all_elements.find(params[:id])\n # Start by removing the element from the page\n page_element = Fe::PageElement.where(:element_id => @element.id, :page_id => @page.id).first\n page_element.destroy if page_element\n\n # If this element is not on any other pages, is not ... | [
"0.6071593",
"0.57807547",
"0.5600696",
"0.55835575",
"0.5526149",
"0.55047345",
"0.543671",
"0.5432676",
"0.5417777",
"0.53990537",
"0.5340022",
"0.5313041",
"0.5259157",
"0.52519363",
"0.5238161",
"0.5231691",
"0.52297837",
"0.5223814",
"0.5210044",
"0.5190807",
"0.5190292"... | 0.67451316 | 0 |
Description Updates the general information of the element (title, description and tags) Mode Ajax Specific filters ApplicationControllerinitialize_media_element_with_owner_and_private | def update
if @ok
@media_element.title = params[:title]
@media_element.description = params[:description]
@media_element.tags = params[:tags_value]
@media_element.save_tags = true
if !@media_element.save
@errors = convert_media_element_error_messages @media_element.errors
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit_description\n self.div(:id=>\"contentmetadata_description_container\").fire_event \"onmouseover\"\n self.div(:id=>\"contentmetadata_description_container\").fire_event \"onclick\"\n end",
"def update\n params[:description][:author_ids] ||= []\n @description = Description.find(params[:id])\n... | [
"0.5705707",
"0.5652698",
"0.5647921",
"0.5594134",
"0.55600524",
"0.5498407",
"0.54231143",
"0.53772646",
"0.53547984",
"0.5341152",
"0.53327996",
"0.5322458",
"0.5298105",
"0.5264204",
"0.5262664",
"0.5225102",
"0.5189534",
"0.5179718",
"0.51662725",
"0.51457626",
"0.510787... | 0.6263109 | 0 |
Gets media elements using Userown_media_elements | def get_own_media_elements
current_user_own_media_elements = current_user.own_media_elements(@page, @for_page, @filter)
@media_elements = current_user_own_media_elements[:records]
@pages_amount = current_user_own_media_elements[:pages_amount]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_media_elements(page)\n MediaElement.joins(:taggings).where(:taggings => {:tag_id => self.id}).order('media_elements.updated_at DESC').page(page)\n end",
"def media_elements_at\n case self.kind\n when AUDIO, VIDEO1, VIDEO2\n resp = self.media_elements_slides.first\n resp.nil? ? n... | [
"0.71667904",
"0.69947106",
"0.6593392",
"0.65456766",
"0.6522452",
"0.6473865",
"0.646598",
"0.64359754",
"0.63486004",
"0.61855525",
"0.61852956",
"0.61313766",
"0.6085632",
"0.6076357",
"0.6076312",
"0.60489213",
"0.6029287",
"0.60000145",
"0.5949952",
"0.5942411",
"0.5934... | 0.79123586 | 0 |
GET /action_states GET /action_states.json | def index
@action_states = ActionState.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_states\n perform(:get, 'enum/states', nil, nonauth_headers).body\n end",
"def get_state\n @states = State.find_state(params[:id])\n respond_to do |format|\n format.json { render :json => @states }\n end\n end",
"def index\n @api_states = Api::State.all\n end",
"def... | [
"0.7573909",
"0.7290489",
"0.7100373",
"0.6914498",
"0.68387026",
"0.68236977",
"0.68236977",
"0.68236977",
"0.68236977",
"0.68236977",
"0.6608056",
"0.6543935",
"0.65251696",
"0.6519283",
"0.64381415",
"0.6428163",
"0.6417171",
"0.6399927",
"0.63791746",
"0.63791746",
"0.636... | 0.7819178 | 0 |
POST /action_states POST /action_states.json | def create
@action_state = ActionState.new(action_state_params)
respond_to do |format|
if @action_state.save
format.html { redirect_to [project, @action_state], notice: 'Action state was successfully created.' }
format.json { render :show, status: :created, location: @action_state }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @action_states = ActionState.all\n end",
"def create\n @state = State.new(state_params)\n\n if @state.save\n render json: @state, status: :created, location: @state\n # 'state was successfully created.'\n else\n render json: @state.errors, status: :unprocessable_entity\n ... | [
"0.6681765",
"0.6533226",
"0.6487266",
"0.64165443",
"0.64110124",
"0.63889223",
"0.63889223",
"0.6381537",
"0.63767755",
"0.6347029",
"0.6346201",
"0.6326781",
"0.6256764",
"0.6248286",
"0.6225454",
"0.62234485",
"0.62085706",
"0.6071389",
"0.60122657",
"0.60032153",
"0.6002... | 0.68875045 | 0 |
PATCH/PUT /action_states/1 PATCH/PUT /action_states/1.json | def update
respond_to do |format|
if @action_state.update(action_state_params)
format.html { redirect_to [project, @action_state], notice: 'Action state was successfully updated.' }
format.json { render :show, status: :ok, location: @action_state }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @state.update(state_params)\n format.html { redirect_to @state, notice: 'State was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @state.errors,... | [
"0.68128395",
"0.67845887",
"0.67845887",
"0.67845887",
"0.67651767",
"0.67571896",
"0.67542475",
"0.66479415",
"0.66479415",
"0.6631263",
"0.6543808",
"0.6541712",
"0.64760345",
"0.63940316",
"0.6382878",
"0.6354047",
"0.62879497",
"0.62710017",
"0.6259483",
"0.62157136",
"0... | 0.71217287 | 0 |
current_organisation returns organisation obj for current organisation return nil if no current organisation defined | def current_organisation()
begin
organisation = (
Thread.current[:organisation_id].blank? ?
nil :
Organisation.find( Thread.current[:organisation_id] )
)
return organisation
rescue ActiveRecord::RecordNotFound
return nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_org\n current_user&.org\n end",
"def set_current_organisation( organisation )\n # able to handle organisation obj or organisation_id\n #case organisation\n # when Organisation then organisation_id = organisation.id\n # when Integer then organisation_id = organisation\n ... | [
"0.7711881",
"0.76772815",
"0.7624038",
"0.7284386",
"0.72407955",
"0.72248566",
"0.6995413",
"0.6935735",
"0.6915876",
"0.6709824",
"0.66519535",
"0.66405255",
"0.6632705",
"0.6632705",
"0.6558245",
"0.6423801",
"0.6405801",
"0.63878894",
"0.63841444",
"0.6370104",
"0.635101... | 0.8878894 | 0 |
current_organisation_id returns organisation_id for current organisation | def current_organisation_id()
return Thread.current[:organisation_id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_organisation()\n begin\n organisation = (\n Thread.current[:organisation_id].blank? ?\n nil :\n Organisation.find( Thread.current[:organisation_id] )\n )\n\n return organisation\n\n rescue ActiveRecord::RecordNotFound\n return nil\n ... | [
"0.81824243",
"0.80198395",
"0.75833",
"0.75296277",
"0.7467459",
"0.729725",
"0.72417474",
"0.6995078",
"0.6897121",
"0.68032783",
"0.6752774",
"0.67313534",
"0.6719804",
"0.6719804",
"0.6719804",
"0.67147934",
"0.6714425",
"0.65651304",
"0.6557183",
"0.6556622",
"0.6556622"... | 0.83400047 | 0 |
set_current_organisation modellevel ability to set the current organisation NOTE: USE WITH CAUTION normally this should NEVER be done from the models ... it's only useful and safe WHEN performed at the start of a background job (DelayedJobperform) | def set_current_organisation( organisation )
# able to handle organisation obj or organisation_id
#case organisation
# when Organisation then organisation_id = organisation.id
# when Integer then organisation_id = organisation
# when Array then organisation_id = organisation
# el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_organisation\n @organisation = Organisation.find(params[:organisation_id]) if params[:organisation_id]\n end",
"def set_organisation\n raise \"You must set the organisation\" if session[:organisation].blank?\n OrganisationSession.set session[:organisation]\n end",
"def set_organization\n... | [
"0.6453708",
"0.64062",
"0.62416416",
"0.6211622",
"0.6211622",
"0.6211622",
"0.6205148",
"0.60366184",
"0.58874464",
"0.57556295",
"0.57506716",
"0.5725723",
"0.5718173",
"0.56490356",
"0.56490356",
"0.56490356",
"0.5634117",
"0.56214094",
"0.5598364",
"0.5596463",
"0.557060... | 0.72130495 | 0 |
where_restrict_organisation gens organisation restrictive where clause for each klass NOTE: subordinate join tables will not get the default scope by Rails theoretically, the default scope on the master table alone should be sufficient in restricting answers to the current_organisation alone .. HOWEVER, it doesn't feel... | def where_restrict_organisation(*args)
args.map{|klass| "#{klass.table_name}.organisation_id = #{Thread.current[:organisation_id]}"}.join(" AND ")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_filter_by_associations_window_function_limit_strategy(ds)\n ds.where(filter_by_associations_limit_key=>apply_window_function_eager_limit_strategy(associated_eager_dataset.select(*filter_by_associations_limit_alias_key)).select(*filter_by_associations_limit_aliases))\n end",
"def apply_f... | [
"0.5719611",
"0.5646677",
"0.55646676",
"0.55289453",
"0.5404927",
"0.5376554",
"0.5335817",
"0.53332233",
"0.5321977",
"0.52638996",
"0.524178",
"0.5206978",
"0.52049476",
"0.52001715",
"0.51796716",
"0.5166633",
"0.5142932",
"0.5134657",
"0.5118139",
"0.5098712",
"0.5068207... | 0.8168442 | 0 |
Pass target to the scope handler of the specified type and name. If `name` is not specified then `:default` name is used. If `type` is not specified then we try to infer the type from the target class. | def apply_scope(target, type:, name: :default, scope_options: nil)
raise ActionPolicy::UnknownScopeType.new(self.class, type) unless
self.class.scoping_handlers.key?(type)
raise ActionPolicy::UnknownNamedScope.new(self.class, type, name) unless
self.class.scoping_handlers[type].key?... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bind_name(name, type)\n @names[name.to_sym] = type unless name.nil?\n end",
"def authorization_scope_type_for(policy, target)\n policy.resolve_scope_type(target)\n end",
"def target\n @target ||= case scope\n when '#'\n klass\n when '.'\n klass && klass.... | [
"0.5854092",
"0.54851234",
"0.54614395",
"0.5429654",
"0.5369638",
"0.53256947",
"0.52948576",
"0.5201738",
"0.5185947",
"0.5157362",
"0.51186293",
"0.50766975",
"0.5053053",
"0.5030344",
"0.500551",
"0.4995355",
"0.49022508",
"0.48995999",
"0.48943287",
"0.48399782",
"0.4834... | 0.7343106 | 0 |
Define scope type matcher. Scope matcher is an object that implements `===` (_case equality_) or a Proc. When no type is provided when applying a scope we try to infer a type from the target object by calling matchers one by one until we find a matching type (i.e. there is a matcher which returns `true` when applying i... | def scope_matcher(type, class_or_proc)
scope_matchers << [type, class_or_proc]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def applies_type?(scope, type); end",
"def type_matcher(mod)\n TypeMatcher.new(mod)\n end",
"def scope_type(node); end",
"def call_scope_by_type(type, scope, target, value, options) #:nodoc:\n if type == :boolean\n target.send(scope)\n elsif value && options.key?(:using)\n ... | [
"0.6947657",
"0.6124443",
"0.5949851",
"0.58142024",
"0.56766033",
"0.5673048",
"0.5441659",
"0.53827775",
"0.5366719",
"0.5353178",
"0.5302973",
"0.5300918",
"0.5299004",
"0.5231972",
"0.52060634",
"0.5149539",
"0.5135744",
"0.5116606",
"0.51091224",
"0.5091886",
"0.5006744"... | 0.7371604 | 0 |
Main method for getting all Available TimeBlock(s) for a given date. +:base_time: DateTime used for determining the base scan date range. | def available_on(base_time)
# Stash this for future use, as we will be using it to set a
# baseline date in order to derive a bunch of different appointments
# from.
set_base_time(base_time)
# Fetch all TimeEntris related for this date query.
time_entries = time_entries_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_blocks(base_time)\n set_base_time(base_time)\n time_entries = time_entries_for(base)\n end",
"def available_delivery_blocks(time)\n\n unless opens_today\n return []\n end\n\n # Reset date to compare with Postgres Time\n time = time.change(:month => 1, :day => 1, :yea... | [
"0.70361656",
"0.67197216",
"0.6327685",
"0.5927963",
"0.5920603",
"0.58066165",
"0.57762384",
"0.5687271",
"0.5667841",
"0.56143665",
"0.5585009",
"0.5533882",
"0.55060583",
"0.55009145",
"0.5492323",
"0.5470167",
"0.54546696",
"0.5426355",
"0.5423387",
"0.53829724",
"0.5328... | 0.718394 | 0 |
Public api for returning all collisions for a given Range. The Range is transformed into a TimeBlock, and then pushed through the pipeline for natural detection of any collisions. | def collisions_for(range)
collider.detect TimeBlock.new(
start_time: range.begin,
end_time: range.end,
session: @session)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collide_hash_all(hash_rects)\n hash_rects.select { |key,value|\n value.collide_rect?+(self)\n }\n end",
"def collisions(rect)\n remain = visible_sprites(rect).to_a\n coll = remain.select { |item| item.intersect_rect? rect }\n [coll, coll - remain]\n end",
"def collisions\n ... | [
"0.6032244",
"0.5861564",
"0.5708567",
"0.56075084",
"0.5579013",
"0.5519869",
"0.54588366",
"0.5458093",
"0.5350583",
"0.52792895",
"0.5246726",
"0.5141044",
"0.50969744",
"0.5044568",
"0.5018214",
"0.49943906",
"0.49637446",
"0.49148008",
"0.49016166",
"0.48722035",
"0.4865... | 0.78286237 | 0 |
Return all valid TimeBlock(s) for a given base time. | def valid_blocks(base_time)
set_base_time(base_time)
time_entries = time_entries_for(base)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_time_blocks(time_blocks)\n b = time_blocks.select(&:collision_free?)\n\n # Test environment has unreliable data entry for start times.\n b = b.select(&:in_future?) unless Rails.env.test?\n\n b\n end",
"def available_delivery_blocks(time)\n\n unless opens_today\n ... | [
"0.6995972",
"0.666866",
"0.61515516",
"0.60989684",
"0.6043392",
"0.6019025",
"0.57999414",
"0.5793993",
"0.5751547",
"0.56786937",
"0.5677315",
"0.5637624",
"0.5597517",
"0.55707026",
"0.55529094",
"0.5491499",
"0.5484656",
"0.5475232",
"0.54654413",
"0.5422617",
"0.5392022... | 0.8538772 | 0 |
Returns all valid Appointments for a given base time. | def valid_appointments(base_time)
transform_blocks_to_appointments(valid_blocks(base_time))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_appointments\n # Appointment\n return unless current_user\n @appointments = current_user.appointments\n\n clean_open_appointments = sanatize_open_appointments(current_user.open_appointments)\n @pending_requests = clean_open_appointments.group_by do |d|\n start_date = set_in_timezone(d.... | [
"0.7045828",
"0.6885598",
"0.6717285",
"0.6605498",
"0.6413851",
"0.63946986",
"0.63369745",
"0.6309198",
"0.6276353",
"0.6226337",
"0.61962336",
"0.61922294",
"0.6171634",
"0.6166286",
"0.6164967",
"0.616016",
"0.60806805",
"0.60776097",
"0.6060947",
"0.60355353",
"0.6013217... | 0.8377896 | 0 |
Get all TimeEntry(s) that match the current session properties. +:target_date+ A DateTime to base the TimeEntry collection query from. | def time_entries_for(target_date)
target_day = Skej::NLP.parse(session, target_date.to_s)
.strftime('%A')
.downcase
.to_sym
TimeEntry.where(build_query_params).with_day(target_day).map do |entry|
entry.se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_entries\n get_ticket_property_list(\"time_entries\" , Unfuddled::TimeEntry)\n end",
"def get_time_entries(start_date=nil, end_date=nil)\n options = Hash.new\n options[\"start_date\"] = iso8601_date(start_date) if start_date\n options[\"end_date\"] = iso8601_date(end_date) if... | [
"0.5922868",
"0.5683903",
"0.5566405",
"0.53385276",
"0.5298395",
"0.52521545",
"0.5115447",
"0.50400954",
"0.48718688",
"0.48286006",
"0.48045316",
"0.48045316",
"0.4798784",
"0.47657496",
"0.47596595",
"0.4755274",
"0.4742012",
"0.4742012",
"0.4742012",
"0.47243476",
"0.471... | 0.8224443 | 0 |
Produces TimeSlot(s) from a collection of TimeEntries | def generate_time_slots(time_entries)
time_entries.map { |entry| extract_available_slots(entry) }.flatten
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_slots_for(time_entry)\n count = (duration_for(time_entry.range) / block_size).floor.to_i\n time = time_entry.start_time\n\n slots = count.times.map do |i|\n # Instantiate a new TimeSlot out of thin air (no backing store)\n slot = TimeSlot.new time, time + block_size.... | [
"0.73997855",
"0.7293364",
"0.6935869",
"0.6710855",
"0.65502787",
"0.6529408",
"0.62408537",
"0.6206863",
"0.60246116",
"0.60169065",
"0.6007946",
"0.6006138",
"0.59570074",
"0.59515446",
"0.5933802",
"0.5849529",
"0.5832255",
"0.57931644",
"0.57828283",
"0.57533526",
"0.573... | 0.7823904 | 0 |
Responsible combining a collection of slots into common groups, defined by touching boundaries. +:slots: Array / Collection of TimeSlot(s) | def combine_linear_slots(slots)
last_slot = false
end_time = false
start_time = false
flushed = false # Tracks the current continuity chain
count = 0
aggregate = []
debug = []
slots.sort_by(&:start_time).each_with_index do |slot, i|
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_ranges(schedule)\n merged_schedule = []\n\n schedule.each do |meeting|\n overlapping_time_slots = check_times(meeting, merged_schedule)\n merged_schedule -= overlapping_time_slots if merged_schedule.include?(overlapping_time_slots)\n merged_schedule << slot_merger(overlapping_time_slots)\n en... | [
"0.6928598",
"0.6598432",
"0.6556763",
"0.62836176",
"0.61598545",
"0.61425924",
"0.61248326",
"0.59110165",
"0.5904596",
"0.5904228",
"0.5902116",
"0.58843243",
"0.58529955",
"0.5809075",
"0.5797486",
"0.57824683",
"0.57600373",
"0.57475156",
"0.56936073",
"0.56116503",
"0.5... | 0.7387607 | 0 |
Given a collection of TimeBlock(s), return only the ones that have no detectable collisions (and thus are valid). +:time_blocks+ All extracted TimeBlock(s) you wish to have validated. | def validate_time_blocks(time_blocks)
b = time_blocks.select(&:collision_free?)
# Test environment has unreliable data entry for start times.
b = b.select(&:in_future?) unless Rails.env.test?
b
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_blocks(base_time)\n set_base_time(base_time)\n time_entries = time_entries_for(base)\n end",
"def valid_schedule?(time_blocks)\n time_blocks = quicksort_timeblocks(time_blocks)\n return !exists_overlap?(time_blocks)\n end",
"def validate_time_slots times\n time_models = [... | [
"0.6731134",
"0.60678077",
"0.5977046",
"0.58140635",
"0.5484393",
"0.5484328",
"0.54600245",
"0.534294",
"0.5336923",
"0.5301098",
"0.5291553",
"0.52813506",
"0.52577484",
"0.52175826",
"0.52076405",
"0.5142211",
"0.5131774",
"0.50770044",
"0.507346",
"0.5050142",
"0.5046692... | 0.7842012 | 0 |
Given a collection of TimeBlock(s), return a more optimized subset of the given collection. +:time_blocks: Collection of TimeBlock(s) to be filtered and optimized. | def optimize_time_blocks(time_blocks)
Optimizer.new.optimize(time_blocks)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quicksort_timeblocks(time_blocks)\n if (time_blocks.size <= 1)\n return time_blocks\n end\n\n pivot = time_blocks[0]\n left = []\n right = []\n\n time_blocks[1..time_blocks.size-1].each do |tb|\n if (tb.term.to_i < pivot.term.to_i)\n left.push(tb)\n elsif (pivot.term.to_... | [
"0.5368214",
"0.5326802",
"0.53122807",
"0.52685475",
"0.5181944",
"0.5129373",
"0.5116508",
"0.5077676",
"0.5031447",
"0.49094605",
"0.48733032",
"0.4859573",
"0.48289484",
"0.4816768",
"0.4806716",
"0.47583252",
"0.47385758",
"0.46988118",
"0.46612123",
"0.46600792",
"0.464... | 0.67573684 | 0 |
The size of a TimeBlock. Based on the minute duration of the chosen Service. | def block_size
session.chosen_service.duration rescue session.business.services.first.duration
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size_time(base = self.date_from)\n\t\t\t\t\t@sizes = {} if @sizes.nil?\n\t\t\t\t\tif @sizes[base.to_s].nil?\n\t\t\t\t\t\tsize = DateTime.parse(\"2000-01-01 00:00:00 +0000\")\n\t\t\t\t\t\tself.reservations(base).each do |reservation|\n\t\t\t\t\t\t\tif reservation.above_line?\n\t\t\t\t\t\t\t\tsize += reservation... | [
"0.6852872",
"0.6738088",
"0.66986936",
"0.6645414",
"0.6619052",
"0.64590394",
"0.64569837",
"0.644224",
"0.6386727",
"0.6282654",
"0.6222423",
"0.6215486",
"0.6212822",
"0.616994",
"0.616994",
"0.6114185",
"0.61123925",
"0.61122954",
"0.6108511",
"0.6100553",
"0.6090947",
... | 0.7701602 | 0 |
Fetch the timezone for the chosen office. While also memoizing the time_zone result as | def time_zone
return @time_zone_cache if @time_zone_cache
# Get the office id from the session json store
id = @session.store[:chosen_office_id]
office = Office
.where(business_id: @session.business_id, id: id)
.first
if office.present?
@time_zone_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_zone\n @session.chosen_office.time_zone if @session.chosen_office.present?\n end",
"def timezone!\n if @timezone.nil?\n\n tz = get_country! \n # if country have only one zone then return that zone\n if tz.zones.count == 1\n @timezone = TZInfo::Timezone.get... | [
"0.750561",
"0.7415016",
"0.73211753",
"0.68303543",
"0.67889184",
"0.67746866",
"0.6667891",
"0.6656611",
"0.6656611",
"0.65952057",
"0.6561896",
"0.6533011",
"0.64766604",
"0.64741546",
"0.646192",
"0.6433686",
"0.6433686",
"0.6433686",
"0.6433686",
"0.6433686",
"0.64171845... | 0.8218083 | 0 |
Add a random amount of blocks (30min per block) to the end of an existing start. | def random_range_end(start)
start + (rand(1..5) * 30).minutes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_range_start\n base.to_datetime + (rand(1..30) * 30).minutes\n end",
"def add_block block\n block.at self.length\n @blocks << block\n end",
"def add_for_num_blocks(words)\n # We just add to the single block, and we split this when we call\n # #blocks\n @s... | [
"0.6101411",
"0.58748794",
"0.578914",
"0.5707435",
"0.57006514",
"0.5687463",
"0.5662635",
"0.56504726",
"0.5633058",
"0.56010556",
"0.55987895",
"0.5523075",
"0.5510154",
"0.5418222",
"0.5354336",
"0.531994",
"0.5262501",
"0.52583444",
"0.52465177",
"0.5210932",
"0.5204403"... | 0.66548526 | 0 |
add hvac Add the daylighting controls for lobby, cafe, dinning and banquet | def add_daylighting_controls(building_vintage)
space_names = ['Banquet_Flr_6','Dining_Flr_6','Cafe_Flr_1','Lobby_Flr_1']
space_names.each do |space_name|
space = self.getSpaceByName(space_name).get
space.addDaylightingControls(building_vintage, false, false)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addDaylightingControls()\n \n OpenStudio::logFree(OpenStudio::Info, 'openstudio.model.Model', 'Started adding daylighting controls.')\n \n # Add daylighting controls to each space\n self.getSpaces.sort.each do |space|\n added = space.addDaylightingControls(self.template, false, false)\n ... | [
"0.71322644",
"0.5209009",
"0.5202599",
"0.5136928",
"0.5112874",
"0.5109905",
"0.4953279",
"0.49216655",
"0.49124262",
"0.48623702",
"0.4854162",
"0.48344964",
"0.47726038",
"0.4744203",
"0.47417986",
"0.47315714",
"0.47222507",
"0.46913967",
"0.4673408",
"0.46558735",
"0.46... | 0.70055264 | 1 |
Generate a planet based on user's inputs | def generate_planet
puts "\nLet's create a planet from scratch."
print "Please enter its name first: "
name = gets.chomp
print "What's its diameter of this planet in km? "
diameter = gets.chomp.to_f
print "What's its mass in kg? (example of input format: 3.30 x 10^23 ) "
mass = gets.chomp
print "What's ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_planet()\n puts \"\\nAdding planet. Please tell me more about this planet.\"\n \n print \"Enter the planet name: \"\n name = gets.chomp.capitalize\n \n print \"\\nEnter the planet color: \"\n color = gets.chomp.downcase\n \n print \"\\nEnter planet mass in kg: \"\n mass_kg =... | [
"0.78234327",
"0.7657574",
"0.7433642",
"0.7393319",
"0.7371366",
"0.71264064",
"0.70756966",
"0.7057372",
"0.70562917",
"0.70562917",
"0.70562917",
"0.70562917",
"0.70562917",
"0.7000872",
"0.69893163",
"0.6938458",
"0.6905905",
"0.68091875",
"0.67716867",
"0.67657614",
"0.6... | 0.79343444 | 0 |
def decimal_base(n) ten_to_position = 1 loop do n = 1 break if n == 0 ten_to_position = 10 end ten_to_position end | def decimal_base(n)
10**(n-1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toBase(n, base)\n return n.to_s(base) if base > 0\n return '0' if n.zero?\n\n digits = []\n while n != 0\n n, remainder = n.divmod(base)\n if remainder < 0\n n += 1\n remainder -= base\n end\n digits << remainder\n end\n digits.join.reverse\nend",
"def super_digit(n)\n while n >=... | [
"0.74928284",
"0.7391296",
"0.73467326",
"0.7299868",
"0.72959495",
"0.7256317",
"0.72488725",
"0.7213806",
"0.71847534",
"0.7150823",
"0.7109661",
"0.7091952",
"0.7083971",
"0.705517",
"0.7028662",
"0.7022338",
"0.70145804",
"0.700829",
"0.6998789",
"0.6951361",
"0.6947307",... | 0.8483405 | 0 |
Sets the acceleration of a stepper, in (micro)steps per second squared, or raises an error. | def acceleration=(new_acceleration)
Klass.setAcceleration(@handle, @index, new_acceleration.to_f)
new_acceleration
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accelerate (rateOfAcceleration)\n @speed = @speed + rateOfAcceleration\n end",
"def accel\n @speed += 7\n end",
"def accelerate\n @speed = @speed + @accelerator\n end",
"def acceleration(state_object, t)\n k = 10\n b = 1\n (- k * state_object.position) - (b * state_object.velocity)\nend",
... | [
"0.6187451",
"0.61048514",
"0.60582536",
"0.60556734",
"0.6005321",
"0.5939681",
"0.59366953",
"0.58714765",
"0.5864271",
"0.5863374",
"0.5802886",
"0.58006376",
"0.57577443",
"0.5673338",
"0.5644646",
"0.5620917",
"0.5570925",
"0.555828",
"0.55382943",
"0.55382943",
"0.55065... | 0.6707642 | 1 |
Sets the current position of a stepper, in (micro)steps, or raises an error. | def current_position=(new_current_position)
Klass.setCurrentPosition(@handle, @index, new_current_position.to_i)
new_current_position
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current=(new_value)\n value = (new_value)%steps\n @dirty = @current != value\n @current = value\n end",
"def progressSetPosition _obj, _args\n \"_obj progressSetPosition _args;\" \n end",
"def set_invalid_steps(steps)\n self.invalid_steps = steps\n end",
"def pt_step _value, _force=... | [
"0.5806139",
"0.56053126",
"0.55437475",
"0.5539134",
"0.55381596",
"0.5532316",
"0.55119836",
"0.54062337",
"0.5401332",
"0.5385979",
"0.53545046",
"0.5323149",
"0.5322548",
"0.5318022",
"0.5297276",
"0.52906615",
"0.52874625",
"0.52843904",
"0.5279208",
"0.5277352",
"0.5270... | 0.5665552 | 1 |
Sets the engaged state of the Phidget. | def engaged=(new_state)
tmp = new_state ? 1 : 0
Klass.setEngaged(@handle, @index, tmp)
new_state
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_State(value)\n set_input(\"State\", value)\n end",
"def set_State(value)\n set_input(\"State\", value)\n end",
"def set_State(value)\n set_input(\"State\", value)\n end",
"def set_State(value)\n set_input(\"State\", value)\n end"... | [
"0.61920553",
"0.61920553",
"0.6154074",
"0.6154074",
"0.6154074",
"0.6154074",
"0.6154074",
"0.6154074",
"0.6154074",
"0.60919803",
"0.60879356",
"0.60879356",
"0.60879356",
"0.60879356",
"0.60879356",
"0.60879356",
"0.60879356",
"0.6069289",
"0.5995986",
"0.5988838",
"0.589... | 0.7006594 | 1 |
Sets the target position of a stepper, in (micro)steps, or raises an error. | def target_position=(new_target_position)
Klass.setTargetPosition(@handle, @index, new_target_position.to_i)
new_target_position
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_move_to_target\n return unless PONY::ERRNO.check_sequence(current_act)\n stop_all_movements\n xpos = target.x + (flip ? -@acts[1] : @acts[1])\n ypos = target.y + @acts[2]\n goto(xpos, ypos, @acts[3], @acts[4], @acts[5] || 0)\n end",
"def setpoint_to_target\n @setpoint = @freq_tar... | [
"0.62203336",
"0.5957737",
"0.587027",
"0.5716573",
"0.55401325",
"0.5535329",
"0.5513744",
"0.5488356",
"0.54202664",
"0.53962225",
"0.5392546",
"0.5384767",
"0.5373468",
"0.53674364",
"0.53669",
"0.53264296",
"0.53110605",
"0.53110605",
"0.53110605",
"0.53110605",
"0.531106... | 0.6607499 | 0 |
Sets the velocity limit of a stepper, in (micro)steps per second, or raises an error. | def velocity_limit=(new_velocity_limit)
Klass.setVelocityLimit(@handle, @index, new_velocity_limit.to_f)
new_velocity_limit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def velocity_limit=(new_velocity_limit)\n Klass.setVelocityLimit(@handle, @index, new_velocity_limit.to_f)\n new_velocity_limit\n end",
"def set_velocity action = :increment\n if action == :increment and @velocity <= 3\n @velocity += 1\n\n elsif action == :decrement and @velocity > 1\n ... | [
"0.7112307",
"0.6255239",
"0.6249731",
"0.6048269",
"0.59822744",
"0.59822744",
"0.5972854",
"0.589134",
"0.57726794",
"0.5745471",
"0.5715279",
"0.57056004",
"0.5559399",
"0.5486125",
"0.5467187",
"0.5467187",
"0.5467187",
"0.5467187",
"0.5467187",
"0.5467187",
"0.5467187",
... | 0.72637236 | 0 |
Create a NxN grid of points on a face of the cube. Note that this will generate (N+1)(N+1) points. Each point is projected on the sphere and stored in an array. Note that all these are points on the unit sphere, and so their distance to the origin is 1, and so each point can be used as its own normal. | def grid(face, n)
dx = 2.0/n
dy = 2.0/n
a = Array.new
n += 1
n.times do |j|
y = -1.0 + j*dy
n.times do |i|
x = -1.0 + i*dx
lon, lat = QuadSphere::CSC.inverse(face, x, y)
sx = Math::cos(lat) * Math::cos(lon)
sy = Math::cos(lat) * Math::sin(lon)
sz ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_points(u_count, v_count)\n points = []\n v_count.times do |iv|\n row = []\n u_count.times do |iu|\n u = map1d(iu, (0..u_count), U_RANGE)\n v = map1d(iv, (0..v_count), V_RANGE)\n # default scale: 50, param: Array.new(12, 1) and mesh_distortion: 0\n row << superformula(u: u, ... | [
"0.5928719",
"0.570356",
"0.56557053",
"0.56169516",
"0.56094754",
"0.5591064",
"0.55714774",
"0.5485938",
"0.54362124",
"0.5412299",
"0.5383223",
"0.5371151",
"0.53186864",
"0.52793384",
"0.5258932",
"0.52141297",
"0.52060217",
"0.5205415",
"0.517512",
"0.51573133",
"0.51541... | 0.7749322 | 0 |
p grid(0, 3) Create triangle strips to represent a NxN mesh. The given array should then contain (N+1)2 points, arranged as N+1 rows of N+1 points. | def mesh2strips(n,a)
dx = 2.0/n
dy = 2.0/n
row = n+1
n.times do |j|
glBegin(GL_TRIANGLE_STRIP)
rowi = j*row
row.times do |x|
add_vertex(a[rowi+x])
add_vertex(a[rowi+row+x])
end
glEnd
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_grid(board_array)\n\t# split into triplets\n\ttriplets_array = []\n board_array.each { |array| triplets_array << array.each_slice(3).to_a }\n\n # shuffle the triplets\n shuffle_container = [[], [], []]\n 9.times do |row|\n 3.times do |column|\n current_array = triplets_array[row][column]\n ... | [
"0.62033063",
"0.60679984",
"0.6010272",
"0.58452564",
"0.58127",
"0.5795336",
"0.5707064",
"0.57053405",
"0.56979764",
"0.5663744",
"0.55985594",
"0.5590872",
"0.55771965",
"0.55767393",
"0.5552159",
"0.55489373",
"0.553704",
"0.5499699",
"0.5486645",
"0.54455215",
"0.532118... | 0.7099372 | 0 |
Set client stats details Author: Puneet Date: 02/02/2018 Reviewed By: | def set_client_stats(client_stats_data)
@client_stats = CompanyApi::Response::Entity::ClientStats.new(client_stats_data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def populate_client_usage(client)\n client_id = client.id\n registration_count = User.using_client_shard(client: client).where(client_id: client_id).count\n kyc_submissions_count = UserKycDetail.using_client_shard(client: client).\n where(client_id: client_id).sum(:submission_count)\n\n ... | [
"0.632931",
"0.609067",
"0.60432386",
"0.60432386",
"0.6000351",
"0.59391373",
"0.58106226",
"0.5807779",
"0.57885337",
"0.5697464",
"0.569321",
"0.5660587",
"0.5552315",
"0.5550092",
"0.5515177",
"0.5488684",
"0.5468579",
"0.546816",
"0.546816",
"0.54330796",
"0.53912634",
... | 0.73293805 | 0 |
Set Client BT Addresss Data Author: Puneet Date: 02/02/2018 Reviewed By: | def set_client_bt_addresses_data(client_bt_addresses_data)
@client_bt_addresses = CompanyApi::Response::Entity::ClientBrandedTokenAddresses.new(client_bt_addresses_data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_address\n end",
"def set_client_address\n @client_address = ClientAddress.find(params[:id])\n end",
"def set_addresses=(v)\n self.addresses = build_addresses(v)\n end",
"def update_contact_info txn\n AddressManager::set_user_address txn.user, txn\n end",
"def set_client\n @cli... | [
"0.6881441",
"0.6312769",
"0.60506237",
"0.6017915",
"0.59968686",
"0.5966925",
"0.59465563",
"0.59386486",
"0.59386486",
"0.59386486",
"0.591972",
"0.5915055",
"0.5915055",
"0.59133244",
"0.59031093",
"0.58883625",
"0.58808154",
"0.58808154",
"0.58686054",
"0.5835885",
"0.58... | 0.7541487 | 0 |
get(Symbol) method that returns a node by the id returns | def get id
@nodes[id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_node(id)\n @nodes[id.to_i]\n end",
"def get_node(id)\n get_object('node', id)\n end",
"def node_by_id(id)\r\n @nodes.each do |n|\r\n return n if n.attributes['id'] == id \r\n end\r\n end",
"def get_node_by_id(id, options={})\n options[:exac... | [
"0.77852273",
"0.7746689",
"0.74849606",
"0.7415566",
"0.7203441",
"0.6996068",
"0.6890222",
"0.6885043",
"0.6787701",
"0.6758027",
"0.66858804",
"0.66643023",
"0.66091704",
"0.6607736",
"0.6528776",
"0.65238875",
"0.65092194",
"0.6489196",
"0.64593965",
"0.64387286",
"0.6398... | 0.79646957 | 0 |
connect(Edge) method that adds a connection to the list of nodes returns | def connect edge
self.add edge.src
self.add edge.dst
@nodes[edge.src] << edge
edge
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect_nodes(node1, node2)\n # node1.connect(node2)\n end",
"def __connect__(node)\n raise \"Cannot connect to a node which is not on the same graph!\" if node.graph != @this.graph\n node.in.instance_exec(@this) { |n| @others << n }\n @graph.instance_eval { @changed = true }\n end",
"def con... | [
"0.7149291",
"0.7143974",
"0.7126218",
"0.69445294",
"0.68873805",
"0.68495196",
"0.672731",
"0.67185426",
"0.6711184",
"0.6705357",
"0.6662451",
"0.65780455",
"0.65737826",
"0.65538955",
"0.6543518",
"0.65326816",
"0.6487913",
"0.6485545",
"0.6385783",
"0.635903",
"0.6352993... | 0.8483913 | 0 |
path_number(List, Symbol, Hash, String) return the number of paths with in the limits returns | def path_number visit_path, dst, limits, condition=EG
paths = route(visit_path, dst, limits, condition)
select_condition = condition == EG ? EG : condition == UNTIL ? LESS : UNTIL
return (paths.select {|path| eval final_eval( select_condition, limits )}).length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_count(*args)\n path_rels(*args).size\n end",
"def get_num_paths(grid_width)\n n, r = grid_width * 2, grid_width\n ((n - r + 1)..n).inject(:*) / (1..r).inject(:*)\nend",
"def count_paths(grid_size)\n factorial(2*grid_size) / (factorial(grid_size) * factorial(grid_size))\nend",
"def path_count(... | [
"0.7148266",
"0.7054428",
"0.6922436",
"0.6717221",
"0.6602749",
"0.6582553",
"0.65792847",
"0.62654996",
"0.6254104",
"0.623642",
"0.62050784",
"0.61050344",
"0.610447",
"0.60559106",
"0.60262126",
"0.6015799",
"0.6009623",
"0.5996869",
"0.58924735",
"0.57638484",
"0.5754598... | 0.7635548 | 0 |
step_number(Hash, String) return the eval expression for the conditions returns | def final_eval condition, limits
return "#{condition[:steps]}#{limits[:steps]}" if limits.has_key? :steps
return "#{condition[:cost]}#{limits[:cost]}" if limits.has_key? :cost
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculation\n wizard_step(nil) { { next_step: :calculate_next_step, cache_index: LbttController } }\n end",
"def opinion_wizard_step_number(step)\n step.to_s.split(\"_\").last.to_i\n end",
"def next_step\n (history.keys.last.to_i + 1).to_s\n end",
"def step_result; end",
"de... | [
"0.5798169",
"0.56881636",
"0.5677804",
"0.5475534",
"0.54139423",
"0.53727996",
"0.5353041",
"0.5338501",
"0.53065944",
"0.53065944",
"0.53065944",
"0.5299751",
"0.5289309",
"0.52679855",
"0.52373195",
"0.5217548",
"0.5089139",
"0.50588447",
"0.50575215",
"0.50575215",
"0.50... | 0.5814103 | 0 |
Returns the account for this business linked to a "money" program with is_money == true | def cashbox
return @cashbox if @cashbox.present?
return nil unless has_money_program?
@cashbox = self.accounts.where(:program_id => money_program.id, :is_money => true).first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def my_account\n accounts.currency_code_is(\"flc\").first\n end",
"def payment_entry\n business_account.entries.find { |e|\n e.code == number.to_s and not e.accounts.include? commodity_account\n }\n end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self... | [
"0.6982914",
"0.68794227",
"0.67552257",
"0.67552257",
"0.67552257",
"0.67552257",
"0.67552257",
"0.67552257",
"0.67552257",
"0.67552257",
"0.67552257",
"0.67552257",
"0.6677856",
"0.6670226",
"0.6612918",
"0.6459652",
"0.644602",
"0.64443004",
"0.6411041",
"0.6390428",
"0.63... | 0.69634044 | 1 |
Tries to detect the current processor based if any of the processors exist. Mogrify have precedence over gm by default. === Returns [String] The detected procesor | def choose_processor
self.processor = if MiniMagick::Utilities.which('mogrify')
:mogrify
elsif MiniMagick::Utilities.which('gm')
:gm
else
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gm?\n choose_processor if processor.nil?\n\n return processor.to_s.downcase.to_sym == :gm unless processor.nil?\n false\n end",
"def mogrify?\n choose_processor if processor.nil?\n\n return processor.to_s.downcase.to_sym == :mogrify unless processor.nil?\n false\n end",
... | [
"0.74321014",
"0.7190223",
"0.6387016",
"0.6373831",
"0.60417885",
"0.5790201",
"0.5749444",
"0.5714313",
"0.57106245",
"0.56824136",
"0.55886793",
"0.5558089",
"0.5539528",
"0.55147165",
"0.54887444",
"0.5444319",
"0.5433147",
"0.5340609",
"0.5298695",
"0.5288989",
"0.527379... | 0.74514323 | 0 |
Discovers the imagemagick version based on mogrify's output. === Returns The imagemagick version | def image_magick_version
@@version ||= Gem::Version.create(`mogrify --version`.split(' ')[2].split('-').first)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def imagemagick7?; end",
"def valid_version_installed?\n image_magick_version >= minimum_image_magick_version\n end",
"def version\n Gem.loaded_specs['image_optim'].version.to_s\n rescue\n 'DEV'\n end",
"def minimum_image_magick_version\n @@minimum_version ||= Gem::Version.create... | [
"0.6637482",
"0.65219146",
"0.6472974",
"0.64288706",
"0.63321644",
"0.62835586",
"0.61837244",
"0.590618",
"0.58283144",
"0.5734902",
"0.5685154",
"0.56706923",
"0.561554",
"0.5570928",
"0.55627096",
"0.5544048",
"0.55422163",
"0.550007",
"0.5496064",
"0.5496064",
"0.5496064... | 0.8131971 | 0 |
The minimum allowed imagemagick version === Returns The minimum imagemagick version | def minimum_image_magick_version
@@minimum_version ||= Gem::Version.create('6.6.3')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_version_installed?\n image_magick_version >= minimum_image_magick_version\n end",
"def image_magick_version\n @@version ||= Gem::Version.create(`mogrify --version`.split(' ')[2].split('-').first)\n end",
"def os_minimum_version\n return @os_minimum_version\n ... | [
"0.7833048",
"0.766381",
"0.67313546",
"0.67313546",
"0.6671334",
"0.6591078",
"0.6586556",
"0.6427364",
"0.6194594",
"0.6013946",
"0.59711105",
"0.59376246",
"0.59376246",
"0.5827781",
"0.5827781",
"0.5811156",
"0.5773059",
"0.5773059",
"0.5773059",
"0.5725629",
"0.5670229",... | 0.8851184 | 0 |
Checks whether the imagemagick's version is valid === Returns [Boolean] | def valid_version_installed?
image_magick_version >= minimum_image_magick_version
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid?\n validate!\n true\n rescue MiniMagick::Invalid\n false\n end",
"def valid?\n image_resource? && supported_format?\n end",
"def invalid?\n %w(undefined 0).include?(version.to_s)\n end",
"def valid_version?\n !statement[\"ver\"].empty?\n end",
"def val... | [
"0.7430224",
"0.70996916",
"0.7020582",
"0.6940662",
"0.69345105",
"0.6854174",
"0.6702889",
"0.6696321",
"0.6671831",
"0.6659723",
"0.6572059",
"0.6560966",
"0.65524983",
"0.65450585",
"0.64926857",
"0.6492017",
"0.6451872",
"0.64208996",
"0.6383397",
"0.63796216",
"0.637726... | 0.8595329 | 0 |
Picks the right processor if it isn't set and returns whether it's mogrify or not. === Returns [Boolean] | def mogrify?
choose_processor if processor.nil?
return processor.to_s.downcase.to_sym == :mogrify unless processor.nil?
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gm?\n choose_processor if processor.nil?\n\n return processor.to_s.downcase.to_sym == :gm unless processor.nil?\n false\n end",
"def choose_processor\n self.processor = if MiniMagick::Utilities.which('mogrify')\n :mogrify\n elsif MiniMagick... | [
"0.7781849",
"0.74955004",
"0.63985616",
"0.62639934",
"0.61793256",
"0.59958065",
"0.5983024",
"0.58769286",
"0.58340687",
"0.5832451",
"0.5798496",
"0.57964385",
"0.5730911",
"0.56767637",
"0.56473035",
"0.56198865",
"0.5616269",
"0.5589491",
"0.5588428",
"0.55843437",
"0.5... | 0.8571836 | 0 |
Picks the right processor if it isn't set and returns whether it's graphicsmagick or not. === Returns [Boolean] | def gm?
choose_processor if processor.nil?
return processor.to_s.downcase.to_sym == :gm unless processor.nil?
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def choose_processor\n self.processor = if MiniMagick::Utilities.which('mogrify')\n :mogrify\n elsif MiniMagick::Utilities.which('gm')\n :gm\n else\n nil\n end\n end",
... | [
"0.7287053",
"0.725614",
"0.67848223",
"0.66996956",
"0.62745863",
"0.61968267",
"0.5919397",
"0.5857916",
"0.58336717",
"0.5826745",
"0.5820798",
"0.5733881",
"0.5703429",
"0.5697703",
"0.56916964",
"0.5678483",
"0.5641339",
"0.5613499",
"0.56020576",
"0.5601356",
"0.5584178... | 0.7643658 | 0 |
Returns a Project object identified by given string The following identifiers are accepted /gdc/md/ /gdc/projects/ | def [](id, options = {})
return id if id.respond_to?(:project?) && id.project?
if id == :all
Project.all
else
if id.to_s !~ %r{^(\/gdc\/(projects|md)\/)?[a-zA-Z\d]+$}
fail(ArgumentError, 'wrong type of argument. Should be either project ID or path')
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def [](id)\n return id if id.respond_to?(:is_project?) && id.is_project?\n if id == :all\n Project.all\n else\n if id.to_s !~ /^(\\/gdc\\/(projects|md)\\/)?[a-zA-Z\\d]+$/\n raise ArgumentError.new('wrong type of argument. Should be either project ID or path')\n ... | [
"0.714441",
"0.63858455",
"0.63714254",
"0.63254607",
"0.625838",
"0.6231655",
"0.62274665",
"0.61855274",
"0.6158891",
"0.61544067",
"0.61487347",
"0.6116764",
"0.6111021",
"0.60941035",
"0.5968301",
"0.5968301",
"0.5963218",
"0.5962752",
"0.5957147",
"0.5939222",
"0.5939222... | 0.6904942 | 1 |
Gets author of project | def author
# TODO: Return object instead
@json['project']['meta']['author']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_author()\n return @author\n end",
"def extract_author_name\n `git config user.name`.strip\n end",
"def get_author()\n @author\n end",
"def\n get_author()\n @author\n end",
"def author\n @author ||= begin\n UnfuddleAPI::People.find(self[:author_id]).username\... | [
"0.75654566",
"0.75434136",
"0.7531482",
"0.7456287",
"0.73964405",
"0.73358434",
"0.7323249",
"0.7306709",
"0.730264",
"0.72318107",
"0.7229581",
"0.72145975",
"0.71947294",
"0.71786714",
"0.71773136",
"0.71660554",
"0.715834",
"0.7139117",
"0.7107673",
"0.71068704",
"0.7090... | 0.81335694 | 0 |
Gets ruby wrapped raw project JSON data | def data
raw_data['project']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_json\n if project.source_exists?\n JSON.parse(File.read(project.project_path))\n else\n []\n end\n end",
"def getProject(projectName)\n data = CLIENT.repository(projectName)\n return data\nend",
"def getProjectID()\n result = RestClient.get GITHUB_API + PROJECTS_PATH, ... | [
"0.70782727",
"0.6797672",
"0.6551246",
"0.6530466",
"0.6362855",
"0.6343553",
"0.6287911",
"0.6110015",
"0.60831463",
"0.6057243",
"0.60512817",
"0.6028828",
"0.60168654",
"0.5995319",
"0.5976462",
"0.59062135",
"0.58701104",
"0.5859514",
"0.5852959",
"0.58440536",
"0.581069... | 0.78173083 | 0 |
Deletes dashboards for project | def delete_dashboards
Dashboard.all.map { |data| Dashboard[data['link']] }.each { |d| d.delete }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n conf.delete 'dashboard'\n end",
"def destroy\n @dashboard_project.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_dashboard(das... | [
"0.69312346",
"0.6843769",
"0.6836013",
"0.67823917",
"0.673084",
"0.6690916",
"0.6652889",
"0.66266125",
"0.661454",
"0.6568845",
"0.65664697",
"0.65664697",
"0.65664697",
"0.65664697",
"0.65664697",
"0.6409158",
"0.6402482",
"0.63316554",
"0.6320223",
"0.61900336",
"0.61697... | 0.80604047 | 0 |
Gets project role byt its summary | def get_role_by_summary(role_summary, role_list = roles)
role_list.each do |role|
return role if role.summary.downcase == role_summary.downcase
end
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_role user\n project_role_user = ProjectRoleUser.where(:project_id => self, :user_id => user).first\n if project_role_user\n project_role_user.role.name\n else\n nil\n end\n end",
"def display_role\n ROLE_LIST[self.role]\n end",
"def getProjectActorByRole\n if @role.nil? an... | [
"0.69252276",
"0.65983015",
"0.65933084",
"0.6576181",
"0.64411587",
"0.64147127",
"0.6348822",
"0.6348822",
"0.6281939",
"0.62592596",
"0.6209841",
"0.62093836",
"0.6200686",
"0.6200608",
"0.61546564",
"0.61338323",
"0.61338323",
"0.61308676",
"0.61137",
"0.61130714",
"0.610... | 0.6995733 | 0 |
Returns invitations to project | def invitations
res = []
tmp = GoodData.get @json['project']['links']['invitations']
tmp['invitations'].each do |invitation|
res << GoodData::Invitation.new(invitation)
end
res
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invitations\n @invitations = Invitation.pending_by_user(current_user.id)\n\n respond_to do |format|\n format.html\n end\n end",
"def invitations\n\t\t@invits = current_user.receive_invites.order(\"id DESC\")\n\tend",
"def invitations()\n return MicrosoftGraph::Invitations::Invitat... | [
"0.76814204",
"0.7535096",
"0.73966706",
"0.7234537",
"0.71821076",
"0.70033073",
"0.70033073",
"0.70033073",
"0.6896788",
"0.68899786",
"0.68819606",
"0.6843941",
"0.68025196",
"0.6798536",
"0.67652124",
"0.67607087",
"0.67198896",
"0.66972095",
"0.66972095",
"0.66972095",
"... | 0.8202656 | 0 |
Checks if this object instance is project | def project?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_for_project?\n not self.project.nil?\n end",
"def project?\n ! @project.nil?\n end",
"def project?; @is_project || false; end",
"def has_project?\n !project_id.nil? && project.visible\n end",
"def project?(p)\r\n projects.include?(p)\r\n end",
"def belongs_to_project?(proje... | [
"0.85757875",
"0.81913626",
"0.7927502",
"0.7593589",
"0.7592387",
"0.75436443",
"0.72515917",
"0.7238059",
"0.70117134",
"0.68325853",
"0.6826295",
"0.680668",
"0.6783032",
"0.6719298",
"0.6627733",
"0.66117585",
"0.65926325",
"0.6570935",
"0.65682834",
"0.648983",
"0.647895... | 0.8303266 | 1 |
Gets project update date | def updated
DateTime.parse(@json['project']['meta']['updated'])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_updated\n updated_at.strftime(\"%b %d, %Y\")\n end",
"def updated_for_repo(repo)\n repo.updated_at.iso8601\n end",
"def last_edited\n self.latest_update.to_date\n end",
"def last_edited\n\t\tself.latest_update.to_date\n\tend",
"def last_updated\n repo = Grit::Repo.init_bare_... | [
"0.7243601",
"0.7116965",
"0.7002887",
"0.688242",
"0.6768324",
"0.6752917",
"0.6735119",
"0.6735119",
"0.6735119",
"0.6735119",
"0.67088586",
"0.67088586",
"0.66656107",
"0.6634576",
"0.66023195",
"0.65239465",
"0.650722",
"0.650722",
"0.64935714",
"0.6489516",
"0.6485808",
... | 0.73746365 | 0 |
Run validation on project Valid settins for validation are (default all): ldm Checks the consistency of LDM objects. pdm Checks LDM to PDM mapping consistency, also checks PDM reference integrity. metric_filter Checks metadata for inconsistent metric filters. invalid_objects Checks metadata for invalid/corrupted object... | def validate(filters = %w(ldm, pdm, metric_filter, invalid_objects))
response = GoodData.post "#{GoodData.project.md['validate-project']}", 'validateProject' => filters
polling_link = response['asyncTask']['link']['poll']
polling_result = GoodData.get(polling_link)
while polling_result['wTaskSta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate\n needs :project unless skip_project_check?\n end",
"def validate_project\n\n # project name should be 10 to 30 length, and 5 words or fewer\n validate_length_words 'Project Name', self.project_name, 10, 30, 0, 5\n\n # vision should be 1 sentence\n validate_sentences_leng... | [
"0.60966474",
"0.5920944",
"0.5883326",
"0.5790503",
"0.56967425",
"0.564787",
"0.56322885",
"0.56300765",
"0.55392665",
"0.55196273",
"0.54341996",
"0.5409193",
"0.54084873",
"0.5390367",
"0.5372635",
"0.5371687",
"0.5356898",
"0.5320983",
"0.5318901",
"0.52747625",
"0.52654... | 0.7684566 | 0 |
retrieve market id get market id from Vendor classfile match up market id and vendor id provide a collection of all vendor instances associated with market by id | def vendors ##DON'T NEED TO PASS IN AN ARGUMENT JUST THE VALUE FROM THE ARGUMENT!!!!
# lookup every vendor that matches this market id
FarMar::Vendor.by_market(@id)
##OMG YAY, REMEMBER THIS TO BRING IN CLASSES FOR DIFFERENT METHODS,
##bring in class object and method and pass in the id from market
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vendors\n FarMar::Vendor.by_market(id)\n end",
"def market #returns the FarMar::Market instance that is associated with this vendor using the FarMar::Vendor market_id field ##WORKS\n\t\tmarkets = []\n\t\tlist = FarMar::Market.all\n\t\tlist.each do |market|\n\t\t\tif market.id == @market_id\n\t\t\t\tputs ... | [
"0.8072416",
"0.79924387",
"0.7924431",
"0.76777023",
"0.7669088",
"0.76245666",
"0.7323986",
"0.6869937",
"0.68620455",
"0.6855523",
"0.6814425",
"0.67456746",
"0.67456746",
"0.6721337",
"0.6629167",
"0.6595687",
"0.6595687",
"0.6540909",
"0.65010834",
"0.6476018",
"0.647119... | 0.8236412 | 0 |
Elect a primary server within this topology. | def elect_primary(description, servers); self; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def elect_primary(description, servers)\n if description.replica_set_name == replica_set_name\n unless detect_stale_primary!(description)\n servers.each do |server|\n if server.primary? && server.address != description.address\n server.description.un... | [
"0.6445153",
"0.54944026",
"0.5484852",
"0.5451359",
"0.5447465",
"0.54417884",
"0.5406501",
"0.53859746",
"0.5379763",
"0.5375298",
"0.5346694",
"0.5250826",
"0.52389693",
"0.52299094",
"0.5220387",
"0.5218819",
"0.5205547",
"0.5151638",
"0.5149905",
"0.5144666",
"0.5117638"... | 0.7482492 | 0 |
Sharded topologies have no replica set name. | def replica_set_name; nil; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replica_set?; false; end",
"def replica_set?; true; end",
"def replica_set?\n type == Mongo::Cluster::Topology::ReplicaSetNoPrimary ||\n type == Mongo::Cluster::Topology::ReplicaSetWithPrimary\n end",
"def reconfiguring_replica_set?\n err = details[\"err\"] || details[\"er... | [
"0.6891267",
"0.67285687",
"0.645339",
"0.643664",
"0.6387346",
"0.6276711",
"0.6276711",
"0.6241491",
"0.6241491",
"0.6145875",
"0.6053696",
"0.6028507",
"0.6027574",
"0.5945153",
"0.5669629",
"0.5662772",
"0.5561229",
"0.5559615",
"0.5517034",
"0.5479895",
"0.54232806",
"... | 0.70127517 | 0 |
A sharded topology is sharded. | def sharded?; true; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sharded?\n @sharded\n end",
"def shard; end",
"def sharded?; false; end",
"def sharded?\n $mongo_client ||= initialize_scanned_client!\n $sharded ||= ($mongo_client.cluster.sharded? || single_mongos?)\nend",
"def sharded?\n $mongo_client ||= initialize_scanned_client!\n $sharded ||= ($mongo... | [
"0.64567375",
"0.6401802",
"0.628635",
"0.6077936",
"0.6077936",
"0.601789",
"0.5766073",
"0.5748678",
"0.56937706",
"0.56869894",
"0.56317043",
"0.5486915",
"0.5449605",
"0.5342455",
"0.5271522",
"0.50610167",
"0.4985788",
"0.49834564",
"0.49709225",
"0.49651423",
"0.4964324... | 0.6496563 | 0 |
Creates a new version of the app in HockeyApp. | def create_version
Milkrun.say "Creating new version of app in HockeyApp"
body = {}.tap do |json|
json[:bundle_version] = version_code
json[:bundle_short_version] = version_name
json[:status] = 1
end
headers = {}.tap do |h|
h["X-HockeyAppToken"] = token
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil, company_name: nil, platform: nil, platforms: nil, itunes_connect_users: nil)\n puts(\"The `version` parameter is deprecated. Use `ensure_version!` method instead\") if version\n client.cre... | [
"0.69854003",
"0.6732899",
"0.668877",
"0.65476656",
"0.6515963",
"0.64948446",
"0.6347779",
"0.634168",
"0.6288814",
"0.6277851",
"0.6277574",
"0.62440366",
"0.62321925",
"0.62309766",
"0.62111074",
"0.6194539",
"0.6173755",
"0.61472636",
"0.60987973",
"0.6071858",
"0.604536... | 0.87121814 | 0 |
Whether the environment is valid for this provider. | def valid?
env_keys.all? { |k| env.key?(k) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def environment_valid?\n %w(test production development).include?(@environment)\n end",
"def valid?(request_env)\n\t\t\treturn false unless valid_fields?(request_env)\n\t\t\ttrue\n\t\tend",
"def valid_environment?\n env['USER'] == config.user && env['HOME'] == config.home_path\n end",
"def va... | [
"0.85026413",
"0.76318866",
"0.7421536",
"0.73386705",
"0.71294063",
"0.71245724",
"0.71205235",
"0.7063185",
"0.7055769",
"0.70506364",
"0.7012718",
"0.70002174",
"0.6954537",
"0.6952816",
"0.69519633",
"0.69255656",
"0.6903113",
"0.690139",
"0.68640417",
"0.6843815",
"0.683... | 0.8144832 | 1 |
GET /people_tasks GET /people_tasks.json | def index
@people_tasks = TasksPerson.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @people_tasks }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @tasks_person = TasksPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tasks_person }\n end\n end",
"def get_user_tasks\n render json: get_current_user.tasks\n end",
"def tasks\n @todos = Todo.all\n render js... | [
"0.73588705",
"0.71109337",
"0.7009187",
"0.6887127",
"0.6873431",
"0.68418485",
"0.6736645",
"0.673531",
"0.67280954",
"0.66958576",
"0.6682668",
"0.6649931",
"0.66353023",
"0.6624169",
"0.6604962",
"0.65877634",
"0.6570386",
"0.6555804",
"0.65556246",
"0.6552364",
"0.655126... | 0.7704657 | 0 |
GET /people_tasks/1 GET /people_tasks/1.json | def show
@tasks_person = TasksPerson.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @tasks_person }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @people_tasks = TasksPerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people_tasks }\n end\n end",
"def show\n render :json => Project.find(params[:project_id]).tasks.find(params[:id])\n end",
"def show\n @task = Task.... | [
"0.75819623",
"0.6937273",
"0.69366366",
"0.6923732",
"0.6905428",
"0.68815845",
"0.6829282",
"0.6826633",
"0.6778851",
"0.6767741",
"0.67472607",
"0.66577345",
"0.66504943",
"0.6614728",
"0.6600599",
"0.6600599",
"0.6600599",
"0.6600599",
"0.6600599",
"0.6600599",
"0.6600599... | 0.75678724 | 1 |
GET /people_tasks/new GET /people_tasks/new.json | def new
@tasks_person = TasksPerson.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @tasks_person }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n # raise params.inspect\n @task = Task.new \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n\n\n\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render j... | [
"0.7775306",
"0.77416384",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7529903",
"0.74275225",
"0.7372045",
"0.73702204",
"0.73412675",
"0.7319687",
"0.7273926",... | 0.8022029 | 0 |
POST /people_tasks POST /people_tasks.json | def create
@tasks_person = TasksPerson.new(params[:tasks_person])
respond_to do |format|
if @tasks_person.save
format.html { redirect_to @tasks_person, notice: 'Tasks person was successfully created.' }
format.json { render json: @tasks_person, status: :created, location: @tasks_person }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n #@task = Task.new(task_params)\n task = @task_list.tasks.create!(task_params)\n render json: task\n end",
"def create\n @task = Task.new(task_params)\n respond_to do |format|\n if @task.save\n @users = User.all\n @users.each do |user|\n user.tasks << @task... | [
"0.70283276",
"0.6979206",
"0.69347423",
"0.68283695",
"0.67829514",
"0.67596644",
"0.6630701",
"0.6628671",
"0.6620221",
"0.6580558",
"0.6576762",
"0.6564267",
"0.6546276",
"0.65427387",
"0.65413153",
"0.6502328",
"0.64934987",
"0.6488791",
"0.6481077",
"0.6477163",
"0.64599... | 0.7100527 | 0 |
PUT /people_tasks/1 PUT /people_tasks/1.json | def update
@tasks_person = TasksPerson.find(params[:id])
respond_to do |format|
if @tasks_person.update_attributes(params[:tasks_person])
format.html { redirect_to @tasks_person, notice: 'Tasks person was successfully updated.' }
format.json { head :no_content }
else
format.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\r\n @tasks = Task.find(params[:id])\r\n if @tasks.update(task_params)\r\n render json: @tasks\r\n else\r\n render json: @tasks.errors, status: :unprocessable_entity\r\n end\r\n end",
"def edit_user_task\n task = Task.find(params[:id])\n \n if... | [
"0.7054414",
"0.701209",
"0.701209",
"0.68201935",
"0.67519337",
"0.66676843",
"0.6646136",
"0.66448426",
"0.6598996",
"0.6573599",
"0.65337265",
"0.6518665",
"0.6455328",
"0.64218044",
"0.6417866",
"0.6416317",
"0.63909566",
"0.63806975",
"0.63777274",
"0.63777274",
"0.63777... | 0.71400964 | 0 |
DELETE /people_tasks/1 DELETE /people_tasks/1.json | def destroy
@tasks_person = TasksPerson.find(params[:id])
@tasks_person.destroy
respond_to do |format|
format.html { redirect_to people_tasks_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_task\n @task = Task.find_by(id: params[:id])\n @task.destroy\n render :json => @task.as_json(:only => [:id])\n end",
"def destroy\n name = @task.name\n @task.destroy\n\n render json: [\"You have successfullly deleted '#{name}''\"], status: 200\n end",
"def destroy\n @user_task... | [
"0.7278031",
"0.7105234",
"0.71013814",
"0.7084282",
"0.7056598",
"0.7056598",
"0.70548373",
"0.7045825",
"0.7032664",
"0.7031984",
"0.70243746",
"0.70174325",
"0.700849",
"0.700849",
"0.700849",
"0.700849",
"0.700849",
"0.700849",
"0.700849",
"0.700849",
"0.700849",
"0.700... | 0.7748938 | 0 |
Updates the jira web.xml file with the soulwing (CAS library) authentication configuration | def config_web_xml()
web_xml = File.readlines(self.web_xml()).map do |line|
if line =~ /#{web_xml_token}/
template = File.open("#{DEPLOYER_HOME}/resources/jira_cas_web.xml") { |f| f.read() }
line + ERB.new(template).result(self.send(:binding))
else
line
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_auth\r\n send_request_cgi({\r\n 'uri' => normalize_uri(target_uri.path.to_s, 'login.jsp'),\r\n 'method' => 'POST',\r\n 'cookie' => \"atlassian.xsrf.token=#{@xsrf_token}; #{@session_id}\",\r\n 'vars_post' => {\r\n 'os_username' => datas... | [
"0.58678955",
"0.5813508",
"0.5813508",
"0.54553145",
"0.52606964",
"0.5175465",
"0.51485616",
"0.51173985",
"0.510662",
"0.504985",
"0.5040798",
"0.50070447",
"0.49489963",
"0.49272862",
"0.49161395",
"0.4902212",
"0.48999223",
"0.48954642",
"0.4858142",
"0.48515493",
"0.480... | 0.5831531 | 1 |
Shortcut to jira entityengine.xml file | def entityengine_xml()
"#{self.build_dir()}/src/edit-webapp/WEB-INF/classes/entityengine.xml"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_entityengine_xml()\n ee_xml = File.readlines(self.entityengine_xml()).map do |line|\n if m = /(#{Regexp.quote(self.entityengine_xml_db_token())})/.match(line)\n self.debug(m[0])\n new_str = \"#{m.pre_match}#{entityengine_db}#{m.post_match}\"\n self.debug(new_str)\n... | [
"0.6398696",
"0.5248405",
"0.48659834",
"0.48535803",
"0.48516288",
"0.4803681",
"0.47713846",
"0.47287074",
"0.4721212",
"0.4706146",
"0.4703447",
"0.46532586",
"0.46518803",
"0.46467614",
"0.46467504",
"0.46376362",
"0.46367082",
"0.46184602",
"0.45869818",
"0.45743212",
"0... | 0.7211464 | 0 |
Updates the jira entityengine.xml file with the correct database configs | def config_entityengine_xml()
ee_xml = File.readlines(self.entityengine_xml()).map do |line|
if m = /(#{Regexp.quote(self.entityengine_xml_db_token())})/.match(line)
self.debug(m[0])
new_str = "#{m.pre_match}#{entityengine_db}#{m.post_match}"
self.debug(new_str)
new... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_db\n require \"#{File.dirname(__FILE__)}/../conf/db_schema.rb\"\n Knj::Db::Revision.new.init_db(\"debug\" => false, \"db\" => @db, \"schema\" => Openall_time_applet::DB_SCHEMA)\n end",
"def entityengine_xml()\n \"#{self.build_dir()}/src/edit-webapp/WEB-INF/classes/entityengine.xml\"\n e... | [
"0.57058316",
"0.56865704",
"0.51462287",
"0.5125705",
"0.5029244",
"0.50115347",
"0.48502994",
"0.4849333",
"0.4825936",
"0.480926",
"0.4796927",
"0.47873434",
"0.4776646",
"0.47746593",
"0.47675866",
"0.47366372",
"0.47258762",
"0.47244507",
"0.47176516",
"0.47176516",
"0.4... | 0.6346941 | 0 |
Shortcut to jira seraphconfig.xml file | def seraph_config_xml()
"#{self.build_dir()}/src/webapp/WEB-INF/classes/seraph-config.xml"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_seraph_config_xml()\n seraph_xml = File.readlines(self.seraph_config_xml()).map do |line|\n if m = /(#{Regexp.quote(self.seraph_config_xml_auth_class_token())})/.match(line)\n self.debug(m[0])\n new_str = \"#{m.pre_match}#{self.cas_authenticator_class()}#{m.post_match}\"\n ... | [
"0.5723253",
"0.56698084",
"0.56275",
"0.56238925",
"0.5587852",
"0.55189437",
"0.5508963",
"0.5494081",
"0.54921",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.543... | 0.6575264 | 0 |
Updates the jira seraph_config.xml file with the soulwing authenticator. | def config_seraph_config_xml()
seraph_xml = File.readlines(self.seraph_config_xml()).map do |line|
if m = /(#{Regexp.quote(self.seraph_config_xml_auth_class_token())})/.match(line)
self.debug(m[0])
new_str = "#{m.pre_match}#{self.cas_authenticator_class()}#{m.post_match}"
sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save\r\n SystemConfig.set :auth, to_h, true\r\n end",
"def add_authentication(xml)\n xml.tag! :Authentication do\n xml.tag! :client, @options[:login]\n xml.tag! :password, @options[:password]\n end\n end",
"def add_authentication(xml)\n xml.tag! :Authenti... | [
"0.5323589",
"0.50956655",
"0.50956655",
"0.501868",
"0.49512613",
"0.4914384",
"0.49026796",
"0.48615596",
"0.48091918",
"0.47805527",
"0.4772286",
"0.47704378",
"0.47487733",
"0.47434014",
"0.47265384",
"0.46971887",
"0.46937457",
"0.46818027",
"0.4681231",
"0.46799538",
"0... | 0.62757486 | 0 |
Shortcut to jiraapplication.properties file | def jira_application_properties()
"#{self.build_dir()}/src/edit-webapp/WEB-INF/classes/jira-application.properties"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_jira_application_properties()\n jira_props = File.readlines(self.jira_application_properties()).map do |line|\n if m = /(#{Regexp.quote(jira_home_token)})/.match(line)\n self.debug(m[0])\n new_str = \"#{self.jira_home_token()} #{self.data_dir()}\"\n self.debug(new_... | [
"0.7073052",
"0.56550014",
"0.5536825",
"0.54226947",
"0.53882706",
"0.5310216",
"0.52702767",
"0.5259988",
"0.51730555",
"0.51256853",
"0.5119314",
"0.5119314",
"0.5099526",
"0.5093299",
"0.5065135",
"0.50203323",
"0.49945876",
"0.49896342",
"0.49575347",
"0.49569803",
"0.49... | 0.76433784 | 0 |
Sets the jira.home property in the file: jiraapplication.properties. | def config_jira_application_properties()
jira_props = File.readlines(self.jira_application_properties()).map do |line|
if m = /(#{Regexp.quote(jira_home_token)})/.match(line)
self.debug(m[0])
new_str = "#{self.jira_home_token()} #{self.data_dir()}"
self.debug(new_str)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def jira_application_properties()\n \"#{self.build_dir()}/src/edit-webapp/WEB-INF/classes/jira-application.properties\"\n end",
"def jruby_home\n ENV['JRUBY_HOME'] || RbConfig::CONFIG['prefix']\n end",
"def set_home\n end",
"def home\n @home ||= File.expand_path('~')\n end",
"def... | [
"0.6404565",
"0.5775393",
"0.56609976",
"0.5628493",
"0.55924094",
"0.54392564",
"0.5433737",
"0.5392451",
"0.53642577",
"0.53558356",
"0.5351502",
"0.5227393",
"0.52152365",
"0.5190894",
"0.5190352",
"0.5187228",
"0.51773024",
"0.5165123",
"0.51646346",
"0.514183",
"0.513415... | 0.6387023 | 1 |
Places IST banner jpg in imaages directory | def config_ist_banner()
FileUtils.cp("#{UcbDeployer::RESOURCES_DIR}/ist_banner.jpg",
"#{self.build_dir()}/src/webapp/images/")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def banner_path\n path = @path[0...@path.length - 4] + '_banner.png'\n path_remote = @path_remote[0...@path_remote.length - 4] + '_banner.png'\n File.exists?(path) ? path_remote : 'https://maps.avicus.net' + '/default_map_banner.png' # May need configured\n end",
"def images_path\n @imags_path |... | [
"0.6503407",
"0.63239735",
"0.6185664",
"0.6161505",
"0.6141384",
"0.6141076",
"0.6140199",
"0.60203546",
"0.59374505",
"0.5884834",
"0.58692557",
"0.5857529",
"0.58498365",
"0.5837028",
"0.5834459",
"0.583369",
"0.58140457",
"0.5797562",
"0.57962584",
"0.5750768",
"0.5750231... | 0.7484696 | 0 |
Remove jars from WEBINF/lib that have been installed at the container level to avoid conflicts. | def reshuffle_jars()
FileUtils.mkdir_p("#{self.build_dir()}/src/edit-webapp/WEB-INF/lib/")
FileUtils.cp(Dir["#{UcbDeployer::RESOURCES_DIR}/soulwing-casclient-*"],
"#{self.build_dir()}/src/edit-webapp/WEB-INF/lib/")
# These have been placed in $CATALINA_HOME/lib
["mail", "activ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_jcl_over_slf\n dir_glob = Dir.glob(File.join @app_dir, 'WEB-INF', 'lib', 'jcl-over-slf4*.jar')\n dir_glob.each do |f|\n File.delete f\n end\n end",
"def remove_library(lib)\n lib = lib.to_s\n\n @libraries[:start].delete lib\n @libraries[:sub_session].delete lib\... | [
"0.7207337",
"0.59160626",
"0.5915155",
"0.58779615",
"0.5759871",
"0.57521474",
"0.56346065",
"0.56267524",
"0.5559628",
"0.554475",
"0.5521686",
"0.5498694",
"0.5494546",
"0.54410636",
"0.5403568",
"0.53731227",
"0.5349069",
"0.53250724",
"0.532069",
"0.52869606",
"0.528390... | 0.74428827 | 0 |
Switch Roles! Print 10 Write a method, array_print_10, that puts the numbers 0 9 using an array and the each method | def array_print_10
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_case\n puts \" 1 2 3\" \n for n in 0..2 do #on commence à compter à 0\n print (65+n).chr + \" \" #affiche 65.chr correspond à A en ACSII donc ensuite en ajoutant n, on a B, C, \n @case_array[n][0].print_case\n print \" | \"\n @case_array[n][1].print_case\n ... | [
"0.6275246",
"0.61135775",
"0.6067515",
"0.605335",
"0.6027156",
"0.6023017",
"0.5947229",
"0.59239376",
"0.5899214",
"0.58658105",
"0.5843036",
"0.5827367",
"0.5819852",
"0.58156735",
"0.5802928",
"0.5691142",
"0.56848645",
"0.568277",
"0.56664586",
"0.56591815",
"0.5648665"... | 0.6585481 | 0 |
Write a method, range_print_10, that prints the numbers 0 9 using a range and the each method | def range_print_10
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def range_print_10\n (0..9).step(1) do |n| \n puts n \n end \n \nend",
"def range_print_10\n array = (0..9).to_a\narray.each do |x|\n print x\nend\n\nend",
"def puts_1_to_10\n (1..10).each { |i| puts i }\nend",
"def puts_1_to_10\n (1..10).each { |i| puts i }\nend",
"def output\n @range.each { |... | [
"0.848194",
"0.84154624",
"0.72716564",
"0.72716564",
"0.72206295",
"0.72206295",
"0.72206295",
"0.6939404",
"0.6834125",
"0.66014296",
"0.6543455",
"0.653032",
"0.64792454",
"0.6423243",
"0.6173442",
"0.6123834",
"0.6095711",
"0.60792685",
"0.6077574",
"0.60465443",
"0.60432... | 0.858811 | 0 |
Write a method, integer_print_10, that prints the numbers 0 9 using an integer and the times method | def integer_print_10
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def integer_print_10\n 10.times do |x|\n print x\n end\nend",
"def integer_print_10\n 10.times do |x|\n puts x \n end \nend",
"def q1_print_times(str, num)\n num.times {|num_here|\n p str\n }\nend",
"def repeat(string, int)\n int.times { puts string }\nend",
"def repeat(str, int)\n int.tim... | [
"0.8370745",
"0.8019723",
"0.6917267",
"0.68825996",
"0.6880553",
"0.6847512",
"0.6815837",
"0.6771567",
"0.6735165",
"0.67280626",
"0.6712343",
"0.67103726",
"0.6621699",
"0.66179854",
"0.6608558",
"0.6608558",
"0.6605648",
"0.65978473",
"0.65978473",
"0.6597411",
"0.6565435... | 0.81304765 | 1 |
Parse file Clean balnk or empty lines form a file storing significat lines in given new file returns the number of significant lines | def parse( new_file_name = "#{@full_pathname}.clean.txt" )
lines_total = 0
lines_removed = 0
new_file = File.open( new_file_name, 'w' )
File.open( @full_pathname, 'r' ) do |f|
f.each_line do |curr_line| # Make sure each line has a valid UTF-8 sequence of characters:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_file\n line_count = 0\n @text.each_line do |line|\n if line == nil || line == '' || line.size == 0 || line[0] == '#' || line[0] == \"\\n\"\n next\n end\n elements = line.split(' ')\n if elements.size > 2\n puts 'Waring : '.red + 'in file \"' + @file_name.yellow + '... | [
"0.6748733",
"0.60515606",
"0.59816027",
"0.58807105",
"0.57976073",
"0.576504",
"0.57561237",
"0.5753687",
"0.5722975",
"0.5696997",
"0.56915474",
"0.5690263",
"0.56616646",
"0.5638411",
"0.56324923",
"0.56324923",
"0.5625236",
"0.5614476",
"0.5594559",
"0.55759364",
"0.5569... | 0.62429416 | 1 |
GET /widgets GET /widgets.json | def index
@widgets = Widget.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @widgets }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @widget = Widget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @widget }\n end\n end",
"def widget_data\n widget = WidgetService.widget(params[:widget_id])\n render json: {\n id: widget.id,\n dataset: widget.... | [
"0.7177016",
"0.7001222",
"0.6949288",
"0.6806375",
"0.66883814",
"0.6652928",
"0.6529962",
"0.65087163",
"0.6492304",
"0.6387974",
"0.6324118",
"0.63024807",
"0.6256441",
"0.62365276",
"0.6211567",
"0.61187756",
"0.6062224",
"0.60185045",
"0.5998205",
"0.5934863",
"0.5862095... | 0.75650525 | 0 |
DELETE /widgets/1 DELETE /widgets/1.json | def destroy
@widget = Widget.find(params[:id])
@widget.destroy
respond_to do |format|
format.html { redirect_to widgets_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @simple_widget.destroy\n respond_to do |format|\n format.html { redirect_to simple_widgets_url, notice: 'Simple widget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @widget = Widget.find(params[:id])\n @widget.destroy\n r... | [
"0.7491588",
"0.7396286",
"0.7394976",
"0.71619344",
"0.7030359",
"0.6919996",
"0.6899113",
"0.6899113",
"0.6814794",
"0.6786082",
"0.6743239",
"0.66606027",
"0.66476583",
"0.6640038",
"0.66333085",
"0.656067",
"0.6553023",
"0.6533894",
"0.65147823",
"0.6480145",
"0.6480145",... | 0.77379686 | 1 |
Setting up a Mock to simulate the requests. | def setup
@requester = Rack::MockRequest.new(SampleApp)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mock_request( params, response_body )\n mock_post = {}\n mock_post.expects(:set_form_data).with(params)\n #mock.expects(:[]=).with('user-agent', anything)\n\n url = Smsinabox.uri\n Net::HTTP::Post.expects(:new).with( url.path ).returns(mock_post)\n\n response = Net::HTTPSuccess.new('1.1', 200, 'OK')\n r... | [
"0.7454988",
"0.73365533",
"0.6954197",
"0.6949394",
"0.6843992",
"0.6829548",
"0.6791436",
"0.66415495",
"0.6638607",
"0.6506976",
"0.64272404",
"0.63936895",
"0.6391782",
"0.6391782",
"0.63868284",
"0.62820786",
"0.6260012",
"0.62329465",
"0.62270343",
"0.62055707",
"0.6179... | 0.7829217 | 0 |
Admin only; get a sample of students for looking at data across the site | def sample_students_json
raise Exceptions::EducatorNotAuthorized unless current_educator.can_set_districtwide_access?
seed = params.fetch(:seed, '42').to_i
n = params.fetch(:n, '40').to_i
authorized_sample_students = authorized do
Student.active.sample(n, random: Random.new(seed))
end
sam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def school_students(query={})\n self.simple_client.get(\"/api/v1/schools/my/students?#{query.to_query}\")\n end",
"def my_students(query={})\n self.simple_client.get(\"/api/v1/students?#{query.to_query}\")\n end",
"def index\n @interesting_things = @student.interesting_things\n @other_interesting... | [
"0.701497",
"0.6813282",
"0.6725721",
"0.6725324",
"0.6707405",
"0.6706399",
"0.6561929",
"0.646718",
"0.6463248",
"0.64573634",
"0.64201087",
"0.6418952",
"0.6411673",
"0.64110625",
"0.63979673",
"0.63894325",
"0.6331304",
"0.62793434",
"0.62716544",
"0.6265985",
"0.6256011"... | 0.7318946 | 0 |
GET /actionables GET /actionables.json | def index
@actionables = Actionable.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actions\n return @actions if @actions\n @actions = Client.get(\"/organizations/#{id}/actions\").json_into(Action)\n end",
"def index\n @user_actions = UserAction.all\n render json: @user_actions\n end",
"def abilities\n get('/ability/')\n end",
"def accessories\n render jso... | [
"0.6987696",
"0.6675143",
"0.66332257",
"0.6281451",
"0.62372965",
"0.6201639",
"0.612287",
"0.60770136",
"0.6061981",
"0.60551727",
"0.60406095",
"0.6033963",
"0.60148203",
"0.59778607",
"0.5972194",
"0.5968946",
"0.59606934",
"0.5938351",
"0.5928417",
"0.59201765",
"0.58816... | 0.75978374 | 0 |
POST /actionables POST /actionables.json | def create
@actionable = Actionable.new(actionable_params)
respond_to do |format|
if @actionable.save
format.html { redirect_to @actionable, notice: 'Actionable was successfully created.' }
format.json { render :show, status: :created, location: @actionable }
else
format.htm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @actionables = Actionable.all\n end",
"def create_actionable\n actionable_node = Neography::Node.create(\"object_id\" => self.id, \"object_type\" => self.class.to_s)\n actionable_node.add_to_index(\"actionables_nodes_index\", \"class0id\", \"#{self.class.to_s}0#{self.id}\")\n e... | [
"0.6378845",
"0.59932905",
"0.5918275",
"0.5736906",
"0.57261574",
"0.5713055",
"0.5677671",
"0.5586333",
"0.55838335",
"0.5547208",
"0.55451936",
"0.55003744",
"0.54988986",
"0.5453329",
"0.5431675",
"0.53686136",
"0.5320863",
"0.53139377",
"0.5297027",
"0.5290968",
"0.52830... | 0.66605294 | 0 |
PATCH/PUT /actionables/1 PATCH/PUT /actionables/1.json | def update
respond_to do |format|
if @actionable.update(actionable_params)
format.html { redirect_to @actionable, notice: 'Actionable was successfully updated.' }
format.json { render :show, status: :ok, location: @actionable }
else
format.html { render :edit }
format.jso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n head :forbidden\n\n #@action = Action.find(params[:id])\n\n #if @action.update_attributes(params[:action])\n # head :no_content\n # else\n # render json: @action.errors, status: :unprocessable_entity\n # end\n end",
"def patch(action, **args); end",
"def update\n @edita... | [
"0.6737716",
"0.6182605",
"0.61328727",
"0.600249",
"0.59972954",
"0.5982557",
"0.593613",
"0.59163475",
"0.5911129",
"0.5909275",
"0.58852",
"0.58827823",
"0.5874014",
"0.58598995",
"0.58342785",
"0.58342785",
"0.58342785",
"0.58342785",
"0.5832853",
"0.58304155",
"0.5822878... | 0.68141884 | 0 |
DELETE /actionables/1 DELETE /actionables/1.json | def destroy
@actionable.destroy
respond_to do |format|
format.html { redirect_to actionables_url, notice: 'Actionable was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n ruta = \"/actions/#{action_id}\"\n client.delete(ruta)\n end",
"def delete(action, **args); end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def destroy\n @accessory_act = AccessoryAct.find(params[:id])\n @accessory_act.destroy\n\n respond_t... | [
"0.7239529",
"0.685737",
"0.6722556",
"0.6682913",
"0.6567606",
"0.6560132",
"0.655953",
"0.655689",
"0.6553568",
"0.6549024",
"0.653393",
"0.65276504",
"0.65073866",
"0.6505469",
"0.6480941",
"0.64697516",
"0.64576954",
"0.64461267",
"0.6445829",
"0.6438733",
"0.64309037",
... | 0.7415544 | 0 |
method showing lives remaining | def show_lives
puts "Lives remaining: #{@players[0].name}: #{@players[0].life}/3 - #{@players[1].name}: #{@players[1].life}/3"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_lives(lives)\n puts \"#{lives} Lives left\"\n end",
"def take_life\n @lives -= 1\n end",
"def looses_life\n @lives -= 1\n end",
"def show_state\n if @life_points <= 0\n puts \"#{@name} is dead... \\n...Monde de merde...\"\n else\n puts \"#{@name} has #{@life_points} life ... | [
"0.75132436",
"0.7385032",
"0.73500735",
"0.730432",
"0.7229958",
"0.72146595",
"0.7208545",
"0.708957",
"0.708957",
"0.708957",
"0.708957",
"0.68156254",
"0.67217946",
"0.67131567",
"0.66743046",
"0.66627496",
"0.6622638",
"0.66155505",
"0.66103446",
"0.65931404",
"0.6589625... | 0.7464693 | 1 |
Parse the uploaded file. Resulting data will be in data | def parse(uploaded_file)
parser_class =
case uploaded_file.content_type
when "application/vnd.ms-excel"
ExcelParser
when "text/csv", "application/octet-stream", "text/plain"
CSVParser
else
self.errors << "Do not know how to parse #{uploaded_file.origi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_file(file)\n if file && !file.instance_of?(String)\n parse_contents(file)\n elsif file.instance_of?(String)\n data = File.read(file)\n parse_contents(data)\n else\n self.load_errors = \"No file was selected to upload.\"\n end\n end",
"def uploaded_data... | [
"0.7450316",
"0.68234205",
"0.6747816",
"0.6613368",
"0.6561181",
"0.6537654",
"0.65263605",
"0.64798194",
"0.64629877",
"0.63639116",
"0.6350962",
"0.63383764",
"0.6289999",
"0.6227038",
"0.6218328",
"0.62134504",
"0.62112314",
"0.6200922",
"0.61911684",
"0.6182405",
"0.6147... | 0.718122 | 1 |
Returns array of keys that do not have value in the hash Given +required_keys+ should be an array of +string+ | def missing_keys_from(required_keys)
required_keys.select{ |k| self.get(k).to_s.empty? }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reject_keys *keys\n reject{|k, _| keys.include? k}\n end",
"def reject_keys!(hash, keys)\n hash.reject { |k, _| keys.include?(k) }\n end",
"def arg_hash_keys_required(required_keys, *args)\n args.each do |h|\n missing = required_keys - h.keys\n raise ArgumentError, ... | [
"0.7145525",
"0.71454954",
"0.70673525",
"0.6754895",
"0.6680012",
"0.6556928",
"0.6548558",
"0.6508701",
"0.6506007",
"0.64663833",
"0.6448933",
"0.6435034",
"0.6412506",
"0.6409251",
"0.6377574",
"0.6377338",
"0.6374554",
"0.6373801",
"0.6331329",
"0.6328221",
"0.63118696",... | 0.81626594 | 0 |
Make Update expression 'SET = :' : points to a value from the expression_attribute_value | def make_update_expression_values(event,attr_values)
update_string = 'SET '
event.each do |k,v|
update_string += "#{make_expression_key(k,"names")} = #{attr_values[k].key(v)}, "
end
return update_string[0...-2]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_expression_value\n @expression_value = ExpressionValue.find(params[:id])\n end",
"def update!(**args)\n @sql_expression = args[:sql_expression] if args.key?(:sql_expression)\n end",
"def update!(**args)\n @sql_expression = args[:sql_expression] if args.key?(:sql_expression)... | [
"0.6285116",
"0.62565255",
"0.62565255",
"0.6079802",
"0.6028029",
"0.6019261",
"0.6008429",
"0.5959494",
"0.5922933",
"0.5892387",
"0.587297",
"0.5806208",
"0.5790991",
"0.57007587",
"0.5645627",
"0.5605947",
"0.55957127",
"0.5564535",
"0.5555585",
"0.5554237",
"0.555319",
... | 0.723983 | 0 |
create a new archive by merging this and another archive | def merge(other)
assert_archive other
data = deep_clone(@data)
merge_data data, other.as_json, other.uri
self.class.new data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge!(other)\n assert_archive other\n clear_caches\n\n merge_data @data, other.as_json, other.uri\n nil\n end",
"def merge(other); end",
"def merge(other)\n self.merge_actors(other)\n self.compress_history()\n end",
"def merge(source); end",
"def merge_with other\n ... | [
"0.7187005",
"0.61873007",
"0.6131283",
"0.6020542",
"0.59257907",
"0.59120613",
"0.5880315",
"0.5879201",
"0.5868103",
"0.5865944",
"0.5838",
"0.57779586",
"0.57763475",
"0.577431",
"0.5706385",
"0.56874985",
"0.5685824",
"0.56599903",
"0.5657604",
"0.56480783",
"0.5635691",... | 0.7257923 | 0 |
destructively merge this with the given archive | def merge!(other)
assert_archive other
clear_caches
merge_data @data, other.as_json, other.uri
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge(other)\n assert_archive other\n\n data = deep_clone(@data)\n merge_data data, other.as_json, other.uri\n\n self.class.new data\n end",
"def merge!; end",
"def merge!(with); end",
"def restore_archive\n end",
"def archive!\n archive\n save!(validate: fal... | [
"0.66228884",
"0.62758654",
"0.6235372",
"0.62330544",
"0.6205354",
"0.62046945",
"0.6178792",
"0.6118874",
"0.60017157",
"0.60017157",
"0.60017157",
"0.59287244",
"0.5926497",
"0.5888809",
"0.5877875",
"0.5868271",
"0.58376217",
"0.5812669",
"0.58084846",
"0.5777846",
"0.576... | 0.7215412 | 0 |
Gets the countdownDisplayBeforeRestartInMinutes property value. The number of minutes before the restart time to display the countdown dialog for pending restarts. | def countdown_display_before_restart_in_minutes
return @countdown_display_before_restart_in_minutes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def countdown_display_before_restart_in_minutes=(value)\n @countdown_display_before_restart_in_minutes = value\n end",
"def restart_notification_snooze_duration_in_minutes\n return @restart_notification_snooze_duration_in_minutes\n end",
"def restart_count\n ... | [
"0.77445376",
"0.5822122",
"0.58177066",
"0.5649487",
"0.561191",
"0.55909705",
"0.55909705",
"0.55469835",
"0.54971653",
"0.5386674",
"0.53762263",
"0.53762263",
"0.5256719",
"0.5256719",
"0.51962405",
"0.51962405",
"0.5191844",
"0.51666063",
"0.5147846",
"0.5135285",
"0.513... | 0.82854724 | 0 |
Sets the countdownDisplayBeforeRestartInMinutes property value. The number of minutes before the restart time to display the countdown dialog for pending restarts. | def countdown_display_before_restart_in_minutes=(value)
@countdown_display_before_restart_in_minutes = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def countdown_display_before_restart_in_minutes\n return @countdown_display_before_restart_in_minutes\n end",
"def restart_notification_snooze_duration_in_minutes=(value)\n @restart_notification_snooze_duration_in_minutes = value\n end",
"def restart_count=(v... | [
"0.7300913",
"0.5887486",
"0.5757111",
"0.5319283",
"0.52962637",
"0.5211868",
"0.5211868",
"0.51519156",
"0.51368046",
"0.51368046",
"0.5113679",
"0.5015245",
"0.49272695",
"0.49153465",
"0.49153465",
"0.49071556",
"0.49071556",
"0.4846544",
"0.4619251",
"0.45845246",
"0.457... | 0.8163413 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.