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 |
|---|---|---|---|---|---|---|
PUT /top_menus/1 PUT /top_menus/1.xml | def update
@top_menu = TopMenu.find(params[:id])
respond_to do |format|
if @top_menu.update_attributes(params[:top_menu])
flash[:notice] = 'TopMenu was successfully updated.'
format.html { redirect_to(@top_menu) }
format.xml { head :ok }
else
format.html { render :a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @menu_item = MenuItem.find(params[:id])\n\n respond_to do |format|\n if uhook_update_menu_item(@menu_item)\n flash[:notice] = t('ubiquo.menus.sitemap_updated')\n format.html { redirect_to(ubiquo_menu_items_path) }\n format.xml { head :ok }\n else\n flash[:e... | [
"0.632901",
"0.6314483",
"0.63054293",
"0.629356",
"0.6290709",
"0.6290709",
"0.6290709",
"0.6290709",
"0.6189342",
"0.6180102",
"0.6137505",
"0.61203146",
"0.6113594",
"0.6053739",
"0.6023369",
"0.6000966",
"0.6000806",
"0.593913",
"0.5928133",
"0.5923923",
"0.5886376",
"0... | 0.71934277 | 0 |
DELETE /top_menus/1 DELETE /top_menus/1.xml | def destroy
@top_menu = TopMenu.find(params[:id])
@top_menu.destroy
respond_to do |format|
format.html { redirect_to(top_menus_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @menu = Menu.find(params[:id])\n @menu.destroy\n\t \n respond_to do |format|\n format.html { redirect_to(menus_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @menu = Menu.find(params[:id])\n @menu.destroy\n\n respond_to do |format|\n format.html ... | [
"0.69103146",
"0.6850569",
"0.6846406",
"0.6832385",
"0.6813448",
"0.6770644",
"0.6713109",
"0.66989785",
"0.6623276",
"0.659216",
"0.6590314",
"0.653764",
"0.65283144",
"0.6480373",
"0.6478835",
"0.64753336",
"0.64356166",
"0.6426243",
"0.64042795",
"0.63951087",
"0.6394833"... | 0.7189245 | 0 |
executes the connection if the arguments match | def try args
# the argument conditions matched
@blk.call *args if match? args
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute(*args)\n friendly_name = args[0]\n connection_info = args[1]\n\n return all unless friendly_name\n delegate(friendly_name, connection_info)\n end",
"def execute_query(sql, args)\n\t\t\t\t\t@db.log_connection_yield(sql, self, args){args ? self.async_exec(sql, args) : self.asyn... | [
"0.68335134",
"0.6104026",
"0.59829855",
"0.5970492",
"0.59658456",
"0.59260046",
"0.59149253",
"0.5849628",
"0.58461386",
"0.58339953",
"0.5793814",
"0.5782586",
"0.5762568",
"0.57589775",
"0.56875837",
"0.5662337",
"0.5660602",
"0.5652283",
"0.5616386",
"0.5598863",
"0.5590... | 0.0 | -1 |
:any is a condition that always matches returns the new connection (that can be useful later to delete it) | def on_event event, *args_cond, &blk
# in first call initialize @event_connections
@event_connections = Hash.new(Set.new) if @event_connections.nil?
new_conn = HH::EventConnection.new event, args_cond, &blk
@event_connections[event] += [new_conn]
#debug "#{new_conn} added"
#emit :new_event_conne... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def any\n con = @connections[rand(@connections.length)]\n if block_given?\n yield con\n else\n con\n end\n end",
"def any_raw_connection\n @raw_connection || valid_raw_connection\n end",
"def all_connections\n yield @conn.first if @conn\n end",
"def ex... | [
"0.6586675",
"0.6545786",
"0.5975575",
"0.59430224",
"0.5804205",
"0.57386565",
"0.56829685",
"0.56104183",
"0.5569609",
"0.55111426",
"0.5471555",
"0.5461563",
"0.54329264",
"0.5400737",
"0.53838587",
"0.5362495",
"0.53452045",
"0.5335859",
"0.53325564",
"0.5315534",
"0.5314... | 0.54447496 | 12 |
GET /my_cvs GET /my_cvs.json | def index
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @cvs = Cv.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cvs }\n end\n end",
"def index\n @cvs = Cv.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cvs }\n ... | [
"0.6411343",
"0.6411343",
"0.63516605",
"0.63173515",
"0.6269345",
"0.6210472",
"0.6205684",
"0.6190279",
"0.6165491",
"0.6165491",
"0.6158682",
"0.6140083",
"0.61375576",
"0.605609",
"0.60512817",
"0.6046386",
"0.6025219",
"0.6020452",
"0.59997445",
"0.5990619",
"0.59777087"... | 0.0 | -1 |
GET /my_cvs/1 GET /my_cvs/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @csv = Csv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @csv }\n end\n end",
"def index\n @cvs = Cv.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cvs }\... | [
"0.63668716",
"0.6155676",
"0.6155676",
"0.61290824",
"0.60915947",
"0.6022015",
"0.60146636",
"0.58855855",
"0.58855855",
"0.5880981",
"0.58800197",
"0.58443105",
"0.58388346",
"0.5824022",
"0.5795927",
"0.5789033",
"0.57780397",
"0.57641226",
"0.57558507",
"0.5744086",
"0.5... | 0.0 | -1 |
POST /my_cvs POST /my_cvs.json | def create
@my_cv = MyCv.new(my_cv_params)
respond_to do |format|
if @my_cv.save
format.html { redirect_to @my_cv, notice: 'My cv was successfully created.' }
format.json { render :show, status: :created, location: @my_cv }
else
format.html { render :new }
format.jso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def postEntityBulkCsv( filedata)\n params = Hash.new\n params['filedata'] = filedata\n return doCurl(\"post\",\"/entity/bulk/csv\",params)\n end",
"def export\n headers = JSON[params[:column_array]]\n rows = JSON[params[:row_array]]\n column_names = Array.new\n headers.each do |col|\n ... | [
"0.6022466",
"0.56225675",
"0.5614967",
"0.54706836",
"0.5466791",
"0.54501754",
"0.5426591",
"0.5426021",
"0.5416774",
"0.5403759",
"0.5372391",
"0.535391",
"0.5351444",
"0.53249407",
"0.5312718",
"0.52447623",
"0.52411735",
"0.5222332",
"0.5202818",
"0.5193996",
"0.5185114"... | 0.0 | -1 |
PATCH/PUT /my_cvs/1 PATCH/PUT /my_cvs/1.json | def update
respond_to do |format|
if @my_cv.update(my_cv_params)
format.html { redirect_to @my_cv, notice: 'My cv was successfully updated.' }
format.json { render :show, status: :ok, location: @my_cv }
else
format.html { render :edit }
format.json { render json: @my_cv.e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => ... | [
"0.6127421",
"0.580229",
"0.579714",
"0.5760648",
"0.5739394",
"0.5684298",
"0.5634248",
"0.5609227",
"0.5594514",
"0.5581622",
"0.55648065",
"0.5550822",
"0.5540473",
"0.5497106",
"0.5485396",
"0.54765177",
"0.5468778",
"0.5468778",
"0.54621226",
"0.54448587",
"0.543447",
... | 0.52103287 | 54 |
DELETE /my_cvs/1 DELETE /my_cvs/1.json | def destroy
@my_cv.destroy
respond_to do |format|
format.html { redirect_to my_cvs_url, notice: 'My cv was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @csv = Csv.find(params[:id])\n @csv.destroy\n\n respond_to do |format|\n format.html { redirect_to csvs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @csv_file = CsvFile.find(params[:id])\n @csv_file.destroy\n\n respond_to do |format|\n f... | [
"0.6609228",
"0.64587283",
"0.6304385",
"0.622321",
"0.6170572",
"0.61592263",
"0.614689",
"0.61330384",
"0.6108112",
"0.6099616",
"0.60768783",
"0.60524577",
"0.60247165",
"0.6020342",
"0.60003686",
"0.599854",
"0.59887326",
"0.59887326",
"0.5964407",
"0.596325",
"0.5960245"... | 0.6266653 | 3 |
Use callbacks to share common setup or constraints between actions. | def set_my_cv
@my_cv = MyCv.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 my_cv_params
params.fetch(:my_cv, {})
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.6980384",
"0.6782743",
"0.6746196",
"0.6742575",
"0.6736",
"0.6594004",
"0.65037984",
"0.6496699",
"0.64819324",
"0.64791185",
"0.6456292",
"0.64403296",
"0.63795286",
"0.6375975",
"0.6365291",
"0.63210756",
"0.6300542",
"0.6299717",
"0.62943304",
"0.6292561",
"0.6290683",... | 0.0 | -1 |
GET /cours GET /cours.json | def index
@cours = Cour.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @courts = Court.by_name\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courts }\n end\n end",
"def show\n @court = Court.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json:... | [
"0.7937811",
"0.7689072",
"0.7597698",
"0.7337674",
"0.7317332",
"0.71578103",
"0.7137326",
"0.71024925",
"0.70347553",
"0.70347553",
"0.70241255",
"0.69868535",
"0.6973225",
"0.696184",
"0.69473886",
"0.6931684",
"0.6918508",
"0.6917514",
"0.68833226",
"0.68764555",
"0.68701... | 0.7225956 | 5 |
GET /cours/1 GET /cours/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @court = Court.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @court }\n end\n end",
"def index\n @courts = Court.by_name\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: ... | [
"0.79235655",
"0.78617215",
"0.75764483",
"0.7471491",
"0.72778654",
"0.7197549",
"0.7165486",
"0.71375126",
"0.7127398",
"0.699773",
"0.6996515",
"0.69663846",
"0.6963188",
"0.6963188",
"0.6963188",
"0.6963188",
"0.6963188",
"0.6963188",
"0.69529766",
"0.69518846",
"0.695074... | 0.0 | -1 |
POST /cours POST /cours.json | def create
params[:cour][:ecole_id] = ecole.id if ecole?
#Ajout de la classe en groupe
params[:cour][:classe_room_id].unshift(params[:cour][:first_classe_room_id])
@creneau = params[:cour][:creneau_debut].to_i
@nombre_heure = params[:cour][:creneau_fin].to_i - params[:cour][:creneau_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @court = Court.new(params[:court])\n\n respond_to do |format|\n if @court.save\n format.html { redirect_to @court, notice: 'Court was successfully created.' }\n format.json { render json: @court, status: :created, location: @court }\n else\n format.html { render ac... | [
"0.7497775",
"0.7415521",
"0.7075326",
"0.7074207",
"0.705048",
"0.69766545",
"0.68226254",
"0.67933404",
"0.6598003",
"0.6578499",
"0.65570635",
"0.6546124",
"0.6534781",
"0.6502597",
"0.6470315",
"0.6430534",
"0.64242977",
"0.6412038",
"0.6410684",
"0.6402201",
"0.63982266"... | 0.6163879 | 70 |
PATCH/PUT /cours/1 PATCH/PUT /cours/1.json | def update
respond_to do |format|
if @cour.update(cour_params)
format.html { redirect_to @cour, notice: 'Time table was successfully updated.' }
format.json { render :show, status: :ok, location: @cour }
else
format.html { render :edit }
format.json { render json: @cour.e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @court = Court.find(params[:id])\n\n respond_to do |format|\n if @court.update_attributes(params[:court])\n format.html { redirect_to @court, notice: 'Court was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit... | [
"0.7166964",
"0.69608766",
"0.6829402",
"0.6826383",
"0.6665849",
"0.66395736",
"0.6563518",
"0.651923",
"0.65129983",
"0.6475539",
"0.64570355",
"0.6441262",
"0.6393419",
"0.63925433",
"0.63730115",
"0.63730115",
"0.6367086",
"0.63614196",
"0.63614196",
"0.63614196",
"0.6361... | 0.65952927 | 6 |
DELETE /cours/1 DELETE /cours/1.json | def destroy
@cour.destroy
respond_to do |format|
format.html { redirect_to cours_url, notice: 'Time table was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @court = Court.find(params[:id])\n @court.destroy\n\n respond_to do |format|\n format.html { redirect_to courts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @concour = Concour.find(params[:id])\n @concour.destroy\n\n respond_to do |format|\n ... | [
"0.7772591",
"0.7494277",
"0.74773806",
"0.7436032",
"0.7373102",
"0.7338597",
"0.7335299",
"0.7180881",
"0.71604013",
"0.7125698",
"0.7103116",
"0.7053597",
"0.7024754",
"0.7001528",
"0.69924736",
"0.6980457",
"0.6971676",
"0.6966079",
"0.6964703",
"0.69583946",
"0.69583946"... | 0.7345408 | 5 |
Request ajax pour les matieres par rapport a une classe | def matieres
@classe = ClasseRoom.find(params[:id_classe])
@matieres = @classe.matieres.all
if request.xhr?
render :partial => 'matieres', locals: {:matieres => @matieres}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_ajax\n @ajax = Ajax.find(params[:id])\n end",
"def index\n @ajaxes = Ajax.all\n end",
"def ocRecibir\n id = params[:id]\n ocClass = Oc.new\n result = ocClass.recibirOC(id) \n render :json => {:aceptado => result, :idoc => id} \n\n end",
"def camiones\n logger.info 'en c... | [
"0.6200452",
"0.6059195",
"0.60206294",
"0.5843768",
"0.5723455",
"0.5659972",
"0.56199867",
"0.5607161",
"0.55788904",
"0.55769986",
"0.5570233",
"0.55488765",
"0.5512759",
"0.55118906",
"0.55107474",
"0.55093956",
"0.5495089",
"0.54907805",
"0.5484914",
"0.5473539",
"0.5467... | 0.63314766 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_cour
@cour = Cour.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 cour_params
params.require(:cour).permit(:enseignant_id, :matiere_id, :salle_id, :creneau_debut, :creneau_fin, :jour_id, :nombre_heure, :numero_cours, :numero_cours_g, :annee_id, :ecole_id, :semestre_id, :user_id, :first_classe_room_id, :classe_room_id)
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.6980384",
"0.6782743",
"0.6746196",
"0.6742575",
"0.6736",
"0.6594004",
"0.65037984",
"0.6496699",
"0.64819324",
"0.64791185",
"0.6456292",
"0.64403296",
"0.63795286",
"0.6375975",
"0.6365291",
"0.63210756",
"0.6300542",
"0.6299717",
"0.62943304",
"0.6292561",
"0.6290683",... | 0.0 | -1 |
GET /ocupations/1 GET /ocupations/1.xml | def show
@ocupation = Ocupation.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @ocupation }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @socioeconomic_ocupation = SocioeconomicOcupation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @socioeconomic_ocupation }\n end\n end",
"def index\n @ocupations = Ocupation.all\n end",
"def index\n @has_ocupation... | [
"0.6790965",
"0.6476865",
"0.6170878",
"0.61315924",
"0.61057764",
"0.6094056",
"0.60913074",
"0.60798764",
"0.607963",
"0.60550696",
"0.60216063",
"0.6002889",
"0.59724796",
"0.59591585",
"0.5958458",
"0.5935473",
"0.59258676",
"0.59021676",
"0.58776015",
"0.58676744",
"0.58... | 0.6930736 | 0 |
GET /ocupations/new GET /ocupations/new.xml | def new
@ocupation = Ocupation.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @ocupation }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end",
"def new\n @omatsuri = Omatsuri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @omatsuri }\n end\n end",
"def n... | [
"0.73057485",
"0.71672004",
"0.7144566",
"0.70368457",
"0.6906072",
"0.68498653",
"0.6843003",
"0.6812067",
"0.6811108",
"0.679478",
"0.6771034",
"0.6760634",
"0.67339236",
"0.6720273",
"0.67166007",
"0.6713132",
"0.6701063",
"0.6687514",
"0.6680076",
"0.66765267",
"0.6672924... | 0.749265 | 0 |
POST /ocupations POST /ocupations.xml | def create
@ocupation = Ocupation.new(params[:ocupation])
respond_to do |format|
if @ocupation.save
format.html { redirect_to(@ocupation, :notice => 'Ocupation was successfully created.') }
format.xml { render :xml => @ocupation, :status => :created, :location => @ocupation }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @ocupation = Ocupation.new(ocupation_params)\n\n respond_to do |format|\n if @ocupation.save\n format.html { redirect_to @ocupation, notice: 'Ocupation was successfully created.' }\n format.json { render :show, status: :created, location: @ocupation }\n else\n form... | [
"0.62676764",
"0.6061635",
"0.5767977",
"0.5756089",
"0.57539666",
"0.5698497",
"0.5642777",
"0.55888253",
"0.55632687",
"0.5555623",
"0.55305827",
"0.5456165",
"0.54385304",
"0.54368865",
"0.54179543",
"0.54081476",
"0.5349922",
"0.5347773",
"0.5346056",
"0.53235614",
"0.531... | 0.66049844 | 0 |
PUT /ocupations/1 PUT /ocupations/1.xml | def update
@ocupation = Ocupation.find(params[:id])
respond_to do |format|
if @ocupation.update_attributes(params[:ocupation])
format.html { redirect_to(@ocupation, :notice => 'Ocupation was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @socioeconomic_ocupation = SocioeconomicOcupation.find(params[:id])\n\n respond_to do |format|\n if @socioeconomic_ocupation.update_attributes(params[:socioeconomic_ocupation])\n format.html { redirect_to(@socioeconomic_ocupation, :notice => 'SocioeconomicOcupation was successfully u... | [
"0.6224686",
"0.6187895",
"0.6112555",
"0.60966593",
"0.6055364",
"0.60510063",
"0.60175747",
"0.59249896",
"0.5857469",
"0.58312875",
"0.57838434",
"0.57724816",
"0.5768908",
"0.57645357",
"0.57396317",
"0.57268506",
"0.56922543",
"0.5669611",
"0.5646307",
"0.5632905",
"0.56... | 0.6459338 | 0 |
DELETE /ocupations/1 DELETE /ocupations/1.xml | def destroy
@ocupation = Ocupation.find(params[:id])
@ocupation.destroy
respond_to do |format|
format.html { redirect_to(ocupations_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @socioeconomic_ocupation = Socioecon... | [
"0.6760789",
"0.675016",
"0.6699093",
"0.66819334",
"0.6637858",
"0.65412605",
"0.6481246",
"0.64416707",
"0.6423068",
"0.63616216",
"0.6345628",
"0.633338",
"0.633338",
"0.6331698",
"0.6299551",
"0.62822",
"0.62810636",
"0.6281048",
"0.6277849",
"0.62769943",
"0.6276367",
... | 0.7159489 | 0 |
def collection authorize! :read, Scheduler::ShiftAssignment | def collection
apply_scopes(super).order(:date).includes{[person, shift.shift_group, shift.county]}.uniq
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def volunteer_portal\n authorize! :volunteer_portal, :Reservation\n end",
"def show\n authorize! :read, @assignment\n end",
"def set_shift\n @shift = Shift.find(params[:id])\n\n authorize @shift\n end",
"def show\n authorize! :read, @collection\n end",
"def authorize_admin\n aut... | [
"0.6795986",
"0.6747096",
"0.66756684",
"0.66584",
"0.6616508",
"0.6601282",
"0.65926504",
"0.6546284",
"0.64773977",
"0.6455889",
"0.64358026",
"0.6401338",
"0.63948977",
"0.63835764",
"0.636969",
"0.6365102",
"0.63581324",
"0.63490564",
"0.6337369",
"0.63346004",
"0.6255981... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def resource_params
[params.require(:shift_assignment).permit(:person_id, :shift_id, :date)]
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 |
GET /for_pags GET /for_pags.json | def index
@for_pags = ForPag.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @pagamentos = Pagamento.page(params[:page]).per(NUMERO_POR_PAGINA)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pagamentos }\n end\n end",
"def index\n @pages = Page.page params[:page]\n\n respond_to do |format|\n format.html #... | [
"0.74186146",
"0.7317744",
"0.7218744",
"0.7182654",
"0.7172309",
"0.71505433",
"0.7106154",
"0.7095095",
"0.7081657",
"0.7068147",
"0.70400345",
"0.7036573",
"0.70104414",
"0.70104414",
"0.70104414",
"0.70104414",
"0.70104414",
"0.70104414",
"0.70104414",
"0.69942296",
"0.69... | 0.6931178 | 23 |
GET /for_pags/1 GET /for_pags/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @pagamentos = Pagamento.page(params[:page]).per(NUMERO_POR_PAGINA)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pagamentos }\n end\n end",
"def index\n @pages = Page.page params[:page]\n\n respond_to do |format|\n format.html #... | [
"0.72397405",
"0.7014571",
"0.7004321",
"0.69238406",
"0.69155943",
"0.6882885",
"0.6825616",
"0.6799138",
"0.67869663",
"0.67869663",
"0.67869663",
"0.67869663",
"0.67869663",
"0.67869663",
"0.67869663",
"0.6739998",
"0.6696968",
"0.6667365",
"0.665863",
"0.6646314",
"0.6641... | 0.0 | -1 |
POST /for_pags POST /for_pags.json | def create
@for_pag = ForPag.new(for_pag_params)
respond_to do |format|
if @for_pag.save
format.html { redirect_to @for_pag, notice: 'For pag was successfully created.' }
format.json { render action: 'show', status: :created, location: @for_pag }
else
format.html { render ac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n\n @pagy, @posts = pagy(Post.cleaner)\n\n paginationObj = {\n page: @pagy.page,\n prev: @pagy.prev,\n next: @pagy.next,\n last: @pagy.last, \n }\n\n render :json => { postsArr: @posts, pagyData: paginationObj }\n end",
"def index\n @ventas_presupuestos = Ventas... | [
"0.6356638",
"0.63352305",
"0.629253",
"0.6207374",
"0.61574405",
"0.61417615",
"0.614163",
"0.6135821",
"0.60952026",
"0.60897297",
"0.6041269",
"0.60253435",
"0.5962303",
"0.5956969",
"0.59244704",
"0.58757305",
"0.58574796",
"0.58470386",
"0.58470386",
"0.58470386",
"0.584... | 0.6289221 | 3 |
PATCH/PUT /for_pags/1 PATCH/PUT /for_pags/1.json | def update
respond_to do |format|
if @for_pag.update(for_pag_params)
format.html { redirect_to @for_pag, notice: 'For pag was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @for_pag.errors, s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @pago.update(pago_params)\n format.html { redirect_to @pago, notice: 'Pago was successfully updated.' }\n format.json { render :show, status: :ok, location: @pago }\n else\n format.html { render :edit }\n format.json { render json: @... | [
"0.6360598",
"0.6360598",
"0.6313854",
"0.62881744",
"0.6281439",
"0.6243139",
"0.6230904",
"0.62261665",
"0.614852",
"0.61258966",
"0.6113327",
"0.6107538",
"0.6095736",
"0.6088949",
"0.60781384",
"0.6058332",
"0.6048065",
"0.6040405",
"0.6036944",
"0.602342",
"0.6008012",
... | 0.70420885 | 0 |
DELETE /for_pags/1 DELETE /for_pags/1.json | def destroy
@for_pag.destroy
respond_to do |format|
format.html { redirect_to for_pags_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @mod_pag = ModPag.find(params[:id])\n @mod_pag.destroy\n\n respond_to do |format|\n format.html { redirect_to mod_pags_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pagamento = Pagamento.find(params[:id])\n @pagamento.destroy\n\n respond_to d... | [
"0.7178697",
"0.71705705",
"0.71151286",
"0.71050733",
"0.7099136",
"0.709174",
"0.7088539",
"0.70454866",
"0.7044028",
"0.7041144",
"0.7008599",
"0.70002836",
"0.69995433",
"0.69995433",
"0.69390345",
"0.69240886",
"0.69235593",
"0.69188386",
"0.6913366",
"0.6911593",
"0.690... | 0.76909953 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_for_pag
@for_pag = ForPag.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.6162554",
"0.60452986",
"0.5945278",
"0.59169763",
"0.58877826",
"0.5834763",
"0.5775349",
"0.5704972",
"0.5704972",
"0.56543803",
"0.5621491",
"0.5427202",
"0.54093206",
"0.54093206",
"0.54093206",
"0.53975695",
"0.53776276",
"0.53562194",
"0.5340594",
"0.5337824",
"0.532... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def for_pag_params
params.require(:for_pag).permit(:description, :days, :active)
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.69795185",
"0.6782116",
"0.6745877",
"0.6742722",
"0.67368543",
"0.65932566",
"0.65048057",
"0.6497429",
"0.6481512",
"0.6478456",
"0.6455591",
"0.64391",
"0.6379068",
"0.6376498",
"0.636542",
"0.632084",
"0.630046",
"0.62998945",
"0.62943697",
"0.6293775",
"0.629097",
"... | 0.0 | -1 |
replicate_match(strs, replication_str) If any of the simple Strings in the Array is found in the current string (possibly in multiple places and possibly overlapping), the String is updated with the matching string in the corresponding location. may also be a single String object. For example, 'abdcbcbcb'.replicate_mat... | def replicate_match(strs, replication_str)
strs = [ strs ] unless (strs.is_a?(Array))
strs.each do |str|
str_len = str.length
next if (length < str_len)
offset, last_offset = 0, length - str_len
while (offset <= last_offset)
if str_pos = in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replicate_match(words)\n @text_lines.each_with_index do |line, i|\n line.replicate_match(words, @sltn_lines[i])\n end\n end",
"def repeated_sub_pattern(str)\n smallest_str = smallest_str(str)\n multiplied = str.length / smallest_str\n str[0...smallest_str] * multiplied == str\n... | [
"0.5991791",
"0.55497426",
"0.5499499",
"0.54187155",
"0.5373907",
"0.52742976",
"0.5274259",
"0.52606195",
"0.52605444",
"0.52531475",
"0.52168685",
"0.51387066",
"0.5102774",
"0.50846803",
"0.50298786",
"0.50290245",
"0.50208807",
"0.49707037",
"0.49655724",
"0.49655724",
"... | 0.9091276 | 0 |
spacey_str = string.space_out Return a copy of the current string with space characters inserted between its characters (plus an initial space character). | def space_out
gsub(/(.)/, ' \1')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replace_blank_space(input_string)\n\t\tcurrent_index = 0\n\t\tback_of_string = input_string.length - 1\n\n\t\twhile current_index < back_of_string\n\t\t\tif input_string[current_index] == \" \"\n\t\t\t\tinput_string[current_index] = \"%20\"\n\t\t\tend\n\t\t\t\tcurrent_index += 1\n\t\t\t\t#back_of_string needs ... | [
"0.70761573",
"0.7055404",
"0.6787125",
"0.6678213",
"0.6562428",
"0.6546508",
"0.6542062",
"0.6527542",
"0.6513802",
"0.64942694",
"0.6360922",
"0.6357714",
"0.6329139",
"0.6320897",
"0.63141966",
"0.6284409",
"0.6282641",
"0.6272445",
"0.6261222",
"0.6232203",
"0.62137234",... | 0.69937533 | 2 |
word_search.add_line(line) Add the String to the current word search puzzle object. | def add_line(line)
@text_lines << line.upcase_trim
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_line(line)\n @lines << line\n line\n end",
"def add_line(line)\n\t\t@lines << line\n\tend",
"def add_line(line)\n @entries << line\n end",
"def add_comment_line line\n @strings << line\n end",
"def add_word(word)\n \n end",
"def add_word(word)\r\n ... | [
"0.68505514",
"0.6775949",
"0.67582613",
"0.66004676",
"0.65298796",
"0.64221686",
"0.6354047",
"0.63225424",
"0.63010395",
"0.62856686",
"0.6236654",
"0.62097275",
"0.6178971",
"0.6123173",
"0.61008024",
"0.6077652",
"0.60291904",
"0.59757316",
"0.59376353",
"0.59094167",
"0... | 0.70044994 | 0 |
word_search.solve(words) Solve the current word search object for the words . The solution is returned, which is an Array of Strings in the same shape as the original puzzle, where the solution word letters are kept intact, but the nonsolution word letters replaced with the character '+'. We tackle this problem by doin... | def solve(*words)
words = words.collect { |word| word.upcase_trim }
#
# Make the various transformations, checking for matches along the
# way.
#
normalize ; replicate_match(words) # match L->R
flip_horizontal ; replicate_match(words) ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solve\n\t\t# Attempt to find a mismatch in start/end\n\t\t# letters in the maps. This signifies first\n\t\t# and last words of the solution\n\t\tdiff_list = []\n\t\t@start_map.each {|k,v|\n\t\t\tr = @end_map[k]\n\t\t\tdiff = r-v\n\t\t\tputs \"#{k} => #{v} | #{r} diff #{diff}\"\n\t\t\t\n\t\t\t# If values in ma... | [
"0.7192096",
"0.64427555",
"0.643621",
"0.62722427",
"0.6263551",
"0.6248918",
"0.613598",
"0.6079689",
"0.60723",
"0.6040596",
"0.60265505",
"0.59671587",
"0.5939894",
"0.5883247",
"0.5874109",
"0.58453125",
"0.5811993",
"0.5783038",
"0.57828397",
"0.5780384",
"0.5756658",
... | 0.72635674 | 0 |
word_search.normalize Undiagonalizing is somewhat tricky, as we need to recover its original (or transposed) shape. Set the internal state of this object for suitable shape information. Also, (un)diagonalizing will be screwed up if this shape is not a nice, full rectangle. Pad it if necessary. And, clear out the soluti... | def normalize
@height = @text_lines.size
@width = 0
@sltn_lines = [ ]
@text_lines.each do |line|
len = line.length
@width = len if (len > @width)
@sltn_lines << '+' * len
end
(0...@text_lines.size).each do |i|
no_pad_chars =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize\n resize(1.0)\n end",
"def normalize!\n self.replace self.normalize\n end",
"def undiagonalize(transposed)\n text_lines = @text_lines\n @text_lines = Array.new(transposed ? @width : @height) { String.new }\n sltn_lines = @sltn_lines\n @sltn_lines = Array.ne... | [
"0.54442054",
"0.52825314",
"0.5265053",
"0.5262985",
"0.52268296",
"0.5157169",
"0.5111925",
"0.5092437",
"0.5038435",
"0.50008994",
"0.49940658",
"0.49940658",
"0.49826562",
"0.49511987",
"0.49263614",
"0.49138594",
"0.48995504",
"0.4883798",
"0.4831838",
"0.48219055",
"0.4... | 0.4693709 | 31 |
word_search.flip_horizontal() Flip all the lines of the current word search puzzle object horizontally. (Note: this and all similar methods should more appropriately be named in their bang (!) forms, but I don't do that for this quiz, nor do I do other normal things here like returning self.) | def flip_horizontal
(0...@text_lines.size).each do |i|
@text_lines[i].reverse!
@sltn_lines[i].reverse!
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flip_horizontally!\n for y in 0..((height - 1) >> 1) do\n other_y = height - (y + 1)\n other_row = row(other_y)\n replace_row!(other_y, row(y))\n replace_row!(y, other_row)\n end\n self\n end",
"def flip_horizontally\n dup.flip_horizontal... | [
"0.6792041",
"0.6417419",
"0.60523856",
"0.599958",
"0.58600897",
"0.5796757",
"0.5752684",
"0.56558865",
"0.55812234",
"0.5263736",
"0.5223522",
"0.5220052",
"0.5171433",
"0.5132745",
"0.51269615",
"0.51020294",
"0.509572",
"0.5093568",
"0.50895673",
"0.5088457",
"0.5082823"... | 0.70315975 | 0 |
word_search.flip_vertical() Flip all the lines of the current word search puzzle object vertically. | def flip_vertical
@text_lines.reverse!
@sltn_lines.reverse!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flip_vertically!\n for y in 0...height do\n replace_row!(y, row(y).reverse)\n end\n self\n end",
"def vertical_words\n word_vectors = []\n inverted_grid = Matrix.rows(@grid.map { |line| line.split('') }).transpose.to_a.map {|line| line.join}\n \n inverted_... | [
"0.72670025",
"0.67112905",
"0.66560256",
"0.66510785",
"0.5957041",
"0.592218",
"0.5773021",
"0.5727257",
"0.55526936",
"0.5523436",
"0.5486222",
"0.53519",
"0.5313064",
"0.5304981",
"0.53012145",
"0.5293072",
"0.5244131",
"0.51944715",
"0.51589257",
"0.51348245",
"0.5112165... | 0.7439568 | 0 |
word_search.diagonalize() Convert the lines of the current word search puzzle object to a kind of diagonalized form. Note that here I don't presize the arrays, and so use the ||= trick (well, I suppose it's possible to figure out how big to make the arrays, but I didn't bother doing that). | def diagonalize
text_lines = @text_lines ; @text_lines = [ ]
sltn_lines = @sltn_lines ; @sltn_lines = [ ]
text_lines.each_with_index do |line, i|
line.split('').each_with_index do |char, j|
(@text_lines[i+j] ||= '') << char
(@sltn_lines[i+j] ||= ''... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def diagonalize floor = 0\n raise 'err: not 2d' unless self[0].class == Array\n size = self.length + self[0].length - 1\n array = Array.new(size) {Array.new}\n # acquire top and main diagonal\n self.length.times do |row|\n (0 .. row).each do |col|\n array[row] << self[row-col][col]\n ... | [
"0.67708445",
"0.6632957",
"0.6403742",
"0.6285169",
"0.621031",
"0.6162703",
"0.6037388",
"0.6034925",
"0.5980928",
"0.59733415",
"0.5965713",
"0.59457356",
"0.59091485",
"0.5899854",
"0.58809996",
"0.5859907",
"0.5839957",
"0.578601",
"0.5777867",
"0.5761868",
"0.57285726",... | 0.72818345 | 0 |
word_search.undiagonalize(transposed) Convert the lines of the current word search puzzle object back into a rectangular form. Because we don't do true matrixlike manipulation (we work with simple strings) and thus lose any original indexing (via simple string appending), we need original shape information in order to ... | def undiagonalize(transposed)
text_lines = @text_lines
@text_lines = Array.new(transposed ? @width : @height) { String.new }
sltn_lines = @sltn_lines
@sltn_lines = Array.new(transposed ? @width : @height) { String.new }
text_lines.each_with_index do |line, i|
if (tran... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def diagonalize\n text_lines = @text_lines ; @text_lines = [ ]\n sltn_lines = @sltn_lines ; @sltn_lines = [ ]\n text_lines.each_with_index do |line, i|\n line.split('').each_with_index do |char, j|\n (@text_lines[i+j] ||= '') << char\n (@sltn_lines[... | [
"0.54619014",
"0.54381835",
"0.49719515",
"0.49665487",
"0.48483568",
"0.4683679",
"0.46210745",
"0.46083647",
"0.4568668",
"0.45678002",
"0.45645362",
"0.45624077",
"0.4529771",
"0.45120037",
"0.44696033",
"0.44653332",
"0.4447841",
"0.44448534",
"0.4438761",
"0.4408356",
"0... | 0.6686408 | 0 |
word_search.replicate_match(words) Update the solution lines of the current word search puzzle object with any matches of the word Strings . | def replicate_match(words)
@text_lines.each_with_index do |line, i|
line.replicate_match(words, @sltn_lines[i])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replicate_match(strs, replication_str)\n strs = [ strs ] unless (strs.is_a?(Array))\n strs.each do |str|\n str_len = str.length\n next if (length < str_len)\n offset, last_offset = 0, length - str_len\n while (offset <= last_offset)\n if ... | [
"0.66687953",
"0.633226",
"0.6130408",
"0.5979474",
"0.59396213",
"0.589451",
"0.5783897",
"0.57772106",
"0.5775033",
"0.5772448",
"0.5772448",
"0.5770923",
"0.5759949",
"0.575482",
"0.57043165",
"0.5687306",
"0.56778115",
"0.5673475",
"0.5670098",
"0.5667745",
"0.56358904",
... | 0.7980253 | 0 |
GET /site_configs GET /site_configs.json | def index
@site_configs = SiteConfig.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @site_config = SiteConfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_config }\n end\n end",
"def index\n\t\t@siteconfigs = Siteconfig.all\n\tend",
"def index\n @app_configs = AppConfig.all\n\n respond_to do ... | [
"0.7330663",
"0.71956205",
"0.68466693",
"0.66667455",
"0.66290116",
"0.6621931",
"0.657767",
"0.6565218",
"0.6536528",
"0.6517258",
"0.64899653",
"0.6488413",
"0.640835",
"0.6363339",
"0.63609266",
"0.6355054",
"0.6299681",
"0.6274702",
"0.6224177",
"0.62056965",
"0.61674255... | 0.7431591 | 0 |
PATCH/PUT /site_configs/1 PATCH/PUT /site_configs/1.json | def update
respond_to do |format|
if @site_config.update(site_config_params)
format.html { redirect_to action: :index, notice: t('Site config was successfully updated.') }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @site_config = SiteConfig.find(params[:id])\n\n respond_to do |format|\n if @site_config.update_attributes(site_config_params)\n format.html { redirect_to @site_config, notice: 'Site config was successfully updated.' }\n format.json { head :no_content }\n else\n fo... | [
"0.7103503",
"0.686727",
"0.6414311",
"0.6321009",
"0.6306876",
"0.6113059",
"0.60946023",
"0.6075398",
"0.6069154",
"0.6054861",
"0.6024975",
"0.5986819",
"0.59717935",
"0.5967716",
"0.594994",
"0.5942937",
"0.5923646",
"0.5922549",
"0.58637697",
"0.5863342",
"0.5862443",
... | 0.70730835 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_site_config
@site_config = SiteConfig.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 site_config_params
params.require(:site_config).permit(:key, :display_name, :value_type, :value_s, :value_b)
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.6980384",
"0.6782743",
"0.6746196",
"0.6742575",
"0.6736",
"0.6594004",
"0.65037984",
"0.6496699",
"0.64819324",
"0.64791185",
"0.6456292",
"0.64403296",
"0.63795286",
"0.6375975",
"0.6365291",
"0.63210756",
"0.6300542",
"0.6299717",
"0.62943304",
"0.6292561",
"0.6290683",... | 0.0 | -1 |
Initializes a new TurnComponent object Arguments player_entities = an array of player entities Postcondtion The TurnComponent object is properly initialized | def initialize(player_entities)
@turn = 0
@turn_count = 1
@players = player_entities
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(player, party_horn)\n\t\t@player = player\n\t\t@party_horn = party_horn\n\n\t\t@x = @y = @angle = 0\n\n\t\t@width = TILE_WIDTH\n\t\t@height = TILE_HEIGHT\n\n\t\t@swimming = false\n\n\t\t@tile_idx = 0\n\t\t@prev_time = 0\n\t\t@animation_update_interval = STD_ANIMATION_UPDATE_INTERVAL\n\tend",
"def ... | [
"0.6417395",
"0.6257679",
"0.61922026",
"0.6152883",
"0.6152448",
"0.6146337",
"0.5983289",
"0.59534407",
"0.5952249",
"0.590282",
"0.5886908",
"0.58730894",
"0.5869555",
"0.5866913",
"0.58645254",
"0.5860836",
"0.58590674",
"0.58425456",
"0.5821833",
"0.5817465",
"0.581274",... | 0.8230874 | 0 |
Returns the player entity whose turn it currently is | def current_turn()
@players[@turn]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_player\n Player.find(player_turn) unless player_turn.nil?\n end",
"def current_player\n @players[@turn%2]\n end",
"def current\n self.players[self.current_turn]\n end",
"def current_player\n players.first\n end",
"def current_player\n @players.first\n end",
"def cu... | [
"0.77469265",
"0.73377615",
"0.7138472",
"0.6995961",
"0.696029",
"0.6953253",
"0.69511634",
"0.6931323",
"0.69022036",
"0.68991995",
"0.6863436",
"0.6668175",
"0.661631",
"0.66016763",
"0.659411",
"0.65421146",
"0.65319973",
"0.6511491",
"0.6511491",
"0.6511491",
"0.6511491"... | 0.7396393 | 1 |
Ends the turn for the current player and moves to the next player's turn. Postcondtion The old player's turn is ended and the new player now has a turn. | def next_turn()
@turn = (@turn + 1) % @players.size
@turn_count += 1
self.current_turn
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_turn\n @players_1_turn = !@players_1_turn\n end",
"def end_turn\n current_username = self.up_next\n current_num = 0\n self.game_players.each do |player|\n if player.user.username == current_username\n current_num = player.turn_order\n end\n end\n if current_num == self... | [
"0.77377325",
"0.74456555",
"0.7393943",
"0.7277434",
"0.689509",
"0.67457783",
"0.6655862",
"0.6655862",
"0.6643923",
"0.66382116",
"0.6634809",
"0.66288143",
"0.6597986",
"0.65976334",
"0.6580962",
"0.6580962",
"0.6556613",
"0.6553201",
"0.64923966",
"0.6479178",
"0.6452820... | 0.6574706 | 16 |
Returns a string representation of the component | def to_s
return "Turn => #{self.current_turn}, Players => #{@players}, "
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n \"Component '#{name}' #{id}\"\n end",
"def inspect\n\t\treturn %{#<%s:0x%0x (%s)>} % [\n\t\t\tself.class.name,\n\t\t\tself.object_id * 2,\n\t\t\tself.component,\n\t\t]\n\tend",
"def to_s\n fail @error if @error && @value.empty?\n\n @template.sub('{value}', URI.encode(@value... | [
"0.82379895",
"0.76293397",
"0.7255166",
"0.7078531",
"0.70406765",
"0.70266217",
"0.69887286",
"0.69808745",
"0.69808745",
"0.69808745",
"0.69808745",
"0.6978229",
"0.6952142",
"0.6938335",
"0.6932769",
"0.69316447",
"0.6924792",
"0.6921064",
"0.68997866",
"0.6878768",
"0.68... | 0.0 | -1 |
Initialize the Response object with the HTTPResponse object to parse, the client that made the request and the original request made | def initialize(http_response, request)
@http_response = http_response
@request = request
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def net_http_init(net_http_response)\n\n @original = net_http_response\n @status = net_http_response.code.to_i\n @body = net_http_response.body\n @headers = {}\n net_http_response.each { |k, v|\n @headers[k.split('-').collect { |s| s.capitalize }.join('-')] = v\n }\n end",
... | [
"0.72845155",
"0.7277241",
"0.72050834",
"0.7126053",
"0.71196204",
"0.7066198",
"0.70610034",
"0.700385",
"0.6958043",
"0.6924923",
"0.68967605",
"0.6880573",
"0.687959",
"0.6806632",
"0.6767952",
"0.67265785",
"0.6714907",
"0.6700294",
"0.66875917",
"0.6687205",
"0.66769457... | 0.7353917 | 0 |
Parses the response, using the client to log any errors | def parse(client)
parse_status_code
parse_data(client)
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_response(response)\n if response.kind_of?(Net::HTTPServerError)\n raise Jamendo::Error.new(\"Jamendo Server Error: #{response} - #{response.body}\", response)\n end\n \n case @format\n when :json\n JSON.parse(response.body, symbolize_names: true)\n when :xml\n ... | [
"0.7715834",
"0.7695897",
"0.7636979",
"0.7559383",
"0.7391786",
"0.73851657",
"0.7268152",
"0.717713",
"0.71524835",
"0.71520627",
"0.7100609",
"0.6992145",
"0.6966249",
"0.69432837",
"0.694044",
"0.69256794",
"0.6910564",
"0.68950933",
"0.6885284",
"0.6875679",
"0.6844567",... | 0.6896452 | 17 |
generic email action params[:from], params[:to], params[:subject], params[:body], params[:redirect_to] | def email
options = { :from => params[:email], :to => "support@telaeris.com", :subject => params[:subject], :body => "From: #{params[:user]} <#{params[:email]}>\r\nCategory: #{params[:category]}\r\nSubject:#{params[:subject]}\r\n\r\n#{params[:body]}"}
RequestMailer.deliver_generic(options)
flash[:notice] = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_email( params )\n puts \"From: #{params[:from]}\"\n puts \"To: #{params[:to]}\"\n puts \"Email subject: #{params[:subject]}\"\n puts \"Email body: #{params[:body]}\" \n return true\n end",
"def my_mailer \n from_email = params[:comment][:email] \n message = params[:comment][:... | [
"0.72289807",
"0.6862396",
"0.6753879",
"0.67461765",
"0.6633784",
"0.6609428",
"0.65690297",
"0.6566992",
"0.6560881",
"0.65576375",
"0.65518254",
"0.65429914",
"0.6527561",
"0.65186566",
"0.65111893",
"0.65111893",
"0.65089023",
"0.65027213",
"0.64958733",
"0.644438",
"0.64... | 0.7444223 | 0 |
Add more helper methods to be used by all extension tests here... | def with(value)
yield value
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.6966541",
"0.66597885",
"0.66597885",
"0.66597885",
"0.6359399",
"0.62459975",
"0.6241368",
"0.6065263",
"0.60067934",
"0.60067934",
"0.59747875",
"0.59480065",
"0.59480065",
"0.59204155",
"0.59180105",
"0.5897143",
"0.58831435",
"0.5811964",
"0.58118355",
"0.5759587",
"0.... | 0.0 | -1 |
key is a string of the key you want to retrieve | def find_key(key)
if env_map.has_key?(key)
return { key => env_map[key]}
else
raise 'Key not found!'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(key); end",
"def get(key); end",
"def get(key); end",
"def get(key); end",
"def get(key)\n end",
"def get(key)\n \n end",
"def get(key)\n end",
"def fetch(key); end",
"def get key; call key; end",
"def read_key; end",
"def get(key)\n Lib.get @path, @no_follow, key.to_s... | [
"0.83017176",
"0.83017176",
"0.83017176",
"0.83017176",
"0.8286379",
"0.8234236",
"0.81853914",
"0.79365474",
"0.7911228",
"0.77594936",
"0.7671483",
"0.7533836",
"0.75086147",
"0.74500424",
"0.7448539",
"0.7427963",
"0.7424928",
"0.74043584",
"0.73740095",
"0.7365028",
"0.73... | 0.0 | -1 |
POST /create This means somebody filled out the contact form | def create
@contact_info = params
GeneralMailer.delay.website_contact_form(@contact_info)
flash[:notice] = 'Thank you for your inquery. We\'ll be in touch with you shortly.'
redirect_to "/"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n\t\t@contact = Contact.new()\n\t\t@contact.fname = params[:fname] \n\t\t@contact.lname = params[:lname]\n\t\t@contact.email = params[:email]\n\t\t@contact.reason = params[:reason]\n\t\t@contact.message = params[:message]\n\t\t@contact.save\n\t\t\n\t\trespond_with(@contact)\n end",
"def create\n @... | [
"0.77107054",
"0.76763564",
"0.7523418",
"0.7508727",
"0.7472217",
"0.74500203",
"0.7444583",
"0.74211144",
"0.74095815",
"0.7352242",
"0.7344172",
"0.7334178",
"0.7327714",
"0.72949445",
"0.7289816",
"0.7280939",
"0.72682154",
"0.72604793",
"0.7252345",
"0.72436917",
"0.7243... | 0.68371785 | 70 |
Returns nil if no such key | def retrieve key
node = traverse @root, key
node.key
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_key(key)\n return self.has_key?(key) ? self[key] : nil\n end",
"def key\n @key or raise MissingKey\n end",
"def [](key)\n entry = find_entry(key)\n return(entry.nil? ? nil : entry[1])\n end",
"def find(key)\n # TODO(himanshujaju) - possible improvement by not checking for ... | [
"0.7865293",
"0.7541485",
"0.73830056",
"0.7199287",
"0.7106905",
"0.70677984",
"0.70454776",
"0.70454776",
"0.70454776",
"0.70454776",
"0.7006005",
"0.7006005",
"0.6967451",
"0.6913904",
"0.6908253",
"0.68922406",
"0.6887032",
"0.6873208",
"0.68594354",
"0.6837338",
"0.68330... | 0.6485357 | 59 |
== CANCAN Authorization == | def ability
@ability ||= Admin::SystemAdminAbility.new(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorize\n end",
"def authorize\n end",
"def authorization; end",
"def authorization(*args, &block); end",
"def authorize(options = {})\r\n # full_res_file_access = ['10.128.99.55','10.128.1.167','10.224.6.10','10.128.99.167','10.128.98.50','10.224.6.26','10.224.6.35','172.16.1.94', '66.234.38.35... | [
"0.6434051",
"0.6434051",
"0.6285173",
"0.62677944",
"0.6244",
"0.6204572",
"0.6159169",
"0.59875715",
"0.59875715",
"0.5979078",
"0.5934815",
"0.59343946",
"0.5895101",
"0.5873449",
"0.58611006",
"0.5849073",
"0.5793801",
"0.578262",
"0.57717574",
"0.5756642",
"0.5748051",
... | 0.0 | -1 |
used when little 'x' image is clicked to close. | def remove_id(object_id)
i = @docs.index { |doc| doc.object_id == object_id }
destroy_tab(i) if @docs[i].try_to_save()
# remove_tab(i) #if not i.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_image\n @p.close_image(self)\n end",
"def close\n @graphic.ungetch(?q.ord)\n end",
"def button_down(id)\r\n if id == Gosu::KB_ESCAPE\r\n close\r\n else\r\n super\r\n end\r\n end",
"def button_down(id)\r\n if id == Gosu::KB_ESCAPE\r\n close\r... | [
"0.69468194",
"0.68555856",
"0.6595714",
"0.65661836",
"0.6563526",
"0.64277756",
"0.64153403",
"0.6397302",
"0.63582796",
"0.62889075",
"0.62867963",
"0.6263157",
"0.6126303",
"0.60624874",
"0.60486305",
"0.60486305",
"0.5987918",
"0.59743",
"0.5971885",
"0.59637344",
"0.596... | 0.0 | -1 |
if its there, destroys it | def destroy_file_tab(file_name)
destroy_tab() if switch_to(file_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy!; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy\n nil\n end",
"def cleanup!; end",
"def clea... | [
"0.6996546",
"0.6960219",
"0.6960219",
"0.6960219",
"0.6960219",
"0.6960219",
"0.6960219",
"0.6960219",
"0.6960219",
"0.6960219",
"0.6960219",
"0.6902436",
"0.6836801",
"0.6836801",
"0.6815666",
"0.6815666",
"0.6815666",
"0.6815666",
"0.6781785",
"0.6766722",
"0.6766722",
"... | 0.0 | -1 |
Methods for completing quests show the player his completed quests | def get_completed_quests
#check if the player has actually completed any quests
#if he has not, tell him
if self.quests.size == 0
puts "You have not completed any quests!!!".red
#otherwise, pull the completed quest objects and print the quest titles
else
puts "Completed Quests:".underline
se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @quest = Quest.find(params[:id])\n quest_objectives = @quest.locations\n completed_objectives = []\n quest_objectives.each do |obj|\n if @current_user.locations.exists?(obj)\n completed_objectives << obj\n end\n end\n if completed_objectives.length == quest_objectives.... | [
"0.67578393",
"0.6722168",
"0.67007244",
"0.66515607",
"0.6633203",
"0.6424803",
"0.64002126",
"0.6333337",
"0.6324548",
"0.63061446",
"0.6277629",
"0.62245256",
"0.6198071",
"0.61739576",
"0.6167319",
"0.6144824",
"0.6123756",
"0.60783225",
"0.60393655",
"0.59907323",
"0.591... | 0.7854303 | 0 |
method for obtaining the uncompleted quests for a given player returns quest instances | def get_uncompleted_quests()
Quest.all.select do |quest|
quest.characters.include?(self) == false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_completed_quests\n\n#check if the player has actually completed any quests\n#if he has not, tell him\n if self.quests.size == 0\n puts \"You have not completed any quests!!!\".red\n\n#otherwise, pull the completed quest objects and print the quest titles\n else\n puts \"Completed Quests:\".... | [
"0.698155",
"0.65838313",
"0.6568926",
"0.6389885",
"0.6305128",
"0.6293106",
"0.6238996",
"0.6164167",
"0.6066384",
"0.5897755",
"0.58861184",
"0.5831168",
"0.5784433",
"0.5762329",
"0.56853086",
"0.56280303",
"0.5556631",
"0.55530924",
"0.5545699",
"0.5541987",
"0.5539793",... | 0.7651346 | 0 |
use the uncompleted quest instances to obtain those that are of a certain difficulty | def get_recommended_quests(difficulty)
self.get_uncompleted_quests.select do |quest|
quest.difficulty == difficulty
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_uncompleted_quests()\n Quest.all.select do |quest|\n quest.characters.include?(self) == false\n end\n\n end",
"def print_quests(difficulty)\n self.get_recommended_quests(difficulty).each_with_index do |quest, i|\n puts \"#{i+1}: #{quest.title}\"\n end\n end",
"def get_available_... | [
"0.7222176",
"0.67014384",
"0.6627774",
"0.6614985",
"0.6581597",
"0.6512667",
"0.6476362",
"0.63532734",
"0.6347757",
"0.6318947",
"0.6225621",
"0.6163819",
"0.61155415",
"0.6069113",
"0.60141456",
"0.601292",
"0.598062",
"0.5955003",
"0.5917984",
"0.5905793",
"0.58614385",
... | 0.77815104 | 0 |
print the quest titles of the uncompleted quests that are of a specified difficulty | def print_quests(difficulty)
self.get_recommended_quests(difficulty).each_with_index do |quest, i|
puts "#{i+1}: #{quest.title}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_completed_quests\n\n#check if the player has actually completed any quests\n#if he has not, tell him\n if self.quests.size == 0\n puts \"You have not completed any quests!!!\".red\n\n#otherwise, pull the completed quest objects and print the quest titles\n else\n puts \"Completed Quests:\".... | [
"0.730667",
"0.6421022",
"0.6139971",
"0.6088218",
"0.60317516",
"0.5855628",
"0.584459",
"0.56226474",
"0.5541372",
"0.5456466",
"0.5450909",
"0.5439021",
"0.5424928",
"0.54177433",
"0.5417137",
"0.5398977",
"0.53792864",
"0.53462696",
"0.5344046",
"0.53439444",
"0.53080463"... | 0.78221 | 0 |
after the player selects a quest instantiate a new CharacterQuest object to show that player has actually completed the quest | def quest_selection(input, difficulty)
quest_id = self.get_recommended_quests(difficulty)[input.to_i-1].id
CharacterQuest.new_character_quest(self.id, quest_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quest_interface\n\n#obtain the difficulty level for the given player\n difficulty = self.get_difficulty\n\n#see if the player has any quests left to complete\n if self.get_recommended_quests(difficulty).size == 0\n puts \"=====================================\".red\n puts \"====================... | [
"0.6867418",
"0.6529618",
"0.6497493",
"0.6401473",
"0.63501173",
"0.6275192",
"0.61856294",
"0.61458117",
"0.6103134",
"0.6101079",
"0.6101079",
"0.6101079",
"0.6101079",
"0.60768604",
"0.6063554",
"0.5990301",
"0.5901015",
"0.5897365",
"0.58694714",
"0.58549243",
"0.5852714... | 0.68937546 | 0 |
print all of the acquired weapons for a certain player | def show_all_weapons
if self.weapons.size == 0
puts ""
puts "You have no weapons, try completing some quests first :)"
else
puts ""
puts "Here Are Your Weapons:".bold.white.on_light_black
puts " "
self.weapons.each do |weapon|
puts "**** #{weapon.name} **** Weapon Pow... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_stats\n puts \"*********************************\"\n\n #check to see if the player has any weapons\n #display stats\n if self.weapons.size == 0\n puts \"Current Health:\".red + \" #{self.hp}\".bold\n puts \"Current Power:\".blue + \" #{self.power}\".bold\n\n #display\n else\n... | [
"0.6611604",
"0.6549918",
"0.6513331",
"0.6506434",
"0.6467202",
"0.6384377",
"0.63677734",
"0.6310053",
"0.6301107",
"0.62826234",
"0.6269984",
"0.62510866",
"0.6239163",
"0.6206391",
"0.61899996",
"0.6178642",
"0.61378664",
"0.61276823",
"0.61235607",
"0.6113446",
"0.609799... | 0.771655 | 0 |
obtain the weapon instance with the highest attack power for a certain player | def highest_attack_power_weapon
weapon = self.weapons.sort_by do |weapon|
weapon.attack_power
end.last
weapon
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_weapon\n new_weapon = rand(1..6)\n puts \">>> Tu as trouvé une arme de niveau #{new_weapon}\"\n\n # Get a random value for the weapon. If the actual weapon has more power, keep the value\n # if it's lower it change the value to the best weapon value\n if new_weapon > @weapon_level\n ... | [
"0.6935373",
"0.68641955",
"0.6706536",
"0.66506845",
"0.65389234",
"0.6536086",
"0.644866",
"0.6369459",
"0.63611096",
"0.6346393",
"0.63452154",
"0.6335168",
"0.633251",
"0.63033986",
"0.6251758",
"0.62285405",
"0.62152255",
"0.6198436",
"0.61759293",
"0.61667114",
"0.61531... | 0.86811703 | 0 |
this method obtains all of the weapons available to a certain player argument passed in is difficulty level, so this will only show weapons of certain attack powe | def get_available_weapons(difficulty)
#if the difficulty of the quest is 1
#only select weapons with attack power less than or equal to 3
# and that the player has not yet obtained
if difficulty == 1
available_weapons = Weapon.all.where("attack_power <=3").select do |weapon|
weapon.characters.include... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_all_weapons\n if self.weapons.size == 0\n puts \"\"\n puts \"You have no weapons, try completing some quests first :)\"\n else\n puts \"\"\n puts \"Here Are Your Weapons:\".bold.white.on_light_black\n puts \" \"\n self.weapons.each do |weapon|\n puts \"**** #{wea... | [
"0.6821203",
"0.6721752",
"0.63553125",
"0.6343425",
"0.6330356",
"0.632762",
"0.6274297",
"0.6239555",
"0.6230755",
"0.6191013",
"0.6146909",
"0.61043906",
"0.60969764",
"0.6093151",
"0.60868627",
"0.6005764",
"0.59790206",
"0.5972679",
"0.5971301",
"0.5964603",
"0.5951353",... | 0.77990663 | 0 |
method for obtaining a player's difficulty setting this is solely based on the attack power of the current player | def get_difficulty
if self.power < 3
difficulty = 1
elsif self.power >= 3 && self.power < 6
difficulty = 2
else
difficulty = 3
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def difficulty\n request('getdifficulty')\n end",
"def getdifficulty\n coind.getdifficulty\n end",
"def board_difficulty\n Board.new.level\n end",
"def get_difficulty\n print \"Choose a difficulty level from 1 (easiest) to 10 (hardest): \"\n level = gets.chomp.to_i\n if (... | [
"0.68832654",
"0.6792101",
"0.6691086",
"0.66792303",
"0.6627899",
"0.6560039",
"0.63671064",
"0.6296457",
"0.6250317",
"0.62473434",
"0.6165845",
"0.6142915",
"0.6096492",
"0.6067504",
"0.59626585",
"0.59383005",
"0.59337896",
"0.5933285",
"0.5900958",
"0.58601665",
"0.58581... | 0.8061097 | 0 |
method for player executing a quest | def quest_interface
#obtain the difficulty level for the given player
difficulty = self.get_difficulty
#see if the player has any quests left to complete
if self.get_recommended_quests(difficulty).size == 0
puts "=====================================".red
puts "====================================... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quest; end",
"def run_quest\n original_power = @todays_hero.power\n system \"clear\"\n subtitle_print('Start Quest')\n power_update = Quest.find_new\n @todays_hero.increase_power_by(power_update)\n system \"clear\"\n if @todays_hero.power > original_power\n puts \"Congrats! Your pow... | [
"0.76057154",
"0.6852442",
"0.6841491",
"0.68252397",
"0.6705769",
"0.66427284",
"0.66124445",
"0.65628415",
"0.64983255",
"0.6370336",
"0.62768626",
"0.62623245",
"0.62606645",
"0.6201033",
"0.61695755",
"0.6147737",
"0.61336553",
"0.61322856",
"0.6127557",
"0.6121104",
"0.6... | 0.6855905 | 1 |
method for getting the reward after completing a quest argument passed in is array of available weapon objects | def weapon_reward(available_weapons)
#reward is 1 random choice from this array
reward = available_weapons.sample
#create to CharacterWeapon object to show that player obtains weaopn
CharacterWeapon.new_character_weapon(self.id, reward.id)
#print weapon details to player
puts "#{reward.name}"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distribute_quest_reward(reward)\n @params = [reward[1], 0, 0, (reward[2] ? reward[2] : 1)]\n case reward[0]\n when :item, 0 then command_126 # Item\n when :weapon, 1 then command_127 # Weapon\n when :armor, 2 then command_128 # Armor\n when :gold, 3 # Gold\n @params = [0, 0, reward[... | [
"0.71311235",
"0.6763951",
"0.67126644",
"0.64617056",
"0.63388056",
"0.6338314",
"0.63285893",
"0.6294439",
"0.6290409",
"0.62730455",
"0.61566705",
"0.6155623",
"0.60622466",
"0.605999",
"0.602159",
"0.598551",
"0.59470385",
"0.5893555",
"0.58841527",
"0.5860339",
"0.585956... | 0.7366794 | 0 |
Methods for fighting other players obtain potential targets for a given player only select other characters with power less than or equal to player's power + 2 level this will return character objects | def recommended_targets
Character.all.select do |character|
character.power <= (self.power + 2) && character != self
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_available_weapons(difficulty)\n\n#if the difficulty of the quest is 1\n#only select weapons with attack power less than or equal to 3\n# and that the player has not yet obtained\n if difficulty == 1\n available_weapons = Weapon.all.where(\"attack_power <=3\").select do |weapon|\n weapon.char... | [
"0.6492809",
"0.59228694",
"0.57107985",
"0.55883014",
"0.55825436",
"0.5558533",
"0.55347407",
"0.5502413",
"0.54810715",
"0.5468582",
"0.5459844",
"0.5356746",
"0.5348944",
"0.5279519",
"0.52530515",
"0.52216107",
"0.5216078",
"0.52096",
"0.52093524",
"0.5207117",
"0.520079... | 0.74867165 | 0 |
print a list of the recommended targets to the player this will return a random sample of 5 of the potential targets for the given player | def print_recommended_targets
find_target_sample = self.recommended_targets.sample(5)
puts "Recommended Targets".bold.underline
puts "Your Attack Power: #{self.power}".italic.blue
find_target_sample.each_with_index do |target , i|
#display the target's name and relevant stats
put... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def powered_by\n random_and_sane [\n \"Diet Pepsi\",\n \"the funny voice he uses to talk to dogs\",\n \"the love of his life, <a href=\\\"http://thebluesunshine.com/\\\">Lizza</a>\",\n \"hoagies from <a href=\\\"https://foursquare.com/v/sarcones-deli/4a9b035ef964a520fc3320e3\\\">Sarcone's De... | [
"0.61591095",
"0.61492926",
"0.5988519",
"0.59762824",
"0.59223676",
"0.5917511",
"0.59096956",
"0.58983916",
"0.58554476",
"0.58409035",
"0.58405674",
"0.5810753",
"0.5773324",
"0.5758916",
"0.5749908",
"0.573031",
"0.56792575",
"0.56792575",
"0.5674176",
"0.5659517",
"0.562... | 0.80174303 | 0 |
method for player selecting a target | def select_target
target_list = print_recommended_targets
#check to see if there are any available targts
if target_list.size == 0
puts "There are no available targets!".bold.red
target = nil
#get input for available targets
else
puts "Select Your Target Number".bold.white.on_light_blue
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_target\n @target or raise Vanagon::Error, '#select_target has not been implemented for your engine.'\n end",
"def target_choice\n launcher, skill, target_bank, target_position = @visual.show_target_choice\n if launcher\n # The player made a choice we store the action and c... | [
"0.77905816",
"0.7041471",
"0.6987912",
"0.66176575",
"0.65036726",
"0.65036726",
"0.6498322",
"0.6466121",
"0.6454266",
"0.6448202",
"0.64133596",
"0.6408906",
"0.63759273",
"0.6330023",
"0.6318779",
"0.6271247",
"0.6271247",
"0.62537056",
"0.6233939",
"0.6233939",
"0.620054... | 0.6689106 | 3 |
method for the actual combat | def attack(target)
#check to see if there is any target
if target == nil
puts "Invite some friends to play this awesome game.".blue
else
#print fighting for the user
puts Artii::Base.new.asciify "Fight"
###methods for determining probability of victory
###and damage to th... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def combat\n if state == GameState::BEFORECOMBAT or state == GameState::INIT\n combatResult = combatGo(@currentSpaceStation, @currentEnemy)\n else\n combatResult = CombatResult::NOCOMBAT\n end\n combatResult\n end",
"def combat\n\t\tif @battleManager.actionUnitsEmpty\n\t\t\ts... | [
"0.74400353",
"0.7438527",
"0.73380214",
"0.7261905",
"0.707193",
"0.6778616",
"0.6581202",
"0.6542766",
"0.65268683",
"0.6475391",
"0.64686334",
"0.6422843",
"0.6419648",
"0.64079475",
"0.640092",
"0.6381136",
"0.6378247",
"0.6378247",
"0.63596094",
"0.63396055",
"0.6331795"... | 0.65983874 | 6 |
method for updating a character object's hp | def update_hp(change)
self.update(hp:self.hp + change)
#check to see if the character is dead
if self.hp <= 0
#display to the user that the character is dead
puts "$$$$$$$$$$$$$$$$$$$$$$$$$$$".blink
puts "#{self.name} IS DEAD !!!!!!!!!!!".bold.red.on_black
#destroy the object from... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hp=(hp)\n @hp = hp\n end",
"def updateHpBar\n return if self.disposed?\n # updates the current state of the HP bar\n zone = 0\n zone = 1 if self.hp <= @battler.totalhp*0.50\n zone = 2 if self.hp <= @battler.totalhp*0.25\n @sprites[\"hp\"].bitmap.blt(0,0,@colors,Rect.new(zone*2,0,2,6))\... | [
"0.7233305",
"0.72171783",
"0.7141941",
"0.68779904",
"0.68349004",
"0.6806555",
"0.6759613",
"0.66288334",
"0.6586484",
"0.64738137",
"0.6460168",
"0.645487",
"0.6424386",
"0.6378438",
"0.6336327",
"0.6302253",
"0.6299974",
"0.6298051",
"0.62900376",
"0.6264237",
"0.6261312"... | 0.7799209 | 0 |
method for displaying the stats of a given player | def show_stats
puts "*********************************"
#check to see if the player has any weapons
#display stats
if self.weapons.size == 0
puts "Current Health:".red + " #{self.hp}".bold
puts "Current Power:".blue + " #{self.power}".bold
#display
else
puts "Current Health... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_player_stats\n @output.puts '- Players -'.center(WIDTH)\n seperator = \"\\t\"\n stat_width = WIDTH - 5\n stats = String.new\n bot_stats = String.new\n\n stats << \"Player: #{@player.name}\".ljust(WIDTH/2)\n stats << seperator\n stats << \"Chips: #{@player.chi... | [
"0.8315523",
"0.770638",
"0.7660251",
"0.76092714",
"0.7581599",
"0.746786",
"0.7299938",
"0.72252",
"0.71763194",
"0.7117901",
"0.7089128",
"0.7087872",
"0.7069533",
"0.70651466",
"0.7040999",
"0.70028555",
"0.69877756",
"0.69825727",
"0.6967976",
"0.69613403",
"0.69562626",... | 0.75670123 | 5 |
Return the application's version string. | def version()
return ParseDecision::VERSION
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def versionString()\n\t\t\t\treturn \"#{major}.#{minor}.#{build}\"\n\t\t\tend",
"def version\n build_string\n end",
"def ver\n if v = version\n str = +\"#{program_name} #{[v].join('.')}\"\n str << \" (#{v})\" if v = release\n str\n end\n end",
"def application_version\n rea... | [
"0.8153033",
"0.80810785",
"0.80770165",
"0.7967893",
"0.7830355",
"0.7830355",
"0.76368684",
"0.76368684",
"0.757915",
"0.7577416",
"0.7577416",
"0.7577125",
"0.7527811",
"0.7481023",
"0.7440889",
"0.7440889",
"0.73899823",
"0.7379159",
"0.73780084",
"0.7361044",
"0.7361044"... | 0.0 | -1 |
Parse files based on the configuration. | def parseCfg(cfg)
$LOG.debug "Parser::parseCfg( cfg )"
if( !validateCfg(cfg) )
puts "ERROR: Invalid options."
return
end
if( !File.exists?(@context.file) )
@context.file = File.join( @context.srcdir, @context.file )
if( !File.exists?(@context.file) )
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_files\n @parse_files ||=\n begin\n files = expand_dirs_to_files(@path)\n files = file_sort(files)\n\n if @options['only'].present?\n files = file_accept(files, @options['only'])\n end\n\n # By default, tmp, vender, spec, test, features a... | [
"0.71039224",
"0.691917",
"0.6822221",
"0.6722013",
"0.6694547",
"0.6576133",
"0.65486646",
"0.6472655",
"0.6465814",
"0.63299894",
"0.6325209",
"0.62602884",
"0.6241334",
"0.62286943",
"0.6174209",
"0.6141843",
"0.61278224",
"0.61043894",
"0.60943955",
"0.6084847",
"0.606878... | 0.0 | -1 |
Parse an XML decision file. | def parseFile(fname)
$LOG.debug "Parser::parseFile( #{fname} )"
puts "Parsing file: #{fname}" if @context.verbose
# Determine the mode and configure plugins based on the file data.
configureForFileMode(fname)
line_count = 1
# Open the file and read line by line
df = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_xml(filename)\n @parser = Parser.new :pregenerated => filename\n @parser.parse\n end",
"def parse_xml\n\n raise \"parse_xml method has not been implemented in this class\"\n \n end",
"def parse(fname)\r\n puts \"Parsing file.\" unless (!verbose?)\r\n ctxListener ... | [
"0.6641009",
"0.6066658",
"0.6057007",
"0.603219",
"0.59758866",
"0.5967331",
"0.5960635",
"0.59363276",
"0.5923457",
"0.5920838",
"0.5903615",
"0.58487666",
"0.5785318",
"0.5756732",
"0.5733115",
"0.57223266",
"0.5697135",
"0.5625335",
"0.56161094",
"0.5571622",
"0.55673367"... | 0.49929798 | 74 |
Set directory where generated files are placed. | def setOutdir(dir)
@context.outdir = dir
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_dir\n File.join(root_path, 'generated')\n end",
"def generated_files_dir\n dir(@generated_files_dir || default_generated_files_dir)\n end",
"def gen_dir(gendir = nil)\n @gen_dir = \"#{gendir}#{gendir.empty? ? '.' : ''}\" if gendir\n @gen_dir\n end",
"def gen_dir(gendir)\n... | [
"0.7593993",
"0.7482969",
"0.7218836",
"0.7031479",
"0.6865798",
"0.6810424",
"0.6576333",
"0.6415231",
"0.63815355",
"0.62477845",
"0.62477845",
"0.62401015",
"0.62124145",
"0.62100536",
"0.61696047",
"0.61696047",
"0.6140647",
"0.61395013",
"0.611539",
"0.6080589",
"0.60624... | 0.6661985 | 6 |
Opens a browser window and sends you to my blog (Not tested on Windows) | def blog
system("open #{blog_url}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_in_browser\n puts url\n `#{open} #{url}`\n end",
"def open()\n \n #note we would want to check for the browser bing open already\n #so we don't annoy people\n \n event(\"Pre\")\n require 'launchy'\n Launchy.open(\"http://local.general.dev/info.php\... | [
"0.67058843",
"0.6701106",
"0.6601959",
"0.6566288",
"0.6462488",
"0.63849753",
"0.62929016",
"0.62779367",
"0.6259112",
"0.6228017",
"0.6228017",
"0.62276393",
"0.6186627",
"0.61483",
"0.6142089",
"0.61385244",
"0.6119605",
"0.6091906",
"0.6066312",
"0.60269153",
"0.60019904... | 0.76009464 | 0 |
Print out all basic information | def print
text = File.expand_path(File.dirname(__FILE__) + '/text/cv.txt')
File.readlines(text).each do |line|
puts line
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_basic_info\n \"Name:#{name}, Occupation:#{occupation}, Sex:#{sex}\"\n end",
"def show_info()\n\t\tputs \"ID: #{@@id}\"\n\t\tputs \"Name: #{@car_name}\"\n\t\tputs \"Make: #{@@make}\"\n\t\tputs \"Cost: #{calc_total_cost} INR\"\n\t\tputs\n\t\tputs \"Review: #{@review}\"\n\t\tputs \"Rating: #{@rating} ... | [
"0.78686696",
"0.7476243",
"0.74320716",
"0.7343626",
"0.72409546",
"0.7223008",
"0.7191144",
"0.7187334",
"0.7174564",
"0.71457267",
"0.7112385",
"0.70454144",
"0.7043258",
"0.70358133",
"0.70358133",
"0.70211315",
"0.70211315",
"0.70000863",
"0.6977748",
"0.6971914",
"0.696... | 0.0 | -1 |
Hire me! :from => Who you are :body => A little message :subject => Subject of the email | def hired!(options={})
raise "You need to specify from, subject and body" unless options.key?(:from) || options.key?(:body) || options.key?(:subject)
Pony.mail({:to => 'reddavis@gmail.com'}.merge(options))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_us(subject, body)\n unless ENV['RACK_ENV'] == 'development'\n recipient = \"The Awesome Team <openhsv@gmail.com>\"\n\n # First, instantiate the Mailgun Client with your API key\n mg_client = Mailgun::Client.new ENV['MAILGUN_PRIVATE']\n\n # Define your message parameters\n mess... | [
"0.7555445",
"0.7502845",
"0.7486557",
"0.7469479",
"0.7461183",
"0.73721486",
"0.73298424",
"0.7311195",
"0.72415924",
"0.71546984",
"0.7137693",
"0.7130245",
"0.7099609",
"0.7090259",
"0.7060519",
"0.70475614",
"0.70448947",
"0.7038294",
"0.7036938",
"0.7021658",
"0.7001909... | 0.7844362 | 0 |
Shared me CV with fellow coworkers. Sends them a URL to download this CV | def share_with(from, *emails)
emails.each do |email|
Pony.mail(:to => email,
:from => from,
:subject => 'Hey what do you think of this guy...',
:body => github_cv_url)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_video\n\t\t# preview_video_url = \"https://video.tvspielfilm.de/ivideo/video/10/9700610_1.mp4\"\n\n\t\tif preview_video_url.present?\t\n\t\t\tfilename = Pathname.new(preview_video_url).basename\n\t\t\tfilename = filename.to_s rescue \"#{Time.now.to_i}.mp4\"\n\t\t\t\n\t\t\tfilename = \"#{id}_#{filename... | [
"0.58917886",
"0.5761847",
"0.5689794",
"0.56559396",
"0.5642501",
"0.5607151",
"0.5575511",
"0.5574851",
"0.5568364",
"0.5515017",
"0.5506534",
"0.5503995",
"0.54688853",
"0.54328305",
"0.54328305",
"0.5417364",
"0.53947467",
"0.5383757",
"0.53732014",
"0.53666115",
"0.53392... | 0.0 | -1 |
Public: Generate a conditional SQL clause for each given filter. Returns the SQL as a string. | def to_sql
return nil unless filters.present? and valid?
filters.map { |n, f| sql_for(n) }.reject(&:blank?).join(' AND ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_filter_sql\n filter_sql = \"( \"\n self.foreach_filter do |filter|\n filter_sql += \"#{filter.get_filter_sql} #{filter.next_condition_as_sql} \"\n end\n filter_sql += \")\"\n return filter_sql\n end",
"def get_filters_sql\n if self.filters.blank?\n return ''\n ... | [
"0.8094061",
"0.7400032",
"0.7360341",
"0.7057596",
"0.697072",
"0.67012405",
"0.6664916",
"0.6664916",
"0.66009945",
"0.65790117",
"0.6518947",
"0.6518947",
"0.65135",
"0.64909905",
"0.6456157",
"0.6355946",
"0.63512546",
"0.6350173",
"0.6348552",
"0.62958217",
"0.62758034",... | 0.7932529 | 1 |
Public: Run the query and return the items. options The options to pass to queryable_class.find: :conditions Additional conditions for the query. :order Order clause as a String or Array of Strings. The default is derived from sort_criteria. A group_by clause is always prepended if the query is grouped. :limit The quer... | def items(options={})
order = [group_by_sort_clause, sort_criteria_clause, options[:order]]
order = order.flatten.reject(&:blank?).compact.uniq.join(",")
order = nil if order.blank?
includes = [options[:include], sort_criteria.map { |n, o| include_for(n) }]
includes << include_for(g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query(options) # :nodoc:\n @next_token = options[:next_token]\n query_expression = build_conditions(options[:query_expression])\n # add sort_options to the query_expression\n if options[:sort_option]\n sort_by, sort_order = sort_options(options[:sort_option])\n ... | [
"0.64638954",
"0.5721004",
"0.5641033",
"0.55430955",
"0.55430955",
"0.5428115",
"0.5416814",
"0.53459305",
"0.5330626",
"0.53125036",
"0.5263157",
"0.52060485",
"0.519313",
"0.51756084",
"0.5116499",
"0.51153415",
"0.50969154",
"0.50912356",
"0.5089135",
"0.50853956",
"0.508... | 0.76387405 | 0 |
Public: Returns a sort clause derived from the group_by column. The order is pulled from available_columns and defaults to ascending. Returns a String SQL clause. | def group_by_sort_clause
return nil unless grouped?
order_clause group_by,
(default_order_for(group_by) || :asc),
(sortable_for(group_by) || true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_by_sort_order\n if grouped? && (column = group_by_column)\n order = sort_criteria_order_for(column.name) || column.default_order\n column.sortable.is_a?(Array) ?\n column.sortable.collect {|s| \"#{s} #{order}\"}.join(',') :\n \"#{column.sortable} #{order}\"\n end\n end",
... | [
"0.7638743",
"0.72135925",
"0.7106896",
"0.69431645",
"0.68971735",
"0.6867724",
"0.67624557",
"0.65752786",
"0.6560675",
"0.6549717",
"0.64147556",
"0.6395926",
"0.63616353",
"0.63315666",
"0.6283763",
"0.6146684",
"0.6107245",
"0.60634905",
"0.6028775",
"0.6024536",
"0.6020... | 0.8168596 | 0 |
Public: Returns a sort clause derived from the sort_criteria. The group_by column is always removed, since it will be handled separately. Returns a String SQL clause. | def sort_criteria_clause
return nil unless sort_criteria.present?
sort_criteria.map { |name, order| order_clause(name, order) if name != group_by }.reject(&:blank?).join(',')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_by_sort_clause\n return nil unless grouped?\n order_clause group_by, \n (default_order_for(group_by) || :asc), \n (sortable_for(group_by) || true)\n end",
"def group_by_sort_order\n if grouped? && (column = group_by_column)\n order = sort_criteria_order_for(column.nam... | [
"0.8171751",
"0.75231844",
"0.75152755",
"0.72794294",
"0.712665",
"0.69320977",
"0.67540526",
"0.6722316",
"0.64181525",
"0.6412818",
"0.6266479",
"0.6257415",
"0.6170133",
"0.6163118",
"0.6131297",
"0.610832",
"0.6092351",
"0.6063083",
"0.6060084",
"0.60569334",
"0.60569286... | 0.76524013 | 1 |
Returns a SQL clause for a date or datetime field. | def date_clause(table, field, from, to)
s = []
s << ("#{table}.#{field} > '%s'" % [connection.quoted_date((from - 1).to_time.end_of_day)]) if from
s << ("#{table}.#{field} <= '%s'" % [connection.quoted_date(to.to_time.end_of_day)]) if to
s.join(' AND ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_clause(table, field, from, to)\n s = []\n if from\n from_yesterday = from - 1\n from_yesterday_time = Time.local(from_yesterday.year, from_yesterday.month, from_yesterday.day)\n if self.class.default_timezone == :utc\n from_yesterday_time = from_yesterday_time.utc\n end\n ... | [
"0.6761678",
"0.67007613",
"0.6615816",
"0.65976596",
"0.64795",
"0.6290864",
"0.62821436",
"0.6151169",
"0.6080176",
"0.6070666",
"0.60588163",
"0.6050347",
"0.601616",
"0.59982234",
"0.58085644",
"0.57310665",
"0.57018715",
"0.5629879",
"0.5591728",
"0.552414",
"0.55058146"... | 0.67144126 | 1 |
Returns a SQL clause for a date or datetime field using relative dates. | def relative_date_clause(table, field, days_from, days_to)
date_clause(table, field, (days_from ? Date.today + days_from : nil), (days_to ? Date.today + days_to : nil))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relative_date_clause(table, field, days_from, days_to)\n date_clause(table, field, (days_from ? Date.today + days_from : nil), (days_to ? Date.today + days_to : nil))\n end",
"def relative_date_clause(table, field, days_from, days_to)\n date_clause(table, field, (days_from ? Date.today + days_from : n... | [
"0.7916117",
"0.7916117",
"0.71775657",
"0.7087279",
"0.7069307",
"0.67671645",
"0.6665684",
"0.6291998",
"0.62455803",
"0.613135",
"0.6094927",
"0.6094068",
"0.5842428",
"0.5817658",
"0.57967645",
"0.57849914",
"0.5680531",
"0.5475651",
"0.544504",
"0.53898245",
"0.5313643",... | 0.78421736 | 2 |
Helper method to generate the WHERE sql for a +field+, +operator+ and a +value+ | def sql_for(name, operator=nil, values=nil, table=nil, field=nil, type=nil)
values ||= values_for(name)
# return if values_blank?(name, values)
type ||= type_for(name)
table ||= queryable_class.table_name
operator ||= operator_for(name)
field ||= name
sql = nil
case oper... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sql_for_field(field, operator, value, db_table, db_field, is_custom_filter=false)\n sql = ''\n case operator\n when \"=\"\n if value.any?\n case type_for(field)\n when :date, :date_past\n sql = date_clause(db_table, db_field, (Date.parse(value.first) rescue nil), (Date.pars... | [
"0.7423291",
"0.7368303",
"0.72244465",
"0.7081502",
"0.7064582",
"0.700777",
"0.6853337",
"0.68013805",
"0.67052764",
"0.6692466",
"0.66903245",
"0.6663531",
"0.66351473",
"0.65600836",
"0.6530368",
"0.648571",
"0.64322424",
"0.6410216",
"0.6329698",
"0.63262427",
"0.6323888... | 0.6486339 | 15 |
PLACE 0,0,NORTH MOVE REPORT Output: 0,1,NORTH | def test_scenario1
r = robot
r.move(table)
assert_equal('0,1,NORTH', r.report)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def place\n next_move = {x: command.arguments[:x], y: command.arguments[:y]}\n if inside_table?(next_move_x_y(next_move, false))\n update_position!(next_move_x_y(next_move, false))\n update_direction!\n else\n almost_die\n end\n end",
"def move\n @coordinates[1] += 1 ... | [
"0.6726027",
"0.6560745",
"0.6539834",
"0.6535293",
"0.6527546",
"0.6520768",
"0.65065175",
"0.64961916",
"0.64522535",
"0.6411783",
"0.63982135",
"0.6396631",
"0.63836455",
"0.6357319",
"0.63566446",
"0.6338761",
"0.6325651",
"0.6325651",
"0.63244396",
"0.6310757",
"0.629076... | 0.63011116 | 20 |
PLACE 0,0,NORTH LEFT REPORT Output: 0,0,WEST | def test_scenario2
r = robot
r.turn_left
assert_equal('0,0,WEST', r.report)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drive_west(direction)\n if direction == 'W'\n @new_horizontal_position = take_input[2].to_i\n @new_horizontal_position -= 1\n @current_position = \"#{@new_horizontal_position},#{take_input[3].to_i}\"\n end\n end",
"def west\n @west ||= id.div(ROWS) * SIZE + SOUTH_WEST.lng\n end",
... | [
"0.71620125",
"0.6751498",
"0.63663757",
"0.6259096",
"0.62498456",
"0.60428506",
"0.6041264",
"0.60330224",
"0.59826523",
"0.59790814",
"0.59680974",
"0.59331715",
"0.5905262",
"0.58589476",
"0.58507276",
"0.58234036",
"0.58156127",
"0.5779869",
"0.5773733",
"0.5767857",
"0.... | 0.5653994 | 29 |
PLACE 1,2,EAST MOVE MOVE LEFT MOVE REPORT Output: 3,3,NORTH | def test_scenario3
r = Robot.new(1, 2, 'EAST')
r.move(table)
r.move(table)
r.turn_left
r.move(table)
assert_equal('3,3,NORTH', r.report)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def left\n if @position != []\n if @position[2] == \"EAST\"\n @position[2] = \"NORTH\"\n elsif @position[2] == \"WEST\"\n @position[2] = \"SOUTH\"\n elsif @position[2] == \"NORTH\"\n @position[2] = \"WEST\"\n elsif @position[2] == \"SOUTH\"\n @position[2] = \"EAST\"\n end\n els... | [
"0.6981736",
"0.6721071",
"0.66007376",
"0.65701956",
"0.6481079",
"0.64718866",
"0.64606196",
"0.6455801",
"0.6443049",
"0.64305604",
"0.64285034",
"0.6404821",
"0.63822407",
"0.636183",
"0.63358563",
"0.6310428",
"0.62961847",
"0.6269694",
"0.62652886",
"0.62573844",
"0.623... | 0.634947 | 14 |
GET /movers GET /movers.json | def index
@movers = Mover.all
render json: @movers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @vers = Ver.all\n end",
"def list_all_aos_versions(args = {}) \n get(\"/aosversions.json/all\", args)\nend",
"def index\n @verbs = Verb.all\n\n render json: @verbs\n end",
"def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend",
"def show\n @jm_verse = ... | [
"0.6280001",
"0.62173295",
"0.620463",
"0.61603177",
"0.59509516",
"0.5942563",
"0.5891583",
"0.5883662",
"0.58809155",
"0.5865459",
"0.5785898",
"0.57800215",
"0.5767855",
"0.57437533",
"0.5723428",
"0.57047355",
"0.57047355",
"0.57047355",
"0.5694611",
"0.5693582",
"0.56812... | 0.69801074 | 0 |
GET /movers/1 GET /movers/1.json | def show
render json: @mover
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @movers = Mover.all\n\n render json: @movers\n end",
"def show\n @jm_verse = JmVerse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jm_verse }\n end\n end",
"def show\n @monit = Monit.find(params[:id])\n\n re... | [
"0.6883134",
"0.6593592",
"0.62272745",
"0.6108805",
"0.61077464",
"0.61077464",
"0.61077464",
"0.6051739",
"0.60380703",
"0.6022514",
"0.5998722",
"0.599316",
"0.5991184",
"0.5976257",
"0.5953912",
"0.59391624",
"0.59266895",
"0.59152865",
"0.5910201",
"0.58913296",
"0.58911... | 0.0 | -1 |
POST /movers POST /movers.json | def create
@mover = Mover.new(mover_params)
if @mover.save
render json: @mover, status: :created, location: @mover
else
render json: @mover.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n megam_rest.post_promos(to_hash) #WONT BE USED AS OF NOW\n end",
"def create\n @verb = Verb.new(verb_params)\n\n if @verb.save\n render json: @verb, status: :created, location: @verb\n else\n render json: @verb.errors, status: :unprocessable_entity\n end\n end",
"def ... | [
"0.618034",
"0.6041709",
"0.5827564",
"0.5759862",
"0.5752757",
"0.57189643",
"0.561509",
"0.5601669",
"0.5597951",
"0.5597951",
"0.5513864",
"0.55125785",
"0.549787",
"0.5477987",
"0.5390466",
"0.5381035",
"0.5328123",
"0.5285386",
"0.5277775",
"0.5256013",
"0.5230142",
"0... | 0.5224448 | 21 |
PATCH/PUT /movers/1 PATCH/PUT /movers/1.json | def update
@mover = Mover.find(params[:id])
if @mover.update(mover_params)
head :no_content
else
render json: @mover.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def patch!\n request! :patch\n end",
"def update\n @verb = Verb.... | [
"0.6559324",
"0.6404041",
"0.6288759",
"0.62777406",
"0.615597",
"0.6143237",
"0.60717356",
"0.6019002",
"0.599752",
"0.599752",
"0.5994568",
"0.59854394",
"0.59622806",
"0.5945145",
"0.5945145",
"0.59058744",
"0.58820784",
"0.58739406",
"0.5863574",
"0.5855251",
"0.5854169",... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.