query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
GET /family_years GET /family_years.json | def index
@family_years = FamilyYear.all.includes(family: [:community]).order("communities.code ASC", "families.name ASC")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_team_years_participated ( team_key )\n get_api_resource \"#{@@api_base_url}team/#{team_key}/years_participated\"\n end",
"def uni_years\n @uni_years = UniYear.where(university_id: params[:university_id])\n \n respond_to do |format|\n format.json { render json: @uni_years }\n end\n end"... | [
"0.6833005",
"0.66414714",
"0.6628266",
"0.6559421",
"0.64723235",
"0.6391704",
"0.6384029",
"0.6362805",
"0.6243158",
"0.6195845",
"0.6155874",
"0.6155874",
"0.6136192",
"0.60688007",
"0.60654944",
"0.60566515",
"0.59732074",
"0.5971816",
"0.5971816",
"0.5971816",
"0.5963321... | 0.63060474 | 8 |
GET /family_years/1 GET /family_years/1.json | def show
@family = @family_year.family
@children = Child.joins(:family).where("families.id = ?", @family.id).order("children.code ASC")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uni_years\n @uni_years = UniYear.where(university_id: params[:university_id])\n \n respond_to do |format|\n format.json { render json: @uni_years }\n end\n end",
"def show\n @family_year = FamilyYear.where(school_year: @enrollment.school_year).where(family_id: @family.id).first\n\n\tend",
... | [
"0.679021",
"0.6696747",
"0.6626246",
"0.6564271",
"0.6364004",
"0.6322235",
"0.6225273",
"0.6194543",
"0.6194543",
"0.6193806",
"0.61402535",
"0.6138562",
"0.6069623",
"0.6063348",
"0.6033476",
"0.6004253",
"0.598569",
"0.5971555",
"0.59233683",
"0.59174055",
"0.5897581",
... | 0.0 | -1 |
POST /family_years POST /family_years.json | def create
@family_year = FamilyYear.new(family_year_params)
respond_to do |format|
if @family_year.save
format.html { redirect_to @family_year, notice: tr("family_year_created") }
else
format.html { render :new }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @fiscal_year = FiscalYear.new(fiscal_year_params)\n\n respond_to do |format|\n if @fiscal_year.save\n format.html { redirect_to @fiscal_year, notice: 'Fiscal year was successfully created.' }\n format.json { render :show, status: :created, location: @fiscal_year }\n else\... | [
"0.6438343",
"0.62902886",
"0.6277119",
"0.62587136",
"0.62587136",
"0.6258327",
"0.6238422",
"0.6130075",
"0.60942996",
"0.6091296",
"0.60606706",
"0.6060202",
"0.60494065",
"0.60237074",
"0.5958604",
"0.5944585",
"0.59040654",
"0.5886411",
"0.58839154",
"0.58768266",
"0.585... | 0.68905896 | 0 |
PATCH/PUT /family_years/1 PATCH/PUT /family_years/1.json | def update
respond_to do |format|
if @family_year.update(family_year_params)
format.html { redirect_to @family_year, notice: tr("family_year_updated") }
else
format.html { render :edit }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @fiscal_year.update(fiscal_year_params)\n format.html { redirect_to @fiscal_year, notice: 'Fiscal year was successfully updated.' }\n format.json { render :show, status: :ok, location: @fiscal_year }\n else\n format.html { render :edit }\n ... | [
"0.6571609",
"0.65660876",
"0.6565878",
"0.65470546",
"0.65375054",
"0.6528177",
"0.6469223",
"0.6469223",
"0.64307237",
"0.6422923",
"0.6367424",
"0.63638264",
"0.6359064",
"0.6343613",
"0.6286524",
"0.6277244",
"0.6255928",
"0.6230749",
"0.61950463",
"0.61632437",
"0.615913... | 0.71121293 | 0 |
DELETE /family_years/1 DELETE /family_years/1.json | def destroy
family = @family_year.family
@family_year.destroy
respond_to do |format|
format.html { redirect_to family, notice: tr("family_year_destroyed") }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @built_year.destroy\n respond_to do |format|\n format.html { redirect_to built_years_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @yearly_info.destroy\n respond_to do |format|\n format.html { redirect_to yearly_infos_url }\n format.json {... | [
"0.70793766",
"0.693862",
"0.69196165",
"0.6907",
"0.68951106",
"0.68950105",
"0.68873906",
"0.68519294",
"0.68505776",
"0.68505776",
"0.6843548",
"0.68267834",
"0.679136",
"0.6744069",
"0.6718606",
"0.6680135",
"0.66764873",
"0.66675436",
"0.6657135",
"0.6625322",
"0.6612354... | 0.713918 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_family_year
@family_year = FamilyYear.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def family_year_params
if @user.can_access_interview_notes?
params.require(:family_year).permit(:community_id, :family_id, :school_year, :picture, :notes)
else
params.require(:family_year).permit(:community_id, :family_id, :school_year, :picture)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
transfer the payement to poster account. | def transfer_money
@recipient_details = BankDetail.where("user_id =?", params[:poster_id]).first
@booking = Booking.find(params[:booking_id])
if @recipient_details
@price = @booking.price.to_i
data = PaymentTransfer.transfer_money_to_poster(@booking,@recipient_details)
if data.class == Stripe::InvalidRequestError
redirect_to :back, :notice => "Stripe error while creating customer: #{data.message}"
else
redirect_to payement_transfers_path
flash[:notice] = "Payement was successfully transfered to #{@recipient_details.stripe_card_id_token}. Amount transfer to poster $#{data[0]} and commision is $#{data[1]}"
end
else
transfer_payment = @booking.update_columns(comment: "Waiting for poster bank account.")
flash[:error] = "No bank detail added for payment"
redirect_to payement_transfers_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_confirmation\n Transfer.create(\n receiver: self,\n amount: 1_000.0,\n source_currency: 'USD',\n target_currency: 'USD',\n exchange_rate: 1.0,\n status: Transfer::SUCCESS\n )\n super\n end",
"def transfer(tx)\n pay_id = get_payment_id(tx.id)\n p... | [
"0.64019454",
"0.6400647",
"0.6313963",
"0.6217827",
"0.6061724",
"0.6060043",
"0.60391766",
"0.6002288",
"0.5983228",
"0.5942406",
"0.5908898",
"0.58977246",
"0.5884997",
"0.58794415",
"0.58462346",
"0.5838864",
"0.5838864",
"0.5833688",
"0.5823008",
"0.58033156",
"0.5792911... | 0.6965162 | 0 |
Check's the transfer status from stripe api. | def check_status
@booking = Booking.find(params[:booking_id])
@transfer_id = @booking.stripe_transfer_id
tr = Stripe::Transfer.retrieve(@booking.stripe_transfer_id)
if tr[:status] == "paid"
transfer_payment = @booking.update_columns(status: tr[:status])
redirect_to payement_transfers_path
flash[:notice] = "Payment was Transfered."
else
flash[:notice] = "Payment Transfer is Pending."
redirect_to payement_transfers_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status\n @transfer[:status]\n end",
"def check_transaction_status\n data = basic_credentials.merge(\n 'x_trans_key' => @x_trans_key,\n 'x_invoice_num' => invoice_num,\n 'x_type' => (type || 0)\n )\n\n astro_curl(@transtatus_url, data)\n end",
"def is_transfer?... | [
"0.73430914",
"0.6987125",
"0.6714578",
"0.6642082",
"0.6521948",
"0.6447181",
"0.6306103",
"0.6277075",
"0.6261966",
"0.6176709",
"0.61406875",
"0.61015165",
"0.6093577",
"0.6080003",
"0.60792315",
"0.6073574",
"0.60447925",
"0.60395116",
"0.602648",
"0.59554344",
"0.5904854... | 0.75068206 | 0 |
Respond to a PlugIt ping request. Sends back an empty HTTP 200 response, or the 'data' parameter that was provided by PlugIt. | def ping
data = params[:data] || ''
render json: { data: data }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ping\n response, body = send_request :get, '', :binary\n true\n end",
"def ping\n get('')\n end",
"def ping\n render json: {\n message: \"OK\",\n time: DateTime.current.strftime(\"%Q\")\n }\n end",
"def ping\n TaxCloud::Responses::Ping.parse request(:ping)\n ... | [
"0.6981154",
"0.6865848",
"0.682164",
"0.67855185",
"0.675121",
"0.6656377",
"0.65743685",
"0.6476206",
"0.6386113",
"0.6377683",
"0.6350589",
"0.62773556",
"0.62552214",
"0.6150953",
"0.6144178",
"0.6140828",
"0.60854256",
"0.60702354",
"0.6068855",
"0.60620975",
"0.60294634... | 0.7434062 | 0 |
Respond with the PlugIt version number. | def version
render json: { result: 'Ok', version: '1', protocol: 'EBUio-PlugIt' }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def version\n api_execute('/version', :get).body\n end",
"def version\n send_command(:getinfo, 'version')\n reply = read_reply.split('=').last\n read_reply # skip \"250 OK\"\n reply\n end",
"def version\n self.class.get(\"/get/version\")\n end",
"def get_version\n ... | [
"0.7141543",
"0.7131425",
"0.70228535",
"0.68992054",
"0.6871362",
"0.672572",
"0.668096",
"0.66106164",
"0.6584674",
"0.6513592",
"0.6511722",
"0.65003586",
"0.64943415",
"0.64838755",
"0.64684653",
"0.64619476",
"0.64581126",
"0.6446494",
"0.6430762",
"0.6430762",
"0.643076... | 0.8408515 | 0 |
GET /feature_models/1 GET /feature_models/1.json | def show
@feature_model = FeatureModel.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @feature_model }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:vehicle_id]\n @vehicle = Vehicle.find(params[:vehicle_id])\n @vehicle_features = @vehicle.features\n end\n @feature = Feature.new\n @features = Feature.all\n @all_features = Feature.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.j... | [
"0.68911725",
"0.65041167",
"0.6456627",
"0.6454674",
"0.63120306",
"0.6290357",
"0.6254651",
"0.618421",
"0.6112798",
"0.6112798",
"0.60943913",
"0.6072903",
"0.60348964",
"0.6027023",
"0.59812653",
"0.5974228",
"0.5938801",
"0.58880633",
"0.58405876",
"0.58024013",
"0.57975... | 0.71283925 | 0 |
GET /feature_models/new GET /feature_models/new.json | def new
@feature_model = FeatureModel.new
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @feature_model }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @feature = Feature.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feature }\n end\n end",
"def new\n @feature = Feature.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feature }\n ... | [
"0.76336366",
"0.76336366",
"0.7387813",
"0.72632056",
"0.72206527",
"0.70854247",
"0.70854247",
"0.70854247",
"0.70854247",
"0.6910392",
"0.68846864",
"0.6854929",
"0.6827115",
"0.6811537",
"0.67846614",
"0.6766844",
"0.6732144",
"0.67289335",
"0.6715952",
"0.6699709",
"0.66... | 0.79455495 | 0 |
POST /feature_models POST /feature_models.json | def create
@feature_model = FeatureModel.new(params[:feature_model])
respond_to do |format|
if @feature_model.save
format.html { redirect_to @feature_model, :notice => 'Feature model was successfully created.' }
format.json { render :json => @feature_model, :status => :created, :location => @feature_model }
else
format.html { render :action => "new" }
format.json { render :json => @feature_model.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n feature = features.create(feature_params)\n\n respond_with(feature)\n end",
"def create\n feature = features.create(feature_params)\n\n respond_with(feature)\n end",
"def create\n @feature = Feature.find_or_create_by(name: params[:feature][:name])\n @feature.update(deleted_at: ... | [
"0.6664786",
"0.6664786",
"0.64545137",
"0.62453234",
"0.6205945",
"0.61729884",
"0.60795695",
"0.6015084",
"0.5973376",
"0.59376323",
"0.5929749",
"0.5929749",
"0.5925967",
"0.5866978",
"0.5846872",
"0.58350337",
"0.5793282",
"0.5791804",
"0.578431",
"0.577851",
"0.5737486",... | 0.7081288 | 0 |
PUT /feature_models/1 PUT /feature_models/1.json | def update
@feature_model = FeatureModel.find(params[:id])
respond_to do |format|
if @feature_model.update_attributes(params[:feature_model])
format.html { redirect_to @feature_model, :notice => 'Feature model was successfully updated.' }
format.json { head :no_content }
else
format.html { render :action => "edit" }
format.json { render :json => @feature_model.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n feature.update_attributes(feature_params)\n\n respond_with(feature)\n end",
"def update\n @feature = Feature.find(params[:id])\n\n respond_to do |format|\n if @feature.update_attributes(params[:feature])\n format.html { redirect_to admin_features_path, notice: 'Feature was s... | [
"0.61656874",
"0.60785335",
"0.60129166",
"0.5987578",
"0.5946932",
"0.59260094",
"0.59238297",
"0.58759475",
"0.58657545",
"0.584658",
"0.5801184",
"0.57697827",
"0.5766134",
"0.5766134",
"0.5766134",
"0.57502174",
"0.5733993",
"0.57091403",
"0.5688624",
"0.56844646",
"0.566... | 0.68288696 | 0 |
DELETE /feature_models/1 DELETE /feature_models/1.json | def destroy
@feature_model = FeatureModel.find(params[:id])
@feature_model.destroy
respond_to do |format|
format.html { redirect_to feature_models_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @feature = Feature.find(params[:id])\n @feature.destroy\n\n respond_to do |format|\n format.html { redirect_to features_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item_feature = ItemFeature.find(params[:id])\n @item_feature.destroy\n\n res... | [
"0.7299146",
"0.71325123",
"0.7058089",
"0.7013151",
"0.6979955",
"0.6970738",
"0.6966448",
"0.696397",
"0.6955871",
"0.6955348",
"0.6955348",
"0.6955348",
"0.69509375",
"0.69467443",
"0.69367075",
"0.6910246",
"0.6905975",
"0.69051516",
"0.68978006",
"0.6887833",
"0.6869564"... | 0.7712323 | 0 |
This is identical to get_sections. Why use different names? Because it expresses the intent. Its possible we will want to return different responses for each in the future. | def get_page
render_page_sections_json
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sections\n respond_with @page.sections\n end",
"def sections\n respond_with @page.sections\n end",
"def sections\n result = @nsx_client.get(@url_sections)\n result['results']\n end",
"def get_sections_with_http_info(name, password = nil, folder = nil, storage = nil)\n... | [
"0.7123568",
"0.7123568",
"0.69484884",
"0.6750666",
"0.65884846",
"0.65809155",
"0.65092695",
"0.639382",
"0.6341351",
"0.62897414",
"0.6086768",
"0.604964",
"0.604964",
"0.6019376",
"0.60089743",
"0.5979822",
"0.5960345",
"0.5933253",
"0.5923285",
"0.5920057",
"0.58883077",... | 0.5997204 | 15 |
Friend.find_by(firstname:'Anna').first.keywords Friend.find_by(firstname:'Anna').keywords Friend.all_upcoming(14) ... working for all birthdays in the next fortnight | def upcoming?(num)
bday = self.birthday.strftime('%j').to_i
today = Date.today.strftime('%j').to_i
bday += 365 if bday < num+1
return ((bday - today >-1) && (bday - today <= num))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def born_on_this_day_biographies\n @born_on_this_day ||= begin\n query_date = Date.today\n\n IntervieweeBiography.\n references(oral_history_content: :work).\n where(\"interviewee_biographies.json_attributes -> 'birth' ->> 'date' like '%-#{query_date.strftime(\"%m-%d\")}'\").\n... | [
"0.6405188",
"0.60113406",
"0.58367825",
"0.57186645",
"0.5659354",
"0.56530124",
"0.5631182",
"0.54510725",
"0.5449537",
"0.5425547",
"0.5408361",
"0.5389542",
"0.5363316",
"0.5349892",
"0.53116506",
"0.5292001",
"0.5291157",
"0.52749234",
"0.52691394",
"0.523764",
"0.523720... | 0.0 | -1 |
Instance Methods Get an AttributeDictionary by name. Returns nil if there is none with the given name. | def [](key)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attribute(name)\n @attributes ||= {}\n @attributes[name]\n end",
"def get_attribute(name)\n return @attrs[name] if attrs.key?(name)\n end",
"def get_attribute(attr_name)\n return nil unless @attributes.key? attr_name\n\n @attributes[attr_name]\n end",
"def attribute(name... | [
"0.69395965",
"0.690341",
"0.6644047",
"0.6571137",
"0.6558699",
"0.64813006",
"0.6455924",
"0.6391009",
"0.6351447",
"0.63282675",
"0.63096464",
"0.6278301",
"0.6234817",
"0.6219401",
"0.6219401",
"0.62180954",
"0.6199426",
"0.61604327",
"0.61604327",
"0.6109516",
"0.6109458... | 0.0 | -1 |
The count method is inherited from the Enumerable mixin module. | def count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count\n each.size\n end",
"def count\n each.count\n end",
"def count\n # implement in subclasses\n end",
"def count\n raise NotImplementedError\n end",
"def count; end",
"def count; end",
"def count; end",
"def count\n all.count\n end",
"def count\n ... | [
"0.7767859",
"0.77471346",
"0.77038735",
"0.7631804",
"0.7525069",
"0.7525069",
"0.7525069",
"0.74714124",
"0.74448335",
"0.7433811",
"0.7433811",
"0.736994",
"0.73684734",
"0.7350836",
"0.7311736",
"0.7309861",
"0.7274849",
"0.7274849",
"0.7274849",
"0.72523123",
"0.7242596"... | 0.7070175 | 29 |
Only allow a trusted parameter "white list" through. | def user_params
params.require(:user).permit(:id, :name, :email, :password, :username,
:allowance, :supervisor, :employee_status, :school_attending,
:degree_type, :degree_program, :eligibility, :request => [:id,
:amount_requested, :amount_paid, :date_processed, :processing_status,
:notes, :request_approved, :documents_submitted])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.71213365",
"0.70527846",
"0.6947171",
"0.6901663",
"0.67342883",
"0.6717481",
"0.668679",
"0.667654",
"0.6660948",
"0.655484",
"0.6525947",
"0.64567953",
"0.64502525",
"0.6450165",
"0.6446098",
"0.6433068",
"0.64118934",
"0.64118934",
"0.63903046",
"0.6379847",
"0.6379847"... | 0.0 | -1 |
GET /complains Return Complains records, filters accept: city and company | def index
@complains = Complain.all
if params[:city].nil?
params[:city] = ''
end
if params[:company].nil?
params[:company] = ''
end
if params[:city] != '' and params[:company] != ''
result = Complain.where("city = ? AND company = ?", params[:city], params[:company]).size
elsif params[:city] != ''
result = Complain.where("city = ?", params[:city]).size
elsif params[:company] != ''
result = Complain.where("company = ?", params[:company]).size
else
result = Complain.count
end
render json: result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @company_clients = CompanyClient.where(company: params[:company]).first\n end",
"def index\n @grouped_companies = Company.all.group_by(&:geography) \n @companies = params[:q] ? company_filteration(params[:q],params[:region]) : Company.all\n render layout: \"browse\"\n end",
"def in... | [
"0.6654297",
"0.64825964",
"0.647094",
"0.6470258",
"0.644156",
"0.64208543",
"0.6417104",
"0.63997155",
"0.63835734",
"0.63789713",
"0.63546705",
"0.6335696",
"0.6324701",
"0.6323322",
"0.6298138",
"0.6294245",
"0.6277777",
"0.62385666",
"0.6235472",
"0.6224066",
"0.62222993... | 0.6938855 | 0 |
GET /complains/1 Not implemented def show | def create
@complain = Complain.new(complain_params)
if @complain.save
render json: @complain, status: :created
else
render json: {status: 'ERROR', message: 'Can not add the complain.', data:@complain.err}, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @cec_complaint = CecComplaint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cec_complaint }\n end\n end",
"def show\n @complaint = Complaint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.... | [
"0.7184997",
"0.7177292",
"0.7172053",
"0.7143324",
"0.70616573",
"0.70195466",
"0.69102174",
"0.6908695",
"0.68395966",
"0.68395966",
"0.6809302",
"0.6799727",
"0.67880195",
"0.67877024",
"0.67780787",
"0.6719261",
"0.6680013",
"0.66711944",
"0.6609896",
"0.6587719",
"0.6587... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_complain
@complain = Complain.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6164095",
"0.6046031",
"0.5945298",
"0.59179014",
"0.58890367",
"0.58341795",
"0.5776118",
"0.5700777",
"0.5700777",
"0.5656277",
"0.56218207",
"0.5423995",
"0.5411516",
"0.5411516",
"0.5411516",
"0.5395004",
"0.53783494",
"0.53593004",
"0.53412604",
"0.534078",
"0.5332865... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def complain_params
#params.require(:complain).permit(:title, :description, :city, :state, :country, :company)
params.permit(:title, :description, :city, :state, :country, :company)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.71213365",
"0.70527846",
"0.6947171",
"0.6901663",
"0.67342883",
"0.6717481",
"0.668679",
"0.667654",
"0.6660948",
"0.655484",
"0.6525947",
"0.64567953",
"0.64502525",
"0.6450165",
"0.6446098",
"0.6433068",
"0.64118934",
"0.64118934",
"0.63903046",
"0.6379847",
"0.6379847"... | 0.0 | -1 |
GET /site_elements GET /site_elements.xml | def index
brand_site_elements = @site_elements.where(brand_id: website.brand_id).order('site_elements.updated_at desc')
@search = brand_site_elements.ransack(params[:q])
if params[:q]
@site_elements = @search.result.order(:name, :version).paginate(page: params[:page], per_page: 50)
else
@site_elements = brand_site_elements.paginate(page: params[:page], per_page: 50)
end
respond_to do |format|
format.html # index.html.erb
format.xml { render xml: @site_elements }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @site_attributes = @site.site_attributes\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @site_attributes }\n end\n end",
"def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml ... | [
"0.6425705",
"0.6259612",
"0.6259612",
"0.6259612",
"0.6259612",
"0.6259612",
"0.6226994",
"0.6164825",
"0.6164373",
"0.6113549",
"0.604433",
"0.604433",
"0.59716105",
"0.5894841",
"0.58780485",
"0.57920706",
"0.57750475",
"0.57742",
"0.5758718",
"0.5717054",
"0.57089067",
... | 0.5355402 | 65 |
GET /site_elements/1 GET /site_elements/1.xml | def show
@product_site_element = ProductSiteElement.new(site_element_id: @site_element.id)
@site_element_attachment = SiteElementAttachment.new
respond_to do |format|
format.html # show.html.erb
format.xml { render xml: @site_element }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @site_attributes = @site.site_attributes\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @site_attributes }\n end\n end",
"def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml ... | [
"0.6393615",
"0.62640053",
"0.62640053",
"0.62640053",
"0.62640053",
"0.62640053",
"0.61647254",
"0.60735124",
"0.60735124",
"0.6057458",
"0.6003926",
"0.59817094",
"0.59798527",
"0.5976412",
"0.5958516",
"0.59091496",
"0.58932716",
"0.58932716",
"0.5887194",
"0.58866256",
"0... | 0.6137115 | 7 |
GET /site_elements/new GET /site_elements/new.xml | def new
@site_element.show_on_public_site = true
if params[:products].present?
@site_element.products = params[:products].split(',').map{|k| Product.find(k)}
@site_element.is_document = true
end
respond_to do |format|
format.html # new.html.erb
format.xml { render xml: @site_element }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end",
... | [
"0.7509086",
"0.7509086",
"0.7509086",
"0.7509086",
"0.7509086",
"0.7509086",
"0.7509086",
"0.7509086",
"0.72165865",
"0.7215627",
"0.7187658",
"0.7089282",
"0.7039676",
"0.6967446",
"0.6956999",
"0.6946106",
"0.6940227",
"0.69271636",
"0.68940675",
"0.68838245",
"0.681854",
... | 0.6716113 | 23 |
POST /admin/site_elements/upload Callback after uploading a file directly to S3. Adds the temporary S3 path to the form before creating new software. | def upload
@direct_upload_url = params[:direct_upload_url]
respond_to do |format|
format.js
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload\n begin\n @site = Site.find(params[:id])\n rescue\n puts \"Requested site id \" + params[:id] + \" not found\"\n flash[:danger] = \"The requested site does not exist in the system.\"\n redirect_to sites_path \n return\n end\n\n # AWS S3 parameters which will be encod... | [
"0.7294369",
"0.64944804",
"0.64936656",
"0.64917964",
"0.6475339",
"0.64223",
"0.6394724",
"0.6348916",
"0.631876",
"0.6312243",
"0.63013184",
"0.630014",
"0.6153277",
"0.6142666",
"0.61151445",
"0.6114971",
"0.61024547",
"0.60958064",
"0.60757005",
"0.60757005",
"0.6065514"... | 0.0 | -1 |
POST /site_elements POST /site_elements.xml | def create
@site_element.brand_id = website.brand_id
respond_to do |format|
if @site_element.save
if @site_element.replaces_element.present?
old_element = SiteElement.find(@site_element.replaces_element)
if old_element.version.blank?
old_element.update(version: "A")
end
if @site_element.versions_to_delete.present?
SiteElement.where(id: @site_element.versions_to_delete).destroy_all
end
end
format.html {
if params[:return_to]
return_to = URI.parse(params[:return_to]).path
redirect_to(return_to, notice: "Resource was successfully uploaded.")
else
redirect_to([:admin, @site_element], notice: 'Resource was successfully created. IMPORTANT: this has been acting up lately. Wait 5 seconds, then refresh this page. Then the links below will be correct.')
end
}
format.xml { render xml: @site_element, status: :created, location: @site_element }
website.add_log(user: current_user, action: "Uploaded a site element: #{@site_element.long_name}")
else
format.html { render action: "new" }
format.xml { render xml: @site_element.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n\n params[:elements].values.each do |elem|\n puts 'el', elem\n elem_to_save = Element.create (elem)\n @design.elements << elem_to_save\n end\n\n\n respond_to do |format|\n if @design.id\n format.html { redirect_to edit_design_path(@design), notice: 'Design was succes... | [
"0.6018734",
"0.5545079",
"0.55372304",
"0.5512491",
"0.54776126",
"0.5454577",
"0.5418566",
"0.53900224",
"0.53596574",
"0.5355668",
"0.5292906",
"0.5282853",
"0.5263238",
"0.5260097",
"0.5246631",
"0.5240756",
"0.5223541",
"0.52134025",
"0.52102023",
"0.5204118",
"0.5193504... | 0.54389364 | 6 |
PUT /site_elements/1 PUT /site_elements/1.xml | def update
other_versions = @site_element.other_versions
respond_to do |format|
if @site_element.update(site_element_params)
other_versions.each{|element| element.catchup_with_latest_version(@site_element)}
format.html {
if params[:return_to]
return_to = URI.parse(params[:return_to]).path
redirect_to(return_to, notice: "Resource was successfully updated.")
else
redirect_to([:admin, @site_element], notice: 'Resource was successfully updated. It may take a few seconds to process and transfer the file to the right place.')
end
}
format.xml { head :ok }
website.add_log(user: current_user, action: "Updated a site element: #{@site_element.long_name}")
else
format.html { render action: "edit" }
format.xml { render xml: @site_element.errors, status: :unprocessable_entity }
end
end
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 put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xm... | [
"0.6661964",
"0.63001144",
"0.6149885",
"0.6112012",
"0.60718286",
"0.60718286",
"0.6035054",
"0.60276175",
"0.60276175",
"0.60276175",
"0.60276175",
"0.59439754",
"0.5907783",
"0.58831424",
"0.58492404",
"0.5845436",
"0.58279246",
"0.5770019",
"0.5762629",
"0.5756456",
"0.57... | 0.6034205 | 7 |
DELETE /site_elements/1 DELETE /site_elements/1.xml | def destroy
@site_element.destroy
respond_to do |format|
format.html {
if params[:return_to]
return_to = URI.parse(params[:return_to]).path
redirect_to(return_to, notice: "#{@site_element.long_name} was successfully deleted.")
else
redirect_to(admin_site_elements_url)
end
}
format.xml { head :ok }
end
website.add_log(user: current_user, action: "Deleted a site element: #{@site_element.long_name}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(connection)\n r = connection.execute(%(<SiteDeleteRequest session-id=\"#{connection.session_id}\" site-id=\"#{@id}\"/>))\n r.success\n end",
"def destroy\n @site_attribute = @site.site_attributes.find(params[:id])\n @site_attribute.destroy\n\n respond_to do |format|\n format... | [
"0.6698817",
"0.6629366",
"0.6550205",
"0.6543918",
"0.65353584",
"0.65353584",
"0.65353584",
"0.65353584",
"0.65353584",
"0.65353584",
"0.65353584",
"0.65353584",
"0.65216714",
"0.65147686",
"0.6456623",
"0.6435682",
"0.6422348",
"0.6351971",
"0.63177294",
"0.6302821",
"0.62... | 0.66200876 | 2 |
Since the Game class is essentially the game engine, most user actions are still here but there is a lot of room for rebuilding. Below you can see we're calling a method within $hero. It's probably going to have a separate class full of user actions alone at some point but for now, it is what it is. This is really the start of the algorithm responsible for generating new rooms. If rooms weren't drawn as you attempt to enter them, the algorithm could be kept separate from the move method. I like this way better because it means that later, if we count the number of unexplored exits, we could then change the algorithm to force additional open doors that way you're guarenteed to always have new exits available. | def move_disambig(direction)
@north_cmds = ["n", "up", "north"]
@east_cmds = ["e", "right", "east"]
@west_cmds = ["w", "left", "west"]
@south_cmds = ["s", "down", "south"]
xy = $hero.location.xy.split(", ")
x = xy[0].to_i
y = xy[1].to_i
if @north_cmds.include?(direction)
if $hero.location.exits.include?("north")
check_room("north", x, (y + 1))
move("north")
else
puts "There is no exit to the north!"
end
elsif @east_cmds.include?(direction)
if $hero.location.exits.include?("east")
check_room("east", (x + 1), y)
move("east")
else
puts "There is no exit to the east!"
end
elsif @west_cmds.include?(direction)
if $hero.location.exits.include?("west")
check_room("west", (x - 1), y)
move("west")
else
puts "There is no exit to the west!"
end
elsif @south_cmds.include?(direction)
if $hero.location.exits.include?("south")
check_room("south", x, (y - 1))
move("south")
else
puts "There is no exit to the south!"
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_hero\n #get next square\n next_x = @cur_x + DIRECTION[@hero_direction][0]\n next_y = @cur_y + DIRECTION[@hero_direction][1]\n next_x = 0 if next_x < 0\n next_x = 14 if next_x > 14\n next_y = 0 if next_y < 0\n next_y = 14 if next_y > 14\n #look at new square in room\... | [
"0.77033126",
"0.6870024",
"0.6719482",
"0.6605058",
"0.6605058",
"0.6605058",
"0.6605058",
"0.6605058",
"0.6432848",
"0.63517225",
"0.6291838",
"0.62804276",
"0.6243273",
"0.62425417",
"0.62425417",
"0.62425417",
"0.62425417",
"0.62425417",
"0.62419415",
"0.62419415",
"0.622... | 0.0 | -1 |
This is effectively the end of the procedural generation algorithm. | def move(direction)
north = ["n", "up", "north"]
east = ["e", "right", "east"]
west = ["w", "left", "west"]
south = ["s", "down", "south"]
if north.include?(direction)
direction == "north"
elsif east.include?(direction)
direction == "east"
elsif west.include?(direction)
direction == "west"
elsif south.include?(direction)
direction == south
end
if $hero.location.exits.has_key?(direction)
newroom = $hero.location.exits[direction]
$hero.location = newroom
$hero.xy = newroom.xy
else
puts "You cannot travel #{direction}. The path does not lead there."
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate; end",
"def generate; end",
"def generate_comprehensive\n\n end",
"def initial_generate\n \n end",
"def generate\n end",
"def generate\n end",
"def next_generation!\n @grid = next_generation\n end",
"def generate_next\n session[:solution] == nil && generate\n\... | [
"0.71253425",
"0.71253425",
"0.6752383",
"0.6721537",
"0.6599887",
"0.646767",
"0.63345635",
"0.6245772",
"0.61636496",
"0.61009806",
"0.60397184",
"0.60297495",
"0.6022243",
"0.6008249",
"0.600814",
"0.5975753",
"0.5955988",
"0.59552217",
"0.59434843",
"0.5936511",
"0.590444... | 0.0 | -1 |
Word disambiguation begins by evaluating word1. In some cases that's all that's needed. If word2 is consided relevant word2 is evaluated as well. Right now, for commands like "look" word2 could be anything so look around is functionally the same as look. The various cmd arrays contain all valid synonymns for a given command. This way new synonymns can be added with minimal effort. Currently word2 evaluations happen within the elsif structure of evaluating word1 it may be worth reworking this in future. Word1_disambig > word2_disambig. However, this hasn't been done now as generally evaluations of word2 branch off based on word1. That is to say dump pot has a word2 value of pot but we can only evaluate it within the context of drop_cmds. At present its more orderly to have everything in one place. In future calling seperate methods such as drop_cmds_disambig might be a way of branching with maintaining readability. | def word_disambig(word1, word2, word3, word4, word5)
go_cmds = ["go", "walk", "run", "move", "travel", "skip", "g", "m"]
fast_move_cmds = ["n", "s", "e", "w"]
look_cmds = ["look", "see", "l"]
get_cmds = ["grab", "get", "take"]
drop_cmds = ["drop", "leave", "dump"]
status_cmds = ["status", "s", "health", "hp", "xp", "check", "level"]
inv_cmds = ["inv", "i", "inventory", "loot", "stuff", "gear"]
quit_cmds = ["q", "quit", "exit", "end"]
use_cmds = ["use"]
attack_cmds = ["attack", "hit"]
@all_cmds << go_cmds
@all_cmds << (look_cmds + get_cmds + drop_cmds)
if go_cmds.include?(word1)
if $hero.location.monsters.size != 0
puts 'Your enemies are blocking the exit'
else
move_disambig(word2)
looking
end
elsif word1 == 'help'
puts 'some commands:
go [direction]
get [thing]
get [type] [thing] Example: get ! scroll
use [type] [thing] Example: use orange bottle
inv - display inventory
attack [type]
drop [thing]
look - gives information about the room/what you can see
status - displays information about your hp etc.
q - quits the game'
# Some developer commands commented out in case they are needed again later
#elsif word1 == "ah"
# $hero.heal(30)
#elsif word1 == "gen"
# $hero.location.item_gen
#elsif word1 == "boom"
# def boom
# $hero.location.monsters.each do |mob|
# mob.wound(10)
# dead = mob.defeated?
# if dead == true
# $hero.location.monsters.delete_at($hero.location.monsters.index(mob))
# end
# end
# end
# boom
# boom
# boom
#elsif word1 == 'god'
# $hero.hp = 100
elsif fast_move_cmds.include?(word1)
move_disambig(word1)
looking
elsif look_cmds.include?(word1)
looking
elsif get_cmds.include?(word1)
getting
elsif drop_cmds.include?(word1)
dropping
elsif status_cmds.include?(word1)
$hero.status_check
elsif inv_cmds.include?(word1)
$hero.inv_check
elsif quit_cmds.include?(word1)
puts "Thanks for playing!"
exit
elsif use_cmds.include?(word1)
using
elsif attack_cmds.include?(word1)
attacking
else
puts "I do not recognize that command. Please try again."
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def looper(word1, word2)\n\t\tputs word1\n\t\t@word1 = word1.split(\"\") \n\t\t@word2 = word2.split(\"\")\n\n\t\tuntil @word1 == @word2 do \n\n\t\t\t@word1.each_with_index do |let, index|\n\t\t\t\tif let == @word2[index]\n\t\t\t\telse \n\t\t\t\t\ttemp = @word1.clone\n\t\t\t\t\ttemp[index] = @word2[index]\n\t\t\t\t... | [
"0.6331387",
"0.5828699",
"0.57423717",
"0.5671364",
"0.561302",
"0.5585133",
"0.55316657",
"0.54644555",
"0.5412722",
"0.5390442",
"0.53889626",
"0.53293914",
"0.53241116",
"0.53124285",
"0.5222425",
"0.5187185",
"0.5153052",
"0.5151803",
"0.51428175",
"0.5120926",
"0.509732... | 0.7428701 | 0 |
GET /admin/room_devices GET /admin/room_devices.json | def index
@admin_room_devices = Admin::RoomDevice.search(params[:search]).where(user: current_user).paginate(:page => params[:page])
@export = Admin::RoomDevice.all
respond_to do |format|
format.html
format.json
format.xlsx {
response.headers['Content-Disposition'] = 'attachment; filename="Room_Devices.xlsx"'
}
format.js { render :layout => false }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def devices(params={})\n res = @client.get(\"#{path}/devices\", params)\n\n res.json[\"devices\"].map{ |atts| ::M2X::Client::Device.new(@client, atts) } if res.success?\n end",
"def get_all_device_info\n # @device = Device.where(\"user_id = ?\",current_user[:id])\n # render json: @device\n @devic... | [
"0.7055636",
"0.69208777",
"0.66435844",
"0.6616356",
"0.6575139",
"0.6558546",
"0.64773583",
"0.64282244",
"0.64228237",
"0.6367818",
"0.6360648",
"0.6355462",
"0.6344811",
"0.6292977",
"0.62433046",
"0.62253916",
"0.6188025",
"0.6160841",
"0.6159646",
"0.6159098",
"0.614332... | 0.0 | -1 |
GET /admin/room_devices/1 GET /admin/room_devices/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_admin_room_device\n @admin_room_device = Admin::RoomDevice.find(params[:id])\n end",
"def get_all_device_info\n # @device = Device.where(\"user_id = ?\",current_user[:id])\n # render json: @device\n @devices = User.get_all_user_devices(current_user[:id])\n render json: @devices\n end",... | [
"0.6824344",
"0.6804012",
"0.6803329",
"0.65179455",
"0.6457647",
"0.64439625",
"0.6427771",
"0.6396508",
"0.63806874",
"0.637307",
"0.6329829",
"0.63195837",
"0.62772506",
"0.6271403",
"0.6269527",
"0.6245627",
"0.62361383",
"0.6235783",
"0.6235311",
"0.6235311",
"0.6235311"... | 0.0 | -1 |
POST /admin/room_devices POST /admin/room_devices.json | def create
@type = params[:actionType]
@admin_room_device = Admin::RoomDevice.new(admin_room_device_params)
@admin_room_device.user = current_user
respond_to do |format|
if @admin_room_device.save
@admin_room_devices = Admin::RoomDevice.where(user: current_user).paginate(:page => params[:page])
format.html { redirect_to @admin_room_device, notice: 'Room device was successfully created.' }
format.json { render :show, status: :created, location: @admin_room_device }
format.js { render :layout => false }
else
format.html { render :new }
format.json { render json: @admin_room_device.errors, status: :unprocessable_entity }
format.js { render :layout => false }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin_room_device_params\n params.require(:admin_room_device).permit(:user_id, :room_id, :name, :amount, :status, :description)\n end",
"def add_device(serial)\n res = @client.post(\"#{path}/devices\", nil, { serial: serial }, \"Content-Type\" => \"application/json\")\n\n ::M2X::Client::Device.new(... | [
"0.68013006",
"0.65333265",
"0.65138197",
"0.6447971",
"0.6410266",
"0.63944453",
"0.63839567",
"0.6297241",
"0.62708104",
"0.62531793",
"0.6242928",
"0.62335235",
"0.61935604",
"0.6179409",
"0.6148227",
"0.6144942",
"0.61443746",
"0.61279184",
"0.6111285",
"0.61031413",
"0.6... | 0.6945448 | 0 |
PATCH/PUT /admin/room_devices/1 PATCH/PUT /admin/room_devices/1.json | def update
@type = params[:actionType]
respond_to do |format|
if @admin_room_device.update(admin_room_device_params)
@admin_room_devices = Admin::RoomDevice.where(user: current_user).paginate(:page => params[:page])
format.html { redirect_to @admin_room_device, notice: 'Room device was successfully updated.' }
format.json { render :show, status: :ok, location: @admin_room_device }
format.js { render :layout => false }
else
format.html { render :edit }
format.json { render json: @admin_room_device.errors, status: :unprocessable_entity }
format.js { render :layout => false }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @room.update(room_params)\n render json: @room, status: :ok, serializer: RoomSerializer\n else\n render json: @room.errors, status: :unprocessable_entity\n end\n end",
"def update\n @room = Room.find(params[:id])\n\n if @room.update_attributes(params[:room])\n head ... | [
"0.66058797",
"0.657957",
"0.65770304",
"0.64990175",
"0.6466597",
"0.64520633",
"0.64374566",
"0.64282745",
"0.6401146",
"0.6389431",
"0.6389431",
"0.63757783",
"0.63544065",
"0.6347033",
"0.62893766",
"0.62862444",
"0.62844026",
"0.6280558",
"0.6261252",
"0.6234525",
"0.623... | 0.6414516 | 8 |
DELETE /admin/room_devices/1 DELETE /admin/room_devices/1.json | def destroy
@admin_room_device.destroy
respond_to do |format|
format.html { redirect_to admin_room_devices_url, notice: 'Room device was successfully destroyed.' }
format.json { head :no_content }
format.js { render :layout => false }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @device.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @device.destroy\n\n respond_to do |format|\n format.html { redirect_to devices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @devi... | [
"0.73066974",
"0.7136805",
"0.7121086",
"0.7120843",
"0.7120843",
"0.7120843",
"0.7120239",
"0.7078767",
"0.70566076",
"0.7044856",
"0.7040752",
"0.6968132",
"0.69659233",
"0.6945928",
"0.69250214",
"0.6924495",
"0.6897003",
"0.6892201",
"0.6865773",
"0.6865364",
"0.6865364",... | 0.7288625 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_admin_room_device
@admin_room_device = Admin::RoomDevice.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6164095",
"0.6046031",
"0.5945298",
"0.59179014",
"0.58890367",
"0.58341795",
"0.5776118",
"0.5700777",
"0.5700777",
"0.5656277",
"0.56218207",
"0.5423995",
"0.5411516",
"0.5411516",
"0.5411516",
"0.5395004",
"0.53783494",
"0.53593004",
"0.53412604",
"0.534078",
"0.5332865... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def admin_room_device_params
params.require(:admin_room_device).permit(:user_id, :room_id, :name, :amount, :status, :description)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_answer
@answer = Answer.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def answer_params
params.require(:answer).permit(:content)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6979893",
"0.6781746",
"0.6746611",
"0.6742344",
"0.6735229",
"0.6592651",
"0.65027124",
"0.6498011",
"0.648163",
"0.647716",
"0.64556813",
"0.64386255",
"0.63784456",
"0.63756156",
"0.636574",
"0.6319542",
"0.63004524",
"0.6299559",
"0.62925464",
"0.62923217",
"0.6289894"... | 0.0 | -1 |
arg [Object] arg.chat or arg itself will be used | def set_chat_data(arg, data)
chat = arg.respond_to?(:chat) ? arg.chat : arg
barrymore_chats_data[chat] = chat_data(arg).merge(data).freeze
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commandChat _obj, _args\n \"_obj commandChat _args;\" \n end",
"def customChat _obj, _args\n \"_obj customChat _args;\" \n end",
"def sideChat _obj, _args\n \"_obj sideChat _args;\" \n end",
"def showChat _args\n \"showChat _args;\" \n end",
"def systemChat _args\n ... | [
"0.73856723",
"0.7379979",
"0.7129483",
"0.70662385",
"0.70342577",
"0.6993293",
"0.692255",
"0.686182",
"0.6624803",
"0.6546691",
"0.6513313",
"0.6496912",
"0.63492715",
"0.5971953",
"0.59363776",
"0.59363776",
"0.5921681",
"0.58564126",
"0.5841593",
"0.5804696",
"0.5792677"... | 0.6439061 | 12 |
arg [Object] arg.chat or arg itself will be used | def chat_data(arg)
chat = arg.respond_to?(:chat) ? arg.chat : arg
barrymore_chats_data[chat] ||= {}.freeze
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commandChat _obj, _args\n \"_obj commandChat _args;\" \n end",
"def customChat _obj, _args\n \"_obj customChat _args;\" \n end",
"def sideChat _obj, _args\n \"_obj sideChat _args;\" \n end",
"def showChat _args\n \"showChat _args;\" \n end",
"def systemChat _args\n ... | [
"0.7384772",
"0.7379535",
"0.71282536",
"0.7066178",
"0.7034402",
"0.6992283",
"0.6921875",
"0.6626611",
"0.654665",
"0.6514601",
"0.64996123",
"0.6441368",
"0.6352319",
"0.5974734",
"0.59321684",
"0.59321684",
"0.5924808",
"0.5855691",
"0.58369803",
"0.58068097",
"0.5788788"... | 0.6863538 | 7 |
GET /events/1 GET /events/1.xml | def show
@event = Event.find(params[:id])
respond_to do |format|
format.html {}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calendar_event(event_id)\n record \"/calendar_events/#{event_id}.xml\", :method => :get\n end",
"def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events ... | [
"0.74074787",
"0.73822564",
"0.72317415",
"0.71266216",
"0.7051357",
"0.70203346",
"0.7014016",
"0.7014016",
"0.7014016",
"0.7014016",
"0.6992188",
"0.69583654",
"0.6933569",
"0.6924838",
"0.6916713",
"0.689496",
"0.68806356",
"0.6879873",
"0.6858128",
"0.6853787",
"0.6853787... | 0.0 | -1 |
GET /events/new GET /events/new.xml | def new
@event = Event.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @event }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n setup_variables\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"def new\n @event = Event.new_default\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render ... | [
"0.7961696",
"0.7921109",
"0.7867247",
"0.7857972",
"0.78549564",
"0.78541255",
"0.78407097",
"0.7750453",
"0.77215594",
"0.7641453",
"0.7637763",
"0.7487815",
"0.74306935",
"0.7382315",
"0.73636585",
"0.73075145",
"0.7307211",
"0.7268604",
"0.72594714",
"0.72589314",
"0.7257... | 0.785546 | 16 |
POST /events POST /events.xml | def create
# save file with _id
# want to get an id then save the file
# so we need to get the filename, save the record with the filename
# then save the file with the right filename with _id
@file = params[:event][:picture_location]
params[:event][:picture_location] = nil
@event = Event.new(params[:event])
respond_to do |format|
if @event.save
@event.save_file(@file)
flash[:notice] = 'Event was successfully created.'
format.html { redirect_to(@event) }
format.xml { render :xml => @event, :status => :created, :location => @event }
else
format.html { render :action => "new" }
format.xml { render :xml => @event.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end",
"def create_event event, data={}\n data[:event] = event\n post '/event', data\n end",
"def save_event(event)\n method = (event.id == nil || event.id == '') ? :post : :put\n query_string ... | [
"0.6938859",
"0.6832928",
"0.6629996",
"0.6572941",
"0.65628463",
"0.64595443",
"0.644994",
"0.6432171",
"0.64178646",
"0.64178646",
"0.64178646",
"0.64178646",
"0.6415361",
"0.6409476",
"0.6409476",
"0.6409476",
"0.6409476",
"0.6409476",
"0.637794",
"0.6374196",
"0.633384",
... | 0.0 | -1 |
PUT /events/1 PUT /events/1.xml | def update
@event = Event.find(params[:id])
if params[:event][:picture_location].kind_of? ActionController::UploadedStringIO
@file = params[:event][:picture_location]
File.open("#{RAILS_ROOT}/public/events/#{@file.original_filename}", "wb"){|f| f.write @file.read}
params[:event][:picture_location] = "/events/#{@file.original_filename}"
else
params[:event][:picture_location] = @event.picture_location
end
respond_to do |format|
if @event.update_attributes(params[:event])
flash[:notice] = 'Event was successfully updated.'
format.html { redirect_to(@event) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @event.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_event(event)\n method = (event.id == nil || event.id == '') ? :post : :put\n query_string = (method == :put) ? \"/#{event.id}\" : ''\n @connection.send(Addressable::URI.parse(events_url + query_string), method, event.to_xml)\n end",
"def put_events(args)\n\tapi_url = \"#{@base_url}/#{a... | [
"0.68006223",
"0.66227084",
"0.6586422",
"0.6582029",
"0.6582029",
"0.6582029",
"0.6582029",
"0.6582029",
"0.6582029",
"0.6582029",
"0.6538628",
"0.6528396",
"0.6528396",
"0.6528396",
"0.6528396",
"0.6504651",
"0.64950335",
"0.64886147",
"0.6481964",
"0.6477629",
"0.6464071",... | 0.0 | -1 |
DELETE /events/1 DELETE /events/1.xml | def destroy
@event = Event.find(params[:id])
@event.destroy
respond_to do |format|
format.html { redirect_to(events_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event.destroy\n respond_to do | format |\n format.html { redirect_to events_path }\n ... | [
"0.71272403",
"0.71019286",
"0.7034015",
"0.7034015",
"0.7018114",
"0.6961932",
"0.6954058",
"0.6954058",
"0.6908071",
"0.688388",
"0.6860901",
"0.6859833",
"0.68565935",
"0.68509364",
"0.67942625",
"0.6784313",
"0.67591745",
"0.6756506",
"0.67406136",
"0.67341024",
"0.672263... | 0.7095852 | 22 |
If user_one_id is always smaller than user_two_id, we always know how to look up the relationships for a given combination of users | def user_one_has_smaller_id
if user_one_id.to_i > user_two_id.to_i
self.errors.add(:user_one_id, :user_one_id_larger, "user_one_id must be the smaller than user_two_id.")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_relationships\n users = User.all\n user = users.first\n\n following = users[1..50] # all of the other users our first user should be following.\n followers = users[3..40] # all of the users that are following our first user.\n\n following.each { |followed| user.follow!(followed) }\n followers.each... | [
"0.64751005",
"0.63839495",
"0.6315147",
"0.63050514",
"0.6249573",
"0.6199855",
"0.61677456",
"0.6138669",
"0.6086289",
"0.60167694",
"0.5800661",
"0.56960475",
"0.56880766",
"0.56662697",
"0.56655467",
"0.5611116",
"0.55957997",
"0.5548916",
"0.55425143",
"0.55153525",
"0.5... | 0.61790586 | 6 |
after_filter :add_visit, :only => [:index] | def index
@entries = @wall.entries.limit(15)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_filter; end",
"def index\n index_filter\n end",
"def before_filter; end",
"def filter\n setup_instance_variables\n render 'index'\n end",
"def filter_redirect; end",
"def filter_redirect; end",
"def index\n super\n end",
"def index\n handle_view\n end",
"def index\n @... | [
"0.70698935",
"0.6924679",
"0.6830165",
"0.6807499",
"0.6568408",
"0.6568408",
"0.61760163",
"0.615979",
"0.6113233",
"0.6091317",
"0.6061638",
"0.60547686",
"0.60501486",
"0.5999248",
"0.5999248",
"0.5999248",
"0.59920114",
"0.5982916",
"0.5981882",
"0.5981882",
"0.5981882",... | 0.0 | -1 |
Increments the value pointed to from the key If the key is nil then it is initialized to amount An optional block may be given, which is passed +key+, and each key in the hash. The block should return true for the key you wish to increment. Examples: h = Hash.new h['foo'] = nil h.increment('foo') 1 h.increment('foo') 2 age = Hash.new age['0 18'] = 0 age['18 24'] = 0 age['24 99999'] = 0 increment the key where 18 is in range of the min and max age.increment(18) do |v, e| min, max = e.split(' ') v >= min.to_i && v < max.to_i end assert_equal(0, age['0 18']) assert_equal(1, age['18 24']) assert_equal(0, age['24 99999']) | def increment(key, amount=1, &block)
if block.nil?
key_to_use = key
else
key_to_use = self.keys.detect { |k| block.call(key, k) }
end
if self[key_to_use].nil?
self[key_to_use] = amount
else
self[key_to_use] += amount
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def incrby(key, increment); end",
"def incrby(key, increment); end",
"def incrby(key, increment)\n node_for(key).incrby(key, increment)\n end",
"def incr(key); end",
"def incr(key); end",
"def increment(key, amount = 1, options = {})\n invoke(:increment, key) do |store|\n alter(store,... | [
"0.6980712",
"0.6980712",
"0.68371296",
"0.6579625",
"0.6579625",
"0.6417474",
"0.6349763",
"0.6324647",
"0.6259782",
"0.6241858",
"0.61707723",
"0.61236584",
"0.61236584",
"0.6100169",
"0.6060157",
"0.60436255",
"0.60436255",
"0.60268813",
"0.60019165",
"0.60011065",
"0.5973... | 0.74691796 | 0 |
string_length_counter = sentence1.length 1 reversed_string = [] sentence1.collect do |letters| reversed_string << string_length_counter string_length_counter = 1 end reversed_string = [] string_length_counter = sentence1.length 1 split_string = sentence1.split("") end | def reverse_each_word(sentence1)
reverse_array=[]
split_sentence_array=sentence1.split(" ")
reversed=split_sentence_array.collect {|word| word.reverse}
reversed.join(" ")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reverse_each_word(sentence1)\r\nnew_array = []\r\nsentence1.split.collect do |words| new_array << \"#{words}\".reverse\r\n end\r\nnew_array.join(\" \")\r\nend",
"def reverse_a_string(string)\n puts \"Give me a sentence\"\n sentence = gets.chomp\n sentence_split = sentence.split \n p sentence_split\n re... | [
"0.7485462",
"0.74588835",
"0.74037427",
"0.739221",
"0.73737806",
"0.73463607",
"0.73272675",
"0.7326399",
"0.73178774",
"0.72945964",
"0.7273104",
"0.7211865",
"0.7205191",
"0.7177311",
"0.71583074",
"0.715178",
"0.7149642",
"0.7132642",
"0.7118217",
"0.7114164",
"0.7108141... | 0.7432545 | 2 |
Identify and describe the Ruby method(s) you implemented. each: This method iterates over each element in the array. After calling the method you must call "do" and in between || any variable name which you'll be using to refer to the element you want the code to do something to. It is convinient to call it something meaningful. include?: This method will check if the string it is being called on includes, the argument passed to it. It does not work on numbers. select!: This destructive method will keep in the array whathever elements meet the criteria in the argument. push: This method adds an element to an array. to_s: Transforms whatever it is being called to into a string. Person 2 | def my_array_modification_method!(source, thing_to_modify)
source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def my_array_finding_method(source, thing_to_find)\n make_string = source.map { |e| e.to_s }\n make_string.select { |e| e.include?(thing_to_find) }\nend",
"def my_array_finding_method(i_want_pets, thing_to_find)\n p i_want_pets.select { |value| value.to_s.include? thing_to_find }\nend",
"def my_array_find... | [
"0.57045865",
"0.5672088",
"0.5616467",
"0.5536172",
"0.5531668",
"0.5531668",
"0.5524372",
"0.550353",
"0.5462816",
"0.5460113",
"0.5457466",
"0.54573774",
"0.54555726",
"0.54052526",
"0.53675973",
"0.53566253",
"0.53489596",
"0.5332775",
"0.5325118",
"0.5302254",
"0.5274603... | 0.0 | -1 |
Identify and describe the Ruby method(s) you implemented. Person 3 | def my_array_sorting_method(source)
source # This line is here to make sure all tests initially fail. Delete it when you begin coding.
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def methods() end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def me... | [
"0.71895266",
"0.70606774",
"0.70606774",
"0.70606774",
"0.70606774",
"0.70606774",
"0.70606774",
"0.70606774",
"0.70606774",
"0.70606774",
"0.70606774",
"0.70606774",
"0.70606774",
"0.70315236",
"0.6946403",
"0.6946403",
"0.6946403",
"0.6946403",
"0.69151235",
"0.68842214",
... | 0.0 | -1 |
Identify and describe the Ruby method(s) you implemented. Person 4 | def my_array_deletion_method!(source, thing_to_delete)
source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def methods() end",
"def extract_method_details; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end"... | [
"0.7254233",
"0.7076545",
"0.70589155",
"0.70589155",
"0.70589155",
"0.70589155",
"0.70589155",
"0.70589155",
"0.70589155",
"0.70589155",
"0.70589155",
"0.70589155",
"0.70589155",
"0.70589155",
"0.69989115",
"0.69989115",
"0.69989115",
"0.69989115",
"0.69039017",
"0.6850014",
... | 0.0 | -1 |
Identify and describe the Ruby method(s) you implemented. Person 5 | def my_array_splitting_method(source)
source # This line is here to make sure all tests initially fail. Delete it when you begin coding.
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def methods() end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def me... | [
"0.7144192",
"0.7030672",
"0.7030672",
"0.7030672",
"0.7030672",
"0.7030672",
"0.7030672",
"0.7030672",
"0.7030672",
"0.7030672",
"0.7030672",
"0.7030672",
"0.7030672",
"0.6951385",
"0.68914163",
"0.68914163",
"0.68914163",
"0.68914163",
"0.6845223",
"0.6793544",
"0.6793544",... | 0.0 | -1 |
GET /profiles/1 GET /profiles/1.json | def show
@user = @profile.user.id
@reviews = Review.where(:profile_id => @profile.id).order("created_at DESC")
@average_rating = @reviews.average(:rating)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_default_profile \n get(\"/profiles.json/default\")\nend",
"def my_profiles\n @user = User.find(params[:user_id])\n @profiles = @user.profiles\n end",
"def show\n profile = Profile.find(params[:id])\n render status: 200, json: profile\n end",
"def index\n authorize Profile\n @profi... | [
"0.7775192",
"0.749174",
"0.7487005",
"0.7365681",
"0.73053837",
"0.730274",
"0.7301948",
"0.72442514",
"0.72312385",
"0.72312385",
"0.72312385",
"0.7217105",
"0.7217105",
"0.71651936",
"0.71406406",
"0.71140933",
"0.707894",
"0.7045284",
"0.701664",
"0.69901544",
"0.6978521"... | 0.0 | -1 |
POST /profiles POST /profiles.json | def create
params[:profile][:tag_list] = params[:profile][:tag_list]
@profile = Profile.new(profile_params)
@profile.user_id = current_user.id
# Store friendly profile URI
current_user.profile_uri = getUniqueURI(current_user)
current_user.save
respond_to do |format|
if @profile.save
format.html { redirect_to profile_path(@profile), notice: 'Profile was successfully created.' }
format.json { render :show, status: :created, location: @profile }
else
format.html { render :new }
format.json { render json: @profile.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @profile = current_user.profiles.build(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n ... | [
"0.73701555",
"0.7367171",
"0.72288865",
"0.71786684",
"0.7172963",
"0.7170674",
"0.71145105",
"0.7096289",
"0.707034",
"0.7002038",
"0.7002038",
"0.7002038",
"0.7002038",
"0.7002038",
"0.7002038",
"0.7002038",
"0.6997514",
"0.69700205",
"0.69617796",
"0.6937631",
"0.6937631"... | 0.68550336 | 37 |
PATCH/PUT /profiles/1 PATCH/PUT /profiles/1.json | def update
respond_to do |format|
if @profile.update(profile_params)
format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }
format.json { render :show, status: :ok, location: @profile }
else
format.html { render :edit }
format.json { render json: @profile.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @profiles = current_user.profiles.find(params[:id])\n\n respond_to do |format|\n if @profiles.update(profile_params)\n format.html { redirect_to profiles_path, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profiles }\n ... | [
"0.7385554",
"0.7121749",
"0.7113102",
"0.7096679",
"0.7091465",
"0.7091465",
"0.7091465",
"0.7076842",
"0.707045",
"0.7063198",
"0.70600575",
"0.7022012",
"0.70120174",
"0.699651",
"0.6985236",
"0.6985236",
"0.6985236",
"0.6985236",
"0.6979028",
"0.697453",
"0.6968044",
"0... | 0.6940231 | 37 |
DELETE /profiles/1 DELETE /profiles/1.json | def destroy
@profile.destroy
respond_to do |format|
format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n ... | [
"0.7739456",
"0.7739456",
"0.7739456",
"0.7707937",
"0.77065504",
"0.77065504",
"0.77065504",
"0.77065504",
"0.77065504",
"0.77065504",
"0.77065504",
"0.77065504",
"0.7706363",
"0.7704212",
"0.769637",
"0.7687797",
"0.7687588",
"0.7687588",
"0.76273435",
"0.7588475",
"0.75627... | 0.74744916 | 52 |
Use callbacks to share common setup or constraints between actions. | def set_profile
if params[:id].to_i != 0
@profile = Profile.find(params[:id])
# @user = User.find(params[:id])
else
@user = User.find_by_profile_uri(params[:id])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6164095",
"0.6046031",
"0.5945298",
"0.59179014",
"0.58890367",
"0.58341795",
"0.5776118",
"0.5700777",
"0.5700777",
"0.5656277",
"0.56218207",
"0.5423995",
"0.5411516",
"0.5411516",
"0.5411516",
"0.5395004",
"0.53783494",
"0.53593004",
"0.53412604",
"0.534078",
"0.5332865... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def profile_params
params.require(:profile).permit(:company_list, :industry_list, :tag_list, :image, :years_of_experience, :experience_level, :price, :portfolio_link, :linked_link, :location, :company, :title, :summary)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6979893",
"0.6781746",
"0.6746611",
"0.6742344",
"0.6735229",
"0.6592651",
"0.65027124",
"0.6498011",
"0.648163",
"0.647716",
"0.64556813",
"0.64386255",
"0.63784456",
"0.63756156",
"0.636574",
"0.6319542",
"0.63004524",
"0.6299559",
"0.62925464",
"0.62923217",
"0.6289894"... | 0.0 | -1 |
GET /friend_invites GET /friend_invites.xml | def index
@friend_invites = FriendInvite.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @friend_invites }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @user = User.find(params[:user_id]) \n @invitations = @user.invitations\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @invitations.to_xml }\n end\nend",
"def invitations\n\t\t@invits = current_user.receive_invites.order(\"id DESC\")\n\tend",
"def... | [
"0.6916717",
"0.6844989",
"0.6743942",
"0.67401826",
"0.6720286",
"0.6709978",
"0.6675588",
"0.6666562",
"0.66264033",
"0.6612731",
"0.6605473",
"0.65979743",
"0.6590543",
"0.6590543",
"0.6590543",
"0.6590543",
"0.6590543",
"0.6574244",
"0.65320206",
"0.6421544",
"0.64167786"... | 0.74392706 | 0 |
GET /friend_invites/1 GET /friend_invites/1.xml | def show
@friend_invite = FriendInvite.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @friend_invite }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @friend_invites = FriendInvite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @friend_invites }\n end\n end",
"def show\n @invite_friend = InviteFriend.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\... | [
"0.734871",
"0.70893246",
"0.6913218",
"0.6898154",
"0.6691045",
"0.66116476",
"0.6607192",
"0.6564615",
"0.6476136",
"0.64601004",
"0.6452081",
"0.6449752",
"0.6440474",
"0.64096445",
"0.6401935",
"0.63865715",
"0.63148916",
"0.6304589",
"0.6278377",
"0.6239744",
"0.6214679"... | 0.68945944 | 4 |
GET /friend_invites/new GET /friend_invites/new.xml | def new
@friend_invite = FriendInvite.new
respond_to do |format|
format.html {redirect_to invite_thank_you_path}
format.xml { render :xml => @friend_invite }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invite }\n end\n end",
"def new\n @invite_request = InviteRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @... | [
"0.731703",
"0.72240376",
"0.7124394",
"0.7035069",
"0.70196736",
"0.70196736",
"0.69675934",
"0.69675934",
"0.6859307",
"0.67454255",
"0.67084503",
"0.6706349",
"0.667743",
"0.66704726",
"0.6632762",
"0.6632762",
"0.6632762",
"0.6582353",
"0.6555207",
"0.65349543",
"0.649563... | 0.69714737 | 6 |
POST /friend_invites POST /friend_invites.xml | def create
@friend_invite = FriendInvite.new(params[:friend_invite])
respond_to do |format|
if @friend_invite.save
invite = ApplicationMailer.create_invite_mailer(params)
invite.set_content_type("text/html")
ApplicationMailer.deliver(invite)
format.html { redirect_to(invite_thank_you_path, :notice => 'Your invitation has been sent.') }
else
format.html { redirect_to invite_friend_path }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_should_create_invite_via_API_XML\r\n get \"/logout\"\r\n post \"/invites.xml\", :api_key=>'testapikey',\r\n :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@ema... | [
"0.6790766",
"0.6546351",
"0.651511",
"0.64166266",
"0.6415754",
"0.6291076",
"0.622905",
"0.62208724",
"0.61873686",
"0.61768925",
"0.6135564",
"0.6104391",
"0.610241",
"0.6099297",
"0.60697484",
"0.60518914",
"0.5991253",
"0.59707206",
"0.59477264",
"0.59004354",
"0.5892184... | 0.0 | -1 |
PUT /friend_invites/1 PUT /friend_invites/1.xml | def update
@friend_invite = FriendInvite.find(params[:id])
respond_to do |format|
if @friend_invite.update_attributes(params[:friend_invite])
format.html { redirect_to(@friend_invite, :notice => 'FriendInvite was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @friend_invite.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_should_update_invite_via_API_XML\r\n get \"/logout\"\r\n put \"/invites/1.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user... | [
"0.72037303",
"0.67752385",
"0.6380558",
"0.633506",
"0.6260861",
"0.6237299",
"0.62027264",
"0.61488986",
"0.6129216",
"0.6113481",
"0.61118686",
"0.61007553",
"0.6082273",
"0.6051589",
"0.6051589",
"0.6051589",
"0.60193217",
"0.6012262",
"0.59933674",
"0.59891045",
"0.59842... | 0.67864174 | 1 |
DELETE /friend_invites/1 DELETE /friend_invites/1.xml | def destroy
@friend_invite = FriendInvite.find(params[:id])
@friend_invite.destroy
respond_to do |format|
format.html { redirect_to(friend_invites_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @invite_friend = InviteFriend.find(params[:id])\n @invite_friend.destroy\n\n respond_to do |format|\n format.html { redirect_to invite_friends_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invite = Invite.find(params[:id])\n @invite.destroy\n\n respo... | [
"0.7367369",
"0.69668",
"0.6878382",
"0.6796715",
"0.669191",
"0.6686713",
"0.6582892",
"0.6523661",
"0.6523661",
"0.65087575",
"0.64569813",
"0.6446774",
"0.6394026",
"0.6394026",
"0.6394026",
"0.6394026",
"0.63845015",
"0.637915",
"0.637915",
"0.6369605",
"0.6358333",
"0.... | 0.7374037 | 0 |
has_many :customers define methods for other data we want to include in the JSON(like to call a method in the model) | def available_inventory
object.check_inventory
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def customers\n self.customers\n end",
"def customer_order\n order = current_user.restaurant.orders.find(params[:id])\n render json: order.as_json(include: [:customer, {order_details: {include: :meal}}]), status: :ok\n end",
"def related_customers\n ratings.customers\n end",
"def as_json(optio... | [
"0.63633573",
"0.6287434",
"0.6022965",
"0.5977957",
"0.5917495",
"0.5857673",
"0.5849566",
"0.58391845",
"0.5837148",
"0.5819272",
"0.58176994",
"0.57798135",
"0.5758697",
"0.5748838",
"0.57394737",
"0.57226324",
"0.5709107",
"0.56460124",
"0.56438136",
"0.56327236",
"0.5615... | 0.0 | -1 |
callback for create function | def require_no_authentication
assert_is_devise_resource!
return unless is_navigational_format?
no_input = devise_mapping.no_input_strategies
authenticated = if no_input.present?
args = no_input.dup.push :scope => resource_name
warden.authenticate?(*args)
else
warden.authenticated?(resource_name)
end
if authenticated && warden.user(resource_name)
render json: {
success: false,
error: "You already logged as #{ current_user.email }"
}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n \n end",
"def create; end",
"def create; end",
"def create; end",
"def create; end",
"def create\n \t\n end",
"def create\r\n\r\n\r\n end",
"def create\n \n end",
"def create\r\n end",
"def create\n run_callbacks :create do\n true\n end\n end",
"... | [
"0.7412077",
"0.7366489",
"0.7366489",
"0.7366489",
"0.7366489",
"0.7337582",
"0.7028147",
"0.701083",
"0.6968749",
"0.694277",
"0.6901445",
"0.68374276",
"0.6798814",
"0.6798814",
"0.6798814",
"0.6785291",
"0.6766384",
"0.6749261",
"0.67012906",
"0.6693949",
"0.6693949",
"... | 0.0 | -1 |
TODO: ensure admin area is accessible to admin | def test_comment_sanitization
full_tests = {
"hey `there`" => "<p>hey <code>there</code></p>",
"hey `<b>`" => "<p>hey <code><b></code></p>",
# this one is not desired, but it's safe and acceptable
"hey `<script>`" => "<p>hey <code><script></code></p>",
"hey `<link href=\"what\">`" => "<p>hey <code><link href=\"what\"></code></p>",
"hey <script>" => "<p>hey <script></script></p>",
"hey <script>yes</script>" => "<p>hey <script>yes</script></p>",
"hey <b>yes</b>" => "<p>hey <b>yes</b></p>",
}
full_tests.each do |input, output|
assert_equal output, routing.render_comment_body(input).strip
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin\n #TODO\n end",
"def admin_logic\n end",
"def admin\n end",
"def admin\n end",
"def admin\n end",
"def admin\n end",
"def admin\n\n end",
"def show\n\t\trequire_admin!\n\tend",
"def require_admin\n end",
"def show\n checkadmin\n end",
"def admin\n self.sitemap\... | [
"0.7987685",
"0.7905653",
"0.7890157",
"0.7890157",
"0.7890157",
"0.7890157",
"0.78491884",
"0.78207916",
"0.7506345",
"0.74201626",
"0.73916966",
"0.73326695",
"0.7308058",
"0.7307785",
"0.7289716",
"0.72761196",
"0.7199536",
"0.7198923",
"0.7198923",
"0.7188741",
"0.7181839... | 0.0 | -1 |
Initialize CatalogFieldMappings with a catalog name currently in Beta only | def initialize(catalog, conf = nil)
@catalog = catalog
super conf
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insertMapping(name, id)\n row = DatabaseManager.row('SYMPLECTIC_COLL_MAP')\n row.setColumn('key_text', name)\n row.setColumn('collection_id', id)\n DatabaseManager.insert(DSpace.context, row)\nend",
"def initialize(name)\n self.list_map_db = CartonDb::ListMapDb.new(name)\n end",
"def set_catalo... | [
"0.5574938",
"0.536709",
"0.5200782",
"0.51519376",
"0.51490414",
"0.50763553",
"0.5071118",
"0.50668305",
"0.5035048",
"0.5030631",
"0.50187093",
"0.49855518",
"0.49484232",
"0.49070257",
"0.48994124",
"0.48994124",
"0.48882502",
"0.48832053",
"0.48672557",
"0.48654768",
"0.... | 0.5291565 | 3 |
Get field mappings for a catalog | def get
Iterable.request(conf, base_path).get
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_flexi_fields_map\n self._flexi_fields_map ||=\n Hash[get_flexi_collection.fields.\n map { |_field| [_field.name.to_sym, _field] }]\n end",
"def fields\n field_map_class.new do |field_map|\n index_config.each { |name, index_field_config| field_map.insert(... | [
"0.6237863",
"0.62130094",
"0.62124634",
"0.59520185",
"0.57564276",
"0.57145846",
"0.57145846",
"0.56560385",
"0.56560385",
"0.5632446",
"0.5610524",
"0.5600444",
"0.55822104",
"0.5579219",
"0.55511475",
"0.5522536",
"0.5484111",
"0.5474731",
"0.5439302",
"0.5392655",
"0.536... | 0.0 | -1 |
gets all answers for the given question id | def create
questionId = params[:questionId]
answerId = params[:answerId]
answer = params[:answer]
numAnswers = params[:numAnswers].to_i
begin
success = ParseManager.createUserAnswer(answer, answerId, questionId)
numAnswers -= 1
end until numAnswers == 0
render json:success
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_answers_for_question(question_id)\n answers = Array.new\n question = Question.find_by_id(question_id, :include => :answers)\n question.answers.each do |ans|\n answers << ans\n end\n return answers\n end",
"def answers\n return Answer.where(question_id: self.id) \n end",
"def al... | [
"0.8286245",
"0.73799884",
"0.72958106",
"0.7107213",
"0.68788236",
"0.6818334",
"0.67468685",
"0.66474044",
"0.6608249",
"0.6598092",
"0.6516267",
"0.65018827",
"0.64631706",
"0.6420905",
"0.6408637",
"0.63946235",
"0.63900703",
"0.63855916",
"0.6349807",
"0.6319654",
"0.619... | 0.0 | -1 |
This fxn exists to provide the API consistent with John's request for the 689R class. Options may include a list of fragment classes as symbols (i.e. :b, :y) | def fragment(pep_seq, options={}) # TODO handle an intensity option to handle normalization and scaling...?
set_options(options) unless options.empty?
generate_fragment_masses(pep_seq)
@list.map(&:mass)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_options_with_class!(options, klass)\n options[:class] ||= ''\n options[:class] << \" #{klass}\"\n options\n end",
"def object_serialization_options\n {\n :except => [:site_id, :node_type, :position],\n :include => {\n :fields => {\n :except => [:variant_id, :posi... | [
"0.5170185",
"0.50379187",
"0.49283826",
"0.49068972",
"0.48953354",
"0.48782712",
"0.487401",
"0.48621804",
"0.48435414",
"0.48423022",
"0.4823746",
"0.47539607",
"0.4735918",
"0.47032008",
"0.46984053",
"0.46936542",
"0.46447563",
"0.46291554",
"0.46263087",
"0.46212554",
"... | 0.0 | -1 |
clears cache data once reading created by sidekiq | def clear_cache
$redis.del self.id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache_clear\n @client.flushall\n end",
"def cache_clear\n @dataset.delete\n end",
"def cache_clear\n @dataset.delete\n end",
"def clear_cache; end",
"def clear\n @cache.clear\n end",
"def clear\n cache.clear\n end",
"def clear_cache() ... | [
"0.7630013",
"0.7626285",
"0.7626285",
"0.74478716",
"0.74381894",
"0.7420034",
"0.73992175",
"0.7377624",
"0.7377624",
"0.7367263",
"0.7344208",
"0.7338464",
"0.72716314",
"0.7262069",
"0.725342",
"0.72002476",
"0.7196411",
"0.70716006",
"0.70246464",
"0.6997503",
"0.6953332... | 0.74469334 | 5 |
methods for returning wgs coordiates from | def wgs_coordinates
return @data["WGS_COORDINATES"] if @data["WGS_COORDINATES"]
query = Geocoder::Query.new(
coordinates, {
coord_in: 'utmk',
coord_out: 'wgs84'
})
lookup = Geocoder::Lookup::Olleh.new
wgs = lookup.search(query).first.converted_coord
@data["WGS_COORDINATES"] = wgs
wgs
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_WGS\n [@lat - @d_lat, @lon - @d_lon]\n end",
"def to_WGS84\n\n\t if @type == :ie\n\t @a = 6377340.189\n\t @b = 6356034.447\n else\n @a = 6377563.396\n @b = 6356256.909\n end\n\n @eSquared = ((@a * @a) - (@b * @b)) / (@a * @a)\n\n ... | [
"0.6932745",
"0.6696975",
"0.65165",
"0.6266386",
"0.62373936",
"0.62175196",
"0.61869127",
"0.6129023",
"0.61173135",
"0.6087097",
"0.59785604",
"0.5926055",
"0.59042066",
"0.58509505",
"0.58195496",
"0.5818461",
"0.57615054",
"0.57496005",
"0.57419395",
"0.57248914",
"0.572... | 0.72892433 | 0 |
methods for converting coord system | def coord_type
@data[1]['COORDTYPE']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_coord\n self[:to_coord].to_sym unless self[:to_coord].blank?\n end",
"def to_coordinates\n\n CGPointMake(self.x.to_coordinates, self.y.to_coordinates)\n end",
"def convert_coords(screen, x, y, z)\n\t\txd = x * $persp / (z + $space_size) + screen.width / 2\n\t\tyd = y * $persp / (z + $space_size... | [
"0.683111",
"0.6757375",
"0.6693201",
"0.6676919",
"0.66255313",
"0.6622134",
"0.66210645",
"0.65812904",
"0.65732133",
"0.6523067",
"0.650704",
"0.64561826",
"0.6397892",
"0.6352838",
"0.630922",
"0.62871784",
"0.62734216",
"0.61899614",
"0.61732113",
"0.6146312",
"0.6131277... | 0.0 | -1 |
methods for route search results total_time : minutes total_dist : meter | def total_time
@data[1]['ROUTE']['total_time']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_time(distance, mph)\n time = distance / mph \nend",
"def find_by_route\n @result = Array.new\n @distancias = Array.new\n\n @ride = Ride.order('id')\n if params[:radio] != '0'\n @ride.each do |p|\n distancia1 =Geocoder::Calculations.distance_between([params[:destLat... | [
"0.6728119",
"0.660959",
"0.6451124",
"0.63647413",
"0.63307196",
"0.6236405",
"0.62065125",
"0.6194379",
"0.61358",
"0.6112958",
"0.6109422",
"0.610727",
"0.6100607",
"0.60863256",
"0.60711616",
"0.60397583",
"0.6014585",
"0.5998915",
"0.5983809",
"0.5966727",
"0.5966727",
... | 0.608185 | 14 |
methods for converting coord system | def coord_type
@data[1]['COORDTYPE']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_coord\n self[:to_coord].to_sym unless self[:to_coord].blank?\n end",
"def to_coordinates\n\n CGPointMake(self.x.to_coordinates, self.y.to_coordinates)\n end",
"def convert_coords(screen, x, y, z)\n\t\txd = x * $persp / (z + $space_size) + screen.width / 2\n\t\tyd = y * $persp / (z + $space_size... | [
"0.683111",
"0.6757375",
"0.6693201",
"0.6676919",
"0.66255313",
"0.6622134",
"0.66210645",
"0.65812904",
"0.65732133",
"0.6523067",
"0.650704",
"0.64561826",
"0.6397892",
"0.6352838",
"0.630922",
"0.62871784",
"0.62734216",
"0.61899614",
"0.61732113",
"0.6146312",
"0.6131277... | 0.0 | -1 |
methods for parsing nearest position search | def position_address
"#{@data['SIDO']} #{@data['L_SIGUN_GU']} #{@data['L_DONG']} #{@data['GIBUN']}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grab_nearest_by_location(distance, loc)\n\n end",
"def positions(passes) = passes.map { find_position(_1) }",
"def explore(pos)\n end",
"def findnearest( coords, targetx, targety )\n # find nearest coordinate\n nearest = 0\n targetcounter = 0\n target = -1\n coords.each do |neighborx,neighbory|\n... | [
"0.6339187",
"0.62296534",
"0.6146507",
"0.61063534",
"0.60950625",
"0.60000217",
"0.5943372",
"0.5895443",
"0.58800095",
"0.58719075",
"0.58719075",
"0.58719075",
"0.58719075",
"0.58254457",
"0.58254457",
"0.5823336",
"0.58157164",
"0.5801092",
"0.579321",
"0.576223",
"0.569... | 0.0 | -1 |
Create a log message given a response Hash. | def response_message response
"%s %s: %s %s (%f)\n%s" % [
*response[:_response_meta].slice(
:request_method, :request_url, :status_code, :status_message, :total_time
).values,
Yajl::Encoder.encode(response.except(:_response_meta))
]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_message(response)\n return if response.nil?\n\n message = \"#{response[:method].to_s.upcase} \"\n message << \"#{response[:url]}: \"\n message << \"#{@status} - #{format_response}\"\n message\n end",
"def build_response(response)\n \"HTTP/1.1 #{response[:stat... | [
"0.67554885",
"0.59179956",
"0.56001985",
"0.5595342",
"0.5567572",
"0.5535381",
"0.55058026",
"0.5470559",
"0.54417294",
"0.5432932",
"0.5432932",
"0.537138",
"0.53340644",
"0.5330785",
"0.5326451",
"0.52752334",
"0.5267429",
"0.5263246",
"0.5259962",
"0.5255423",
"0.5254488... | 0.5443789 | 8 |
Add more helper methods to be used by all tests here... | def age_token(user, client_id)
if user.tokens[client_id]
user.tokens[client_id]['updated_at'] = Time.now - (DeviseTokenAuth.batch_request_buffer_throttle + 10.seconds)
user.save!
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_legacy_helpers\n assert_equal @patron.primary_phone, @patron.primary_address_phone\n assert_equal @patron.secondary_phone, @patron.secondary_address_phone\n assert_nil @patron.primary_address_mobile_phone\n assert_nil @patron.secondary_address_mobile_phone\n end",
"def helpers; end",
"def... | [
"0.7330966",
"0.701972",
"0.701972",
"0.701972",
"0.6772961",
"0.6679903",
"0.6679903",
"0.6583205",
"0.65507036",
"0.6377433",
"0.63762784",
"0.632961",
"0.6280821",
"0.6280821",
"0.6249786",
"0.6142927",
"0.6137607",
"0.6121912",
"0.6108209",
"0.60972595",
"0.60949636",
"... | 0.0 | -1 |
Gets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. | def additional_data
return @additional_data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [] | [] | 0.0 | -1 |
Sets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. | def additional_data=(value)
@additional_data = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [] | [] | 0.0 | -1 |
Gets the allowMultipleLines property value. Whether to allow multiple lines of text. | def allow_multiple_lines
return @allow_multiple_lines
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allow_multiple_lines=(value)\n @allow_multiple_lines = value\n end",
"def multiline_token_support\n attributes.fetch(:multilineTokenSupport)\n end",
"def multi_line?\n @buffer.is_a?(Array)\n end",
"def is_multiline?(text)\n text && text.length > 1 &&... | [
"0.83213437",
"0.6415545",
"0.6138348",
"0.5735378",
"0.57066154",
"0.5676352",
"0.56335616",
"0.56022626",
"0.5424472",
"0.5401344",
"0.53951806",
"0.5367026",
"0.5353544",
"0.5349827",
"0.5349827",
"0.5339627",
"0.53288686",
"0.5285873",
"0.5281335",
"0.5239974",
"0.5231438... | 0.84840107 | 0 |
Sets the allowMultipleLines property value. Whether to allow multiple lines of text. | def allow_multiple_lines=(value)
@allow_multiple_lines = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allow_multiple_lines\n return @allow_multiple_lines\n end",
"def multiline_lines=(multiline_lines)\n if !multiline_lines.nil? && multiline_lines < 0\n fail ArgumentError, 'invalid value for \"multiline_lines\", must be greater than or equal to 0.'\n end\n\n @mu... | [
"0.7993178",
"0.62009764",
"0.56984085",
"0.56431687",
"0.5592195",
"0.5544511",
"0.54977125",
"0.53569794",
"0.53569794",
"0.53287387",
"0.53287387",
"0.53220814",
"0.52856916",
"0.52822673",
"0.5212219",
"0.5207211",
"0.50223595",
"0.5006243",
"0.5001838",
"0.49701497",
"0.... | 0.88923717 | 0 |
Gets the appendChangesToExistingText property value. Whether updates to this column should replace existing text, or append to it. | def append_changes_to_existing_text
return @append_changes_to_existing_text
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append_changes_to_existing_text=(value)\n @append_changes_to_existing_text = value\n end",
"def additional_text_edits\n attributes.fetch(:additionalTextEdits)\n end",
"def additional_text_edits\n attributes.fetch(:additionalTextEdits)\n end",
"def... | [
"0.72567743",
"0.58929497",
"0.58929497",
"0.5761123",
"0.55316764",
"0.54123366",
"0.53945076",
"0.53904986",
"0.5349387",
"0.532613",
"0.5142969",
"0.50899434",
"0.50684637",
"0.50627446",
"0.4886818",
"0.47832555",
"0.47832555",
"0.47768778",
"0.47673687",
"0.4765066",
"0.... | 0.75926095 | 0 |
Sets the appendChangesToExistingText property value. Whether updates to this column should replace existing text, or append to it. | def append_changes_to_existing_text=(value)
@append_changes_to_existing_text = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append_changes_to_existing_text\n return @append_changes_to_existing_text\n end",
"def append(appended_text = '')\n @text << ' ' << appended_text\n end",
"def appendtext(value)\n merge(appendtext: value.to_s)\n end",
"def new_text=(value)\n ... | [
"0.7114637",
"0.57877344",
"0.5679415",
"0.558914",
"0.5397085",
"0.5391201",
"0.50902903",
"0.5037438",
"0.49652958",
"0.48512244",
"0.48512244",
"0.48472497",
"0.48314473",
"0.48263013",
"0.4817114",
"0.4730583",
"0.47024634",
"0.46789056",
"0.4633324",
"0.4630135",
"0.4629... | 0.7766487 | 0 |
Instantiates a new textColumn and sets the default values. | def initialize()
@additional_data = Hash.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(text, line, column)\n @text = text\n @line = line\n @column = column\n end",
"def initialize(text, line, column)\n @text = text\n @line = line\n @column = column\n end",
"def set_column (text, data_index, filter=nil, xtype=nil, tpl=nil, renderer=nil)\n\t\tcolumnHash =... | [
"0.62656325",
"0.6191882",
"0.6101368",
"0.582297",
"0.5794146",
"0.5753911",
"0.57014453",
"0.56821734",
"0.5680624",
"0.56597483",
"0.5562005",
"0.5467814",
"0.54616696",
"0.54570836",
"0.5414983",
"0.5408143",
"0.54037803",
"0.5377013",
"0.537621",
"0.5372852",
"0.53611815... | 0.0 | -1 |
The deserialization information for the current model | def get_field_deserializers()
return {
"allowMultipleLines" => lambda {|n| @allow_multiple_lines = n.get_boolean_value() },
"appendChangesToExistingText" => lambda {|n| @append_changes_to_existing_text = n.get_boolean_value() },
"linesForEditing" => lambda {|n| @lines_for_editing = n.get_number_value() },
"maxLength" => lambda {|n| @max_length = n.get_number_value() },
"@odata.type" => lambda {|n| @odata_type = n.get_string_value() },
"textType" => lambda {|n| @text_type = n.get_string_value() },
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deserialized\n @deserialized ||= @serializer.deserialize @serialized_object\n end",
"def get_field_deserializers()\n return super.merge({\n \"detectionStatus\" => lambda {|n| @detection_status = n.get_enum_value(MicrosoftGraph::Models::SecurityDetectionStatus) },... | [
"0.6510734",
"0.63224316",
"0.6322254",
"0.63094735",
"0.62954384",
"0.6238735",
"0.6232461",
"0.62155676",
"0.6200175",
"0.6199403",
"0.6173917",
"0.61733985",
"0.61705345",
"0.61631054",
"0.61620396",
"0.6158031",
"0.6156071",
"0.6142402",
"0.613998",
"0.6138061",
"0.612005... | 0.596824 | 46 |
Gets the linesForEditing property value. The size of the text box. | def lines_for_editing
return @lines_for_editing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lines_for_editing=(value)\n @lines_for_editing = value\n end",
"def max_lines\n (contents.width / line_height) - 1\n end",
"def lines\n @lines ||= Vedeu::Editor::Lines.coerce(data)\n end",
"def height\n lines.size\n end",
"def height\n lines.... | [
"0.71317625",
"0.5916596",
"0.5855405",
"0.5706847",
"0.5706847",
"0.5629682",
"0.5605443",
"0.55275047",
"0.54887915",
"0.5383004",
"0.536081",
"0.53225744",
"0.52563536",
"0.52533966",
"0.5248578",
"0.521122",
"0.51969016",
"0.515944",
"0.51562744",
"0.5149807",
"0.51367706... | 0.7022846 | 1 |
Sets the linesForEditing property value. The size of the text box. | def lines_for_editing=(value)
@lines_for_editing = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lines_for_editing\n return @lines_for_editing\n end",
"def tabsize=(value)\n\t\t\teditor.tabsize= value\n\t\tend",
"def set_iline( string = \"\" )\n return if @testing\n Curses::curs_set 0\n @win_interaction.setpos( 0, 0 )\n @win_interaction.addstr( \"%-#{Curs... | [
"0.57657236",
"0.5531479",
"0.5376552",
"0.5371425",
"0.5370802",
"0.53644997",
"0.5220621",
"0.5202362",
"0.5171742",
"0.5160064",
"0.5160053",
"0.5148227",
"0.5131868",
"0.49475008",
"0.49388665",
"0.48577872",
"0.4838324",
"0.4826996",
"0.482041",
"0.4816033",
"0.4813137",... | 0.76545715 | 0 |
Gets the maxLength property value. The maximum number of characters for the value. | def max_length
return @max_length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maximal_length\n if !self.value.blank? && self.maxLength\n errors.add(:value, 'is too long!') if self.value.length > self.maxLength\n end\n end",
"def max_length\n MAX_LENGTH\n end",
"def max_length=(value)\n @max_length = value\n end",
"def set_MaxLength... | [
"0.8447109",
"0.82382596",
"0.80090624",
"0.7692626",
"0.7692626",
"0.7692626",
"0.7692626",
"0.7687205",
"0.7569953",
"0.7223672",
"0.7191999",
"0.7089905",
"0.703267",
"0.7024757",
"0.68754363",
"0.68093157",
"0.6791841",
"0.6719554",
"0.6642381",
"0.66059464",
"0.6605477",... | 0.8345751 | 1 |
Sets the maxLength property value. The maximum number of characters for the value. | def max_length=(value)
@max_length = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_MaxLength(value)\n set_input(\"MaxLength\", value)\n end",
"def set_MaxLength(value)\n set_input(\"MaxLength\", value)\n end",
"def set_MaxLength(value)\n set_input(\"MaxLength\", value)\n end",
"def set_MaxLength(value)\n set_input(\"MaxLength... | [
"0.8746794",
"0.8746794",
"0.8746794",
"0.8746794",
"0.7654556",
"0.75876635",
"0.7441334",
"0.7243818",
"0.71112627",
"0.7097908",
"0.6882856",
"0.6882856",
"0.6882856",
"0.6822817",
"0.6822817",
"0.6822817",
"0.6822817",
"0.6822817",
"0.6822817",
"0.6822817",
"0.6822817",
... | 0.85988724 | 4 |
Serializes information the current object | def serialize(writer)
raise StandardError, 'writer cannot be null' if writer.nil?
writer.write_boolean_value("allowMultipleLines", @allow_multiple_lines)
writer.write_boolean_value("appendChangesToExistingText", @append_changes_to_existing_text)
writer.write_number_value("linesForEditing", @lines_for_editing)
writer.write_number_value("maxLength", @max_length)
writer.write_string_value("@odata.type", @odata_type)
writer.write_string_value("textType", @text_type)
writer.write_additional_data(@additional_data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize\n end",
"def serialize(object) end",
"def serialize; end",
"def serialize; end",
"def serialize\n \n end",
"def serialize\n raise NotImplementedError\n end",
"def serialize\n raise NotImplementedError\n end",
"def dump\r\n super + to_s\r\n end",
... | [
"0.7951372",
"0.7645999",
"0.7579812",
"0.7579812",
"0.7440032",
"0.720861",
"0.720861",
"0.7207583",
"0.7016516",
"0.70007193",
"0.6992252",
"0.69838214",
"0.69723576",
"0.69666415",
"0.69666415",
"0.6942002",
"0.69417155",
"0.6933786",
"0.6913977",
"0.6891677",
"0.68810964"... | 0.0 | -1 |
Gets the textType property value. The type of text being stored. Must be one of plain or richText | def text_type
return @text_type
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def text_type=(value)\n @text_type = value\n end",
"def text_type\n @@text_type_ord_to_text_type[self.text_type_ord]\n end",
"def text_type=(value)\n self.text_type_ord = @@text_type_to_text_type_ord[value]\n end",
"def is_texttype?(); @type == GRT_TEXTTYPE; end",
... | [
"0.83617353",
"0.831395",
"0.7824582",
"0.7276367",
"0.6920246",
"0.68734324",
"0.6691693",
"0.6578273",
"0.6530198",
"0.6499831",
"0.63302773",
"0.61271894",
"0.6106904",
"0.5977403",
"0.589898",
"0.5881678",
"0.5789869",
"0.57623094",
"0.57556695",
"0.5728864",
"0.5725433",... | 0.86564493 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.