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 |
|---|---|---|---|---|---|---|
advance the specified date by 24 hours | def next_day(date)
date + (60 * 60 * 24)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def advance(date, time)\n date.advance(hours: time.hour, minutes: time.min, seconds: time.sec)\n end",
"def add_day(day)\n day += 24*60*60\nend",
"def extendbythirthydays\n update_at = update_at + 14.days.from_now\n end",
"def advance_hours(hours)\n self + (hours * 60 * 60)\n end",
"def advanc... | [
"0.69941074",
"0.6841838",
"0.67930883",
"0.6630433",
"0.6575559",
"0.6570724",
"0.6570724",
"0.6464861",
"0.6400233",
"0.63858587",
"0.63757384",
"0.635167",
"0.6309209",
"0.6257211",
"0.6196842",
"0.60889256",
"0.60845995",
"0.6080924",
"0.6080924",
"0.606035",
"0.6031458",... | 0.7098298 | 0 |
use imageserver and blob csid to serve audio | def render_audio_csid options={}
# render audio player
content_tag(:div) do
options[:value].collect do |audio_csid|
content_tag(:audio,
content_tag(:source, "I'm sorry; your browser doesn't support HTML5 audio in MPEG format.",
src: "https://webapps.cspace.berkeley.edu/#TENA... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def audio; end",
"def audio_url(source, options = T.unsafe(nil)); end",
"def send_data(s, data)\n\n if USE_MP3\n audio_data = `echo '#{data}' | base64 --decode | sox -r 8000 -c 1 -e mu-law -t raw - -r 48000 -c 1 -t mp3 -`\n else\n audio_data = `echo '#{data}' | base64 --decode | opusenc --quiet --raw -... | [
"0.6188182",
"0.6148834",
"0.6059774",
"0.58894014",
"0.58392197",
"0.58172303",
"0.5796662",
"0.5743499",
"0.5692511",
"0.565943",
"0.56481653",
"0.56124437",
"0.5525445",
"0.5520838",
"0.55117834",
"0.5502439",
"0.5419982",
"0.54087967",
"0.539042",
"0.5387752",
"0.53563017... | 0.6326567 | 0 |
use imageserver and blob csid to serve video | def render_video_csid options={}
# render video player
content_tag(:div) do
options[:value].collect do |video_csid|
content_tag(:video,
content_tag(:source, "I'm sorry; your browser doesn't support HTML5 video in MP4 with H.264.",
src: "https://webapps.cspace.berkeley.edu/#T... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n # This comment part specifies how to perform server side uploading\n # http://cloudinary.com/documentation/rails_video_upload#rails_video_upload_examples\n # http://cloudinary.com/documentation/upload_videos\n # http://cloudinary.com/documentation/video_management\n # http://cloudinary.... | [
"0.6226114",
"0.62218916",
"0.61662036",
"0.61038744",
"0.5980719",
"0.5953603",
"0.59417665",
"0.59393287",
"0.59091514",
"0.5905462",
"0.5891946",
"0.58840954",
"0.587745",
"0.587745",
"0.58565646",
"0.5837253",
"0.581587",
"0.5803875",
"0.5771184",
"0.57599425",
"0.5704587... | 0.63397646 | 0 |
serve X3D directy via apache (apache needs to be configured to serve nuxeo repo) | def render_x3d_directly options={}
# render x3d player
content_tag(:div) do
options[:value].collect do |x3d_md5|
l1 = x3d_md5[0..1]
l2 = x3d_md5[2..3]
content_tag(:video,
content_tag(:source, "I'm sorry; your browser doesn't support HTML5 video in MP4 with H.264.",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def public_file_server; end",
"def public_file_server; end",
"def proxy\n uri = URI.parse(params[:url])\n open(uri.to_s) do |f|\n # TODO: instead of using f.read below, perhaps read it a bit at a time and\n # stream it a bit at a time. Look into response chunking for Rails.\n data = f.read... | [
"0.50478256",
"0.50478256",
"0.49866343",
"0.49134192",
"0.48859057",
"0.4842553",
"0.47938356",
"0.47938356",
"0.46422634",
"0.46160978",
"0.46122935",
"0.45976636",
"0.45743403",
"0.45290786",
"0.4522045",
"0.4508615",
"0.44929716",
"0.4410881",
"0.44010726",
"0.4386273",
"... | 0.6053656 | 0 |
Given a field and an array of child fields, we need to recurse through them to get the last one | def get_child_entity_from_path_by(field, children)
# the next child in the path
child_value = children.shift
# get the child entity
child = self.send(:children).find {|child| child.send(field) == child_value}
if child && children.size > 0
# we have some recursion to do - we're not ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_fields_or_build(field)\n unless field.is_a? DelegationField\n field_slug = field.to_s\n field = DelegationField.where(slug: field_slug).first\n return nil if field.nil?\n end\n field_values = get_fields(field)\n if field_values.empty?\n field_values = [self.fields.build(dele... | [
"0.59080845",
"0.56681645",
"0.54430634",
"0.5370381",
"0.5351737",
"0.5320911",
"0.5302727",
"0.5220414",
"0.52140176",
"0.5203989",
"0.5203787",
"0.51899236",
"0.5187229",
"0.5157163",
"0.5131079",
"0.5122954",
"0.5122617",
"0.51044697",
"0.5096488",
"0.5095738",
"0.5076473... | 0.62602544 | 0 |
Given a field (and optional delimiter), return a path to the current object. e.g. you'd end up with /path/to/page (where this object is 'page') | def nested_path_by(field, opts = {})
options = {delimiter: "/", prefix: ""}
options.merge!(opts)
delimiter = options[:delimiter]
prefix = options[:prefix].empty? ? "" : "#{options[:prefix]}#{delimiter}"
path = ([self] + ancestors).reverse.collect {|a| a.send(field)}.join(delimiter).gsub(pr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def field_path *fields\n FieldPath.new(*fields)\n end",
"def path\n position = document.atomic_position\n position.blank? ? field : \"#{position}.#{field}\"\n end",
"def format_path(object)\n object.path.gsub('::', '_')\n end",
"def path\n if value.is... | [
"0.7080905",
"0.6715625",
"0.58925784",
"0.5880446",
"0.5816501",
"0.5636496",
"0.56151146",
"0.56148654",
"0.5562594",
"0.5562594",
"0.5509637",
"0.5509637",
"0.5478027",
"0.54699725",
"0.5450733",
"0.5439551",
"0.539896",
"0.539896",
"0.5393265",
"0.5374846",
"0.53731406",
... | 0.74437016 | 0 |
Returns a css class name for kind of file | def icon_css_class
case file_mime_type
when *ARCHIVE_FILE_TYPES
then "archive"
when *AUDIO_FILE_TYPES
then "audio"
when *IMAGE_FILE_TYPES
then "image"
when *VIDEO_FILE_TYPES
then "video"
when "application/x-shockwave-flash"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getStyle(filename)\n DEFAULT_FILE_TYPES.invert[File.extname(filename)]\n end",
"def file_type_class\n self.file_type.downcase.split.join('-') + '-file'\n end",
"def defined_classname filename\r\n script = File.new filename\r\n script.each_line do |line|\r\n if line =~ /class(.*)[<|\\z... | [
"0.7138231",
"0.70957786",
"0.6911482",
"0.6825835",
"0.6763818",
"0.67032063",
"0.66817033",
"0.66719776",
"0.66584134",
"0.6626825",
"0.66194874",
"0.65593463",
"0.6532662",
"0.6524408",
"0.6500964",
"0.64866716",
"0.64494306",
"0.643257",
"0.64283687",
"0.6416402",
"0.6398... | 0.73979926 | 0 |
GET /references/new GET /references/new.json | def new
@reference = @account.references.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @reference = Reference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reference }\n end\n end",
"def new\n @ref = Ref.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ref }\n end... | [
"0.7560176",
"0.69466454",
"0.68360513",
"0.67046285",
"0.6702816",
"0.66879934",
"0.6649331",
"0.6632744",
"0.66226864",
"0.65013385",
"0.65010905",
"0.64644486",
"0.63942343",
"0.6278453",
"0.6274386",
"0.6274033",
"0.62692356",
"0.6243434",
"0.6240735",
"0.6225951",
"0.621... | 0.70272243 | 1 |
GET /internets GET /internets.json | def index
@internets = Internet.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @networkings = Networking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @networkings }\n end\n end",
"def test_get_site_list\r\n endpoint = \"/sites\"\r\n uri = URI(\"#{@host}#{endpoint}\")\r\n request = Net::HTTP::... | [
"0.61471325",
"0.61165494",
"0.60363746",
"0.60363746",
"0.59300953",
"0.5920869",
"0.58244175",
"0.58151627",
"0.5804467",
"0.57917476",
"0.5772945",
"0.5763802",
"0.57162535",
"0.5668736",
"0.5654593",
"0.5649707",
"0.5640878",
"0.5610581",
"0.56096345",
"0.5600866",
"0.559... | 0.71520454 | 0 |
POST /internets POST /internets.json | def create
@internet = Internet.new(internet_params)
respond_to do |format|
if @internet.save
format.html { redirect_to @internet, notice: 'Internet was successfully created.' }
format.json { render :show, status: :created, location: @internet }
else
format.html { render :ne... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @internets = Internet.all\n end",
"def internet_params\n params.require(:internet).permit(:banda, :contrato, :cnpj, :nome)\n end",
"def post_inventories(name,description, organization=1,variables='')\n dprint \"/api/v1/hosts\"\n resp = @rest['/api/v1/hosts'].post({\n :n... | [
"0.6009264",
"0.59840983",
"0.5594287",
"0.5545337",
"0.5446135",
"0.5374118",
"0.5335536",
"0.5175832",
"0.5175655",
"0.51737547",
"0.51425505",
"0.5102705",
"0.5090323",
"0.50758237",
"0.50503325",
"0.5047668",
"0.5027481",
"0.50174975",
"0.5014189",
"0.50128645",
"0.497923... | 0.69433653 | 0 |
PATCH/PUT /internets/1 PATCH/PUT /internets/1.json | def update
respond_to do |format|
if @internet.update(internet_params)
format.html { redirect_to @internet, notice: 'Internet was successfully updated.' }
format.json { render :show, status: :ok, location: @internet }
else
format.html { render :edit }
format.json { render... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end",
"def patch!\n request! :patch\n end",
"def put_update(options = {})\n options[:id] ||= @website.id\n options[:websit... | [
"0.66075563",
"0.6107189",
"0.60620934",
"0.59931374",
"0.5962214",
"0.5935094",
"0.59247345",
"0.5882629",
"0.58340967",
"0.58259654",
"0.58022547",
"0.579239",
"0.5791156",
"0.5776272",
"0.5764515",
"0.57546973",
"0.573455",
"0.57310504",
"0.57158035",
"0.57158035",
"0.5693... | 0.65989697 | 1 |
DELETE /internets/1 DELETE /internets/1.json | def destroy
@internet.destroy
respond_to do |format|
format.html { redirect_to internets_url, notice: 'Internet was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @access_internet.destroy\n respond_to do |format|\n format.html { redirect_to access_internets_url, notice: 'Access internet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n delete_from_server single_url\n end",
"def delete\... | [
"0.7133318",
"0.7132496",
"0.70107406",
"0.6983946",
"0.68748295",
"0.6865625",
"0.68331397",
"0.68314385",
"0.6812762",
"0.67787737",
"0.67660373",
"0.6747108",
"0.6721552",
"0.67062354",
"0.6667756",
"0.6652738",
"0.6652738",
"0.6652738",
"0.6652738",
"0.66250277",
"0.66173... | 0.7319332 | 0 |
POST /admin/restaurants POST /admin/restaurants.json | def create
@admin_restaurant = Admin::Restaurant.new(admin_restaurant_params)
respond_to do |format|
if @admin_restaurant.save
format.html { redirect_to @admin_restaurant, notice: 'Restaurant was successfully created.' }
format.json { render :show, status: :created, location: @admin_resta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n json_response(Restaurant.create!(restaurant_params), :created)\n end",
"def create\n @restaurant = Restaurant.new(restaurant_params)\n if @restaurant.save\n render json: {success: true, restaurant: @restaurant} \n else\n render json: {success: false, errors: @restauran... | [
"0.7369996",
"0.7160911",
"0.71376413",
"0.6938119",
"0.69327366",
"0.6910166",
"0.6910166",
"0.6910166",
"0.6895149",
"0.6895149",
"0.6895149",
"0.68870723",
"0.6833067",
"0.68267864",
"0.67923766",
"0.67799735",
"0.6750343",
"0.67458135",
"0.6731178",
"0.6726244",
"0.666463... | 0.7427476 | 0 |
PATCH/PUT /admin/restaurants/1 PATCH/PUT /admin/restaurants/1.json | def update
respond_to do |format|
if @admin_restaurant.update(admin_restaurant_params)
format.html { redirect_to @admin_restaurant, notice: 'Restaurant was successfully updated.' }
format.json { render :show, status: :ok, location: @admin_restaurant }
else
format.html { render :e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n json_response(@restaurant.update!(restaurant_params))\n end",
"def update \n @restaurant = Restaurant.find(params[:id])\n @restaurant.owner_id = current_owner.id\n\n respond_to do |format|\n if @restaurant.update_attributes(params[:restaurant])\n # format.html { redi... | [
"0.7251908",
"0.6729797",
"0.6715429",
"0.6670564",
"0.66246164",
"0.66246164",
"0.66246164",
"0.66246164",
"0.65513116",
"0.65513116",
"0.654816",
"0.6507395",
"0.650353",
"0.6469208",
"0.6415895",
"0.6415895",
"0.6415895",
"0.63961005",
"0.63853073",
"0.63785475",
"0.636257... | 0.6990584 | 1 |
DELETE /admin/restaurants/1 DELETE /admin/restaurants/1.json | def destroy
@admin_restaurant.destroy
respond_to do |format|
format.html { redirect_to admin_restaurants_url, notice: 'Restaurant was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n... | [
"0.73669946",
"0.73669946",
"0.73669946",
"0.73669946",
"0.73669946",
"0.73669946",
"0.73669946",
"0.73669946",
"0.7314704",
"0.7306246",
"0.72777504",
"0.72777504",
"0.72777504",
"0.7174789",
"0.71701103",
"0.71401596",
"0.71370363",
"0.7126396",
"0.7086429",
"0.7086429",
"0... | 0.75120753 | 0 |
GET /isps GET /isps.json | def index
@isps = Isp.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @snps = Snp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snps }\n end\n end",
"def index\n @socio_irpjs = SocioIrpj.all\n end",
"def index\n @snips = Snip.all\n\n respond_to do |format|\n format.html # index.html.erb\... | [
"0.65481347",
"0.6263038",
"0.62025106",
"0.6166296",
"0.61100435",
"0.61009514",
"0.6085157",
"0.6040352",
"0.60241735",
"0.5971656",
"0.5910074",
"0.5909469",
"0.5893497",
"0.58617395",
"0.5853113",
"0.5841907",
"0.58054084",
"0.58040136",
"0.58012736",
"0.57784843",
"0.577... | 0.69026697 | 0 |
POST /isps POST /isps.json | def create
@isp = Isp.new(isp_params)
respond_to do |format|
if @isp.save
format.html { redirect_to @isp, notice: 'Isp was successfully created.' }
format.json { render :show, status: :created, location: @isp }
else
format.html { render :new }
format.json { render js... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isp_params\n params.require(:isp).permit(:name, :attackID)\n end",
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipe... | [
"0.58544284",
"0.5805111",
"0.567645",
"0.5673798",
"0.5655088",
"0.5631333",
"0.5578892",
"0.55357426",
"0.5533478",
"0.55230206",
"0.5515764",
"0.5376391",
"0.5360025",
"0.5348559",
"0.5308799",
"0.5296655",
"0.5250025",
"0.52440387",
"0.5237828",
"0.5228899",
"0.5209398",
... | 0.71348965 | 0 |
PATCH/PUT /isps/1 PATCH/PUT /isps/1.json | def update
respond_to do |format|
if @isp.update(isp_params)
format.html { redirect_to @isp, notice: 'Isp was successfully updated.' }
format.json { render :show, status: :ok, location: @isp }
else
format.html { render :edit }
format.json { render json: @isp.errors, statu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @squire.update(squire_params)\n format.html { redirect_to @squire, notice: 'Squire was successfully updated.' }\n format.json { render :show, status: :ok, location: @squire }\n else\n format.html { render :edit }\n format.json { rend... | [
"0.6500215",
"0.65000606",
"0.6294271",
"0.6283362",
"0.6253095",
"0.6186845",
"0.61377424",
"0.612602",
"0.6110562",
"0.6096497",
"0.6082327",
"0.60786444",
"0.60739785",
"0.607001",
"0.6069687",
"0.60664874",
"0.60622823",
"0.60445046",
"0.60377777",
"0.6026912",
"0.6023557... | 0.6948542 | 0 |
DELETE /isps/1 DELETE /isps/1.json | def destroy
@isp.destroy
respond_to do |format|
format.html { redirect_to isps_url, notice: 'Isp was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @socio_spc.destroy\n respond_to do |format|\n format.html { redirect_to socio_spcs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sivic_discipulo.destroy\n respond_to do |format|\n format.html { redirect_to sivic_discipulos_url }\n format.... | [
"0.6861883",
"0.6731049",
"0.67298347",
"0.6683525",
"0.6659344",
"0.66463345",
"0.66406304",
"0.6636197",
"0.66064376",
"0.66064376",
"0.65785253",
"0.65729284",
"0.6566983",
"0.6547658",
"0.6539412",
"0.65387005",
"0.64981526",
"0.6493661",
"0.6487279",
"0.6483142",
"0.6477... | 0.7208446 | 0 |
Get dispute details Returns all the details of a dispute using the dispute identifier. | def get_dispute_details(dispute_id, opts = {})
data, _status_code, _headers = get_dispute_details_with_http_info(dispute_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dispute_details_with_http_info(dispute_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.get_dispute_details ...'\n end\n # verify the required parameter 'dispute_id' is set\n if @api_client.config.client_side_validation ... | [
"0.6528571",
"0.6504726",
"0.6429193",
"0.6429193",
"0.62441564",
"0.62161034",
"0.61614233",
"0.6070044",
"0.6012627",
"0.5927579",
"0.57882786",
"0.57763785",
"0.5764956",
"0.57508475",
"0.5748973",
"0.57304984",
"0.5725318",
"0.57224196",
"0.57224196",
"0.57183236",
"0.562... | 0.8035517 | 0 |
Get dispute details Returns all the details of a dispute using the dispute identifier. | def get_dispute_details_with_http_info(dispute_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: DisputesApi.get_dispute_details ...'
end
# verify the required parameter 'dispute_id' is set
if @api_client.config.client_side_validation && dispute... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dispute_details(dispute_id, opts = {})\n data, _status_code, _headers = get_dispute_details_with_http_info(dispute_id, opts)\n data\n end",
"def get_dispute_evidence(dispute_id, opts = {})\n data, _status_code, _headers = get_dispute_evidence_with_http_info(dispute_id, opts)\n data... | [
"0.8035856",
"0.6504682",
"0.64283854",
"0.64283854",
"0.6243345",
"0.6215734",
"0.6161557",
"0.60696095",
"0.60122734",
"0.5927277",
"0.57880384",
"0.57761335",
"0.5764058",
"0.57507944",
"0.57487565",
"0.5730047",
"0.57245874",
"0.57224613",
"0.57224613",
"0.57171255",
"0.5... | 0.6528627 | 1 |
Get dispute evidence Retrieves a list of the evidence submitted in response to a specific dispute. | def get_dispute_evidence(dispute_id, opts = {})
data, _status_code, _headers = get_dispute_evidence_with_http_info(dispute_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def provide_dispute_evidence(dispute_id, opts = {})\n provide_dispute_evidence_with_http_info(dispute_id, opts)\n nil\n end",
"def index\n @evidence = Evidence.all\n end",
"def index\n @evidences = Evidence.all\n end",
"def get_dispute_evidence_with_http_info(dispute_id, opts = {})\n ... | [
"0.65136564",
"0.6201981",
"0.61271626",
"0.6014643",
"0.5719737",
"0.5661378",
"0.55535525",
"0.5443012",
"0.5431403",
"0.5414931",
"0.5381682",
"0.5347796",
"0.5347796",
"0.53197044",
"0.5310905",
"0.5292871",
"0.5292871",
"0.52774334",
"0.51486903",
"0.5119194",
"0.5109836... | 0.69512284 | 0 |
Get disputes Returns a list of all disputes against your business. The results will be returned in reverse chronological order, showing the last modified dispute (for example, where you've recently added a piece of evidence) first. You can use the optional parameters below to skip or limit results. | def get_disputes(opts = {})
data, _status_code, _headers = get_disputes_with_http_info(opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @disputes = Dispute.all\n end",
"def get_disputes_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.get_disputes ...'\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'... | [
"0.65108514",
"0.6081465",
"0.57753664",
"0.5476248",
"0.54130894",
"0.5400466",
"0.5392575",
"0.53411204",
"0.5335698",
"0.5212754",
"0.509491",
"0.50940126",
"0.5081775",
"0.5066418",
"0.50181496",
"0.5004236",
"0.4987846",
"0.49724054",
"0.49682108",
"0.49634677",
"0.49563... | 0.74500763 | 0 |
Submit dispute evidence With this final request, you can submit the evidence that you have previously provided. Make sure you have provided all the relevant information before using this request. You will not be able to amend your evidence once you have submitted it. | def submit_dispute_evidence(dispute_id, opts = {})
submit_dispute_evidence_with_http_info(dispute_id, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evidence_params\n params.require(:evidence).permit(:awarded_badge_id, :file_name)\n end",
"def evidence_params\n params.require(:evidence).permit(:title,:action,:description, :recommendation_id,:day, evidencefiles_attributes: [:document, :_destroy])\n end",
"def evidence_params\n param... | [
"0.6426868",
"0.6416204",
"0.6224866",
"0.6169022",
"0.6168901",
"0.58507633",
"0.56596124",
"0.5583541",
"0.5551783",
"0.5502571",
"0.54677784",
"0.5448605",
"0.5448605",
"0.54181176",
"0.53506374",
"0.5341992",
"0.5329798",
"0.5326155",
"0.52908725",
"0.526332",
"0.5239235"... | 0.6422297 | 1 |
Login to Cherwell using the given credentials. Return true if login succeeded, or raise `LoginFailed` if login failed. | def login(username=nil, password=nil)
creds = {
:userId => username || @username,
:password => password || @password,
}
begin
response = @client.call(:login, :message => creds)
rescue => e
# This can happen if a bad URL is given
raise Cherby::LoginFailed, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login\n username = find_username\n password = find_password\n\n Log.info(\"Logging in as #{username}... \", newline: false)\n\n conn = Faraday.new(url: \"https://redacted.ch/\")\n response = conn.post do |request|\n request.url \"login.php\"\n request.headers[\"User-Agent\"] = Redacted... | [
"0.69659966",
"0.6943631",
"0.68029386",
"0.6529158",
"0.65098614",
"0.6448102",
"0.6405253",
"0.6319349",
"0.63108695",
"0.6307422",
"0.6305286",
"0.6197721",
"0.61966246",
"0.61807466",
"0.61802006",
"0.6169368",
"0.6163685",
"0.6154385",
"0.6147033",
"0.61369807",
"0.61300... | 0.7541474 | 0 |
Get the Cherwell incident with the given public ID, and return an Incident object. | def incident(id)
incident_xml = get_object_xml('Incident', id)
error = self.last_error
if error
raise Cherby::NotFound.new("Cannot find Incident '#{id}': #{error}")
else
return Incident.new(incident_xml.to_s)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_incident(data)\n incident = Incident.create(data)\n result = @client.create_business_object({\n :busObNameOrId => 'Incident',\n :creationXml => incident.to_xml\n })\n\n # Result contains the public ID of the new incident, or nil if the\n # incident-creation failed.... | [
"0.6230577",
"0.6167987",
"0.56428635",
"0.55607504",
"0.55577266",
"0.5505253",
"0.54623157",
"0.5422608",
"0.5352587",
"0.53493416",
"0.53493416",
"0.533292",
"0.5316828",
"0.52880484",
"0.52880484",
"0.52880484",
"0.52880484",
"0.52880484",
"0.52880484",
"0.52880484",
"0.5... | 0.7662541 | 0 |
Get the Cherwell task with the given public ID, and return a Task object. | def task(id)
task_xml = get_object_xml('Task', id)
error = self.last_error
if error
raise Cherby::NotFound.new("Cannot find Task '#{id}': #{error}")
else
return Task.new(task_xml.to_s)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task id\n Task.new(self, JSON.parse(request :get, \"tasks/#{id}\"))\n end",
"def getTaskByID(id) \n ret = nil \n\n @Tasks.each do |task| \n ret = task if task.ID == id\n end \n end",
"def task(task_id)\n task = self.class.get(\"/tasks/%s\" % task_id).parsed_response\n\n ret... | [
"0.7402685",
"0.69623286",
"0.6862189",
"0.6759626",
"0.66513723",
"0.6555171",
"0.65374213",
"0.64835805",
"0.64676446",
"0.64466",
"0.638712",
"0.6369276",
"0.63113207",
"0.63113207",
"0.6270845",
"0.6267655",
"0.61952704",
"0.61718273",
"0.6155113",
"0.6153831",
"0.6107212... | 0.7864912 | 0 |
Get a BusinessObject instance | def get_business_object(object_type, id)
xml = self.get_object_xml(object_type, id)
return BusinessObject.new(xml)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def business\n @business ||= @session.business\n end",
"def business(business_id)\n begin\n get_hash_by_object(@client.business(business_id))\n rescue Exception => e\n {:application_code => 400}\n end\n end",
"def get(obj)\n collection, query = get_type_info(obj)\n\n r... | [
"0.64524025",
"0.6060337",
"0.5957739",
"0.5940631",
"0.59086174",
"0.5883946",
"0.58594644",
"0.5848227",
"0.5794602",
"0.5794602",
"0.5790286",
"0.5790286",
"0.5790286",
"0.5790286",
"0.5790286",
"0.5790286",
"0.5790286",
"0.5790286",
"0.5790286",
"0.5772834",
"0.57710195",... | 0.8126258 | 0 |
Update a given Cherwell object by submitting its XML to the SOAP interface. | def update_object_xml(object_type, id, xml)
@client.update_business_object_by_public_id({
:busObNameOrId => object_type,
:busObPublicId => id,
:updateXml => xml
})
return last_error
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n connection.put(element_path, to_xml)\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update\n # returning connection.put(element_path(prefix_options), to_xml, self.class.headers) d... | [
"0.6479917",
"0.63149154",
"0.623946",
"0.5823542",
"0.58115184",
"0.57926804",
"0.57878566",
"0.5706624",
"0.5703181",
"0.5698466",
"0.56553006",
"0.56543136",
"0.5635792",
"0.56115854",
"0.55983585",
"0.55750173",
"0.55648303",
"0.55632895",
"0.5557411",
"0.55290174",
"0.55... | 0.66331226 | 0 |
Save the given Cherwell incident | def save_incident(incident)
update_object_xml('Incident', incident.id, incident.to_xml)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @incident = Incident.new(incident_params)\n @incident.happened_at = Time.now\n @incident.state = :open\n\n respond_to do |format|\n if @incident.save\n format.html { redirect_to @incident, notice: 'Incident was successfully created.' }\n format.json { render :show, statu... | [
"0.6133752",
"0.59281516",
"0.58280176",
"0.5819363",
"0.58001083",
"0.57861286",
"0.57861286",
"0.5772887",
"0.5714373",
"0.5701688",
"0.5701688",
"0.5682269",
"0.5666079",
"0.5666079",
"0.5663588",
"0.56451356",
"0.56451356",
"0.56451356",
"0.56451356",
"0.56451356",
"0.564... | 0.7536809 | 0 |
Create a new Cherwell incident with the given data. If creation succeeds, return the Incident instance; otherwise, return `nil`. | def create_incident(data)
incident = Incident.create(data)
result = @client.create_business_object({
:busObNameOrId => 'Incident',
:creationXml => incident.to_xml
})
# Result contains the public ID of the new incident, or nil if the
# incident-creation failed.
if !re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @incident = Incident.new(incident_params)\n\n respond_to do |format|\n if @incident.save\n format.html { redirect_to @incident, notice: 'Incident was successfully created.' }\n format.json { render :show, status: :created, location: @incident }\n else\n format.html... | [
"0.63564336",
"0.6304077",
"0.6295956",
"0.6295956",
"0.62588406",
"0.62181264",
"0.6210553",
"0.61930954",
"0.61212116",
"0.6118432",
"0.5821759",
"0.57834375",
"0.5702393",
"0.5701018",
"0.5651847",
"0.56334335",
"0.5605624",
"0.55650544",
"0.5534656",
"0.55182076",
"0.5491... | 0.839599 | 0 |
Get a business object definition as a hash ex. get_object_definition('Incident') TODO: Use this as the basis for building templates? | def get_object_definition(object_type)
result = {}
definition = @client.get_business_object_definition(object_type)
selector = 'BusinessObjectDef > FieldList > Field'
Nokogiri::XML(definition).css(selector).map do |field|
result[field['Name']] = field.css('Description').inner_html
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_definition\n\n end",
"def hash\n [class_id, object_type, description, name, type, system].hash\n end",
"def getEmploymentBusinessDetailObjName\r\n\t\t\treturn \"mfiforce__Employment_Business_Detail__c\"\r\n\t\tend",
"def get_schema(object_name)\n s = @client.describe(object_name)\n ... | [
"0.5812334",
"0.57990557",
"0.5618393",
"0.55305177",
"0.5494255",
"0.5494255",
"0.5494255",
"0.5494255",
"0.5494255",
"0.5494255",
"0.5494255",
"0.5494255",
"0.5494255",
"0.5494255",
"0.5494255",
"0.5494255",
"0.5494255",
"0.5494255",
"0.54875606",
"0.54716027",
"0.5463971",... | 0.7137704 | 0 |
Redirects to a single constituency given an external source and an id that identifies this constituency in that source. | def lookup
@constituency = @request.get.first
redirect_to constituency_path(@constituency.graph_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redirected\n @url = Url.where(short_url: params[:id]).first\n if @url.present?\n @url.increase_hit\n redirect_to \"#{'http://' unless @url.url.include?('http://') || @url.url.include?('https://')}#{@url.url}\"\n else\n redirect_to urls_path, alert: \"URL not present. Please create new U... | [
"0.6356379",
"0.6323642",
"0.6301863",
"0.62697154",
"0.62367415",
"0.6148157",
"0.6147223",
"0.6096034",
"0.60953665",
"0.6094001",
"0.60492134",
"0.60352594",
"0.5989146",
"0.595721",
"0.5942591",
"0.59392685",
"0.582971",
"0.5796933",
"0.5782548",
"0.5750796",
"0.5746887",... | 0.63747656 | 0 |
Post method which accepts form parameters from postcode lookup and redirects to constituency_path. | def postcode_lookup
flash[:postcode] = params[:postcode]
redirect_to constituency_path(params[:constituency_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post\n\t redirect_to search_path( query: params[:query] )\n\tend",
"def create\n @post_code = PostCode.new(post_code_params)\n\n respond_to do |format|\n if @post_code.save\n format.html { redirect_to @post_code, notice: 'Post code was successfully created.' }\n format.json { render... | [
"0.601083",
"0.58243847",
"0.57342035",
"0.5613032",
"0.5558212",
"0.5543345",
"0.5499545",
"0.5471181",
"0.546844",
"0.5455429",
"0.5447761",
"0.5424066",
"0.5388734",
"0.5366871",
"0.53646636",
"0.5326812",
"0.53149766",
"0.5274738",
"0.52576333",
"0.5253722",
"0.52461255",... | 0.7674942 | 0 |
Renders a constituency that has a constituency area object on map view given a constituency id. Will respond with GeoJSON data using the geosparqltogeojson gem if JSON is requested. | def map
respond_to do |format|
format.html do
@constituency = Parliament::Utils::Helpers::FilterHelper.filter(@request, 'ConstituencyGroup').first
@json_location = constituency_map_path(@constituency.graph_id, format: 'json')
end
format.json do
@constituency = Parliament:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @county = Entity.where(id: params[:id]).where(entity_type: 'County').first\n respond_with(@county) do |format|\n format.geojson { render text: @county.to_geojson }\n end\n end",
"def map\n respond_to do |format|\n format.html do\n @constituency = Parliament::Utils::Helper... | [
"0.6665441",
"0.62658805",
"0.560211",
"0.55548006",
"0.55038095",
"0.5484718",
"0.5409774",
"0.54057163",
"0.5393519",
"0.5364922",
"0.53348184",
"0.531092",
"0.5278387",
"0.5256406",
"0.5243053",
"0.5214157",
"0.52126855",
"0.52115476",
"0.51657003",
"0.5163363",
"0.5145046... | 0.6267736 | 1 |
UC2 Put information about Users and contracts with Vendors | def put_contract(q)
$LOG.info('put_contract');
@USER=q["USER"];
@CONTRACT=q["CONTRACT"];
@CID=@USER["CID"];
@user=$CACHE.get("USER",@CID)
$LOG.info(@USER.to_s()+' - '+@CONTRACT.to_s());
if (@user == nil)
@user=$STORAGE.get("USER",@CID)
if (@user == nil)
$STORAGE.put("USER",@CID,@USER)
@user=$STORAGE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vendor_params\n params.require(:vendor).permit(:bank, :bank_account, :branch_code, :account_number, :family_name, :first_name, :post_number, :city,:address, :building_name, :created_at, :updated_at, :prefecture_id ).merge(user_id: current_user.id)\n end",
"def create\n @vendor = current_user.vendors.n... | [
"0.55371755",
"0.54913795",
"0.54703075",
"0.53519434",
"0.5263387",
"0.51892287",
"0.5170976",
"0.5159538",
"0.5153413",
"0.51261294",
"0.5103107",
"0.51030314",
"0.5053509",
"0.5051054",
"0.5040232",
"0.50084823",
"0.4998513",
"0.4972688",
"0.49528152",
"0.4945624",
"0.4945... | 0.55504066 | 0 |
Creates a new SexpProcessor. Use super to invoke this initializer from SexpProcessor subclasses, then use the attributes above to customize the functionality of the SexpProcessor | def initialize
@expected = Sexp
# we do this on an instance basis so we can subclass it for
# different processors.
@processors = {}
@context = []
public_methods.each do |name|
if name.to_s.start_with? "process_" then
@processors[name[8..-1].to_sym] = name.to_sym
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n @expected = Sexp\n @processors = self.class.processors\n @context = []\n\n if @processors.empty?\n public_methods.each do |name|\n if name.to_s.start_with? \"process_\" then\n @processors[name[8..-1].to_sym] = name.to_sym\n end\n end\n end\n end"... | [
"0.68719083",
"0.67864865",
"0.6003468",
"0.5708315",
"0.56322914",
"0.5605215",
"0.55952346",
"0.558298",
"0.539174",
"0.53711504",
"0.52841204",
"0.5227974",
"0.5194748",
"0.5193247",
"0.5148749",
"0.5145704",
"0.51257926",
"0.5111365",
"0.5039571",
"0.50331455",
"0.5020619... | 0.69607973 | 0 |
Default Sexp processor. Invokes process_ methods matching the Sexp type given. Performs additional checks as specified by the initializer. | def process(exp)
return nil if exp.nil?
result = nil
type = exp.first
raise "type should be a Symbol, not: #{exp.first.inspect}" unless
Symbol === type
in_context type do
# now do a pass with the real processor (or generic)
meth = @processors[type]
if meth then
if ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process exp\n return nil if exp.nil?\n\n unless Sexp === exp then\n raise SexpTypeError, \"exp must be a Sexp, was #{exp.class}:#{exp.inspect}\"\n end\n\n if self.context.empty? then\n p :rewriting unless debug.empty?\n exp = self.rewrite(exp)\n p :done_rewriting unless debug.em... | [
"0.7451764",
"0.7434105",
"0.6505911",
"0.6460087",
"0.6388599",
"0.63822263",
"0.6163957",
"0.612368",
"0.6037836",
"0.5958047",
"0.58640337",
"0.5844334",
"0.5833821",
"0.57282895",
"0.56586176",
"0.5653573",
"0.5579693",
"0.553309",
"0.55093855",
"0.5496367",
"0.54887104",... | 0.75268567 | 0 |
A fairly generic processor for a dummy node. Dummy nodes are used when your processor is doing a complicated rewrite that replaces the current sexp with multiple sexps. Bogus Example: def process_something(exp) return s(:dummy, process(exp), s(:extra, 42)) end | def process_dummy(exp)
result = @expected.new(:dummy) rescue @expected.new
until exp.empty? do
result << self.process(exp.shift)
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_dummy exp\n result = @expected.new(:dummy) rescue @expected.new\n result << self.process(exp.shift) until exp.empty?\n result\n end",
"def process_dummy(exp)\n process_block(exp).chomp\n end",
"def process_defn exp\n exp.shift unless auto_shift_type # node type\n name = @sclass.... | [
"0.63568693",
"0.6237473",
"0.5949897",
"0.5918314",
"0.5550516",
"0.55156153",
"0.54685557",
"0.5429859",
"0.5420868",
"0.5302231",
"0.5297833",
"0.5243836",
"0.52326226",
"0.52313733",
"0.521029",
"0.5202815",
"0.51909214",
"0.51699054",
"0.51671785",
"0.51224387",
"0.51151... | 0.6348755 | 1 |
GET /bid_winners GET /bid_winners.json | def index
@bid_winners = BidWinner.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @winners = Winner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @winners }\n end\n end",
"def index\n @bids = Bid.where(\"auction_id = ?\", params[:auction_id])\n\n render json: @bids\n end",
"def all_booking_of_client\n\t\t@bo... | [
"0.6780769",
"0.6647827",
"0.6563457",
"0.652974",
"0.61657447",
"0.608783",
"0.6080473",
"0.6074066",
"0.6041351",
"0.6015063",
"0.60125554",
"0.601035",
"0.59837455",
"0.595581",
"0.5943688",
"0.5916635",
"0.58888197",
"0.5884723",
"0.58798057",
"0.58788425",
"0.58627576",
... | 0.7656405 | 0 |
POST /bid_winners POST /bid_winners.json | def create
@bid_winner = BidWinner.new(bid_winner_params)
respond_to do |format|
if @bid_winner.save
format.html { redirect_to @bid_winner, notice: 'Bid winner was successfully created.' }
format.json { render :show, status: :created, location: @bid_winner }
else
format.html... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n \t@bet = Bet.find(params[:bet_id])\n @winner = @bet.build_winner(winner_params)\n\n respond_to do |format|\n if @winner.save\n @bet.participations.each do |participation|\n if participation.choice == @winner.choice\n user = participation.user\n winning... | [
"0.64246356",
"0.6414788",
"0.6399638",
"0.63068753",
"0.6241566",
"0.6133156",
"0.6027251",
"0.59767824",
"0.5944652",
"0.5922627",
"0.59179306",
"0.59175223",
"0.5902692",
"0.58576345",
"0.5856097",
"0.5831401",
"0.57759506",
"0.5766759",
"0.5765637",
"0.57549363",
"0.57486... | 0.69893986 | 0 |
PATCH/PUT /bid_winners/1 PATCH/PUT /bid_winners/1.json | def update
respond_to do |format|
if @bid_winner.update(bid_winner_params)
format.html { redirect_to @bid_winner, notice: 'Bid winner was successfully updated.' }
format.json { render :show, status: :ok, location: @bid_winner }
else
format.html { render :edit }
format.jso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @bid = @swarm_request.bids.find(params[:id])\n\n respond_to do |format|\n if @bid.update_attributes(params[:bid])\n format.html { redirect_to(swarm_request_bid_url(:id => @bid.to_param, :swarm_request_id => @swarm_request.to_param), :notice => 'Bid was successfully updated.') }\n ... | [
"0.692455",
"0.6564157",
"0.65320796",
"0.64614964",
"0.6446403",
"0.6444107",
"0.6438846",
"0.6438846",
"0.6438846",
"0.6438846",
"0.6431077",
"0.64215314",
"0.6402706",
"0.6386484",
"0.6367449",
"0.6357738",
"0.6268321",
"0.62669903",
"0.6233732",
"0.6230411",
"0.6223576",
... | 0.69262636 | 0 |
DELETE /bid_winners/1 DELETE /bid_winners/1.json | def destroy
@bid_winner.destroy
respond_to do |format|
format.html { redirect_to bid_winners_url, notice: 'Bid winner was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @bid = @swarm_request.bids.find(params[:id])\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to(swarm_request_bids_url(:swarm_request_id => @swarm_request.to_param)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bid.destroy\n\n respond_to... | [
"0.7177306",
"0.7116709",
"0.7081332",
"0.7081332",
"0.70671713",
"0.69776374",
"0.694754",
"0.69332546",
"0.6883727",
"0.6860931",
"0.6833714",
"0.6829652",
"0.6829652",
"0.6829652",
"0.6829652",
"0.6829652",
"0.6822566",
"0.6820957",
"0.68122256",
"0.6805556",
"0.6804825",
... | 0.7298102 | 0 |
Build an instance of TrunkInstance | def get_instance(payload)
TrunkInstance.new(@version, payload)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trunk code, options = {}\n TrunkCode.new code, options\n end",
"def get_instance(payload)\n TranscriptInstance.new(@version, payload)\n end",
"def new_instance(suite, platform, index)\n Instance.new(\n :busser => new_busser(suite, platform... | [
"0.6475194",
"0.6136434",
"0.57862455",
"0.5784211",
"0.5720444",
"0.5533709",
"0.541989",
"0.53673667",
"0.5281895",
"0.5267927",
"0.5225712",
"0.5204002",
"0.50863034",
"0.5076422",
"0.5072901",
"0.50608623",
"0.50405186",
"0.50070596",
"0.49636728",
"0.49558178",
"0.493797... | 0.79163444 | 0 |
========= PEDAC. Problem, Examples, Data Structure, Algorithum, Code P: Write a method that rotates an array by moving the first element to the end of the array. The original array should not be modified. Do not use the method Arrayrotate or Arrayrotate! for your implementation. E: rotate_array([7, 3, 5, 2, 9, 1]) == [... | def rotate_array(array_of_numbers)
rotated_array = array_of_numbers.clone
rotated_array << rotated_array.shift
rotated_array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate_array(input_array)\n return input_array if input_array.size <= 1\n new_array = []\n index_counter = 1\n loop do\n new_array << input_array[index_counter]\n index_counter += 1\n break if index_counter >= input_array.size\n end\n new_array << input_array[0]\n new_array\nend",
"def rotate... | [
"0.81887287",
"0.80985403",
"0.80985403",
"0.8023813",
"0.80042064",
"0.7981421",
"0.79398644",
"0.7939189",
"0.79229003",
"0.7916857",
"0.7905621",
"0.78907263",
"0.7876534",
"0.7868385",
"0.7868385",
"0.7868385",
"0.7868385",
"0.7868385",
"0.7868385",
"0.7868385",
"0.786838... | 0.85668236 | 0 |
Problem 4: ========= PEDAC. Problem, Examples, Data Structure, Algorithum, Code P: You have a bank of switches before you, numbered from 1 to n. Each switch is connected to exactly one light that is initially off. You walk down the row of switches and toggle every one of them. You go back to the beginning, and on this ... | def light_sequence(n)
lights = {}
n.times {|num| lights[num+1] = "on"}
n.times do |num|
lights.each do |light, status|
if light % (num+1) == 0
lights[light] == "on" ? lights[light] = "off" : lights[light] = "on"
end
end
end
lights.select {|light, status| status == 'off'}.keys
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def light_switches(n)\n light_hash = {}\n 1.upto(n) { |i| light_hash[i] = true }\n 2.upto(n) do |current_pass|\n light_hash.map do |light, state|\n light_hash[light] = !state if light % current_pass == 0\n end\n end\n lights_left_on = light_hash.select do |_, state|\n state\n end\n result = []... | [
"0.792712",
"0.7749223",
"0.7739923",
"0.7692745",
"0.76643014",
"0.74957013",
"0.7375937",
"0.7313735",
"0.72194535",
"0.71955246",
"0.7178645",
"0.71327615",
"0.6890177",
"0.6886227",
"0.687644",
"0.67687666",
"0.67145634",
"0.668294",
"0.6666244",
"0.6658966",
"0.6572849",... | 0.78218555 | 1 |
GET /resource_types/new GET /resource_types/new.json | def new
@resource_type = ResourceType.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @resource_type }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @resource = Resource.new\n @resource_types=ResourceType.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def new\n @type = Type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.... | [
"0.80984217",
"0.749518",
"0.72583467",
"0.7163297",
"0.7077784",
"0.7077784",
"0.7077784",
"0.6994682",
"0.699189",
"0.69738686",
"0.6973582",
"0.69266593",
"0.6924751",
"0.68841773",
"0.6876847",
"0.6873741",
"0.6855479",
"0.6854698",
"0.6847847",
"0.6828631",
"0.6825493",
... | 0.8351805 | 0 |
POST /resource_types POST /resource_types.jsojoins(:field_type)n | def create
@resource_type = ResourceType.new(params[:resource_type])
respond_to do |format|
if @resource_type.save
if params[:fields]
params[:fields].each do |param|
@field = Field.new(
:name => param[:name],
:field_type_id ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def field_as_json(field)\n res = \"'#{field.name}' => @#{field.name}\"\n field_base_type = _schema_base_class(field.type).type_sym\n\n if %i(record enum).include?(field_base_type)\n res += case field.type.type_sym\n when :array\n '.map { |... | [
"0.56644815",
"0.5489921",
"0.54534537",
"0.5450834",
"0.54328495",
"0.53692836",
"0.5260073",
"0.5241032",
"0.5222839",
"0.5208282",
"0.5194803",
"0.51610243",
"0.513126",
"0.5117086",
"0.50895536",
"0.5083326",
"0.5080772",
"0.50585425",
"0.5018466",
"0.4976705",
"0.4956067... | 0.5658422 | 1 |
DELETE /resource_types/1 DELETE /resource_types/1.json | def destroy
begin
if @resource_type.destroy
respond_to do |format|
format.html { redirect_to resource_types_url }
format.json { head :no_content }
end
end
rescue
respond_to do |format|
format.html { redirect_to "index", notice: "Resource_type cann'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_resource(type, id, data = {})\n model = fetch_generic_object_definition(type, id, data)\n delete_resource_main_action(type, model, data)\n model\n rescue => err\n raise BadRequestError, \"Deleting #{model_ident(model, type)} - #{err}\"\n end",
"def destroy\n authorize :res... | [
"0.75429046",
"0.74166036",
"0.7370498",
"0.7339524",
"0.7250024",
"0.7213917",
"0.7186394",
"0.7171517",
"0.71469706",
"0.71456087",
"0.7096467",
"0.70753014",
"0.7072549",
"0.7066805",
"0.70355505",
"0.6999935",
"0.698017",
"0.6972318",
"0.6968882",
"0.6968364",
"0.6964999"... | 0.7696583 | 0 |
Returns the comments on the given startup. | def startup_comments(id)
get("1/startups/#{id}/comments")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comments; end",
"def comments; end",
"def comments; end",
"def comments; end",
"def comments; end",
"def comments; end",
"def comments\n @docstring.all\n end",
"def comments\n\t\t\t@comments ||= read_comments\n\t\tend",
"def description\n comment_sections.first\n end",
"def co... | [
"0.62729996",
"0.62729996",
"0.62729996",
"0.62729996",
"0.62729996",
"0.62729996",
"0.6271587",
"0.6245342",
"0.6235109",
"0.6204977",
"0.6120188",
"0.6094312",
"0.6094312",
"0.6094312",
"0.6094312",
"0.6094312",
"0.6002215",
"0.5987624",
"0.59661573",
"0.59236956",
"0.58643... | 0.7397307 | 0 |
Returns up to 50 startups at a time, given an Array of ids. | def get_startups(ids)
params = { :ids => ids.join(',') }
get("1/startups/batch", params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gather_user_profiles_from_ids(ids)\n ids = ids.map{|i| Integer(i) }\n profiles = []\n count = 0\n ids.each_slice(100) do |arr|\n count += 1\n puts \"On count: #{count}\"\n begin\n data = Twit.fetch_users_by_ids(arr)\n ... | [
"0.67651993",
"0.66166914",
"0.60484505",
"0.6021994",
"0.58882123",
"0.5844549",
"0.5763887",
"0.5762793",
"0.5753166",
"0.57400334",
"0.5730895",
"0.56570125",
"0.55848336",
"0.5583678",
"0.55628765",
"0.5545807",
"0.55302626",
"0.5518771",
"0.5465705",
"0.5456989",
"0.5445... | 0.74887687 | 0 |
Search for a startup given a URL slug. Responds like GET /startups/:id. | def startup_search(options={})
get("1/startups/search", options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search\n if Config[\"ISEARCH\"]\n incremental_search\n else\n str = getstr('/')\n do_search NEXT, str\n end\n end",
"def find(slug)\n target_url = fetch_target_url(slug)\n\n fail(Errors::SlugNotFound, slug) unless target_url\n\n to_url(slug, target_url)\n... | [
"0.54361725",
"0.53489435",
"0.5294611",
"0.5292878",
"0.5270016",
"0.5260653",
"0.52603585",
"0.52084076",
"0.52073455",
"0.51507175",
"0.5139186",
"0.5105882",
"0.5086841",
"0.50842106",
"0.50469387",
"0.50155705",
"0.49937168",
"0.49776912",
"0.49465457",
"0.49241126",
"0.... | 0.68186027 | 0 |
output to a file, and the streaming output handler | def log_and_stream(output)
write_file output, @filename if @filename
@block.call(output)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_to_file\n @output=:file\n end",
"def process_output(file=nil)\n output = if file\n File.new(file.to_s,'w')\n else\n STDOUT\n end\n\n yield output if block_given?\n\n output.flush\n output.close\n return ni... | [
"0.70496744",
"0.6911427",
"0.677642",
"0.6775058",
"0.67674965",
"0.6717924",
"0.66240805",
"0.65162593",
"0.64997506",
"0.64211464",
"0.6414503",
"0.63471895",
"0.63361895",
"0.633134",
"0.63018715",
"0.6292471",
"0.62518466",
"0.622082",
"0.6200323",
"0.61857706",
"0.61738... | 0.729572 | 0 |
pokemon_name = [] def pokemons_names(pokemon_name) Pokemon.each do |pokemon| pokemon_name << pokemon[:name] end pokemon_name end def pokemons_names pokemon_name = [] Pokemon.each do |pokemon| pokemon_name << pokemon[:name] end pokemon_name end | def pokemons_names
Pokemon.collect do |pokemon|
pokemon[:name]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_names(pokemon)\n pokemon.map do |pokemon_data|\n pokemon_data[:name]\n end\nend",
"def list_of_names\n World.politicians.map { |p| p.name } + World.voters.map { |p| p.name}\nend",
"def get_name(pokemon)\n pokemon['species']['name']\nend",
"def list_pokemon_stats\n puts(\"Name: {#name}\")\n ... | [
"0.8352148",
"0.6975621",
"0.6961352",
"0.6800399",
"0.67062896",
"0.6685342",
"0.6606104",
"0.65480524",
"0.652607",
"0.65034187",
"0.63971573",
"0.63942194",
"0.6387897",
"0.6387897",
"0.6387897",
"0.6387897",
"0.6387897",
"0.6387897",
"0.6387897",
"0.63625735",
"0.6362492"... | 0.82182777 | 1 |
Update institution by id Handling errors from not finding the id and wrong data | def update
institution = Institution.find(params[:id])
if institution.update(institution_params)
render json: { status: '200', message: "Updated Institution with id #{params[:id]}", data: institution }, status: :ok
else
render json: { status: '422', error: 'Institution not up... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_institution\n @institution = current_user.institutions.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n render json: { errors: [I18n.t('api.institution.not_found')] }, status: :not_found\n end",
"def update\n @institution = Institution.find(params[:id])\n\n respond_to do |f... | [
"0.717103",
"0.7150022",
"0.71217936",
"0.70621365",
"0.70548487",
"0.6986477",
"0.69753784",
"0.6964017",
"0.6932576",
"0.6932301",
"0.6890543",
"0.6877638",
"0.6799948",
"0.6799948",
"0.6799948",
"0.6799948",
"0.6790408",
"0.67805046",
"0.6764449",
"0.66290385",
"0.6588837"... | 0.75500005 | 0 |
Removes the specified class. Examples: const_get 'String' String const_get ['ActiveRecord', 'Base'] ActiveRecord::Base | def const_remove(klass)
klass = [klass] unless klass.kind_of? Array
if klass.length > 1
Utility.const_get(klass[0..-2]).send :remove_const, klass.last
elsif klass.any?
Object.send :remove_const, klass.last
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy_class ( klass )\n klass = klass.name.to_s if klass.kind_of? Class\n Object.class_exec { remove_const klass } if Object.const_defined? klass\nend",
"def destroy_class ( klass )\n klass = klass.name.to_s if klass.kind_of? Class\n Object.class_exec { remove_const klass } if Object.const_defined? kla... | [
"0.7097662",
"0.7097662",
"0.6871307",
"0.6773116",
"0.6773116",
"0.66102207",
"0.6467323",
"0.6315427",
"0.62628007",
"0.6225008",
"0.6170541",
"0.61001974",
"0.6087947",
"0.6046526",
"0.6029146",
"0.60193866",
"0.5984087",
"0.5979203",
"0.59605956",
"0.59605956",
"0.5959502... | 0.72459763 | 0 |
Public: Iterates through contours and yields them. | def with_each_contour
contours.each do |contour|
# Generate a MASK based on the current contour, and erode it so
# that we can get rid of some of the shadow around the piece.
# The whole map is black and the piece is white.
yield contour, grab_color_from_contour(contour)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contour( *args )\n return bezier.contour\n end",
"def get_contour_points_adv()\r\n result = []\r\n idx = 0\r\n result[idx] = Offset.vertices(@active_face.outer_loop.vertices, -(@bit_diameter * 0.5)).offsetPoints\r\n# puts \" outer #{result[idx].length} #{result[idx]} \"\r\n @active_face.loop... | [
"0.60089713",
"0.5678124",
"0.559642",
"0.549338",
"0.52676505",
"0.5193994",
"0.5161028",
"0.5131451",
"0.50493115",
"0.5042759",
"0.50266737",
"0.4899071",
"0.48570544",
"0.48410073",
"0.4837293",
"0.48018655",
"0.4788069",
"0.47867218",
"0.47665426",
"0.47369778",
"0.47241... | 0.7435681 | 0 |
GET /nature_financings GET /nature_financings.json | def index
@nature_financings = NatureFinancing.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_nature_financing\n begin\n @nature_financing = current_institute.nature_financings.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n redirect_to nature_financings_path\n end\n end",
"def index\n @filials = Filial.all\n\n respond_to do |format|\n form... | [
"0.66428757",
"0.62522465",
"0.6037751",
"0.6009311",
"0.5964351",
"0.5962566",
"0.59222186",
"0.5899061",
"0.58915544",
"0.58852136",
"0.58818626",
"0.58692473",
"0.58586335",
"0.584415",
"0.58214456",
"0.5809563",
"0.5794413",
"0.578763",
"0.578101",
"0.5777905",
"0.5756194... | 0.7403564 | 0 |
POST /nature_financings POST /nature_financings.json | def create
@nature_financing = NatureFinancing.new(nature_financing_params)
@nature_financing.institute = current_institute
respond_to do |format|
if @nature_financing.save
format.html { redirect_to @nature_financing, notice: 'Nature financing was successfully created.' }
format.json ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nature_financing_params\n params.require(:nature_financing).permit(:title, :description, :institute_id)\n end",
"def set_nature_financing\n begin\n @nature_financing = current_institute.nature_financings.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n redirect_to... | [
"0.6604814",
"0.6420883",
"0.638493",
"0.6008372",
"0.59575504",
"0.592031",
"0.5761156",
"0.57413477",
"0.56809795",
"0.56630325",
"0.563797",
"0.5607012",
"0.5606789",
"0.56050414",
"0.5593278",
"0.5548935",
"0.55449504",
"0.55356085",
"0.55339384",
"0.55339384",
"0.5530416... | 0.6804349 | 0 |
PATCH/PUT /nature_financings/1 PATCH/PUT /nature_financings/1.json | def update
respond_to do |format|
if @nature_financing.update(nature_financing_params)
format.html { redirect_to @nature_financing, notice: 'Nature financing was successfully updated.' }
format.json { render :show, status: :ok, location: @nature_financing }
else
format.html { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n ... | [
"0.68497854",
"0.6820507",
"0.61943775",
"0.61264604",
"0.6111212",
"0.6064038",
"0.60610753",
"0.60450727",
"0.60300046",
"0.60036325",
"0.5999813",
"0.5993303",
"0.5987237",
"0.5986764",
"0.5986676",
"0.59830415",
"0.59792536",
"0.5975104",
"0.5968804",
"0.59637606",
"0.596... | 0.7074337 | 0 |
DELETE /nature_financings/1 DELETE /nature_financings/1.json | def destroy
@nature_financing.destroy
respond_to do |format|
format.html { redirect_to nature_financings_url, notice: 'Nature financing was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end",
"def destroy\n @socio_doc_fiscais_coring.destroy\n respond_to do |format|\n format.html { redirect_to socio_doc_fiscais_corings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foiltype = ... | [
"0.6873725",
"0.6706721",
"0.67030793",
"0.6683761",
"0.6608549",
"0.65908784",
"0.65865266",
"0.6575249",
"0.65596765",
"0.6547893",
"0.6520962",
"0.65199906",
"0.6508244",
"0.6507091",
"0.6505291",
"0.6505291",
"0.65048474",
"0.6492816",
"0.6486912",
"0.64862823",
"0.648151... | 0.7301639 | 0 |
GET /inventory_snapshot_contents GET /inventory_snapshot_contents.json | def index
@inventory_snapshot_contents = InventorySnapshotContent.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snapshot\n begin\n response = resource[\"/snapshot/#{app}\"].post(nil)\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end",
"def set_inventory_snapshot_content\n @inventory_snapshot_content = InventorySnapshotContent.f... | [
"0.68496674",
"0.6571057",
"0.65362597",
"0.6531449",
"0.6490074",
"0.6254804",
"0.6193462",
"0.61878216",
"0.61849135",
"0.60949624",
"0.6060234",
"0.60109794",
"0.6005607",
"0.60007113",
"0.59459823",
"0.5931839",
"0.58714306",
"0.5845803",
"0.58300704",
"0.5812881",
"0.578... | 0.76583564 | 0 |
POST /inventory_snapshot_contents POST /inventory_snapshot_contents.json | def create
@inventory_snapshot_content = InventorySnapshotContent.new(inventory_snapshot_content_params)
respond_to do |format|
if @inventory_snapshot_content.save
format.html { redirect_to @inventory_snapshot_content, notice: 'Inventory snapshot content was successfully created.' }
form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @inventory_snapshot_contents = InventorySnapshotContent.all\n end",
"def set_inventory_snapshot_content\n @inventory_snapshot_content = InventorySnapshotContent.find(params[:id])\n end",
"def inventory_snapshot_content_params\n params.require(:inventory_snapshot_content).permit(:in... | [
"0.7063605",
"0.6874044",
"0.65961987",
"0.65095544",
"0.623067",
"0.6076004",
"0.5891567",
"0.5864759",
"0.58224505",
"0.57561773",
"0.5733231",
"0.5695487",
"0.5695487",
"0.5670691",
"0.5603551",
"0.5540606",
"0.549805",
"0.5497956",
"0.5493898",
"0.54928637",
"0.54853433",... | 0.69451535 | 1 |
PATCH/PUT /inventory_snapshot_contents/1 PATCH/PUT /inventory_snapshot_contents/1.json | def update
respond_to do |format|
if @inventory_snapshot_content.update(inventory_snapshot_content_params)
format.html { redirect_to @inventory_snapshot_content, notice: 'Inventory snapshot content was successfully updated.' }
format.json { render :show, status: :ok, location: @inventory_snaps... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_inventory_snapshot_content\n @inventory_snapshot_content = InventorySnapshotContent.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @snapshot.update_attributes(params[:snapshot])\n flash[:notice] = 'Snapshot was successfully updated.'\n format.html { redi... | [
"0.63918066",
"0.6122518",
"0.61052436",
"0.60411817",
"0.5987605",
"0.59689766",
"0.5941832",
"0.5919314",
"0.59164494",
"0.5915763",
"0.58930266",
"0.5860993",
"0.5847519",
"0.5847519",
"0.5847519",
"0.58218503",
"0.58218503",
"0.58209634",
"0.581484",
"0.5792977",
"0.57495... | 0.72562665 | 0 |
DELETE /inventory_snapshot_contents/1 DELETE /inventory_snapshot_contents/1.json | def destroy
@inventory_snapshot_content.destroy
respond_to do |format|
format.html { redirect_to inventory_snapshot_contents_url, notice: 'Inventory snapshot content was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_snapshot(snapshot_id)\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @snapshot.destroy\n\n respond_to do |format|\n format.html { redirect_to(snapshots_url) }\n format.xml { head :ok }\n end\n end... | [
"0.71034294",
"0.6989312",
"0.698219",
"0.6873329",
"0.6862213",
"0.67356247",
"0.67318803",
"0.67318803",
"0.66691077",
"0.66383034",
"0.6449294",
"0.64359504",
"0.64261997",
"0.6413788",
"0.6397142",
"0.63857067",
"0.63417417",
"0.63295454",
"0.632338",
"0.6293428",
"0.6273... | 0.74888015 | 0 |
Take a file, get all the lines until matching termination_pattern. We are searching for // in particular, which are the termination characters for the cds. TODO: make the method general for any String object, and not for file objects. | def get_sequence(file, termination_pattern, keep_last = nil)
assert(file.class == File, "#{file} is not a valid File object.")
assert(termination_pattern.class == Regexp, "#{termination_pattern} is not a valid Regexp object.")
out = ""
line = file.gets
# Continue reading file lines until file ends or
# lin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFileLineEndings(file)\n File.open(file, 'rb') do |f|\n return f.readline[/\\r?\\n$/]\n end\nend",
"def getFileLineEndings(file)\n File.open(file, 'rb') do |f|\n return f.readline[/\\r?\\n$/]\n end\nend",
"def get_lines raw_file\n lines = raw_file.split(\"\\n\").compact\n lines = lines.un... | [
"0.6186355",
"0.6186355",
"0.5688657",
"0.5572266",
"0.5494056",
"0.54769635",
"0.5469907",
"0.54392624",
"0.5434705",
"0.53960973",
"0.53926474",
"0.53635836",
"0.5352465",
"0.53516716",
"0.5276789",
"0.52446127",
"0.5197745",
"0.51373065",
"0.51366985",
"0.5135233",
"0.5125... | 0.6285695 | 0 |
group sequence in 80 characters lines long the 80th character is '\n' TODO: try to pass sequence by reference (think 'yeld' statement is involved) | def group_sequence (sequence, length)
temp_sequence = ""
index = 0; cont = 0
while sequence[index] != nil do
temp_sequence += sequence[index]
index += 1
if cont < length - 1
cont += 1
else
temp_sequence += "\n"
cont = 0
end
end
temp_sequence
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def string2seq seq\n numN = (seq.length-1) / 60\n for i in 1..numN\n index = i*61 - 1\n seq.insert(index,\"\\n\")\n end\n return seq \nend",
"def sequence_lined(char_per_line)\n counter = char_per_line\n sequence_lined = \"\"\n sequence.each_char { |ch|\n sequence_lined.concat(ch)\n ... | [
"0.70442134",
"0.6604634",
"0.6344033",
"0.6255229",
"0.6180489",
"0.60526514",
"0.5995365",
"0.59914327",
"0.5963045",
"0.5961926",
"0.59178966",
"0.58994865",
"0.5895896",
"0.58919954",
"0.5863008",
"0.58487666",
"0.58373606",
"0.58156574",
"0.580436",
"0.57835954",
"0.5719... | 0.75298303 | 0 |
Send the user an email saying the bulk observation import encountered an error. | def bulk_observation_error( user, filename, error_details )
@user = user
@message = error_details[:reason]
@errors = error_details[:errors]
@field_options = error_details[:field_options]
mail_with_defaults(
to: "#{user.name} <#{user.email}>",
subject: [
:were_sorry_b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def startup_import_failed(user)\n @user = user\n mail(:to => user.email, :subject => _('Startup import failed on %s.') % [\n Doers::Config.app_name])\n end",
"def bulk_observation_success( user, filename )\n @user = user\n @filename = filename\n mail_with_defaults(\n to: \"#{user.name} ... | [
"0.7121073",
"0.7028098",
"0.688409",
"0.672163",
"0.66173947",
"0.64790744",
"0.64095193",
"0.6355795",
"0.63334626",
"0.6326061",
"0.62635976",
"0.62318677",
"0.6212769",
"0.6197572",
"0.61504775",
"0.6117635",
"0.61053604",
"0.6094399",
"0.6081655",
"0.6038021",
"0.6022153... | 0.8026312 | 0 |
Send the user an email saying the bulk observation import was successful. | def bulk_observation_success( user, filename )
@user = user
@filename = filename
mail_with_defaults(
to: "#{user.name} <#{user.email}>",
subject: [
:bulk_import_of_filename_is_complete,
{ filename: filename }
]
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def importing_update( email_list )\n @failed_registrations = FailedRegistration.all \n # email_list.each do | email | \n mail( :to => email_list, \n :subject => \"potoSchool | Tarumanegara Failed Registration #{Time.now}\" )\n # end\n end",
"def bulk_observation_error( user, filename, error_... | [
"0.6828059",
"0.6817229",
"0.65598416",
"0.6248235",
"0.613114",
"0.60800695",
"0.59730613",
"0.59607154",
"0.5936173",
"0.59326285",
"0.58989424",
"0.5888067",
"0.58783627",
"0.58548117",
"0.5841181",
"0.58194315",
"0.581422",
"0.58033085",
"0.5798732",
"0.57891613",
"0.5767... | 0.8169935 | 0 |
Returns name; converts broadcast label to shared to be consistent with google | def name
@name == 'broadcast' ? 'shared' : @name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalized_name\n @normalized_name ||= if self.name.start_with?(ClientConstants::GLOBAL_PLAYLIST_PREFIX)\n self.name[2..-1]\n else\n self.name\n end\n end",
"def human_name\n \"reverse UDP\"\n end",
"def label_name(product)\n return product.label_override unless product.label_o... | [
"0.5969148",
"0.59362423",
"0.59199756",
"0.57583636",
"0.5734359",
"0.5624824",
"0.5557625",
"0.5550942",
"0.55457973",
"0.55219597",
"0.55169463",
"0.55048835",
"0.5504671",
"0.54974896",
"0.54896873",
"0.54806745",
"0.5469429",
"0.54642653",
"0.5458646",
"0.54083604",
"0.5... | 0.7227313 | 0 |
Usage: Google::Reader::Label.new('friends').entries Google::Reader::Label.new('friends').entries(:all, :n => 25) Google::Reader::Label.new('friends').entries(:unread) Google::Reader::Label.new('friends').entries(:unread, :n => 25) To use with continuations: unread = Google::Reader::Label.new('friends').entries(:unread)... | def entries(which=nil, o={})
options = {:n => 15,}.merge(o)
query_str = valid_keys_to_query_string(o)
url = case which.to_s
when 'unread'
sprintf(LABEL_URL, @name) + "?xt=#{State::READ}&#{query_str}"
else
sprintf(LABEL_URL, @name)
end
self.clas... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_entries(limit = nil)\n limit ||= -1\n prepare_entries(LiveJournal::Request::GetFriendsPage.new(@user, :recent => limit, :strict => false).run)\n rescue exception_block\n end",
"def get_next_entry; end",
"def initial_unread_entries\n update unread_entries: feed.entries.count\n end",
... | [
"0.54353607",
"0.53896016",
"0.5341011",
"0.5337799",
"0.5326041",
"0.51987106",
"0.5083683",
"0.5060455",
"0.5052474",
"0.5021779",
"0.5020245",
"0.49735343",
"0.4968922",
"0.4966228",
"0.49256212",
"0.49205467",
"0.49009368",
"0.48384634",
"0.48378083",
"0.4820481",
"0.4819... | 0.6037697 | 0 |
GET /multi_boards/1 GET /multi_boards/1.json | def show
@multi_board = MultiBoard.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @multi_board }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n\n respond_to do |format|\n format.html { @boards = Board.where network_id: current_user.network_id }\n format.json { @boards = Board.where network_id: current_user.network_id }\n \n end\n end",
"def index\n @boards = Board.all\n\n respond_to do |format|\n format.html ... | [
"0.717086",
"0.71656495",
"0.71656495",
"0.7125509",
"0.70815754",
"0.6953657",
"0.68549836",
"0.67742854",
"0.6758978",
"0.6758978",
"0.6758978",
"0.6758978",
"0.6758978",
"0.6758978",
"0.6758978",
"0.67567176",
"0.67567176",
"0.6660346",
"0.6653679",
"0.66397345",
"0.662427... | 0.77802366 | 0 |
GET /multi_boards/new GET /multi_boards/new.json | def new
@multi_board = MultiBoard.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @multi_board }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @multi_board = MultiBoard.new(params[:multi_board])\n\n respond_to do |format|\n if @multi_board.save\n format.html { redirect_to @multi_board, notice: 'Multi board was successfully created.' }\n format.json { render json: @multi_board, status: :created, location: @multi_board... | [
"0.765537",
"0.73813117",
"0.7373626",
"0.7373626",
"0.7373626",
"0.7358786",
"0.73242414",
"0.72853667",
"0.71558535",
"0.68685913",
"0.67852145",
"0.67022324",
"0.66908336",
"0.6659409",
"0.6654111",
"0.662626",
"0.6616006",
"0.6602182",
"0.6602182",
"0.65454155",
"0.652276... | 0.8042196 | 0 |
POST /multi_boards POST /multi_boards.json | def create
@multi_board = MultiBoard.new(params[:multi_board])
respond_to do |format|
if @multi_board.save
format.html { redirect_to @multi_board, notice: 'Multi board was successfully created.' }
format.json { render json: @multi_board, status: :created, location: @multi_board }
el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @multi_board = MultiBoard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @multi_board }\n end\n end",
"def create\n # render json: params\n render json: UserBoards.create(params[\"user_board\"])\n end",
"def create\n\n #figure ou... | [
"0.65558285",
"0.6052207",
"0.6017639",
"0.5955247",
"0.5944999",
"0.589071",
"0.5879683",
"0.58716166",
"0.5822776",
"0.58199686",
"0.58197665",
"0.5805861",
"0.5805861",
"0.5792975",
"0.5789303",
"0.5780078",
"0.5767066",
"0.57580215",
"0.5733862",
"0.57283384",
"0.5728132"... | 0.72645885 | 0 |
PUT /multi_boards/1 PUT /multi_boards/1.json | def update
@multi_board = MultiBoard.find(params[:id])
respond_to do |format|
if @multi_board.update_attributes(params[:multi_board])
format.html { redirect_to @multi_board, notice: 'Multi board was successfully updated.' }
format.json { head :no_content }
else
format.html {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @user = User.find(params[:user_id])\n @board = @user.boards.find(params[:id])\n @board.update_column(:content, params[:board].as_json)\n respond_to do |format|\n format.json { render json: @board }\n end\n end",
"def update\n render json: UserBoards.update(params[\"id\"], par... | [
"0.63786983",
"0.6290787",
"0.6277463",
"0.61961484",
"0.61092675",
"0.6101314",
"0.609912",
"0.60944223",
"0.60743004",
"0.60743004",
"0.607125",
"0.5998887",
"0.5965327",
"0.5960679",
"0.59169346",
"0.5907754",
"0.5899616",
"0.5879339",
"0.587101",
"0.5866627",
"0.5866627",... | 0.738697 | 0 |
DELETE /multi_boards/1 DELETE /multi_boards/1.json | def destroy
@multi_board = MultiBoard.find(params[:id])
@multi_board.destroy
respond_to do |format|
format.html { redirect_to multi_boards_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @board = Board.find(params[:id])\n @board.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_boards_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: UserBoards.delete(params[\"id\"])\n end",
"def destroy\n @board.des... | [
"0.7401453",
"0.73394424",
"0.7290816",
"0.7290816",
"0.7290816",
"0.72545016",
"0.72545016",
"0.7245085",
"0.721105",
"0.71041125",
"0.7101037",
"0.7099692",
"0.70849425",
"0.70300865",
"0.70039123",
"0.69742435",
"0.69690216",
"0.69690216",
"0.69690216",
"0.69690216",
"0.69... | 0.8229748 | 0 |
Retrieve the client vpn config for current user Returns the client vpn config for the currently loggedin user. | def find_current_user_vpn_config(code, opts = {})
data, _status_code, _headers = find_current_user_vpn_config_with_http_info(code, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def selected_config\n config[client_name]\n end",
"def vpn_configuration_id\n return @vpn_configuration_id\n end",
"def client_id\n ENV['VIPPS_CLIENT_ID']\n end",
"def get_current_user_options\n response = get_current_user_meta('options')\n ... | [
"0.6358495",
"0.573225",
"0.5680149",
"0.5658015",
"0.5591358",
"0.5542105",
"0.5481544",
"0.54781246",
"0.5419859",
"0.53983325",
"0.5335912",
"0.53180736",
"0.53159946",
"0.528733",
"0.52699834",
"0.52698797",
"0.5264542",
"0.5219623",
"0.520557",
"0.5197233",
"0.5182343",
... | 0.65783453 | 0 |
Turn off vpn for the current user Turns off vpn for the currently loggedin user. | def turn_off_current_user_vpn(opts = {})
turn_off_current_user_vpn_with_http_info(opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_off_current_user_vpn_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VPNApi.turn_off_current_user_vpn ...'\n end\n # resource path\n local_var_path = '/user/vpn'\n\n # query parameters\n query_params = opts[:q... | [
"0.6947038",
"0.6082682",
"0.599128",
"0.5936998",
"0.5935822",
"0.59238344",
"0.5907025",
"0.58545583",
"0.584242",
"0.5832911",
"0.5825407",
"0.57688993",
"0.5741067",
"0.57284874",
"0.57183874",
"0.57183874",
"0.5712141",
"0.5710035",
"0.568161",
"0.565093",
"0.56494325",
... | 0.80374235 | 0 |
Turn off vpn for the current user Turns off vpn for the currently loggedin user. | def turn_off_current_user_vpn_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: VPNApi.turn_off_current_user_vpn ...'
end
# resource path
local_var_path = '/user/vpn'
# query parameters
query_params = opts[:query_params] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_off_current_user_vpn(opts = {})\n turn_off_current_user_vpn_with_http_info(opts)\n nil\n end",
"def deactivate!(user)\n return false unless self.active?\n\n @user = user\n\n remove_hook!\n\n self.active = false\n self.save!\n end",
"def deactivate_user(user_id)\n post... | [
"0.80374235",
"0.6082682",
"0.599128",
"0.5936998",
"0.5935822",
"0.59238344",
"0.5907025",
"0.58545583",
"0.584242",
"0.5832911",
"0.5825407",
"0.57688993",
"0.5741067",
"0.57284874",
"0.57183874",
"0.57183874",
"0.5712141",
"0.5710035",
"0.568161",
"0.565093",
"0.56494325",... | 0.6947038 | 1 |
Turn on vpn for the current user Turns on vpn for the currently loggedin user. | def turn_on_current_user_vpn(opts = {})
turn_on_current_user_vpn_with_http_info(opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vip_user\n redirect_to(root_url) unless current_user.vip?\n end",
"def turn_on_current_user_vpn_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VPNApi.turn_on_current_user_vpn ...'\n end\n # resource path\n local_v... | [
"0.6372449",
"0.593669",
"0.573794",
"0.55957085",
"0.55560887",
"0.55357134",
"0.55208737",
"0.55129844",
"0.5454473",
"0.54213685",
"0.5414204",
"0.5395543",
"0.538463",
"0.5373731",
"0.53193337",
"0.53193337",
"0.53193337",
"0.5308838",
"0.52956516",
"0.5282667",
"0.525830... | 0.71412027 | 0 |
Define breakfast, lunch and dinner methods that return the meal choice passed into them. If nothing is passed in, it shoud default to the foods on the readme (frosted flake, grilled cheese, salmon) | def meal(breakfast = "frosted flakes", lunch = "grilled cheese", dinner = "salmon")
puts "Morning is the best time for #{breakfast}!"
puts "Noon is the best time for #{lunch}!"
puts "Evening is the best time for #{dinner}!"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def meal_choice( food = \"meat\") \n return food\nend",
"def meal_choice(food_type = \"meat\")\n food_type\nend",
"def meal_choice(choice = \"meat\")\n return choice\nend",
"def meal_choice(choice = \"meat\")\n return choice #meal choice that was passed into it \nend",
"def meal_choice(vegan = \"meat... | [
"0.7704664",
"0.74114716",
"0.73323464",
"0.7279166",
"0.7224172",
"0.71477914",
"0.707415",
"0.7061001",
"0.70384383",
"0.7017799",
"0.7001092",
"0.69718695",
"0.6878549",
"0.68420815",
"0.6826327",
"0.680343",
"0.6801603",
"0.67776394",
"0.6737181",
"0.6737181",
"0.6737181"... | 0.7449021 | 1 |
=begin dada una palabra clave(llave) construlle una tabla tipo vigenere polialfabetica. =end | def crea_tabla(llave)
renglon = Array.new
tam = llave.length
tam.times do |i|
tmp = "" << llave[i]
if ALFABETO.include? tmp
renglon.push(tmp)
ALFABETO.delete! tmp
end
end
ALFABETO.chars{|c| renglon.push(c)}
tabla = Array.new
tabla.push(renglon.to_s)
for i in (1...26)
aux = re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def publicaEnPantalla(tabla,resultados)\n\t\tentrada=0\n\t\ti=0\n\t\trenglonesDeResultado=[]\n\t\twhile resultados.length > entrada\n\t\t\tif (resultados[entrada].to_s==tabla.getItemText(i,4).to_s)\n\t\t\t\tentrada=1+entrada\n\t\t\t\trenglonesDeResultado.push(i)\n\t\t\t\ti=0\n\t\t\telse\n\t\t\t\ti=1+i\n\t\t\tend\... | [
"0.61291707",
"0.5964928",
"0.58517224",
"0.569821",
"0.559974",
"0.55498147",
"0.55345196",
"0.55345196",
"0.55345196",
"0.55345196",
"0.54677457",
"0.54645467",
"0.5439441",
"0.5423002",
"0.540165",
"0.53390056",
"0.5324846",
"0.531647",
"0.52941746",
"0.52847576",
"0.52779... | 0.6340806 | 0 |
Helper method to generate the proper url for Mailgun unsubscribe API calls | def unsubscribe_url(address=nil)
"#{@mailgun.base_url}/#{@domain}/unsubscribes#{'/' + address if address}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unsubscribe_url\n nil\n end",
"def unsubscribe_url(id:, email:)\n token =\n Base64.encode64(\"#{id}:#{email}\")\n\n \"#{connection.url_prefix}unsubscribe?token=#{token}\"\n end",
"def unsubscribe(uuid)\n post_json(\"#{endpoint}/unsubscribe/#{uri_encode(uuid)}\")\n en... | [
"0.7956396",
"0.7790017",
"0.66825646",
"0.66825646",
"0.6421595",
"0.64120543",
"0.6399402",
"0.62976885",
"0.6285101",
"0.62684",
"0.62666005",
"0.6224547",
"0.61930853",
"0.61874294",
"0.61724144",
"0.6149331",
"0.61451983",
"0.61103004",
"0.6095919",
"0.6062818",
"0.60594... | 0.82254606 | 0 |
Given a nested list of integers, return the sum of all integers in the list weighted by their depth. Each element is either an integer, or a list whose elements may also be integers or other lists. Example 1: Given the list [[1,1],2,[1,1]], return 10. (four 1's at depth 2, one 2 at depth 1) | def sum_depth ( x, weight = 1 )
sum = 0
x = [ x ] if x.is_a? Integer
x.each do | n |
if n.is_a? Array
sum += sum_depth( n, weight + 1 )
else
sum += n * weight
end
end
return sum
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum_nested_collection\n nested_numbers = [[1,2,3], [5,6,7,5], [9,10,13,6], [1]]\nend",
"def list_depth(list, depth = 0)\n return depth if !list.is_a?(Array)\n list.empty? ? depth + 1 : list.map { |l| list_depth(l, depth + 1) }.max\n end",
"def two_d_sum(arr)\n\ttotal = 0\n\n\t# 1st Leve... | [
"0.7259541",
"0.6403564",
"0.6190413",
"0.61393106",
"0.61237186",
"0.6052727",
"0.60513127",
"0.6027382",
"0.59915495",
"0.5952943",
"0.5952943",
"0.584366",
"0.58356076",
"0.5814014",
"0.5787257",
"0.57775086",
"0.5742661",
"0.5713105",
"0.57107484",
"0.57060844",
"0.569219... | 0.8158782 | 0 |
Checks if the user is the author of a reply | def reply_author(reply)
logged_in? && current_user.id == reply.user_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reply_author(reply)\n user_signed_in? && current_user.id == reply.user_id\n end",
"def answered_by?(user)\n replies.exists?(:user_id => user)\n end",
"def author?(user)\n user && author.id == user.id\n end",
"def author?(user)\n self.user == user\n end",
"def is_author?\n Response.jo... | [
"0.84007716",
"0.75702244",
"0.7307788",
"0.7227496",
"0.71521413",
"0.7040628",
"0.6997446",
"0.6984886",
"0.6984886",
"0.6929768",
"0.6856324",
"0.6832867",
"0.6771362",
"0.67612094",
"0.674855",
"0.67419815",
"0.66817474",
"0.6679152",
"0.66348916",
"0.66151196",
"0.661090... | 0.8284275 | 1 |
POST /tipo_venta POST /tipo_venta.json | def create
@tipo_ventum = TipoVentum.new(tipo_ventum_params)
respond_to do |format|
if @tipo_ventum.save
format.html { redirect_to @tipo_ventum, notice: 'Tipo ventum was successfully created.' }
format.json { render :show, status: :created, location: @tipo_ventum }
else
form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @servico_evento = Servico::Evento.new(servico_evento_params)\n\n respond_to do |format|\n if @servico_evento.save\n format.html { redirect_to @servico_evento, notice: 'Evento was successfully created.' }\n format.json { render action: 'show', status: :created, location: @servi... | [
"0.6867",
"0.6817968",
"0.68127877",
"0.67253333",
"0.66842735",
"0.66657007",
"0.6665518",
"0.6631251",
"0.6573862",
"0.65716714",
"0.65370315",
"0.65320987",
"0.6525978",
"0.65173113",
"0.64755213",
"0.6468274",
"0.64443547",
"0.6443177",
"0.64382386",
"0.64375365",
"0.6435... | 0.6920562 | 0 |
DELETE /tipo_venta/1 DELETE /tipo_venta/1.json | def destroy
@tipo_ventum.destroy
respond_to do |format|
format.html { redirect_to tipo_venta_url, notice: 'Tipo ventum was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @venta = Venta.find(params[:id])\n @venta.destroy\n\n respond_to do |format|\n format.html { redirect_to ventas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipoapreensao.destroy\n respond_to do |format|\n format.html { redirect_to tipoapr... | [
"0.73050547",
"0.7288937",
"0.72860026",
"0.7260907",
"0.72545373",
"0.72513586",
"0.72424674",
"0.7212556",
"0.72034216",
"0.7199657",
"0.7173166",
"0.715502",
"0.7154095",
"0.71462303",
"0.71372104",
"0.71292514",
"0.712569",
"0.712216",
"0.7115263",
"0.71151876",
"0.710945... | 0.7411644 | 0 |
Checks if other period is inside this period. This means that both starts_at and ends_at of other period have to be included in this period. | def include?(other_period)
inside?(other_period.starts_at) && inside?(other_period.ends_at)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cover?(other_period)\n inside?(other_period.starts_at) || inside?(other_period.ends_at)\n end",
"def overlaps?(other)\n start <= other.end_date && other.start <= self.end_date\n end",
"def overlaps?(other)\n\t\tself.start_date < other.end_date && other.start_date < self.end_date\n\tend",
"def ove... | [
"0.84127146",
"0.79092336",
"0.775272",
"0.7748917",
"0.7659067",
"0.7430443",
"0.70193183",
"0.69477475",
"0.6879989",
"0.68794787",
"0.68765366",
"0.68664837",
"0.68364984",
"0.6810467",
"0.68038625",
"0.6779065",
"0.6754526",
"0.6729548",
"0.6729548",
"0.6723803",
"0.67060... | 0.8659968 | 0 |
We can't serialize the explainer, so clear it before we transmit | def prepare_to_send
statement.explainer = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset\n\t\tself.raw = ''\n\t\tself.hdr_length_left = 8\n\t\tself.payload_length_left = 0\n\tend",
"def clear_body; end",
"def clear\n @raw.clear\n self\n end",
"def reset\n @id = nil\n @strands = []\n @suggested_topic = nil\n end",
"def clear() end",
"def clear() end",
... | [
"0.5777639",
"0.5725918",
"0.5681908",
"0.56193465",
"0.54777956",
"0.54777956",
"0.5457249",
"0.5455802",
"0.5455802",
"0.5455802",
"0.5455802",
"0.5455802",
"0.5455802",
"0.5455802",
"0.54160935",
"0.5398351",
"0.53931236",
"0.537337",
"0.5359569",
"0.53531617",
"0.53531617... | 0.6434746 | 0 |
`Paginatedlast_page(count)` Compute the maximum page number which could be meaningfully displayed. | def last_page(count)
(count / PER_PAGE.to_f).ceil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_page_number\n number_of_pages\n end",
"def bound_last(last, count)\n if last > last_page(count) then last_page(count) else last end\n end",
"def last_page\n (max_matches.to_f / per_page).ceil\n end",
"def max_page(per_page = 10)\n count_hint / per_page + (count_hin... | [
"0.77618897",
"0.7652974",
"0.7541254",
"0.7479644",
"0.74753183",
"0.7469814",
"0.73419493",
"0.73419493",
"0.7279868",
"0.7231671",
"0.71892387",
"0.7136886",
"0.7101307",
"0.7081131",
"0.7075225",
"0.6987154",
"0.6924625",
"0.6673539",
"0.6664465",
"0.6664465",
"0.66098636... | 0.8702603 | 0 |
`Paginatedpage(req)` Retrieve the current page out of the `req` instance. | def page(req)
req.params.fetch('page', default='1').to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page\n @request.params[:page] ? @request.params[:page].to_i : 1\n end",
"def page\n @page ||= params[:page] || 1\n end",
"def current_page\n unless @page\n @page = params[:page].to_i\n @page = 1 unless @page\n @page = 1 if @page < 1\n end\n return @page\n end",
"def c... | [
"0.7167881",
"0.7017142",
"0.6912711",
"0.6870681",
"0.68435025",
"0.6779926",
"0.67683566",
"0.67608017",
"0.66719925",
"0.6671466",
"0.6610503",
"0.6595616",
"0.65521616",
"0.65460056",
"0.6499224",
"0.6487493",
"0.6485147",
"0.64834034",
"0.648218",
"0.64777994",
"0.64458"... | 0.79003173 | 0 |
`Paginatedpage_nums(req, count)` Compute the range of page numbers to display based on the current `req` and the total `count` of items contained in the paginated collection. | def page_nums(req, count)
first = page(req) - SPREAD
last = bound_first(first) + (SPREAD * 2)
first = bound_last(last, count) - (SPREAD * 2) if bound_last(last, count) == last_page(count)
bound_first(first)..bound_last(last, count)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_count\n (unpaged_count.to_f / @entries_per_page).ceil\n end",
"def num_pages\n (count.to_f / options[:limit]).ceil\n end",
"def pages_count\n @pages_count ||= (items_count / @per_page.to_f).ceil\n end",
"def page_count\n if item_count % @items_per_page == 0\n ... | [
"0.68033",
"0.6742234",
"0.67151403",
"0.6706579",
"0.6575172",
"0.6540593",
"0.65268904",
"0.65163493",
"0.6479631",
"0.64606625",
"0.6439652",
"0.6423903",
"0.6397344",
"0.6397344",
"0.6354994",
"0.6351529",
"0.6339063",
"0.6337159",
"0.63135064",
"0.629884",
"0.6276227",
... | 0.8142675 | 0 |
`Paginatedbound_first(first)` Private method to calculate the first page based on the current value of `first` to display taking into account the lower display bound or minimum page number (1). | def bound_first(first)
if first < 1 then 1 else first end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_page\n return nil if total_pages < 1\n return 1\n end",
"def first_in_page\n ((current_page - 1) * per_page) + 1\n end",
"def first_page_number\n 1\n end",
"def first_page\n previous_page? ? updated_collection(from: from, page: { number: 1 }) : self\n ... | [
"0.7377282",
"0.7195114",
"0.6836876",
"0.66712075",
"0.6499926",
"0.6460395",
"0.63195884",
"0.62161016",
"0.6181618",
"0.6150422",
"0.6137931",
"0.6100401",
"0.59770656",
"0.597066",
"0.59535486",
"0.59534216",
"0.5894904",
"0.5894904",
"0.5894904",
"0.5894904",
"0.5867713"... | 0.7515672 | 0 |
`Paginatedbound_last(last, count)` Private method to calculate the last page number to display accounting for the maximum page number display bound represented by `last_page`. Returns a value less than or equal to `last_page` based on the current value of `last` and the total `count` of items in the collection. | def bound_last(last, count)
if last > last_page(count) then last_page(count) else last end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_page(count)\n (count / PER_PAGE.to_f).ceil\n end",
"def last_page\n @last_page ||= WillPaginate::ViewHelpers.total_pages_for_collection(@collection)\n end",
"def last_page\n @last_page ||= WillPaginate::ViewHelpers.total_pages_for_collection(@collection)\n end",
"def ... | [
"0.77432275",
"0.754022",
"0.754022",
"0.73383677",
"0.72729415",
"0.7152181",
"0.70715684",
"0.7006435",
"0.69542134",
"0.6946921",
"0.6859196",
"0.6797491",
"0.67929506",
"0.6724094",
"0.66747844",
"0.6551067",
"0.6513334",
"0.6513334",
"0.6503359",
"0.6484546",
"0.6471332"... | 0.84732765 | 0 |
Approve a particular Store in the database | def approve_store_app(uid)
Store.unlock.where(uid: uid)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def confirm\n begin\n accept = params[:accept].eql?('true')\n st = StoreTransaction.where(id: params[:request_id], store: current_user.stores.find(params[:store_id])).first\n if accept\n st.status = 1\n st.store.owner = st.requester\n st.store.save!\n else\n st.st... | [
"0.65584135",
"0.65475833",
"0.65280986",
"0.6248958",
"0.61926055",
"0.61558306",
"0.61183625",
"0.6085756",
"0.6069497",
"0.60578406",
"0.60577106",
"0.6045045",
"0.604113",
"0.60335875",
"0.60078955",
"0.59879804",
"0.59736264",
"0.5972359",
"0.5959627",
"0.59538823",
"0.5... | 0.6592211 | 0 |
Reject a particular Store in the database | def reject_store_app(uid)
Store.lock.where(uid: uid)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reject\n self[:status] = \"Reject\"\n save\n end",
"def reject_offer\n @auction = @current_user.auctions.find(params[:auction_id])\n @offer = @auction.offers.find(params[:offer_id])\n Alert.transaction do\n Alert.offer_to_reject_response!(@offer, @decision)\n if @decision\n ... | [
"0.62324977",
"0.6155242",
"0.59718937",
"0.5971266",
"0.595649",
"0.5921772",
"0.5840953",
"0.5774094",
"0.5736666",
"0.5736666",
"0.57346123",
"0.57309073",
"0.571686",
"0.571686",
"0.57054085",
"0.5700467",
"0.56686306",
"0.5590971",
"0.55640686",
"0.55594414",
"0.55526054... | 0.6388437 | 0 |
Edit a particular Store in the database | def edit_store(edited_store)
store = Store.find(edited_store.uid)
store.attributes = edited_store.attributes
store.save!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\t\t\t\t @store = Store.find(params[:id])\n\n\t\t\t\t respond_to do |format|\n\t\t\t\t if @store.update_attributes(params[:store])\n\t\t\t\t\tformat.html { redirect_to @store, notice: 'Store was successfully updated.' }\n\t\t\t\t\tformat.json { head :no_content }\n\t\t\t\t else\n\t\t\t\... | [
"0.7630424",
"0.7570387",
"0.753359",
"0.75034577",
"0.74710655",
"0.74640095",
"0.74640095",
"0.74640095",
"0.74640095",
"0.74589825",
"0.74499995",
"0.74494755",
"0.7435615",
"0.71426547",
"0.7111787",
"0.7111787",
"0.71071357",
"0.70999485",
"0.70999485",
"0.70999485",
"0.... | 0.83347523 | 0 |
Delete a particular Store in the database | def delete_store(uid)
store = Store.find(uid)
store.delete!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @store.destroy\n redirect_to store_path, notice: \"store destroyed.\"\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n if @store.destroyed?\n flash[:notice] = \"El almacen fue eliminado.\"\n redirect_to stores_path\n else\n flash[:warnin... | [
"0.787363",
"0.7869649",
"0.78203076",
"0.7595794",
"0.75738734",
"0.75329024",
"0.7502063",
"0.7495493",
"0.7469896",
"0.7456329",
"0.74345654",
"0.74345654",
"0.74345654",
"0.74345654",
"0.74328136",
"0.74072427",
"0.7378357",
"0.733771",
"0.7279009",
"0.7279009",
"0.727900... | 0.7872565 | 1 |
vai pegar os componentes e as quantidade de cada produto/componente | def iterando_nos_componente_enviados
quantidade = params[:produto_quantidade]
i = 1
for i in quantidade.to_i do
@componentesenviados << Produto.all(params[:exibeformcomponente_id])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum_produits_used\n sum = 0\n self.protofactures.each { |p| sum += p.prix_unit * (p.quantite - p.stock) }\n sum\n end",
"def sum_produits_assoc\n # TODO URGENT facture 46 la valeur renvoyee est fausse\n sum = 0\n # logger.error \"facture : #{self.id}\"\n self.protofactures.each do |p| \... | [
"0.6829691",
"0.65202075",
"0.63435733",
"0.63397264",
"0.6316852",
"0.6309619",
"0.6217147",
"0.61361855",
"0.6131325",
"0.6002625",
"0.60023963",
"0.59801996",
"0.59752125",
"0.597436",
"0.59686685",
"0.59464395",
"0.5934944",
"0.5916231",
"0.5909422",
"0.5890826",
"0.58889... | 0.7346988 | 0 |
GET /backend/conf_activities GET /backend/conf_activities.json | def index
@backend_conf_activities = Conf::Activity.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activities\n get_call(\"1/activities.json\")\n end",
"def activities(params = {})\n scope 'default'\n get('activities/', params)\n end",
"def activities(options={})\n response = connection.get do |req|\n req.url \"activities\", options\n end\n return_error_or_body... | [
"0.75542724",
"0.68641347",
"0.6809054",
"0.66842586",
"0.6663225",
"0.6663225",
"0.6567038",
"0.63987267",
"0.63709867",
"0.63617444",
"0.6338498",
"0.6294427",
"0.6257422",
"0.6244506",
"0.62327194",
"0.6232272",
"0.62228",
"0.6211288",
"0.6186235",
"0.6180784",
"0.61680305... | 0.79817796 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.