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 |
|---|---|---|---|---|---|---|
Check if resize is needed with given size/format | def resize_needed?(record, format, size)
return false if size == 'raw'
# needed if size given
w, h, method = size.scan(/(\d+)x(\d+)([a-z]*\d*)/).shift
return true if method && !method.empty?
# compare given format with original format
w, h = [w, h].map{|i| i.to_i}
if w > rec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_for_resize; end",
"def size_check(size)\n size_regex = /[0-1]{32}/\n if size_regex.match(size)\n true\n else\n false\n end\n end",
"def validate_resize\n {:available => supports_resize?, :message => unsupported_reason(:resize)}\n end",
"def resized?\n ... | [
"0.7537509",
"0.71153796",
"0.7025197",
"0.7008939",
"0.68590516",
"0.6841737",
"0.67779464",
"0.67657447",
"0.66983736",
"0.66901475",
"0.6632904",
"0.6510663",
"0.6480149",
"0.64763594",
"0.6446239",
"0.64386755",
"0.6391648",
"0.6314624",
"0.6283522",
"0.6268646",
"0.62298... | 0.85307163 | 0 |
Overwrite this method to customize how ticket types are displayed across all pages of the admin dashboard. | def display_resource(ticket_type)
"#{ticket_type.name}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_ticket_type\n @ticket_type = TicketType.find(params[:id])\n end",
"def set_ticket_type\n @ticket_type = TicketType.find(params[:id])\n end",
"def method_missing(method, *args)\n if Show.ticket_types.include?(method.to_s)\n tickets_for_type(method.to_s)\n else\n super... | [
"0.6064187",
"0.59920865",
"0.58284974",
"0.5583125",
"0.544115",
"0.5427817",
"0.541394",
"0.53981894",
"0.5340363",
"0.52932054",
"0.5277448",
"0.5276416",
"0.52627563",
"0.5228534",
"0.5221758",
"0.52075344",
"0.519331",
"0.51874226",
"0.51859885",
"0.5170269",
"0.51496357... | 0.6357834 | 0 |
POST /parlos POST /parlos.json | def create
@parlo = Parlo.new(parlo_params)
respond_to do |format|
if @parlo.save
format.html { redirect_to @parlo, notice: 'Parlo was successfully created.' }
format.json { render action: 'show', status: :created, location: @parlo }
else
format.html { render action: 'new' }... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @parish = Parish.new(parish_params)\n\n if @parish.save\n render json: @parish, status: :created, location: @parish\n else\n render json: @parish.errors, status: :unprocessable_entity\n end\n end",
"def create\n @parola = Parola.new(parola_params)\n\n respond_to do |form... | [
"0.6837842",
"0.67962027",
"0.67568815",
"0.6716278",
"0.6693855",
"0.6574767",
"0.64438313",
"0.6407797",
"0.6358489",
"0.63414216",
"0.6319846",
"0.6317831",
"0.6253401",
"0.6245385",
"0.6232081",
"0.62270755",
"0.61835235",
"0.6180087",
"0.6173875",
"0.6163978",
"0.6163871... | 0.6960537 | 0 |
DELETE /parlos/1 DELETE /parlos/1.json | def destroy
@parlo.destroy
respond_to do |format|
format.html { redirect_to parlos_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @parola.destroy\n respond_to do |format|\n format.html { redirect_to parolas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :n... | [
"0.71673435",
"0.713465",
"0.6976745",
"0.69339126",
"0.68977696",
"0.6890458",
"0.6880215",
"0.6876861",
"0.6871993",
"0.6869327",
"0.6861193",
"0.6860957",
"0.6860834",
"0.68385977",
"0.6816877",
"0.6816148",
"0.6812603",
"0.6807853",
"0.68072826",
"0.67992425",
"0.6797138"... | 0.72477704 | 0 |
GET /losts GET /losts.json | def index
@losts = Lost.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @losts }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end",
"def index\n @laws = Law.ordered_roots\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @laws }\n end\n end",
"def ... | [
"0.64416194",
"0.628549",
"0.62795436",
"0.6240283",
"0.62273544",
"0.6200244",
"0.61977506",
"0.6154882",
"0.60920984",
"0.6023547",
"0.5978034",
"0.5973906",
"0.5968594",
"0.5887524",
"0.5859618",
"0.5849309",
"0.5834157",
"0.58098084",
"0.5793541",
"0.5778229",
"0.5775035"... | 0.6964957 | 0 |
GET /losts/new GET /losts/new.json | def new
@lost = Lost.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @lost }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @lid = Lid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lid }\n end\n end",
"def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end... | [
"0.7195165",
"0.71023077",
"0.708168",
"0.70173556",
"0.7007016",
"0.6966751",
"0.6940093",
"0.6890926",
"0.6887306",
"0.68593323",
"0.68539417",
"0.68539417",
"0.6852864",
"0.68483835",
"0.68387836",
"0.68248814",
"0.68201613",
"0.6804131",
"0.6799369",
"0.6796867",
"0.67966... | 0.7143105 | 1 |
Renders the embedded action specified as the response for the current method | def embed_action(options) #:doc:
embedded_logging(options) do
response = embedded_response(options, true)
render_for_text(response.body, response.headers["Status"])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invoke_action(name)\n self.send(name)\n render(name.to_s) unless already_built_response?\n end",
"def invoke_action(name)\n self.send(name)\n render(name) unless already_built_response?\n end",
"def invoke_action(name)\n self.send(name)\n render(name) unless already_built_response?\n e... | [
"0.7219615",
"0.7130751",
"0.7130751",
"0.70759094",
"0.7059984",
"0.70555645",
"0.69769233",
"0.6949417",
"0.69198525",
"0.68638724",
"0.66894233",
"0.66840553",
"0.66332024",
"0.6608867",
"0.66017145",
"0.65116215",
"0.6484417",
"0.6369271",
"0.631382",
"0.63033664",
"0.630... | 0.75276 | 0 |
Returns the embedded action response as a string | def embed_action_as_string(options) #:doc:
embedded_logging(options) do
response_for_embeded_action = embedded_response(options, false)
if redirected = response_for_embeded_action.redirected_to
embed_action_as_string(redirected)
else
response_fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n @textual_representation ||= (\n \"Action: #{@name}\\r\\nActionID: #{@action_id}\\r\\n\" +\n @headers.map { |(key,value)| \"#{key}: #{value}\" }.join(\"\\r\\n\") +\n (@headers.any? ? \"\\r\\n\\r\\n\" : \"\\r\\n\")\n )\n end",
"def to_s\n @response.body\n... | [
"0.7483922",
"0.68890435",
"0.6777473",
"0.63436365",
"0.63130826",
"0.628629",
"0.6127121",
"0.612497",
"0.60926944",
"0.60641253",
"0.60602903",
"0.6054943",
"0.59947586",
"0.59476125",
"0.59476125",
"0.59399664",
"0.59180045",
"0.5913386",
"0.59043986",
"0.5896627",
"0.589... | 0.7869257 | 0 |
GET /admin/public_transports GET /admin/public_transports.json | def index
@admin_public_transports = City.find(session[:current_city_id]).utility.public_transports.page(params[:page]).per(10)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_admin_public_transport\n @admin_public_transport = PublicTransport.find(params[:id])\n end",
"def public_transport_options_url\n url(:public_transport_options)\n end",
"def create\n @admin_public_transport = City.find(session[:current_city_id]).utility.public_transports.new(admin_public_... | [
"0.6418957",
"0.6066269",
"0.5986751",
"0.5724263",
"0.5653513",
"0.556749",
"0.5539823",
"0.550631",
"0.5501001",
"0.5439615",
"0.5435778",
"0.5320109",
"0.5319846",
"0.5257627",
"0.5238383",
"0.5215166",
"0.5200068",
"0.519801",
"0.51423156",
"0.51242054",
"0.5105193",
"0... | 0.733658 | 0 |
POST /admin/public_transports POST /admin/public_transports.json | def create
@admin_public_transport = City.find(session[:current_city_id]).utility.public_transports.new(admin_public_transport_params)
respond_to do |format|
if @admin_public_transport.save
format.html { redirect_to session['previous_url'] || admin_public_transports_url, notice: 'Mezzi pubblici è... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @cabinet_transport = current_user.transports.new(cabinet_transport_params)\n respond_to do |format|\n if @cabinet_transport.save\n public_send(params[:transport][:status])\n format.html { redirect_to cabinet_transports_path, notice: I18n.t('created') }\n else\n for... | [
"0.6344577",
"0.60450405",
"0.5857497",
"0.5849306",
"0.5844672",
"0.5554616",
"0.55398196",
"0.5468606",
"0.5415901",
"0.5362593",
"0.5227561",
"0.51722413",
"0.5086547",
"0.4937038",
"0.49364933",
"0.48590758",
"0.48590758",
"0.48590758",
"0.4847331",
"0.48366293",
"0.48092... | 0.7043652 | 0 |
PATCH/PUT /admin/public_transports/1 PATCH/PUT /admin/public_transports/1.json | def update
respond_to do |format|
if @admin_public_transport.update(admin_public_transport_params)
format.html { redirect_to session['previous_url'] || admin_public_transports_url, notice: 'Mezzi pubblici è stato aggiornato con successo.' }
format.json { render :show, status: :ok, location: @a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @cabinet_transport.update(cabinet_transport_params)\n public_send(params[:transport][:status])\n format.html { redirect_to cabinet_transports_path, notice: I18n.t('updated') }\n else\n format.html { render :edit }\n format.json { ren... | [
"0.6401045",
"0.59542453",
"0.5894345",
"0.5666393",
"0.5663819",
"0.56543094",
"0.5633437",
"0.56015205",
"0.5586878",
"0.5560855",
"0.55492276",
"0.5544656",
"0.55069536",
"0.5471202",
"0.5465397",
"0.5448703",
"0.5426422",
"0.5425086",
"0.5379716",
"0.5372745",
"0.53645444... | 0.66331583 | 0 |
DELETE /admin/public_transports/1 DELETE /admin/public_transports/1.json | def destroy
@admin_public_transport.destroy
respond_to do |format|
format.html { redirect_to session['previous_url'] || admin_public_transports_url, notice: 'Mezzi pubblici cancellata con successo!.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @cabinet_transport.destroy\n respond_to do |format|\n format.html { redirect_to cabinet_transports_path, notice: I18n.t('deleted') }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :destroy, @transport\n @transport.destroy\n respond_to do |for... | [
"0.68462825",
"0.6762606",
"0.6588885",
"0.6584615",
"0.65397125",
"0.65143085",
"0.65143085",
"0.64985776",
"0.6479285",
"0.64777297",
"0.6444727",
"0.64173186",
"0.6408993",
"0.6397208",
"0.63912153",
"0.6366906",
"0.63666797",
"0.63544965",
"0.63475996",
"0.6327082",
"0.63... | 0.72813874 | 0 |
cdm api XML: dmGetCompoundObjectInfo | def get_compound_object_info(repository, collection, pointer)
cdm_compound_object_info_url = repository.cdm_url + "dmGetCompoundObjectInfo/#{collection.alias}/#{pointer}/xml"
compound_object_info = Nokogiri::XML(open(cdm_compound_object_info_url))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_obj_child_content(object, name)\n k = object.to_kml\n get_child_content(k, name)\nend",
"def merritt_object_info\n repo = APP_CONFIG[:repository]\n collection = repo.endpoint.match(%r{[^/]+$}).to_s\n enc_doi = ERB::Util.url_encode(to_s)\n resp = HTTP.basic_auth(user: repo.username, ... | [
"0.5238811",
"0.51114553",
"0.5109243",
"0.50747055",
"0.5051831",
"0.5051488",
"0.5019912",
"0.5006841",
"0.4989428",
"0.49697152",
"0.49496165",
"0.49109524",
"0.49029",
"0.48999515",
"0.48261774",
"0.48259687",
"0.4823561",
"0.47742602",
"0.475223",
"0.47288036",
"0.468895... | 0.74967504 | 0 |
GET /gyms GET /gyms.json | def index
@gyms = Gym.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n format.html {render json: @gig, status: :ok}\n format.json { render json: @gig, status: :ok }\n end\n end",
"def show\n @gpath = Gpath.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n ... | [
"0.6129732",
"0.60734826",
"0.60234696",
"0.6003654",
"0.59175116",
"0.5890951",
"0.5874421",
"0.5866508",
"0.58539283",
"0.5844898",
"0.5843303",
"0.58239025",
"0.5783119",
"0.5781402",
"0.57617927",
"0.5759709",
"0.57529277",
"0.5743247",
"0.5700198",
"0.5677917",
"0.565811... | 0.6267864 | 0 |
create earl and return json of errors or short_url | def create
earl = Earl.find_or_create_by(earl_params)
if earl.persisted?
render json: { short_url: earl_url(earl) }
else
render json: earl.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_error(msg, status)\n {\n json: {\n errors: [\n {\n \"status\": Rack::Utils::SYMBOL_TO_STATUS_CODE[status].to_s,\n \"title\": msg,\n \"detail\": msg\n }\n ]\n },\n content_type: 'application/vnd.api+json',\n status: st... | [
"0.62392783",
"0.601064",
"0.59949166",
"0.592691",
"0.58961827",
"0.58754224",
"0.5864362",
"0.58566266",
"0.5839177",
"0.58107924",
"0.58028656",
"0.5801584",
"0.57728195",
"0.5763886",
"0.57595736",
"0.5753104",
"0.5744223",
"0.57367474",
"0.571191",
"0.57087755",
"0.57033... | 0.61778057 | 1 |
this message takes a prototype message, copies it, and returns the copy with its node set to this node | def new_message_from(prototype_message)
copy = prototype_message.clone
copy.node = self
copy
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _protocolelement\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_typedef)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_messagedef)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_protocolelement unless _tmp\n ... | [
"0.58759046",
"0.56551427",
"0.55807036",
"0.55738306",
"0.5541068",
"0.5504815",
"0.55013496",
"0.55013496",
"0.54699284",
"0.54200774",
"0.5374517",
"0.5315082",
"0.5315082",
"0.5280639",
"0.5259941",
"0.5257361",
"0.52310675",
"0.5225687",
"0.5224692",
"0.52061325",
"0.520... | 0.84180677 | 0 |
create a new Request message associated with this node | def request(*a)
request = Request.new(*a)
request.node = self
request
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @request = Request.new\n end",
"def create\n\n #Can params be fulfilled through the headers as well?\n #Checks the receiver and group id parameter to see if they exist\n #Then create a new Request with parameters through the body, including group id and receiver id\n\n ... | [
"0.67885286",
"0.6738931",
"0.6690406",
"0.65296906",
"0.64988613",
"0.649336",
"0.649336",
"0.63689065",
"0.6322263",
"0.6273313",
"0.6269184",
"0.62345475",
"0.62301904",
"0.6212856",
"0.6201536",
"0.619085",
"0.61863214",
"0.61597085",
"0.6124218",
"0.6123787",
"0.6120403"... | 0.6854871 | 0 |
Build a SysEx message object of the given type using the given bytes | def build_typed_message(message_class, bytes)
bytes = bytes.dup
fixed_length_message_part = bytes.slice!(0,7)
manufacturer_id = fixed_length_message_part[0]
device_id = fixed_length_message_part[1]
model_id = fixed_length_message_part[2]
address = fixed_length_message_p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build(*bytes)\n if is_sysex?(bytes)\n\n # if the 4th byte isn't status, we will just make this a Message object\n # -- this may need some tweaking\n message_class = get_message_class(bytes)\n\n if message_class.nil?\n Message.new(bytes)\n else\n ... | [
"0.8077976",
"0.6352178",
"0.6212186",
"0.5851414",
"0.5851414",
"0.58353204",
"0.5750312",
"0.564131",
"0.560129",
"0.55621517",
"0.55470395",
"0.55449325",
"0.5513025",
"0.5488252",
"0.5449802",
"0.535901",
"0.5350721",
"0.53396714",
"0.5319383",
"0.53100204",
"0.52932036",... | 0.7454272 | 1 |
Define a group for files. Works similar to add_filter, only that the first argument is the desired group name and files PASSING the filter end up in the group (while filters exclude when the filter is applicable). | def add_group(group_name, filter_argument = nil)
groups[group_name] = filter_argument
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_group(group_name, filter_argument = T.unsafe(nil), &filter_proc); end",
"def add_file_filter(file_filter)\n @filter_file = file_filter\n end",
"def add_file_filter(file_filter)\n @filter_file = file_filter\n end",
"def grouped(files); end",
"def group(arg = nil)\n set_or_return(\n ... | [
"0.7426042",
"0.5910355",
"0.5910355",
"0.5903443",
"0.55968815",
"0.5584078",
"0.5584078",
"0.55437815",
"0.5518371",
"0.5512579",
"0.54837406",
"0.5470386",
"0.54386187",
"0.54046345",
"0.5384108",
"0.5371239",
"0.5354653",
"0.53545314",
"0.5351436",
"0.53167856",
"0.531623... | 0.7241241 | 1 |
Initializes card to the appropriate suit and identifier passed in. | def initialize( suit, identifier )
@suit, @identifier = suit, identifier
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(suit)\n raise \"Suit cannot be nil\" if suit.nil?\n raise \"Unknown suit\" unless Card::VALID_SUITS.include?(suit)\n @suit = suit\n end",
"def initialize suit, value\n raise 'Invalid card suit' unless SUITS.include? suit\n raise 'Invalid card value' unless value.to_i >= 0 && value.... | [
"0.7423188",
"0.7107194",
"0.7072371",
"0.6820361",
"0.6800539",
"0.6769643",
"0.67607164",
"0.66561794",
"0.6617111",
"0.6545238",
"0.65353155",
"0.65175414",
"0.6499368",
"0.6486053",
"0.64842564",
"0.6483858",
"0.648019",
"0.648019",
"0.648019",
"0.648019",
"0.648019",
"... | 0.7887861 | 0 |
Returns if Card is a face card. | def face_card?
[:jack,:queen,:king].include? @identifier
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_face?\n\n if @rank.type == CardType::FACE_TYPE\n return true\n end\n\n return false\n end",
"def ==(other_card)\n self.face == other_card.face \n end",
"def meld?\n double_faced? && linked_card_present?\n end",
"def always_face_camera?\n end",
"def f... | [
"0.8765185",
"0.6549804",
"0.64570886",
"0.63856673",
"0.6381932",
"0.6196407",
"0.61902636",
"0.6185416",
"0.615992",
"0.6143472",
"0.6079012",
"0.6040689",
"0.6018255",
"0.5991708",
"0.5906159",
"0.5886993",
"0.5872196",
"0.58553874",
"0.583711",
"0.58266145",
"0.58049655",... | 0.70265764 | 1 |
Returns Card's largest possible values. | def largest_value
values.max
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def card_value\n card_values = cards.map { |card| card.straight_value }\n [4, 3, 2].each do |num|\n if card_values.any? { |value| card_values.count(value) == num }\n return card_values.select { |value| card_values.count(value) == num }.max\n end\n end\n card_values.max\n end",
"def ... | [
"0.80904263",
"0.7450365",
"0.7330993",
"0.718418",
"0.7171719",
"0.708812",
"0.7079365",
"0.7068776",
"0.6940818",
"0.6921161",
"0.69071347",
"0.68622667",
"0.6854297",
"0.6808591",
"0.6782165",
"0.67820007",
"0.6768079",
"0.6756314",
"0.6740205",
"0.67398137",
"0.67294383",... | 0.7826979 | 1 |
Were we able to load the adapter? If false the adapter is broken and can't be used. | def ok?
! adapter.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_adapter\n return false if !auto_load?\n\n path = \"#{namespace}/adapters/#{orm.to_s.underscore}\"\n begin\n require path\n rescue\n raise \"Adapter for :#{orm} could not be found at: #{path}\"\n end\n end",
"def adapter_supported?(a = cache_conn_... | [
"0.6401125",
"0.6395244",
"0.61005044",
"0.6060216",
"0.5957143",
"0.5944472",
"0.59409356",
"0.59346896",
"0.5886999",
"0.584881",
"0.58410597",
"0.5837756",
"0.58242005",
"0.5820289",
"0.5800702",
"0.5800702",
"0.57819253",
"0.5772288",
"0.5737271",
"0.57259995",
"0.570375"... | 0.73244876 | 0 |
Given intcode program, return output Position 0: Output Position 1: Noun Position 2: Verb | def run_program(intcode_program, noun, verb)
program = intcode_program.clone.map(&:clone)
program[1] = noun
program[2] = verb
program.each_slice(4) do |opcode, a, b, res|
# puts "#{opcode}, #{a}, #{b}, #{res}"
if opcode == 1
program[res] = program[a] + program[b]
els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_program(input, intcodes)\n relative_base = 0\n pointer = 0\n instruction = intcodes[pointer]\n opcode = instruction % 100\n modes = (instruction / 100).digits\n\n while opcode != 99\n mode1 = modes[0] || 0\n mode2 = modes[1] || 0\n mode3 = modes[2] || 0\n input_param1 = intcodes[pointer +... | [
"0.5660523",
"0.5531132",
"0.5463023",
"0.54610914",
"0.5449115",
"0.5443019",
"0.54297477",
"0.5349472",
"0.5349472",
"0.5349472",
"0.5349472",
"0.5349472",
"0.5349472",
"0.5349472",
"0.5349472",
"0.5349472",
"0.5349472",
"0.5349472",
"0.5349472",
"0.5317726",
"0.53069466",
... | 0.6279002 | 0 |
Returns +true+ if the simplified type matches the current | def like?(other)
if other.respond_to?(:simplified)
@simplified == other.simplified
else
@simplified == Type.simplified(other)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matches?(actual)\n matches_type?(actual)\n end",
"def type_of?(type)\n type.raw_type == raw_type\n end",
"def same_type_guard?\n @type_guard == true\n end",
"def same_types?(other)\n types == other.types\n end",
"def type?( in_type )\n type == in_type\n e... | [
"0.675165",
"0.6670417",
"0.66009855",
"0.65969235",
"0.6513892",
"0.64469",
"0.61964446",
"0.6195362",
"0.61723673",
"0.6169768",
"0.6169768",
"0.6168377",
"0.61437327",
"0.61273307",
"0.603168",
"0.59812254",
"0.5976311",
"0.5962072",
"0.5944009",
"0.5933795",
"0.5905497",
... | 0.7010499 | 0 |
Returns +true+ if the other object is a MIME::Type and the content types match. | def eql?(other)
other.kind_of?(MIME::Type) and self == other
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eql?(other)\n other.is_a?(MIME::Type) && (self == other)\n end",
"def is_mime_type? m\n MIME::Type.new m rescue false\n end",
"def is_mime_type? m\n MIME::Type.new m rescue false\n end",
"def accepts_content_type?(content_type)\n accepted_content_types.include? content_type.t... | [
"0.80186635",
"0.73652184",
"0.73652184",
"0.72565085",
"0.7126272",
"0.697212",
"0.6962201",
"0.6908504",
"0.6894822",
"0.67047286",
"0.66698",
"0.66053003",
"0.6587885",
"0.6451965",
"0.6420071",
"0.635776",
"0.62732553",
"0.62386334",
"0.6193321",
"0.6188045",
"0.6172817",... | 0.80287284 | 0 |
Returns +true+ if the media type is obsolete. | def obsolete?
@obsolete ? true : false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def obsolete?\n self.obsolete\n end",
"def spoofed?\n has_extension? and media_type_mismatch?\n end",
"def obsolete?\n !@obsolete.nil?\n end",
"def acceptable?(media_type)\n !matches(media_type).empty?\n end",
"def has_mime_version?\n !fields.select { |f... | [
"0.67698723",
"0.67099357",
"0.6613109",
"0.6528122",
"0.6130997",
"0.60547906",
"0.60480577",
"0.5994004",
"0.59595877",
"0.58103603",
"0.5807145",
"0.58045477",
"0.579972",
"0.57910097",
"0.5756383",
"0.5694758",
"0.56660914",
"0.56599283",
"0.5640095",
"0.55320626",
"0.550... | 0.69200516 | 0 |
The decoded URL list for this MIME::Type. The special URL value IANA will be translated into: The special URL value RFC will be translated into: The special URL value DRAFT:name will be translated into: command=id_detail&filename= The special URL value LTSW will be translated into: The special URL value [token] will be... | def urls
@url.map do |el|
case el
when %r{^IANA$}
IANA_URL % [ @media_type, @sub_type ]
when %r{^RFC(\d+)$}
RFC_URL % $1
when %r{^DRAFT:(.+)$}
DRAFT_URL % $1
when %r{^LTSW$}
LTSW_URL % @media_type
when %r{^\{([^=]+)=([^\}]+)\}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url_for_list(type); end",
"def getTypeUrlFromTypesObject(types)\n return types.map {|x| x['type']['url']}.compact\nend",
"def fetch_urls(name, format, size='raw')\n [self::CONTENT_TYPES[format.to_sym], retrieve_image(name, format, size, :url)]\n end",
"def urls\n @urls ||= extract_urls('u... | [
"0.5973897",
"0.5915847",
"0.56830853",
"0.56195205",
"0.55429244",
"0.55402166",
"0.5528285",
"0.54727757",
"0.5470889",
"0.54431856",
"0.5427365",
"0.53962594",
"0.5368025",
"0.53545254",
"0.5330269",
"0.527063",
"0.52570546",
"0.52491903",
"0.52190703",
"0.5196044",
"0.519... | 0.7333421 | 0 |
Creates a MIME::Type from an array in the form of: [typename, [extensions], encoding, system] +extensions+, +encoding+, and +system+ are optional. MIME::Type.from_array("application/xruby", ['rb'], '8bit') MIME::Type.from_array(["application/xruby", ['rb'], '8bit']) These are equivalent to: MIME::Type.new('application/... | def from_array(*args) #:yields MIME::Type.new:
# Dereferences the array one level, if necessary.
args = args[0] if args[0].kind_of?(Array)
if args.size.between?(1, 8)
m = MIME::Type.new(args[0]) do |t|
t.extensions = args[1] if args.size > 1
t.encoding = ar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_mime_types\n types = mime_types.map(&:to_s)\n exts = file_extensions.map(&:to_sym)\n type = types.shift\n ext = exts.shift\n __debug_mime(binding) do\n { type: type, ext: ext, types: types, exts: exts }\n end\n return unless type && ext\n Mime::Type.r... | [
"0.54581994",
"0.5360973",
"0.53059876",
"0.526344",
"0.5253506",
"0.52173436",
"0.52030784",
"0.5197039",
"0.51796395",
"0.51610863",
"0.4979936",
"0.49456322",
"0.48853916",
"0.48640263",
"0.48536608",
"0.48334914",
"0.47911787",
"0.47864822",
"0.47864822",
"0.47569776",
"0... | 0.7875051 | 0 |
Creates a MIME::Type from a hash. Keys are caseinsensitive, dashes may be replaced with underscores, and the internal Symbol of the lowercaseunderscore version can be used as well. That is, ContentType can be provided as contenttype, Content_Type, content_type, or :content_type. Known keys are ContentType, ContentTrans... | def from_hash(hash) #:yields MIME::Type.new:
type = {}
hash.each_pair do |k, v|
type[k.to_s.tr('A-Z', 'a-z').gsub(/-/, '_').to_sym] = v
end
m = MIME::Type.new(type[:content_type]) do |t|
t.extensions = type[:extensions]
t.encoding = type[:content_transf... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(hash = nil)\n return if hash.nil?\n\n names = self.class.name_mapping\n types = self.class.type_mapping\n\n names.each do |key, value|\n type = types[key]\n if type.instance_of? Hash\n # array\n if type['type'].instance_of? String\n if t... | [
"0.5832479",
"0.5802709",
"0.5802709",
"0.57083106",
"0.5689842",
"0.5653323",
"0.5528606",
"0.5508103",
"0.5433375",
"0.5404923",
"0.5393855",
"0.5261616",
"0.5218015",
"0.51803243",
"0.51277155",
"0.5120483",
"0.5088111",
"0.506371",
"0.5046832",
"0.50420743",
"0.50395846",... | 0.79048795 | 0 |
Essentially a copy constructor. MIME::Type.from_mime_type(plaintext) is equivalent to: MIME::Type.new(plaintext.content_type.dup) do |t| t.extensions = plaintext.extensions.dup t.system = plaintext.system.dup t.encoding = plaintext.encoding.dup end | def from_mime_type(mime_type) #:yields the new MIME::Type:
m = MIME::Type.new(mime_type.content_type.dup) do |t|
t.extensions = mime_type.extensions.map { |e| e.dup }
t.url = mime_type.url && mime_type.url.map { |e| e.dup }
mime_type.system && t.system = mime_type.system.dup
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(name, contents, mime_type = nil)\n @name = name\n @contents = contents\n @mime_type = mime_type\n end",
"def from_hash(hash) #:yields MIME::Type.new:\n type = {}\n hash.each_pair do |k, v|\n type[k.to_s.tr('A-Z', 'a-z').gsub(/-/, '_').to_sym] = v\n ... | [
"0.5499078",
"0.53854036",
"0.53601915",
"0.535145",
"0.5323281",
"0.53113246",
"0.52811605",
"0.5248975",
"0.5211693",
"0.52114415",
"0.5189277",
"0.51608783",
"0.5151399",
"0.5147817",
"0.5147817",
"0.513621",
"0.5128816",
"0.51108456",
"0.51055366",
"0.51055366",
"0.510553... | 0.69276434 | 0 |
Builds a MIME::Type object from the provided MIME Content Type value (e.g., 'text/plain' or 'applicaton/xeruby'). The constructed object is yielded to an optional block for additional configuration, such as associating extensions and encoding information. | def initialize(content_type) #:yields self:
matchdata = MEDIA_TYPE_RE.match(content_type)
if matchdata.nil?
raise InvalidContentType, "Invalid Content-Type provided ('#{content_type}')"
end
@content_type = content_type
@raw_media_type = matchdata.captures[0]
@raw_sub_type =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_mime_type(mime_type) #:yields the new MIME::Type:\n m = MIME::Type.new(mime_type.content_type.dup) do |t|\n t.extensions = mime_type.extensions.map { |e| e.dup }\n t.url = mime_type.url && mime_type.url.map { |e| e.dup }\n\n mime_type.system && t.system = mime_type.system... | [
"0.7560522",
"0.6514348",
"0.6347539",
"0.6267406",
"0.6225199",
"0.62220603",
"0.61746335",
"0.612792",
"0.6123322",
"0.61057365",
"0.60967654",
"0.6055949",
"0.6015735",
"0.6002599",
"0.59990335",
"0.59990335",
"0.59954023",
"0.59911734",
"0.59911734",
"0.5965426",
"0.59312... | 0.690078 | 1 |
:nodoc: MIME types can be specified to be sent across a network in particular formats. This method returns +true+ when the MIME type encoding is set to base64. | def binary?
@encoding == 'base64'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base64?\n !!@options[:base64]\n end",
"def base64_encoded?(string)\n !!string.gsub(/[\\r\\n]|\\\\r|\\\\n/, \"\").match(BASE64_FORMAT)\n end",
"def base64_encoded?(string)\n !!string.gsub(/[\\r\\n]|\\\\r|\\\\n/, \"\").match(BASE64_FORMAT)\n end",
"def is_mime_type? m\n ... | [
"0.7471699",
"0.6972102",
"0.6972102",
"0.6958315",
"0.6958315",
"0.68058914",
"0.67527795",
"0.6712815",
"0.662755",
"0.66107416",
"0.65256065",
"0.6484303",
"0.64764154",
"0.64274573",
"0.64264715",
"0.6398865",
"0.63851565",
"0.63667953",
"0.6366754",
"0.6331173",
"0.63297... | 0.7175844 | 1 |
Returns +true+ when the simplified MIME type is in the list of known digital signatures. | def signature?
SIGNATURES.include?(@simplified.downcase)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spoofed?\n has_extension? and media_type_mismatch?\n end",
"def signatures?\n @signatures ? true : false\n end",
"def has_signature?\n auth_info.include? \"signature\"\n end",
"def supports_derivatives?\n (attachment_content_type =~ %r{^(image|(x-)?application)/... | [
"0.6866516",
"0.6774074",
"0.65911144",
"0.658952",
"0.65509635",
"0.650918",
"0.6488139",
"0.6473594",
"0.64672464",
"0.64583576",
"0.64307946",
"0.6344426",
"0.6300139",
"0.6200916",
"0.6186729",
"0.6162996",
"0.61565775",
"0.61433417",
"0.6122628",
"0.6111413",
"0.61010665... | 0.74839467 | 0 |
Returns +true+ if the MIME::Type is specific to the current operating system as represented by RUBY_PLATFORM. | def platform?
system? and (RUBY_PLATFORM =~ @system)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sensible_os?\n\n return ::RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? false : true\n\n end",
"def supported_platform?\n linux? || darwin?\n end",
"def client_os? system\n detect_os == system.to_sym\n end",
"def is_unix_like?\n os_type !~ /^\\s*windows\\s*$/i\n end",
"def ... | [
"0.73754597",
"0.7086139",
"0.7008266",
"0.69815487",
"0.6931801",
"0.68902403",
"0.67998827",
"0.6761456",
"0.6740946",
"0.6740946",
"0.6683693",
"0.6681238",
"0.66501474",
"0.6581801",
"0.6565884",
"0.6527999",
"0.65129095",
"0.65083176",
"0.650197",
"0.6489739",
"0.6485129... | 0.7453852 | 0 |
Returns the MIME type as a string for implicit conversions. | def to_str
@content_type
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content_type_string\n Mime::Type.lookup_by_extension(content_type).to_s\n end",
"def to_str\n content_type\n end",
"def mime_type\n _mime_type ? _mime_type.to_s : 'text/plain'\n end",
"def stringy_media_type\n request.content_mime_type.to_s\n end",
"def to_s\n content_typ... | [
"0.7985686",
"0.7845213",
"0.7832382",
"0.75170684",
"0.7507313",
"0.7388457",
"0.73369515",
"0.7335104",
"0.7306588",
"0.71195036",
"0.7060703",
"0.7055251",
"0.7020961",
"0.7014414",
"0.70108074",
"0.70027995",
"0.69939566",
"0.6967982",
"0.6955283",
"0.69485843",
"0.694808... | 0.79188204 | 1 |
Returns the number of known types. A shortcut of MIME::Types[//].size. (Keep in mind that this is memory intensive, cache the result to spare resources) | def count
defined_types.size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count\n __types__.count\n end",
"def number_of_types\n return GameData::Type.all.size\n end",
"def number_of_types\n return GameData::Type.all.size\n end",
"def num_types\n return @num_types unless @num_types.nil?\n @num_types = ((num_types_m1 + 1) % 6553... | [
"0.73029786",
"0.71871513",
"0.71871513",
"0.7092209",
"0.6613957",
"0.6543262",
"0.63500035",
"0.6311617",
"0.6097227",
"0.60696423",
"0.6018823",
"0.59189284",
"0.58935714",
"0.58654565",
"0.58308524",
"0.5804207",
"0.5761974",
"0.57513106",
"0.5677435",
"0.5677435",
"0.566... | 0.74628663 | 0 |
Add one or more MIME::Type objects to the set of known types. Each type should be experimental (e.g., 'application/xruby'). If the type is already known, a warning will be displayed. Please inform the maintainer of this module when registered types are missing. | def add(*types)
types.each do |mime_type|
if mime_type.kind_of? MIME::Types
add(*mime_type.defined_types)
else
if @type_variants.include?(mime_type.simplified)
if @type_variants[mime_type.simplified].include?(mime_type)
warn "Type #{mime_type} already ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(*types)\n quiet = ((types.last == :silent) or (types.last == true))\n\n types.each do |mime_type|\n case mime_type\n when true, false, nil, Symbol\n nil\n when MIME::Types\n variants = mime_type.instance_variable_get(:@type_variants)\n add(*variants.values.flatten,... | [
"0.7693556",
"0.727175",
"0.699573",
"0.69272715",
"0.6886755",
"0.6871323",
"0.6771046",
"0.67293364",
"0.64505434",
"0.6202162",
"0.62000436",
"0.60552466",
"0.60552466",
"0.60467917",
"0.5939225",
"0.5899352",
"0.5825805",
"0.5797892",
"0.5777911",
"0.57472384",
"0.5747109... | 0.7834628 | 0 |
because open_struct's to_json gives attributes nested in "table" attribute | def as_json(*args)
super.as_json['table']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_json_sub\n to_json_struct.to_json\n end",
"def marshal_dump\n @table\n end",
"def to_json_raw_object()\n #This is a stub, used for indexing\n end",
"def to_json_object\n {'type' => 'ntable', 'axes' => @structure.to_json_array, 'values' => @par... | [
"0.674446",
"0.6290545",
"0.62132484",
"0.6186663",
"0.6176112",
"0.6176112",
"0.61557794",
"0.61508167",
"0.6100469",
"0.6024951",
"0.59914577",
"0.59694874",
"0.59694874",
"0.5965638",
"0.5960494",
"0.5960494",
"0.59604794",
"0.59590834",
"0.58902967",
"0.5840938",
"0.58341... | 0.69866216 | 0 |
Examples odd_product([3, 4, 1, 1, 5]) 15 | def odd_product(arr)
product=1
arr.each do |a|
if a.odd?
product=product*a
end
end
return product
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def odd_product(arr)\n\tarr.filter! { |i| (i % 2 != 0) }\n\tx = arr.inject(:*)\n\treturn x\nend",
"def odd_product(arr)\n sum = 1\n for i in arr\n if i.odd?\n sum *= i\n end\n end\n sum\nend",
"def calculate_product_odd(arr)\n product = []\n arr.each { |x| x.odd? ? product << x : x }\n y = 1... | [
"0.77120286",
"0.75806916",
"0.7565935",
"0.66652566",
"0.665584",
"0.65359235",
"0.65229243",
"0.6522139",
"0.64564085",
"0.6443305",
"0.63381475",
"0.6331748",
"0.6324879",
"0.6317008",
"0.63123244",
"0.62882835",
"0.62820864",
"0.6276996",
"0.62742573",
"0.62653935",
"0.62... | 0.7820049 | 0 |
given a bounding box, returns coordinates of center as tuple precondition: self is an UONItem | def getCenter
box = self.bbox
[ (box[0] + box[2])/2, (box[1] + box[3])/2 ]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bounding_box\n r = @radius\n bottom_left = Point[@centre.x - r, @centre.y - r]\n top_right = Point[@centre.x + r, @centre.y + r]\n [bottom_left, top_right]\n end",
"def find_center\n center = []\n center[0] = (@west + @east) / 2\n center[1] = (@south + @north) / ... | [
"0.70983994",
"0.6905676",
"0.6785564",
"0.67736965",
"0.67358035",
"0.67342365",
"0.6719795",
"0.6677769",
"0.6642488",
"0.661826",
"0.65891457",
"0.6521224",
"0.65008986",
"0.6491395",
"0.63196355",
"0.6288511",
"0.6280644",
"0.620639",
"0.6171945",
"0.6144085",
"0.6141193"... | 0.75618845 | 0 |
return list of all connections associated with this uonItem | def getConnections
r = []
editor.getModelCanvas.getItems(UONConnection).each do |c|
if (c.srcItem == self) || (c.destItem == self) then r.push c end
end
r
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_connections\n @connected_to.keys\n end",
"def connections\n return @connectors.keys\n end",
"def connections\n attributes[:connections]\n end",
"def connections\n @mutex.synchronize do\n @connections.values.inject(0, &:+)\n end\n end",
"def connecti... | [
"0.7455122",
"0.732516",
"0.7290813",
"0.70181787",
"0.6681519",
"0.6561031",
"0.649486",
"0.6446171",
"0.64318746",
"0.64131",
"0.6407851",
"0.63345104",
"0.63179725",
"0.6308015",
"0.625823",
"0.6201771",
"0.61992365",
"0.61613303",
"0.61352146",
"0.61352146",
"0.6129686",
... | 0.78988206 | 0 |
GET /restaurant_branches GET /restaurant_branches.json | def index
@restaurant_branches = RestaurantBranch.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @restaurant = Restaurant.find(params[:id])\n @branches = @restaurant.branches\n end",
"def get_branches\n xml = call(:branches).parsed_response\n xml.css('branches branch').map { |b| Branch.new(b, self) }\n end",
"def branches\n client.branches(repo)\n end",
"def branch... | [
"0.76465863",
"0.72241855",
"0.69273764",
"0.6824904",
"0.6780566",
"0.6630442",
"0.6630442",
"0.6630442",
"0.6622862",
"0.65868974",
"0.65384626",
"0.6532396",
"0.65298116",
"0.65190107",
"0.65156853",
"0.6511962",
"0.64696944",
"0.64371145",
"0.6434441",
"0.63993794",
"0.63... | 0.7479359 | 1 |
POST /restaurant_branches POST /restaurant_branches.json | def create
@restaurant_branch = RestaurantBranch.new(restaurant_branch_params)
respond_to do |format|
if @restaurant_branch.save
format.html { redirect_to @restaurant_branch, notice: 'Restaurant branch was successfully created.' }
format.json { render :show, status: :created, location: @r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @branch_tree = BranchTree.new(branch_tree_params)\n\n respond_to do |format|\n if @branch_tree.save\n format.html { redirect_to @branch_tree, notice: 'Branch tree was successfully created.' }\n format.json { render :show, status: :created, location: @branch_tree }\n else\... | [
"0.66939336",
"0.6635435",
"0.65998644",
"0.6569353",
"0.6499244",
"0.64951396",
"0.64597493",
"0.64215356",
"0.64011157",
"0.62656343",
"0.62505126",
"0.62500733",
"0.6227893",
"0.6211744",
"0.62107766",
"0.6196717",
"0.61882836",
"0.61243963",
"0.6115162",
"0.6084116",
"0.6... | 0.7337756 | 0 |
PATCH/PUT /restaurant_branches/1 PATCH/PUT /restaurant_branches/1.json | def update
respond_to do |format|
if @restaurant_branch.update(restaurant_branch_params)
format.html { redirect_to @restaurant_branch, notice: 'Restaurant branch was successfully updated.' }
format.json { render :show, status: :ok, location: @restaurant_branch }
else
format.html ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_restaurant_branch\n @restaurant_branch = RestaurantBranch.find(params[:id])\n end",
"def update\n @branch = Branch.friendly.find(params[:id])\n respond_to do |format|\n if @branch.update(branch_params)\n format.html { redirect_to @branch, notice: 'Branch was successfully updated... | [
"0.642313",
"0.64221174",
"0.63726896",
"0.6263119",
"0.62377363",
"0.6212138",
"0.6158636",
"0.61248195",
"0.6123172",
"0.610255",
"0.61015326",
"0.60131615",
"0.6003834",
"0.598155",
"0.59811103",
"0.5913415",
"0.5886431",
"0.5883514",
"0.584266",
"0.56891364",
"0.5679484",... | 0.69790274 | 0 |
DELETE /restaurant_branches/1 DELETE /restaurant_branches/1.json | def destroy
@restaurant_branch.destroy
respond_to do |format|
format.html { redirect_to restaurant_branches_url, notice: 'Restaurant branch was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @restaurant.branches.each do |branch|\n branch.destroy\n end\n\n @restaurant.destroy\n respond_to do |format|\n format.html { redirect_to restaurants_url, notice: 'Restaurant eliminado correctamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n ... | [
"0.7850665",
"0.70885825",
"0.6893989",
"0.68923336",
"0.6885138",
"0.6878077",
"0.6811619",
"0.6799603",
"0.6758656",
"0.6713127",
"0.67121464",
"0.6703843",
"0.6685654",
"0.6666713",
"0.6647502",
"0.6642167",
"0.65557474",
"0.65541077",
"0.6488979",
"0.64589804",
"0.6441015... | 0.7438593 | 1 |
Method to return request text PLN proccess to API.AI Params: text: This is the text that user sends in Messenger | def send_to_api_ai(text)
client = ApiAiRuby::Client.new(:client_access_token => ACCESS_TOKEN())
return client.text_request(text)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def text_params\n {\n 'ToUserName' => 'FAKE_VALID_USERNAME',\n 'FromUserName' => 'FAKE_VALID_FROMUSERNAME',\n 'CreateTime' => '1501489767',\n 'MsgType' => 'text',\n 'Content' => 'ping', # will send a pong\n }\nend",
"def send_text\n\nend",
"def text\n lead = Lead.find(params... | [
"0.6656531",
"0.6538276",
"0.6473433",
"0.63607174",
"0.6305673",
"0.62806237",
"0.62782365",
"0.6266342",
"0.62391955",
"0.62185407",
"0.6193291",
"0.6154337",
"0.61220205",
"0.6066782",
"0.606439",
"0.6063732",
"0.6053672",
"0.60512054",
"0.60458875",
"0.6041002",
"0.602366... | 0.6630057 | 1 |
Write a method that converts its argument to weirdcase, where every odd character is lowercase and every even is uppercase, e.g. weirdcase("weirdcase") => "wEiRdCaSe" | def weirdcase(str)
new_str = ""
str.chars.each_with_index do |c, i|
if i%2==0 #reverse because odd characters have even indices
new_str += c.downcase
else
new_str += c.upcase
end
end
return new_str
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weirdcase(str)\n result = \"\"\n str.chars.each_with_index do |ch, i|\n result += i.odd? ? ch.upcase : ch.downcase\n end\n result\nend",
"def weirdcase(str)\n (0...str.length).each do |idx|\n if idx % 2 == 0\n str[idx] = str[idx].downcase\n else\n str[idx] = str[idx].upcase\n end\n... | [
"0.8154193",
"0.81168884",
"0.80978066",
"0.80646384",
"0.80246884",
"0.80093557",
"0.7927897",
"0.79022175",
"0.7900956",
"0.78612465",
"0.77829975",
"0.7766228",
"0.7619295",
"0.75359845",
"0.75242454",
"0.7521367",
"0.7455029",
"0.7414533",
"0.73419315",
"0.733652",
"0.732... | 0.81930494 | 0 |
Store login redirect location and/or role if either exists. | def store_location
session[:redirect_url] = params[:redirect_url] if params[:redirect_url]
session[:role] = params[:role] if params[:role]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store_location\n session[:redirect_after_login] = request.request_uri\n end",
"def check_login\n# redirect_to sessions_new_path if session[:user_id].nil? #|| session[:role_id].nil?\n end",
"def store_location\n # store last url - this is needed for post-login redirect to whatever the user ... | [
"0.7202056",
"0.67580056",
"0.67015755",
"0.6635767",
"0.6491631",
"0.64234215",
"0.64165986",
"0.64157665",
"0.6369211",
"0.63670003",
"0.6297176",
"0.6280211",
"0.6255896",
"0.62196696",
"0.6219239",
"0.621696",
"0.62152106",
"0.6196234",
"0.6188893",
"0.6188461",
"0.618513... | 0.7755152 | 0 |
Returns the next available row as a hash, or nil if there are none left. | def fetch_row
if @row_buffer.empty?
if @done
return nil
else
fetch_more
end
end
@row_buffer.shift
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_hash\n result = @stmt.step\n return nil if result.nil?\n unless result.kind_of?(Hash)\n result_ary = result\n result = {}\n result_ary.each_with_index do |el, i|\n result[@stmt.column_name(i)] = el\n end\n end\n result\n end",
"def next_row\n @next_row |... | [
"0.6873146",
"0.64647985",
"0.6098975",
"0.5936347",
"0.5865222",
"0.58144224",
"0.581059",
"0.5788434",
"0.5775916",
"0.57216454",
"0.570588",
"0.5701577",
"0.5652173",
"0.56137097",
"0.5572413",
"0.55513364",
"0.55328643",
"0.55230474",
"0.55163664",
"0.5506523",
"0.5486345... | 0.64768386 | 1 |
Blocks until the query done running. | def wait!
until query_done?
check_cancel
periodic_callback
sleep @poll_every
end
check_errors
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait_until_done!\n return if done?\n\n ensure_service!\n loop do\n query_results_gapi = service.job_query_results job_id, max: 0\n if query_results_gapi.job_complete\n @destination_schema_gapi = query_results_gapi.schema\n break\n ... | [
"0.6737276",
"0.64100826",
"0.6397573",
"0.6377493",
"0.63693166",
"0.6361261",
"0.6358793",
"0.62077224",
"0.6202083",
"0.6192252",
"0.6037442",
"0.60118455",
"0.6006291",
"0.5999602",
"0.5984958",
"0.5984958",
"0.5984958",
"0.5971336",
"0.5971287",
"0.5961397",
"0.5935366",... | 0.7176434 | 0 |
Returns true if there are any more rows to fetch. | def has_more?
!@done || !@row_buffer.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next?\n unless self.rows\n # Try to load some records\n \n if options[:query] and last_row != nil\n # A query was directly specified and all it's rows were returned\n # ==> Finished.\n return false\n end\n\n if options[:query]\n # If a... | [
"0.79183453",
"0.7078088",
"0.7013102",
"0.68817496",
"0.685601",
"0.68518364",
"0.6682774",
"0.66220057",
"0.6594398",
"0.6536726",
"0.65354764",
"0.6515907",
"0.6507387",
"0.65003717",
"0.64749575",
"0.64749575",
"0.64749575",
"0.64727926",
"0.6464609",
"0.64410007",
"0.642... | 0.8242153 | 0 |
GET /brends/new GET /brends/new.json | def new
@brend = Brend.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @brend }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @boat = Boat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json {render json: @boat}\n end\n end",
"def new\n @baton = Baton.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @baton }\n end\n end",
"... | [
"0.69579005",
"0.69029313",
"0.68994904",
"0.6844844",
"0.6803696",
"0.6767721",
"0.6767721",
"0.6756715",
"0.6736712",
"0.6728514",
"0.669388",
"0.6690245",
"0.6690245",
"0.66807055",
"0.666879",
"0.6657482",
"0.6627814",
"0.6610796",
"0.6550687",
"0.6541454",
"0.65357554",
... | 0.72220814 | 0 |
POST /brends POST /brends.json | def create
@brend = Brend.new(params[:brend])
respond_to do |format|
if @brend.save
format.html { redirect_to @brend, notice: 'Brend was successfully created.' }
format.json { render json: @brend, status: :created, location: @brend }
else
format.html { render action: "new" }... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n \n @trends = Trend.order(\"as_of DESC\").limit(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trends }\n end\n\n end",
"def destroy\n @brend = Brend.find(params[:id])\n @brend.destroy\n\n respond_to do |format|\n format... | [
"0.592784",
"0.5874095",
"0.5870903",
"0.5792633",
"0.5759357",
"0.5624807",
"0.55880475",
"0.5562565",
"0.55443716",
"0.54942715",
"0.5477832",
"0.5461827",
"0.54312485",
"0.5390751",
"0.53896177",
"0.5380428",
"0.5379528",
"0.534278",
"0.5282086",
"0.527942",
"0.5275625",
... | 0.63460904 | 0 |
PUT /brends/1 PUT /brends/1.json | def update
@brend = Brend.find(params[:id])
respond_to do |format|
if @brend.update_attributes(params[:brend])
format.html { redirect_to @brend, notice: 'Brend was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @boat.update(boat_params)\n head :no_content\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end",
"def destroy\n @brend = Brend.find(params[:id])\n @brend.destroy\n\n respond_to do |format|\n format.html { redirect_to brends_url }\n ... | [
"0.59913504",
"0.5847053",
"0.5538435",
"0.552423",
"0.5517752",
"0.54914606",
"0.54896444",
"0.54802257",
"0.54592866",
"0.54469484",
"0.5397771",
"0.5396791",
"0.53757054",
"0.53757054",
"0.53757054",
"0.53706086",
"0.5341139",
"0.53394914",
"0.53160113",
"0.53152573",
"0.5... | 0.61708224 | 0 |
DELETE /brends/1 DELETE /brends/1.json | def destroy
@brend = Brend.find(params[:id])
@brend.destroy
respond_to do |format|
format.html { redirect_to brends_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @baton = Baton.find(params[:id])\n @baton.destroy\n\n respond_to do |format|\n format.html { redirect_to batons_url }\n format.json { head :no_content }\n end\n end",
"def test_del\n header 'Content-Type', 'applicat... | [
"0.66903615",
"0.66177684",
"0.64729476",
"0.6470646",
"0.6464759",
"0.64381397",
"0.6376533",
"0.6349312",
"0.63472325",
"0.63445836",
"0.633716",
"0.633716",
"0.633716",
"0.633716",
"0.63320625",
"0.63202435",
"0.6312615",
"0.63079137",
"0.6303334",
"0.62978965",
"0.6287319... | 0.7636526 | 0 |
GET /member_statuses GET /member_statuses.json | def index
@member_statuses = MemberStatus.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def statuses\n Sifter.\n get(\"/api/statuses\").\n parsed_response[\"statuses\"]\n end",
"def list_statuses(user, list)\n get(\"/#{user}/lists/#{list}/statuses.json\")\n end",
"def statuses( params={} )\n statuses = get_connections(\"statuses\", params)\n return map_connections stat... | [
"0.7399004",
"0.70604825",
"0.6856628",
"0.67240596",
"0.6648107",
"0.6599335",
"0.6586321",
"0.6560976",
"0.6531898",
"0.6480493",
"0.64069945",
"0.6350289",
"0.6350289",
"0.6303469",
"0.6297918",
"0.62283456",
"0.6205776",
"0.6145821",
"0.61094797",
"0.6088396",
"0.6061294"... | 0.73494154 | 1 |
PATCH/PUT /member_statuses/1 PATCH/PUT /member_statuses/1.json | def update
respond_to do |format|
if @member_status.update(member_status_params)
format.html { redirect_to @member_status, notice: 'Member status was successfully updated.' }
format.json { render :show, status: :ok, location: @member_status }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\n #LA\n #@status = current_user.statuses.find(status_params)\n\n #if (status_params) && (status_params).has_key?(:user_id)\n # (status_params).delete(:user_id) \n #end\n\n respond_to do |format|\n if @status.update(status_params)\n format.html { redirect_to statuses_url,... | [
"0.67822343",
"0.67238945",
"0.6662101",
"0.6417947",
"0.63973075",
"0.63849556",
"0.6371989",
"0.6369008",
"0.6334985",
"0.6275746",
"0.6176164",
"0.61758965",
"0.6172022",
"0.6148009",
"0.61273587",
"0.6113367",
"0.6087338",
"0.60867935",
"0.6085883",
"0.6085883",
"0.608588... | 0.6781098 | 1 |
DELETE /member_statuses/1 DELETE /member_statuses/1.json | def destroy
@member_status.destroy
respond_to do |format|
format.html { redirect_to member_statuses_url, notice: 'Member status was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy_status(status_id)\n delete \"statuses/destroy/#{status_id}\"\n end",
"def destroy\n @status = Status.find(params[:id])\n @status.destroy\n\n respond_to do |format|\n format.html { redirect_to(statuses_url) }\n format.xml { head :ok }\n end\n end",
"def delete_status(id)\... | [
"0.7464168",
"0.7337328",
"0.7320424",
"0.7267209",
"0.7237432",
"0.7199938",
"0.7189278",
"0.7151961",
"0.71432024",
"0.7119188",
"0.7101079",
"0.70277345",
"0.70255774",
"0.7018218",
"0.70036155",
"0.6979395",
"0.6979395",
"0.6961111",
"0.6946992",
"0.69467247",
"0.6883606"... | 0.7644799 | 0 |
creates new booking for given table | def create_booking(table)
booking = Booking.new(table_id: table.id,
start_time: @start_date,
end_time: @end_date,
length: params[:hours],
user_id: current_user.id)
booking.table = table
booking.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @tablebooking = Tablebooking.new(tablebooking_params)\n\n respond_to do |format|\n if @tablebooking.save\n format.html { redirect_to @tablebooking, notice: 'Tablebooking was successfully created.' }\n format.json { render :show, status: :created, location: @tablebooking }\n ... | [
"0.73173624",
"0.69545263",
"0.69543886",
"0.6953544",
"0.6791081",
"0.66686255",
"0.6637843",
"0.66346353",
"0.6631346",
"0.66298527",
"0.6615578",
"0.6602387",
"0.65892786",
"0.65694267",
"0.6555094",
"0.6545427",
"0.6520002",
"0.65188706",
"0.65166026",
"0.6500156",
"0.645... | 0.8694362 | 0 |
SlowMoGen.new(options[:infile], options[:inrate], options[:outlist], options[:output], options[:verbosity], options[:cleanup]) def initialize(infile, inrate, outlist, output, verbosity, cleanup) | def initialize(infile, outlist, output, verbosity, cleanup)
@in_file = infile
# @in_rate = 0
@outlist_file = outlist
@output_path = output
@cleanup = cleanup
@app_dir = Dir::pwd
@verbosity = verbosity.to_i
log("*** #{self.class}, version #{VERSI... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(options = { })\n\t\t\t# Assumes that there is a file called \"tuneable.txt\" in a \"data\" subdirectory of\n\t\t\t# the superdirectory of this script\n\t\t\tdefault_tuneable_file = File.open(File.dirname(File.expand_path(__FILE__)) + \"/../data/tuneable.txt\")\n @options = options\n self.p... | [
"0.6676858",
"0.6336442",
"0.6228062",
"0.62178046",
"0.6151028",
"0.61289424",
"0.6063052",
"0.6038036",
"0.60377145",
"0.6000795",
"0.5964189",
"0.59620607",
"0.5954706",
"0.59519416",
"0.59481996",
"0.59479475",
"0.5915318",
"0.5913741",
"0.5912136",
"0.590191",
"0.590181"... | 0.7118454 | 0 |
GET /group_permissions/1 GET /group_permissions/1.xml | def show
@group_permission = GroupPermission.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @group_permission }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n\t\t@all_permissions = Lockdown::System.permissions_assignable_for_user(current_user)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_group }\n end\n end",
"def index\n @permissions = Permission.find(:all)\n\t\trespond_to do |format|\n\t\t... | [
"0.74006724",
"0.68112576",
"0.6616037",
"0.6585705",
"0.6511969",
"0.6492737",
"0.6483544",
"0.6447307",
"0.6427851",
"0.64215535",
"0.63856083",
"0.63434654",
"0.6319885",
"0.6307066",
"0.62971765",
"0.62971765",
"0.62970674",
"0.62630004",
"0.6258951",
"0.6245268",
"0.6206... | 0.7289314 | 1 |
GET /group_permissions/new GET /group_permissions/new.xml | def new
@group_permission = GroupPermission.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @group_permission }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @user_group = UserGroup.new\n\t\t@all_permissions = Lockdown::System.permissions_assignable_for_user(current_user)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_group }\n end\n end",
"def new\n @group = Group.new(:owner => current_us... | [
"0.7746536",
"0.752343",
"0.7373777",
"0.7278835",
"0.7262374",
"0.7187569",
"0.7082014",
"0.7068594",
"0.70040184",
"0.69096315",
"0.6896146",
"0.6889904",
"0.68890756",
"0.6878446",
"0.6878446",
"0.6878446",
"0.6878446",
"0.6878446",
"0.6878446",
"0.6878446",
"0.6878446",
... | 0.8016219 | 0 |
PUT /group_permissions/1 PUT /group_permissions/1.xml | def update
@group_permission = GroupPermission.find(params[:id])
respond_to do |format|
if @group_permission.update_attributes(params[:group_permission])
flash[:notice] = 'GroupPermission was successfully updated.'
format.html { redirect_to(@group_permission) }
format.xml { head ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_permissions\n\t\t\tgroup = SystemGroup.find params[:id]\n\n\t\t\tresult = group.save_permissions params[:permission_ids]\n\n\t\t\trender json: result\n\t\tend",
"def update_group_permissions \n if group_id.present?\n permissions = self.permissions\n # checking if user has permissions or ... | [
"0.68145823",
"0.6690598",
"0.6549892",
"0.64663637",
"0.64034724",
"0.6300014",
"0.6262615",
"0.62281334",
"0.61956936",
"0.6183321",
"0.6134942",
"0.61347115",
"0.6119759",
"0.6104751",
"0.6104751",
"0.6104751",
"0.6104751",
"0.6104751",
"0.6104751",
"0.6104751",
"0.6104751... | 0.71115416 | 0 |
DELETE /group_permissions/1 DELETE /group_permissions/1.xml | def destroy
GroupPermission.destroy(params[:id])
respond_to do |format|
format.html { redirect_to(group_permissions_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_set3_04b_delete_group()\n group = \"test_group\"\n user = \"test_user\"\n \n @test_acl.create_principal(user)\n @test_acl.create_group(group, [\"ALL\"], [user])\n \n query = \"doc(\\\"#{@col_path}Principals.xml\\\")//node()[@id=\\\"#{user}\\\"]/membership/mgroup[@idref=\\\"#{group}\\\... | [
"0.72962296",
"0.69185543",
"0.6830321",
"0.6790138",
"0.67296225",
"0.6729253",
"0.6655606",
"0.6582041",
"0.6554273",
"0.64818805",
"0.64515334",
"0.64472795",
"0.6422268",
"0.64115167",
"0.64095247",
"0.6408379",
"0.6404318",
"0.6399591",
"0.6394362",
"0.63908964",
"0.6388... | 0.75849587 | 0 |
Creates or updates a datastore at +path+ === Parameters +path+:: Path to create or update datastore (usually an application's root) +resources+:: A list of resources that exist for the application | def start(path, resources, framework = nil)
DataStore.local_dir = path/"datastore"
# create the datastore dir unless it exists
FileUtils.mkdir_p(DataStore.local_dir) unless File.exists?(DataStore.local_dir)
# create a .stone_metadata that contains the resource locations
# for Stone::Util... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(resources)\n adapter.create(resources)\n end",
"def create(resources)\n adapter.create(resources)\n end",
"def create(resources)\n resources.each do |resource|\n model = resource.model\n identity_field = model.identity_field\n attributes ... | [
"0.61898494",
"0.61898494",
"0.59068424",
"0.56843513",
"0.56823194",
"0.5508378",
"0.54198384",
"0.5419762",
"0.5353922",
"0.5253251",
"0.52283573",
"0.5206848",
"0.5206848",
"0.513747",
"0.5121352",
"0.5079036",
"0.5024075",
"0.5006136",
"0.4976351",
"0.49602172",
"0.492955... | 0.6210174 | 0 |
GET /long_term_goals GET /long_term_goals.xml | def index
@long_term_goals = LongTermGoal.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @long_term_goals }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @longterm_goals = LongtermGoal.all\n end",
"def show\n @long_term_goal = LongTermGoal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @long_term_goal }\n end\n end",
"def goals(*args)\n @client.get \"#{@path}/g... | [
"0.7414443",
"0.7253547",
"0.6714619",
"0.6652748",
"0.66511154",
"0.6533391",
"0.65291864",
"0.63010126",
"0.62562656",
"0.62521154",
"0.6229944",
"0.6221486",
"0.62061995",
"0.62061995",
"0.62061995",
"0.62061995",
"0.6145142",
"0.6113269",
"0.61060506",
"0.6087987",
"0.606... | 0.76479775 | 0 |
GET /long_term_goals/1 GET /long_term_goals/1.xml | def show
@long_term_goal = LongTermGoal.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @long_term_goal }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @long_term_goals = LongTermGoal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @long_term_goals }\n end\n end",
"def index\n @longterm_goals = LongtermGoal.all\n end",
"def show\n @short_term_goal = ShortTermGoal.find(params[:... | [
"0.760826",
"0.69984937",
"0.6832894",
"0.67024714",
"0.64513093",
"0.6391985",
"0.6360284",
"0.63438535",
"0.63420904",
"0.6210299",
"0.6157086",
"0.61531246",
"0.61170655",
"0.60256815",
"0.6005389",
"0.6005389",
"0.6005389",
"0.6005389",
"0.59509706",
"0.59367645",
"0.5935... | 0.7403875 | 1 |
POST /long_term_goals POST /long_term_goals.xml | def create
@long_term_goal = LongTermGoal.new(params[:long_term_goal])
respond_to do |format|
if @long_term_goal.save
format.html { redirect_to(@long_term_goal, :notice => 'Long term goal was successfully created.') }
format.xml { render :xml => @long_term_goal, :status => :created, :loc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @longterm_goal = LongtermGoal.new(longterm_goal_params)\n\n respond_to do |format|\n if @longterm_goal.save\n format.html { redirect_to @longterm_goal, notice: 'Longterm goal was successfully created.' }\n format.json { render :show, status: :created, location: @longterm_goal ... | [
"0.6758227",
"0.63186073",
"0.61922234",
"0.6177819",
"0.6155052",
"0.5806755",
"0.57402194",
"0.5738636",
"0.572715",
"0.5711043",
"0.5699473",
"0.5676062",
"0.56552",
"0.565489",
"0.56495374",
"0.563717",
"0.56324965",
"0.5619253",
"0.56133634",
"0.55964303",
"0.558848",
... | 0.70826036 | 0 |
PUT /long_term_goals/1 PUT /long_term_goals/1.xml | def update
@long_term_goal = LongTermGoal.find(params[:id])
respond_to do |format|
if @long_term_goal.update_attributes(params[:long_term_goal])
format.html { redirect_to(@long_term_goal, :notice => 'Long term goal was successfully updated.') }
format.xml { head :ok }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @longterm_goal.update(longterm_goal_params)\n format.html { redirect_to @longterm_goal, notice: 'Longterm goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @longterm_goal }\n else\n format.html { render ... | [
"0.68592596",
"0.6578327",
"0.6535526",
"0.635934",
"0.6277292",
"0.6259996",
"0.6177453",
"0.6074288",
"0.60723823",
"0.60411483",
"0.60178024",
"0.6003439",
"0.6002033",
"0.5997974",
"0.5997974",
"0.5997974",
"0.5997974",
"0.5997974",
"0.59748507",
"0.5967378",
"0.59590906"... | 0.7391022 | 0 |
DELETE /long_term_goals/1 DELETE /long_term_goals/1.xml | def destroy
@long_term_goal = LongTermGoal.find(params[:id])
@long_term_goal.destroy
respond_to do |format|
format.html { redirect_to(long_term_goals_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @short_term_goal = ShortTermGoal.find(params[:id])\n @short_term_goal.tasks.each do |task|\n task.destroy\n end\n @short_term_goal.destroy\n\n respond_to do |format|\n format.html { redirect_to(short_term_goals_url) }\n format.xml { head :ok }\n end\n end",
"def d... | [
"0.69871974",
"0.6959227",
"0.6903309",
"0.6631599",
"0.65331656",
"0.647477",
"0.6397696",
"0.6363339",
"0.6350251",
"0.63092434",
"0.63092434",
"0.6302126",
"0.6291282",
"0.62908316",
"0.62681407",
"0.6253962",
"0.6210575",
"0.6171451",
"0.6169973",
"0.6147302",
"0.61469775... | 0.7426231 | 0 |
any calculator would confirm that 211 = 2048 519432525806 would be much more difficult, as both numbers contain over three million digits. Using base_exp.txt, a 22K text file containing one thousand lines with a base/exponent pair on each line, determine which line number has the greatest numerical value. My Notes: Giv... | def compare(pair1, pair2) # each pair in the form [base, exponent]
Math.log(pair1[0]) * pair1[1] > Math.log(pair2[0]) * pair2[1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def euler038\n (9213..9876)\n .map{ |x| x.to_s + (x*2).to_s }\n .select{ |f| f.chars.sort.join == \"123456789\" }\n .map{ |f| f.to_i }\n .max\nend",
"def convert_base(number, base)\n \n exponents = []\n n = 0 # Exponent / number position\n\n # Find the appropriate exponent size larger than the n... | [
"0.63868445",
"0.6384118",
"0.6259942",
"0.61685354",
"0.59584045",
"0.5926866",
"0.5835872",
"0.57721347",
"0.5763447",
"0.5722283",
"0.56962043",
"0.56818396",
"0.5671775",
"0.56032354",
"0.557531",
"0.5560582",
"0.5545206",
"0.5534637",
"0.55021304",
"0.54996127",
"0.54967... | 0.647068 | 0 |
secure validation of username to prevent putting email as username | def validate_username
if User.where(email: username).exist?
errors.add(:username, :invalid)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_username\n return unless username.blank?\n\n self.username = email.gsub(/@.*$/, '')\n end",
"def validate_username\n if User.where(email: username).exists?\n errors.add(:username, :invalid)\n end\n end",
"def validate_username\n if User.where(email: username).exists?\n err... | [
"0.8233555",
"0.8025082",
"0.8025082",
"0.79936147",
"0.78403556",
"0.7810739",
"0.78027797",
"0.77832013",
"0.77121556",
"0.7685226",
"0.7626688",
"0.74416584",
"0.7431681",
"0.7428324",
"0.7373828",
"0.73662126",
"0.73222363",
"0.7308619",
"0.7294917",
"0.7280357",
"0.71782... | 0.811374 | 1 |
GET /crates GET /crates.json | def index
@crates = Crate.all
respond_to do |format|
format.html # index.html.erb
format.json { render :json => @crates }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @pend_crates = Overview.get_pending_crates \n @paid_crates = Overview.get_last_paid_crates \n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render :json => @crates }\n end\n end",
"def index\n @crates = Crate.all\n end",
"def crates(); @crates |... | [
"0.7286275",
"0.7254392",
"0.7131353",
"0.7090634",
"0.68075687",
"0.6538981",
"0.64826256",
"0.62514573",
"0.61754215",
"0.6078953",
"0.6067751",
"0.60561067",
"0.6024391",
"0.59681565",
"0.59481347",
"0.58263683",
"0.5816424",
"0.5792171",
"0.57851654",
"0.57579666",
"0.575... | 0.74909174 | 0 |
GET /crates/new GET /crates/new.json | def new
@crate = Crate.new
@payers = get_cratepayers()
@types = get_crate_types()
@priorities = get_crate_priorities()
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @crate }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @crust = Crust.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @crust }\n end\n end",
"def new\n @borrow = Borrow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrow }\n end\n e... | [
"0.71784747",
"0.7115869",
"0.6943796",
"0.68867916",
"0.68291247",
"0.67772347",
"0.67688465",
"0.6759718",
"0.6759718",
"0.67589945",
"0.6757266",
"0.6742607",
"0.6725266",
"0.6725266",
"0.66872025",
"0.66850585",
"0.6667229",
"0.66667455",
"0.6640828",
"0.6636733",
"0.6636... | 0.73685336 | 0 |
POST /crates POST /crates.json | def create
@crate = Crate.new(params[:crate])
respond_to do |format|
if @crate.save
CratesNotifier.crate_received(@crate).deliver
format.html { redirect_to @crate, :notice => 'Crate was successfully created.' }
format.json { render :json => @crate, :status => :created, :location =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crates(); @crates || CrateAPI::Crates.new(); end",
"def create\n @crate = Crate.new(crate_params)\n\n respond_to do |format|\n if @crate.save\n format.html { redirect_to tenant_crates_path(@tenant), notice: 'Crate was successfully created.' }\n format.json { render :show, status: :cr... | [
"0.6899586",
"0.65221536",
"0.6309109",
"0.6261621",
"0.6171561",
"0.5985363",
"0.5967105",
"0.59478414",
"0.5896208",
"0.57521886",
"0.57016283",
"0.5699444",
"0.5663994",
"0.5621796",
"0.55958915",
"0.55890465",
"0.5576382",
"0.5545997",
"0.5538835",
"0.5507476",
"0.5502208... | 0.66305315 | 1 |
DELETE /crates/1 DELETE /crates/1.json | def destroy
@crate = Crate.find(params[:id])
@crate.destroy
respond_to do |format|
format.html { redirect_to crates_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @crust = Crust.find(params[:id])\n @crust.destroy\n\n respond_to do |format|\n format.html { redirect_to crusts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crate.destroy\n respond_to do |format|\n format.html { redirect_to tenant_crates_u... | [
"0.69931746",
"0.69457525",
"0.6884194",
"0.68576616",
"0.6831494",
"0.68019176",
"0.6647461",
"0.6646041",
"0.65799636",
"0.65722215",
"0.6551675",
"0.6547213",
"0.654516",
"0.6543362",
"0.6526836",
"0.6518214",
"0.6517433",
"0.65138227",
"0.65016204",
"0.65012676",
"0.64934... | 0.7199346 | 0 |
Create one request per box. | def request_attributes(box)
{
Request: request_id(box),
"Site_#{request_id(box)}": site,
"Location_#{request_id(box)}": translate_location_code(box["location_code"]),
"GroupingField_#{request_id(box)}": grouping_identifier(box),
"ItemSubTitle_#{request_id(box)}": subtitle,
"ItemT... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @request = Request.new\n 1.times do\n request_photo = @request.request_photos.build\n end\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end",
"def create\n @box = current_user.boxes.build(params[:box])\n @box.... | [
"0.5774417",
"0.576641",
"0.55553234",
"0.5471476",
"0.5441197",
"0.54394037",
"0.5427112",
"0.536434",
"0.53626335",
"0.53419054",
"0.5287718",
"0.5287718",
"0.5273295",
"0.52663696",
"0.5258482",
"0.52542454",
"0.5243881",
"0.5234683",
"0.52240366",
"0.51951605",
"0.5188664... | 0.58605033 | 0 |
Top containers are boxes and oversize folders. | def top_containers
container_information.select do |container|
container["label"].to_s.downcase.include?("box") || container["profile"].include?("OS folder")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def container\n [[container_parent, container_element(\"box\"), container_element(\"folder\")].compact.join(\", \")]\n end",
"def get_containers\n init_folder unless @init # have I been initialized?\n return @containers \n end",
"def containers\n containers_exited(days_old: ... | [
"0.6764368",
"0.6027917",
"0.5828226",
"0.54117405",
"0.5312717",
"0.53029525",
"0.52975637",
"0.5201634",
"0.51862675",
"0.5133873",
"0.512802",
"0.5126311",
"0.5124864",
"0.5117796",
"0.51028067",
"0.51004153",
"0.5072328",
"0.5057386",
"0.5033289",
"0.5027992",
"0.50194967... | 0.7491647 | 0 |
Checks to see if a user has attached a Venmo account, if not, restrict access by redirecting to homepage and give a notification | def venmo_required
if current_user.venmo.blank?
redirect_to request.referer,
:notice => "Oops! There is not yet a Venmo account associated with this user."
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restrict_access\t\n\t\tif current_user.owner == false\n\t\t\tredirect_to user_path(current_user), notice: \"You can't view this page, contact your box owner\"\n\t\tend\t\n\tend",
"def vheroauthorize\n redirect_to vherologin_path, alert: 'You must be logged in as a Volunthero to access this page.' if cur... | [
"0.6850083",
"0.6756134",
"0.667074",
"0.66129345",
"0.6611483",
"0.659878",
"0.65827703",
"0.6582253",
"0.65627587",
"0.65087646",
"0.65059984",
"0.65024006",
"0.6498131",
"0.6478253",
"0.6477353",
"0.6457789",
"0.64444935",
"0.6441217",
"0.6426587",
"0.6417679",
"0.6399545"... | 0.7643806 | 0 |
Find all possible class names in all XML and property files under _path_ and optionally ignore _ignorepattern_ | def scan_config_for_class_names(path, ignorepattern=/^\./)
return [] unless File.exist? path
if File.file?(path)
if path =~ /\.xml$|\.properties$|MANIFEST.MF$/
scan_text_for_class_names(IO.readlines(path).join)
else
[]
end
else
Dir.entries(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match_classes(fullpath)\n Dir.foreach(fullpath) do |patternfile|\n filepath = \"#{fullpath}/#{patternfile}\"\n next unless File.file?(filepath) and\n File.readable?(filepath)\n next if patternfile =~ /^\\./\n log(\"Attempting to match [#{@hostname}] in [#{filepath}]\")\n if... | [
"0.6396464",
"0.61449164",
"0.60674614",
"0.59656113",
"0.5900876",
"0.58380497",
"0.5739137",
"0.57230395",
"0.5716626",
"0.56739",
"0.5650982",
"0.56338215",
"0.5590223",
"0.55878437",
"0.55393314",
"0.55189943",
"0.5515087",
"0.5491214",
"0.54773426",
"0.5477292",
"0.54741... | 0.79389906 | 0 |
Extract the list of possible class names from the given _string_ . This will only find names with at least one package name. | def scan_text_for_class_names(string)
string.scan(TEXT_REGEX).flatten.map { |match| JavaQualifiedName.new(match) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_class(string)\n uncapitalize(string.split('::').last)\n end",
"def string_to_class string\n chain = string.split \"::\"\n i=0\n res = chain.inject(Module) do |ans,obj|\n break if ans.nil?\n i+=1\n klass = ans.const_get(obj)\n # Make sure the current obj is a valid class\n ... | [
"0.663399",
"0.63246316",
"0.6262295",
"0.6218915",
"0.59567183",
"0.59498155",
"0.58953226",
"0.58073586",
"0.5744066",
"0.5684576",
"0.5676884",
"0.5673253",
"0.5665215",
"0.5622434",
"0.5622392",
"0.5547766",
"0.55400187",
"0.55320895",
"0.5529991",
"0.54774207",
"0.547148... | 0.80041295 | 0 |
Shows a new notification. | def show!
notify_init(app_name) or raise "notify_init failed"
raw_ptr = notify_notification_new(summary, body, icon_path, nil)
@notification = ::FFI::AutoPointer.new(raw_ptr, method(:g_object_unref))
show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n NOTIFICATION[:show].call @notification, nil\n end",
"def new\n respond_with @notification = @application.notifications.new\n end",
"def show\n # notification_email\n end",
"def show\n if @notification.waiting?\n if @notification.should_be_deleted_after_view?\n ... | [
"0.798552",
"0.71599627",
"0.7146819",
"0.7090232",
"0.70181394",
"0.69321513",
"0.6917675",
"0.68808794",
"0.68596315",
"0.6849953",
"0.6780705",
"0.67728704",
"0.67123526",
"0.67123526",
"0.67043746",
"0.66912335",
"0.6664137",
"0.6657805",
"0.66529506",
"0.6625525",
"0.662... | 0.7799835 | 1 |
Close a previously shown notification. | def close
notify_notification_close(@notification, nil) if @notification
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def windowWillClose(notification)\n OSX::NSApp.terminate(self)\n end",
"def windowWillClose(notification)\n OSX::NSApp.terminate(self)\n end",
"def close_notification\n self.div(:class=>\"gritter-item\").hover\n self.div(:class=>\"gritter-close\").fire_event \"onclick\"\n end",
"def close ... | [
"0.6381102",
"0.6381102",
"0.6326114",
"0.6225394",
"0.6155754",
"0.61054844",
"0.60929894",
"0.59916615",
"0.5955381",
"0.5928497",
"0.57839805",
"0.57231563",
"0.56882215",
"0.5632371",
"0.5625021",
"0.561875",
"0.5606332",
"0.5603924",
"0.55925184",
"0.5561749",
"0.5560861... | 0.75279343 | 0 |
Sets icon path. Path can be absolute, relative (will be resolved) or a symbol. | def icon_path=(path)
case path
when %r{^/} # absolute
@icon_path = path
when String
@icon_path = icon_for(path)
when Symbol
self.icon_path = "#{path}.png"
else
@icon_path = nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def large_icon=(path)\n super(Resource.icon_path(path))\n end",
"def icon=(value)\n @icon = value\n end",
"def icon=(val)\n @icon = \"http://www.google.com#{val}\"\n end",
"def icon_location=(location)\n @link.IconLocation = location.tr('/', \"\\\\\")\n end",... | [
"0.7474866",
"0.68865764",
"0.6814014",
"0.66545266",
"0.6502754",
"0.6473644",
"0.6391234",
"0.6313533",
"0.6298746",
"0.6298746",
"0.6298746",
"0.6197742",
"0.610215",
"0.60536665",
"0.5994572",
"0.59935176",
"0.596793",
"0.5966196",
"0.5965081",
"0.5959808",
"0.59190536",
... | 0.8872866 | 0 |
override Sufia::CollectionsControllerBehaviorpresenter to establish a link between the presenter and the view context in which it will present | def presenter
@presenter ||= presenter_class.new(@collection).tap do |p|
p.render_context = view_context
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def presenter\n self\n end",
"def prepare_instance_variables_for_batch_control_display\n super\n @incorporate_collection_presenter = build_incorporate_collection_presenter\n end",
"def collection\n action_name == 'show' ? @presenter : @collection\n end",
"def show\n @presenter... | [
"0.6387842",
"0.6233644",
"0.6207702",
"0.6164603",
"0.5914134",
"0.5850165",
"0.58039516",
"0.57728",
"0.5734656",
"0.57217085",
"0.5592715",
"0.55857295",
"0.5562631",
"0.55261034",
"0.5525112",
"0.55132765",
"0.5503139",
"0.54409933",
"0.53873533",
"0.53604674",
"0.5343501... | 0.6871963 | 1 |
GET /loan_types GET /loan_types.json | def index
@loan_types = LoanType.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @leavetypes = Leavetype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leavetypes }\n end\n end",
"def index\n @leavetypes = Leavetype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render ... | [
"0.65135485",
"0.65135485",
"0.6487587",
"0.6464225",
"0.6448399",
"0.6411704",
"0.6410413",
"0.63662493",
"0.6356641",
"0.63187784",
"0.63096213",
"0.6309177",
"0.6305139",
"0.6268259",
"0.62615675",
"0.62405676",
"0.6218149",
"0.6195775",
"0.6187348",
"0.6122378",
"0.611388... | 0.7532244 | 0 |
POST /loan_types POST /loan_types.json | def create
@loan_type = LoanType.new(loan_type_params)
respond_to do |format|
if @loan_type.save
format.html { redirect_to @loan_type, notice: 'Loan type was successfully created.' }
format.json { render :show, status: :created, location: @loan_type }
else
format.html { rend... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @loan_types = LoanType.all\n end",
"def loan_type_params\n params.fetch(:loan_type, {})\n end",
"def set_loan_type\n @loan_type = LoanType.find(params[:id])\n end",
"def create_break_type(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::... | [
"0.6374525",
"0.6367706",
"0.6259528",
"0.62311774",
"0.5920879",
"0.5919172",
"0.5886606",
"0.5831655",
"0.5831655",
"0.5821386",
"0.5818739",
"0.5818739",
"0.5817611",
"0.58053416",
"0.58031374",
"0.57959485",
"0.57786846",
"0.57774955",
"0.5745986",
"0.57211477",
"0.571803... | 0.71639663 | 0 |
PATCH/PUT /loan_types/1 PATCH/PUT /loan_types/1.json | def update
respond_to do |format|
if @loan_type.update(loan_type_params)
format.html { redirect_to @loan_type, notice: 'Loan type was successfully updated.' }
format.json { render :show, status: :ok, location: @loan_type }
else
format.html { render :edit }
format.json { r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @loan.update(loan_params)\n format.html { redirect_to @loan, notice: 'Loan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @loan.errors, stat... | [
"0.6571745",
"0.6473818",
"0.6473818",
"0.6444055",
"0.6442311",
"0.6353402",
"0.6345817",
"0.6321011",
"0.63075334",
"0.6303423",
"0.62868255",
"0.62693644",
"0.6267278",
"0.62622434",
"0.6258478",
"0.62435293",
"0.6232652",
"0.62106633",
"0.615921",
"0.61474174",
"0.614066"... | 0.736167 | 0 |
DELETE /loan_types/1 DELETE /loan_types/1.json | def destroy
@loan_type.destroy
respond_to do |format|
format.html { redirect_to loan_types_url, notice: 'Loan type was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @mall_type = MallType.find(params[:id])\n @mall_type.destroy\n\n respond_to do |format|\n format.html { redirect_to mall_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crate_type = CrateType.find(params[:id])\n @crate_type.destroy\n\n re... | [
"0.70186293",
"0.6991777",
"0.69884765",
"0.69795454",
"0.6954552",
"0.6929785",
"0.6927437",
"0.6903039",
"0.6854845",
"0.68545645",
"0.68302107",
"0.6829497",
"0.6828095",
"0.68078613",
"0.6797935",
"0.6791343",
"0.6779898",
"0.67763555",
"0.67648536",
"0.67634284",
"0.6760... | 0.76741445 | 0 |
Returns the list of unique defined integer values | def values
@values.values.map(&:to_i).uniq.sort
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uniq_ints()\n []\n end",
"def unique(integers)\n integers.to_set.to_a\nend",
"def unique(integers)\n new_int = []\n \n \n integers.each do |val1|\n integers.each do |val2|\n if (val1 != val2 && (not (new_int.include?(val1))))\n new_int << val1\n end\n end\n \n end... | [
"0.81635875",
"0.7184712",
"0.71682113",
"0.70682544",
"0.68589336",
"0.67415345",
"0.67323685",
"0.6710959",
"0.6644489",
"0.6562523",
"0.6550861",
"0.63595945",
"0.63483363",
"0.6337085",
"0.62929416",
"0.62840694",
"0.6250988",
"0.624627",
"0.62455976",
"0.6234097",
"0.622... | 0.7645724 | 1 |
Initialize an enum member and optionally define an associated constant on the class singleton | def init(name, value, define_constant = false)
@values ||= {}
@symbols ||= []
s = name.to_sym
n = s.to_s
n_lc = n.downcase
raise ArgumentError.new("Key #{s} is not lower case") if n != n_lc
raise ArgumentError.new("Key #{s} already defined") if @values.key? name
val =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(constant)\n @constant = constant\n freeze\n end",
"def initialize(enum)\n @enum = enum.map { |v| v.maybe? ? v : v.to_maybe }\n end",
"def classy_enum_attr(attribute, options={})\n enum = (options[:class_name] || options[:enum] || attribute).to_s.c... | [
"0.61746967",
"0.6117075",
"0.6044732",
"0.6023065",
"0.5957828",
"0.5903657",
"0.58276576",
"0.5800775",
"0.57437134",
"0.57034093",
"0.5695122",
"0.5615044",
"0.5595145",
"0.5589597",
"0.55389965",
"0.54381883",
"0.543595",
"0.5395147",
"0.53915966",
"0.5371466",
"0.5359145... | 0.63739073 | 0 |
The command represents what external command is running Sharp. Typical values are: server A rack server like WEBrick, Thin, Unicorn, Puma, etc. console An IRB session If Sharp is just being run in a script or something, this will be nil. You can set this to any value you like using the SHARP_COMMAND environment variabl... | def command
if defined? @command
@command
else
@command = ENV['SHARP_COMMAND'].downcase.to_sym if ENV['SHARP_COMMAND'].present?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command\n @command ||= Mixlib::ShellOut.new from_instructions\n end",
"def command\n @command ||= command_for(:query)\n end",
"def command\n @command ||= command_for(:query)\n end",
"def command\n case first\n when '\\?' then Command::HelpCommand\n when '\\config' then ... | [
"0.6716227",
"0.6541922",
"0.64707345",
"0.6351963",
"0.6333799",
"0.63332236",
"0.6310868",
"0.6279296",
"0.6248779",
"0.62044007",
"0.61985344",
"0.6197446",
"0.6116772",
"0.6105353",
"0.6102975",
"0.6071942",
"0.6063286",
"0.60163707",
"0.5984606",
"0.59662527",
"0.5951282... | 0.77210045 | 0 |
Get the actual gricer request instance. | def gricer_request
@gricer_request
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request\n @request ||= Request.find request_id\n end",
"def request\n @_request\n end",
"def request\n @request ||= Request.new(::Minfraud::HTTPService.configuration)\n end",
"def request\n @request ||= ::Lotus::Action::Request.new(@_env)\n end",
"def request\n ... | [
"0.746422",
"0.73551434",
"0.73279876",
"0.72387",
"0.72007585",
"0.71921474",
"0.7185619",
"0.71713436",
"0.71125764",
"0.70267314",
"0.6937813",
"0.68576604",
"0.67756325",
"0.67756325",
"0.67545444",
"0.6735697",
"0.6725153",
"0.6722104",
"0.67026407",
"0.669003",
"0.66783... | 0.7475823 | 0 |
checks whether an article is bookmarked | def bookmarked?(article)
bookmarked_article_ids.include?(article.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bookmarked?(user_id)\n !Bookmark.where(story_id: self.id, user_id: user_id).empty?\n end",
"def document_is_bookmarked?(document_id)\n bookmarked_document_ids.include? document_id\n end",
"def bookmarked_by_user?(user)\n bookmark_object(user).present?\n end",
"def marked?(mark)\n @ma... | [
"0.69141656",
"0.68481064",
"0.6665301",
"0.64915514",
"0.6425864",
"0.62527657",
"0.60925484",
"0.60688794",
"0.60555005",
"0.60195726",
"0.6006599",
"0.5968635",
"0.5955107",
"0.59436375",
"0.5936417",
"0.59054226",
"0.5867661",
"0.5865104",
"0.5863335",
"0.58500427",
"0.58... | 0.86283094 | 0 |
removes bookmark from article | def unbookmark(article)
bookmarked_articles.destroy(article)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n\t\treturn self.repo.bookmark( self.name, delete: true )\n\tend",
"def delBookmarks content\r\n\t\tfind('#del1449930755433').click\r\n\t\tfind('.jBox-Confirm-button-submit').click\r\n\t\tsleep 1\r\n\tend",
"def _delete\n # Set id and cache key\n id = @options[:id]\n cache_key = nil #\"book... | [
"0.6651918",
"0.6460027",
"0.6452861",
"0.6416381",
"0.63643223",
"0.63034034",
"0.6264365",
"0.6219531",
"0.6219531",
"0.6211236",
"0.61615145",
"0.6147038",
"0.61160445",
"0.6110374",
"0.6085335",
"0.60153943",
"0.60066646",
"0.6001179",
"0.5986151",
"0.5961646",
"0.5945459... | 0.826096 | 0 |
takes profile first and last name and make it full | def full_name
if self.profile.present?
"#{self.profile.first_name.capitalize} #{self.profile.last_name.capitalize}"
else
"#{username.capitalize}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_name\n \"#{user_profile.first_name} #{user_profile.last_name}\" unless user_profile.blank?\n end",
"def full_name\n [first_name, last_name].join(' ').strip\n end",
"def full_name\n \"#{first_name} #{middle_name} #{last_name}\".split.join(' ')\n end",
"def my_full_name\n \"#{self.profi... | [
"0.8240436",
"0.7997898",
"0.7986613",
"0.79781544",
"0.79697025",
"0.79480135",
"0.79480135",
"0.79480135",
"0.79480135",
"0.79480135",
"0.79480135",
"0.794695",
"0.79427344",
"0.7942314",
"0.7942314",
"0.7942314",
"0.7942314",
"0.7942314",
"0.794091",
"0.79339546",
"0.79294... | 0.8406628 | 0 |
Reutrns the reference which ndim is reduced by eliminating the dimensions which size == 1 | def compacted
if ndim == 1
return self[]
else
newdim = dim.reject{|x| x == 1 }
return ( ndim != newdim.size ) ? reshape(*newdim) : self[]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compact\n if ndim == 1\n return self.to_ca\n else\n newdim = dim.reject{|x| x == 1 }\n return ( ndim != newdim.size ) ? reshape(*newdim).to_ca : self.to_ca\n end\n end",
"def reshape! new_shape,*shapes\n if self.is_ref?\n raise(ArgumentError, \"This operation cannot be perfor... | [
"0.66872466",
"0.5931285",
"0.5893715",
"0.5489244",
"0.54656184",
"0.5456026",
"0.5402678",
"0.5402678",
"0.5402678",
"0.5346659",
"0.52844113",
"0.5266356",
"0.52618176",
"0.52500963",
"0.52434564",
"0.52005786",
"0.51696056",
"0.51630825",
"0.51365423",
"0.512751",
"0.5108... | 0.67635137 | 0 |
Returns the array which ndim is reduced by eliminating the dimensions which size == 1 | def compact
if ndim == 1
return self.to_ca
else
newdim = dim.reject{|x| x == 1 }
return ( ndim != newdim.size ) ? reshape(*newdim).to_ca : self.to_ca
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compacted\n if ndim == 1\n return self[]\n else\n newdim = dim.reject{|x| x == 1 }\n return ( ndim != newdim.size ) ? reshape(*newdim) : self[]\n end\n end",
"def xdim\n @xdim || 1\n end",
"def xdim\n @xdim || 1\n end",
"def xdim\n @xdim || 1\n end",
"de... | [
"0.73550844",
"0.56975305",
"0.56975305",
"0.56975305",
"0.5624158",
"0.5605374",
"0.55254126",
"0.5454002",
"0.538824",
"0.53233796",
"0.53149045",
"0.52899027",
"0.52543616",
"0.5228487",
"0.52168095",
"0.5212728",
"0.5212728",
"0.51974297",
"0.5161763",
"0.51487297",
"0.51... | 0.6934933 | 1 |
create the topology data bag | def create_bag(bag_name)
# check that the name is valid
begin
Chef::DataBag.validate_name!(bag_name)
rescue Chef::Exceptions::InvalidDataBagName => e
ui.fatal(e.message)
exit(1)
end
# create the data bag
begin
data_bag = Chef::Data... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_all_data_bags\n DATA_BAGS_CONF.keys.each do |bag|\n next if list_data_bags.include? bag\n puts \"TRACE: creating missing data bag #{bag}\" if verbose\n create_data_bag(bag)\n end\nend",
"def topo_data\n data = { 'tp-id' => @name }\n data['supporting-termination-point'] = @supp... | [
"0.63052416",
"0.6030822",
"0.59989023",
"0.5907162",
"0.5828214",
"0.57634145",
"0.5739195",
"0.5731053",
"0.5654357",
"0.55860585",
"0.55230355",
"0.5516168",
"0.551203",
"0.55034286",
"0.5478046",
"0.54444504",
"0.5421448",
"0.5400149",
"0.5385444",
"0.53588694",
"0.532897... | 0.6312079 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.