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
PATCH/PUT /skills_users/1 PATCH/PUT /skills_users/1.json
def update respond_to do |format| if @skills_user.update(skills_user_params) format.html { redirect_to @skills_user, notice: 'Skills user was successfully updated.' } format.json { render :show, status: :ok, location: @skills_user } else format.html { render :edit } forma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @user_skill = UserSkill.find(params[:id])\n\n respond_to do |format|\n if @user_skill.update_attributes(params[:user_skill])\n format.html { redirect_to @user_skill, notice: 'User skill was successfully updated.' }\n format.json { head :no_content }\n else\n format...
[ "0.73963255", "0.7313134", "0.72381735", "0.7172604", "0.6868651", "0.68263346", "0.67393565", "0.67176044", "0.66935027", "0.66719806", "0.66248727", "0.6591147", "0.6525093", "0.65120304", "0.65120304", "0.6480547", "0.64662945", "0.6424622", "0.6397266", "0.6377717", "0.63...
0.76252794
0
DELETE /skills_users/1 DELETE /skills_users/1.json
def destroy @skills_user.destroy respond_to do |format| format.html { redirect_to skills_users_url, notice: 'Skills user was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @user_skill = UserSkill.find(params[:id])\n @user_skill.destroy\n\n respond_to do |format|\n format.html { redirect_to user_skills_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @skill = @user.skills.find(params[:id])\n @skill.destroy\n\n respo...
[ "0.7936429", "0.77148426", "0.75620735", "0.7529557", "0.7500365", "0.72862726", "0.71611124", "0.7122857", "0.7040144", "0.70263976", "0.6995813", "0.6983281", "0.6982126", "0.6965075", "0.696273", "0.6958852", "0.69474936", "0.6923944", "0.688285", "0.68542176", "0.68472826...
0.790851
1
Use callbacks to share common setup or constraints between actions.
def set_skills_user @skills_user = SkillsUser.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.6165422", "0.60457647", "0.5946384", "0.5916027", "0.58905005", "0.583495", "0.5777223", "0.56995213", "0.56995213", "0.56532377", "0.5621348", "0.5422839", "0.54118705", "0.54118705", "0.54118705", "0.53935355", "0.5379617", "0.53577393", "0.53407264", "0.53398263", "0.53...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def skills_user_params # params.fetch(:skills_user, {}) params.require(:skills_user).permit(:user_id, :skill_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.6981273", "0.6783789", "0.67460483", "0.6742222", "0.67354137", "0.65934366", "0.65028495", "0.6497783", "0.64826745", "0.6479415", "0.6456823", "0.6440081", "0.63800216", "0.6376521", "0.636652", "0.6319898", "0.6300256", "0.62994003", "0.6293621", "0.6292629", "0.6291586...
0.0
-1
Create a new instance of the class described in attributes[:internal_resource]
def convert! @resource ||= resource end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource\n resource_klass.new(attributes.symbolize_keys.merge(new_record: false))\n end", "def build_resource\n self.resource = resource_class.new(resource_params)\n end", "def build_resource(hash = {})\n self.resource = resource_class.new(hash)\n end", "def new(attributes = {...
[ "0.73300165", "0.7151475", "0.7022157", "0.6877556", "0.68694437", "0.6819088", "0.68176883", "0.6793027", "0.6777795", "0.6771038", "0.67329603", "0.6712503", "0.66959006", "0.66959006", "0.6655062", "0.6644095", "0.663743", "0.6618087", "0.65998495", "0.65989155", "0.659891...
0.0
-1
Construct a new Valkyrie Resource using the attributes retrieved from the database
def resource resource_klass.new( attributes.merge( new_record: false, Valkyrie::Persistence::Attributes::OPTIMISTIC_LOCK => lock_token ) ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource\n resource_klass.new(attributes.symbolize_keys.merge(new_record: false))\n end", "def initialize(resource)\n @attributes = OpenStruct.new(resource.attributes.to_hash)\n end", "def build(attributes)\n Model.new(resource_gateway, attributes)\n end", "def new(attributes = {})\n ...
[ "0.68473095", "0.6451179", "0.64106363", "0.62615484", "0.6138977", "0.61307365", "0.6091602", "0.60788167", "0.6074454", "0.6052761", "0.60387117", "0.60077095", "0.60040855", "0.59725994", "0.596118", "0.5957456", "0.5950076", "0.5902554", "0.59009105", "0.5898545", "0.5893...
0.55683714
76
Construct the optimistic lock token using the adapter and lock version for the Resource
def lock_token return lock_token_warning unless orm_object.class.column_names.include?("lock_version") @lock_token ||= Valkyrie::Persistence::OptimisticLockToken.new( adapter_id: resource_factory.adapter_id, token: orm_object.lock_version ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def token\n Valkyrie::Persistence::OptimisticLockToken.new(adapter_id: resource_factory.adapter_id, token: version)\n end", "def lock_token\n return nil if object[:lock_version].blank?\n @lock_token ||=\n Valkyrie::Persistence::OptimisticLockToken.new(\n adapter_id: resource_fac...
[ "0.8428372", "0.82416886", "0.7086971", "0.70768666", "0.6429185", "0.593253", "0.5904177", "0.57884455", "0.5784479", "0.5742413", "0.56850034", "0.564966", "0.5546797", "0.5491265", "0.5474813", "0.5325415", "0.5303181", "0.5297073", "0.5292952", "0.5292928", "0.5278285", ...
0.7775911
2
Issue a migration warning for previous releases of Valkyrie which did not support optimistic locking
def lock_token_warning return nil unless resource_klass.optimistic_locking_enabled? warn "[MIGRATION REQUIRED] You have loaded a resource from the Postgres adapter with " \ "optimistic locking enabled, but the necessary migrations have not been run. \n" \ "Please run `bin/rails...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_atomic_update!\n quoted_col_name_clean = connection.quote_column_name('clean_version')\n quoted_col_name_dirty = connection.quote_column_name('dirty_version') \n affected_rows = connection.update(<<-end_sql, \"#{self.class.name} Update with 'clean/dirty version' locking\")\n UPDATE #{se...
[ "0.63315296", "0.62807775", "0.6112958", "0.60421", "0.60012513", "0.5934006", "0.59104604", "0.59104604", "0.5798562", "0.57777286", "0.57105774", "0.5701408", "0.5685037", "0.56095004", "0.5595273", "0.55917376", "0.5589016", "0.556536", "0.5552687", "0.5547992", "0.5547992...
0.7576175
0
Retrieve the Class used to construct the Valkyrie Resource
def resource_klass Valkyrie.config.resource_class_resolver.call(internal_resource) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_klass\n Valkyrie.config.resource_class_resolver.call(internal_resource)\n end", "def resource_klass\n Valkyrie.config.resource_class_resolver.call(internal_resource)\n end", "def resource_klass\n @resource_klass ||= JsonApi::Resources::Discovery\n .resource_for_name obj...
[ "0.8275578", "0.8275578", "0.78705853", "0.7853335", "0.7699302", "0.76302373", "0.7621101", "0.76009166", "0.75991315", "0.75954914", "0.7575006", "0.75725985", "0.75725985", "0.75725985", "0.757064", "0.756112", "0.756112", "0.756112", "0.7522686", "0.75208414", "0.7513814"...
0.8211478
2
Access the String for the Valkyrie Resource type within the attributes
def internal_resource attributes[:internal_resource] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rrtype\n @attributes[:rrtype]\n end", "def get_resource_type()\n return RedXmlResource::TYPE\n end", "def getResourceType() \n @obj.getResourceType() \n end", "def type\n @attributes[:type]\n end", "def resource_type(resource)\n resource.xpath('string(command/ident/...
[ "0.686555", "0.68285525", "0.6740357", "0.6709638", "0.66803086", "0.66803086", "0.6643613", "0.6643613", "0.6643613", "0.65329915", "0.65033334", "0.6488952", "0.6480422", "0.64715666", "0.64715666", "0.64715666", "0.64715666", "0.64684397", "0.6454553", "0.644137", "0.64375...
0.0
-1
Generate a Hash derived from Valkyrie Resource metadata encoded in the RDF
def rdf_metadata @rdf_metadata ||= RDFMetadata.new(orm_object.metadata).result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n [anchor, cv, nullifier, proof, rk, spend_auth_sig].hash\n end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash\n guid.hash\n end", "def hash\n raw = [name, type, values.join('/')]....
[ "0.6512681", "0.64285296", "0.64285296", "0.64285296", "0.64285296", "0.64285296", "0.64285296", "0.64285296", "0.6340804", "0.63384116", "0.62793946", "0.62301", "0.6172481", "0.61149955", "0.60792553", "0.6045069", "0.6044548", "0.6009207", "0.5983657", "0.5956043", "0.5954...
0.0
-1
GET /m1s GET /m1s.json
def index @m1s = M1.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_m1\n @m1 = M1.find(params[:id])\n end", "def index\n @cmms = Cmm.all\n render json: @cmms\n end", "def index\n @mugshots = Mugshot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mugshots }\n end\n end", "def index\n @m...
[ "0.5940741", "0.5886358", "0.58298373", "0.5762683", "0.573294", "0.5711572", "0.57099724", "0.5666089", "0.5662484", "0.56445783", "0.563639", "0.563154", "0.5601376", "0.55895865", "0.5573028", "0.5563265", "0.55493164", "0.55295026", "0.55183697", "0.5486725", "0.547825", ...
0.71321964
0
GET /m1s/1 GET /m1s/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @m1s = M1.all\n end", "def set_m1\n @m1 = M1.find(params[:id])\n end", "def create\n @m1 = M1.new(m1_params)\n\n respond_to do |format|\n if @m1.save\n format.html { redirect_to @m1, notice: 'M1 was successfully created.' }\n format.json { render :show, status: ...
[ "0.71655387", "0.6450512", "0.6081672", "0.57148945", "0.5667608", "0.5663954", "0.56352955", "0.5619258", "0.5598063", "0.55687493", "0.5463022", "0.54463017", "0.54461145", "0.5440451", "0.54317343", "0.54245573", "0.54208237", "0.5416458", "0.54011536", "0.5397025", "0.537...
0.0
-1
POST /m1s POST /m1s.json
def create @m1 = M1.new(m1_params) respond_to do |format| if @m1.save format.html { redirect_to @m1, notice: 'M1 was successfully created.' } format.json { render :show, status: :created, location: @m1 } else format.html { render :new } format.json { render json: @m1...
{ "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 megam_rest.post_appdefn(to_hash)\n end", "def set_m1\n @m1 = M1.find(params[:id])\n end", "def create\n megam_rest.post_appreq(to_hash)\n end", "def index\n @m1s = M1.all\n end", ...
[ "0.6138955", "0.5817167", "0.56230235", "0.56179196", "0.55499136", "0.543654", "0.5301853", "0.5256846", "0.52270633", "0.5224802", "0.51322967", "0.5112962", "0.5110948", "0.5100036", "0.50989723", "0.5086544", "0.5086125", "0.5061694", "0.50557655", "0.505296", "0.5047409"...
0.66608363
0
PATCH/PUT /m1s/1 PATCH/PUT /m1s/1.json
def update respond_to do |format| if @m1.update(m1_params) format.html { redirect_to @m1, notice: 'M1 was successfully updated.' } format.json { render :show, status: :ok, location: @m1 } else format.html { render :edit } format.json { render json: @m1.errors, status: :un...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch!\n request! :patch\n end", "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 set_m1\n @m1 = M1.fi...
[ "0.5845718", "0.5832054", "0.57704973", "0.5738084", "0.56756413", "0.5665514", "0.5645811", "0.5598781", "0.55687165", "0.5558141", "0.55474865", "0.55414104", "0.5539623", "0.5515649", "0.55037093", "0.5498082", "0.54946035", "0.54853797", "0.54620135", "0.5444358", "0.5439...
0.6701933
0
DELETE /m1s/1 DELETE /m1s/1.json
def destroy @m1.destroy respond_to do |format| format.html { redirect_to m1s_url, notice: 'M1 was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @momsg = Momsg.find(params[:id])\n @momsg.destroy\n\n respond_to do |format|\...
[ "0.63473576", "0.632736", "0.62279093", "0.6192553", "0.6187123", "0.60917205", "0.6088695", "0.608592", "0.6056924", "0.6056218", "0.60469455", "0.60427034", "0.60416853", "0.60316896", "0.60276306", "0.60086936", "0.59864855", "0.59838283", "0.59788656", "0.5968564", "0.596...
0.7217923
0
Use callbacks to share common setup or constraints between actions.
def set_m1 @m1 = M1.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 m1_params params.require(:m1).permit(:one, :two, :quiz_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.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
Sends a remote procedure call +method+ and +params+.
def call method, params json = { 'method' => method.to_s, 'params' => params } @connection.send @box.encrypt MultiJson.dump json read_response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_rpc(method, params: [])\n @api.send(method, *params)\n end", "def call(method, *params)\n request('/RPC2',\n :method => 'post',\n :params => XMLRPC::Marshal.dump_call(method, *params)\n )\n end", "def call(method, *args) rpc_execute(method, *args) end", "...
[ "0.7336448", "0.7211534", "0.7075728", "0.68223715", "0.67751074", "0.67352176", "0.67046267", "0.66924226", "0.6604785", "0.62937766", "0.61537206", "0.6150986", "0.61464804", "0.6138706", "0.6128844", "0.6116936", "0.5992208", "0.5972572", "0.597198", "0.5968376", "0.596123...
0.5860859
26
need to manually enter the track id and the user id
def create @annotation = Annotation.new(annotation_params) @annotation.author_id = current_user.id @annotation.track_id = params[:track_id] if @annotation.save render :show else render json: @annotation.errors.full_messages, status: 422 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_track\n # @track = Track.find(params[:id])\n end", "def logging_in\n # For example:\n guest_tracks = guest_user.tracks.all\n guest_tracks.each do |track|\n track.user_id = current_user.id\n track.save!\n end\n end", "def set_user_track_log\n @user_track_log = UserTra...
[ "0.6988656", "0.68657947", "0.68058217", "0.67583483", "0.67583483", "0.67323804", "0.66829056", "0.66829056", "0.66829056", "0.66829056", "0.66829056", "0.66829056", "0.66829056", "0.66829056", "0.66829056", "0.66829056", "0.66384476", "0.6592786", "0.6592786", "0.65325737", ...
0.0
-1
GET /orders GET /orders.json
def index @paginanation = nil build do if params[:scope] == "pending" message 'Покупки ожидающие ответа продавца' orders Order.where(consumer_id: current_user.id, status: 0).order('created_at DESC') elsif params[:scope] == "close" message 'Завершенные покупки пользователя'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end", "def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end", "def index\n @orders = Order.all\n render json: @orders\n end", "def index\n @orders = Order.all\n ...
[ "0.83267236", "0.815406", "0.80041754", "0.7947603", "0.7846487", "0.7823147", "0.78028905", "0.76992875", "0.76980406", "0.7682792", "0.7682792", "0.7682792", "0.7682792", "0.76827645", "0.75880665", "0.7574349", "0.756171", "0.7531827", "0.74860185", "0.7432208", "0.7369724...
0.0
-1
GET /orders/1 GET /orders/1.json
def show build do message 'Данные о покупке' view 'consumer/orders/show' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end", "def index\n @orders = Order.all\n render json: @orders\n end", "def index\n @orders = Order.all\n render json: @orders, status: 200\n end", "def index\n @orders = Order.order(\"id\").all\n\n resp...
[ "0.7554187", "0.7488565", "0.7475228", "0.73777765", "0.73714006", "0.7341344", "0.73384553", "0.73168725", "0.73018956", "0.7291244", "0.7291244", "0.7291244", "0.7291244", "0.72911215", "0.7281374", "0.7266143", "0.72498786", "0.7228276", "0.7213504", "0.71842283", "0.71261...
0.0
-1
POST /orders POST /orders.json
def create if params[:order][:id] build do message 'Повторый заказ' order Order.create_order_from_order(params[:order][:id]) view 'consumer/orders/show' end elsif Order.create_orders_from_cart(params[:cart_id], current_user) build do message 'Создание заказов' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def orders\n authenticated_post(\"orders\").body\n end", "def create\n order = Order.create(order_params)\n render json: order\nend", "def orders\n authenticated_post(\"auth/r/orders\").body\n end", "def submit_order()\n\tputs \"Submitting order\"\n\tdata = create_order()\n\tresponse = ...
[ "0.75854594", "0.7488331", "0.7488016", "0.74659675", "0.7273466", "0.7195538", "0.7062834", "0.6974246", "0.69102997", "0.6887998", "0.6874573", "0.68495136", "0.6839207", "0.6837934", "0.6837934", "0.6837934", "0.6837934", "0.68222916", "0.678991", "0.6778651", "0.6778453",...
0.6266376
96
PATCH/PUT /orders/1 PATCH/PUT /orders/1.json
def update if @order.update(order_params) render :show, status: :ok, location: @order else render json: @order.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @order = Order.find(params[:id])\n\n if @order.update(order_params)\n head :no_content\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end", "def update\n @order = Order.find(params[:id])\n\n if @order.update(order_params)\n head :no_conte...
[ "0.6801285", "0.6801285", "0.6773653", "0.67422754", "0.6734117", "0.6725639", "0.6721942", "0.671828", "0.67034334", "0.67033666", "0.67033666", "0.67033666", "0.67033666", "0.67033666", "0.67033666", "0.67033666", "0.67033666", "0.67033666", "0.67033666", "0.67033666", "0.6...
0.0
-1
DELETE /orders/1 DELETE /orders/1.json
def destroy if @order.destroy build do message 'Удаление заказа' view 'consumer/orders/delete' end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @v1_order = V1::Order.find(params[:id])\n @v1_order.destroy\n\n head :no_content\n end", "def destroy\n @order1 = Order1.find(params[:id])\n @order1.destroy\n\n respond_to do |format|\n format.html { redirect_to order1s_url }\n format.json { head :no_content }\n end\...
[ "0.7592003", "0.7475092", "0.74298924", "0.7371978", "0.7371411", "0.7371187", "0.7357556", "0.7357556", "0.7357556", "0.7357556", "0.7357556", "0.7347606", "0.7347606", "0.7347606", "0.7347606", "0.7347606", "0.7347606", "0.7347606", "0.7347606", "0.7347606", "0.7347606", ...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_order @order = Order.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 order_params params.fetch(:order, {}) 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
Returns back all categories related to a primary category e.g. "blog" or "questions"
def filter_categories_by_primary_category(posts) filtered = [] for post in posts for post_category in post.categories filtered.push(post_category) unless RESTRICTED_CATEGORIES.include? post_category end end filtered.sort.uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categories\n category\n end", "def getCategories(_, _, _)\n @db.categories\n end", "def all_categories\n end", "def categories\n taxonomies.all :conditions => { :classification => :category }\n end", "def category(id)\n db = connect()\n return db.execute('SELECT Id,Title ...
[ "0.7151989", "0.69634485", "0.6952917", "0.68637645", "0.6838024", "0.6830476", "0.6799438", "0.6786178", "0.67813516", "0.67395335", "0.67309", "0.6728612", "0.6727116", "0.67252743", "0.67222536", "0.6719791", "0.6693302", "0.6693302", "0.6693302", "0.6683539", "0.6683186",...
0.64872384
40
GET /companies GET /companies.json
def index @companies = Company.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def companies\n render \"company/companies.json.jbuilder\", status: :ok\n end", "def index\n @companies = Company.all\n if @companies\n render json: {\n companies: @companies\n }\n else\n render json: {\n status: 500,\n errors: ['No companies']\n }\n end...
[ "0.79014075", "0.78579754", "0.77734107", "0.77734107", "0.77734107", "0.77734107", "0.7593946", "0.751332", "0.7442931", "0.74332345", "0.7311373", "0.72778213", "0.72639275", "0.7246536", "0.72437197", "0.7199838", "0.715509", "0.7150789", "0.7148859", "0.7133268", "0.71272...
0.70310616
35
GET /companies/1 GET /companies/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @companies = Company.all\n @com_info = Company.last\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def companies\n render \"company/companies.json.jbuilder\", status: :ok\n end", "def index\n @companie...
[ "0.7809677", "0.7684622", "0.7650939", "0.764286", "0.764286", "0.764286", "0.764286", "0.7573474", "0.75325364", "0.74133873", "0.74133873", "0.74133873", "0.74133873", "0.74133873", "0.74133873", "0.7337208", "0.7308071", "0.7303884", "0.72902197", "0.7241168", "0.7118292",...
0.0
-1
POST /companies POST /companies.json
def create @company = Company.new(company_params) if current_user current_user.companies << @company end @company.save flash[:safe] = %Q[#{t("company_created")} #{view_context.link_to(t("create_new_open_jobs"), administration_company_path(@company))}.] respond_to do |format| if @comp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n render json: Company.create(params[\"company\"])\n end", "def create\n if @company = Company.find(entity_id_from_params(:company))\n respond_to do |format|\n current_user.account.companies << @company\n format.html { redirect_to root_path, notice: 'Company was successfully ...
[ "0.7508227", "0.74532276", "0.71477157", "0.7066147", "0.6990666", "0.6990459", "0.69900304", "0.69900304", "0.69900304", "0.69900304", "0.6920757", "0.69169074", "0.69169074", "0.69169074", "0.69169074", "0.69169074", "0.69145435", "0.69024074", "0.689738", "0.6891364", "0.6...
0.63786197
51
PATCH/PUT /companies/1 PATCH/PUT /companies/1.json
def update respond_to do |format| if @company.update(company_params) format.html { redirect_to @company, notice: t("updated") } format.json { render :show, status: :ok, location: @company } else format.html { render :edit } format.json { render json: @company.errors, stat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update\n @company = Company.find(company_params[:id])\n\n if @company.update(company_params)\n head :no_content\n else\n render json: @company.errors, status: :unprocessable_entity\n end\n end", ...
[ "0.76345783", "0.7151384", "0.7054653", "0.7043556", "0.7036788", "0.7036788", "0.7036788", "0.7036788", "0.7036788", "0.7036788", "0.7030497", "0.7016897", "0.70110387", "0.69732136", "0.6945714", "0.6918853", "0.6918853", "0.6878453", "0.6874265", "0.6836176", "0.6835676", ...
0.67472816
40
DELETE /companies/1 DELETE /companies/1.json
def destroy @company.destroy respond_to do |format| format.html { redirect_to companies_url, notice: t("company_destroyed") } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n render json: Company.delete(params[\"id\"])\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format....
[ "0.8019473", "0.7862428", "0.76931924", "0.76931924", "0.76931924", "0.76931924", "0.76931924", "0.76931924", "0.76931924", "0.76931924", "0.76931924", "0.76931924", "0.76426274", "0.76239645", "0.76221794", "0.76221794", "0.76221794", "0.756952", "0.75480443", "0.7540624", "...
0.74236715
22
Use callbacks to share common setup or constraints between actions.
def set_company @company = Company.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 company_params params.require(:company).permit(:name, :description, :location, :website) 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
puts bagi(8, 0) rescue => param / penanganan error berdasarkan parameter
def bagi(a,b) begin hasil = a/b rescue error = true end if error puts "terjadi error" else hasil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bagi(a,b)\n # begin\n # a / b\n # rescue\n # 0\n # end\n\n ##Kode di atas akan sama dengan, tapi konsekwensinya adalah rescue ini harus ada di bawah karena kita tidak bisa menambah kodingan lagi (solusi lebih baik adalah dengan begin ..... end)\n # a / b\n # rescue\n # 0\n\n ...
[ "0.7488402", "0.6691363", "0.5768109", "0.56298137", "0.55696684", "0.551259", "0.55103505", "0.54870206", "0.54632694", "0.54378384", "0.54019123", "0.53808254", "0.53591245", "0.53507954", "0.5350293", "0.5337386", "0.5294819", "0.52852666", "0.5262974", "0.5255192", "0.524...
0.7042428
1
skip_authorize_resource :only => :index
def index @released = Comic.where(released: true).paginate(page: params[:page]).order('position ASC') @unreleased = Comic.where(released: false).paginate(page: params[:page]).order('position ASC') @featured = Comic.where(featured: true).take @webcomics = Webcomic.all.includes(:webcomic_pages).order('web...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skip_authorization; end", "def show\n skip_authorization\n end", "def index\n prevent_non_admin\n end", "def skip_load_and_authorize_resource(*args)\n skip_load_resource(*args)\n skip_authorize_resource(*args)\n end", "def ignore_request_unless_permitted\n return if ...
[ "0.7614575", "0.75594807", "0.748137", "0.7383461", "0.7103904", "0.70286363", "0.7017364", "0.6975054", "0.6969574", "0.6966128", "0.6944401", "0.68073565", "0.6717292", "0.6707942", "0.6689672", "0.66859114", "0.66859114", "0.66859114", "0.66859114", "0.66859114", "0.668591...
0.0
-1
Method gets single could details
def get_cloud(cloud_id) http_get_request(Scalarium.clouds_url+"/#{cloud_id}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_infos\n #detail = Info.find_by_status(true).detail\n #if detail \n # return detail\n #else\n # return \"wating for updatting.....\"\n #end\n info = Info.random_to_show_info\n return info.detail\n\n end", "def details\n data.details\n end", "def details\n data()\n ...
[ "0.76821506", "0.72736484", "0.7262107", "0.7222693", "0.7155168", "0.7155168", "0.7155168", "0.7089826", "0.7089826", "0.7089826", "0.7003019", "0.69673353", "0.69532365", "0.6865657", "0.6856543", "0.68055904", "0.67982805", "0.678694", "0.67314416", "0.6663813", "0.6663497...
0.0
-1
Method obtains roles per cloud
def get_cloud_roles(cloud_id) http_get_request(Scalarium.clouds_url+"/#{cloud_id}/roles") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def roles\n self.dig_for_array(\"roles\")\n end", "def roles\n url = \"/gdc/projects/#{pid}/roles\"\n tmp = GoodData.get(url)\n tmp['projectRoles']['roles'].map do |role_url|\n json = GoodData.get role_url\n GoodData::ProjectRole.new(json)\n end\n end", "def roles\n ...
[ "0.71982366", "0.7005355", "0.6972455", "0.6963374", "0.68873984", "0.68645704", "0.68540525", "0.68149936", "0.6793778", "0.67725766", "0.67255026", "0.67184365", "0.6709584", "0.6695001", "0.66740596", "0.66333616", "0.6605507", "0.6601638", "0.6601638", "0.6579858", "0.656...
0.80768174
0
Method obtains details of all instances for a given role
def get_role_instances(cloud_id, role_id) http_get_request(Scalarium.clouds_url+"/#{cloud_id}/roles/#{role_id}/instances") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instances_for_role(role, state = \"running\")\n instances_for_filter(\"tag:role\", role, state)\n end", "def instances_by_role(*roles)\n roles = roles.flatten.map(&:to_s)\n instances.select { |inst| roles.include?(inst.role.to_s) }\n end", "def get_instances(role: nil, username: ...
[ "0.7593797", "0.7326704", "0.7220917", "0.7094256", "0.6147204", "0.61171913", "0.60888946", "0.597722", "0.5930808", "0.5927849", "0.5860402", "0.5857713", "0.579832", "0.57216555", "0.57163215", "0.5704275", "0.56603473", "0.56603336", "0.5630497", "0.5623143", "0.5621404",...
0.72347605
2
Method obtains instances of the cloud
def get_cloud_instances(cloud_id) http_get_request(Scalarium.clouds_url+"/#{cloud_id}/instances") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_instances\n instances = [ ]\n get_clouds.each do |cloud|\n instances += cloud.instances.index(:filter => [], :view => 'tiny')\n end\n instances\n end", "def instances\n Egi::Fedcloud::Vmhound::Log.info \"[#{self.class}] Retrieving active instances\"\n fetch_instances\n...
[ "0.81813926", "0.81067806", "0.7536962", "0.7405116", "0.73474824", "0.72378355", "0.7115569", "0.70951647", "0.7015476", "0.7015476", "0.69778377", "0.6966741", "0.69576466", "0.68223536", "0.67908615", "0.6771394", "0.676709", "0.6766386", "0.6760807", "0.67550653", "0.6752...
0.77364564
2
Method obtains details of specified instance for a given cloud
def get_instance_of_cloud(cloud_id, instance_of_cloud_id) http_get_request(Scalarium.clouds_url+"/#{cloud_id}/instances/#{instance_of_cloud_id}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pcloud_instance\n get(\"cloud-instances/#{guid}\")\n end", "def get_cloud\n cloud_href = instance.cloud.href\n cloud_id = cloud_href.split('/').last\n cloud = @api_client.clouds(:id => cloud_id)\n end", "def info(type, instance_id, options={})\n args = {type: type, ...
[ "0.7518819", "0.7265742", "0.68979347", "0.6691193", "0.6569563", "0.6564085", "0.6508924", "0.64796877", "0.64029074", "0.6402767", "0.6392722", "0.63911146", "0.6374016", "0.6330803", "0.6316872", "0.6297124", "0.6280447", "0.6280447", "0.6203043", "0.6155269", "0.6150855",...
0.76314545
0
Method allows to send command to the instance of specified cloud
def send_instance_command(cloud_id, instance_id, command) commands = [:start, :reboot, :stop] raise ArgumentError, "You have passed wrong command allowed ones are: #{commands}" if !commands.include?(command) http_post_request(Scalarium.clouds_url+"/#{cloud_id}/instances/#{instance_id}/#{command.to_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_missing(method_sym, *arguments)\n if @cloudobj\n MU.log \"INVOKING #{method_sym} FROM PARENT CLOUD OBJECT #{self}\", MU::DEBUG, details: arguments\n @cloudobj.method(method_sym).call(*arguments)\n else\n raise NoMethodError, \"No such instance method #{...
[ "0.5986951", "0.5849965", "0.5838478", "0.58123904", "0.57129145", "0.569034", "0.56619537", "0.5626992", "0.56095994", "0.5569716", "0.555222", "0.5542827", "0.55161035", "0.55161035", "0.55161035", "0.55161035", "0.55161035", "0.55161035", "0.55033165", "0.54726404", "0.545...
0.764065
0
Method fetches all applications on the server
def get_applications http_get_request(Scalarium.applications_url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def applications_list\n get \"applications\"\n end", "def applications\n Application.from session.get 'operations/application', API_V1\n end", "def all\n request_model = @request_model_factory.all_apps_request_model\n response = @network_client.perform_request(request_model)\n ...
[ "0.80315036", "0.7856624", "0.7815275", "0.7761975", "0.75881815", "0.75300723", "0.7528356", "0.74479836", "0.7407264", "0.73881143", "0.73667043", "0.73608714", "0.7199897", "0.71948963", "0.71906453", "0.71899307", "0.7087329", "0.7086972", "0.7086972", "0.7086972", "0.708...
0.83168656
0
Method pings scalarium to check the details of the deploy (i.e. progress)
def fetch_deployment_details(app_id, deployment_id) http_get_request(Scalarium.applications_url+"/#{app_id}/deployments/#{deployment_id}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deploy\n ::Taxi::Status.list_by_status(status: 'deploy', format: options[:format], agency: options[:agency])\n end", "def deploy_complete(url,password)\n puts\n deployed = \"IPA deployed\"\n puts bold(deployed)\n puts deployed.length.times.map {\"=\"}.join\n put...
[ "0.6704139", "0.642926", "0.6332816", "0.6193167", "0.606225", "0.5948414", "0.59407026", "0.5908083", "0.58910817", "0.5877013", "0.5859068", "0.583187", "0.58190095", "0.58018064", "0.57854486", "0.57629645", "0.5756332", "0.5711298", "0.57094836", "0.57012796", "0.56992286...
0.0
-1
Method allows to deploy application in scalarium
def deploy_application(app_id, options = {:comment => nil, :migrate => false}) json_command = JSON.dump(:command => 'deploy', :comment => options[:comment], :migrate => options[:migrate]) http_post_request(Scalarium.applications_url+"/#{app_id}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deploy_application\n deploy(selfdir + \"app\")\n end", "def deploy\n unless serverside_version\n # only set serverside version if it's not set, to imitate the api\n # behavior of choosing its own serverside version if one is not\n # sent\n update :serverside_version => AWSM_SERVERS...
[ "0.7390715", "0.6611774", "0.65221953", "0.6474304", "0.63609135", "0.6350595", "0.63283885", "0.6318182", "0.62926525", "0.62461185", "0.62399834", "0.6214265", "0.6205005", "0.61740994", "0.6110696", "0.61019826", "0.6068592", "0.6021005", "0.6019029", "0.60021394", "0.5994...
0.6482714
3
or def student_can_talk return speech end
def student_favourite_programming_language(language) return "I love #{language}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def speech; end", "def student_talks\n return \"Could you explain that?\"\n end", "def student_talks()\n return \"I can talk!\"\nend", "def speak\n \"#{name} says Assalaam alaykum\"\n end", "def speak\n \"Th...
[ "0.8186673", "0.7564535", "0.7535857", "0.7200061", "0.71164423", "0.70890015", "0.70888245", "0.7084489", "0.6986747", "0.6974987", "0.6960985", "0.6922426", "0.69190246", "0.6918096", "0.69090885", "0.688828", "0.6888117", "0.6888117", "0.6888117", "0.6872143", "0.68593526"...
0.0
-1
move to users model
def current_user_interests current_user.interests end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def promoteMembers\n @groupuser = GroupUser.where(:group_id => params[:group_id], :user_id => params[:user_id])\n @user = GroupUser.find(@groupuser)\n if @user.isCreator == true\n @user.isCreator = false\n else \n @user.isCreator = true\n end\n if @user.save\n redirect_to(:controll...
[ "0.62500215", "0.617874", "0.6176706", "0.6049044", "0.6020955", "0.5947911", "0.5914384", "0.5911142", "0.5906681", "0.589283", "0.58726037", "0.58684325", "0.585751", "0.57991284", "0.5786298", "0.5762231", "0.5739068", "0.5723853", "0.571923", "0.56807184", "0.5670382", ...
0.0
-1
Wait on the semaphore. If the count zero or below, the calling thread blocks. Optionally a timeout in seconds can be specified. This method returns true if the wait ended because of a signal, and false if it ended because of a timeout.
def wait(timeout = nil) result = true c = nil @mutex.synchronize do @count -= 1 if @count < 0 @sleeping.push Thread.current @mutex.sleep(timeout) end end if timeout # If we had a timeout we may have woken due to it expiring rather than # due to signal be...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait(timeout = nil)\n begin\n Timeout::timeout timeout do\n @mutex.synchronize do\n @conditional.wait @mutex if @count > 0\n end\n end\n true\n rescue Timeout::Error\n false\n end\n end", "def wait(timeout = nil)\n raise_unless_l...
[ "0.7516419", "0.7222389", "0.7155222", "0.6654649", "0.661103", "0.655974", "0.635637", "0.63348126", "0.62758756", "0.6071681", "0.60664165", "0.60613555", "0.6019524", "0.5966335", "0.59007937", "0.58517635", "0.5822257", "0.57724124", "0.57683873", "0.5735848", "0.57300955...
0.73358136
1
Signal the semaphore. If the count is below zero the waiting threads are woken.
def signal c = nil @mutex.synchronize do c = @count @count += 1 if c < 0 t = @sleeping.shift t.wakeup if t end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signal\n signal_next if @waiting_threads.any?\n self\n end", "def signal_access\n @condvar.signal unless @running_threads >= @max_threads\n end", "def signal\n @monitor.instance_eval {mon_check_owner()}\n Thread.critical = true\n t = @waiters.shift\n t.wakeup if t\n ...
[ "0.673016", "0.6160603", "0.6018287", "0.5995401", "0.5906145", "0.58566403", "0.58402807", "0.575974", "0.5640413", "0.5640413", "0.5552357", "0.55368084", "0.54923135", "0.5427805", "0.5427805", "0.54217213", "0.5331874", "0.5311278", "0.5279827", "0.5278418", "0.52419543",...
0.77584887
0
GET /litters GET /litters.json
def index @litters = Litter.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @litters = Litter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @litters }\n end\n end", "def show\n @litter = Litter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json...
[ "0.7364864", "0.6870809", "0.6451895", "0.63661975", "0.6145103", "0.5964414", "0.59091085", "0.59058136", "0.588858", "0.5836263", "0.5824243", "0.5752784", "0.57451326", "0.57331157", "0.57279044", "0.57247955", "0.5704515", "0.5701896", "0.5690286", "0.5652678", "0.5646642...
0.713006
1
GET /litters/1 GET /litters/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @litters = Litter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @litters }\n end\n end", "def show\n @litter = Litter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json...
[ "0.71968675", "0.7099143", "0.68242526", "0.66903734", "0.65331745", "0.63916904", "0.6208351", "0.62051946", "0.6078915", "0.6070834", "0.6009553", "0.59389323", "0.58629614", "0.5849937", "0.5849641", "0.5834735", "0.5830431", "0.58289635", "0.5761881", "0.5717441", "0.5716...
0.0
-1
POST /litters POST /litters.json
def create @litter = Litter.new(litter_params) # @litter.litter_treatments.each do |t| # t.treatment_date = t.treatment_date.strftime('%Y-%d-%m') # end respond_to do |format| if @litter.save format.html { redirect_to @litter, notice: 'Litter was successfully created.' } fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @kennel_litter = KennelLitter.new(params[:kennel_litter])\n\n respond_to do |format|\n if @kennel_litter.save\n format.html { redirect_to @kennel_litter, notice: 'Kennel litter was successfully created.' }\n format.json { render json: @kennel_litter, status: :created, location...
[ "0.6511364", "0.6313636", "0.62791556", "0.6200267", "0.61916715", "0.6150934", "0.6128844", "0.6024626", "0.59537524", "0.5948912", "0.59347713", "0.5899846", "0.5863618", "0.58368874", "0.5821319", "0.57748574", "0.5741465", "0.5707024", "0.5701193", "0.5700693", "0.5638251...
0.5784913
15
PATCH/PUT /litters/1 PATCH/PUT /litters/1.json
def update # params[:litter][:litter_treatments_attributes].values.each do |l| # l[:treatment_date] = Date.parse(l[:treatment_date]).strftime('%Y-%d-%m') # end respond_to do |format| if @litter.update(litter_params) format.html { redirect_to @litter, notice: 'Litter was successfully upd...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @litter = Litter.find(params[:id])\n\n respond_to do |format|\n if @litter.update_attributes(params[:litter])\n format.html { redirect_to @litter, notice: 'Litter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: ...
[ "0.71894604", "0.65410334", "0.65365064", "0.646889", "0.64515334", "0.6433858", "0.6373652", "0.6230806", "0.6225922", "0.62034404", "0.61920744", "0.61514014", "0.6144192", "0.6119447", "0.60815614", "0.60399944", "0.60383594", "0.602776", "0.60186714", "0.6011083", "0.5980...
0.561981
74
DELETE /litters/1 DELETE /litters/1.json
def destroy @litter.destroy respond_to do |format| format.html { redirect_to litters_url, notice: 'Litter was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @litter = Litter.find(params[:id])\n @litter.destroy\n\n respond_to do |format|\n format.html { redirect_to litters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @litter = Litter.find(params[:id])\n @litter.destroy\n\n respond_to do |format|\n...
[ "0.70292395", "0.688678", "0.6773559", "0.67455447", "0.6710137", "0.66959095", "0.6691677", "0.6675498", "0.66580844", "0.66088", "0.6564177", "0.6558052", "0.6531854", "0.65100265", "0.6498472", "0.6493576", "0.64726835", "0.64714926", "0.64553344", "0.6448738", "0.64469373...
0.6805235
2
Use callbacks to share common setup or constraints between actions.
def set_litter @litter = Litter.find(params[:id]) @litter.birth_date = @litter.birth_date.strftime('%m/%d/%Y') @litter.arrival_date = @litter.arrival_date.strftime('%m/%d/%Y') @litter.available_date = @litter.available_date.strftime('%m/%d/%Y') @litter.litter_treatments.each do |t| ...
{ "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.6165152", "0.60463154", "0.59467196", "0.5917112", "0.5890387", "0.58345735", "0.57773316", "0.56991524", "0.56991524", "0.565454", "0.5622282", "0.54232633", "0.54119074", "0.54119074", "0.54119074", "0.53937256", "0.53801376", "0.5358599", "0.53412294", "0.5340814", "0.5...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def litter_params params.require(:litter).permit(:name, :arrival_date, :available_date, :birth_date, :breed_id, :breeder_id, :dam_id, :sire_id, :male_count, :female_count, litter_treatments_attributes:[:_destroy, :id, :litter_id, :treatment...
{ "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
=begin Writing the various output files write_the_html_file(mdpath, name) The first argument specifies the path for the `.md` input file. The output file directory is
def write_the_html_file(mdpath, name) DbgMgr.put "out_html", "writing #{name}html" file = File.join @doc, (name + "html") VersionedFile.new_version file, true, bak: @doc_bak, keep: @keep cmd = "pandoc -p -s -S -f markdown -t html5 --toc --toc-depth=4 " + "--self-contained --css #{@c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_html_file(name, type, html)\n if ENV['WRITE_HTML_FILE'] != 'false'\n file_name = \"#{File.dirname(__FILE__)}/results/#{name.gsub('.xml', '')}-#{Time.now.strftime(\"%d%b\")}_#{type}.html\"\n file = File.open(file_name, 'w+')\n file.puts html\n file.close\n end\nend", "def write_index_...
[ "0.69669896", "0.66782254", "0.6614067", "0.6548489", "0.6477707", "0.63762623", "0.634309", "0.63427263", "0.6311904", "0.62461877", "0.6204513", "0.6145369", "0.6123473", "0.60981417", "0.60871303", "0.6072572", "0.60481507", "0.60218626", "0.60054415", "0.5992216", "0.5978...
0.87060326
0
GET /restaurant_pages/1 GET /restaurant_pages/1.xml
def show @restaurant_page = RestaurantPage.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @restaurant_page } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @restaurant_page = RestaurantPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @restaurant_page }\n end\n end", "def index\n @restaurants = Restaurant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format...
[ "0.68269575", "0.66098976", "0.64848065", "0.64327085", "0.6363313", "0.6357622", "0.6355673", "0.6349896", "0.63362664", "0.63348395", "0.6304641", "0.6304641", "0.6293139", "0.6293139", "0.62823737", "0.6239269", "0.6231397", "0.62240523", "0.6205463", "0.620066", "0.617091...
0.7162892
0
GET /restaurant_pages/new GET /restaurant_pages/new.xml
def new @restaurant_page = RestaurantPage.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @restaurant_page } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @page = Page.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n \n end\...
[ "0.7327192", "0.73267806", "0.7314669", "0.7314669", "0.7314669", "0.7314669", "0.7314669", "0.7314669", "0.72376615", "0.72160846", "0.71452177", "0.7137751", "0.7136678", "0.71111757", "0.71045977", "0.70954305", "0.70954305", "0.70838207", "0.70115036", "0.6968261", "0.696...
0.78758043
0
POST /restaurant_pages POST /restaurant_pages.xml
def create @restaurant_page = RestaurantPage.new(params[:restaurant_page]) respond_to do |format| if @restaurant_page.save format.html { redirect_to(@restaurant_page, :notice => 'Restaurant page was successfully created.') } format.xml { render :xml => @restaurant_page, :status => :creat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @restaurant_page = RestaurantPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @restaurant_page }\n end\n end", "def create\n @page = Page.new(params[:page])\n \n if @page.save\n respond_to do |format|\n format.json ...
[ "0.64129114", "0.59530365", "0.5912015", "0.58530456", "0.5840767", "0.5796656", "0.5772399", "0.5730502", "0.57233757", "0.57198185", "0.57043", "0.57043", "0.5683625", "0.5679566", "0.5673179", "0.5670336", "0.56650156", "0.5658843", "0.56501406", "0.56286573", "0.5624494",...
0.6744128
0
PUT /restaurant_pages/1 PUT /restaurant_pages/1.xml
def update @restaurant_page = RestaurantPage.find(params[:id]) respond_to do |format| if @restaurant_page.update_attributes(params[:restaurant_page]) format.html { redirect_to(@restaurant_page, :notice => 'Restaurant page was successfully updated.') } format.xml { head :ok } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @page = Page.find(params[:id])\n\n if @page.update_attributes(params[:page])\n respond_to do |format|\n format.json {render json: @page, status: :created }\n format.xml {render xml: @page, status: :created}\n end\n \n else\n respond_to do |format|\n fo...
[ "0.60251135", "0.59833103", "0.5862567", "0.58286554", "0.5809634", "0.5752456", "0.57491714", "0.57483304", "0.57217056", "0.57210034", "0.57140064", "0.57140064", "0.5708334", "0.5695169", "0.56788725", "0.56788725", "0.56715834", "0.567027", "0.56663764", "0.5653832", "0.5...
0.6452508
0
DELETE /restaurant_pages/1 DELETE /restaurant_pages/1.xml
def destroy @restaurant_page = RestaurantPage.find(params[:id]) @restaurant_page.destroy respond_to do |format| format.html { redirect_to(restaurant_pages_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 destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to(restaurants_url) }\n format.xml { head :ok }\n end\n end", ...
[ "0.6897229", "0.66815853", "0.66815853", "0.65823525", "0.6529406", "0.64899063", "0.64634657", "0.6447512", "0.639261", "0.6362686", "0.63618934", "0.63486266", "0.63486266", "0.63201755", "0.6312174", "0.62963355", "0.62925977", "0.6255763", "0.62453884", "0.623137", "0.623...
0.7339648
0
todo: find a better name e.g design draft / outline/ ??? or such why? why not?
def design_spec( zoom=3, spacing: 1, transparent: nil ) grayscale_img = @img.grayscale ## step 1 - convert to grayscale 0-255 shades of gray # todo: line - find a better name eg. line_strenght/width or such? width = grayscale_img.width*zoom + (grayscale_img.width-1)*spacing height = grayscale_img....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def design\r\n \r\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def anatomy; end", "def who_we_are\r\n end", "def formation; end", "def probers; end", "def implementation; end", "def implementation; end", "def under_constructio...
[ "0.7253137", "0.70311284", "0.6820933", "0.6820933", "0.6820933", "0.6820933", "0.6766822", "0.6758106", "0.6708557", "0.66928065", "0.6655176", "0.6655176", "0.66401666", "0.6584534", "0.6565794", "0.636986", "0.63628834", "0.63628834", "0.6352399", "0.63216716", "0.6263155"...
0.0
-1
======== IMPORT FUNCTION ===========
def importFromFile(type, json_hash) idx = 0 len = json_hash.length json_hash.each do |arr| # this is for jason, remove for prod if idx > 500 break end begin type.create(arr) idx += 1 puts "Added #{idx}/#{len}" rescue => exception puts "Error #{exception}" end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import\n end", "def import\n end", "def import\n end", "def import\n end", "def import()\n # TODO\n end", "def before_import ; end", "def import(ovf)\n end", "def request_import\n end", "def external; end", "def import_into\n raise NotImplementedError, not_implemented...
[ "0.8018424", "0.8018424", "0.8018424", "0.8018424", "0.7649704", "0.7618706", "0.6805495", "0.6631208", "0.6350732", "0.63288474", "0.6238229", "0.6226656", "0.6226656", "0.6148622", "0.6148622", "0.61365813", "0.61365813", "0.61074674", "0.60301304", "0.6018281", "0.6018281"...
0.0
-1
/ open the data file and load the text into a variable called filetext
def initialize(filename) @fname = filename end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_text(filename); end", "def parse_file\n @file ||= File.open(@file_name) unless @file_name.nil?\n @text = @file.readlines\n @file.close unless @file.nil?\n parse_text\n end", "def read_file\n\t\tif @filename == \"\"\n\t\t\t@text = [\"\"]\n\t\t\treturn\n\t\telse\n\t\t\tif File.exi...
[ "0.7821777", "0.7261464", "0.7012813", "0.6719336", "0.6719121", "0.667757", "0.65645486", "0.65167284", "0.6441785", "0.6359007", "0.63102704", "0.6270854", "0.6269741", "0.6249963", "0.6241787", "0.6235755", "0.62261647", "0.6219629", "0.6219629", "0.62095606", "0.6183557",...
0.0
-1
parse a delimited header line into an array of symbols
def parse_header_line(header_str) @headers = header_str.split(',') @headers.map! do |h| h.gsub!('"','') h.strip! h.underscore.to_sym end @headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_header( data )\n k,v = data.split(\"\\0\", 2)\n return [k, v.delete(\"\\0\")]\n end", "def parse_header(raw)\n header = {}\n field = nil\n\n raw.each_line do |line|\n case line\n when /^([A-Za-z0-9!\\#$%&'*+\\-.^_`|~]+):\\s*(.*?)\\s*\\z/om\n field, val...
[ "0.7289143", "0.64177924", "0.6383861", "0.6383143", "0.6314814", "0.6274076", "0.62711287", "0.6263893", "0.616021", "0.60961837", "0.6072457", "0.6019628", "0.5965356", "0.59575784", "0.5918348", "0.5897727", "0.5893021", "0.58839786", "0.58435434", "0.5827832", "0.5809016"...
0.6686835
1
loop through text line by line, and yeild results to calling block
def read @fileobj = File.open(@fname,"r") parse_header_line(@fileobj.readline) unless @fileobj.eof? while (!@fileobj.eof?) yield(parse_data_line(@fileobj.readline)) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each\n @theLines.each { |s| yield s }\n end", "def each_line(&block)\n string.each_line(&block)\n end", "def each_line(&block)\n # expect that str.index accepts an Integer for 1st argument as a byte data\n offset = 0\n while(pos = self.index(0x0a, offset))\n block.call(self[offset...
[ "0.6845911", "0.6827801", "0.66468686", "0.64869976", "0.64031994", "0.63693666", "0.6343965", "0.6328683", "0.6297698", "0.6262744", "0.62547064", "0.6160859", "0.61244696", "0.6099159", "0.60946614", "0.60863996", "0.6075467", "0.6069523", "0.6002119", "0.5969838", "0.59475...
0.0
-1
Getter and Setter for all_tags vertial attribute
def all_tags=(proverb_tags) tag_names = proverb_tags.collect{|tag_name| tag_name.strip.downcase}.uniq self.tags = tag_names.map do |proverb_tag| Tag.where(name: proverb_tag).first_or_create! end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tags\n attributes.fetch(:tags)\n end", "def tags\n attributes.fetch(:tags)\n end", "def tags\n normal[:tags] = Array(normal[:tags])\n normal[:tags]\n end", "def tags\n attributes[:tags] || []\n end", "def tags=(value)\n @tags = value\n...
[ "0.76836324", "0.76836324", "0.7271992", "0.7258013", "0.72539735", "0.72539735", "0.72539735", "0.70862746", "0.70862746", "0.70862746", "0.7043511", "0.7003246", "0.69912946", "0.69905454", "0.6983017", "0.69692653", "0.6951493", "0.69481623", "0.69428927", "0.6934179", "0....
0.0
-1
Implement benchmarking code using the Benchmark module inside the "run" method
def fibonacci_iterative(n) n1 = 1 n2 = 1 array = [] while array.length < n if array.length < 2 array << n1 array << n2 end n1 = n1 + n2 array << n1 n2 = n1 + n2 array << n2 end array[n - 1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def benchmark\nend", "def benchmark!\n @benchmark = true\n end", "def benchmark(reporter); end", "def benchmark(&block)\n end", "def custom_benchmark\n start_time = Time.now\n yield if block_given?\n elapsed_time = Time.now - start_time\n puts \"Custom Benchmark Time in Seconds: #{elapse...
[ "0.8546147", "0.8007573", "0.7845695", "0.78401357", "0.7443054", "0.73363346", "0.73242974", "0.72447485", "0.7214087", "0.71617705", "0.7112788", "0.7082812", "0.69935864", "0.6954766", "0.68851537", "0.68664616", "0.6822528", "0.6812875", "0.67786705", "0.67735064", "0.676...
0.0
-1
[END to_entity] Save the book to Datastore.
def save if valid? entity = to_entity User.dataset.save entity self.id = entity.key.id true else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save\n # add the id to the book list\n @hub.lpush('book:list', @id)\n\n # creates the couples key-values where we store our data\n BOOK_STRING_ATTRS.each do |attr|\n @hub.set(\"book:#{@id}:#{attr}\", self.send(attr.to_sym))\n end\n\n # creates a set containing all the topic id associated...
[ "0.69090843", "0.62397933", "0.61894107", "0.61636585", "0.61618567", "0.6095863", "0.6095863", "0.6095863", "0.6095863", "0.6095863", "0.6095863", "0.6095863", "0.6095863", "0.6063369", "0.6057995", "0.60158974", "0.5965583", "0.5938047", "0.5938047", "0.59311765", "0.593117...
0.0
-1
Set attribute values from provided Hash and save to Datastore.
def update attributes attributes.each do |name, value| send "#{name}=", value if respond_to? "#{name}=" end save end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set(hash)\n hash.each_pair do |key, value|\n _data[key] = value\n end\n _save\n end", "def attributes=(hash)\n hash.each do |key, value|\n send(\"#{key}=\", value)\n end\n end", "def update_attributes(hash)\n update_attributes_without_saving hash\n save\n ...
[ "0.73309207", "0.70284474", "0.69012237", "0.6813211", "0.67809004", "0.66799635", "0.66618896", "0.66299355", "0.65772855", "0.65302444", "0.6479084", "0.6451955", "0.6447296", "0.644414", "0.64401853", "0.6437231", "0.6379121", "0.6358667", "0.6287612", "0.6283763", "0.6260...
0.585429
34
Instance methods return an array of formatted item informationj
def ui_columns text = name text += "\n" + notes if notes res = [id.to_s.blue, quantity.to_s.light_blue, text] if quantity > 1 # we need to print unit weight and total weight value = "$#{price}\n$#{price*quantity}" burden = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format\n @item_attributes.first.format.collect {|f| f.to_s}\n end", "def format_list(items); end", "def print_item\n return values\n end", "def list_item\n row = []\n list_item_fields.each do |field_name|\n row << field(field_name).to_s\n end\n\n row\n ...
[ "0.7093764", "0.701702", "0.70067966", "0.68009967", "0.67855024", "0.676375", "0.6671609", "0.6656959", "0.6588702", "0.654125", "0.65176743", "0.6461128", "0.64069545", "0.63802314", "0.6349601", "0.63224363", "0.62890166", "0.6260974", "0.62473", "0.6230013", "0.6228596", ...
0.0
-1
print string representation of item
def to_s t = Terminal::Table.new headings: self.class.table_headings, rows: [ui_columns] t.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_item(item)\n content = item.value\n\n case item.type\n when :string, :float, :integer then print content\n when :ident then print value_of(content)\n when :separator then print \"\\t\" if content == ','\n end\n end", "def printItem\n print ...
[ "0.80571693", "0.7809159", "0.7615275", "0.75120527", "0.7436315", "0.74184465", "0.73589253", "0.7209087", "0.7155041", "0.7150745", "0.7039294", "0.7008664", "0.6965619", "0.6936918", "0.69115657", "0.68909055", "0.68824315", "0.68520546", "0.68292767", "0.6793808", "0.6783...
0.0
-1
number of items remaining in a stack
def quantity quantity_initial - quantity_consumed end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count\n @stack.count\n end", "def length\n return @stack.length\n end", "def stack_size()\n #This is a stub, used for indexing\n end", "def size()\n return nil if is_empty\n\n i = 0\n\n while @stack[i] != nil\n i += 1\n end\n\n return i\n end", "def st...
[ "0.81291234", "0.7911544", "0.7854113", "0.7848037", "0.7832873", "0.7255518", "0.7068425", "0.69702876", "0.6858244", "0.6850958", "0.6805241", "0.6764294", "0.6715893", "0.6695987", "0.66953546", "0.6685135", "0.6674195", "0.6637013", "0.66181576", "0.6596217", "0.6581589",...
0.0
-1
Set the total item quanity as though you scooped more of the item off the ground
def quantity=(q) delta = quantity - q self.quantity_consumed += delta save end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sumQuality(item)\n item.quality += 1\n end", "def quarry_discount_for player\n player.current_quarry_discount > max_quarry_discount ? max_quarry_discount : player.current_quarry_discount\n end", "def increase_quality_by1(item)\n item.quality += 1\n end", "def total_sugars\n food.sugars * q...
[ "0.65441793", "0.64593077", "0.6314645", "0.6300568", "0.62986755", "0.6201103", "0.6137599", "0.6133314", "0.6004686", "0.60021394", "0.59877616", "0.59612453", "0.59521115", "0.5933604", "0.59236896", "0.5921446", "0.5914528", "0.5897932", "0.5897221", "0.58767307", "0.5848...
0.55811155
62
drop an item, discarding it from your inventory if you originally bought the item, it will still count against your total aquired gold use drop to consume items
def drop(quant = nil) if quant.nil? self.is_had = false save "dropped #{self.quantity} #{self.name}" else self.quantity_consumed += quant if quantity < 0 raise "Cannot have negative items!" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drop_item(item)\n #this will take an item from the hero's inventory and place it in the current room\n end", "def gain_drop_items\n drops = []\n rate = Grade.rate(:drop)\n $game_troop.make_drop_items(rate).each do |item|\n $game_party.gain_item(item, 1)\n drops.push(item)\n end\n ...
[ "0.7755215", "0.72466516", "0.7151513", "0.70759106", "0.7025276", "0.6995351", "0.6898894", "0.685788", "0.68413866", "0.6772553", "0.66451734", "0.6622571", "0.6578572", "0.65458596", "0.6530385", "0.6530385", "0.652581", "0.650852", "0.6490905", "0.64823747", "0.6480903", ...
0.78686273
0
Add more items to a stack you currently have
def add(quant) self.quantity_consumed -= quant save "added #{quant} #{name}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(item)\n @mini_stack.push(item)\n @maxx_stack.push(item)\n @stak.push(item)\n end", "def <<(new_item)\n if @item_stack.empty?\n @items << new_item\n else\n @item_stack.last.html << new_item\n end\n self\n end", "def push(item); end", "def push(item)\n @items.push...
[ "0.7040711", "0.6645587", "0.651781", "0.6480472", "0.64653087", "0.6417497", "0.63659436", "0.63015157", "0.6251742", "0.62378794", "0.6152998", "0.61505854", "0.6147307", "0.60578334", "0.60479885", "0.60324246", "0.60200757", "0.6017876", "0.598325", "0.59752554", "0.59687...
0.0
-1
Analogous to "undoing" a Item::buy action sell an item, removing its price from your purchases list
def sell(quant = nil) if quant.nil? iname, quant = name, quantity destroy "sold #{quant} #{iname}" else self.quantity_initial -= quant save "sold #{quant} #{i.name}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sell_to_offer(offer,item)\r\n active = item.active?\r\n item.activate if !active\r\n #offer.from.credits +=offer.price*offer.quantity\r\n purchase = Purchase.create(item,offer.quantity,item.owner,offer.from)\r\n purchase.adapt_price_to_offer(offer)\r\n purchase.prepare\r\n Pu...
[ "0.72956336", "0.71858436", "0.7137155", "0.71181035", "0.6996175", "0.69894993", "0.69894993", "0.6924583", "0.68979764", "0.6893973", "0.6869667", "0.6791366", "0.678846", "0.6781141", "0.67335695", "0.669141", "0.66765904", "0.6657572", "0.66274184", "0.66142845", "0.66057...
0.6629273
18
After receiving from the server send one back to let it know we're ready to start TLS
def starttls @stream.send "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def starttls?; end", "def starttls(value)\n send_text(\"220 2.0.0 TLS go ahead\")\n LOG.info(@mail[:mail_id]) {\"<-> (handshake)\"} if LogReceiverConversation\n conn = @connection.deepclone # save the unencrypted connection in case of error\n begin\n @connection.accept\n @mail[:encrypted] =...
[ "0.69460464", "0.671493", "0.6684669", "0.66690904", "0.64762646", "0.64130884", "0.6379957", "0.6360213", "0.6360213", "0.6240113", "0.6129621", "0.61171126", "0.61168396", "0.611617", "0.6061044", "0.6052953", "0.6022838", "0.6018055", "0.6010002", "0.5950713", "0.59444463"...
0.57061875
32
Server's ready for TLS, so start it up
def proceed @stream.start_tls success end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def starttls?; end", "def start_tls(host, ssl_socket_class, ssl_context); end", "def starttls_always?; end", "def post_init\n start_tls(\n :verify_peer => true,\n :private_key_file => key_file,\n :cert_chain_file => crt_file\n )\n end", "def starttls_auto?; end", "def capable_startt...
[ "0.7814023", "0.76860523", "0.76479477", "0.7521846", "0.74966276", "0.7468481", "0.7455604", "0.72376955", "0.7180062", "0.7129109", "0.7093832", "0.70814514", "0.6758238", "0.6742156", "0.66988057", "0.66988057", "0.6681083", "0.66689944", "0.6659132", "0.6644245", "0.65920...
0.71465594
9
Only allow a trusted parameter "white list" through.
def board_params params.require(:board).permit(:velocity) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_chirp @chirp = Chirp.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.6165422", "0.60457647", "0.5946384", "0.5916027", "0.58905005", "0.583495", "0.5777223", "0.56995213", "0.56995213", "0.56532377", "0.5621348", "0.5422839", "0.54118705", "0.54118705", "0.54118705", "0.53935355", "0.5379617", "0.53577393", "0.53407264", "0.53398263", "0.53...
0.0
-1
Only allow a trusted parameter "white list" through.
def chirp_params params.permit(:body) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.71230334", "0.70530915", "0.69479465", "0.6902122", "0.67367256", "0.67172784", "0.6689043", "0.66784793", "0.6660117", "0.6555213", "0.6528485", "0.6458438", "0.6452378", "0.6451654", "0.64478326", "0.6433326", "0.6413599", "0.6413599", "0.63907677", "0.63787645", "0.6378...
0.0
-1
GET /contacts GET /contacts.json
def index @contacts = Contact.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_contacts(options = {})\n send_request(\"get\", contacts_url, body: options.to_json)\n end", "def get_contacts(params={})\n @obj.get('get-contacts', @auth.merge(params))\n end", "def contacts\n respond_with_entity(api.get('/api/v1/profile/contacts'),\n NexaasID::Ent...
[ "0.80651945", "0.7942857", "0.78436047", "0.7802116", "0.77277195", "0.76782286", "0.7592066", "0.74919254", "0.7467012", "0.73504406", "0.7329629", "0.73074734", "0.71978635", "0.71872765", "0.71866214", "0.7176661", "0.7168481", "0.71074116", "0.71074116", "0.7098688", "0.7...
0.69067913
41
GET /contacts/1 GET /contacts/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @contact = Contact.find(params[:id])\n\n render json: @contact\n end", "def index\n @contacts = Contact.all\n render json: @contacts\n end", "def contacts\n respond_with_entity(api.get('/api/v1/profile/contacts'),\n NexaasID::Entities::Profile::Contacts)\n en...
[ "0.7591177", "0.7570335", "0.75499505", "0.75394666", "0.7465594", "0.7329576", "0.73102534", "0.73102534", "0.73102534", "0.72869056", "0.72569484", "0.717351", "0.71114993", "0.7110642", "0.7110637", "0.71082646", "0.71082646", "0.7104926", "0.70934457", "0.7064881", "0.703...
0.0
-1
POST /contacts POST /contacts.json
def create @contact = Contact.new(contact_params) respond_to do |format| if @contact.save format.html { redirect_to @contact, notice: 'Contact was successfully created.' } format.json { render :show, status: :created, location: @contact } else format.html { render :new } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @contact = Contact.create!(contact_params)\n render json: Contact.all\n end", "def create\n @contact = @current_user.contacts.new(contact_params)\n if @contact.save\n render json: {status: 201, contact: @contact}\n else\n render json: {status: 400}\n end\n end", "def ...
[ "0.7576714", "0.7490089", "0.7379185", "0.72857505", "0.71957034", "0.71625906", "0.712342", "0.709042", "0.70820177", "0.7066479", "0.70180994", "0.7013158", "0.69653463", "0.6925242", "0.69036794", "0.68896425", "0.68729776", "0.6868994", "0.6856355", "0.683797", "0.6836811...
0.6859026
23
PATCH/PUT /contacts/1 PATCH/PUT /contacts/1.json
def update respond_to do |format| if @contact.update(contact_params) format.html { redirect_to @contact, notice: 'Contact was successfully updated.' } format.json { render :show, status: :ok, location: @contact } else format.html { render :edit } format.json { render json...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @contact.update(contact_params)\n if @contact.valid?\n render json: @contact\n end\n end", "def update\n if @contact.update(contact_params)\n fresh_when(@contact)\n render json: @contact, status: :ok, location: @contact\n else\n render json: { errors: @contact.err...
[ "0.70579433", "0.6980592", "0.69360167", "0.6922704", "0.68812835", "0.6824542", "0.6790451", "0.6788321", "0.6777508", "0.675033", "0.675033", "0.675033", "0.6717497", "0.6675476", "0.6673548", "0.66730887", "0.6655215", "0.6621539", "0.6619479", "0.6594453", "0.6577915", ...
0.6511021
31
DELETE /contacts/1 DELETE /contacts/1.json
def destroy @contact.destroy respond_to do |format| format.html { redirect_to contacts_url, notice: 'Contact was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @contact.destroy\n render json: {status: 204}\n end", "def delete(contactname)\n\n end", "def destroy\n @contact.destroy\n #Contact.delete(@contact.id)\n respond_to do |format|\n format.html { redirect_to contacts_path }\n format.json { head :no_content }\n end\n en...
[ "0.7692505", "0.7681699", "0.76096106", "0.75637853", "0.75455976", "0.75426126", "0.75426126", "0.75426126", "0.75274014", "0.75274014", "0.75274014", "0.75274014", "0.7427848", "0.74231184", "0.74073875", "0.739963", "0.7388033", "0.73524195", "0.7331634", "0.7321653", "0.7...
0.72476834
47
Use callbacks to share common setup or constraints between actions.
def set_contact @contact = Contact.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 contact_params params.require(:contact).permit(:uuid, :udid, :first_name, :last_name, :email_address, :contact_no, :latitude, :longitude) 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
self.authors = ["Fred ", "George"] > "Fred, George"
def author_info self.authors.map(&:full_name).join(', ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def author\n (self.authors.empty?) ? '' : self.authors.join(', ')\n end", "def author\n return '' if self.authors.empty?\n self.authors.join(', ')\n end", "def to_s\n\t\t\"#{title}, by #{authors.join(', ')}\"\n\tend", "def authorstring\n @authorstring ||= self.authors.collec...
[ "0.7485268", "0.73969847", "0.6921064", "0.6717582", "0.65863943", "0.65565735", "0.6551221", "0.65504724", "0.64913297", "0.64779687", "0.64210224", "0.64172477", "0.6410178", "0.64013654", "0.63875157", "0.6375509", "0.63410836", "0.63278913", "0.6291769", "0.6289491", "0.6...
0.68211645
3
If an admin is currently using the 'log in as user' feature, they must exit that user's account before they can go back to doing normal admin functions
def simultaneous_login! redirect_to root_path if current_admin && current_account end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def admin_log_out\n session.delete(:admin_user_id)\n @current_admin_user = nil\n end", "def logged_in_admin\n unless current_user && current_user.admin\n flash[:danger] = \"Please log in as admin.\"\n redirect_to '/home'\n end\n end", "def admin_user\n redirect_to(login_path) un...
[ "0.7272191", "0.7226422", "0.7223163", "0.7182201", "0.7178432", "0.7157327", "0.7157327", "0.71434397", "0.71434397", "0.71434397", "0.7129493", "0.7106842", "0.70982045", "0.7085666", "0.7079948", "0.70762837", "0.70754224", "0.70754224", "0.7072457", "0.70624644", "0.70461...
0.0
-1
Takes either a .names or a .data file and loads the respective other file from the same directory automatically. Returns a Weka::Core::Instances object. See for more information about the C4.5 file format.
def load_c45(file) load_with(Converters::C45Loader, file: file) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_instance(filename)\n File.open(filename) do | f |\n read_ukp_instance(f)\n end\nend", "def classifier_from_training( filename )\n classifier = Weka::Classifiers::Meta::AdaBoostM1.new # \n \n # http://weka.sourceforge.net/doc.dev/\n\n # java.lang.String[-P, 100, -S, 1, -I, 10, -W, weka.class...
[ "0.5899686", "0.56409866", "0.5516726", "0.5458033", "0.53977245", "0.5327207", "0.5320651", "0.5319775", "0.5318317", "0.5290761", "0.5253401", "0.524499", "0.524499", "0.5202548", "0.51616704", "0.51547605", "0.51539224", "0.51196724", "0.50983846", "0.50618804", "0.5059889...
0.0
-1
returns an array of commits grouped by size
def grouped_commits parsed_commits.each_slice(group_size).to_a end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_commits(repo)\n all_commits = []\n page = 0\n page_size = 10\n commits = repo.commits('master', page_size, page)\n while commits.length > 0\n all_commits = all_commits + commits\n page = page + page_size\n commits = repo.commits('master', page_size, page)\n end\n return all_commits\nend...
[ "0.6871236", "0.66632384", "0.6652863", "0.65021276", "0.64520127", "0.64255255", "0.63796073", "0.6370141", "0.6335138", "0.6321324", "0.61294097", "0.6118349", "0.61047417", "0.60532814", "0.60445845", "0.60134935", "0.6007257", "0.59592944", "0.59273106", "0.5917504", "0.5...
0.7988305
0
Indicates the version of HEAD.
def version @version end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def head\n\tversion\n end", "def head\n \"HEAD\"\n end", "def head\n \"HEAD\"\n end", "def major_version; end", "def version\n @version ||= `git --version`.split(/\\s/).last.split(\".\").collect {|i| i.to_i}\n end", "def revision\n # HEAD is the default, but lets j...
[ "0.8004169", "0.754647", "0.7339696", "0.6788911", "0.67785674", "0.6695311", "0.66685593", "0.66601884", "0.66530335", "0.66530335", "0.66276413", "0.6626719", "0.6626719", "0.6611291", "0.6611291", "0.6611291", "0.6588309", "0.65464735", "0.65389407", "0.65091246", "0.65073...
0.6521773
19
Which version control system?
def vcs_type @vcs_type ||= ( dir = nil Dir.chdir(root) do dir = Dir.glob("{.git,.hg,.svn,_darcs}").first end dir[1..-1] if dir ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def version_strategy\n # default to git for backwards compatible behavior\n @version_strategy ||= begin\n case config.fetch(\"version_strategy\", nil)\n when CONTENTS\n CONTENTS\n when GIT\n GIT\n else\n Licensed::Git.available? ? G...
[ "0.6505801", "0.62311554", "0.62116444", "0.6172794", "0.61664605", "0.6080529", "0.60672903", "0.5989993", "0.59823585", "0.59401184", "0.59009886", "0.5897551", "0.5868369", "0.5853065", "0.580765", "0.57392883", "0.57052386", "0.570495", "0.57002896", "0.56949174", "0.5687...
0.5839552
14
The vclog config file.
def file if glob = file_map['vclog'] Dir.glob(glob).first else Dir.glob(DEFAULT_GLOB).first end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_file\n Vedeu::Configuration.log\n end", "def config_file\n @config_file\n end", "def config_file\n CONFIG_FILE\n end", "def logger_filename\n \"#{cm_cfg_path}/logs/configmonkey.log\"\n end", "def config\n @config_file\n end", "def log_configurat...
[ "0.7354048", "0.66934", "0.6609069", "0.65053785", "0.6438726", "0.64294434", "0.6346893", "0.6346893", "0.6340626", "0.63167423", "0.62863386", "0.62749344", "0.6247199", "0.62071234", "0.6201973", "0.6141029", "0.6115427", "0.61016357", "0.6048016", "0.6042607", "0.60123724...
0.0
-1
Project's map file, if present.
def map_file file = File.join(root, MAP_FILE) return file if File.exist?(file) return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_map\n @file_map ||= (\n map_file ? YAML.load_file(map_file) : {}\n )\n end", "def source_map_file; end", "def load_map(map_name)\n if File.file?(\"assets/maps/#{map_name}\") == true\n file = File.read(\"assets/maps/#{map_name}\")\n else \n ...
[ "0.69994116", "0.6940571", "0.6576544", "0.6341722", "0.6221383", "0.6031457", "0.60159457", "0.5947763", "0.5847681", "0.5741649", "0.5723997", "0.57188976", "0.5698544", "0.5689841", "0.5671446", "0.56070024", "0.5575849", "0.554981", "0.55472875", "0.55461615", "0.54905504...
0.80199003
0
Load the map file.
def file_map @file_map ||= ( map_file ? YAML.load_file(map_file) : {} ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_map_file map_file\n return YAML.load(map_file.read)\nend", "def load_map(map_name)\n if File.file?(\"assets/maps/#{map_name}\") == true\n file = File.read(\"assets/maps/#{map_name}\")\n else \n file = File.read(\"assets/save/#{map_name}\")\n ...
[ "0.7736348", "0.76158184", "0.70176184", "0.700559", "0.6847073", "0.6750691", "0.66817564", "0.66485137", "0.65350884", "0.63858587", "0.6376088", "0.63670266", "0.6311794", "0.62981606", "0.62981606", "0.62657094", "0.6238861", "0.6233991", "0.6212153", "0.6212153", "0.6203...
0.67982566
5