query
stringlengths
7
6.41k
document
stringlengths
12
28.8k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
5
10
document_rank
stringclasses
2 values
Merge `s` and `t` the brute force way (nonrecursive, no edgemerge)
def merge_states(glts, s, t) data = STATE_AGGREGATOR.merge(s.data, t.data) # reconnect `t`'s edges to s t.in_edges.each do |in_edge| source = (in_edge.source == t ? s : in_edge.source) glts.connect(source, s, in_edge.data) end t.out_edges.each do |out_edge| ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def growEqualityGraph(s_vertices, t_vertices, s_neighbors, s_neighbors_not_in_t) #weights, s_vertices, t_vertices, s_neighbors_not_in_t, s_neighbors)\n\t\t\n\t\t#update labels\n\t\t\n\t\t\n\t\tlabelUpdateVal = nil\n\t\t\n\t\t#We want to grow T in order to up the chance we can have a match\n\t\t\n\t\tunconnected_y_...
[ "0.5686777", "0.54360306", "0.53057736", "0.52859104", "0.5245384", "0.5243138", "0.52025", "0.5177024", "0.5161093", "0.5135283", "0.51323295", "0.50953436", "0.50946754", "0.50888425", "0.5086928", "0.5063346", "0.50549257", "0.5026138", "0.5018362", "0.50092363", "0.500242...
0.701275
0
GET /guest_books GET /guest_books.xml
def index @guest_books = GuestBook.find(:all, :order=>'created_at desc') respond_to do |format| format.html # index.html.erb format.xml { render :xml => @guest_books } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @guest_book = GuestBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @guest_book }\n end\n end", "def index\n @books = Book.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml...
[ "0.7130327", "0.68204415", "0.68204415", "0.6807553", "0.67116266", "0.6677689", "0.66416866", "0.65895504", "0.65624106", "0.65172786", "0.65131605", "0.65096414", "0.65096414", "0.65096414", "0.65096414", "0.65096414", "0.65096414", "0.65096414", "0.65096414", "0.6451227", ...
0.7318075
0
GET /guest_books/1 GET /guest_books/1.xml
def show @guest_book = GuestBook.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @guest_book } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @guest_books = GuestBook.find(:all, :order=>'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @guest_books }\n end\n end", "def index\n @books = Book.find(:all)\n\n respond_to do |format|\n format.html # index.ht...
[ "0.7145942", "0.67945766", "0.67945766", "0.66933763", "0.6691467", "0.6650903", "0.66507", "0.66507", "0.66507", "0.66507", "0.66507", "0.66507", "0.66507", "0.66507", "0.66215044", "0.6621058", "0.65922284", "0.65820754", "0.64961845", "0.649307", "0.6476968", "0.6428486"...
0.7091885
1
GET /guest_books/new GET /guest_books/new.xml
def new @guest_book = GuestBook.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @guest_book } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @book = Book.new :copies => 1\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end", "def new\n @book = Book.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n...
[ "0.7646644", "0.75112015", "0.74705714", "0.7469237", "0.7469237", "0.7469237", "0.7469237", "0.7469237", "0.7469237", "0.7469237", "0.7469237", "0.7461468", "0.7283416", "0.7281681", "0.7173729", "0.7120703", "0.7113117", "0.7088467", "0.7078703", "0.7078703", "0.70169955", ...
0.7656112
0
POST /guest_books POST /guest_books.xml
def create @guest_book = GuestBook.new(params[:guest_book]) respond_to do |format| if @guest_book.save flash[:notice] = 'Thank you for signing the guestbook' # format.html { redirect_to(@guest_book) } format.html { render :action => "created" } format.xml { render :xml =>...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @guest_book = GuestBook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @guest_book }\n end\n end", "def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <na...
[ "0.6128191", "0.5912338", "0.58980846", "0.5892739", "0.5871913", "0.5871913", "0.5859612", "0.5838711", "0.5838711", "0.5838711", "0.57950014", "0.57874006", "0.57766145", "0.57479924", "0.572443", "0.57202256", "0.56504256", "0.56315106", "0.562869", "0.5608863", "0.560264"...
0.5929783
1
PUT /guest_books/1 PUT /guest_books/1.xml
def update @guest_book = GuestBook.find(params[:id]) respond_to do |format| if @guest_book.update_attributes(params[:guest_book]) flash[:notice] = 'GuestBook was successfully updated.' format.html { redirect_to(@guest_book) } format.xml { head :ok } else format.html...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n #expire_page :controller => 'guestbook', :action => 'index'\n @guestbook = Guestbook.find(params[:id])\n\n respond_to do |format|\n if @guestbook.update_attributes(params[:guestbook])\n flash[:notice] = 'Guestbook was successfully updated.'\n format.html { redirect_to admin...
[ "0.6542057", "0.6459722", "0.6334024", "0.62971467", "0.6255734", "0.6221573", "0.620879", "0.620879", "0.620879", "0.620879", "0.620857", "0.61897933", "0.61847293", "0.61847293", "0.61847293", "0.61836815", "0.615289", "0.6137634", "0.6111244", "0.6051023", "0.6038135", "...
0.68086034
0
DELETE /guest_books/1 DELETE /guest_books/1.xml
def destroy @guest_book = GuestBook.find(params[:id]) @guest_book.destroy respond_to do |format| format.html { redirect_to(guest_books_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n #expire_page :controller => 'guestbook', :action => 'index'\n @guestbook = Guestbook.find(params[:id])\n @guestbook.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_guestbooks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @book = Boo...
[ "0.69296926", "0.68356967", "0.6834604", "0.679162", "0.679162", "0.679162", "0.679162", "0.679162", "0.679162", "0.679162", "0.679162", "0.679162", "0.679162", "0.67577416", "0.67310137", "0.6678191", "0.66632473", "0.665211", "0.6614338", "0.6597356", "0.659321", "0.65827...
0.7215945
0
get total coins value with this route => host/users/total_coins_value?:user_id=user_id
def total_coins_value json_response({:total_coins_value => @total_coins_val, :status => true, :message => 'calculated'}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coins\n\t\tres = {}\n\t\tuser = User.find_by_token(params[:token])\n\t\tif user\n\t\t\tres[:status] = \"0\"\n\t\t\tres[:coins] = user.coins\n\t\telse\n\t\t\tres[:status] = \"1\"\n\t\tend\n\t\trender json: res\n\tend", "def get_coins\n get(\"/getcoins\")\n end", "def get_total_price\n @us...
[ "0.706636", "0.6928268", "0.68818575", "0.6691343", "0.6493234", "0.6493234", "0.6493234", "0.6233464", "0.6137647", "0.60845786", "0.606392", "0.6012118", "0.6003915", "0.5997342", "0.59955025", "0.5978348", "0.5960885", "0.59429586", "0.59429586", "0.59429586", "0.5938953",...
0.7595399
0
all transactions for a specific user => host/users/user_transactions?:user_id=user_id
def user_transactions user_deposits = get_user_deposits user_withdrawals = get_user_withdrawals json_response({:user_transactions => @user_transactions, :user_deposits => user_deposits, :user_withdrawals => user_withdrawals}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @transactions = User.find(params[:id])\n end", "def transactionByUser\n results = HTTParty.get(\"http://192.168.99.101:4050/by_user_id?userid=\" + (@current_user[\"id\"]).to_s)\n render json: results.parsed_response, status: results.code\n end", "def get_transactions_from_user\n ...
[ "0.76925904", "0.7555634", "0.74471265", "0.73294973", "0.73018956", "0.72070515", "0.7158072", "0.70532507", "0.700467", "0.6913992", "0.6900689", "0.6855507", "0.6834058", "0.678975", "0.6669661", "0.6647189", "0.66274357", "0.660833", "0.65642697", "0.6545789", "0.65380245...
0.7579626
1
Public: returns the string "We're playing tennis!" When the game_play object is named.
def to_s "We're playing tennis!" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def game_title\n object.game ? object.game.title : 'Не прикреплен ни к одной игре'\n end", "def game_name\n fetch('sword_art_online.game_name')\n end", "def game_title\n\t\t\"#{home_team} vs. #{visitor_team}\"\n\tend", "def play\n \"We're rockiinnggg\"\n end", "def name\n @game...
[ "0.6862751", "0.67511", "0.6732199", "0.6632266", "0.6504157", "0.6503335", "0.6460288", "0.63905954", "0.6358499", "0.6351518", "0.63228124", "0.62906235", "0.62560695", "0.6250081", "0.6248526", "0.62003005", "0.6188027", "0.61837476", "0.61716276", "0.6171561", "0.61649805...
0.68638587
0
Internal: This method is called to start a new game. It asks whether the user would like to play a new game. If answer is 'y' it starts a new game. If 'n' it ends the program. returns: "response not understood" if any other response is received.
def new_game puts "Would you like to play a new game (y or n)?" answer = gets.chomp.downcase if answer == 'y' @player1.points = 0 @player2.points = 0 puts "Player 1 = #{@player1}" puts "player 2 = #{@player2}" self.coin_toss_call elsif answer puts "Have a nice day." else puts...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ask_for_start\n puts \"Do you want to start the game? y/n\"\n user_input = Info.get_user_input\n if user_input.downcase == \"y\"\n start_game\n elsif user_input.downcase == \"n\"\n puts \"You said no :(\"\n else\n exit_app\n end\n end", "def requestNewGame\n print \"Do yo...
[ "0.80085206", "0.7972854", "0.7859935", "0.78385824", "0.7571109", "0.73958206", "0.7366434", "0.7345739", "0.7330692", "0.7211508", "0.7136359", "0.71131057", "0.708612", "0.70814526", "0.7075292", "0.7072899", "0.70616215", "0.6993281", "0.6951044", "0.6911757", "0.6907397"...
0.8022935
0
Internal: Asks player to call heads or tails, saves response. Calls toss_results if 'heads' or 'tails' is entered.
def coin_toss_call puts "Please call 'heads' or 'tails'" call = gets.chomp.downcase unless call == 'heads' || call == 'tails' puts "response not understood. Hit 't' to try again." response = gets.chomp.downcase if response == "t" self.coin_toss_call else puts "exiting game." end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toss_results(call)\n\t\t\ttoss = self.cointoss\n\t\t\ttoss_string =\"you called #{call} and the toss returned #{toss}.\"\n\t\t\tif call == toss\n\t\t\t\tputs toss_string\n\t\t\t\tputs \"you won the coin toss.\"\n\t\t\t\tputs \"You get to serve first.\"\n\t\t\t\tputs \" \"\n\t\t\t\tself.hitter2\n\t\t\t\tserver...
[ "0.67123103", "0.5408612", "0.5336791", "0.52342737", "0.5134752", "0.5134286", "0.51317537", "0.5071834", "0.5051467", "0.5015764", "0.5010839", "0.500381", "0.50014025", "0.49874166", "0.49859127", "0.49545282", "0.49525946", "0.49507055", "0.49431372", "0.49424398", "0.491...
0.80080867
0
tossresults takes a call as argument passes it to the results of a call to the cointoss method then determines a winner of the toss
def toss_results(call) toss = self.cointoss toss_string ="you called #{call} and the toss returned #{toss}." if call == toss puts toss_string puts "you won the coin toss." puts "You get to serve first." puts " " self.hitter2 server(@player1) elsif call != toss puts toss_string ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_results(user, comp)\n if winner(user, comp)\n say 'You won that round!'\n elsif winner(comp, user)\n say 'The computer won that round..'\n else\n say 'That round was a TIE'\n end\nend", "def analyze_results(player, computer)\r\n\r\n #Analyze the results of the game when the player select...
[ "0.6516848", "0.6256644", "0.6205345", "0.6134353", "0.6016133", "0.5972003", "0.5965531", "0.5914879", "0.5911554", "0.5842381", "0.5840176", "0.5772151", "0.5756688", "0.5730377", "0.5724547", "0.5692705", "0.5671264", "0.56522644", "0.56475145", "0.56439996", "0.56365323",...
0.7867938
0
cointoss generates a random number between 1 and 10 and saves it in the 'number' variable. If the number generated is less than or equal to five the method returns "heads". If the random number is greater than 5 coin toss returns "tails."
def cointoss number = rand(1..10) return "heads" if number <= 5 return "tails" if number > 5 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coin_toss\n toss = SecureRandom.random_number(2)\n if toss == 0\n HEADS_VALUE\n else\n TAILS_VALUE\n end\n end", "def coin_flip\n return (rand(1..2) == 1 ? \"HEADS\" : \"TAILS\")\nend", "def coin_toss_call\n\t\t\tputs \"Please call 'heads' or 'tails'\"\n\t\t\tcall = ...
[ "0.6919821", "0.58450276", "0.5837084", "0.56994927", "0.56777275", "0.56684595", "0.56553215", "0.5587411", "0.5582435", "0.55771285", "0.5561587", "0.5529225", "0.5519647", "0.5518868", "0.55127317", "0.5430425", "0.5427462", "0.542739", "0.5426693", "0.5407493", "0.5407493...
0.8020386
0
game action uses a random number to determine the result of ball serves. a random number between 5 and 15 is set as a net ball meaning the ball is stopped by the net and does not make it to the other court
def game_action(num) net_ball = rand(5..15) return "net" if num == net_ball return "oob" if num <= 3 return "hit" if num > 3 && num <=17 return "miss" if num > 17 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rally\n\t\t\tnum = rand(1..20)\n\t\t\trally_case = game_action(num)\n\t\t\tcase rally_case\n\t\t\t\twhen \"oob\" \n\t\t\t\t\tputs \"oo-oo-oo-oo-oo #{$hitter} hit the ball out of bounds oo-oo-oo-oo-oo\"\n\t\t\t\t\t@current_game.wins_ball($def_num)\n\t\t\t\t\tself.game_stats\n\t\t\t\t\n\t\t\t\twhen \"miss\"\n\t\...
[ "0.71782994", "0.6828066", "0.67948586", "0.6782375", "0.6745367", "0.67412096", "0.670572", "0.67025584", "0.67007613", "0.665206", "0.6651955", "0.66195554", "0.6604901", "0.66048497", "0.6602807", "0.6588497", "0.6579324", "0.65771365", "0.657554", "0.6574815", "0.6571189"...
0.7099683
1
This method switches which player is the hitter and which is returning the ball Once a player hits the ball they become the "hitter" and the other player becomes the defender. It also associates player number with "hitter" and "defender" so that the score can be tracked.
def hitter(hitter) if $hitter == @player1 self.hitter1 self.rally else self.hitter2 self.rally end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def judge_winner\n\t\tif attacker.army.all_curr_hp.zero?\n\t\t\tresult.winner = defender\n\t\t\twinner = defender\n\t\telsif defender.army.all_curr_hp.zero?\n\t\t\tresult.winner = attacker\n\t\t\twinner = defender\n\t\tend\n\tend", "def winning_team_with_spread\n\t\tif self.final?\n\t\t\treturn home_team_id if h...
[ "0.65078837", "0.64507174", "0.6429378", "0.63456154", "0.6292119", "0.6283494", "0.6274708", "0.61308235", "0.6123053", "0.6045784", "0.60281605", "0.60231036", "0.6021796", "0.60000515", "0.59720653", "0.58996475", "0.5868824", "0.5859486", "0.5857962", "0.5850558", "0.5818...
0.72063625
0
This method initiates a new serve and calls the rally method.
def new_serve(server) puts " " puts ">>>>>>>>>>>>> #{$hitter} serves the ball >>>>>>>>>>>>>>>" puts "hit any letter to continue 'q' to quit." puts "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" result = gets.chomp.downcase if result == 'q' puts "exiting game" else self.ra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_new_toy\n @main_view.setup_for_new\n @id = rand(2**60).to_s\n end", "def set_rally\n @rally = Rally.find(params[:id])\n end", "def run\n client.run\n end", "def run\n make_request(@path)\n end", "def begin!\n start_server\n end", "def create\n seth_se...
[ "0.5527765", "0.5481547", "0.54634446", "0.5459039", "0.5353314", "0.53342146", "0.5328975", "0.5328817", "0.53245336", "0.5315245", "0.5313844", "0.52707726", "0.5255495", "0.52460724", "0.52460724", "0.52460724", "0.52460724", "0.52460724", "0.52460724", "0.52460724", "0.52...
0.5810025
0
This method alternates which player is the server and then passes the new server to the new_serve method.
def switch_serve(server) if @current_game.check_status == "#{@player1} wins" || @current_game.check_status == "#{@player2} wins" self.new_game else if $server == @player1 $server = @player2 self.hitter1 else $server = @player1 self.hitter2 end new_serve($server) end...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def server(player)\n\t\t\t$server = player\n\t\t\tnew_serve($server)\n\t\tend", "def switch_server\n self.connection = nil\n servers << servers.shift\n end", "def accept_player_connection\n new_connection = @ref_server.accept\n\n #NOTE if players are taking a long time to respond here, other...
[ "0.77768034", "0.6474637", "0.61794686", "0.61417204", "0.6033821", "0.59365153", "0.5920103", "0.5831099", "0.5831099", "0.58268505", "0.58268505", "0.58103096", "0.57869613", "0.5733789", "0.57077223", "0.5697381", "0.569682", "0.5689727", "0.56782115", "0.56400853", "0.563...
0.7631063
1
This is the main action of the game rally calls the game_action method to determine what has happened to the ball then it uses a case statement to return results and pick next actions
def rally num = rand(1..20) rally_case = game_action(num) case rally_case when "oob" puts "oo-oo-oo-oo-oo #{$hitter} hit the ball out of bounds oo-oo-oo-oo-oo" @current_game.wins_ball($def_num) self.game_stats when "miss" puts "mmmmmmm #{$defender} missed the ball! mmmmmmmmmm"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_action snapshot\n # HERE GOES YOUR ALGORITHM. \n\n puts\n puts \"------VIRTUAL PLAYER DATA--------\"\n puts \"v-player: NAME #{name}\"\n puts \"v-player: CARDS #{cards}\"\n puts \"v-player: REMAINING MONEY #{remaining_money}\"\n puts \"last_round_actions: #{s...
[ "0.6867743", "0.6645535", "0.6621035", "0.65957445", "0.65756154", "0.64657813", "0.6455764", "0.6415749", "0.6398253", "0.63843673", "0.6367002", "0.63352346", "0.63307863", "0.6293095", "0.62886244", "0.62862873", "0.62676406", "0.6263425", "0.62470925", "0.62146115", "0.62...
0.73228633
0
Returns an input iterator to use for the request. if arguments are given, uses arguments if the input file option is given, uses file input if none of the previous are given, uses stdin
def input_iterator return arguments.each unless arguments.empty? return File.foreach(options[:input]) if options[:input] $stdin.each_line end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_stream(options)\n options[:file].nil? ?\n $stdin :\n open(File.expand_path(options[:file]))\nend", "def process_inputs(args)\n @input = ((name = args[:in_file]) && (IO.read(name, mode: \"rb\"))) ||\n args[:in_str] ||\n fail(\"An...
[ "0.6686894", "0.66236067", "0.6605015", "0.6336927", "0.62568593", "0.62260014", "0.61801213", "0.6156044", "0.6133542", "0.6084084", "0.6084084", "0.60715115", "0.60430545", "0.6014799", "0.601269", "0.601269", "0.5988913", "0.59886664", "0.59488773", "0.5926221", "0.5904913...
0.842547
0
Returns the default default_batch_size of a command.
def default_batch_size raise NotImplementedError, 'This must be implemented in a subclass.' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_size\n if options[:batch]\n options[:batch].to_i\n else\n default_batch_size\n end\n end", "def get_batch_size\n if @options[:limit] > 0 && @options[:batch_size]\n rest < @options[:batch_size] ? rest : @options[:batch_size]\n else @options[:batch_size]\n...
[ "0.71441257", "0.68832207", "0.6735431", "0.6720366", "0.6215067", "0.6164288", "0.61455417", "0.60646504", "0.5996299", "0.5949705", "0.581246", "0.5770261", "0.565737", "0.55842865", "0.55501163", "0.55258423", "0.5452814", "0.5333686", "0.532593", "0.53223276", "0.5283142"...
0.74167126
0
returns the effective batch_size of a command
def batch_size if options[:batch] options[:batch].to_i else default_batch_size end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_batch_size\n\t\tdatastore['BATCHSIZE'].to_i\n\tend", "def get_batch_size\n if @options[:limit] > 0 && @options[:batch_size]\n rest < @options[:batch_size] ? rest : @options[:batch_size]\n else @options[:batch_size]\n @options[:batch_size]\n end\n end", "def batch_size\n ...
[ "0.6884615", "0.68340075", "0.68056166", "0.6704901", "0.66717595", "0.6262663", "0.59965837", "0.58802134", "0.58296955", "0.5822657", "0.57918453", "0.5785271", "0.576993", "0.5766231", "0.5751917", "0.57449234", "0.5742205", "0.5738303", "0.5697127", "0.569474", "0.5692438...
0.68786407
1
Returns a new batch_iterator based on the batch_size
def batch_iterator Unipept::BatchIterator.new(batch_size) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batches(batch_size:, cursor:)\n @csv.lazy\n .each_slice(batch_size)\n .with_index\n .drop(count_of_processed_rows(cursor))\n .to_enum { (count_of_rows_in_file.to_f / batch_size).ceil }\n end", "def in_batches(of: DEFAULT_BATCH_SIZE, &block)\n per_page = of\n\n ...
[ "0.63759923", "0.6204015", "0.6114403", "0.59071976", "0.5832074", "0.5815702", "0.57909197", "0.57320005", "0.57122004", "0.5698831", "0.56500286", "0.5577306", "0.5412376", "0.537969", "0.53696537", "0.533266", "0.53314716", "0.52766865", "0.5242842", "0.52294457", "0.51955...
0.73165506
0
Returns an array of regular expressions containing all the selected fields
def selected_fields return @selected_fields unless @selected_fields.nil? fields = [*options[:select]].map { |f| f.split(',') }.flatten fields.concat(required_fields) if @fasta && !fields.empty? @selected_fields = fields.map { |f| glob_to_regex(f) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def possible_regexes(w)\n possible = []\n w_as_regex = escape_regex(w)\n\n # Here we specify many different functions that generate regex criterias,\n #\n # For example, /\\$10/ and /\\$[0-9]+/ for $10\n possible << w_as_regex\n possible << w_as_regex.gsub(/[0-9]/, \"[0-9]+\")\n\...
[ "0.6468004", "0.633093", "0.62629044", "0.6211319", "0.6053983", "0.6046699", "0.59120476", "0.5631322", "0.55165964", "0.5467334", "0.54167783", "0.5396006", "0.5387249", "0.5383706", "0.538021", "0.5375666", "0.53514737", "0.53140116", "0.5287678", "0.52858543", "0.52796036...
0.71189165
0
Returns a formatter, based on the format specified in the options
def formatter @formatter ||= Unipept::Formatter.new_for_format(options[:format]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_format(formatter_klass, options={})\n formatter_klass.new(self, options).output\n end", "def format(formatter = self.class.formatter, **options)\n formatter.format(self, options)\n end", "def formatter fmt\n @formatter = fmt\n end", "def formatter\n @formatter ||= Formatters::Default....
[ "0.71300334", "0.71230537", "0.706918", "0.7065986", "0.7020982", "0.6900602", "0.68292946", "0.68029535", "0.67695177", "0.669708", "0.6608481", "0.65708154", "0.65409714", "0.6531597", "0.65250045", "0.6425825", "0.64107114", "0.64105326", "0.64081585", "0.6390247", "0.6363...
0.79420877
0
Constructs a request body (a Hash) for set of input strings, using the options supplied by the user.
def construct_request_body(input) names = selected_fields.empty? || selected_fields.any? { |f| f.to_s.include?('name') || f.to_s.include?('.*$') } { input: input, equate_il: options[:equate] == true, extra: options[:all] == true, names: options[:all] == true && names } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build(options = {})\n options.each do |k,v|\n k = k.to_s\n unless k.match(/^body_/)\n self.send(\"#{k}=\", v)\n else\n k.gsub!(\"body_\", \"\")\n self.body(k, v)\n end\n end\n end", "def make_request_body(opts, headers)\n case\n when opts.body\n ...
[ "0.65530926", "0.6464858", "0.63408285", "0.6313061", "0.63088036", "0.6243186", "0.6243186", "0.6243186", "0.6243186", "0.6209404", "0.6172065", "0.61426836", "0.60170084", "0.6007852", "0.5964315", "0.59277284", "0.5924487", "0.5861653", "0.57572794", "0.57408476", "0.55986...
0.74869096
0
Saves an error to a new file in the .unipept directory in the users home directory.
def save_error(message) path = error_file_path FileUtils.mkdir_p File.dirname(path) File.write(path, message) warn "API request failed! log can be found in #{path}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_error_report_to_file(text)\n File.open(\"errorfile\", \"a\") do |er|\n er.write \"#{text}\"\n end\nend", "def write_error_report_to_file(text)\n File.open(\"errorfile\", \"a\") do |er|\n er.write \"#{text}\"\n end\nend", "def map_error_output(filename)\r\n\tDir.mkdir(\"#{settings.ro...
[ "0.64753145", "0.64753145", "0.6455628", "0.63397366", "0.6173027", "0.5959358", "0.5893266", "0.57447356", "0.56342256", "0.55946857", "0.5589954", "0.55641836", "0.55584353", "0.5557607", "0.55516434", "0.5497772", "0.5475988", "0.5469417", "0.5432468", "0.5428971", "0.5419...
0.7041508
0
Parses the json_response, wraps it in an array if needed and filters the fields based on the selected_fields
def filter_result(json_response) result = JSON[json_response] rescue [] result = [result] unless result.is_a? Array key_order = result.first.keys if result.first result = flatten_functional_fields(result) if formatter.instance_of?(Unipept::CSVFormatter) result.map! { |r| r.select! { |k, _v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_response(response)\n JSON.parse(response)\n end", "def setup_response(response)\n response = response.values if unprocessable_hash?(response)\n Array([response]).flatten\n end", "def extract_data_from_response(response)\n if response.nil?\n return []\n ...
[ "0.6037001", "0.5941196", "0.59008944", "0.5856639", "0.5730038", "0.56695974", "0.5620536", "0.55746675", "0.5550236", "0.55334204", "0.5521257", "0.5499812", "0.54981154", "0.54705095", "0.54559356", "0.543158", "0.542495", "0.5424", "0.5383765", "0.537878", "0.53630066", ...
0.7519475
0
GET /cta_ctes GET /cta_ctes.json
def index @cta_ctes = CtaCte.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @cta = Cta.all\n end", "def set_cta_cte\n @cta_cte = CtaCte.find(params[:id])\n end", "def index\n @ctos = Cto.all\n end", "def index\n @cts = Ct.all\n end", "def set_cta\n @cta = cta.find(params[:id])\n end", "def list_tenants_for_circle(args = {}) \n get(\"/tenan...
[ "0.6766735", "0.6536953", "0.61619496", "0.6160475", "0.6144055", "0.61351055", "0.61277616", "0.60599494", "0.60330796", "0.6006532", "0.59637034", "0.5902809", "0.5875919", "0.58559465", "0.58408", "0.58312565", "0.5806932", "0.5750383", "0.56878304", "0.56671757", "0.56534...
0.7110192
0
POST /cta_ctes POST /cta_ctes.json
def create @cta_cte = CtaCte.new(cta_cte_params) respond_to do |format| if @cta_cte.save format.html { redirect_to @cta_cte, notice: 'Se creo correctamente.' } format.json { render :show, status: :created, location: @cta_cte } else format.html { render :new } format....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @cta = Cta.new(cta_params)\n\n respond_to do |format|\n if @cta.save\n format.html { redirect_to @cta, notice: 'cta was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cta }\n else\n format.html { render action: 'new' }\...
[ "0.6988885", "0.68833303", "0.66639024", "0.6642157", "0.6459567", "0.62548745", "0.62467664", "0.6194473", "0.60483253", "0.58805376", "0.58160996", "0.5760595", "0.57507014", "0.57424766", "0.5725609", "0.57031035", "0.5630633", "0.5601686", "0.54903114", "0.5482138", "0.54...
0.72541827
0
PATCH/PUT /cta_ctes/1 PATCH/PUT /cta_ctes/1.json
def update respond_to do |format| if @cta_cte.update(cta_cte_params) format.html { redirect_to @cta_cte, notice: 'Cta cte was successfully updated.' } format.json { render :show, status: :ok, location: @cta_cte } else format.html { render :edit } format.json { render json...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @cta.update(cta_params)\n format.html { redirect_to @cta, notice: 'cta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cta.errors, status: :...
[ "0.7178427", "0.67674005", "0.65616006", "0.649103", "0.6470003", "0.6425526", "0.62084883", "0.6124629", "0.6115476", "0.60421103", "0.5930012", "0.5886875", "0.5882646", "0.5861724", "0.58495075", "0.5808336", "0.5807825", "0.58050156", "0.5803656", "0.5793464", "0.5789125"...
0.731992
0
SEND: XMPP General method for sending xmppmessages. Notce! clientparameter contains the client that is used to send the message, not the client that is receving the message
def sendMessage(args, client = @send_client) jabmsg = Jabber::Message::new(args[:receiver], args[:message]).set_type(:chat).set_id('1') begin Timeout::timeout(10) do client.send(jabmsg) puts "XMPP TO: " + args[:receiver].to_s puts "XMPP MESSAGE: " + args[:message].to_s ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_message(message); end", "def send_message(message); end", "def send_msg(conn,args)\n p = @app.get_client(conn) #pega objeto Player da lista de clientes\n unless p.nil?\n @app.broadcast(Message.new('chat','txt',\n {'author' => CGI::escapeHTML(p.to_s), 'msg' => CGI::escapeHTML(args...
[ "0.6530843", "0.6530843", "0.64775795", "0.64474255", "0.61949897", "0.6178032", "0.6167656", "0.616258", "0.614283", "0.6111387", "0.6029982", "0.60292256", "0.6010723", "0.59718424", "0.59715956", "0.5936464", "0.58512276", "0.5835966", "0.57869095", "0.5765655", "0.5762083...
0.6621806
0
Handles xmpp2restmessages that are received.
def handleMessage(msg) if msg != nil and msg.type == :chat and msg.body #and msg.from == @@visualRESTmain #puts "#{msg.from}:" #puts "#{msg.body.strip}" puts "Validating.." begin doc = XML::Document.string(msg.body)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_msgs\n end", "def receive_msg msg\n # stub, overwrite this in your handler\n end", "def process_response\n case @msg.sip_method\n when :INVITE\n if client_transaction = @msg.connection.class.invite_client_transactions[@msg.via_branch_id]\n client_transacti...
[ "0.64893013", "0.602477", "0.5796106", "0.5658078", "0.55917823", "0.55594623", "0.55490136", "0.5509176", "0.54918", "0.5485523", "0.54762375", "0.5471524", "0.54709697", "0.5459718", "0.5413442", "0.5410259", "0.53884965", "0.53739774", "0.53625333", "0.53532904", "0.534015...
0.65637827
0
Finds context from xml, adds parts to path and returns the both results
def findContext(doc, path) context = nil # If user-element is given -> context is user-based, otherwise context is system-based if doc.find_first('//xmpp2rest/user') puts "User context" username = (doc.find_first('//xmpp2rest/user').attributes.get_attribute("username")) ? doc.find...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_xml_common(ent, node)\n REXML::XPath.each(node, \"./ctx:identifier\", {\"ctx\" => \"info:ofi/fmt:xml:xsd:ctx\"}) do |id|\n ent.add_identifier(id.get_text.value) if id and id.has_text?\n end\n\n priv = REXML::XPath.first(node, \"./ctx:private-data\", {\"ctx\" => \"info:ofi/fmt:xml:x...
[ "0.56314456", "0.55916697", "0.5503099", "0.542548", "0.51419705", "0.5080171", "0.50422806", "0.50086486", "0.50027657", "0.50007904", "0.49485382", "0.49271888", "0.49271888", "0.4908697", "0.48717603", "0.48561013", "0.48391455", "0.47899863", "0.47889015", "0.47503296", "...
0.62768525
0
Parses dev_type and password from xml
def parseDeviceData(doc, params) dev_type = (doc.find_first('//xmpp2rest/user/device/dev_type')) ? doc.find_first('//xmpp2rest/user/device/dev_type').content : nil password = (doc.find_first('//xmpp2rest/user/device/password')) ? doc.find_first('//xmpp2rest/user/device/password').content : nil if no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_user!\n login_xml = Hpricot.XML(self.login_token) \n item = (login_xml/:login).first\n self.login_type = item[\"type\"]\n self.login_id = (item/:login_id).inner_html\n self.name = (item/:name).inner_html\n self.email = (item/:email).inner_html\n self.expires_at = (item/:expires_at).i...
[ "0.5899146", "0.56406736", "0.5602265", "0.55816984", "0.5552967", "0.54880935", "0.5461128", "0.5451781", "0.5427604", "0.5340531", "0.523414", "0.5094814", "0.5083051", "0.50740397", "0.5004393", "0.49906373", "0.49274254", "0.49213305", "0.489434", "0.4878623", "0.48465493...
0.6075635
0
Parses device's online status, and the possible status elements that are given
def parseOnlineStatus(doc, params, path) status = {} doc.find('//xmpp2rest/user/device/online/status').each do |status_element| status_key = (status_element.attributes.get_attribute("status_key")) ? status_element.attributes.get_attribute("status_key").value : nil if not status_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_online_status(status)\n case status\n when :available, :online\n @notification_server.chg \"NLN\", 0\n when :busy\n @notification_server.chg \"BSY\", 0\n when :idle\n @notification_server.chg \"IDL\", 0\n when :brb, :be_right_back\n @notification_server.chg \"BRB\", 0\n ...
[ "0.62053114", "0.61316156", "0.5951072", "0.58885884", "0.58121955", "0.5796551", "0.5788164", "0.5777459", "0.57056564", "0.5694479", "0.56859666", "0.56562823", "0.5655947", "0.5637627", "0.5549555", "0.55483246", "0.5544901", "0.5540149", "0.55320114", "0.54901993", "0.545...
0.735458
0
Parses the userspecific metadata from xml to visualREST form. List of updated files is returned, so that xml can contain many metadata changes for different files
def parseUpdatedMetadata(doc, params, path) path += "/files" listOfUpdatedFiles = Array.new doc.find('//user/device/files/file').each do |file| fullpath = (file.attributes.get_attribute("fullpath")) ? file.attributes.get_attribute("fullpath").value : nil version = "not_found"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metadata_xml\n Nokogiri::XML(original_file.content)\n end", "def parse_photo_request_reponse_xml\n logger.debug('PARSING FILES.')\n Dir.glob(File.join(LOCAL_DIR, FILE_EXTN)).each do |file|\n begin\n doc = Nokogiri::XML.parse(File.open(file)) { |xml| xml.noblanks }\n ...
[ "0.6386808", "0.6291768", "0.62225085", "0.60652304", "0.6039805", "0.6015787", "0.59605604", "0.58678955", "0.5758944", "0.57544965", "0.573245", "0.57027555", "0.566653", "0.56462985", "0.5641608", "0.5640055", "0.5623967", "0.5616245", "0.5562989", "0.5547797", "0.5529505"...
0.7655701
0
General method for first sending http to visualREST and then returning the response to xmppclient that sent the xmpp2rest message
def httpAndNotify(path, params, msg_from, method) message = "" begin m = "" if method == :get m = "GET" elsif method == :post m = "POST" elsif method == :put m = "PUT" elsif method == :delete m = "DELETE" else raise Exception.new...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def http_send_action\n http = http_inst\n req = http_post\n Response.new http.request req\n end", "def request\n self.response = prepare_response(http_communication.content)\n end", "def send_request; end", "def execute\n\n case @template[:payload][:method]\n when...
[ "0.6685027", "0.66773605", "0.65325016", "0.62631613", "0.61380297", "0.6074409", "0.60246587", "0.6010596", "0.60056424", "0.5995534", "0.59726405", "0.59530205", "0.5920722", "0.59037554", "0.58551", "0.58340186", "0.5832804", "0.58209467", "0.5817091", "0.57810426", "0.575...
0.6777497
0
Determines whether or not the 2 names match (ignoring parenthesis text)
def exact_match?(name1:, name2:) return false unless name1.present? && name2.present? a = name_without_alias(name: name1.downcase) b = name_without_alias(name: name2.downcase) a == b end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def names_match?(n1, style1, n2, style2)\n f1 = style1 == :short ? n1.first : n1.firstname\n m1 = style1 == :short ? n1.middle : n1.middlename\n l1 = style1 == :short ? n1.last : n1.lastname\n \n f2 = style2 == :short ? n2.first : n2.firstname\n m2 = style2 == :short ? n2.middle : n2....
[ "0.72339934", "0.72310805", "0.68644345", "0.6822717", "0.67379135", "0.66431665", "0.6568806", "0.65048754", "0.6489231", "0.6485371", "0.6330591", "0.6263789", "0.62537646", "0.6161135", "0.61080587", "0.6083597", "0.6083597", "0.6080111", "0.60179526", "0.6011076", "0.6006...
0.7354697
0
Removes the parenthesis portion of the name. For example: "Foo College (foo.edu)" > "Foo College"
def name_without_alias(name:) return '' if name.blank? name.split(' (')&.first&.strip end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_name\n name.gsub(/\\(.*?\\)/, \"\").gsub(/(.*)/, \"\").strip\n end", "def name_filter\n self.gsub(/[^a-zA-Z\\s\\-\\(\\)]/, '')\n end", "def cleanup_firstname(name)\n name.gsub(/^Dean(\\w+)/) { |s| \"DeAn#{$1}\" }\n end", "def clean_name(name)\n if name.present?\n ...
[ "0.7359029", "0.71358466", "0.6829798", "0.6827434", "0.670028", "0.6634049", "0.6571017", "0.65043586", "0.6491759", "0.6455967", "0.6449051", "0.64332825", "0.64114606", "0.6396182", "0.63892615", "0.63799095", "0.63573664", "0.6332352", "0.6326359", "0.632394", "0.6301046"...
0.74420595
0
Removes any duplicates by comparing the sort names and ids
def deduplicate(records:) return [] unless records.present? && records.is_a?(Array) out = [] found = [] records.each do |rec| next if found.include?(rec[:sort_name]) || found.include?(rec[:id]) found << rec[:sort_name] found << rec[:id] if rec[:id].present...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def duplicates\n @duplicates = Duplicate.all\n @duplicates.sort! do |x, y|\n diff = (x.person.last_name || '') <=> y.person.last_name\n if diff == 0\n (x.person.first_name || '') <=> y.person.first_name\n else\n diff\n end\n end\n end", "def eliminate_duplicates\n m...
[ "0.58871746", "0.5852777", "0.5831081", "0.5724807", "0.57106245", "0.56934", "0.5622929", "0.5622929", "0.5603035", "0.55947965", "0.55722135", "0.5550381", "0.55066276", "0.5505039", "0.5504047", "0.55018365", "0.5463947", "0.5435217", "0.5431193", "0.5418625", "0.5398014",...
0.6992698
0
used at filelist inorder to send file info if requested path is file
def send_file_info(last, path) if not last == nil user = current_user path = path.force_encoding("UTF-8") @file_names = "#{path.split('/').last}" + "\n" @access_url = "#{HOSTING_URL}" + "/user_files/"+ "#{user.userid}" + path.force_encoding("UTF-8") else @f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def requested_file(request_line)\r\n # ... implementation details to be discussed later ...\r\nend", "def index\n \n \n\n if params[:file]\n @file = params[:file] \n p @file\n @path = \"/home/session[:user_name]/#{@file}\"\n @path.to_s.gsub!('\\.\\.' , '')\n if File.directory?(@path...
[ "0.67169935", "0.65137047", "0.6421977", "0.6369916", "0.6365445", "0.6277567", "0.62718534", "0.62718534", "0.62718534", "0.62718534", "0.62718534", "0.62718534", "0.62572217", "0.61724484", "0.6093924", "0.607562", "0.6065342", "0.6034502", "0.60303706", "0.602736", "0.6008...
0.71248126
0
Sends a progress update Inputs: percentage Integer Optional description, this could be displayed to the user e.g. Resizing image
def progress(percentage, description = nil) reply({:progress => percentage, :description => description}, {:message_type => 'progress'}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(percentage,text=nil)\n @progressBar.text = text.to_s if text\n @progressBar.fraction = percentage.to_f\n end", "def progress()\n percent = (($ops / $total_ops) * 100).floor\n if (percent <= 99)\n $progress.progress = percent\n $ops += 1\n else\n $progress.finish\n end\nend", ...
[ "0.7638601", "0.70924854", "0.70458984", "0.6957239", "0.694144", "0.69105506", "0.69105506", "0.69105506", "0.69105506", "0.69105506", "0.68811923", "0.6865555", "0.68185127", "0.67870325", "0.6713462", "0.66508126", "0.6617774", "0.66099554", "0.6544198", "0.6544198", "0.64...
0.7824124
0
Returns the Site with the given UID. This method does a server request, to get additional property data.
def site(uid) site_data = request("/web_properties/#{uid}.json") Site.new self, site_data['uid'], site_data['name'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sites\n request('/web_properties.json').map do |site_data|\n Site.new self, site_data['uid'], site_data['name']\n end\n end", "def get(uid)\n raise '`get` method by ID is not supported for this resource.'\n end", "def collect_site_details\n site = fetch('site','1')\n @site...
[ "0.61289465", "0.5512622", "0.5508035", "0.5489653", "0.5458613", "0.54338104", "0.5417794", "0.53828555", "0.538107", "0.5327955", "0.5324578", "0.53003526", "0.5295587", "0.5248692", "0.5243255", "0.52392995", "0.5217557", "0.5206366", "0.52001184", "0.5194564", "0.5186917"...
0.7929458
0
GET /likes Mostra todos os likes
def index @likes = Like.all render json: @likes, status: 200 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @likes = Like.all\n end", "def index\n @likes = Like.all\n end", "def likes(options = {})\n urn = options.delete(:urn)\n path = \"/socialActions/#{urn}/likes\"\n get(path, options)\n end", "def set_likes\n @likes = likes.find(params[:id])\n end", "def index\n ...
[ "0.7544764", "0.7544764", "0.7470378", "0.7364153", "0.7342139", "0.7328079", "0.73216075", "0.7293337", "0.7274337", "0.72464454", "0.7214664", "0.72048587", "0.7202439", "0.709546", "0.7057871", "0.7054916", "0.70053536", "0.6981248", "0.6981153", "0.6978274", "0.69717467",...
0.76030463
0
TODO: If no original_stock_location given, return a stock item according to some priority of the regular stock locations, instead of just the first one we find.
def stock_item(variant_id, user_id = nil, original_stock_location_id = nil) return super(variant_id) unless reserved_items? raise( UserRequiredArgumentError, Spree.t(:user_id_required_for_reserved_stock_location) ) unless user_id.present? items = stock_items.where(variant_id: variant_id, use...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stock(item_id)\n stocks.find {|st| st.item_id === item_id }\n end", "def lookup_stock(name)\n return StockQuote::Stock.quote(name)\nend", "def lowest_stock # A refactoriser via méthode SQL, on peut faire beaucoup plus court\n # Pour chaque produit récupérer la remaining quantity\n # Vérifier si cett...
[ "0.62543505", "0.614009", "0.5910705", "0.5881634", "0.5777033", "0.5772522", "0.5648893", "0.56396985", "0.5593023", "0.555641", "0.5554408", "0.5550677", "0.5539887", "0.5474278", "0.5446111", "0.5444322", "0.5389466", "0.52754205", "0.5259013", "0.52447337", "0.52430665", ...
0.6792954
0
provides the institution_id from the authentication block
def auth_inst_id auth[:institution_id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def institution_id\n\t\tif organisation.nil?\n\t\t\treturn nil\n\t\telse\n\t\t\treturn organisation.root.id\n\t\tend\n\tend", "def institution\n @institution ||= Institutions.institutions[institution_code.to_sym]\n end", "def institution\n @institution ||= Institutions.institutions[institution_code.to_s...
[ "0.72608656", "0.68392867", "0.68392867", "0.64460135", "0.64351135", "0.6403331", "0.6301779", "0.62198377", "0.6191585", "0.6138439", "0.6019603", "0.6018182", "0.59983885", "0.59951633", "0.59127873", "0.59085804", "0.5883133", "0.58764386", "0.5867963", "0.5702741", "0.56...
0.8112613
0
provides the user_id from the authentication block
def auth_user_id auth[:user_id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_id\n @raw['user']['id']\n end", "def user_id\n # The user id can't be handled by the method_missing magic from\n # OctocatHerder::Base, since the id method returns the object\n # id.\n @raw['id']\n end", "def user_id\n instance_variable_get(:@prepared_argument...
[ "0.7645467", "0.7389681", "0.7312701", "0.7123653", "0.71005976", "0.7092453", "0.7092453", "0.7092453", "0.7092453", "0.7092453", "0.7092453", "0.7083815", "0.70586646", "0.70318735", "0.7011396", "0.69800925", "0.696835", "0.696835", "0.696835", "0.696835", "0.696835", "0...
0.7673672
0
check existence of auth params
def auth_params_exist auth.key?(:user_id) && auth.key?(:api_key) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_for_params_auth?; end", "def valid_for_params_auth?\n params_authenticatable? && valid_params_request? &&\n valid_params? && with_authentication_hash(:params_auth, params_auth_hash)\n end", "def valid_params?\n params_auth_hash.is_a?(Hash)\n end", "def is_empty_para...
[ "0.816638", "0.77417094", "0.7450934", "0.74055743", "0.7396229", "0.737999", "0.72717565", "0.70791", "0.7000566", "0.6939553", "0.6935825", "0.6845076", "0.6775781", "0.6733712", "0.6727407", "0.6726336", "0.6710135", "0.67016196", "0.66966575", "0.66760284", "0.6672235", ...
0.8768393
0
returns a hash of only the search parameters that apply to the specific model being queried
def model_search_params(model, params) cols = model.column_names params.reject { |k, _v| !cols.include?(k) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_query_params\n out = {}\n search_attributes.each do |val|\n out[val.field] = self.send(val.field) unless self.send(val.field).blank?\n end\n\n out\n end", "def fetch_custom_search_params; end", "def search_params\n params.fetch(:search, {})\n end", "def search_pa...
[ "0.79279274", "0.7138219", "0.7130279", "0.7130279", "0.7130279", "0.69336075", "0.6910689", "0.6885791", "0.6873534", "0.6815955", "0.681338", "0.6802341", "0.67571557", "0.6730063", "0.670062", "0.6698462", "0.6678437", "0.66590023", "0.6657164", "0.665496", "0.6647552", ...
0.75259227
1
to install specific streams and profiles: $ dnf module install modulename:stream/profile $ dnf module install perl:5.24/minimal if unspecified, they will be defaulted (see [d] param in dnf module list output)
def install # ensure we start fresh (remove existing stream) uninstall unless [:absent, :purged].include?(@property_hash[:ensure]) args = @resource[:name].dup case @resource[:ensure] when true, false, Symbol # pass else args << ":#{@resource[:ensure]}" end args << "/#{@resou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def install\n args = @resource[:name]\n # ensure we start fresh (remove existing stream)\n uninstall unless [:absent, :purged].include?(@property_hash[:ensure])\n case @resource[:ensure]\n when true, false, Symbol\n # pass\n else\n args << \":#{@resource[:ensure]}\"\n end\n if @re...
[ "0.6378302", "0.58142465", "0.5811897", "0.5429503", "0.5412068", "0.53860205", "0.5375154", "0.5346813", "0.5346813", "0.5322329", "0.53153825", "0.53139937", "0.5310551", "0.530886", "0.5297804", "0.52954435", "0.5291388", "0.5283234", "0.52825147", "0.52732813", "0.5236966...
0.69993186
0
Configure knapsack report Setup variables Fetch latest report
def configure! ENV["KNAPSACK_TEST_FILE_PATTERN"] ||= "qa/specs/features/**/*_spec.rb" ENV["KNAPSACK_REPORT_PATH"] = report_path Knapsack.logger = QA::Runtime::Logger.logger download_report end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_report_settings!\n\n #set up default values\n self.network_perf = true\n self.network_perf = true\n self.route_perf_t = true\n self.route_tt_t = true\n self.route_perf_c = true\n self.route_tt_c = true\n self.duration = 86400\n\n #These are used for ScaterPlots and ScatterG...
[ "0.5656863", "0.5396806", "0.53540295", "0.52948236", "0.52855825", "0.5277777", "0.5212641", "0.5191116", "0.51815605", "0.5153086", "0.511975", "0.51102775", "0.5089693", "0.5089693", "0.50691193", "0.5059716", "0.50484574", "0.5037243", "0.50289696", "0.50271183", "0.50063...
0.6904296
0
Download knapsack report from gcs bucket
def download_report logger.debug("Downloading latest knapsack report for '#{report_name}' to '#{report_path}'") file = client.get_object(BUCKET, report_file) File.write(report_path, file[:body]) rescue StandardError => e ENV["KNAPSACK_REPORT_PATH"] = FALLBACK_REPORT logger....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_benchmark_output\n if !ApplicationController.fire_cloud_client.services_available?('GoogleBuckets')\n head 503 and return\n end\n\n requested_file = ApplicationController.gcs_client.execute_gcloud_method(:get_workspace_file, 0, @user_workspace.namespace,\n ...
[ "0.63311225", "0.59666455", "0.5818391", "0.57888836", "0.551008", "0.51703316", "0.5161123", "0.51274544", "0.5125504", "0.5040815", "0.5039935", "0.50388086", "0.49987504", "0.49857906", "0.49622244", "0.49592185", "0.49359795", "0.492353", "0.49170744", "0.4903087", "0.489...
0.6491717
0
Rename and move new regenerated report to a separate folder used to indicate report name
def move_regenerated_report return unless ENV["KNAPSACK_GENERATE_REPORT"] == "true" tmp_path = "tmp/knapsack/#{report_name}" FileUtils.mkdir_p(tmp_path) # Use path from knapsack config in case of fallback to master_report.json knapsack_report_path = Knapsack.report.report_path ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generatedReportFolder\n currentData, currentTime = DateTime.now.strftime(\"%Y_%m_%d %H_%M\").split(' ')\n path = \"#{$ROOT}/../output\"\n creatFolder(path)\n path += \"/#{currentData}\"\n creatFolder(path)\n path += \"/#{currentTime}\"\n creatFolder(path)\n path\n end", "def new_file...
[ "0.6160137", "0.6125244", "0.6013985", "0.58310205", "0.58233744", "0.57581466", "0.57088715", "0.56791013", "0.5672969", "0.56674683", "0.56530285", "0.56306183", "0.5624512", "0.55690086", "0.5519024", "0.5510288", "0.5503708", "0.5496041", "0.5495401", "0.54946774", "0.548...
0.70011115
0
Merge and upload knapsack report to gcs bucket Fetches all files defined in glob and uses parent folder as report name
def upload_report(glob) reports = Pathname.glob(glob).each_with_object(Hash.new { |hsh, key| hsh[key] = [] }) do |report, hash| next unless report.extname == ".json" hash[report.parent.basename.to_s].push(report) end return logger.error("Glob '#{glob}' did not contain any va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def place_files_in_buckets\n @files.each do |file|\n place_file_in_buckets(file)\n end\n end", "def process_workspace_bucket_files(files)\n # first mark any files that we already know are study files that haven't changed (can tell by generation tag)\n files_to_remove = []\n files...
[ "0.6140814", "0.58546835", "0.57979655", "0.57714075", "0.5493003", "0.5478963", "0.53091407", "0.52255744", "0.5213097", "0.51806384", "0.51462024", "0.51106644", "0.50835323", "0.5065028", "0.50629234", "0.5041598", "0.5039722", "0.5033797", "0.4996107", "0.49708122", "0.49...
0.7857947
0
Base path of knapsack report
def report_base_path @report_base_path ||= "knapsack" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pathBaseSummary()\n return \"#{@resultBaseDir}/#{getConf(:basenameSummary)}\" ;\n end", "def base_path\n super.concat \"/application_plans/#{application_plan['id']}/metrics/#{metric['id']}/limits\"\n end", "def app_thinning_size_report_path\n Gym.cache[:app_thinning_size_report] ||= ...
[ "0.66301197", "0.6129114", "0.60752475", "0.6011144", "0.59272826", "0.5903291", "0.58584666", "0.582792", "0.57376164", "0.5731664", "0.57311064", "0.568675", "0.56706345", "0.56676203", "0.5614115", "0.55870783", "0.55824566", "0.5579267", "0.55567247", "0.5550666", "0.5541...
0.853375
0
Report name Infer report name from ci job name Remove characters incompatible with gcs bucket naming from job names like ee:instanceparallel
def report_name @report_name ||= ENV["CI_JOB_NAME"].split(" ").first.tr(":", "-") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def job_name\n @job_name ||= QA::Runtime::Env.ci_job_name&.gsub(%r{ \\d{1,2}/\\d{1,2}}, '')\n end", "def trim_job_name(job_name)\n job_name = job_name.gsub('grid-', '');\n job_name = job_name.gsub('store-', '');\n job_name = job_name.gsub('sphere-', '');\n job_name = job_name.gsub('-public-de...
[ "0.7248338", "0.6820897", "0.6768887", "0.67313915", "0.63627213", "0.6267965", "0.6105949", "0.60516924", "0.5920085", "0.5904481", "0.58996475", "0.5779933", "0.5767508", "0.57361823", "0.5682957", "0.567658", "0.5672096", "0.5666553", "0.56558", "0.5650843", "0.56354606", ...
0.7777293
0
clean the tree, for example, eliminates sequence that have only one child (use the child directly).
def clean_tree(branch) branch.children = branch.children.inject(Children.new(branch)) do |r, c| cc = if c.name == 'sequence' and c.children.size == 1 c.children.first else c end r << clean_tree(cc) end branch end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_tree\n @root = nil # In ruby it will be taken care by garbage collector\n end", "def clean_children\n\n return unless @children\n\n @children.each do |child_fei|\n #next unless child.is_a?(FlowExpressionId)\n get_expression_pool.remove(child_fei)\n end\n end", "de...
[ "0.7100007", "0.705259", "0.6893871", "0.68154705", "0.66956043", "0.6646522", "0.66318303", "0.6615858", "0.6603389", "0.6541945", "0.65344673", "0.6487312", "0.64776355", "0.64569944", "0.6451546", "0.64353853", "0.64272636", "0.64166486", "0.6415475", "0.6396895", "0.63621...
0.7773698
0
Configuration blocks allow for lists of remote hosts, those are split into seperate configuration blocks here
def split_multi_remotehost_config_blocks(config_block) split_config = [] config_block['remoteHost'].each do |single_remote_host| # Clone the block containing the multiple remote hosts config_block_for_single_remote_host = config_block.clone # And replace them with a single remote host config_block_f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_config(parsed_config)\n final_config = []\n parsed_config.each do |config_block|\n # Skip any blocks that are explicitely not enabled\n next if config_block.key?('enabled') && !config_block['enabled']\n if config_block['remoteHost'].instance_of? Array\n final_config += split_multi_remot...
[ "0.7338561", "0.70764697", "0.6782281", "0.65633124", "0.65633124", "0.65633124", "0.654711", "0.63554907", "0.63472986", "0.63418674", "0.63418674", "0.63105065", "0.6256475", "0.62415254", "0.6212775", "0.61521417", "0.60444057", "0.60348874", "0.60348874", "0.6033988", "0....
0.7541265
0
Returns an image tag for a Google Maps image with the GPS polyline of the activity.
def polyline_image(polyline, size = 150, color = "blue") image_tag(polyline_map_url(polyline, size, color), alt: "Activity map") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map_image location, width=500, height=275, zoom=15\n image_tag(\"http://maps.googleapis.com/maps/api/staticmap?center=#{location.latitude},#{location.longitude}&zoom=#{zoom}&size=#{width}x#{height}&markers=color:blue%7Clabel:1%7C#{location.latitude},#{location.longitude}&sensor=false\", :class => \"map_imag...
[ "0.6824514", "0.65281117", "0.64669037", "0.631032", "0.5903551", "0.58798385", "0.58798385", "0.58798385", "0.578538", "0.56194264", "0.55652374", "0.5491314", "0.5479745", "0.5470793", "0.54530746", "0.5445605", "0.54446155", "0.54302865", "0.53642136", "0.5344973", "0.5337...
0.7739354
0
Detect the player in a specific direction
def detect_player(nb_pas, direction) return false if $game_switches[Yuki::Sw::Env_Detection] c = $game_map.events[@event_id] dx = $game_player.x - c.x dy = $game_player.y - c.y case direction when :right, 6 return (dy == 0 && dx >= 0 && dx <= nb_pas) when :down, 2 return (dx == 0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def di(x); $game_player.directionalInput == x; end", "def turn_to_player\n diffx = @x - $game.player.x\n diffy = @y - $game.player.y\n down = diffy < 0\n left = diffx > 0\n right = diffx < 0\n up = diffy > 0\n if down\n @direction = 2\n elsif up\n @direction ...
[ "0.69039494", "0.67745876", "0.6509103", "0.64658564", "0.64279443", "0.63223827", "0.6275695", "0.62329936", "0.6192447", "0.6164574", "0.6164574", "0.6159311", "0.61554235", "0.6108618", "0.6068152", "0.6058643", "0.6058213", "0.6039256", "0.6033777", "0.60277975", "0.60205...
0.7166496
0
Detect the player in a rectangle around the event
def detect_player_rect(nx, ny) return false if $game_switches[Yuki::Sw::Env_Detection] c = $game_map.events[@event_id] dx = ($game_player.x - c.x).abs dy = ($game_player.y - c.y).abs return (dx <= nx && dy <= ny) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onalg_player_has_moved(player,color, start_x, start_y, end_x, end_y)\r\n if player != @alg_player\r\n \r\n end\r\n end", "def player_push_button(event)\n if ((event.x - 180)**2 + (event.y - 810)**2).abs <= 8100\n @player_playing = 0\n elsif ((event.x - 1180)**2 + (event.y - 810)**2)....
[ "0.67386544", "0.6657943", "0.6456209", "0.64166856", "0.61822844", "0.61503327", "0.61353695", "0.6100163", "0.6041976", "0.60358363", "0.6006808", "0.600609", "0.59700865", "0.59470993", "0.59283006", "0.59061223", "0.5899723", "0.58703464", "0.5866658", "0.58552366", "0.58...
0.74727374
0
Delete the current event forever
def delete_this_event_forever $env.set_event_delete_state(@event_id) $game_map.events[@event_id]&.erase end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gcdelete_event\n cal_event = Event.find_by(gamecall_tag: self.id)\n cal_event.destroy if cal_event\n end", "def delete\n MoxiworksPlatform::Event.delete(self.to_hash)\n end", "def destroy\r\n @event.destroy\r\n end", "def purge\n i = 0\n debug \"Purge events on GCal... \"\n ...
[ "0.70878845", "0.7075776", "0.6887765", "0.6740551", "0.6656339", "0.6656339", "0.6656339", "0.6639906", "0.6573895", "0.6548764", "0.6521256", "0.6423632", "0.6387505", "0.638528", "0.63606566", "0.63352406", "0.6332292", "0.63229036", "0.63029516", "0.6264226", "0.6249685",...
0.8512633
0
Wait for the end of the movement of this particular character
def wait_character_move_completion(event_id = @event_id) @move_route_waiting = true @move_route_waiting_id = event_id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_for_player\n wait_character_move_completion 0\n end", "def update\n if button_down? Gosu::Button::KbEscape then\n do_exit\n end\n if @waiting then\n @waiting = @waiting - (Gosu::milliseconds - @time)\n @time = Gosu::milliseconds\n if @waiting.to_i <= 0 then...
[ "0.7760461", "0.62054217", "0.6096826", "0.59877986", "0.59877986", "0.5973073", "0.5861543", "0.585147", "0.5762579", "0.5747054", "0.570506", "0.5692232", "0.5672972", "0.56296563", "0.56163204", "0.55777335", "0.55704474", "0.5537389", "0.5530464", "0.5530464", "0.5518111"...
0.69585085
1
URL slug creation logic The steps are roughly as follows 1. If the record hasn't passed its validations, exit immediately 2. If the source_column is empty, exit immediately (no error is thrown this should be checked with your own validation) 3. If the slug is already set we have nothing to do, otherwise a. Strip out pu...
def create_slug return if self.errors.size > 0 return if self[source_column].blank? if self[slug_column].to_s.empty? proposed_slug = self[source_column].to_slug suffix = "" existing = true acts_as_slugable_class.transaction do...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_slug\n source = self[model.slug_options[:gen_from]] || \"\"\n slug = ActiveSupport::Inflector.transliterate(source) # remove accents\n .gsub(/&/,'and') # switch out &\n .gsub(/@/,'at') # switch out @\n .parameterize('-') # cleanup remain...
[ "0.7065004", "0.6764861", "0.66352636", "0.65899235", "0.65244013", "0.65244013", "0.6512822", "0.6461349", "0.63912755", "0.6388084", "0.6388084", "0.6371469", "0.6365984", "0.6351019", "0.63445914", "0.6339431", "0.6322686", "0.63140494", "0.62559336", "0.62559336", "0.6248...
0.86341465
0
This is the constructor for the Paper class. All dimension parameters to this method are in twips. ==== Parameters name:: The name for the paper object. width:: The width of the paper in portrait mode. height:: The height of the paper in portrait mode.
def initialize(name, width, height) @name = name @width = width @height = height end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n @paper = Paper::A4\n @left_margin = DEFAULT_LEFT_MARGIN\n @right_margin = DEFAULT_RIGHT_MARGIN\n @top_margin = DEFAULT_TOP_MARGIN\n @bottom_margin = DEFAULT_BOTTOM_MARGIN\n @gutter = nil\n @orientation = PORTRAIT\n ...
[ "0.6314327", "0.6223362", "0.61128145", "0.6091368", "0.6081066", "0.600612", "0.600612", "0.5984649", "0.5946034", "0.5912513", "0.5911243", "0.59032494", "0.5886491", "0.58456147", "0.58222026", "0.57983303", "0.56411725", "0.5640577", "0.56243366", "0.562127", "0.560729", ...
0.7407958
0
assert("RustRegexpcasefold?", '15.2.15.7.6') do assert_false RustRegexp.new("(https?://[^/]+)[azAZ09./]+", RustRegexp::MULTILINE).casefold? assert_true RustRegexp.new("(https?://[^/]+)[azAZ09./]+", RustRegexp::IGNORECASE | RustRegexp::EXTENDED).casefold? assert_true RustRegexp.new("(https?://[^/]+)[azAZ09./]+", RustReg...
def test_match reg = RustRegexp.new("(https?://[^/]+)[-a-zA-Z0-9./]+") assert_false reg.match("http://masamitsu-murase.12345/hoge.html").nil? assert_nil reg.match("http:///masamitsu-murase.12345/hoge.html") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_match_case_sensitive_binary_no_match\r\n\t\t#content with exact match\r\n\t\tcontent = \"first line.\\nthis string doesnt contains a match on: My\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"M|79|Mat|63 68|123\" #equals MyMatch123\r\n\t\tsnort_rule_cont...
[ "0.6137553", "0.60912406", "0.60233766", "0.6018899", "0.5960956", "0.58500963", "0.5798894", "0.57920045", "0.5780985", "0.57408726", "0.5732851", "0.5724394", "0.5691623", "0.5656116", "0.56359", "0.557114", "0.5563196", "0.55368555", "0.5534483", "0.54810584", "0.5474184",...
0.6180982
0
if RustRegexp.const_defined? :ASCII_RANGE assert('RustRegexpoptions (no options)') do assert_equal RustRegexp::ASCII_RANGE | RustRegexp::POSIX_BRACKET_ALL_RANGE | RustRegexp::WORD_BOUND_ALL_RANGE, OnigRegexp.new(".").options end assert('RustRegexpoptions (multiline)') do assert_equal RustRegexp::MULTILINE | RustRegexp:...
def test_extended_patterns_no_flags [ [ ".*", "abcd\nefg", "abcd" ], [ "^a.", "abcd\naefg", "ab" ], [ "^a.", "bacd\naefg", "ae" ], [ ".$", "bacd\naefg", "d" ] ].each do |reg, str, result| m = RustRegexp.new(reg).match(str) puts m.inspect unless m.nil? assert_equ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_regexp\n# (find-node \"(emacs-ja)Regexps\")\n \n conv = lambda{|from,to| assert_equal(to, el4r_conv_regexp(from)) }\n conv[ //, '' ]\n conv[ /a/, 'a' ]\n conv[ /a./, 'a.' ]\n conv[ /a*/, 'a*' ]\n conv[ /a+/, 'a+' ]\n conv[ /a?/, 'a?' ]\n conv[ /[ab]/, '[ab]' ]\n conv[ /[^ab]...
[ "0.5964451", "0.5913886", "0.5913886", "0.5864126", "0.58640945", "0.5765381", "0.57223755", "0.57221174", "0.558431", "0.5540713", "0.5537782", "0.5499215", "0.5493492", "0.5485469", "0.5476689", "0.5476689", "0.5476689", "0.54644084", "0.541113", "0.54087114", "0.5389694", ...
0.60338444
0
DELETE /requests/1 DELETE /requests/1.json
def destroy @request.destroy respond_to do |format| format.html { redirect_to requests_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url ...
[ "0.7699295", "0.76810163", "0.76810163", "0.76810163", "0.7671836", "0.7671836", "0.7671836", "0.7671836", "0.7671836", "0.7671836", "0.7389192", "0.73615795", "0.7333734", "0.7329198", "0.7329198", "0.7329198", "0.7329198", "0.7329198", "0.7329198", "0.7329198", "0.7329198",...
0.7705958
0
Return current user instance, used for authorization. This method can be redefined in ApplicationController if you want to use application's auth system. ex: class ApplicationController < ActionController::Base def current_puffer_user current_user end end In this case returner user model instance should respond to has_...
def current_puffer_user @current_puffer_user ||= begin super rescue NoMethodError ::Admin::SessionsController.model.to_adapter.get(session[:puffer_user_id]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_user\n \treturn @current_user if defined? @current_user\n \t@current_user = User.first\n end", "def current_user\n if @current_user.nil?\n if ( ! session[ApplicationController::KEY_CURRENT_USER_ID].blank? )\n user_class = session[ApplicationController::KEY_CURRENT_...
[ "0.7571162", "0.7537186", "0.75358003", "0.7500328", "0.749589", "0.74914634", "0.74897945", "0.7485818", "0.74837977", "0.7482105", "0.74799097", "0.7463718", "0.7463391", "0.745315", "0.74430585", "0.74367815", "0.74355406", "0.74205005", "0.74205005", "0.74155694", "0.7414...
0.7935158
0
Execute record creation based in quantity input
def execute_customer_record_create(qty) puts "Starting to create Customer records... Please give the API time to respond...\n" qty.times do |t| body = FakeCustomer.new.generate # puts JSON.pretty_generate(JSON.parse(body.to_json)) FakeRestActions.new(endpoint: "Customers", body: body, access_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call(_obj, args, _ctx)\n create_table = Table.new(\n name: args[:name],\n quantity: args[:quantity],\n )\n return create_table if create_table.save\n GraphQL::ExecutionError.new(\"invalid data\")\n end", "def add_units(qty)\n qty.to_i.times do\n #create item\n ...
[ "0.67013735", "0.65957385", "0.63124126", "0.6233941", "0.6219562", "0.61756307", "0.61744106", "0.6164429", "0.60861033", "0.6059458", "0.6053218", "0.601747", "0.5993268", "0.5993268", "0.59552157", "0.5915156", "0.5906974", "0.5903815", "0.5892649", "0.58911955", "0.587275...
0.6794722
0
GET /bookings GET /bookings.json
def index @bookings = Booking.all respond_to do |format| format.html format.json { render :json => @bookings } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |f...
[ "0.8231102", "0.80220497", "0.80220497", "0.80220497", "0.7619097", "0.7607287", "0.7501954", "0.7473071", "0.7473071", "0.7473071", "0.7473071", "0.7473071", "0.7473071", "0.7473071", "0.7473071", "0.7473071", "0.7473071", "0.7473071", "0.7473071", "0.7473071", "0.7437335", ...
0.80365145
1
GET /student_app_cat_regnos GET /student_app_cat_regnos.json
def index @student_app_cat_regnos = StudentAppCatRegno.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @all_registration = AllRegistration.new\n @all_registration.reg_no=number_retrive(\"REG\")\n @college_master = CollegeMaster.last\n @years = which_category.years.find(:all)\n # @year1.map!(&:year)\n @semesters = \"B-Tech\".include?(@college_master.category) ? @category.semesters : \"\...
[ "0.6189821", "0.60448205", "0.5916937", "0.5742928", "0.5697935", "0.55680597", "0.5528712", "0.5516869", "0.5514594", "0.55056554", "0.5497031", "0.54948574", "0.5491098", "0.5450131", "0.5445969", "0.54315805", "0.5430632", "0.5398704", "0.5384641", "0.5384532", "0.5376649"...
0.7220545
0
POST /student_app_cat_regnos POST /student_app_cat_regnos.json
def create @student_app_cat_regno = StudentAppCatRegno.new(student_app_cat_regno_params) respond_to do |format| if @student_app_cat_regno.save format.html { redirect_to @student_app_cat_regno, notice: 'Student app cat regno was successfully created.' } format.json { render :show, status: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @student_app_cat_regnos = StudentAppCatRegno.all\n end", "def set_student_app_cat_regno\n @student_app_cat_regno = StudentAppCatRegno.find(params[:id])\n end", "def new\n @all_registration = AllRegistration.new\n @all_registration.reg_no=number_retrive(\"REG\")\n @college_maste...
[ "0.645226", "0.59649545", "0.5849053", "0.5651538", "0.5577191", "0.54617", "0.5451802", "0.542166", "0.54051125", "0.533416", "0.5330176", "0.5326658", "0.52769065", "0.52295613", "0.5201422", "0.5188359", "0.5160425", "0.51532394", "0.51500064", "0.5131479", "0.5130406", ...
0.7248284
0
PATCH/PUT /student_app_cat_regnos/1 PATCH/PUT /student_app_cat_regnos/1.json
def update respond_to do |format| if @student_app_cat_regno.update(student_app_cat_regno_params) format.html { redirect_to @student_app_cat_regno, notice: 'Student app cat regno was successfully updated.' } format.json { render :show, status: :ok, location: @student_app_cat_regno } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_student_app_cat_regno\n @student_app_cat_regno = StudentAppCatRegno.find(params[:id])\n end", "def update\n json_update(category,category_params, Category)\n end", "def update\n # @student_category = StudentCategory.find(params[:id])\n\n respond_to do |format|\n if @student_catego...
[ "0.61135834", "0.58597535", "0.5834623", "0.57942486", "0.5766092", "0.5749243", "0.572301", "0.57015866", "0.5649218", "0.56271374", "0.56202483", "0.5569394", "0.5530903", "0.55274683", "0.55272967", "0.55177826", "0.5516618", "0.5513322", "0.5502429", "0.5458423", "0.54519...
0.69879645
0
DELETE /student_app_cat_regnos/1 DELETE /student_app_cat_regnos/1.json
def destroy @student_app_cat_regno.destroy respond_to do |format| format.html { redirect_to student_app_cat_regnos_url, notice: 'Student app cat regno was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n #@incidentcategory.destroy\n render json: {}, status: 200\n end", "def destroy\n # @student_category = StudentCategory.find(params[:id])\n @student_category.destroy\n\n respond_to do |format|\n format.html { redirect_to student_categories_url }\n format.json { head :ok }\n ...
[ "0.6481493", "0.64647764", "0.6455211", "0.64507127", "0.6437519", "0.640994", "0.64044076", "0.63618094", "0.6357828", "0.6351566", "0.6349962", "0.6335993", "0.6334742", "0.6328334", "0.6326384", "0.63259524", "0.631205", "0.63094646", "0.6304676", "0.6303961", "0.63002515"...
0.73455197
0
GET /promulher_forms GET /promulher_forms.json
def index @promulher_forms = PromulherForm.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_forms\n @course = Course.find(params[:course_id])\n @forms = @course.professor_forms\n render json: @forms\n end", "def show\n\t\t@form = @client.forms.find(params[:id])\n @procedures = @form.procedures.order('step_num ASC')\n\n \trespond_to do |format|\n \t\tformat.html # show.html....
[ "0.7620798", "0.7235807", "0.71815485", "0.7090954", "0.6815023", "0.67670554", "0.6584934", "0.6520534", "0.65044993", "0.64778745", "0.64277625", "0.64209366", "0.63731885", "0.635059", "0.63230646", "0.63163817", "0.6273654", "0.6267967", "0.6258361", "0.62518436", "0.6251...
0.72768515
1
POST /promulher_forms POST /promulher_forms.json
def create @promulher_form = PromulherForm.new(promulher_form_params) respond_to do |format| if @promulher_form.save format.html { redirect_to @promulher_form, notice: 'Promulher form was successfully created.' } format.json { render :show, status: :created, location: @promulher_form } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n\t\t@form = @client.forms.new\n\n \n 3.times do\n procedure = @form.procedures.build\n end\n 3.times do\n authemp = @form.authemps.build\n end\n\n\t\trespond_to do |format|\n \t\tformat.html # show.html.erb\n \t\tformat.json { render json: @form }\n \t\tend\n\tend", ...
[ "0.6913027", "0.66726047", "0.6592258", "0.6552269", "0.64742494", "0.6252745", "0.62478137", "0.6233747", "0.6229439", "0.6166977", "0.6159434", "0.61400044", "0.612566", "0.60932463", "0.6082558", "0.6077474", "0.6069096", "0.6062797", "0.6053153", "0.60170335", "0.6016596"...
0.69148487
0
PATCH/PUT /promulher_forms/1 PATCH/PUT /promulher_forms/1.json
def update respond_to do |format| if @promulher_form.update(promulher_form_params) format.html { redirect_to @promulher_form, notice: 'Promulher form was successfully updated.' } format.json { render :show, status: :ok, location: @promulher_form } else format.html { render :edit ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @pec_form = PecForm.find(params[:id])\n\n respond_to do |format|\n if @pec_form.update_attributes(params[:pec_form])\n format.html { redirect_to @pec_form, notice: I18n.t('pec_form.notice.update') }\n format.json { head :ok }\n else\n\t\t\t\tgon.edit_pec_form = true\n\t\t...
[ "0.65179825", "0.6510923", "0.64998424", "0.6494558", "0.6481626", "0.64682937", "0.64682937", "0.6396021", "0.6302415", "0.6280932", "0.62748474", "0.62587726", "0.62528056", "0.6247302", "0.6236622", "0.6225212", "0.6219872", "0.62041736", "0.62023014", "0.6200375", "0.6198...
0.6852862
0
DELETE /promulher_forms/1 DELETE /promulher_forms/1.json
def destroy @promulher_form.destroy respond_to do |format| format.html { redirect_to promulher_forms_url, notice: 'Promulher form was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @form1.destroy\n respond_to do |format|\n format.html { redirect_to form1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @formulario = Formulario.find(params[:id])\n @formulario.destroy\n\n respond_to do |format|\n format.html { redirect_to ...
[ "0.72760016", "0.720834", "0.7181126", "0.71731514", "0.7154185", "0.7150297", "0.7143509", "0.71341413", "0.7090525", "0.70640826", "0.7054177", "0.70404845", "0.7016824", "0.7015252", "0.7006958", "0.6993865", "0.69792414", "0.6978846", "0.6977704", "0.69638497", "0.6953685...
0.7256895
1
DELETE /minuts/1 DELETE /minuts/1.json
def destroy @minut.destroy respond_to do |format| format.html { redirect_to minuts_url, notice: 'Minut was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @ministerio = Ministerio.find(params[:id])\n @ministerio.destroy\n\n respond_to do |format|\n format.html { redirect_to ministerios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @minicurso = Minicurso.find(params[:id])\n @minicurso.destroy\n\n ...
[ "0.7088651", "0.6969055", "0.69264215", "0.69081724", "0.68713397", "0.687088", "0.6791006", "0.6781413", "0.67722327", "0.6757899", "0.67391723", "0.6722646", "0.67088556", "0.6705816", "0.6703608", "0.6692136", "0.66843086", "0.6656975", "0.6639853", "0.6637083", "0.6636861...
0.7147959
0
Make sure password and confirm_password are the same on update
def validate_on_update unless plain_password.blank? unless plain_password == password_confirmation errors.add_to_base("Passwords don't match") end # Validate password criteria unless plain_password.length >= 6 errors.add_to_base("Password must be a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_on_update\n unless plain_password.blank?\n unless plain_password == password_confirmation\n errors.add_to_base(\"Passwords don't match\")\n end\n # Validate password criteria\n unless plain_password.length >= 6\n errors.add_to_base(\"Password must be at least 6 cha...
[ "0.7755978", "0.76147574", "0.7551223", "0.75487745", "0.74905527", "0.7482487", "0.7462891", "0.744798", "0.7446331", "0.7367924", "0.7308071", "0.7282038", "0.7268492", "0.72589314", "0.7253914", "0.72497183", "0.72287405", "0.71731997", "0.7166696", "0.7149652", "0.7146407...
0.76982796
1
We are going to connect this user object with a facebook id. But only ever one account.
def link_fb_connect(fb_user_id) unless fb_user_id.nil? #check for existing account existing_fb_user = ::User.find_by_fb_user_id(fb_user_id) #merge the existing account unless existing_fb_user.nil? merge_with(existing_fb_user) end #link the ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link_fb_connect(fb_user_id)\n unless fb_user_id.nil?\n #check for existing account\n # UPDATE:\n # allow multiple accounts to use the same facebook id I guess - \n # makes debugging a lot easier too\n existing_fb_user = User.find_by_facebook_uid(fb_user_id)\n \n #unlink th...
[ "0.7504093", "0.7490277", "0.7399922", "0.7399922", "0.7399922", "0.7399922", "0.73369694", "0.7231991", "0.72258043", "0.70384943", "0.6854877", "0.67980784", "0.67314434", "0.6724964", "0.6720284", "0.6681034", "0.66633296", "0.6646808", "0.664005", "0.6634973", "0.6614998"...
0.7533046
0
find the user in the database, first by the facebook user id and if that fails through the email hash
def find_by_fb_user(fb_user) u = ::User.find(:first, :conditions => {_(:fb_user_id, :user) => fb_user.uid}) || ::User.find(:first, :conditions => {_(:facebook_hash, :user) => fb_user.email_hashes}) # make sure we have a person if u && !u.person u.create_person_from_fb(fb_user) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_using_oauth_email(oauth_data, oauth_user_id)\r\n user = nil\r\n oauth_email = oauth_data.info.email\r\n if oauth_email.present?\r\n user = self.find_by(email: oauth_email)\r\n if user.present? && user.oauth_user_id.blank?\r\n ...
[ "0.6920768", "0.67485434", "0.672814", "0.67200446", "0.67033076", "0.66947705", "0.66855234", "0.66835487", "0.66795", "0.66595215", "0.66486245", "0.6629216", "0.6628796", "0.65961623", "0.65886146", "0.65642726", "0.65103817", "0.65065646", "0.64859295", "0.6476302", "0.64...
0.7600064
0
delete the default shipment and create split shipments out of it
def split_shipment! self.shipments.destroy_all units = self.inventory_units.includes(:variant=>:product) units.group_by{|u| u.variant.product.brand_id}.each do |brand_id,units| s = Spree::Shipment.create!({ :order => self, :shipping_method => shipping_method, :address => self.ship_address, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_shippment(items)\n fill_boxes(items)\n shippment_object\n make_json_object\n end", "def shipped\n \n end", "def create_shipment!\n shipping_method(true)\n\n if shipment.present?\n shipment.update_attributes!(:shipping_method => shipping_method)\n else\n self.shipmen...
[ "0.61928374", "0.59945863", "0.59641236", "0.58702356", "0.5850442", "0.576921", "0.5718929", "0.57001406", "0.56667674", "0.5660817", "0.56591797", "0.56439507", "0.56239814", "0.5610756", "0.55948067", "0.55864877", "0.5574602", "0.5569819", "0.5567483", "0.5567483", "0.555...
0.6811934
0
Method combines First name, Middle name & Last name and returns Full Name of Contact
def full_name return Contact.generate_full_name self.first_name, self.middel_name, self.last_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_name\n \"#{first_name} #{middle_name} #{last_name}\".split.join(' ')\n end", "def full_name\n name = first_name.strip # required\n name << \" #{middle_name.strip}\" if !middle_name.nil?\n name << \" #{last_name.strip}\" # required\n name << \" #{mother_last_name.s...
[ "0.82870626", "0.8255562", "0.821288", "0.81470543", "0.8136675", "0.81085455", "0.8104215", "0.8104215", "0.80901086", "0.80901086", "0.80901086", "0.80901086", "0.80901086", "0.8088031", "0.8088031", "0.8088031", "0.8088031", "0.8088031", "0.8088031", "0.80834216", "0.80793...
0.83620644
0
Method returns the top connector status of Contact
def is_top_connector? TopConnector.exists? :contact_id => self.id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status\n @connections.status\n end", "def connection_status\n \t@current_connection = ConnectionInfo.where(\"disconnected_at is null\").first\n end", "def connector_type\n cable.connector_types[self.end - 1]\n end", "def getConnectorStart()\n\t\tif @roomConnectors.length() > 0\n\t\t\treturn @ro...
[ "0.6166162", "0.5930187", "0.571587", "0.565967", "0.5516205", "0.5496794", "0.541558", "0.5384492", "0.5379278", "0.5327636", "0.5326426", "0.5294457", "0.52766067", "0.52710396", "0.52410865", "0.5230667", "0.5228206", "0.5219499", "0.52187765", "0.52187765", "0.52187765", ...
0.7028141
0
Method validates a Contact for Manual Update
def validated_for_update?(c) valid = true if first_name.blank? && last_name.blank? c.errors.add_to_base("Must enter contact name") valid = false end ex_email = Contact.find(:first, :include => [:emails], :conditions => ["emails.email_text = ? AND contacts.user_id = ? AND contacts.id != ? AND...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate\n validates_contact\n end", "def validate\n if !new_record? && current?\n errors.add('contact_name', 'Please provide a contact name for your enquiry') unless contact_name.present?\n errors.add('contact_phone', 'Please provide a phone number where we may contact you at about your enq...
[ "0.70229536", "0.63903046", "0.6388088", "0.6354135", "0.6290593", "0.62462604", "0.6065871", "0.60438716", "0.60438716", "0.60438716", "0.6012076", "0.5992357", "0.5966696", "0.5943815", "0.59399045", "0.5924662", "0.5907218", "0.59043497", "0.58974147", "0.5894543", "0.5870...
0.7387179
0
Method Returns Collection of Contacts that are suspected as duplicates in the Merge but not Merged. THis scenario does not occur now.
def duplicates Contact.find(:all, :conditions => ["id != ? AND merge_id = ?", id, merge_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge(contacts_with_dupes)\n group_by_email(contacts_with_dupes).flat_map do |_, contacts|\n contacts.sort_by! { |c| c[:date_added] }\n\n contacts.first.tap do |merged|\n contacts[1..-1].each do |newer|\n merged.keys.each do |key|\n merged[key] = newer[key] unless newer[...
[ "0.642129", "0.63884264", "0.6226378", "0.62016684", "0.6129265", "0.6113292", "0.59946615", "0.5966752", "0.59532094", "0.5919953", "0.5893186", "0.580054", "0.57838774", "0.57540345", "0.5693528", "0.5678384", "0.5638158", "0.56254077", "0.56212527", "0.56030095", "0.558354...
0.7821992
0
Method To Unmerge Contact
def un_merge Contact.transaction do self.parents.each do |contact| contact.update_attribute('merged_to_form_contact_id', 0) if contact.contact_type == Constants::CONTACT_TYPE::PROSPECT ContactProspect.update_all("prospect_old_id = NULL, prospect_id = #{contact.id}", "prospect_old_id ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_tag_from_contact\n\t\t\t\t# unlike the remove method in account, this only removes the tag from one contact\n\t\t\t\t\n\t\t\tend", "def unlink_contact(_contact)\n _rc = false\n if self.contacts.detect { |c| c._id ==_contact._id }\n _facility = self.facilities.any_in(consumer_ids: [_contact....
[ "0.6606985", "0.65824574", "0.63902843", "0.63557243", "0.6297876", "0.6173803", "0.6135985", "0.61075574", "0.6054319", "0.6038812", "0.6034099", "0.6012317", "0.60014975", "0.5994348", "0.5992247", "0.5987092", "0.5949446", "0.5891389", "0.5891389", "0.5889042", "0.58774173...
0.78927857
0
def set_company(company_name) if self.valid? unless company_name.nil? company_name = company_name.strip unless company_name.blank? company = Company.find_or_create_by_name company_name self.company_id = company.id self.company_name = company.name end end end end
def update_company company_name if self.valid? unless company_name.nil? company_name = company_name.strip if company_name.blank? self.company_id = 0 self.company_name = '' else company = Company.find_or_create_by_name company_name unless company....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_company_name\n @company_name = CompanyName.find(params[:id])\n end", "def company=(company)\n super(Company.find_or_create_by_name(company))\n end", "def company_name=(company_name)\n if !company_name.nil? && company_name.to_s.length < 0\n fail ArgumentError, 'invalid value for ...
[ "0.8134257", "0.80279374", "0.7890128", "0.77635014", "0.7657602", "0.762966", "0.7577724", "0.75354016", "0.751264", "0.751264", "0.7444966", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183",...
0.87759185
0
Save titles for contact
def save_contact_titles(positions) title_str= '' positions.each_with_index do |position, index| if position.is_current == 'true' company = Company.find_or_create_by_name(position.company.name) title = self.titles.build(:position => position.title, :company_id => company.id) title_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sync_titles\n # Title was submitted\n if self.title.blank?\n self.title = get_title_from_chartup(chartup) || 'Untitled'\n else\n set_chartup_title(self.title)\n end\n end", "def set_saved_title\n @saved_title = SavedTitle.find(params[:id])\n end", "def contact\n @title = \...
[ "0.6404645", "0.6220932", "0.61893195", "0.6028167", "0.59328157", "0.59262687", "0.5821474", "0.5804921", "0.5788068", "0.57827574", "0.5780047", "0.57742757", "0.5755893", "0.57304657", "0.5717839", "0.57167625", "0.57158715", "0.5715551", "0.57153976", "0.57029545", "0.569...
0.75141835
0
GET /transferences GET /transferences.json
def index @transferences = Transference.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_transference\n @transference = Transference.find(params[:id])\n end", "def transactions\n JSON.parse(response.body).fetch('transactions')\n end", "def create\n @transference = Transference.new(transference_params)\n\n respond_to do |format|\n if @transference.save\n fo...
[ "0.6027824", "0.58282536", "0.5787434", "0.5720145", "0.56887525", "0.5670672", "0.5624934", "0.5548853", "0.55383706", "0.55295706", "0.55247754", "0.5511844", "0.54960746", "0.54903936", "0.5475591", "0.5474376", "0.5460736", "0.5454536", "0.5454448", "0.5433533", "0.542978...
0.72812235
0
POST /transferences POST /transferences.json
def create @transference = Transference.new(transference_params) respond_to do |format| if @transference.save format.html { redirect_to @transference, notice: 'Transference was successfully created.' } format.json { render :show, status: :created, location: @transference } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transference_params\n params.require(:transference).permit(:new_cost_center, :old_cost_center, :cost_center_id, :status, :who_ask, :user_id, :collaborator, :new_branch, :old_branch, :branch_id, :new_company, :old_company, :company_id, :tranference_date, :old_city, :new_city)\n end", "def index\n @...
[ "0.62170047", "0.61825293", "0.6021567", "0.561041", "0.5511341", "0.54670703", "0.5454508", "0.54189974", "0.5406838", "0.539899", "0.5358836", "0.5324159", "0.530877", "0.5215243", "0.5215243", "0.5204153", "0.5180949", "0.5165129", "0.5126005", "0.51137674", "0.50988257", ...
0.72675544
0
PATCH/PUT /transferences/1 PATCH/PUT /transferences/1.json
def update respond_to do |format| if @transference.update(transference_params) format.html { redirect_to @transference, notice: 'Transference was successfully updated.' } format.json { render :show, status: :ok, location: @transference } else format.html { render :edit } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n authorize @trip\n\n\n @trip.estimated_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @trip.destination\n req.expense_type = 'estimated'\n end\n end\n\n respond_to do |format|\...
[ "0.60052466", "0.59662753", "0.59576494", "0.595488", "0.5945739", "0.5938819", "0.5918057", "0.5913815", "0.59122485", "0.5873087", "0.5837971", "0.5808703", "0.5807274", "0.5806339", "0.5800243", "0.57868665", "0.5785557", "0.57833064", "0.5779331", "0.5774113", "0.57385", ...
0.6791676
0
DELETE /transferences/1 DELETE /transferences/1.json
def destroy @transference.destroy respond_to do |format| format.html { redirect_to transferences_url, notice: 'Transference was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @translantion = Translantion.find(params[:id])\n @translantion.destroy\n\n respond_to do |format|\n format.html { redirect_to translantions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaccion = Transaccion.find(params[:id])\n @transaccion....
[ "0.7317299", "0.72046584", "0.7103289", "0.6990557", "0.69714916", "0.6968919", "0.6953228", "0.6951607", "0.6949724", "0.69459254", "0.6942211", "0.6932132", "0.6932132", "0.6932132", "0.6932132", "0.6932132", "0.6932132", "0.6932132", "0.6932132", "0.69275266", "0.69117737"...
0.77265006
0
Amazon's description: > Call the CloseOrderReference operation to indicate that a previously > confirmed order reference has been fulfilled (fully or partially) and that > you do not expect to create any new authorizations on this order > reference. You can still capture funds against open authorizations on the > order...
def close_order_reference client.close_order_reference(@amazon_order_reference_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_order_reference(\n amazon_order_reference_id,\n closure_reason: nil,\n merchant_id: @merchant_id,\n mws_auth_token: nil\n )\n\n parameters = {\n 'Action' => 'CloseOrderReference',\n 'SellerId' => merchant_id,\n 'AmazonOrderReferenceId' => amazon_order_refe...
[ "0.852008", "0.6932497", "0.672758", "0.62557137", "0.6145952", "0.5993691", "0.5891179", "0.57508147", "0.5582657", "0.55144054", "0.54654205", "0.5318896", "0.5312864", "0.5292023", "0.5285824", "0.5243086", "0.5227629", "0.521219", "0.5211484", "0.5185712", "0.51652986", ...
0.8556126
1
Perform a key lookup in the registered data tables
def table_lookup(key, arg, table = nil) lookup_key = key[1..-1].to_sym lookup_table = table || @tables[lookup_key] if lookup_table.kind_of? Hash lookup_table[arg.to_sym] elsif lookup_table.kind_of? Array if lookup_table.member? arg or lookup_table.member? arg.t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lookup(key=nil)\n silo = self.lookup_silo_name\n dict = nil\n ActiveRecord::Base.benchmark(\"Lookup: #{silo}#{key.ergo{'#'+to_s}}\") do\n dict = self.fetch_object(silo){\n # FIXME Exceptions within this block are silently swallowed by something. This is bad.\n self.find(...
[ "0.6345362", "0.6335568", "0.63058096", "0.63058096", "0.61418647", "0.60832137", "0.6055057", "0.6040019", "0.6014103", "0.5965513", "0.5963341", "0.59249365", "0.5887201", "0.58803284", "0.5870959", "0.5852537", "0.58426255", "0.5835181", "0.5835181", "0.5825391", "0.582218...
0.6834899
0
Delete tags from a learnerId Delete the specified tags from the learner. Deleting tags that do not exist will still result in a success.
def delete_learner_tags(learner_id, tags, opts = {}) delete_learner_tags_with_http_info(learner_id, tags, opts) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_learner_tags_with_http_info(learner_id, tags, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LearnerApi.delete_learner_tags ...'\n end\n # verify the required parameter 'learner_id' is set\n if learner_id.nil?\n fail Argumen...
[ "0.73326707", "0.65890735", "0.6294065", "0.62899333", "0.61576474", "0.59523106", "0.5875303", "0.58677757", "0.5840874", "0.5827503", "0.580925", "0.5808189", "0.58037084", "0.57895905", "0.57785535", "0.57701147", "0.57071227", "0.5678882", "0.5619069", "0.5599222", "0.559...
0.66478974
1
Delete tags from a learnerId Delete the specified tags from the learner. Deleting tags that do not exist will still result in a success.
def delete_learner_tags_with_http_info(learner_id, tags, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LearnerApi.delete_learner_tags ...' end # verify the required parameter 'learner_id' is set if learner_id.nil? fail ArgumentError, "Mi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_learner_tags(learner_id, tags, opts = {})\n delete_learner_tags_with_http_info(learner_id, tags, opts)\n nil\n end", "def remove_tags(tag_id)\n self.tags.destroy(tag_id)\n end", "def delete_tag(tag_id)\n @api.delete(\"#{@api.path}/List/#{@id}/Tag/#{tag_id}\")\n end", "...
[ "0.6648784", "0.6590318", "0.62957233", "0.6292301", "0.6159142", "0.5955739", "0.58766955", "0.5868921", "0.5843445", "0.5829038", "0.58123165", "0.5811391", "0.5804703", "0.5791164", "0.57814145", "0.5771185", "0.5709879", "0.56814194", "0.56203556", "0.56014305", "0.559470...
0.7333469
0