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
Use callbacks to share common setup or constraints between actions.
def set_empathy_map_record @empathy_map_record = EmpathyMapRecord.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.6163754", "0.6045816", "0.5944853", "0.59169096", "0.58892167", "0.58342934", "0.5776148", "0.57057375", "0.57057375", "0.56534296", "0.56209534", "0.54244673", "0.54101455", "0.54101455", "0.54101455", "0.53951085", "0.5378493", "0.53563684", "0.53399915", "0.5338049", "0...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def empathy_map_record_params params.require(:empathy_map_record).permit(:empathy_map_id, :record_type, :group, :position, :text) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6979893", "0.6781746", "0.6746611", "0.6742344", "0.6735229", "0.6592651", "0.65027124", "0.6498011", "0.648163", "0.647716", "0.64556813", "0.64386255", "0.63784456", "0.63756156", "0.636574", "0.6319542", "0.63004524", "0.6299559", "0.62925464", "0.62923217", "0.6289894"...
0.0
-1
Danger! Whole databases will be lost with this method!
def destroy_schema Apartment::Tenant.drop tenant end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flushdb; end", "def reinitialize_db\n drop_db\n initialize_db\n end", "def database_reset\n @database = nil\n end", "def reset_db\n \n end", "def db; end", "def db; end", "def flushdb\n end", "def single_object_db; end", "def teardown\n @db.close\n ...
[ "0.7271918", "0.7246854", "0.711242", "0.70913017", "0.7045368", "0.7045368", "0.67963433", "0.6782604", "0.6710274", "0.6615039", "0.6607097", "0.6502952", "0.6472918", "0.6472918", "0.6434807", "0.64253694", "0.6422215", "0.6407628", "0.6397954", "0.6393746", "0.63812405", ...
0.0
-1
Set the pairwise server auth, host, and protocol values. ==== Parameters options:host:: the pairwise server. options:user:: the pairwise user. options:password:: the pairwise password for user. options:protocol:: the internet protocol to use, probably HTTP or HTTPS.
def server(options) @auth = Base64.b64encode("#{options[:user]}:#{options[:pass]}") @host = options[:host] @protocol = options[:protocol] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_server_option(opt)\n check_connection\n @protocol.set_option_command opt\n self\n end", "def initialize(options={})\n @host = options[:host] || ENV['OT_HOST']\n @user = options[:user] || ENV['OT_USER']\n @password = options[:password] || ENV['OT_PASSWORD']\n en...
[ "0.61345476", "0.6061445", "0.5974885", "0.5862918", "0.5846424", "0.58201426", "0.5777119", "0.57633376", "0.57444125", "0.5741903", "0.57188195", "0.57030964", "0.56949115", "0.5639456", "0.5629883", "0.5613067", "0.5595172", "0.55948496", "0.55522597", "0.55391175", "0.553...
0.7256473
0
Create a question. ==== Return Array of question external ids. ==== Parameters data:: a single question string or an array of question strings.
def question(data) xml = xml_root("questions") arrayed(data).each do |name| xml.root << (XML::Node.new("question") << name) end send_and_process('questions/add', 'questions/question', xml) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item(data, question_ids)\n xml = xml_root(\"items\")\n\n questions = question_ids.inject(XML::Node.new(\"questions\")) do |doc, id|\n question = XML::Node.new(\"question\")\n question[\"id\"] = id.to_s\n doc << question\n end\n\n arrayed(data).each do |name|\n xm...
[ "0.5350682", "0.5306397", "0.5287122", "0.52816534", "0.52503914", "0.5055924", "0.5025253", "0.50071937", "0.49373135", "0.4925255", "0.49194708", "0.49115413", "0.49023232", "0.48863173", "0.48682547", "0.4795868", "0.47892782", "0.47649413", "0.4764641", "0.47414693", "0.4...
0.67774814
0
Create an item for questions. ==== Return On success returns an array of item external ids. Failure on passing nonexistent question id. ==== Parameters data:: a single item data string or an array of item data strings. question_ids:: an array of integers representing the external ids of the questions the item is to be ...
def item(data, question_ids) xml = xml_root("items") questions = question_ids.inject(XML::Node.new("questions")) do |doc, id| question = XML::Node.new("question") question["id"] = id.to_s doc << question end arrayed(data).each do |name| xml.root << (XML::Node.ne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def question(data)\n xml = xml_root(\"questions\")\n\n arrayed(data).each do |name|\n xml.root << (XML::Node.new(\"question\") << name)\n end\n\n send_and_process('questions/add', 'questions/question', xml)\n end", "def add_question_items(items) #params is hash of type => value\n\...
[ "0.5983707", "0.59349555", "0.55877876", "0.53265584", "0.53040576", "0.5225188", "0.5212127", "0.52066594", "0.5114843", "0.5101313", "0.5088006", "0.5061628", "0.5043377", "0.50359756", "0.50218266", "0.5010373", "0.5005206", "0.49890712", "0.49574092", "0.4956596", "0.4941...
0.7797227
0
Update an item's state. ==== Return On response returns true. Failure on incorrect item id. ==== Parameters item_id:: the external id of the items whose state to set. state:: state will be set to 'activated' if state is true. Otherwise state will be set to 'suspended'.
def update_item_state(item_id, state) !send_pairwise_request("items/#{item_id}/#{state ? 'activate' : 'suspend'}", nil, 'Get').nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def offer_an_item(item)\r\n item.status = true\r\n end", "def set_item_status\n @item_status = ItemStatus.find(params[:id])\n end", "def set_status_item\n @status_item = StatusItem.find(params[:id])\n end", "def update_state(state, active)\n if !active.nil?\n @states.each ...
[ "0.6487289", "0.62296295", "0.59071", "0.5905134", "0.5891069", "0.5783998", "0.5781955", "0.5725282", "0.5715166", "0.5715166", "0.5715166", "0.5715166", "0.5715166", "0.5715166", "0.5715166", "0.5715166", "0.57066965", "0.56984854", "0.56788796", "0.56784606", "0.5663464", ...
0.85662454
0
Create voters with given features. Each can pass a single hash of features to create a single voter or an array of hashes to create multiple voters. ==== Return On sucess returns the voter external ids. ==== Parameters features:: a hash of name to value pairs for the voter's features.
def voter(features) xml = arrayed(features).inject(xml_root("voters").root) do |voters, hash| voter = XML::Node.new("voter") features = XML::Node.new("features") hash.each do |name, value| feature = XML::Node.new("feature") << value feature["name"] = name.to_s ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @feature = Feature.find_or_create_by(name: params[:feature][:name])\n @feature.update(deleted_at: nil)\n if params[:vehicle_id]\n @vehicle = Vehicle.find(params[:vehicle_id])\n @vehicle.features << @feature unless @feature.in? @vehicle.features\n end\n respond_to do |format|\n...
[ "0.5387349", "0.5185302", "0.5185302", "0.5130037", "0.5114926", "0.5079057", "0.50732845", "0.50124395", "0.4993313", "0.49901593", "0.49732086", "0.49524087", "0.48843485", "0.48499784", "0.48026893", "0.4778398", "0.47729948", "0.47272143", "0.46399", "0.46328455", "0.4625...
0.7850558
0
Update the state of voter feature name to value. ==== Retturn On success returns voter external id. ==== Parameters voter_id:: the external voter id. name:: the feature to set. value:: the value to set the feature to. ==== Failure on incorrect voter id.
def update_voter_state(voter_id, name, value) send_and_process("voters/set/#{voter_id}?#{name}=#{value}", 'voter') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_value(name, value)\n feature = features.find_or_create_by!(name: name)\n\n feature.update_attributes(value: value, enabled: true)\n end", "def feature(name)\n @feature_name = name\n end", "def feature(name)\n @feature_name = name\n end", "def set_value(feature_id, va...
[ "0.6641854", "0.57551724", "0.57551724", "0.56616014", "0.55843043", "0.55843043", "0.55187595", "0.55162126", "0.5413843", "0.5405181", "0.53557944", "0.53195274", "0.52892727", "0.5280325", "0.5280325", "0.5269154", "0.52312976", "0.52048653", "0.52047116", "0.51986164", "0...
0.7879194
0
Create n prompts for question and voter. Can restrict to items and specify number of items expected in returned prompt. ==== Return Array with each member a prompt external id followed by an array of item external ids for that prompt. ==== Parameters question_id:: the question to create the prompt for. voter_id:: the v...
def prompt(question_id, voter_id, n = 1, prime = false, num_items = 2) res = "prompts/create/#{question_id}/#{voter_id || 0}/#{n}" res += "/1" if prime res = send_pairwise_request(res, nil, 'Get') # process response if res prompt_ids = fetch_xml_attr('prompts/prompt', res) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prompt_params\n params.require(:prompt).permit(\n :id,\n replies: [\n :id,\n :answer,\n :skipped,\n :not_applicable\n ]\n )\n end", "def create_question_items(items)\n\t\tquestion_items = []\n\t\titems.each_with_index do |item, i| # item ...
[ "0.5410109", "0.52770454", "0.5073869", "0.5049218", "0.5038816", "0.49686605", "0.49592617", "0.47671047", "0.4755181", "0.465089", "0.4641647", "0.4631189", "0.45681995", "0.4555603", "0.4532947", "0.44979072", "0.4454051", "0.44515985", "0.4449596", "0.44308463", "0.441940...
0.8193235
0
Tell pairwise this prompt has been viewed so stats can be updated ==== Parameters id:: the prompt external id.
def view(id) send_pairwise_request("prompts/view/#{id}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show #show specific prompt\n @pid = current_user\n @prompt = Prompt.find(params[:id])\n end", "def notify(id)\n logger.info(\"Notifying snitch #{id}\")\n result = http.get('/' + id)\n logger.debug(\"Snitch notification result: #{result}\")\n result.is_a? Net::HTTPSuccess\n end",...
[ "0.5607854", "0.56046385", "0.5541908", "0.5541908", "0.5541908", "0.5541908", "0.5541908", "0.5444386", "0.54237795", "0.5413871", "0.53922766", "0.5310585", "0.5290429", "0.52036047", "0.51736504", "0.51661766", "0.5148986", "0.5137781", "0.5137705", "0.5126335", "0.5066347...
0.7107877
0
Create a vote on a prompt for an item or a skip if nil. Can be cast for a voter or the anonymous voter and a response time can be sent. ==== Return Array of vote external ids. ==== Parameters prompt_id:: the prompt external id to record a vote for. item_id:: the item_id to record the vote for. If item_id is nil or fals...
def vote(prompt_id, item_id = nil, voter_id = 0, response_time = 0) send_and_process("votes/add/#{prompt_id}/#{voter_id || 0}/#{response_time}#{"/#{item_id}" if item_id}", 'vote') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prompt(question_id, voter_id, n = 1, prime = false, num_items = 2)\n res = \"prompts/create/#{question_id}/#{voter_id || 0}/#{n}\"\n res += \"/1\" if prime\n res = send_pairwise_request(res, nil, 'Get')\n\n # process response\n if res\n prompt_ids = fetch_xml_attr('prompts/promp...
[ "0.6184425", "0.5062516", "0.48995715", "0.47818843", "0.46035075", "0.45020816", "0.44762647", "0.43380207", "0.43087745", "0.4291446", "0.42674348", "0.4185205", "0.4120411", "0.41046184", "0.4104594", "0.4104594", "0.40258685", "0.4023598", "0.39919123", "0.39794603", "0.3...
0.714732
0
Call list method. Can pass a question and rank algorithm id. List method :item is supported. ==== Return Array each element being an item external id followed by a rank value. ==== Parameters method:: a symbol representing the type of list request to send. question_id:: the question external id of the question's items ...
def list(method, question_id = nil, rank_algorithm_id = nil) case method when :item res = send_pairwise_request("items/list/#{question_id.to_i}/#{rank_algorithm_id.to_i}") fetch_xml_attr('items/item', res).zip(fetch_xml_attr('items/item', res, 'rank')) if res end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list\n call! :list\n end", "def list\n session[:list_type_id] = ListType.find(:first).id if session[:list_type_id] == nil\n @list_items = ListItem.find_all_by_user_id_and_list_type_id(\n session[:user_id], \n session[:list_type_id],\n :order => \"position\") \n if @list_...
[ "0.50055254", "0.49155006", "0.48818654", "0.4850443", "0.48383677", "0.48237073", "0.48237073", "0.48185572", "0.47987282", "0.47806236", "0.47080103", "0.46912354", "0.46784502", "0.4648795", "0.46196693", "0.4609411", "0.4590373", "0.45723546", "0.45686504", "0.45609424", ...
0.8491188
0
==== Return Response from the pairwise path parsed with the res_path. ==== Parameters path:: where to send the pairwise request to. res_path:: the parse path for the xml. xml:: the data to send to pairwise, default nil.
def send_and_process(path, res_path, xml = nil) # :doc: # send XML res = send_pairwise_request(path, xml) # process response fetch_xml_attr(res_path, res) if res end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_pairwise_request(path, xml = nil, method = nil) # :doc:\n url = URI.parse(\"#{protocol}://#{host}/#{path}\")\n headers = {\n 'Content-Type' => 'text/xml',\n 'Authorization' => \"Basic #{auth}\"\n }\n res = Net::HTTP.new(url.host, url.port)\n res.use_ssl = true if url...
[ "0.66683805", "0.56768364", "0.5544367", "0.5463231", "0.5381418", "0.5355577", "0.5214095", "0.5172248", "0.5172248", "0.51544285", "0.4988938", "0.4862032", "0.4848561", "0.48429552", "0.48421153", "0.4831365", "0.47964713", "0.4733468", "0.47211072", "0.47184923", "0.46669...
0.7834757
0
==== Parameters path:: where to send the pairwise request to. xml:: the post body to send. If xml is nil and method is nil (see below) a get request is sent. Default nil. method:: type of request to send. If method is nil request type is determined by the value of value of xml.
def send_pairwise_request(path, xml = nil, method = nil) # :doc: url = URI.parse("#{protocol}://#{host}/#{path}") headers = { 'Content-Type' => 'text/xml', 'Authorization' => "Basic #{auth}" } res = Net::HTTP.new(url.host, url.port) res.use_ssl = true if url.port == Net::HT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_and_process(path, res_path, xml = nil) # :doc:\n # send XML\n res = send_pairwise_request(path, xml)\n # process response\n fetch_xml_attr(res_path, res) if res\n end", "def request(method, path, params = nil)\n requestParam = params.nil? ? '' : '&' + params\n response = sel...
[ "0.66145945", "0.62873244", "0.62540025", "0.6250427", "0.6084499", "0.6016308", "0.6008194", "0.5989685", "0.5905902", "0.5885524", "0.58788574", "0.58608365", "0.5843559", "0.5842871", "0.58264625", "0.5785685", "0.5769255", "0.5768904", "0.5766302", "0.5759464", "0.5712616...
0.7845612
0
==== Parameters xml:: an HTTP response. path:: the path to search in xml. attribute:: the attribute to return for each element in the search path.
def fetch_xml_attr(path, xml, attribute = "id") # :doc: XML::Parser.parse(xml.body, "/pairwise/#{path}", attribute) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_value(attribute,xml)\n xml.xpath(\".//#{attribute}\").first.content\n end", "def search_xml(search_path)\n\t\t\tself.xml.search(search_path)\n\t\trescue Exception => e\n\t\t\tputs \"Error searching XML: #{e}\"\n\t\tend", "def search(path)\n self.find_by_xpath(path)\n end", "def searchForA...
[ "0.61007124", "0.5985721", "0.58075184", "0.5652818", "0.56034106", "0.5591247", "0.5584137", "0.5443259", "0.5350978", "0.5350978", "0.5340897", "0.5316613", "0.53079474", "0.5302483", "0.5302483", "0.52813524", "0.5213715", "0.5190214", "0.5190214", "0.5184328", "0.51835144...
0.7260485
0
wrap in an array if not an array. ==== Parameters object:: object or array.
def arrayed(object) # :doc: (object.is_a?(Array) ? object : [object]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def array_wrap(object)\n if object.nil?\n []\n elsif object.respond_to?(:to_ary)\n object.to_ary || [object]\n else\n [object]\n end\n end", "def array_wrap(object)\n if object.nil?\n []\n elsif object.respond_to?(:to_ary)\n object.to_ar...
[ "0.83698124", "0.82875735", "0.82875735", "0.7675665", "0.71024895", "0.70215595", "0.68902415", "0.6830485", "0.67829055", "0.6701204", "0.65780014", "0.65277296", "0.6521763", "0.6507515", "0.6464903", "0.64177835", "0.63669807", "0.6208929", "0.6161852", "0.61540824", "0.6...
0.78144723
3
creates an XML document and sets the root value to string. ==== Parameters string:: the root value of a new XML document.
def xml_root(string) # :doc: xml = XML::Document.new xml.root = XML::Node.new(string) xml end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_xml(xml_string)\n\t\twrite_byte(AMF_XML)\n\t\twrite_long_utf(xml_string.to_s)\n\tend", "def root=( root )\n\t\t\n\t\tcase root\n\t\twhen String # If String, parse it, baby!\n\t\t\t@root = parse root\n\t\twhen Tag\n\t\t\t@root = root\n\t\telse\n\t\t\traise ArgumentError, \"#{root.class} is not a valid i...
[ "0.6360996", "0.6347723", "0.61351347", "0.60582894", "0.6021584", "0.6006786", "0.5861998", "0.585639", "0.5822319", "0.5803086", "0.57741016", "0.57564294", "0.5742833", "0.57427585", "0.5654353", "0.5598637", "0.5594485", "0.55860525", "0.5545658", "0.5516973", "0.54906166...
0.8738608
0
A simplified loop: loops until +condition+ is met execution +ruby_block+. The loop is synchronized on +clk_e+ and initialized by +init+. If +condition+ is nil, then +init+ is used as +condition+.
def while_loop(clk_e, init, condition = nil, &ruby_block) # Create the loop task. tsk = while_task(clk_e,init,condition,ruby_block).(HDLRuby.uniq_name) # Create the inner access port. prt = tsk.inner HDLRuby.uniq_name # Return the access port. return prt end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define_condition(&blk)\n @condition_defined = true\n define_singleton_method :invoke_condition, &blk\n end", "def while_block\n @while_block || nil\n end", "def run_when(&blk)\n raise(\"A block is needed to evaluate for run_when\") unless block_given?\n @run_condition = blk\n...
[ "0.6408576", "0.60662174", "0.60422707", "0.6005565", "0.592587", "0.5898521", "0.58362484", "0.5797407", "0.57835853", "0.57680523", "0.5733258", "0.57185966", "0.5710787", "0.5702853", "0.55854523", "0.5560434", "0.55535537", "0.55337214", "0.55181414", "0.5511318", "0.5506...
0.640976
0
Loop +num+ times executing +ruby_block+. The loop is synchronized on +clk_e+.
def times_loop(clk_e, num, &ruby_block) # Compute the width of the counter. width = num.respond_to?(:width) ? num.width : num.type.width # Declares the counter. cnt = [width].inner(HDLRuby.uniq_name) # Create the loop. return while_loop(clk_e, proc{cnt<=0}, cnt<num) do cnt <= cnt + 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(exec_num, &block)\n exec_num.times do timed(&block)\n end\n end", "def run (&code_block)\n raise ArgumentError, 'run requires a code block to execute.' unless block_given?\n @count=0\n\n start_time = Time.now\n\n (1..@max_count).each do |x|\n @count = x\n ...
[ "0.67448765", "0.64946723", "0.64463645", "0.62853146", "0.61080754", "0.6102964", "0.60047644", "0.59675574", "0.5886751", "0.58361995", "0.58197194", "0.5791511", "0.5786998", "0.57648265", "0.5743564", "0.56998837", "0.56796324", "0.56599104", "0.5653269", "0.56272215", "0...
0.7305055
0
Have to write our own check because of paranoia
def site_membership_uniqueness return unless site && user existing_membership = user.site_memberships.where(site_id: site.id).where.not(id: id).first errors.add(:user, "already has a membership to #{ site.url }") if existing_membership end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check ; true ; end", "def checks; end", "def check\n \n end", "def check\n \n end", "def issn; end", "def precheck\n end", "def check!\n true\n end", "def result_of_checking; end", "def check(params)\n false\n end", "def ver...
[ "0.7483885", "0.73668545", "0.7356915", "0.7356915", "0.67411256", "0.6660677", "0.65561205", "0.6488808", "0.6459305", "0.640988", "0.640988", "0.6397954", "0.63253045", "0.63058335", "0.6300654", "0.6288776", "0.6280623", "0.624676", "0.6241115", "0.6195547", "0.6173113", ...
0.0
-1
distance_amount = (coordinate_difference) 1000 initial suggestion, adds distance amount to calculate_amount
def calculate_amount(ride) base_amount = 350000 time_diff_sec = (ride.ends_time - ride.start_time) time_amount = ( time_diff_sec / 60).round * 20000 base_amount + time_amount end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance_price\n distance * price_per_km\n end", "def distance_measurement; end", "def distance_calculator\n @trips.each do |trip|\n @total_distance += trip.distance.to_f\n end\n end", "def calculate_distance(customer)\n ::LoremIpsumNearby::GeoCalculator.distance(@center_point,\n ...
[ "0.6831245", "0.6743432", "0.6687405", "0.66842854", "0.6529628", "0.6326174", "0.6316928", "0.6260251", "0.62474906", "0.62340724", "0.62340724", "0.6173937", "0.61538637", "0.61229825", "0.6090918", "0.60848767", "0.6051273", "0.6036527", "0.60323423", "0.6025688", "0.59859...
0.0
-1
GET galleries/images/1 GET /images.json
def index if params[:id].nil? redirect_to root_path end @images = Image.where("galery_id" => params[:id]) @gallery =Gallery.find(params[:id]) @project = Project.find(@gallery.project_id) @permiso = check_propiety(@project) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_gallery\r\n\t\t\timages = ProjectImage.where(project_id: params[:id]).reorder('\"order\" asc')\r\n\r\n\t\t\trender json: { status: 0, result: images.map { |image| { id: image.id, small: image.image.url(:thumb), original: image.image.url, description: image.description } } }\r\n\t\tend", "def image_list\n...
[ "0.77165365", "0.75094193", "0.7509173", "0.7508023", "0.7378055", "0.7287367", "0.7265672", "0.7265672", "0.7265672", "0.72463787", "0.72343385", "0.72233444", "0.717934", "0.71326226", "0.7130853", "0.71240073", "0.71038777", "0.7044534", "0.70424384", "0.70308876", "0.7016...
0.0
-1
GET /images/1 GET /images/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @image = Image.find(params[:id])\n\n render json: @image\n end", "def show\n @image = Image.find(params[:id])\n\n render json: @image\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient....
[ "0.75692236", "0.75692236", "0.750291", "0.74658996", "0.7424032", "0.7413632", "0.7271288", "0.7271288", "0.7271288", "0.7271288", "0.7248988", "0.72469395", "0.72184175", "0.7214888", "0.720512", "0.7134353", "0.70623124", "0.7058875", "0.70420796", "0.7037943", "0.7026351"...
0.0
-1
GET /images/1/edit/ =begin def edit end =end POST /images POST /images.json
def create @pic = params[:image][:image_url] puts "---------------------------------datos-imagen------------------------------------------------------" puts @pic.inspect puts "---------------------------------------------------------------------------------------------------" @gallery = Gallery.fin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n @image = Image.find(params[:id])\n end", "def edit_image\n pass_query_params\n return unless (@image = find_or_goto_index(Image, params[:id].to_s))\n\n @licenses = License.current_names_and_ids(@image.license)\n if !check_permission!(@image)\n redirect_with_query(action: \"show_im...
[ "0.67568016", "0.6728694", "0.67029256", "0.66533196", "0.6639441", "0.6623775", "0.65914404", "0.65885884", "0.6432802", "0.6424902", "0.64006376", "0.64005405", "0.6391233", "0.6362309", "0.6347147", "0.6343557", "0.6338396", "0.63325536", "0.63273436", "0.63213426", "0.631...
0.0
-1
PATCH/PUT /images/1 PATCH/PUT /images/1.json
def update respond_to do |format| if @image.update(image_params) format.html { redirect_to '/galleries/' + params[:galery_id].to_s, notice: 'Image was successfully updated.' } format.json { render :show, status: :ok, location: @image } else format.html { render :edit } fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n params[:image].delete :created_at\n params[:image].delete :updated_at\n params[:image].delete :id\n @image = Image.find(params[:id])\n if @image.update_attributes(params[:image])\n render json: @image\n else\n render json: @image.errors, status: :unprocessable_entity\n e...
[ "0.7235109", "0.7025943", "0.6789823", "0.672486", "0.67229646", "0.67229646", "0.67229646", "0.67229646", "0.6580123", "0.6572312", "0.6563871", "0.6563871", "0.6563871", "0.6563871", "0.6563871", "0.6563871", "0.6563871", "0.6511535", "0.6501567", "0.6494244", "0.64869976",...
0.61150724
83
DELETE /images/1 DELETE /images/1.json
def destroy @image.destroy respond_to do |format| format.html { redirect_to root_path, notice: 'Image was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n render json: {status: \"success\"}, status: :ok\n end", "def destroy\n @image.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n \n...
[ "0.7678309", "0.7601473", "0.7551389", "0.75382483", "0.75213534", "0.75213534", "0.75213534", "0.75213534", "0.75213534", "0.75213534", "0.75213534", "0.74876904", "0.74876904", "0.74876904", "0.74876904", "0.74876904", "0.74876904", "0.7483591", "0.74375474", "0.7431285", "...
0.7204203
44
Use callbacks to share common setup or constraints between actions.
def set_image @image = Image.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.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 image_params params.require(:image).permit(:image_url, :galery_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.6980629", "0.67819995", "0.67467666", "0.67419875", "0.67347664", "0.65928614", "0.6504013", "0.6498014", "0.64819515", "0.64797956", "0.64562726", "0.64400834", "0.6380117", "0.6377456", "0.63656694", "0.6320543", "0.63002014", "0.62997127", "0.629425", "0.6293866", "0.62...
0.0
-1
Popplerglib needs a newer cairo than provided by OS X 10.6.x and pdf2svg needs it to be on PKG_CONFIG_PATH during the build
def install unless have_poppler_glib? onoe <<-EOS.undent pkg-config could not find poppler-glib! Please try re-installing Poppler with support for the Glib backend: brew uninstall poppler brew install --with-glib poppler EOS exit 1 end ENV.x11 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def install\n # Avoid references to shim\n inreplace Dir[\"**/*-config.in\"], \"@PKG_CONFIG@\", Formula[\"pkg-config\"].opt_bin/\"pkg-config\"\n\n\n # Add a symlink that points to the X11 include files provided by XQuartz.\n # This prevents the `display wizard` command from segfaulting.\n ln_s \"/op...
[ "0.5451852", "0.5317061", "0.52827036", "0.5155285", "0.5059033", "0.50544095", "0.49249426", "0.48528227", "0.483806", "0.47728977", "0.4720057", "0.4713789", "0.470601", "0.4658182", "0.46479738", "0.45708117", "0.45686218", "0.449616", "0.44907615", "0.44705173", "0.443945...
0.6967744
0
GET /communities GET /communities.json
def index @communities = Community.all respond_with @communities end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @communities = Community.all\n render json: {items: @communities}\n end", "def index\n @communities = @district.communities.page(params[:page])\n\n respond_to do |format|\n format.html\n format.json { render json: @communities }\n end\n end", "def index\n @communities ...
[ "0.7754252", "0.75398004", "0.7480216", "0.74625015", "0.74625015", "0.73144126", "0.7296912", "0.72321916", "0.71014124", "0.7075813", "0.68581903", "0.6735031", "0.6595083", "0.6553301", "0.65412617", "0.6484505", "0.6463115", "0.64263386", "0.63536566", "0.6323036", "0.626...
0.75077486
2
GET /communities/1 GET /communities/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @communities = Community.all\n render json: {items: @communities}\n end", "def show\n @community = @district.communities.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @community }\n end\n end", "def index\n @communities = @dist...
[ "0.753101", "0.74388665", "0.73625237", "0.7267102", "0.7267102", "0.72114617", "0.71429074", "0.7028034", "0.7000779", "0.6937691", "0.6868076", "0.6814944", "0.678979", "0.67064846", "0.6701092", "0.66297626", "0.6583685", "0.65033877", "0.6378771", "0.6237414", "0.6207839"...
0.0
-1
POST /communities POST /communities.json
def create @community = Community.new(community_params) flash[:notice] = 'Community was successfully created.' if @community.save respond_with @community end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @community = @district.communities.new(params[:community])\n\n respond_to do |format|\n if @community.save\n format.html { redirect_to admin_district_communities_url, notice: 'Community was successfully created.' }\n format.json { render json: @community, status: :created, loc...
[ "0.70709425", "0.6613993", "0.65838265", "0.6542353", "0.6542353", "0.6526148", "0.65121216", "0.64777964", "0.6441192", "0.6423569", "0.631841", "0.6269429", "0.6256072", "0.6256072", "0.62540835", "0.6154375", "0.6140559", "0.61129653", "0.6101837", "0.6098104", "0.6067932"...
0.62250787
15
PATCH/PUT /communities/1 PATCH/PUT /communities/1.json
def update flash[:notice] = 'Community was successfully updated.' if @community.update(community_params) respond_with @community end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @community = current_user.own_communities.find(params[:id])\n flash[:notice] = 'Community was successfully updated.' if @community.update_attributes(update_params)\n respond_with(@community)\n end", "def update\n @community = Community.find(params[:id])\n\n respond_to do |format|\n ...
[ "0.69263655", "0.6827412", "0.6807774", "0.6701007", "0.6669012", "0.6616443", "0.6616443", "0.6615508", "0.660194", "0.6494414", "0.6471224", "0.62220657", "0.6163707", "0.6094261", "0.60879534", "0.6017205", "0.5978597", "0.59739524", "0.59310395", "0.58571196", "0.5790069"...
0.63943624
11
DELETE /communities/1 DELETE /communities/1.json
def destroy @community.destroy flash[:notice] = 'Community was successfully destroyed.' respond_with @community end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @community.destroy\n respond_to do |format|\n format.html { redirect_to communities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @community = Community.find(params[:id])\n @community.destroy\n\n respond_to do |format|\n format.html { redire...
[ "0.77485144", "0.7736181", "0.76273257", "0.7587767", "0.7581778", "0.7518036", "0.7518036", "0.7518036", "0.7518036", "0.73436004", "0.70315486", "0.69896495", "0.69865716", "0.69472486", "0.6937182", "0.6927305", "0.6831687", "0.68242604", "0.6719934", "0.6719274", "0.66850...
0.6901678
16
Use callbacks to share common setup or constraints between actions.
def set_community @community = Community.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.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 community_params params.require(:community).permit(:name) 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.6980629", "0.67819995", "0.67467666", "0.67419875", "0.67347664", "0.65928614", "0.6504013", "0.6498014", "0.64819515", "0.64797956", "0.64562726", "0.64400834", "0.6380117", "0.6377456", "0.63656694", "0.6320543", "0.63002014", "0.62997127", "0.629425", "0.6293866", "0.62...
0.0
-1
def accept(bike) bike.fix end
def collect_broken_bikes(van) van.broken_bikes.each {|bike| bikes << van.release(bike)} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dock(bike, is_broken = false)\n raise \"Sorry, #{self.class.name} is full\" if full?\n bike.broken if is_broken\n @bikes << bike\n end", "def make_it_quack(duck)\n duck.quack\nend", "def dock(bike)\n fail 'Docking station full' if @bike\n @bike = bike\n end", "def fix_bikes\n @...
[ "0.6193261", "0.6160468", "0.61478674", "0.61392397", "0.61140853", "0.6022699", "0.60172874", "0.59267944", "0.58917785", "0.56926453", "0.5656574", "0.5634361", "0.56091917", "0.55911833", "0.55872726", "0.5532102", "0.5475667", "0.5418856", "0.5409662", "0.5409662", "0.539...
0.5177046
44
Furthermore, it can raise a number to an exponent. There will be an accuracy out to 4 decimal places. Acceptable input will be numeric. Operation choices will have multiple acceptable input methods.
def collect(request_array) print "Please enter the first number: " request_array << gets.chomp exit if request_array[0].downcase == "exit" print "Please enter the second number: " request_array << gets.chomp exit if request_array[1].downcase == "exit" print "Please select an operation: \n 1) Addition, 2)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exp(number, exponent)\n number * (10**exponent)\nend", "def exponents\n\tputs \"what number would you like raise and to what power do you want to raise it?\"\n\texp_number = gets.chomp\n\tpower = gets.chomp\n\tif power.to_i > 15\n\t\tputs \"Okay, let's be real, I'm not THAT smart. What're you trying to brea...
[ "0.72399545", "0.7134934", "0.7034123", "0.67119396", "0.6708129", "0.67040765", "0.66942364", "0.6692034", "0.66441095", "0.65946716", "0.65150684", "0.6477547", "0.647454", "0.64606357", "0.6457236", "0.64509505", "0.6406289", "0.63956356", "0.63830763", "0.6328843", "0.630...
0.0
-1
This has been confirmed. It can still be salvaged by adding a similar begin/end to the perform method, however, this feels like cheating since I'm just covering for my inability to filter out the nonnumerals before they make it to the perform method in the first place :/
def perform(array) case array[2] when "1", "add", "addition" puts "The result is: #{(array[0] + array[1]).round(4)}" when "2", "subtract", "subtraction" puts "The result is: #{(array[0] - array[1]).round(4)}" when "3", "multiply", "multiplication" puts "The result is: #{(array[0] * array[1]).round(4...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def consume_numeric; end", "def sum_numbers (numbers)\r\n##INJECT METHOD\r\n # numbers.each do |thing|\r\n # thing \r\n # this is where you put the thing to check for strings/not numbers\r\n # end \r\n numbers.inject(:+)\r\n# ##ACCUMULATOR METHOD\r\n# accumulator = 0\r\n# numbers.each do |num|\r\n# ...
[ "0.58933306", "0.5532144", "0.5360812", "0.530203", "0.5265705", "0.5222284", "0.5212109", "0.5175283", "0.5168601", "0.5168601", "0.5168601", "0.5168601", "0.5121689", "0.51116806", "0.51116806", "0.5098833", "0.50627273", "0.5060655", "0.5056694", "0.5056694", "0.5056694", ...
0.5094941
16
Use callbacks to share common setup or constraints between actions.
def set_field_of_study_and_semester @field_of_study = FieldOfStudy.find params[:field_of_study_id] @semester = Semester.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.6163754", "0.6045816", "0.5944853", "0.59169096", "0.58892167", "0.58342934", "0.5776148", "0.57057375", "0.57057375", "0.56534296", "0.56209534", "0.54244673", "0.54101455", "0.54101455", "0.54101455", "0.53951085", "0.5378493", "0.53563684", "0.53399915", "0.5338049", "0...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def semester_params params.require(:semester).permit(:start_date, :end_date, :period_type, :field_of_study_id, :student_ids) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6979893", "0.6781746", "0.6746611", "0.6742344", "0.6735229", "0.6592651", "0.65027124", "0.6498011", "0.648163", "0.647716", "0.64556813", "0.64386255", "0.63784456", "0.63756156", "0.636574", "0.6319542", "0.63004524", "0.6299559", "0.62925464", "0.62923217", "0.6289894"...
0.0
-1
I worked on this challenge Parminder Singh I spent 1 hours on this challenge. Complete each step below according to the challenge directions and include it in this file. Also make sure everything that isn't code is commented in the file. Complete each step below according to the challenge directions and include it in t...
def pad!(array, min_size, value = nil) #destructive return array << value if array.length <= min_size return array # #size_difference = min_size - array.length # (min_size - array.length).times do # array << value # end # array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad!(array, min_size, value = nil) #destructive\n solution_array = []\n if min_size <= array.length\n #p array\n return array\n elsif min_size > array.length\n solution_array = array\n times_to_pad = min_size - array.length\n #p times_to_pad\n times_to_pad.times do\n solution_array <<...
[ "0.8165151", "0.8163589", "0.8139152", "0.81212735", "0.8096282", "0.8067355", "0.8061226", "0.8057232", "0.80507433", "0.804161", "0.80416065", "0.80364704", "0.8027315", "0.80192924", "0.7998241", "0.7991077", "0.7985973", "0.79823256", "0.79773647", "0.797665", "0.7946385"...
0.7902694
32
GET /cohort_students GET /cohort_students.json
def index @cohort_students = CohortStudent.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @cohorts_students = CohortsStudent.all\n end", "def set_cohorts_student\n @cohorts_student = CohortsStudent.find(params[:id])\n end", "def show\n @cohort = current_user.accessible_cohorts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format...
[ "0.7576715", "0.7266602", "0.71837896", "0.7182661", "0.71798307", "0.7025486", "0.68950367", "0.68575704", "0.6821021", "0.6797158", "0.67882144", "0.67645735", "0.6745834", "0.6742806", "0.6726181", "0.6723332", "0.67153585", "0.6676039", "0.6644349", "0.6621877", "0.658865...
0.74787164
1
GET /cohort_students/1 GET /cohort_students/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @cohort = current_user.accessible_cohorts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cohort }\n end\n end", "def index\n @cohorts_students = CohortsStudent.all\n end", "def index\n @cohort_students = CohortStude...
[ "0.75729537", "0.7555781", "0.74921215", "0.7356137", "0.73497474", "0.7099478", "0.7056338", "0.6876462", "0.68675405", "0.68649244", "0.68626624", "0.6825989", "0.6817717", "0.67984736", "0.66916275", "0.66736794", "0.66476846", "0.6642956", "0.66386354", "0.6609719", "0.65...
0.0
-1
POST /cohort_students POST /cohort_students.json
def create @cohort_student = CohortStudent.new(cohort_student_params) respond_to do |format| if @cohort_student.save format.html { redirect_to students_path, notice: 'Student was successfully added.' } format.json { render :show, status: :created, location: @cohort_student } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @cohorts_student = CohortsStudent.new(cohorts_student_params)\n\n respond_to do |format|\n if @cohorts_student.save\n format.html { redirect_to cohort_path(@cohorts_student.cohort_id), notice: 'Cohorts student was successfully created.' }\n format.json { render :show, status: ...
[ "0.753811", "0.7102129", "0.6849768", "0.6773771", "0.6749253", "0.66934884", "0.66301805", "0.6495715", "0.6476462", "0.6466018", "0.64548063", "0.6448313", "0.642406", "0.6362836", "0.6357827", "0.63575", "0.6356001", "0.63448936", "0.6323497", "0.6310399", "0.62416", "0....
0.7620681
0
PATCH/PUT /cohort_students/1 PATCH/PUT /cohort_students/1.json
def update respond_to do |format| if @cohort_student.update(cohort_student_params) format.html { redirect_to cohorts_path, notice: 'Cohort student was successfully updated.' } format.json { render :show, status: :ok, location: @cohort_student } else format.html { render :edit } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @cohorts_student.update(cohorts_student_params)\n format.html { redirect_to @cohorts_student, notice: 'Cohorts student was successfully updated.' }\n format.json { render :show, status: :ok, location: @cohorts_student }\n else\n format.html...
[ "0.7642854", "0.733133", "0.7045759", "0.7033442", "0.70001405", "0.684791", "0.68196124", "0.6802078", "0.67461497", "0.6674449", "0.6577322", "0.6534868", "0.64968026", "0.6478331", "0.6476773", "0.6466021", "0.64300215", "0.6408944", "0.63732886", "0.63709587", "0.63194007...
0.7632243
1
DELETE /cohort_students/1 DELETE /cohort_students/1.json
def destroy @cohort_student.destroy respond_to do |format| format.html { redirect_to cohorts_path, notice: 'Student was successfully removed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @cohorts_student.destroy\n respond_to do |format|\n format.html { redirect_to cohorts_students_url, notice: 'Cohorts student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cohort = current_user.accessible_cohorts.find(params[:i...
[ "0.78387237", "0.76687914", "0.75989556", "0.7437786", "0.73493505", "0.7252724", "0.72395897", "0.7239384", "0.70489895", "0.6988584", "0.6979489", "0.69713515", "0.6967503", "0.6953428", "0.68832374", "0.68832374", "0.68832374", "0.68832374", "0.6872103", "0.68385005", "0.6...
0.8095469
0
Use callbacks to share common setup or constraints between actions.
def set_cohort_student @cohort_student = CohortStudent.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.6163754", "0.6045816", "0.5944853", "0.59169096", "0.58892167", "0.58342934", "0.5776148", "0.57057375", "0.57057375", "0.56534296", "0.56209534", "0.54244673", "0.54101455", "0.54101455", "0.54101455", "0.53951085", "0.5378493", "0.53563684", "0.53399915", "0.5338049", "0...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def cohort_student_params params.require(:cohort_student).permit(:student_id, :cohort_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.6979893", "0.6781746", "0.6746611", "0.6742344", "0.6735229", "0.6592651", "0.65027124", "0.6498011", "0.648163", "0.647716", "0.64556813", "0.64386255", "0.63784456", "0.63756156", "0.636574", "0.6319542", "0.63004524", "0.6299559", "0.62925464", "0.62923217", "0.6289894"...
0.0
-1
What is the largest prime factor of the number 600851475143 ?
def is_prime?(num) 2.upto(num-1) do |i| return false if num%i==0 end true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def largest_prime_factor\n number = 600851475143\n n = 2\n while n < number\n if number % n == 0\n factor = number / n\n return factor if is_prime?(factor)\n end\n n += 1\n end\nend", "def prime_factor\n max = 600851475143**0.5\n\n for i in (1..max).step(2)\n if 600851475143 % i == 0\...
[ "0.8600093", "0.84466064", "0.83975476", "0.8163614", "0.79469234", "0.7868302", "0.78587383", "0.7749704", "0.77494866", "0.77346915", "0.773229", "0.77261335", "0.7710812", "0.7691497", "0.7671454", "0.76705384", "0.7668792", "0.76673114", "0.7655952", "0.76461506", "0.7643...
0.0
-1
route: Street line 1 neighborhood: Street line 2 postalCode: Postal code locality: Municipality sublocality: City state: State country: Country
def build_address(address) { route: address.address1, neighborhood: address.address2, locality: address.address3, postalCode: address.postal_code, subLocality: address.city, state: address.city, country: address.coun...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def street_address\n\t\treturn \"#96, Railway Layout, Vijaynagar\"\n\tend", "def street_address\n [\n house_number, \n street_predirection, \n street_name, \n street_type, \n street_postdirection, \n unit_type, \n unit_number\n ].compact.delete_if(&:empty?).join(' ')\n e...
[ "0.6527278", "0.6510228", "0.64724445", "0.6468811", "0.6391277", "0.6356101", "0.6348147", "0.63370967", "0.6313591", "0.63118505", "0.63021284", "0.6300182", "0.6288554", "0.62723404", "0.624659", "0.62401116", "0.6232576", "0.62289095", "0.6218854", "0.6215955", "0.6201", ...
0.62947464
12
Write a method vowel_cipher that takes in a string and returns a new string where every vowel becomes the next vowel in the alphabet.
def vowel_cipher(string) vowels = "aeiou" new_arr = [] string.each_char do |char| if vowels.include?(char) old_index = vowels.index(char) new_index = (old_index + 1)%5 new_arr << vowels[new_index] else new_arr << char end e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vowel_cipher(string)\n vowels = 'aeiou'\n string.each_char.with_index do |char, i|\n if vowels.include?(char)\n vowel_index = vowels.index(char)\n string[i] = vowels[(vowel_index + 1) % vowels.length]\n end\n end\n string\nend", "def vowel_cipher(string)\n\tvowels = \"aeiou\"\n \tcipher ...
[ "0.85575265", "0.852394", "0.8521091", "0.8509966", "0.85062784", "0.84803027", "0.847693", "0.84619784", "0.8453311", "0.8450848", "0.8359486", "0.8332253", "0.82024", "0.81562495", "0.7979212", "0.79546505", "0.79182947", "0.79035634", "0.7852651", "0.78108865", "0.7808798"...
0.79763573
15
GET /communities GET /communities.json
def index @communities = current_user.communities.all @page_title = "Communities" @page_subtitle = "Uniting People and Companies" @page_description = "" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @communities = Community.all\n render json: {items: @communities}\n end", "def index\n @communities = @district.communities.page(params[:page])\n\n respond_to do |format|\n format.html\n format.json { render json: @communities }\n end\n end", "def index\n @communities ...
[ "0.7754252", "0.75398004", "0.75077486", "0.7480216", "0.74625015", "0.74625015", "0.73144126", "0.7296912", "0.72321916", "0.71014124", "0.7075813", "0.6735031", "0.6595083", "0.6553301", "0.65412617", "0.6484505", "0.6463115", "0.64263386", "0.63536566", "0.6323036", "0.626...
0.68581903
11
GET /communities/1 GET /communities/1.json
def show @noteable = @community @note = @community.notes.new @notes = @community.notes.order("created_at desc") @tab_name = "community_home" @page_title = "#{@community.name}" @page_subtitle = "Community Home" @page_description = "" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @communities = Community.all\n render json: {items: @communities}\n end", "def show\n @community = @district.communities.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @community }\n end\n end", "def index\n @communities = @dist...
[ "0.7532106", "0.7438297", "0.73629737", "0.7267805", "0.7267805", "0.7211644", "0.7142899", "0.7028306", "0.700208", "0.69387263", "0.68686855", "0.6814255", "0.67909026", "0.67068005", "0.6700809", "0.6631002", "0.6583499", "0.6503375", "0.63781095", "0.6237455", "0.6208554"...
0.0
-1
POST /communities POST /communities.json
def create @community = Community.new(community_params) respond_to do |format| if @community.save format.html { redirect_to community_home_url(:subdomain => @community.subdomain), notice: 'Community was successfully created.' } format.json { render :show, status: :created, location: @comm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @community = @district.communities.new(params[:community])\n\n respond_to do |format|\n if @community.save\n format.html { redirect_to admin_district_communities_url, notice: 'Community was successfully created.' }\n format.json { render json: @community, status: :created, loc...
[ "0.7069727", "0.6612496", "0.6582467", "0.6540847", "0.6540847", "0.65248716", "0.65107644", "0.6477836", "0.64396614", "0.64234245", "0.6317966", "0.62551725", "0.62551725", "0.6252406", "0.62232697", "0.6152603", "0.61372006", "0.61113334", "0.60993016", "0.6097542", "0.606...
0.6267733
11
PATCH/PUT /communities/1 PATCH/PUT /communities/1.json
def update respond_to do |format| if @community.update(community_params) format.html { redirect_to community_home_url(:subdomain => @community.subdomain), notice: 'Community was successfully updated.' } format.json { render :show, status: :ok, location: @community } else format.h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @community = current_user.own_communities.find(params[:id])\n flash[:notice] = 'Community was successfully updated.' if @community.update_attributes(update_params)\n respond_with(@community)\n end", "def update\n @community = Community.find(params[:id])\n\n respond_to do |format|\n ...
[ "0.69277656", "0.6828275", "0.6808888", "0.6701874", "0.6670035", "0.6617551", "0.6617551", "0.66164196", "0.6602938", "0.64724076", "0.6395361", "0.62229115", "0.6164329", "0.6094397", "0.6089327", "0.60179067", "0.59801584", "0.5974137", "0.5930805", "0.5857064", "0.5790322...
0.6494922
9
DELETE /communities/1 DELETE /communities/1.json
def destroy @community.destroy respond_to do |format| format.html { redirect_to communities_url, notice: 'Community was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @community.destroy\n respond_to do |format|\n format.html { redirect_to communities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @community = Community.find(params[:id])\n @community.destroy\n\n respond_to do |format|\n format.html { redire...
[ "0.77485144", "0.7736181", "0.76273257", "0.7587767", "0.7581778", "0.73436004", "0.70315486", "0.69896495", "0.69865716", "0.69472486", "0.6937182", "0.6927305", "0.6901678", "0.6831687", "0.68242604", "0.6719934", "0.6719274", "0.6685005", "0.6684442", "0.66841626", "0.6684...
0.7518036
8
Use callbacks to share common setup or constraints between actions.
def set_community @community = Community.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6164095", "0.6046031", "0.5945298", "0.59179014", "0.58890367", "0.58341795", "0.5776118", "0.5700777", "0.5700777", "0.5656277", "0.56218207", "0.5423995", "0.5411516", "0.5411516", "0.5411516", "0.5395004", "0.53783494", "0.53593004", "0.53412604", "0.534078", "0.5332865...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def community_params params.require(:community).permit(:name, :subdomain, :owner_id, :photo, :remote_photo_url, :i...
{ "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
array of train objects
def initialize (start_num, train_direction, line, speed = 1) @start_num = start_num #station start number integer @start_point = line.stations[@start_num].station_name #start station name string @train_direction = train_directio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_trains\r\n @trains = Array.new\r\n\r\n @lines.each {|line, stations|\r\n @trains.push(Train.new(line))\r\n }\r\n \r\n return @trains\r\n end", "def train\r\n return @train\r\n end", "def train\n run_aggregation\n run_syntetics\n run_values_to_r...
[ "0.6936384", "0.66699296", "0.6537438", "0.6532776", "0.6416285", "0.62966156", "0.6233101", "0.6196317", "0.6158977", "0.6094557", "0.60681516", "0.6043533", "0.5991628", "0.5983836", "0.5977855", "0.59303075", "0.5902977", "0.5886628", "0.58000064", "0.5783904", "0.57688695...
0.5357354
37
This method generates an array of all moves that can be made after the current move.
def children array = [] (0..2).each do |row| (0..2).each do |col| if @board[row][col].empty? array << @board[row][col] end end end array.each do |pos| new_board = @board.dup new_board[pos] = @next_mover_mark prev_mov_pos = pos node = TicTac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_possible_moves\n positions_array = []\n x = @position[0]\n y = @position[1]\n next_position = [x+1,y+2]\n positions_array << next_position if position_check(next_position)\n next_position = [x+1,y-2]\n positions_array << next_position if position_check(next_position)\n next_positio...
[ "0.7454899", "0.7446933", "0.74072415", "0.73741376", "0.7238501", "0.72353125", "0.7216565", "0.72129965", "0.72053987", "0.7180976", "0.7141286", "0.71169573", "0.70892733", "0.70804757", "0.70714456", "0.7061779", "0.7034827", "0.70276445", "0.69852394", "0.6976368", "0.69...
0.0
-1
clones an individual course with no deep cloning
def clone_course(course) cloned_course = course.dup cloned_course.update_attribute("name", course.name + "-CLONE") cloned_course.save cloned_course end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clone_course \n if params[:copy_course_id]\n @service_learning_course ||= ServiceLearningCourse.find(params[:copy_course_id])\n \n if slc2 = @service_learning_course.deep_clone!\n slc2.update_attribute(:quarter_id, @quarter.id)\n flash[:notice] = \"Successfully cloned #{@servi...
[ "0.6996922", "0.68290555", "0.6796687", "0.67476386", "0.6672084", "0.6650907", "0.6587748", "0.6587748", "0.65372384", "0.6529931", "0.6529931", "0.6529931", "0.6527987", "0.6519813", "0.6498825", "0.6498825", "0.6498825", "0.6408678", "0.6389067", "0.63048863", "0.63048863"...
0.7685121
0
GET begin the OpenID verification process
def create openid_url = params[:openid_url] response = openid_consumer.begin openid_url if response.status == OpenID::SUCCESS response.add_extension_arg('sreg','required','email') # TODO ask for given, family names from OpenID provider here redirect_url = response.redirect_url(home_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def begin\n openid_url = params[:openid_url]\n\n if openid_url.blank?\n flash[:error] = \"To use this, please type in the box.\"\n redirect_to openid_root_path and return\n end\n\n # We begin using the consumer with the user's OpenID URL.\n #\n # This returns a CheckID Request object co...
[ "0.7550162", "0.6971578", "0.69567066", "0.67255825", "0.67023087", "0.6528135", "0.65027916", "0.6438414", "0.6417642", "0.6308097", "0.62479496", "0.624009", "0.62206894", "0.6201764", "0.61497813", "0.613363", "0.61213684", "0.6071464", "0.6046506", "0.5982794", "0.5982794...
0.6485183
7
GET complete the OpenID verification process
def complete response = openid_consumer.complete params if response.status == OpenID::SUCCESS session[:openid] = response.identity_url # TODO: grab user from db based on OpenID url session[:user] = Person.find_by_openid_url(response.identity_url) # the user is now logged in with OpenID!...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_complete\n # Ask the library to check the response that the server sent\n # us. Status is a code indicating the response type. info is\n # either nil or a string containing more information about\n # the return type.\n response = $consumer.complete(@req.query)\n \n css_class = \"error\...
[ "0.73473525", "0.7087192", "0.6854757", "0.68273944", "0.68259394", "0.67506677", "0.6748939", "0.6742375", "0.66408825", "0.6600671", "0.6440145", "0.6395849", "0.6344263", "0.6256212", "0.6236545", "0.6188792", "0.6172881", "0.61695427", "0.608825", "0.5948302", "0.59395975...
0.6854851
2
Implementation of a bubblesort algorithm
def bubbleSort @data.each do |i| @data.each_with_index do |val, index| unless @data[index + 1].nil? if val > @data[index+1] temp = val @data[index] = @data[index + 1] @data[index + 1] = temp end end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bubble_sort(a)\n i = 0\n while i<a.size\n j = a.size - 1\n while (i < j)\n if a[j] < a[j - 1]\n a[j], a[j-1] = a[j-1], a[j]\n end\n j-=1\n end\n i+=1\n end\n return a\nend", "def bubble_sort!(arr)\n arr.size.times do |iteration|\n arr.each_index do |x|\n break i...
[ "0.815879", "0.80634403", "0.80261666", "0.8010087", "0.7977855", "0.79703903", "0.7933456", "0.792018", "0.79073346", "0.78973234", "0.78954756", "0.7863135", "0.785767", "0.7845188", "0.78413147", "0.7814436", "0.7812116", "0.77959", "0.77945536", "0.7789678", "0.77861565",...
0.787393
11
GET /task_metrics/1 GET /task_metrics/1.json
def show @task_metric = TaskMetric.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render :json => @task_metric } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_metrics\n {\n method: \"Performance.getMetrics\"\n }\n end", "def url\n resource.url + '/metrics'\n end", "def new\n @task_metric = TaskMetric.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @task_metric...
[ "0.66714025", "0.6633066", "0.64287776", "0.634064", "0.633092", "0.632126", "0.6299364", "0.6178539", "0.61565757", "0.6118245", "0.60998636", "0.6051033", "0.6042351", "0.60026", "0.59021795", "0.5876435", "0.5874128", "0.5868451", "0.586028", "0.5844015", "0.58186257", "...
0.7146769
0
GET /task_metrics/new GET /task_metrics/new.json
def new @task_metric = TaskMetric.new respond_to do |format| format.html # new.html.erb format.json { render :json => @task_metric } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @task_metric = TaskMetric.new(params[:task_metric])\n\n respond_to do |format|\n if @task_metric.save\n format.html { redirect_to @task_metric, :notice => 'Task metric was successfully created.' }\n format.json { render :json => @task_metric, :status => :created, :location => ...
[ "0.7871681", "0.73605996", "0.71881884", "0.6784202", "0.6762427", "0.6744882", "0.6694651", "0.66940176", "0.66940176", "0.66940176", "0.66940176", "0.66940176", "0.66940176", "0.66940176", "0.66940176", "0.66940176", "0.66940176", "0.66940176", "0.66940176", "0.6631869", "0...
0.8083968
0
POST /task_metrics POST /task_metrics.json
def create @task_metric = TaskMetric.new(params[:task_metric]) respond_to do |format| if @task_metric.save format.html { redirect_to @task_metric, :notice => 'Task metric was successfully created.' } format.json { render :json => @task_metric, :status => :created, :location => @task_metri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report_metrics\n metadata = {\n 'sourcetype' => 'json',\n 'source' => 'chef-handler',\n 'host' => node.hostname,\n 'index' => @index,\n 'check-index' => false\n }\n\n # We're creating a new Hash b/c 'node' and 'all_resources' in run_status\n ...
[ "0.6300248", "0.61832935", "0.60954666", "0.60595226", "0.59646887", "0.591376", "0.5886812", "0.58007085", "0.5787043", "0.57808393", "0.575522", "0.5743912", "0.5680045", "0.5664509", "0.56559134", "0.5646263", "0.5646263", "0.5646263", "0.5616606", "0.5605294", "0.5602597"...
0.7254701
0
PUT /task_metrics/1 PUT /task_metrics/1.json
def update @task_metric = TaskMetric.find(params[:id]) respond_to do |format| if @task_metric.update_attributes(params[:task_metric]) format.html { redirect_to @task_metric, :notice => 'Task metric was successfully updated.' } format.json { head :no_content } else format.htm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @task_metric = TaskMetric.new(params[:task_metric])\n\n respond_to do |format|\n if @task_metric.save\n format.html { redirect_to @task_metric, :notice => 'Task metric was successfully created.' }\n format.json { render :json => @task_metric, :status => :created, :location => ...
[ "0.6457924", "0.6442556", "0.62184036", "0.6119812", "0.6114812", "0.60787916", "0.6073466", "0.6051637", "0.60322124", "0.6018429", "0.5957192", "0.59560674", "0.5904801", "0.5890842", "0.5864443", "0.5855654", "0.5855654", "0.58538175", "0.5850605", "0.58420485", "0.5839309...
0.74356985
0
DELETE /task_metrics/1 DELETE /task_metrics/1.json
def destroy @task_metric = TaskMetric.find(params[:id]) @task_metric.destroy respond_to do |format| format.html { redirect_to task_metrics_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @throughput_metric.destroy\n respond_to do |format|\n format.html { redirect_to throughput_metrics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @task_stat = TaskStat.find(params[:id])\n @task_stat.destroy\n\n respond_to do |format|\n format...
[ "0.70675415", "0.7034422", "0.7021465", "0.6977076", "0.6930605", "0.6885834", "0.6784174", "0.6715926", "0.6681381", "0.6664881", "0.66481495", "0.65771383", "0.6551758", "0.65491515", "0.6514149", "0.65129554", "0.6490324", "0.64871776", "0.6439243", "0.64371496", "0.642868...
0.8113819
0
GET /books GET /books.json
def index default_q = { name_not_cont_all: (1..9).to_a.map { |i| ["(#{i})", "(#{i})", "(0#{i})", "(0#{i})"] }.flatten, press_not_cont_all: %w(東立 九星文化出版社 台灣角川股份有限公司 旺福圖書 N/A 銘顯文化事業有限公司 上海譯文出版社 明日工作室股份有限公司 橘子 十田十 青文出版社股份有限公司 尖端出版 龍吟ROSE 台灣東販股份有限公司 桔子), rate_gt: 4.5 } @q = Book.enabled.ransac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n ...
[ "0.79133123", "0.76842594", "0.7639867", "0.7624737", "0.75782645", "0.75433046", "0.75361156", "0.74585557", "0.7415426", "0.7316023", "0.72467226", "0.72467226", "0.7238736", "0.7236441", "0.7236441", "0.7236441", "0.7236441", "0.7236441", "0.7236441", "0.7236441", "0.72364...
0.0
-1
GET /books/1 GET /books/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n ...
[ "0.7639104", "0.74438995", "0.7442231", "0.73364466", "0.7315201", "0.72987884", "0.7227466", "0.7227466", "0.7223304", "0.7210002", "0.7210002", "0.7210002", "0.7210002", "0.7210002", "0.7210002", "0.7210002", "0.7210002", "0.7210002", "0.7158703", "0.7144481", "0.71394396",...
0.0
-1
POST /books POST /books.json
def create @book = Book.new(book_params) respond_to do |format| if @book.save format.html { redirect_to @book, notice: 'Book was successfully created.' } format.json { render :show, status: :created, location: @book } else format.html { render :new } format.json { re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @book = Book.new(book_params)\n\n if @book.save\n render json: @book, status: :created, location: @book\n else\n render json: @book.errors, status: :unprocessable_entity\n end\n end", "def create\n\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @b...
[ "0.7260979", "0.7052168", "0.6990385", "0.69234765", "0.6920176", "0.68718755", "0.68718755", "0.68718755", "0.68718755", "0.68718755", "0.685515", "0.6847371", "0.67841905", "0.6777309", "0.67586553", "0.67586553", "0.6756703", "0.6698212", "0.66888076", "0.6679647", "0.6679...
0.67478836
24
PATCH/PUT /books/1 PATCH/PUT /books/1.json
def update respond_to do |format| if @book.update(book_params) format.html { redirect_to @book, notice: 'Book was successfully updated.' } format.json { render :show, status: :ok, location: @book } else format.html { render :edit } format.json { render json: @book.errors,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n \n format.json { render json: @book, status: :created, location: @book }\n else\n \n format.json { render json: @book.errors, status: :unprocessable_entity }\n...
[ "0.7048998", "0.68883467", "0.68529594", "0.6827183", "0.6824368", "0.6820998", "0.68021524", "0.68021524", "0.68021524", "0.68021524", "0.68021524", "0.68021524", "0.68021524", "0.68021524", "0.68021524", "0.68001693", "0.67871445", "0.6730221", "0.6726465", "0.67243236", "0...
0.6543273
55
DELETE /books/1 DELETE /books/1.json
def destroy @book.destroy respond_to do |format| format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n \n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n form...
[ "0.7483589", "0.74434155", "0.74434155", "0.74372506", "0.74334204", "0.74334204", "0.74334204", "0.74334204", "0.74334204", "0.74334204", "0.74334204", "0.74334204", "0.74334204", "0.74334204", "0.74334204", "0.74334204", "0.7419262", "0.7401301", "0.7401301", "0.7401301", "...
0.7148163
66
Use callbacks to share common setup or constraints between actions.
def set_book @book = Book.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.6163754", "0.6045816", "0.5944853", "0.59169096", "0.58892167", "0.58342934", "0.5776148", "0.57057375", "0.57057375", "0.56534296", "0.56209534", "0.54244673", "0.54101455", "0.54101455", "0.54101455", "0.53951085", "0.5378493", "0.53563684", "0.53399915", "0.5338049", "0...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def book_params params.require(:book).permit(:name, :isbn, :rate, :quantity) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6979893", "0.6781746", "0.6746611", "0.6742344", "0.6735229", "0.6592651", "0.65027124", "0.6498011", "0.648163", "0.647716", "0.64556813", "0.64386255", "0.63784456", "0.63756156", "0.636574", "0.6319542", "0.63004524", "0.6299559", "0.62925464", "0.62923217", "0.6289894"...
0.0
-1
This will behave slightly different than the legacy jq based rule which was targeted against inline ingress only
def audit_impl(cfn_model) violating_security_groups = cfn_model.security_groups.select do |security_group| violating_ingresses = security_group.ingresses.select do |ingress| ingress.toPort.to_i == 22 || ingress.toPort.to_i == 3389 end !violating_ingresses.empty? end viol...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distributed_engine_rules_2_json_simple(rules)\n\n end", "def get_ingress_endpoint(namespace, ingress_name)\n stdout, _, _ = execute(\"kubectl get ingress #{ingress_name} -n #{namespace} -o json -o jsonpath='{.status.loadBalancer.ingress[0].hostname}'\")\n stdout\nend", "def check_ingress_rule(rule, ip_p...
[ "0.5502245", "0.5355207", "0.5209904", "0.50533956", "0.49692795", "0.48834926", "0.48076454", "0.47935584", "0.47616243", "0.4761367", "0.4761367", "0.4743649", "0.47119635", "0.46726266", "0.46672648", "0.46666542", "0.466472", "0.46558657", "0.4639754", "0.46384746", "0.46...
0.0
-1
Some people liked this; personally I've decided against using it but I'll keep it nonetheless
def belongs_to(table, options = {}) options = options.merge(:references => table) options[:on_delete] = options.delete(:dependent) if options.has_key?(:dependent) column("#{table.to_s.singularize}_id".to_sym, :integer, options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def anchored; end", "def as_you_like_it_quote; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def tiny; end", "def custom; end", "def custom; end", "def same; end", "def overload; end", "def escaper=(_); end", "...
[ "0.6680228", "0.60641086", "0.5919675", "0.5831292", "0.56877553", "0.56877553", "0.56877553", "0.56877553", "0.5632485", "0.5593488", "0.5593488", "0.55667615", "0.5543266", "0.5542601", "0.55320334", "0.55255836", "0.5502758", "0.5502003", "0.54976505", "0.54871804", "0.544...
0.0
-1
Gets the mailbox of the notifiable
def mailbox @mailbox ||= Alerter::Mailbox.new(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mailbox\n @mailbox ||= current_user.mailbox\n end", "def mailbox(receiver)\n mailboxes[receiver]\n end", "def mailbox\n @mailbox ||= Mailboxer::Mailbox.new(self)\n end", "def mailbox\n\t\t\tMarshal.load(get_mailbox)\n\t\t\t#msgs = []\n\t\t\t#get_mailbox.each { |l| msgs << l.ch...
[ "0.7772022", "0.7689806", "0.734236", "0.72420174", "0.68659145", "0.6744115", "0.6677493", "0.6677493", "0.6645485", "0.6617418", "0.6598836", "0.6576097", "0.6416318", "0.63179076", "0.6275652", "0.6263459", "0.6263459", "0.61721", "0.61694455", "0.6160219", "0.60719395", ...
0.73114663
3
Get number of unread messages
def unread_inbox_count mailbox.inbox(unread: true).count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unread_messages_count\n @unread_messages_count ||= messages.unread.count\n end", "def unread_count\n @status = Messenger.inbox_status(current_user)\n return_message(200, :ok, :count => @status[:unread])\n end", "def num_unread_messages\n return Message.where({:receiver_id => self....
[ "0.8892931", "0.87081295", "0.86974627", "0.8516799", "0.8515271", "0.84592104", "0.8425156", "0.8269916", "0.8082705", "0.8058698", "0.78464174", "0.78433144", "0.7626396", "0.7598192", "0.7597499", "0.7592162", "0.757922", "0.753449", "0.7511473", "0.74979043", "0.74561876"...
0.8669084
4
Sends a notification as originator
def send_message(recipients, msg, sanitize_text=true, message_timestamp = Time.now) message = Alerter::MessageBuilder.new({ :sender => self, :recipients => recipients, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_notification\n unless development?\n recipient_email = Hacker.first(:username => self.recipient).email\n Notifier.send_message_notification(recipient_email, self.sender)\n end\n end", "def send_notification\n\n\n end", "def send_notifications\n end", "def send_notification( noti...
[ "0.7152381", "0.71006465", "0.6761019", "0.67285365", "0.6674969", "0.6617675", "0.66106033", "0.65781283", "0.657797", "0.65715086", "0.65639794", "0.65583205", "0.65403086", "0.6536262", "0.6423331", "0.6406292", "0.63745874", "0.63511246", "0.63429666", "0.6326527", "0.630...
0.0
-1
Mark the object as read for notifiable. Object can be: A Receipt A Message An Array of these Optionally pass in details of the read receipt as String
def mark_as_read(obj, details = nil) case obj when Alerter::Receipt obj.mark_as_read if obj.receiver == self when Alerter::Message obj.mark_as_read(self, details) when Array obj.map{ |sub_obj| mark_as_read(sub_obj, details) } end e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark_as_read(obj, details = nil)\n case obj\n when Alerter::Receipt\n obj.mark_as_read if obj.receiver == self\n when Alerter::Message\n obj.mark_as_read(self)\n when Array\n obj.map{ |sub_obj| mark_as_read(sub_obj) }\n end\n\n end"...
[ "0.8127545", "0.7459157", "0.70616096", "0.7008646", "0.68729013", "0.687277", "0.6725161", "0.6694544", "0.6664977", "0.66500986", "0.6543181", "0.6413077", "0.6393082", "0.6320283", "0.6291205", "0.6258487", "0.6135621", "0.60842365", "0.60720795", "0.6068862", "0.6063772",...
0.8107758
1
Mark the object as unread for notifiable. Object can be: A Receipt A Message An Array of these Optionally pass in details of the unread receipt as String
def mark_as_unread(obj, details = nil) case obj when Alerter::Receipt obj.mark_as_unread if obj.receiver == self when Alerter::Message obj.mark_as_unread(self, details) when Array obj.map{ |sub_obj| mark_as_unread(sub_obj, details) } end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark_as_unread(obj, details = nil)\n case obj\n when Alerter::Receipt\n obj.mark_as_unread if obj.receiver == self\n when Alerter::Message\n obj.mark_as_unread(self)\n when Array\n obj.map{ |sub_obj| mark_as_unread(sub_obj) }\n end\n ...
[ "0.80158764", "0.7713312", "0.7329078", "0.7327997", "0.7327997", "0.71355546", "0.7067028", "0.6976718", "0.6964072", "0.6877538", "0.68277824", "0.67906964", "0.6773941", "0.674946", "0.67281234", "0.67194664", "0.66602886", "0.6649267", "0.66469955", "0.66469955", "0.66251...
0.7985938
1
Mark the object as deleted for notifiable. Object can be: A Receipt A Message An Array of these Optionally pass in details of the deletion as String
def mark_as_deleted(obj, details = nil) case obj when Receipt return obj.mark_as_deleted if obj.receiver == self when Message obj.mark_as_deleted(self, details) when Array obj.map{ |sub_obj| mark_as_deleted(sub_obj, details) } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark_as_deleted(obj, details = nil)\n case obj\n when Receipt\n return obj.mark_as_deleted if obj.receiver == self\n when Message\n obj.mark_as_deleted(self)\n when Array\n obj.map{ |sub_obj| mark_as_deleted(sub_obj) }\n else\n ...
[ "0.7848713", "0.758374", "0.7233986", "0.7204598", "0.71474224", "0.71474224", "0.6635259", "0.6594418", "0.6594418", "0.6561719", "0.6526666", "0.6423671", "0.6352882", "0.6301278", "0.6283565", "0.6282509", "0.62547547", "0.6198809", "0.6145686", "0.61391306", "0.6125014", ...
0.7816421
1
Could use this if wanted to change the magic number.
def set_magic(file, bytes) raise unless bytes.size == 4 unless nowrite() File.open(file, File::RDWR) do |io| io.write(bytes) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def magic=(magic)\n @dirty = true\n @dir_ent['reserved1'] = magic\n end", "def reset_magic_code\n result = StringIO.new\n\n # magic flask 1 starts after 17 matches of magic flasks.\n # flasks 1-16, not sure what they're used for.\n # we start indexing at 1 so 16+1 = 17 .. 31 represents f...
[ "0.6725211", "0.6325121", "0.6282123", "0.62380654", "0.62380654", "0.59615004", "0.59223133", "0.5904694", "0.58981466", "0.58817136", "0.57881284", "0.5767669", "0.5746822", "0.5690321", "0.5688299", "0.5593992", "0.55778986", "0.55012906", "0.54621196", "0.54551107", "0.54...
0.63851804
1
Compiles the specified file to .pyc. A Python source file called ``py_file`` must exist. The created .pyc file will be given the name ``pyc_file``, or if not specified, the name ``py_file``.
def compile(source_name, py_file, pyc_file = nil) pyc_file ||= py_file source_name =~ /\.py$/ or raise base = $` pyofile = base + '.pyo' cp(py_file, source_name) command = format('python2.2 -OO -c \'%s\'', format('import py_compile; py_compile.compile("%s")', source_name)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile_file(file, compiled)\n if CodeLoader.save_compiled?\n Compiler.compile file, compiled\n else\n Compiler.compile_file file\n end\n end", "def compile_file(path)\n path = \"#{path}.rb\" unless path =~ /\\.rb\\Z/\n res = RubyVM::InstructionSequence.compile_file(pat...
[ "0.66759753", "0.63063234", "0.61108196", "0.597955", "0.59461755", "0.5866778", "0.5812637", "0.5744838", "0.5725461", "0.5642655", "0.56091785", "0.5451705", "0.545042", "0.54105604", "0.5396802", "0.53583926", "0.53047514", "0.52878696", "0.51846135", "0.51569426", "0.5096...
0.78596276
0
GET /operation_hours GET /operation_hours.js
def index @operation_hours = OperationHour.paginate(:page => params[:page], :per_page => 30).order('updated_at DESC') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hours\n render json: Pings::Selector.new.hours(params)\n end", "def hours\n \n end", "def hours\n response[\"hours\"]\n end", "def show\n @operation_hour = OperationHour.find(params[:id])\n end", "def get_hours()\n\n return self.hours\n\nend", "def venue_hours venue_id\n ...
[ "0.78751576", "0.7607654", "0.7442598", "0.7102228", "0.68928397", "0.6825148", "0.6803083", "0.6695163", "0.6681165", "0.662051", "0.6606692", "0.6464355", "0.64631426", "0.64630574", "0.6447762", "0.64153045", "0.6402415", "0.6402415", "0.6390251", "0.6390251", "0.63748866"...
0.68312395
5
GET /operation_hours/1 GET /operation_hours/1.js
def show @operation_hour = OperationHour.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hours\n render json: Pings::Selector.new.hours(params)\n end", "def hours\n \n end", "def index\n @operation_hours = OperationHour.paginate(:page => params[:page], :per_page => 30).order('updated_at DESC')\n end", "def hours\n response[\"hours\"]\n end", "def hourly(query)\n ...
[ "0.7537586", "0.69937414", "0.6502103", "0.64034283", "0.64026767", "0.640007", "0.6394357", "0.6356834", "0.62926114", "0.62792957", "0.62760884", "0.6204536", "0.6200759", "0.6091754", "0.6066728", "0.6064779", "0.6055176", "0.60415196", "0.60226375", "0.60148644", "0.59733...
0.71119756
1
POST /operation_hours POST /operation_hours.js
def create @operation_hours = OperationHour.paginate(:page => params[:page], :per_page => 30).order('updated_at DESC') @operation_hour = OperationHour.create(params[:operation_hour]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hours\n render json: Pings::Selector.new.hours(params)\n end", "def create\n if(params[:oper] && params[:oper] != '')\n timecard = Timecard.find(params[:timecard_id])\n # the hour the we should use\n if(params[:oper] == 'edit')\n hour = timecard.hours.find(params[:id])\n #...
[ "0.7110456", "0.690831", "0.6791965", "0.6603908", "0.65123665", "0.64754593", "0.64322174", "0.6351163", "0.6321367", "0.63117397", "0.62787676", "0.62695134", "0.62526315", "0.62052554", "0.6187293", "0.6169043", "0.6152835", "0.6096853", "0.60850513", "0.6083107", "0.60757...
0.7256437
0
PATCH/PUT /operation_hours/1 PATCH/PUT /operation_hours/1.json
def update @operation_hour = OperationHour.find(params[:id]) @operation_hour.update_attributes(params[:operation_hour]) @operation_hours = OperationHour.paginate(:page => params[:page], :per_page => 30).order('updated_at DESC') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @hour = Hour.find(params[:id])\n\n respond_to do |format|\n if @hour.update_attributes(params[:hour])\n format.html { redirect_to @hour, notice: 'Hour was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n...
[ "0.6516292", "0.6430447", "0.6414233", "0.63876444", "0.6387635", "0.635673", "0.6356571", "0.6348749", "0.6338697", "0.63050187", "0.62625736", "0.6242436", "0.62315106", "0.6224622", "0.6220036", "0.61364305", "0.6128679", "0.61261815", "0.61012894", "0.6075175", "0.6069383...
0.6963615
0
GET /operation_hour/1/delete GET /operation_hour/1/delete.js
def delete @operation_hour = OperationHour.find(params[:operation_hour_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @operation_hours = OperationHour.paginate(:page => params[:page], :per_page => 30).order('updated_at DESC')\n @operation_hour = OperationHour.find(params[:id])\n @error = nil\n\n begin\n @operation_hour.destroy\n rescue ActiveRecord::DeleteRestrictionError => e\n @error = e.m...
[ "0.7643843", "0.7241243", "0.7232302", "0.72178173", "0.71876425", "0.71542364", "0.71524835", "0.7131361", "0.70469207", "0.7030424", "0.7005596", "0.6923907", "0.6901295", "0.68752474", "0.6872276", "0.6834157", "0.6794279", "0.6787985", "0.6786737", "0.6774493", "0.6772147...
0.8344926
0
DELETE /operation_hours/1 DELETE /operation_hours/1.json
def destroy @operation_hours = OperationHour.paginate(:page => params[:page], :per_page => 30).order('updated_at DESC') @operation_hour = OperationHour.find(params[:id]) @error = nil begin @operation_hour.destroy rescue ActiveRecord::DeleteRestrictionError => e @error = e.message en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n @operation_hour = OperationHour.find(params[:operation_hour_id])\n end", "def destroy\n @estimated_hour.destroy\n respond_to do |format|\n format.html { redirect_to estimated_hours_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hour = Hour.find(pa...
[ "0.77436256", "0.722334", "0.70052344", "0.6993959", "0.6982049", "0.6967984", "0.6967714", "0.6870495", "0.68367976", "0.6803779", "0.6786576", "0.6757719", "0.67111844", "0.6693003", "0.66879857", "0.66820204", "0.66705316", "0.6642099", "0.66297346", "0.6620806", "0.661255...
0.7241692
1
this authorizes the user
def authorize if current_user.nil? redirect_to login_path, alert: 'You must be logged in to access this page.' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorize_user\n puts \"AUTHORIZE USER\"\n puts \"params[:id] \" + params[:id].to_s\n # render json: { status: 401, message: 'Unauthorized' } unless get_current_user.id == params[:id].to_i\n render json: { status: 401, message: 'Unauthorized' } unless get_current_user\n end", ...
[ "0.74178886", "0.7417691", "0.7355045", "0.7355045", "0.71754146", "0.7067895", "0.70627064", "0.7025085", "0.6998828", "0.69858694", "0.6959764", "0.6924969", "0.691239", "0.6830241", "0.6822793", "0.6809136", "0.6800804", "0.6797888", "0.6788931", "0.6772549", "0.6769208", ...
0.65518683
60
Create a new Entity for the specified +world+, and use the specified +id+ if given. If no +id+ is given, one will be automatically generated.
def initialize( world, id=nil ) @world = world @id = id || self.class.make_new_id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def newWorld(db, name)\n\tif db.hexists('sgt-worlds', name)\n\t\treturn World.new(db, db.hget('sgt-worlds', name))\n\tend\n\tnewId = newUUID(db)\n\t\n\t# Associate this name to the world id\n\tdb.hset('sgt-worlds', name, newId)\n\t\t\n\t# The 'name' property of the object\n\tdb.hset('sgt-world:'+newId, 'name', nam...
[ "0.6879333", "0.6554995", "0.5979309", "0.5927247", "0.5730982", "0.54769474", "0.5393953", "0.5378512", "0.53775334", "0.533464", "0.53244907", "0.5311943", "0.5230342", "0.5204399", "0.51848537", "0.51751137", "0.5140475", "0.5118512", "0.5099806", "0.5090408", "0.50781786"...
0.6781481
1
Return the components that the entity's World has registered for it as a Hash keyed by the Component class.
def components return self.world.components_for( self ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def components\n @world.get_components(self)\n end", "def components\n if @components.nil?\n @components = self.class.components(self.key)\n end\n @components\n end", "def available_components\n components = []\n @components.each_key do |k|\n componen...
[ "0.7663428", "0.75063187", "0.73536706", "0.7189071", "0.7131839", "0.7131839", "0.6979893", "0.69054174", "0.66480315", "0.6611369", "0.65765", "0.6576317", "0.650232", "0.6371836", "0.6252082", "0.6252082", "0.6171722", "0.6171722", "0.6136458", "0.6106993", "0.6094025", ...
0.7729197
0
Add the specified +component+ to the entity. The +component+ can be a subclass of Chione::Component, an instance of such a subclass, or the name of a subclass. It will replace any existing component of the same type.
def add_component( component, **init_values ) self.world.add_component_to( self, component, **init_values ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_component(component)\n add_to(component, @components)\n end", "def attach_component(entity, component)\n\t\tinterface = component.class.interface\n\t\t\n\t\texisting_component = entity[interface]\n\t\tif existing_component\n\t\t\tentity.delete_component(interface)\n\t\tend\n\t\t\n\t\tentity.add_co...
[ "0.7773207", "0.76045185", "0.73290765", "0.6952512", "0.69168866", "0.64536387", "0.64201784", "0.63917994", "0.6348756", "0.6322841", "0.6105137", "0.60300577", "0.60242087", "0.5996424", "0.5996424", "0.59016263", "0.5865261", "0.58454144", "0.58319706", "0.5763506", "0.57...
0.70127475
3
Fetch the component of the specified +component_class+ that corresponds with the receiving entity. Returns +nil+ if so much component exists.
def get_component( component_class ) return self.world.get_component_for( self, component_class ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_component\n @component = Component.find(params[:id])\n end", "def get(entity)\n @components[entity.id] \n end", "def getComponent()\n @component\n end", "def remove_component( component_class )\n\t\treturn self.world.remove_component_from( self, component_class )\n\tend...
[ "0.5998647", "0.58695394", "0.5649517", "0.56186616", "0.5536365", "0.5532835", "0.5511326", "0.548795", "0.5324822", "0.52252674", "0.51657945", "0.5146771", "0.5039102", "0.5027815", "0.49569795", "0.49466267", "0.4937558", "0.49223918", "0.48322213", "0.4797391", "0.479450...
0.7174485
0
Remove the component of the specified +component_class+ that corresponds with the receiving entity. Returns the component instance if it was removed, or +nil+ if no Component of the specified type was registered to the entity.
def remove_component( component_class ) return self.world.remove_component_from( self, component_class ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_component(component)\n\t\t@components.delete(component)\n\tend", "def remove_class\n destroy_instance_for_course(@current_path.instance_for_course_in_path(@selected_course).id)\n end", "def remove_component(gear, component)\n app = gear.application\n args = build_base_gear_args(gear)\n...
[ "0.6260348", "0.5741741", "0.5722073", "0.56466746", "0.5628608", "0.5625143", "0.54449683", "0.53781134", "0.52448356", "0.5164202", "0.51494735", "0.5132868", "0.5076262", "0.50725985", "0.4975316", "0.49378696", "0.4907771", "0.48704574", "0.48552623", "0.48552623", "0.483...
0.79381424
0