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
DELETE /categories/1 DELETE /categories/1.json
def destroy @category.destroy respond_to do |format| format.html { redirect_to admin_good_categories_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteCategory id\n \n APICall(path: \"categories/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n @category.destroy\n render json: @category, status: :ok\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |f...
[ "0.78272814", "0.77353686", "0.76392984", "0.7488916", "0.74731207", "0.74233276", "0.7399541", "0.7385346", "0.7385346", "0.7385346", "0.7385346", "0.7385346", "0.7385346", "0.7385346", "0.7385346", "0.7385346", "0.7385346", "0.7385346", "0.7385346", "0.7378597", "0.7378597"...
0.7245488
34
Use callbacks to share common setup or constraints between actions.
def set_category @category = GoodCategory.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.6165094", "0.60450804", "0.5944413", "0.5915806", "0.58885634", "0.5835225", "0.5775847", "0.5700531", "0.5700531", "0.56543404", "0.56209993", "0.54238355", "0.5410386", "0.5410386", "0.5410386", "0.5394892", "0.5377769", "0.53559244", "0.5339896", "0.53388095", "0.533008...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def order_params params.require(:order) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
def scrapped_recipes_with_ingredient(ingredient, difficulty) recipes = search_recipe_with_ingredient(ingredient, difficulty) recipes.map! do |recipe| Recipe.new(recipe[:title], recipe[:description], recipe[:prep_time], difficulty) end return recipes end
def recipe_done(recipe_index) @recipes[recipe_index].done! save_recipes_in_csv end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recipe_instances\n recipe_ingredients.map { |ri| ri.recipe }\n end", "def scrape_recipe(ingredient)\n @recipes_array = []\n @ingredient = ingredient\n url = \"https://www.allrecipes.com/search/results/?search=#{@ingredient}\"\n html_file = URI.open(url).read\n html_doc = Nokogiri::HTML(h...
[ "0.74096835", "0.72532356", "0.71460694", "0.7139655", "0.70501655", "0.6990193", "0.6939288", "0.6922007", "0.6911624", "0.6875349", "0.68605465", "0.6813661", "0.6806659", "0.6799779", "0.67432016", "0.6737293", "0.6724071", "0.6717115", "0.66972363", "0.6656441", "0.665613...
0.0
-1
Returns the depth of a node
def depth return 0 if nil? @accumulator_depth = 1 depth_aux(self, @accumulator_depth) @accumulator_depth end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def depth\n node = @kids.max {|k, j| k.depth <=> j.depth }\n node.depth + 1\n end", "def depth\n return call_ancestry_method(:depth) if use_ancestry?\n\n rel = relationship(:raise_on_multiple => true) # TODO: Handle multiple nodes with a way to detect which node you want\n rel.nil? ? 0 : rel.dept...
[ "0.7982543", "0.78039885", "0.776212", "0.7581981", "0.7463969", "0.7426475", "0.74191433", "0.74070585", "0.73817444", "0.73544765", "0.7267967", "0.7193124", "0.7171441", "0.7169074", "0.71485484", "0.710232", "0.70936257", "0.7085758", "0.70428896", "0.69886154", "0.697607...
0.65800434
36
Aux function to depth
def depth_aux(current_node, accumulator) @accumulator_depth = accumulator if accumulator > @accumulator_depth depth_aux(current_node.left_child, accumulator + 1) unless current_node.left_child.nil? depth_aux(current_node.right_child, accumulator + 1) unless current_node.right_child.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def depth=(_arg0); end", "def depth; end", "def my_depth\n 1\n end", "def depth_helper(node, arr, depth)\n if node.left.nil? && node.right.nil? \n arr << depth\n return\n else \n depth += 1 \n if node.left\n depth_helper(node.left, arr, depth) \n end \n if n...
[ "0.8176865", "0.76371735", "0.75289", "0.7167133", "0.7078402", "0.684866", "0.6810365", "0.6797169", "0.67596865", "0.6729017", "0.66827774", "0.66722256", "0.6633537", "0.6603984", "0.66034657", "0.6572468", "0.65552247", "0.6534248", "0.649647", "0.6430507", "0.6423622", ...
0.6557452
16
Consumes an input array and returns a balanced binary tree.
def build_tree(input_array) sorted_set = input_array.sort.uniq build_tree_aux(sorted_set, 0, sorted_set.length - 1) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def array_to_binary(arr)\n node = Node.new(arr[0])\n arr.slice(1..-1).each {|el| insert_into_tree(node, el) }\n node\nend", "def build_tree(array)\n return nil if array.empty?\n\n mid = (array.length - 1) / 2\n node = Node.new(array[mid])\n node.left = build_tree(array[0...mid])\n node.right =...
[ "0.7178468", "0.7052835", "0.6953921", "0.69506204", "0.6894124", "0.68749267", "0.68042964", "0.6784026", "0.67772186", "0.67171127", "0.66846347", "0.66815245", "0.6665387", "0.6660863", "0.6652068", "0.66337943", "0.65953887", "0.65851086", "0.6578991", "0.65423375", "0.65...
0.7092395
1
Aux function to build_tree
def build_tree_aux(input_array, start_index, stop_index) return nil if start_index > stop_index middle_index = (start_index + stop_index) / 2 left_half = build_tree_aux(input_array, start_index, middle_index - 1) middle_value = input_array[middle_index] right_half = build_tree_aux(input_array, middle_index + 1, stop_index) Node.new(middle_value, left_half, right_half) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_tree(arr)\n\tend", "def produce_tree(ary); end", "def tree\n @tree ||= build_tree\n end", "def build_tree( n , d )\n \n if d.key?('v')\n n < d['v'] ? build_tree(n , d['l']) : build_tree(n, d['r'])\n else\n d['l'] = {}\n d['v'] = n\n ...
[ "0.80958796", "0.76826626", "0.73350346", "0.72577316", "0.71102494", "0.7083005", "0.7029116", "0.6905179", "0.68785703", "0.68664896", "0.68532866", "0.6838869", "0.68172544", "0.6813181", "0.6777184", "0.67601293", "0.6740358", "0.67166764", "0.67084575", "0.6697673", "0.6...
0.0
-1
Insert a value to the BBT, careful, this may unbalance the tree
def insert(value) current_node = @root until current_node.nil? if current_node.data < value if current_node.right_child.nil? current_node.right_child = Node.new(value) break end current_node = current_node.right_child elsif current_node.data > value if current_node.left_child.nil? current_node.left_child = Node.new(value) break end current_node = current_node.left_child else puts 'Input error' break end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insertar(value)\n insert(Node.new(value, nil, nil))\n end", "def insert(value)\n\t\tcurrent_node = @head \n\t\tif current_node.value >= value \n\t\t\t@head = Node.new(value, current_node)\n\t\tend \n\t\tuntil current_node.next_node.value =< value \n\t\t\tbreak if current_node.next_node == nil \n\t\...
[ "0.7541748", "0.7393517", "0.734367", "0.73159623", "0.72740924", "0.726315", "0.72594833", "0.7250223", "0.72144294", "0.7192768", "0.7141769", "0.71271324", "0.7125075", "0.7121618", "0.7113678", "0.7075371", "0.70482314", "0.7030223", "0.70174193", "0.69876283", "0.6987557...
0.7042976
17
Delete a value from the BBT, careful, this may unbalance the tree
def delete(value) current_node = @root until current_node.nil? if current_node.data < value next_node = current_node.right_child if next_node.data == value current_node.right_child = delete_aux(next_node, value) break end current_node = current_node.right_child elsif current_node.data > value next_node = current_node.left_child if next_node.data == value current_node.left_child = delete_aux(next_node, value) break end current_node = current_node.left_child elsif current_node.data == value @root = build_tree(in_order_traversal(current_node) - [value]) break end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(value)\n find_node(value)&.delete\n end", "def delete_value value\r\n #find the pointer to the wanted node using LIST-SEARCH(value)\r\n #then delete that node with LIST-DELETE-BY-NODE(node)\r\n delete_node(self.search(value))\r\n end", "def delete_from(value)\n L.log '', \"...
[ "0.80915844", "0.7924976", "0.7830004", "0.7815752", "0.7461815", "0.7431895", "0.7431645", "0.73469865", "0.72802377", "0.72285813", "0.7181502", "0.71264124", "0.71264124", "0.70844907", "0.70844907", "0.7027486", "0.7017461", "0.70027834", "0.70001626", "0.69611734", "0.69...
0.74384767
5
Aux function to delete
def delete_aux(next_node, value) return nil if next_node.right_child.nil? && next_node.left_child.nil? return next_node.left_child if next_node.right_child.nil? return next_node.right_child if next_node.left_child.nil? build_tree(in_order_traversal(next_node) - [value]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n \n end", "def delete\n \n end", "def del\n delete\n end", "def delete(obj) ; end", "def destroy; delete end", "def delete!\n delete( nil, true ) \n end", "def del(*args); end", "def delete(name); end", "def delete(name); end", "def delete\n end", "d...
[ "0.8200665", "0.7844601", "0.7826577", "0.77656096", "0.7733488", "0.77138853", "0.7696122", "0.7626925", "0.7626925", "0.76240575", "0.76075155", "0.7541425", "0.751256", "0.7487649", "0.7487639", "0.7482364", "0.7482364", "0.7482364", "0.7482364", "0.7482364", "0.7482364", ...
0.0
-1
Consumes a value and return a Node if the value match the data in a Node
def find(value) current_node = @root until current_node.nil? if current_node.data < value current_node = current_node.right_child elsif current_node.data > value current_node = current_node.left_child else return current_node end end return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_node node, value\n return if ANY_VALUE != node &&\n (Array === value || Hash === value)\n\n if node.class == value.class\n node == value\n\n elsif Regexp === node\n match = node.match value.to_s\n return false unless match\n match = match.size > 1 ? match[1..-1] ...
[ "0.68579715", "0.6826764", "0.6746283", "0.6733583", "0.6733583", "0.65911585", "0.65357494", "0.6441634", "0.6334188", "0.6299959", "0.62202597", "0.6112517", "0.6096844", "0.60942537", "0.60339826", "0.6003444", "0.5993824", "0.59850776", "0.5950705", "0.59453076", "0.59172...
0.57974684
28
traverse the BBT in width and returns the data in level order in an array
def level_order_traversal array_to_be_string = [] queue = [] queue.push(@root) until queue.empty? current_node = queue.first array_to_be_string.push(current_node.data) queue.push(current_node.left_child) unless current_node.left_child.nil? queue.push(current_node.right_child) unless current_node.right_child.nil? queue.shift end array_to_be_string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tree_to_array(node)\n h = height(node)\n tree_arr = []\n (1..h).each do |n|\n tree_arr << node_at_a_level(node, n)\n end\n tree_arr\nend", "def bst_sequences(root)\n\nend", "def bnodes\n @graphs.inject([]) {|memo, g| memo += g.bnodes}\n end", "def setBredthLevels\n stack = []\n ...
[ "0.6412929", "0.5843901", "0.58246225", "0.58194315", "0.58133703", "0.5744274", "0.57283115", "0.5682781", "0.5664568", "0.5653229", "0.56401044", "0.56221324", "0.5542804", "0.54595715", "0.5408077", "0.53806406", "0.5379051", "0.5352988", "0.5339826", "0.5332224", "0.53228...
0.5628298
11
traverse the BBT in depth and returns the data in order in an array
def in_order_traversal(current_node = @root) @accumulator = [] in_order_traversal_aux(current_node) @accumulator end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tree_to_array(node)\n h = height(node)\n tree_arr = []\n (1..h).each do |n|\n tree_arr << node_at_a_level(node, n)\n end\n tree_arr\nend", "def test_breadth_each\n j = Tree::TreeNode.new(\"j\")\n f = Tree::TreeNode.new(\"f\")\n k = Tree::TreeNode.new(\"k\")\n a = Tree::TreeNode.ne...
[ "0.6668036", "0.6569204", "0.6509171", "0.64585686", "0.6368126", "0.63543254", "0.633515", "0.6260548", "0.625961", "0.62510276", "0.62374806", "0.6093633", "0.60844", "0.60510457", "0.6047733", "0.6037672", "0.60368687", "0.60228395", "0.601307", "0.6008515", "0.5998546", ...
0.0
-1
Aux function to in order traversal
def in_order_traversal_aux(current_node) in_order_traversal_aux(current_node.left_child) unless current_node.left_child.nil? @accumulator << current_node.data in_order_traversal_aux(current_node.right_child) unless current_node.right_child.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def traverse; end", "def in_order_traversal(tree=root, ordering=[])\n end", "def inorder_traversal_rec(root)\n res = []\n inorder_dfs(root, res)\n res\nend", "def traverse(&block)\n\t\t\t\treturn to_enum(:traverse) unless block_given?\n\t\t\t\t\n\t\t\t\ttraverse_recurse(@order-1, 0, 0, self.origin, self....
[ "0.7623163", "0.7067999", "0.6992783", "0.69893193", "0.69087136", "0.68776727", "0.6839546", "0.6832996", "0.66784036", "0.66678447", "0.66663486", "0.6644006", "0.6644006", "0.6643007", "0.6622308", "0.65833986", "0.65818155", "0.65818155", "0.65818155", "0.65818155", "0.65...
0.64637655
33
traverse the BBT in depth and returns the data in pre order in an array
def pre_order_traversal(current_node = @root) @accumulator = [] pre_order_traversal_aux(current_node) @accumulator end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_order_traverse(tree, array)\n if !tree.nil?\n array.append(tree.value)\n pre_order_traverse(tree.left, array)\n pre_order_traverse(tree.right, array)\n end\n \n return array\n\nend", "def tree_to_array(node)\n h = height(node)\n tree_arr = []\n (1..h).each do |n|\n tree_arr << node_at_...
[ "0.6736897", "0.6625045", "0.64283854", "0.64212704", "0.6389139", "0.6383696", "0.63626343", "0.63306254", "0.63287085", "0.629724", "0.6288771", "0.6228669", "0.6201915", "0.6201731", "0.6176722", "0.61671686", "0.6133982", "0.6122791", "0.61184794", "0.6105733", "0.6103688...
0.5580638
94
Aux function to pre order traversal
def pre_order_traversal_aux(current_node) @accumulator << current_node.data pre_order_traversal_aux(current_node.left_child) unless current_node.left_child.nil? pre_order_traversal_aux(current_node.right_child) unless current_node.right_child.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_order_traversal(tree=root, ordering=[])\n end", "def preorder\n preorder_traversal(@root, [])\n end", "def pre_order_traversal(current_node = @root)\n @accumulator = []\n pre_order_traversal_aux(current_node)\n @accumulator\n end", "def preorder\n # raise NotImplementedError\n re...
[ "0.8055941", "0.7493848", "0.74795413", "0.7446758", "0.7366498", "0.7343609", "0.7336576", "0.73146737", "0.72807556", "0.72807556", "0.72807556", "0.72807556", "0.72807556", "0.72807556", "0.72807556", "0.71900535", "0.7176545", "0.71700424", "0.7133009", "0.7060804", "0.70...
0.7180809
16
traverse the BBT in depth and returns the data in post order in an array
def post_order_traversal(current_node = @root) @accumulator = [] post_order_traversal_aux(current_node) @accumulator end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def postorder_traversal(root)\n response = []\n traverse(root, response)\n return response\nend", "def post_order_traverse(tree, array)\n if !tree.nil?\n post_order_traverse(tree.left, array)\n post_order_traverse(tree.right, array)\n array.append(tree.value)\n end\n \n return array\n\nend", "d...
[ "0.6622121", "0.6546339", "0.65049946", "0.64781773", "0.6472456", "0.6360617", "0.6342862", "0.6328196", "0.6315669", "0.6308888", "0.63047093", "0.62743026", "0.6181229", "0.6135139", "0.6069553", "0.6027046", "0.6025853", "0.5942014", "0.58201873", "0.58060455", "0.5804864...
0.5475283
63
Aux function to post order traversal
def post_order_traversal_aux(current_node) post_order_traversal_aux(current_node.left_child) unless current_node.left_child.nil? post_order_traversal_aux(current_node.right_child) unless current_node.right_child.nil? @accumulator << current_node.data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_order_traversal(tree=root, ordering=[])\n end", "def postorder\n postorder_traversal(@root, [])\n end", "def post_order_traversal(current_node = @root)\n @accumulator = []\n post_order_traversal_aux(current_node)\n @accumulator\n end", "def postorder_traversal(root)\n response = []\n...
[ "0.7940628", "0.75571615", "0.74823767", "0.74067074", "0.73935467", "0.73537165", "0.7140463", "0.7047513", "0.7042344", "0.69973093", "0.69973093", "0.69973093", "0.69973093", "0.69973093", "0.69973093", "0.69973093", "0.69973093", "0.6993667", "0.6986625", "0.69726586", "0...
0.6958984
21
pretty print a BT
def pretty_print(node = @root, prefix = '', is_left = true) pretty_print(node.right_child, "#{prefix}#{is_left ? '│ ' : ' '}", false) if node.right_child puts "#{prefix}#{is_left ? '└── ' : '┌── '}#{node.data}" pretty_print(node.left_child, "#{prefix}#{is_left ? ' ' : '│ '}", true) if node.left_child end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_pretty\n to_s(:prettyprint => true)\n end", "def pretty_print(pp)\n pp.text \"#{task.name}.#{name}\"\n pp.nest(2) do\n pp.breakable\n pp.text \"tracked = #{@tracked}\"\n pp.breakable\n pp.text...
[ "0.64626485", "0.6351177", "0.6222819", "0.6217678", "0.61975056", "0.61331207", "0.61038876", "0.6074433", "0.6007125", "0.5995448", "0.59572077", "0.59484774", "0.59323484", "0.59323484", "0.590655", "0.59032434", "0.58905196", "0.5885599", "0.5881111", "0.58686805", "0.585...
0.0
-1
Checks if a BT is balanced
def balanced? difference_left_right = @root.left_child.depth - @root.right_child.depth difference_left_right.between?(-1, 1) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_balanced?\n diff = (self.left.depth - self.right.depth).abs\n if diff <= 1\n true\n else\n false\n end\n end", "def balances?(tk); end", "def balanced?\n # tree is balanced if the difference between left and right depths is within 1\n (Tree.depth(root.left) - Tree.depth(root...
[ "0.7397917", "0.7177619", "0.716193", "0.7135442", "0.7102492", "0.7034965", "0.70281976", "0.7004631", "0.6984082", "0.6981011", "0.6910093", "0.69051784", "0.6878196", "0.6853529", "0.67641383", "0.6749212", "0.67465234", "0.6678913", "0.659758", "0.64845747", "0.6467659", ...
0.694673
10
Consumes a BT an returns a BBT
def rebalance @root = build_tree(self.level_order_traversal) if !self.balanced? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bt\n @queue << \"bt\"\n end", "def bsb_test\n bsb = BSB.new\n bsb.read(\"!Copyright 1999, Maptech Inc. All Rights Reserved.\nCRR/CERTIFICATE OF AUTHENTICITY\n This electronic chart was produced under the authority of the National\n Oceanic and Atmospheric Administration (NOAA). NOAA is the ...
[ "0.5633212", "0.5510109", "0.5359136", "0.53279406", "0.5150156", "0.5144604", "0.5139233", "0.50056314", "0.49942097", "0.49818766", "0.4961851", "0.49156207", "0.49090236", "0.4898425", "0.48741075", "0.48733762", "0.48618728", "0.48542228", "0.4837664", "0.48141629", "0.47...
0.0
-1
GET /barks or /barks.json
def index @barks = Bark.all.order('created_at DESC') @bark = Bark.new 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.6698829", "0.6591819", "0.63576835", "0.62608725", "0.62539774", "0.6245141", "0.61578286", "0.61014587", "0.60914284", "0.6090552", "0.6056627", "0.5987603", "0.59819996", "0.5978963", "0.58918744", "0.58896375", "0.58797693", "0.58732694", "0.5860237", "0.5845424", "0.58...
0.0
-1
GET /barks/1 or /barks/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @barrack = Barrack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @barrack }\n end\n end", "def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOG...
[ "0.6599254", "0.65854555", "0.648414", "0.64804435", "0.6153299", "0.6146643", "0.61453545", "0.61275506", "0.60958946", "0.6081435", "0.60410964", "0.6034058", "0.5954818", "0.5939912", "0.5936391", "0.59286743", "0.591732", "0.59138465", "0.59123826", "0.59052783", "0.58993...
0.0
-1
POST /barks or /barks.json
def create @bark = current_user.barks.build(bark_params) respond_to do |format| if @bark.save format.html { redirect_to root_path, notice: "Bark was successfully created." } format.json { render :show, status: :created, location: @bark } else format.html { render :new, status: :unprocessable_entity } format.json { render json: @bark.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @barrack = Barrack.new(params[:barrack])\n\n respond_to do |format|\n if @barrack.save\n format.html { redirect_to @barrack, notice: 'Barrack was successfully created.' }\n format.json { render json: @barrack, status: :created, location: @barrack }\n else\n format....
[ "0.64246625", "0.6424445", "0.6054478", "0.5923874", "0.5910778", "0.59107625", "0.5903337", "0.5902356", "0.5887644", "0.5884899", "0.585661", "0.58294487", "0.5823725", "0.57541114", "0.5738117", "0.57277936", "0.5719391", "0.56941056", "0.5692517", "0.5685203", "0.56814486...
0.68822765
0
PATCH/PUT /barks/1 or /barks/1.json
def update respond_to do |format| if @bark.update(bark_params) format.html { redirect_to @bark, notice: "Bark was successfully updated." } format.json { render :show, status: :ok, location: @bark } else format.html { render :edit, status: :unprocessable_entity } format.json { render json: @bark.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @barrack = Barrack.find(params[:id])\n\n respond_to do |format|\n if @barrack.update_attributes(params[:barrack])\n format.html { redirect_to @barrack, notice: 'Barrack was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render ac...
[ "0.66103864", "0.6525338", "0.6412469", "0.63037306", "0.6233765", "0.62271506", "0.62136483", "0.62129813", "0.61933815", "0.61432594", "0.6134164", "0.61065763", "0.6066356", "0.6062231", "0.6054456", "0.60389256", "0.6028534", "0.6025036", "0.6017557", "0.60162574", "0.601...
0.67966646
0
DELETE /barks/1 or /barks/1.json
def destroy @bark.destroy respond_to do |format| format.html { redirect_to barks_url, notice: "Bark was successfully destroyed." } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def delete\n client.delete(\"/#{id}\")\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", ...
[ "0.6676001", "0.6607538", "0.6607472", "0.66072315", "0.65900487", "0.65897286", "0.6547464", "0.64660424", "0.64660424", "0.6464393", "0.6458845", "0.64166373", "0.64010286", "0.6387053", "0.63831455", "0.63682324", "0.63682324", "0.63682324", "0.63682324", "0.6350965", "0.6...
0.63406587
20
Use callbacks to share common setup or constraints between actions.
def set_bark @bark = Bark.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a list of trusted parameters through.
def bark_params params.require(:bark).permit(:bark) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
End Class Methods Instance Methods
def moderator_of?(forum) moderatorships.where('forum_id = ?', (forum.is_a?(Forum) ? forum.id : forum)).count == 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end\n end", "def end; end", "def end; end", "def end; end", "def methods() end", "def private; end", "def end\n end", "def end\n end", "def end\n end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def class() end", "def instance; end",...
[ "0.710527", "0.7079218", "0.7079218", "0.7079218", "0.707783", "0.7053696", "0.69864154", "0.69365126", "0.69365126", "0.692868", "0.692868", "0.692868", "0.692868", "0.69109607", "0.6808825", "0.6808825", "0.6808825", "0.66090584", "0.65659946", "0.6538463", "0.6538463", "...
0.0
-1
should only be called after best guess is known! not enforced to allow non heuristic based csp search
def assignment_intialize if(@puret and @puref) return false end if(@num_negative == 0 or @puret) @assignments = [1] elsif(@num_positive == 0 or @puref) @assignments = [-1] elsif(@best_guess <0) @assignments = [-1,1] else @assignments = [1,-1] end return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heuristics\n raise NotImplementedError, \"not implemented in #{self}\"\n end", "def find_solution_dynamic\n if @game_data.solved?\n update_best_maybe(nil)\n return\n end\n\n prev_move_num = @visited[@game_data.cur_row]\n if !prev_move_num.nil? && (prev_move_num <= @move_numb...
[ "0.6333796", "0.6231165", "0.6195267", "0.6195267", "0.61370957", "0.60599285", "0.6014038", "0.60125136", "0.59513736", "0.59121877", "0.5883356", "0.585162", "0.57922685", "0.57830924", "0.5769511", "0.57068855", "0.56865275", "0.56728035", "0.56535906", "0.56470627", "0.56...
0.0
-1
takes a string preposistion and turns it into a 2d array ands of ors with id numbers + depending on negation
def string_to_internal(preposition) temp_kb =Array.new #string input of format literal_name LOGICAL_PREPOSISTION preposition_array = preposition.split next_negated = false sentence = [] preposition_array.each do |word| #####################################3 # puts " word: " + word #don't need to handle "or" as long as it is in right format, will look to "and" and the end as limiters if (word == "AND" || word == "and") temp_kb << sentence sentence = [] elsif(word == "NOT" || word == "not") next_negated = true elsif(word == "OR" || word =="or") else temp = @name_hash[word] #add variable if doesnt exist if(temp == nil) temp_var = Literalzs.new(word,@total_variables) @id_array.push(temp_var) @name_hash[word] = @total_variables temp = @total_variables @total_variables+=1 end if(next_negated) temp = temp.to_i * -1 #########################################################3333 #puts " temp negated, now is: " + temp.to_s next_negated = false end sentence << temp end end #need to grab last sentence since it wont be ended with and temp_kb << sentence return temp_kb end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contain_all_rots(strng, arr)\n array = strng.chars\n number = 0\n result = []\n (array.size - 1).times do \n array.rotate!\n result << array\n end\n result.map! {|y| y.join(\"\")}\n # result.all?{|x| arr.include?(x)}\nend", "def convert_to_ar(str)\n bgn = 0\n cur = st...
[ "0.5680787", "0.5576906", "0.5546782", "0.554677", "0.5517356", "0.5515137", "0.54760414", "0.54503244", "0.5427184", "0.5394476", "0.53865373", "0.53825337", "0.53650457", "0.536414", "0.53584665", "0.53492194", "0.5336559", "0.5335094", "0.5331078", "0.53201073", "0.5318915...
0.613412
0
private function to read input, called in intialize in creation of knowledge base and when adding to knowledge base
def input(prepositions) @kb = string_to_internal(prepositions) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_input; end", "def read_input\n end", "def parse_input(input_file); end", "def parse_input(input_file); end", "def parse_input (input_file)\nend", "def input; end", "def input; end", "def input; end", "def parse_input(params, resource); end", "def input; @input; end", "def input; @in...
[ "0.7333816", "0.7254152", "0.6922051", "0.6922051", "0.6890028", "0.67104304", "0.67104304", "0.67104304", "0.65179425", "0.64887583", "0.64887583", "0.64805466", "0.63677293", "0.63103247", "0.62835985", "0.62647754", "0.62050456", "0.6169425", "0.6022659", "0.5993443", "0.5...
0.5792584
37
calls in sequence, could add logic to remove instead, but rather not make it public
def find_remove(preposistion) remove(find(preposition)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove; end", "def remove; end", "def remove; end", "def remove; end", "def remove!; end", "def method_removed(*) end", "def remove\n __flag__ :remove\n end", "def remove_item\n\n end", "def remove(val)\n\nend", "def prepareForReuse; end", "def discard; end", "def discard; end"...
[ "0.7608687", "0.7608687", "0.7608687", "0.7608687", "0.7302225", "0.66224986", "0.65020186", "0.6396098", "0.634207", "0.63171536", "0.6278926", "0.6278926", "0.62548035", "0.62548035", "0.62548035", "0.62548035", "0.62173784", "0.61737305", "0.6172877", "0.6160341", "0.61378...
0.0
-1
removes the last logical statement added, returns false on failure, else true
def remove_last() temp = @kb.pop return !temp.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_statement?\n false\n end", "def semact?; false; end", "def end?\r\n\t\tif(@allLines.empty?)\r\n\t\t\treturn true\r\n\t\telse\r\n\t\t\treturn false\r\n\t\tend\r\n\tend", "def halted?\n @current >= (@size - 1)\n end", "def can_redo?; @last_done < (@actions.size - 1); end", ...
[ "0.64031285", "0.61769944", "0.59375757", "0.582834", "0.5811565", "0.57776767", "0.57702106", "0.57599515", "0.5692707", "0.565337", "0.56469125", "0.56464064", "0.56345326", "0.5630337", "0.56045985", "0.5585154", "0.55791086", "0.5567264", "0.55550313", "0.55268115", "0.55...
0.55839723
16
finds only the first instance
def find(prepostion) partial_search_kb = string_to_internal(preposition) partial_search_kb.each do |sentence| ind = @kb.index(sentence) end return ind end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first() end", "def find_first(*args)\n id = get_range(:count => 1, *args).first\n id && find_one(id, *args)\n end", "def first!\n first or raise RecordNotFound\n end", "def first(*args)\n find(:first, *args)\n end", "def first(*args)\n find(:first, *args)\n ...
[ "0.76388025", "0.7529196", "0.75099707", "0.74916905", "0.74916905", "0.7488185", "0.7477368", "0.74085915", "0.73815966", "0.73810834", "0.73281676", "0.7303974", "0.7296113", "0.72872245", "0.72059315", "0.72059315", "0.72059315", "0.72059315", "0.719647", "0.7193925", "0.7...
0.0
-1
a modifier that uses an internal identifier, so it is private
def remove(prep_id) @kb.delete_at(prep_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modifier; end", "def private=(_); end", "def modifier(member)\n\n\n\n # 357:5: ( PRIVATE | PUBLIC | PROTECTED | STATIC | ABSTRACT | FINAL | NATIVE | SYNCHRONIZED | TRANSIENT | VOLATILE | STRICTFP )*\n # 357:5: ( PRIVATE | PUBLIC | PROTECTED | STATIC | ABSTRACT | FINAL | NATIVE | SYNCHRONIZED ...
[ "0.7698321", "0.67642546", "0.66385704", "0.6516947", "0.650884", "0.64818573", "0.64492565", "0.6448046", "0.63793576", "0.6345228", "0.6258631", "0.6258631", "0.6199132", "0.61429554", "0.6129914", "0.6115473", "0.60738283", "0.60573876", "0.6055713", "0.60252565", "0.60214...
0.0
-1
turns the propositions to CNF(if needed)
def toCNF end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cnf\n r = []\n @table.each {|inputs, output|\n return output.to_s if inputs.empty?\n next if output\n term = []\n each_input(inputs) {|name, input|\n if input\n term << \"!#{name}\"\n else\n term << name\n end\n }\n if term.length == 1\...
[ "0.57956314", "0.54493576", "0.5425205", "0.5412952", "0.5344363", "0.52897114", "0.5277667", "0.5216268", "0.5154754", "0.5138244", "0.5109283", "0.5085626", "0.50761646", "0.5060717", "0.5031964", "0.5017147", "0.49444252", "0.49179173", "0.4911493", "0.48964894", "0.487549...
0.60784334
0
public wrapper for the various satisfiability solvers and techniques
def isSatisfiable?() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve\n end", "def solve!\n end", "def hook_solution?(a); end", "def solver_for(_actuals, ctx)\n # Important: every `solver_for` call will result in a distinct Context.\n DuckFiber.new(-> { ctx.succeeded! })\n end", "def solve\n BruteForceSolver.new(self).solve\n end", "d...
[ "0.66706353", "0.66283953", "0.6239612", "0.60651714", "0.60209996", "0.594654", "0.58924836", "0.5852371", "0.5849326", "0.5737718", "0.57127976", "0.5696004", "0.56845933", "0.5649134", "0.5628463", "0.5624024", "0.5589592", "0.5544175", "0.55179447", "0.55131024", "0.55130...
0.5087591
62
edit to make it recalculate the heuristic? or slower...
def dpll #need to count degree, best_guess, assignments and such heuristic stuff somewhere... makes sense to do it here #should make a version without heuristics aswell ##############################################3 # puts "the kb : " + @kb.to_s @kb.each do |sente| ##########################################################333 # puts " the sentences: " + sente.to_s if(sente.size==1) index=sente[0] if(index > 0) @id_array[index-1].pos_increment @id_array[index-1].puret=true else index*=-1 @id_array[index-1].neg_increment @id_array[index-1].puref = true end else sente.each do |atome| ############################################################# # puts "the individual atoms: " + atome.to_s if(atome > 0) index = atome-1 @id_array[index].pos_increment else index = -1*atome-1 @id_array[index].neg_increment end end end end @id_array.each do |var| if(!var.assignment_intialize) return false end end #intialization stuff ##########heuristic sort! var_list = @id_array var_list.sort! depth=0 assignment = Array.new satisfiable = false stack = [] #make parallel array assignment id_array.map { assignment << 0} #insert root (var_list[depth].assignments).map do |child| stack.push(Assign_Stack_Object.new(child,depth)) end #start depth-first search while(stack.size()>0) temp = stack.pop #comparing depth to make sure assignment variables reassigned if popping up the tree while(depth>temp.depth) assignment[depth] = 0 depth -=1 end #add it to the assignment evaluation list (depth doubles as index through var_list) assignment[var_list[temp.depth].id - 1] = temp.value #Evaluate the assignment list if(satisfiable_assignment?(assignment)==1) ##########################################################################333 puts "the kb is: " + @kb.to_s puts "the assignment that evaluates to true: " puts assignment.to_s ############################################################################# return true end #add children depth+=1 #if not bottumed out, add more children based on values from the var if(depth<var_list.size()) (var_list[depth].assignments).map do |child| stack.push(Assign_Stack_Object.new(child,depth)) end else #reset to bottom value depth =var_list.size-1 end end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heuristic(current:, target:)\n d = (current[0].real - target[0].real).abs + (current[0].imag - target[0].imag).abs\n d += 7 if d <= 8 && current[1] != target[1]\n\n d\nend", "def heuristic_score\n 0\n end", "def heuristic(map, there, here)\n there_val = map.at(*there)\n here_val = map.at(*here...
[ "0.7292886", "0.7058845", "0.6743463", "0.6661915", "0.66364956", "0.6624951", "0.6314571", "0.6269569", "0.6204419", "0.61874884", "0.6128044", "0.608693", "0.60858166", "0.6062857", "0.60444415", "0.6017084", "0.6012665", "0.5989448", "0.59759694", "0.5963527", "0.5963407",...
0.0
-1
the way this is designed, it short circuts. so sometimes when it should say false it will say indeterminant for the whole knowledgebase returns false, true, or indetermninant as 1,1,0 (in current encoding) alike with the assignment list and literal class assignment must be parallel array to id nums (may want to use hashes instead)
def satisfiable_assignment?(assignment) sentence_eval = 1 index = 0 while(sentence_eval == 1 && index < @kb.size) sentence_eval = 0 all_false = true ##############################################3 # puts "kb is: " + @kb.to_s # puts "the assignments are : " + assignment.to_s @kb[index].each do |id| ################################################33 # puts " the atom to check : " + id.to_s temp_id = id if(temp_id >0) assign = assignment[temp_id - 1] ################################################### # puts "the atom is : " + id.to_s # puts "the variable is assigned to: " + assignment[temp_id-1].to_s # puts "which evaluates to: " + assign.to_s else assign = assignment[temp_id*-1 -1].to_i * -1 ################################################### # puts "the atom is : " + id.to_s # puts "the variable is assigned to: " + (assignment[temp_id*-1 - 1] - 1).to_s # puts "which evaluates to: " + assign.to_s end if(assign==1) sentence_eval = 1 all_false = false break elsif(assign == 0) all_false = false end end if(all_false) sentence_eval = -1 end index+=1 end return sentence_eval end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assignment_intialize\n\t\tif(@puret and @puref)\n\t\t\treturn false\n\t\tend\n\t\tif(@num_negative == 0 or @puret)\n\t\t\t@assignments = [1]\n\t\telsif(@num_positive == 0 or @puref)\n\t\t\t@assignments = [-1]\n\t\telsif(@best_guess <0)\n\t\t\t@assignments = [-1,1]\n\t\telse\n\t\t\t@assignments = [1,-1]\n\t\ten...
[ "0.6625051", "0.6095803", "0.5790214", "0.56934625", "0.56818473", "0.55996346", "0.55899537", "0.5428367", "0.5428367", "0.5428367", "0.5427513", "0.53843915", "0.5354882", "0.5267769", "0.5261744", "0.52563506", "0.52499795", "0.5246493", "0.5193265", "0.5193265", "0.517964...
0.631583
1
Gets the operating system
def os app = app_with_comments return app.comment[0] if app && app.comment[0] app = detect_product(DARWIN) [IOS, OperatingSystems::Darwin::IOS[app.version.to_s]].compact.join(' ') if app end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def os\n return `uname -s`.chomp\n end", "def get_os_name\n\t\t\t\treturn SystemDetector.get_os_name\n\t\t\tend", "def get_os\n line = Cocaine::CommandLine.new('uname')\n output = line.run\n\n output.chomp.downcase.intern\n end", "def os\n os_parser.os\n end", "def osv...
[ "0.8720404", "0.82192767", "0.8136886", "0.8127003", "0.8118536", "0.8097448", "0.80247927", "0.7985938", "0.7979931", "0.79103154", "0.79080313", "0.7896797", "0.7837198", "0.7825617", "0.7769707", "0.7754323", "0.7751218", "0.77491677", "0.7665985", "0.76521593", "0.7652159...
0.72384113
53
Public Create file start cookbook String cookbook name Returns nil
def create tmpl = ERB.new(load_erb_file('metadata.erb')) @cookbook = @opts[:cookbook] @maintainer = @opts[:souschef][:maintainer] @maintainer_email = @opts[:souschef][:maintainer_email] @license = @opts[:souschef][:license] data = tmpl.result(binding) info 'Updating metadata.rb' write_file(cookbook_file_path('metadata.rb'), data) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_file(filename)\n cookbook_file '/var/opt/dynatrace-managed/sources/' + filename do\n source '' + filename\n owner node['dynatrace-quickstart-gcp']['user']\n group node['dynatrace-quickstart-gcp']['user']\n mode '644'\n action :create\n end\nend", "def build_cookbo...
[ "0.69162536", "0.6542696", "0.6535739", "0.64973015", "0.6352324", "0.6298342", "0.6279494", "0.6213824", "0.6194064", "0.60995734", "0.6022786", "0.60210294", "0.596972", "0.5944844", "0.5932327", "0.5911238", "0.5911039", "0.5854371", "0.5838811", "0.575114", "0.570897", ...
0.61204183
9
Create a function with two arguments that will return a list of length (n) with multiples of (x). Assume both the given number and the number of times to count will be positive numbers greater than 0. Return the results as an array (or list in Python or Haskell.) Examples: count_by(1,10) should return [1,2,3,4,5,6,7,8,9,10] count_by(2,5) should return [2,4,6,8,10]
def count_by(x, n) a=[] y=0 n.times {y+=x; a<<y} a end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_by(x, n)\n (1..n).map{|i| i*x}\nend", "def counts(n)\n divisors = Array.new\n (1..n).each do |n|\n single_divisors = count n\n divisors.push(single_divisors)\n end\n divisors\n end", "def multiples_of( x, xmax )\n ct = x\n nums = []\n while ct <= xmax\n nums << ct\n c...
[ "0.8004699", "0.70162845", "0.6892011", "0.68776846", "0.6769908", "0.67528325", "0.6590494", "0.6569084", "0.65532243", "0.6551252", "0.65417355", "0.64793026", "0.6461403", "0.64416224", "0.6372089", "0.6347995", "0.6330729", "0.63219327", "0.6292802", "0.6268252", "0.62589...
0.7754079
1
GET /tipocuenta GET /tipocuenta.json
def index @tipocuenta = Tipocuentum.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @tipocliente = Tipocliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @tipocliente }\n end\n end", "def show\n @tip_so = TipSo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n ...
[ "0.70758057", "0.6861703", "0.6858581", "0.6765908", "0.6765908", "0.66960454", "0.6654463", "0.6627065", "0.6605445", "0.6594997", "0.6522421", "0.6487479", "0.648541", "0.64729357", "0.64467347", "0.6401073", "0.63894105", "0.63742113", "0.6358471", "0.63532233", "0.6353223...
0.6875919
1
GET /tipocuenta/1 GET /tipocuenta/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @tipocliente = Tipocliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @tipocliente }\n end\n end", "def show\n @tip_so = TipSo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n ...
[ "0.7264182", "0.71376866", "0.7094846", "0.70151764", "0.68708414", "0.68690723", "0.68690723", "0.68183523", "0.6795829", "0.6777179", "0.6712439", "0.67072284", "0.6665166", "0.6611626", "0.6582963", "0.6549734", "0.6534824", "0.65198547", "0.65116423", "0.64699715", "0.646...
0.0
-1
POST /tipocuenta POST /tipocuenta.json
def create @tipocuentum = Tipocuentum.new(tipocuentum_params) respond_to do |format| if @tipocuentum.save format.html { redirect_to @tipocuentum, notice: 'Tipocuentum was successfully created.' } format.json { render :show, status: :created, location: @tipocuentum } else format.html { render :new } format.json { render json: @tipocuentum.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @tipos_contato = TiposContato.new(tipos_contato_params)\n\n respond_to do |format|\n if @tipos_contato.save\n format.html { redirect_to @tipos_contato, notice: 'Tipos contato was successfully created.' }\n format.json { render :show, status: :created, location: @tipos_contato ...
[ "0.7226958", "0.7016861", "0.69697654", "0.6966347", "0.6885372", "0.68441194", "0.6790598", "0.67653495", "0.6759658", "0.6750996", "0.6744425", "0.67255884", "0.6723875", "0.67209226", "0.66504896", "0.66443026", "0.6604963", "0.65778124", "0.65702933", "0.6559782", "0.6557...
0.6943472
4
PATCH/PUT /tipocuenta/1 PATCH/PUT /tipocuenta/1.json
def update respond_to do |format| if @tipocuentum.update(tipocuentum_params) format.html { redirect_to @tipocuentum, notice: 'Tipocuentum was successfully updated.' } format.json { render :show, status: :ok, location: @tipocuentum } else format.html { render :edit } format.json { render json: @tipocuentum.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @tipos_contato.update(tipos_contato_params)\n format.html { redirect_to @tipos_contato, notice: 'Tipos contato was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipos_contato }\n else\n format.html { render ...
[ "0.7096629", "0.69910496", "0.6948625", "0.68949896", "0.6883719", "0.6840661", "0.67996186", "0.6739658", "0.6681233", "0.6657945", "0.6625662", "0.661959", "0.65987736", "0.659808", "0.65840715", "0.6574071", "0.6560793", "0.65463454", "0.65428406", "0.65234953", "0.6511084...
0.6584238
14
DELETE /tipocuenta/1 DELETE /tipocuenta/1.json
def destroy @tipocuentum.destroy respond_to do |format| format.html { redirect_to tipocuenta_url, notice: 'Tipocuentum was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @tipoveiculo.destroy\n respond_to do |format|\n format.html { redirect_to tipoveiculos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipocliente = Tipocliente.find(params[:id])\n @tipocliente.destroy\n\n respond_to do |format|\n format.html...
[ "0.74846035", "0.7438317", "0.7416803", "0.73901147", "0.73758835", "0.7353602", "0.7284259", "0.72161543", "0.7206195", "0.7172122", "0.7170672", "0.7169681", "0.7169681", "0.7169681", "0.7168835", "0.7161455", "0.71610135", "0.71517104", "0.714395", "0.714276", "0.7141049",...
0.73677945
5
Use callbacks to share common setup or constraints between actions.
def set_tipocuentum @tipocuentum = Tipocuentum.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.6165094", "0.60450804", "0.5944413", "0.5915806", "0.58885634", "0.5835225", "0.5775847", "0.5700531", "0.5700531", "0.56543404", "0.56209993", "0.54238355", "0.5410386", "0.5410386", "0.5410386", "0.5394892", "0.5377769", "0.53559244", "0.5339896", "0.53388095", "0.533008...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def tipocuentum_params params.require(:tipocuentum).permit(:nombretipocuenta, :fechaingresotipocuenta) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
A customize uploads path for ActiveStorage GET /uplaods/:id?s= send file Reference implementation
def show send_file_by_disk_key @blob, content_type: @blob.content_type rescue ActionController::MissingFile, ActiveStorage::FileNotFoundError head :not_found rescue ActiveStorage::IntegrityError head :unprocessable_entity end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_file_url\n \"file://#{upload_full_path}\"\n end", "def path\n \"/#{UPLOAD_DIR}/#{filename}\"\n end", "def uploaded_file_path\n FileServices::Uploader.perform(@file, upload_path)\n end", "def file_path\n storage.file_path(self.class, @id)\n end", "def photo_path\n\"/photo_...
[ "0.69769955", "0.6915078", "0.6832691", "0.66786593", "0.6669179", "0.6657174", "0.65731835", "0.6566756", "0.65632176", "0.65505815", "0.6512887", "0.6466021", "0.6436854", "0.6435343", "0.6419599", "0.63772887", "0.63717026", "0.63077205", "0.6276352", "0.62615764", "0.6261...
0.0
-1
maybe admin user from session or clientapi user from params[:user_id]
def get_user_name(user_id) if self.is_api then user = begin HuiMain.plugin_data.find_one("_id" => BSON::ObjectId(user_id)) rescue BSON::InvalidObjectId nil end if user then user["name"] else nil end else # not api session[:current_user_name] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def admin_user\n if session[:user_id] and session[:position]\n @admin_user = AdminUser.find_by_id(session[:user_id])\n end\n end", "def correct_or_admin_user\n @user = User.find(params[:id]) \n unless current_user?(@user) || admin_user?\n redirect_to(login_url)\n end\n end", ...
[ "0.735896", "0.7357242", "0.73302084", "0.7321911", "0.7316402", "0.7281784", "0.71649903", "0.71170217", "0.7105338", "0.708646", "0.70781726", "0.70715773", "0.70343584", "0.70318", "0.70238256", "0.70221776", "0.7012857", "0.6992297", "0.6989097", "0.6975193", "0.6963761",...
0.0
-1
Calls mattermost using the default Mattermost URL from the configuration data is a hash containing the data to send. Note that channel, username, and icon_url are reserved url is the Mattermost URL defined above. This can be overridden for debugging header is the default headers. This shouldn't need modified, but it's nice to have
def call_mattermost (data = {}, url = [Config['Mattermost']['url'], 'hooks', Config['Mattermost']['webhook_code']].join('/'), header = {content_type: :json, accept: :json}) if !data.has_key?(:login_id) payload = data.merge(Config['DefaultPayload']) else payload = data end # Just in case, though we may not need text unless payload.has_key?(:text) or payload.has_key?(:attachments) payload['text'] = 'This was triggered on: ' + Time.now.strftime("%d/%m/%Y %H:%M") #Feel free to change this end response = RestClient.post url, payload.to_json, {content_type: :json, accept: :json} return response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push_data(push_params)\n # Push URI\n push_uri = URI.parse(\"#{$tipboard_base_uri}/#{$apikey}/push\")\n\n # Post to API to set up tile\n push_response = Net::HTTP.post_form(push_uri, push_params)\nend", "def send_message(mes,token,user_id)\n #Open a direct message\n options = {\n token: toke...
[ "0.5465588", "0.542814", "0.53797555", "0.53797555", "0.53348374", "0.51957387", "0.49491575", "0.48877075", "0.4883532", "0.48634773", "0.4846544", "0.48428428", "0.48361412", "0.48356918", "0.48224252", "0.4820484", "0.48077616", "0.47950903", "0.4787078", "0.47738805", "0....
0.72075117
0
upload_file moves the file to the webserver from the config file filename: The full path of the image file video_filename: Used to generate a unique MD5 hash for each image file
def upload_file (filename, video_filename) # new filename is the md5 of the old filename, plus "jpg" new_filename = Digest::MD5.hexdigest video_filename new_filename += '.jpg' FileUtils.mv(filename, [Config['WebServer']['webroot'], Config['WebServer']['preview_dir'], new_filename].join('/')) return [Config['WebServer']['url'], Config['WebServer']['preview_dir'], new_filename].join('/') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload(file)\n logger.info 'Downloading video...'\n path = file.download.path\n movie = FFMPEG::Movie.new(path)\n @mp4_path = encode('mp4', movie, '-vcodec libx264 -strict -2')\n @webm_path = encode('webm', movie, '-vcodec libvpx -acodec libvorbis -f webm -deadline realtime -s 640x480'...
[ "0.70270765", "0.6648143", "0.6634276", "0.65686625", "0.63425255", "0.6336181", "0.631758", "0.62717307", "0.6266716", "0.61908865", "0.61814225", "0.61228365", "0.6119716", "0.6118708", "0.6082119", "0.60702676", "0.60483265", "0.60462517", "0.60237974", "0.59999603", "0.59...
0.8131492
0
Generates previews for each movie file in the transcode directory filename: The full path of the video file to output options: allows you to pass the following values for configuration. If not set they'll be pulled from your config framegrab_grid: (string) Something like '5x6' or '2x4' to specify the size of the grid framegrab_interval: (integer) The interval at which to grab frames in seconds. If set to zero it will determine it based on grid size and duration framegrab_height: (integer) The height of the generated frames in pixels.
def generate_previews(filename, options = {}) framegrab_grid = options['framegrab_grid'] || Config['PreviewSettings']['default_grid'] framegrab_interval = options['framegrab_interval'] || Config['PreviewSettings']['default_interval'] framegrab_height = options['framegrab_height'] || Config['PreviewSettings']['default_height'] base_filename = File.basename(filename) filesize = File.size(filename) file_info = Mediainfo.new filename if framegrab_interval.to_i == 0 total_images = 1 framegrab_grid.split('x').each do |x| total_images *= x.to_i end framegrab_interval = file_info.duration / total_images end count = 0 units = ['bytes', 'KB', 'MB', 'GB', 'TB'] loop do break if filesize < 1024.0 count += 1 filesize /= 1024.0 end pretty_filesize = filesize.round(2).to_s + ' ' + units[count] duration = file_info.duration remainder = 0 count = 0 units = ['sec','min','h'] loop do break if duration < 60 count += 1 remainder = duration % 60 duration /= 60 end pretty_duration = duration.round(0).to_s + ' ' + units[count] if remainder > 0 pretty_duration += ' ' + remainder.round(0).to_s + ' ' + units[count-1] end command = "ffmpeg -loglevel panic -y -i \"#{filename}\" -frames 1 -q:v 1 -vf \"select='isnan(prev_selected_t)+gte(t-prev_selected_t\," + framegrab_interval.to_s + ")',scale=-1:" + framegrab_height.to_s + ",tile=" + framegrab_grid + "\" '/tmp/video_preview.jpg'" # puts command if system(command) # # Now that the preview is generated, post it to Mattermost if !(uploaded_file_url = upload_file('/tmp/video_preview.jpg', base_filename)) call_mattermost({:text => "We ran into a problem uploading the file. Have someone look at this!"}) else message = "![#{base_filename}](#{uploaded_file_url})\n\n" message+= "|#{base_filename}|[(preview)](#{uploaded_file_url})|\n" message+= "|-|-:|\n" message+= "|File Size| **#{pretty_filesize}**|\n" message+= "|Duration| **#{pretty_duration}**|\n" message+= "|Format| **#{file_info.format}**|" actions = Config['FileOperations'] attachments_actions = [] actions.keys.each do |key| action_hash = { 'name': key, 'integration': { 'url': [Config['Webhook']['url'], 'run-command'].join('/'), 'context': { 'command': key, 'filename': File.realpath(filename) } } } attachments_actions.push(action_hash) end attachments = [ { "text": message, "actions": attachments_actions }] payload = {:attachments => attachments} call_mattermost(payload) end else Log.error "There was an error running the command: #{command}" call_mattermost({:text => "### DANGER WILL ROBINSON\nERROR"}) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_compilation\n puts \"Generating compilation\"\n get_selected_vines\n pathArray = [];\n @selected_vines.each do |vid|\n vine = Vine.find(vid)\n pathArray.push vine.path\n end\n if pathArray.count > 0\n return outputFile = execut...
[ "0.60002273", "0.58840054", "0.58810204", "0.57090247", "0.5693331", "0.5655191", "0.5628516", "0.56282556", "0.5576697", "0.5517942", "0.54917055", "0.5438951", "0.54197395", "0.54037774", "0.5365946", "0.5324334", "0.52558136", "0.52532005", "0.5248448", "0.5240166", "0.521...
0.80225223
0
Runs the command defined in the config file input_filename: The full path of the file you want to run the command on file_operation: One of the defined file operations in the config file
def run_command(input_filename, file_operation) Log.info "Inside run_command" if !Config['FileOperations'].key?(file_operation) return "#{file_operation} isn't a valid preset" end transcode_settings = Config['FileOperations'][file_operation] Log.info transcode_settings.to_s begin if !transcode_settings.key?('command') return "#{file_operation} doesn't have a command" end command_template = transcode_settings['command'] filename = File.basename(input_filename) base_filename = File.basename(input_filename, File.extname(input_filename)) if transcode_settings.key?('location') output_filename = [transcode_settings['location'], base_filename].join('/') else output_filename = [Config['WebServer']['webroot'], Config['WebServer']['transcode_dir'], base_filename].join('/') end command = command_template % {input_filename:input_filename, output_filename: output_filename} Log.info command # Update the channel to let them know what's happening call_mattermost({:text => "Running command #{file_operation} on file #{filename}"}) if system(command) if transcode_settings.key?('text') output_text = transcode_settings['text'] % {input_filename:input_filename, output_filename: output_filename} else output_text = "Finished running command #{file_operation} on file #{filename}" end call_mattermost({:text => output_text}) else call_mattermost({:text => "ERROR: Could not run command #{file_operation} on file #{filename}"}) end rescue Exception => e Log.error e.to_s return 'There was an error' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_file( filename )\n text = File.read(filename)\n execute(text)\n end", "def run(filename, options) end", "def run(config_file)\n load_options_from_file(config_file)\n check_options\n output = %x[ #{@binary} #{config_file} ]\n output\n end", "def run_file(filename, pre...
[ "0.6529169", "0.6030414", "0.5856169", "0.5741992", "0.5705901", "0.5705548", "0.56950265", "0.55987614", "0.558795", "0.5523257", "0.54516935", "0.5441318", "0.53969586", "0.5386397", "0.53860337", "0.5376245", "0.53733194", "0.53602606", "0.5351467", "0.5345632", "0.5338001...
0.73074967
0
The position of the data dictionary header within the page.
def pos_data_dictionary_header pos_page_body end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pos_header\n @position - 2\n end", "def header_position\n C.archive_read_header_position archive\n end", "def pos_index_header\n pos_page_body\n end", "def offset\n fil_header[:offset]\n end", "def local_header_offset; end", "def pos_partial_page_header\n pos_fil_header...
[ "0.77962977", "0.7534069", "0.71625656", "0.69582975", "0.69355947", "0.6839482", "0.659235", "0.6557365", "0.6500078", "0.64648426", "0.6379584", "0.6372833", "0.6348647", "0.6330062", "0.62297636", "0.62297636", "0.61918914", "0.61702305", "0.61660814", "0.6159254", "0.6136...
0.80084866
0
The size of the data dictionary header.
def size_data_dictionary_header ((8 * 3) + (4 * 7) + 4 + Innodb::FsegEntry::SIZE) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def header_size\n TYPE_SIZE\n end", "def d_size\n uint64(header, 'size') / @blockSize\n end", "def size\n @data ? @data.size : header.sh_size\n end", "def header_size\n 12\n end", "def size\n self.data.keys.size\n end", "def size\n @data.bytesize\n ...
[ "0.8326364", "0.8231278", "0.821332", "0.7950296", "0.7906167", "0.7841435", "0.77830505", "0.77472657", "0.7738898", "0.77322656", "0.772482", "0.772482", "0.7649034", "0.7637968", "0.7603028", "0.7592744", "0.7592744", "0.7592744", "0.75760883", "0.7490768", "0.7485302", ...
0.87241167
0
Parse the data dictionary header from the page.
def data_dictionary_header cursor(pos_data_dictionary_header).name("data_dictionary_header") do |c| Header.new( max_row_id: c.name("max_row_id") { c.read_uint64 }, max_table_id: c.name("max_table_id") { c.read_uint64 }, max_index_id: c.name("max_index_id") { c.read_uint64 }, max_space_id: c.name("max_space_id") { c.read_uint32 }, unused_mix_id_low: c.name("unused_mix_id_low") { c.read_uint32 }, indexes: c.name("indexes") do { SYS_TABLES: c.name("SYS_TABLES") do { PRIMARY: c.name("PRIMARY") { c.read_uint32 }, ID: c.name("ID") { c.read_uint32 }, } end, SYS_COLUMNS: c.name("SYS_COLUMNS") do { PRIMARY: c.name("PRIMARY") { c.read_uint32 }, } end, SYS_INDEXES: c.name("SYS_INDEXES") do { PRIMARY: c.name("PRIMARY") { c.read_uint32 }, } end, SYS_FIELDS: c.name("SYS_FIELDS") do { PRIMARY: c.name("PRIMARY") { c.read_uint32 }, } end, } end, unused_space: c.name("unused_space") { c.read_bytes(4) }, fseg: c.name("fseg") { Innodb::FsegEntry.get_inode(@space, c) } ) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse\n read_header\n parse_text_segment\n parse_data_segment\n @data = nil\n end", "def parse_header_contents; end", "def pos_data_dictionary_header\n pos_page_body\n end", "def read_headers(page_content)\n format = page_content.split(\"---\")\n if format.size > ...
[ "0.6742138", "0.6672907", "0.6566992", "0.6279731", "0.616502", "0.6050409", "0.6028795", "0.6001625", "0.6000103", "0.5929474", "0.5910416", "0.5905324", "0.5901847", "0.5871764", "0.58646333", "0.5839426", "0.57999176", "0.5737371", "0.57308865", "0.57233626", "0.5701291", ...
0.6072086
5
Must redefine this because anonymous objects can't be passed in/out/through Rubyspace.
def create(parents = nil, *args) case parents when Array parents = '{' + parents.map { |p| obj_ref(p) }.join(', ') + '}' else parents = obj_ref(parents) end p = rand(36**5).to_s(36) unless args.empty? args = args.map { |a| value_ref(a) }.join(', ') simplify(command(%Q|; add_property(#{@obj}, "_#{p}", create(#{parents}, #{args}), {player, "rw"}); return "#{@obj}._#{p}";|)) else simplify(command(%Q|; add_property(#{@obj}, "_#{p}", create(#{parents}), {player, "rw"}); return "#{@obj}._#{p}";|)) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def anonymous?; end", "def object=(_arg0); end", "def object=(_arg0); end", "def object=(_arg0); end", "def object=(_arg0); end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def ob...
[ "0.6694541", "0.6332925", "0.6332925", "0.6332925", "0.6332925", "0.6280461", "0.6280461", "0.6280461", "0.6280461", "0.6280461", "0.6280461", "0.6280461", "0.6280461", "0.6280461", "0.6280461", "0.6280461", "0.6280461", "0.6280461", "0.6280461", "0.6280461", "0.6115622", "...
0.0
-1
Must redefine this because anonymous objects can't be passed in/out/through Rubyspace.
def create(parents, *args) case parents when Array parents = '{' + parents.map { |p| obj_ref(p) }.join(', ') + '}' else parents = obj_ref(parents) end p = rand(36**5).to_s(36) owner = nil anon = nil unless args.empty? if args.length > 1 owner, anon = *args elsif args[0].kind_of? Numeric anon = args[0] else owner = args[0] end end if !owner.nil? and !anon.nil? simplify(command(%Q|; add_property(#{@obj}, "_#{p}", create(#{parents}, #{obj_ref(owner)}, #{value_ref(anon)}), {player, "rw"}); return "#{@obj}._#{p}";|)) elsif !owner.nil? simplify(command(%Q|; add_property(#{@obj}, "_#{p}", create(#{parents}, #{obj_ref(owner)}), {player, "rw"}); return "#{@obj}._#{p}";|)) elsif !anon.nil? simplify(command(%Q|; add_property(#{@obj}, "_#{p}", create(#{parents}, #{value_ref(anon)}), {player, "rw"}); return "#{@obj}._#{p}";|)) else simplify(command(%Q|; add_property(#{@obj}, "_#{p}", create(#{parents}), {player, "rw"}); return "#{@obj}._#{p}";|)) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def anonymous?; end", "def object=(_arg0); end", "def object=(_arg0); end", "def object=(_arg0); end", "def object=(_arg0); end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def ob...
[ "0.6695099", "0.6333414", "0.6333414", "0.6333414", "0.6333414", "0.62820977", "0.62820977", "0.62820977", "0.62820977", "0.62820977", "0.62820977", "0.62820977", "0.62820977", "0.62820977", "0.62820977", "0.62820977", "0.62820977", "0.62820977", "0.62820977", "0.62820977", "...
0.0
-1
only permanent objects can have descendants
def test_that_add_property_fails_if_the_property_is_already_defined_on_a_descendant run_test_as('programmer') do x = simplify(command(%Q|; return create($nothing);|)) o = simplify(command(%Q|; return create(#{x});|)) add_property(o, 'foobar', 0, ['player', 'rw']) assert_equal E_INVARG, add_property(x, 'foobar', 0, ['player', '']) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_children; end", "def descendants_affected\n descendants\n end", "def preserve_children?\n false\n end", "def weaker\n descendants\n end", "def descendants\n \t descendants = []\n \t self.children.each { |child|\n \t descendants += [child] if child.permitted?\n...
[ "0.6920546", "0.6594865", "0.64908755", "0.6391284", "0.6370211", "0.62835556", "0.61979485", "0.6151877", "0.611885", "0.61106884", "0.6100523", "0.6084722", "0.6084722", "0.6084722", "0.6084722", "0.6084722", "0.6084722", "0.6084722", "0.6084722", "0.6084722", "0.6084722", ...
0.0
-1
clear_property The implementation of `clear_property()' isn't perfectly consistent with the documentation in the standard server. Specifically, nonwizard, nonowners can't clear a property, even if the property is writable contrary to what the docs say. Stunt fixes this inconsistency.
def test_that_clear_property_works_on_objects SCENARIOS.each do |args| run_test_as('programmer') do o = simplify(command(%Q|; return create($nothing);|)) add_property(o, 'foobar', 123, ['player', '']) p = create(o, args[1]) set(p, 'foobar', 'hello') assert_equal 'hello', get(p, 'foobar') clear_property(p, 'foobar') assert_equal 123, get(p, 'foobar') end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @property_flush[:ensure] = :absent\n end", "def remove_property(key)\n end", "def delete_property field\n orientdb.delete_property self, field\n end", "def clear_properties\n Config::Collection.clear\n end", "def destroy\n @property_hash[:ensure] = :absent\n end", "de...
[ "0.7237162", "0.7028978", "0.695999", "0.6926202", "0.6877152", "0.6847569", "0.68424004", "0.6833207", "0.6806238", "0.67667216", "0.6766026", "0.66550577", "0.66394854", "0.6624302", "0.66190094", "0.66190094", "0.66190094", "0.6604665", "0.6556308", "0.6552142", "0.6547649...
0.6619399
14
JWT: No need to try and load session as there is none in an API request
def skip_session request.session_options[:skip] = true if token end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_jwt_auth\n #\n @jwt_auth ||= (defined? session and session[:jwt_auth]) ? JwtToken.where(id: session[:jwt_auth]).first : nil\n end", "def current_jwt_token\n @jwt_auth ||= session[:jwt_auth] ? JwtToken.where(id: session[:jwt_auth]).first : nil\n end", "def authenticate_user\n ...
[ "0.74579275", "0.7307346", "0.71927863", "0.7164475", "0.71471584", "0.7094833", "0.7042193", "0.697402", "0.69023854", "0.68554103", "0.684276", "0.68399924", "0.68379927", "0.67932177", "0.67723805", "0.6769199", "0.67633164", "0.6754452", "0.6754452", "0.6754452", "0.67451...
0.0
-1
JWT: overriding Knock's method to manually trigger Devise's auth. When there is no token we assume the request comes from the browser so has a session (potentially with warden key) attached. def authenticate_entity(entity_name) if token super(entity_name) else current_user end end
def set_current_user User.current = current_user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate_entity(entity_name)\n if token\n super(entity_name)\n else\n current_user\n end\n end", "def user_authentication!\n if params[:auth_token].present? or params[:token_authentication]== \"true\"\n #this is for api authentication and access\n authenticate_u...
[ "0.8261872", "0.7478975", "0.7437366", "0.72052616", "0.71870774", "0.71349186", "0.7121628", "0.7084537", "0.7070366", "0.7066863", "0.7056656", "0.7041128", "0.7021292", "0.7016089", "0.6996374", "0.6987947", "0.69855547", "0.6961307", "0.69611585", "0.69534427", "0.6942428...
0.0
-1
GET /krishes GET /krishes.json
def index @krishes = Krish.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @konyu_rireki = KonyuRireki.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @konyu_rireki }\n end\n end", "def show\n @heli_kit = HeliKit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n ...
[ "0.64235795", "0.6413217", "0.63505614", "0.63149554", "0.6259184", "0.61902434", "0.6148827", "0.61450493", "0.613017", "0.61261714", "0.6111282", "0.61100954", "0.602197", "0.59770715", "0.5976871", "0.5969935", "0.5937085", "0.5936833", "0.5933155", "0.5927539", "0.5918369...
0.72551185
0
GET /krishes/1 GET /krishes/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @krishes = Krish.all\n end", "def show\n @konyu_rireki = KonyuRireki.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @konyu_rireki }\n end\n end", "def show\n @koti = Koti.find(params[:id])\n\n respond_to do |form...
[ "0.6977528", "0.6757544", "0.6619993", "0.65624136", "0.6532964", "0.6509917", "0.64181507", "0.63769203", "0.6376468", "0.6366866", "0.6349936", "0.631369", "0.6307003", "0.63015926", "0.62812805", "0.62634414", "0.6252709", "0.62331706", "0.61636144", "0.6149472", "0.613101...
0.0
-1
POST /krishes POST /krishes.json
def create @krish = Krish.new(krish_params) respond_to do |format| if @krish.save format.html { redirect_to @krish, notice: 'Krish was successfully created.' } format.json { render action: 'show', status: :created, location: @krish } else format.html { render action: 'new' } format.json { render json: @krish.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @kraj = Kraj.new(params[:kraj])\n\n respond_to do |format|\n if @kraj.save\n format.html { redirect_to @kraj, notice: 'Kraj was successfully created.' }\n format.json { render json: @kraj, status: :created, location: @kraj }\n else\n format.html { render action: \"...
[ "0.5828118", "0.58169323", "0.57454354", "0.57131404", "0.5639105", "0.56224394", "0.56178004", "0.56003463", "0.5546556", "0.5528062", "0.550135", "0.5460965", "0.54601884", "0.54574925", "0.545331", "0.5448933", "0.54423964", "0.54073685", "0.53977144", "0.53930813", "0.539...
0.61175925
0
PATCH/PUT /krishes/1 PATCH/PUT /krishes/1.json
def update respond_to do |format| if @krish.update(krish_params) format.html { redirect_to @krish, notice: 'Krish was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @krish.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, head...
[ "0.6548498", "0.64746237", "0.64552885", "0.63674617", "0.6347726", "0.6305036", "0.6280305", "0.6232289", "0.61980367", "0.61739886", "0.6171244", "0.6136331", "0.6131918", "0.61314905", "0.61225253", "0.61162925", "0.61161566", "0.611597", "0.61154187", "0.60927117", "0.609...
0.63571364
4
DELETE /krishes/1 DELETE /krishes/1.json
def destroy @krish.destroy respond_to do |format| format.html { redirect_to krishes_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @kisalli = Kisalli.find_by_key(params[:id])\n @kisalli.destroy\n\n respond_to do |format|\n format.html { redirect_to kisallis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kid.destroy\n ...
[ "0.71626604", "0.6889966", "0.6877485", "0.68562984", "0.68514127", "0.68434036", "0.6829869", "0.68237877", "0.6818874", "0.67722005", "0.673912", "0.6737086", "0.67237496", "0.67152166", "0.670024", "0.66985", "0.6692994", "0.66918", "0.66726756", "0.6667808", "0.6665582", ...
0.7293339
0
Use callbacks to share common setup or constraints between actions.
def set_krish @krish = Krish.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def krish_params params.require(:krish).permit(:name, :location, :is_succes, :user_count, :employe_id, :user_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Join the room. Pass +true+ to join even if you've already joined.
def join(force = false) post 'join' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def join_room(id)\n @rooms.join id\n end", "def join\n @room = Room.find(params.require(:room_id))\n if @room&.add_user(current_user)\n success\n else\n not_found\n end\n end", "def join_room uri\n has_room = rooms.detect { |room| room.uri == uri }\n\n ...
[ "0.726165", "0.72291356", "0.695971", "0.6733938", "0.6693268", "0.6648598", "0.6587703", "0.6547608", "0.652138", "0.6520944", "0.64728284", "0.64692616", "0.6468626", "0.64477855", "0.6415901", "0.6353932", "0.63050723", "0.624297", "0.62385523", "0.62344885", "0.621736", ...
0.70863837
2
Toggle guest access on or off
def toggle_guest_access raise NotImplementedError end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guest_access?\n guest_access == :can_join\n end", "def toggle_admin\n do_toggle_role :admin\n end", "def guest?\n false\n end", "def guest_access=(guest_access)\n client.api.set_room_guest_access(id, guest_access)\n tinycache_adapter.write(:guest_access, guest_access)\n ...
[ "0.6607076", "0.6488401", "0.6369919", "0.6237322", "0.62227607", "0.6190604", "0.61766887", "0.61213094", "0.61032784", "0.60904926", "0.6074536", "0.60504216", "0.60217774", "0.60018927", "0.59932137", "0.59780246", "0.5976769", "0.5957458", "0.59057647", "0.5886336", "0.58...
0.835637
0
Get the url for guest access
def guest_url if guest_access_enabled? "http://#{@campfire.subdomain}.campfirenow.com/#{guest_invite_code}" else nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guest_link\n return guest_hearing_link if guest_hearing_link.present?\n\n \"#{VirtualHearing.base_url}?join=1&media=&escalate=1&\" \\\n \"conference=#{formatted_alias_or_alias_with_host}&\" \\\n \"pin=#{guest_pin}&role=guest\"\n end", "def guest\n allow [:show]\n end", "def redirect_guest\...
[ "0.79203606", "0.63214844", "0.63024205", "0.61987704", "0.6108481", "0.6091542", "0.6039268", "0.603794", "0.6015924", "0.600454", "0.5999916", "0.5993426", "0.5954002", "0.5941162", "0.59177375", "0.5915073", "0.59030753", "0.58932114", "0.5879106", "0.58500963", "0.5849586...
0.7852773
1
The invite code use for guest
def guest_invite_code load @active_token_value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_invite_code\n self.invite_code = generate_token\n end", "def invitee_string\n\t\n\tend", "def ensure_invite_code!\n self.invite_code ||= \"thiscord.gg/\"+SecureRandom.uuid[0..5]\n end", "def invite\n \n end", "def invite_code\n\t\tres = {}\n\t\tuser = User.find_by_token(params[:to...
[ "0.76387304", "0.754709", "0.72436905", "0.72416025", "0.6952381", "0.6828545", "0.6672465", "0.6549126", "0.6514559", "0.64977175", "0.64647174", "0.64445704", "0.6424634", "0.6411214", "0.63947904", "0.6377739", "0.63747996", "0.63674206", "0.6337006", "0.6308173", "0.62807...
0.82367903
0
Change the name of the room
def name=(name) connection.post("/room/#{@id}.json", :body => { :room => { :name => name } }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name=(name)\n tinycache_adapter.write(:name, name)\n client.api.set_room_name(id, name)\n name\n end", "def set_room(room_name)\n @room = find_room_by_name(room_name)\n end", "def new_name(new_name)\n @name = new_name\n end", "def name\n name = \"Store Room\"\n end...
[ "0.74344593", "0.7372264", "0.6911815", "0.6841977", "0.68415135", "0.6718905", "0.66798884", "0.6624731", "0.659215", "0.6544838", "0.64946675", "0.6442982", "0.64412916", "0.64101684", "0.63888556", "0.63838935", "0.63838935", "0.63493305", "0.63428617", "0.63157773", "0.63...
0.7658218
0
Get the current topic
def topic load @topic end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def topic\n return @topic\n end", "def topic\n return @topic\n end", "def topic\n return @topic\n end", "def topic\n @topic ||= client.topic config.topic\n end", "def topic\n @topic.to_s\n end"...
[ "0.85295093", "0.84955055", "0.84955055", "0.81091905", "0.7965236", "0.76474184", "0.7608643", "0.753008", "0.7507351", "0.7482701", "0.74822533", "0.73460495", "0.72347134", "0.71954453", "0.7182757", "0.7182757", "0.7149849", "0.7147728", "0.7081121", "0.70697045", "0.6961...
0.80420315
4
Lock the room to prevent new users from entering and to disable logging
def lock post :lock end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lock_to!(user)\n update_columns(locked_at: Time.current, locked_by: user.id)\n end", "def lock!\n @locked = true\n end", "def lock!\n @locked = true\n end", "def lock!\n self.for_update!\n end", "def lock\n if unlocked_status == false\n raise ArgumentErro...
[ "0.6984339", "0.6885231", "0.6855805", "0.67850494", "0.6742901", "0.67141396", "0.6708558", "0.6683348", "0.66544193", "0.6623988", "0.6617628", "0.66113114", "0.65634686", "0.6557", "0.6520701", "0.64591056", "0.6440628", "0.64358276", "0.6420929", "0.6420359", "0.6416929",...
0.6719379
5
Post a new message to the chat room
def speak(message, options = {}) send_message(message) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_message(message)\n # https://api.slack.com/methods/chat.postMessage\n # scopes: chat:write\n slack_client.chat_postMessage(\n channel: channel_id,\n thread_ts: slack_ts,\n text: message\n )\n end", "def post_message(text)\n body ={\n \"title\" => @from_name,\n ...
[ "0.7684662", "0.7636147", "0.74436873", "0.73256916", "0.73184514", "0.72338104", "0.72219676", "0.7172414", "0.71667814", "0.7158852", "0.71453726", "0.71272147", "0.7111531", "0.71043724", "0.70873123", "0.7074597", "0.70507073", "0.70049435", "0.6998143", "0.6998143", "0.6...
0.0
-1
Get the list of users currently chatting for this room
def users reload! @users end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chat_room_users\n if params[:is_group_chat]\n User.where(id: params[:user_id]).to_a << current_user\n else\n [current_user, User.find(params[:user_id])]\n end\n end", "def index\n @chat_rooms = current_user.chat_rooms\n end", "def users\n\t\tusers = []\n\t\trooms.each do |room|\n\t\...
[ "0.78019845", "0.7359228", "0.7312027", "0.7122309", "0.70683384", "0.7065807", "0.6982438", "0.6870897", "0.6598247", "0.6559906", "0.6541818", "0.6541668", "0.65152454", "0.65036994", "0.650041", "0.6471033", "0.6458599", "0.6435318", "0.6400494", "0.6376361", "0.636624", ...
0.0
-1
Get the dates for the available transcripts for this room
def available_transcripts raise NotImplementedError end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve_transcripts_from_all_rooms_between(start_date, end_date)\n puts \"Retrieving transcripts from all rooms in #{@uri.to_s} between #{start_date.strftime(\"%m/%d/%Y\")} and #{end_date.strftime(\"%m/%d/%Y\")}.\".yellow\n preset_room = @room\n @rooms.each do |room|\n @room = room\n ...
[ "0.67828506", "0.6743189", "0.66180444", "0.6598498", "0.6519986", "0.6219939", "0.59861195", "0.5943454", "0.5906825", "0.5753567", "0.573729", "0.5631875", "0.56006277", "0.55877954", "0.55776006", "0.5541773", "0.5529693", "0.55120283", "0.54962283", "0.5421641", "0.541262...
0.51883656
41
Get the list of latest files for this room
def files(count = 5) connection.get(room_url_for(:uploads))['uploads'].map { |u| u['full_url'] } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recents\n files = session[:user].x_files.all(:last_update.gte => (DateTime.now - 20.days), folder: false, limit: 20)\n files_list = []\n files.each do |file|\n files_list.push(file.description(session[:user])) if file.folder || (!file.folder && file.uploaded)\n end\n @result = { files: file...
[ "0.6851216", "0.6728712", "0.66088516", "0.65985143", "0.644003", "0.6398718", "0.63614875", "0.63593876", "0.63276464", "0.6291387", "0.6159493", "0.61403316", "0.60882336", "0.60721946", "0.60476243", "0.60351056", "0.60285884", "0.6025172", "0.5956404", "0.5941372", "0.592...
0.55531055
73
GET /tuberculoses GET /tuberculoses.json
def index @tuberculoses = Tuberculose.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @tacks = Tack.all\n\n render json: @tacks\n end", "def retrieve_tubes\n show do\n title \"Retrieve tubes and spin down\"\n \n timer initial: { hours: 0, minutes: 15, seconds: 0}\n \n check \"After timer finishes, retrieve all #{operations.length} tubes f...
[ "0.61899436", "0.6043484", "0.5980227", "0.59198403", "0.59156847", "0.5898723", "0.5896654", "0.5896654", "0.5885377", "0.5875285", "0.58730227", "0.58651614", "0.5865042", "0.5772566", "0.5762172", "0.5761809", "0.5741422", "0.5711907", "0.56627285", "0.56610477", "0.565933...
0.70785415
0
GET /tuberculoses/1 GET /tuberculoses/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @tuberculoses = Tuberculose.all\n end", "def index\n @tacks = Tack.all\n\n render json: @tacks\n end", "def index\n @tunes = Tune.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tunes }\n end\n end", "def index\n @tenures...
[ "0.67937416", "0.61324847", "0.6050181", "0.60280186", "0.6016129", "0.5954204", "0.59041876", "0.58514225", "0.58225685", "0.5818246", "0.5806759", "0.58032036", "0.5796304", "0.5780724", "0.57646114", "0.57588583", "0.57577026", "0.57431394", "0.5719428", "0.5719428", "0.57...
0.0
-1
POST /tuberculoses POST /tuberculoses.json
def create @tuberculose = Tuberculose.new(tuberculose_params) begin @paciente = Paciente.find(params[:tuberculose][:paciente_id]) @paciente.form_laboratorio_id=8 @paciente.save rescue Exception => e end respond_to do |format| if @tuberculose.save format.html { redirect_to @tuberculose, notice: 'Tuberculose was successfully created.' } format.json { render :show, status: :created, location: @tuberculose } else format.html { render :new } format.json { render json: @tuberculose.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @tuberculoses = Tuberculose.all\n end", "def create\n @toyotum = Toyotum.new(toyotum_params)\n\n respond_to do |format|\n if @toyotum.save\n format.html { redirect_to @toyotum, notice: 'Toyotum was successfully created.' }\n format.json { render :show, status: :created, l...
[ "0.58030933", "0.5621041", "0.55557984", "0.5492082", "0.54913324", "0.5365434", "0.5353052", "0.53145224", "0.531164", "0.52605265", "0.52542317", "0.5251206", "0.52503914", "0.5242318", "0.52376175", "0.52367294", "0.52338463", "0.52282405", "0.5210136", "0.5202543", "0.516...
0.48252332
84
PATCH/PUT /tuberculoses/1 PATCH/PUT /tuberculoses/1.json
def update respond_to do |format| if @tuberculose.update(tuberculose_params) format.html { redirect_to @tuberculose, notice: 'Tuberculose was successfully updated.' } format.json { render :show, status: :ok, location: @tuberculose } else format.html { render :edit } format.json { render json: @tuberculose.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n respond_to do |format|\n if @toyotum.update(toyotum_params)\n format.html { redirect_to @toyotum, notice: 'Toyotum was successfully updated.' }\n format.json { render :show, sta...
[ "0.62342656", "0.6159337", "0.6017543", "0.5962537", "0.5906415", "0.58878356", "0.58550674", "0.58427715", "0.58356863", "0.58275104", "0.57966566", "0.5775827", "0.57754874", "0.5763261", "0.5750018", "0.5745397", "0.57427526", "0.5706849", "0.567954", "0.5678928", "0.56729...
0.60361046
2
DELETE /tuberculoses/1 DELETE /tuberculoses/1.json
def destroy @tuberculose.destroy respond_to do |format| format.html { redirect_to tuberculoses_url, notice: 'Tuberculose was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_respons...
[ "0.7034478", "0.6960446", "0.69082654", "0.6850429", "0.6813731", "0.6807011", "0.6773395", "0.6765198", "0.6764767", "0.6760868", "0.67534345", "0.67516494", "0.6729735", "0.6699983", "0.66778886", "0.6662065", "0.66490984", "0.6642172", "0.6641188", "0.66382045", "0.6622730...
0.6925316
2
Use callbacks to share common setup or constraints between actions.
def set_tuberculose @tuberculose = Tuberculose.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.6165094", "0.60450804", "0.5944413", "0.5915806", "0.58885634", "0.5835225", "0.5775847", "0.5700531", "0.5700531", "0.56543404", "0.56209993", "0.54238355", "0.5410386", "0.5410386", "0.5410386", "0.5394892", "0.5377769", "0.53559244", "0.5339896", "0.53388095", "0.533008...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def tuberculose_params params.require(:tuberculose).permit(:form_laboratorio_id, :paciente_id, :tipo_de_muestra, :razon, :string, :mendico, :centro_de_salud, :observaciones) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
GET /pharmas GET /pharmas.json
def index @pharmas = Pharma.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @phlog = Phlog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @phlog }\n end\n end", "def show\n @pharm = Pharm.find(params[:id])\n end", "def show\n\t\t@pharmacy = Pharmacy.find(params[:id])\n\n\t\trespond_to do |forma...
[ "0.6479799", "0.6422723", "0.6421849", "0.6397673", "0.63839346", "0.63242126", "0.62848365", "0.6218878", "0.6213666", "0.6208553", "0.62017393", "0.6198759", "0.61778975", "0.6164403", "0.616128", "0.6150613", "0.61449045", "0.6138376", "0.61362934", "0.6135968", "0.6135760...
0.68925804
0
GET /pharmas/1 GET /pharmas/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @phlog = Phlog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @phlog }\n end\n end", "def index\n @pharmas = Pharma.all\n end", "def show\n @pharm = Pharm.find(params[:id])\n end", "def show\n @presenza = Prese...
[ "0.6703745", "0.6700327", "0.6653632", "0.65828764", "0.65435284", "0.65236574", "0.6495796", "0.6471314", "0.64363825", "0.643502", "0.64038706", "0.64022493", "0.6388125", "0.6366552", "0.63664764", "0.6361207", "0.6347709", "0.6343804", "0.6333667", "0.632796", "0.6320854"...
0.0
-1
POST /pharmas POST /pharmas.json
def create @pharma = Pharma.new(pharma_params) respond_to do |format| if @pharma.save format.html { redirect_to @pharma, notice: 'Pharma was successfully created.' } format.json { render :show, status: :created, location: @pharma } else format.html { render :new } format.json { render json: @pharma.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @pharm = Pharm.new(pharm_params)\n @pharm.user_id = current_user.id\n\n respond_to do |format|\n if @pharm.save\n format.html { redirect_to @pharm, notice: 'Pharm was successfully created.' }\n format.json { render :show, status: :created, location: @pharm }\n else\n ...
[ "0.66720706", "0.66034615", "0.6332219", "0.61596787", "0.61153233", "0.5994991", "0.59933317", "0.5993134", "0.595828", "0.5924629", "0.5921499", "0.5913209", "0.5893331", "0.5881247", "0.58505136", "0.5849291", "0.5835567", "0.5826907", "0.5820701", "0.5779027", "0.577251",...
0.6895389
0
PATCH/PUT /pharmas/1 PATCH/PUT /pharmas/1.json
def update respond_to do |format| if @pharma.update(pharma_params) format.html { redirect_to @pharma, notice: 'Pharma was successfully updated.' } format.json { render :show, status: :ok, location: @pharma } else format.html { render :edit } format.json { render json: @pharma.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @pharm = Pharm.find(params[:id])\n respond_to do |format|\n if @pharm.update(pharm_params)\n format.html { redirect_to @pharm, notice: 'Pharm was successfully updated.' }\n format.json { render :show, status: :ok, location: @pharm }\n else\n format.html { render :e...
[ "0.6336532", "0.6231755", "0.6189727", "0.61738074", "0.61282563", "0.60966814", "0.6094203", "0.6090823", "0.6073731", "0.6050702", "0.60389566", "0.60285115", "0.6013566", "0.5987759", "0.594626", "0.5922043", "0.5915093", "0.5915093", "0.59119517", "0.59048057", "0.5882333...
0.62516516
1
DELETE /pharmas/1 DELETE /pharmas/1.json
def destroy @pharma.destroy respond_to do |format| format.html { redirect_to pharmas_url, notice: 'Pharma was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @pharm = Pharm.find(params[:id])\n @pharm.destroy\n respond_to do |format|\n format.html { redirect_to pharms_url, notice: 'Pharm was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pharmacy.destroy\n respond_to do |format|\n ...
[ "0.70930415", "0.7069602", "0.7018399", "0.6955611", "0.6899932", "0.6857838", "0.6847263", "0.68359846", "0.6833831", "0.6815114", "0.6804892", "0.67765373", "0.676942", "0.6760427", "0.67448163", "0.6741097", "0.67396224", "0.67310315", "0.6724449", "0.67188543", "0.6716296...
0.70656323
2
Use callbacks to share common setup or constraints between actions.
def set_pharma @pharma = Pharma.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def pharma_params params.require(:pharma).permit(:name, :hsopitalname) 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.6981537", "0.67835593", "0.6748275", "0.67436063", "0.6736311", "0.65937173", "0.6503359", "0.6498499", "0.6482832", "0.6478776", "0.645703", "0.6439998", "0.63802195", "0.6377008", "0.6366287", "0.632018", "0.63016284", "0.63011277", "0.62932974", "0.62919617", "0.6290564...
0.0
-1
GET /message_outs GET /message_outs.json
def index @message_outs = MessageOut.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @outmessages = Outmessage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @outmessages }\n end\n end", "def index\n if params[:workpoint_id]\n @outs = Workpoint.find(params[:workpoint_id]).outs\n else\n @outs = Out.all\...
[ "0.70113707", "0.63836396", "0.62472916", "0.6224572", "0.6138406", "0.6136233", "0.61274123", "0.6113622", "0.6110786", "0.60970414", "0.60852665", "0.60795325", "0.60603845", "0.60270935", "0.6025916", "0.60208464", "0.6019969", "0.6019969", "0.60160685", "0.6008911", "0.60...
0.7497711
0
GET /message_outs/1 GET /message_outs/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @message_outs = MessageOut.all\n end", "def index\n @outmessages = Outmessage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @outmessages }\n end\n end", "def new\n @outmessage = Outmessage.new\n\n respond_to do |format|\n...
[ "0.71900153", "0.6946622", "0.65348715", "0.6396523", "0.62391096", "0.62051475", "0.61953485", "0.61840504", "0.61580974", "0.6157837", "0.6157837", "0.613405", "0.61328566", "0.6126474", "0.6123998", "0.61012584", "0.6079397", "0.6049314", "0.5996184", "0.5989917", "0.59854...
0.0
-1