query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
GET /exercises GET /exercises.json
def index @exercises = Exercise.paginate(:page => params[:page], :per_page => 10).order('created_at DESC') respond_to do |format| format.html # index.html.erb format.json { render :json => @exercises } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end", "def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:...
[ "0.783679", "0.783679", "0.77817446", "0.75752074", "0.74295366", "0.72863555", "0.72863555", "0.7261397", "0.72165775", "0.7173775", "0.6936795", "0.6923066", "0.6891667", "0.68783736", "0.6845835", "0.68213016", "0.6779002", "0.67506135", "0.6729376", "0.66589105", "0.66108...
0.70971286
10
GET /exercises/1 GET /exercises/1.json
def show @exercise = Exercise.find(params[:id]) @groups = @current_user.groups if @current_user.valid_exercise? @exercise respond_to do |format| format.html # show.html.erb format.json { render :json => @exercise } end else redirect_to :root, :notice => "You can't see this contest" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end", "def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:...
[ "0.76870173", "0.76870173", "0.76333475", "0.7607911", "0.7484267", "0.7484267", "0.743832", "0.7418293", "0.72972757", "0.7151746", "0.7130306", "0.70675737", "0.69919556", "0.69903964", "0.6952406", "0.69257784", "0.69257784", "0.68399256", "0.6820712", "0.6820712", "0.6820...
0.0
-1
GET /exercises/new GET /exercises/new.json
def new @exercise = Exercise.new respond_to do |format| format.html # new.html.erb format.json { render :json => @exercise } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise ...
[ "0.80460995", "0.80460995", "0.80460995", "0.80460995", "0.7976122", "0.758775", "0.745661", "0.7445238", "0.73545176", "0.7348174", "0.72896", "0.72124213", "0.71821404", "0.7179046", "0.7167674", "0.7153269", "0.710674", "0.71045464", "0.70961505", "0.70467615", "0.7033909"...
0.78858
5
POST /exercises POST /exercises.json
def create @exercise = Exercise.new(params[:exercise]) respond_to do |format| if @exercise.save flash[:class] = "alert alert-success" format.html { redirect_to @exercise, :notice => 'exercise was successfully created.' } format.json { render :json => @exercise, :status => :created, :location => @exercise } else format.html { render :action => "new" } format.json { render :json => @exercise.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @api_v1_exercise = Api::V1::Exercise.new(api_v1_exercise_params)\n\n respond_to do |format|\n if @api_v1_exercise.save\n format.html { redirect_to @api_v1_exercise, notice: 'Exercise was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1...
[ "0.7109185", "0.70962274", "0.70019597", "0.69918406", "0.6982696", "0.6879251", "0.6862878", "0.6811362", "0.66803247", "0.6631677", "0.6548024", "0.6527623", "0.6509552", "0.6453499", "0.6453499", "0.6453499", "0.6453499", "0.64214003", "0.64120775", "0.6391337", "0.6391195...
0.6856047
7
PUT /exercises/1 PUT /exercises/1.json
def update @exercise = Exercise.find(params[:id]) respond_to do |format| if @exercise.update_attributes(params[:exercise]) flash[:class] = "alert alert-success" format.html { redirect_to @exercise, :notice => 'exercise was successfully updated.' } format.json { head :no_content } else format.html { render :action => "edit" } format.json { render :json => @exercise.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @api_v1_exercise.update(api_v1_exercise_params)\n format.html { redirect_to @api_v1_exercise, notice: 'Exercise was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_exercise }\n else\n format.html { rend...
[ "0.7324663", "0.71539116", "0.71102846", "0.71102846", "0.71102846", "0.7029578", "0.689915", "0.689915", "0.6848897", "0.6848897", "0.68465215", "0.68130237", "0.6654643", "0.65024143", "0.6470328", "0.6429307", "0.63886136", "0.6323429", "0.63222635", "0.63118863", "0.63048...
0.69560796
6
DELETE /exercises/1 DELETE /exercises/1.json
def destroy @exercise = Exercise.find(params[:id]) @exercise.destroy respond_to do |format| format.html { redirect_to exercises_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @api_v1_exercise.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.htm...
[ "0.79378635", "0.79288936", "0.79288936", "0.7713915", "0.7685438", "0.76078516", "0.76078516", "0.76063395", "0.76054764", "0.75452346", "0.75288355", "0.74851006", "0.74347275", "0.74320525", "0.7387946", "0.7319115", "0.72717196", "0.72684777", "0.7254346", "0.72319186", "...
0.7903338
6
Permet d'initialiser les joueurs
def initialize(player_name) @name = player_name.to_s @life_points = 10 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initTableaux\n @meilleursJoueursScore = [[],[],[]]\n for i in 1..4\n @meilleursJoueursScore.push([])\n for j in 0..4\n @meilleursJoueursScore[i][j]=0\n end\n end\n @meilleursJoueursPseudo = [[],[],[]]\n for i in 1..4\n @meilleursJoueursPseudo.push([])\n for j in 0...
[ "0.6905259", "0.6690974", "0.6602307", "0.63684464", "0.62038183", "0.61731565", "0.6159223", "0.6113889", "0.6084365", "0.60441357", "0.60441357", "0.60151714", "0.5966624", "0.5945264", "0.593643", "0.59147584", "0.5903716", "0.5903069", "0.58777255", "0.58740985", "0.58740...
0.0
-1
Affiche les points de vie d'un joueur
def show_state puts "#{@name} à #{@life_points} points de vie" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def points; end", "def points()\n\t\t\tfilter()\n\t\t\treturn @points_floor + @points_ceil.reverse\n\t\tend", "def points\n []\n end", "def points\n -1\n end", "def points\n 1\n end", "def points\n @results.inject(0.0) { |t, r| t += r.points }\n end", "def points #:nodoc:\n ...
[ "0.7395904", "0.6786394", "0.6730683", "0.6723258", "0.66966563", "0.658182", "0.65802276", "0.65802276", "0.6475862", "0.64580804", "0.64144397", "0.6268341", "0.6258314", "0.6258314", "0.62553966", "0.62353957", "0.6224816", "0.6212377", "0.6212377", "0.6198464", "0.6115408...
0.0
-1
Initialise la fonction d'attaque
def attacks(player) puts "#{@name} attaque #{player.name} !" damage = compute_damage player.gets_damage(damage) if player.life_points > 0 puts "#{@name} lui inflige #{damage} points de dommage.\n\n" else puts "Oups, #{player.name} c'est fait décapité...\n\n" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize() # Metodo construtor\r\n \t@caixas = [0,0,0,0,0]\r\n\tend", "def initialize(at_init)\n @at_init = at_init.to_s # quelquefois, on envoie un nombre (annulation)\n parse\n end", "def initialize(ciclos, lupula, cebada, mezcla, levadura)\n\n @ciclos = ciclos\n @almacen = Almacen.new(...
[ "0.64770067", "0.6460148", "0.6343408", "0.6319056", "0.6155767", "0.61547714", "0.61508876", "0.6132148", "0.6132148", "0.6132148", "0.6132148", "0.61246896", "0.6066526", "0.60647357", "0.6059331", "0.6042987", "0.596809", "0.59385157", "0.5935281", "0.5919208", "0.5919208"...
0.0
-1
Initializes the reverse TCP handler and ads the options that are required for all reverse TCP payloads, like local host and local port.
def initialize(info = {}) super # XXX: Not supported by all modules register_advanced_options( [ OptAddress.new( 'ReverseListenerBindAddress', [ false, 'The specific IP address to bind to on the local system' ] ), OptBool.new( 'ReverseListenerThreaded', [ true, 'Handle every connection in a new thread (experimental)', false ] ) ] + Msf::Opt::stager_retry_options, Msf::Handler::ReverseTcp ) self.conn_threads = [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(*args)\n super\n register_advanced_options([ OptString.new('PayloadBindPort', [false, 'Port to bind reverse tcp socket to on target system.']) ], self.class)\n end", "def initialize(info = {})\n super\n\n register_options(\n [\n Opt::LHOST,\n Opt::LPORT(4444)\n ...
[ "0.7051749", "0.68686384", "0.66140634", "0.6449245", "0.613122", "0.6022586", "0.5908058", "0.5879022", "0.5864022", "0.5864022", "0.5852761", "0.58474207", "0.5835213", "0.5826105", "0.57121617", "0.5705926", "0.5696336", "0.5680529", "0.5626633", "0.5602641", "0.55915433",...
0.6791222
2
Closes the listener socket if one was created.
def cleanup_handler stop_handler # Kill any remaining handle_connection threads that might # be hanging around conn_threads.each do |thr| begin thr.kill rescue nil end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close\n @socket.close unless closed?\n end", "def close\n @socket.close if @socket\n end", "def close\n @socket.close if @socket\n @socket = nil\n end", "def close\n if @socket\n @socket.close\n @socket = nil\n end\n end", "def close\n ...
[ "0.7537935", "0.75271004", "0.74639684", "0.74506307", "0.74506307", "0.7415628", "0.7396619", "0.7334758", "0.72950494", "0.72950494", "0.72692597", "0.7240079", "0.7171701", "0.7104085", "0.7103169", "0.7079316", "0.7044943", "0.7044702", "0.7017634", "0.70102155", "0.69851...
0.0
-1
A string suitable for displaying to the user
def human_name "reverse TCP" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_string(options, object, length = nil)\n \":#{object}\"\n end", "def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end", "def to_s\n render().join \"\\n\"\n end", "def to_s\n Alf::Renderer.text(self).execute(\"\"...
[ "0.7143428", "0.6978515", "0.6970994", "0.6902787", "0.6883123", "0.6868609", "0.6845904", "0.6808934", "0.6791878", "0.6788074", "0.67876154", "0.67875713", "0.6786277", "0.6786277", "0.6786277", "0.6786277", "0.67828447", "0.677699", "0.6754529", "0.674938", "0.67454743", ...
0.0
-1
A URI describing what the payload is configured to use for transport
def payload_uri addr = datastore['LHOST'] uri_host = Rex::Socket.is_ipv6?(addr) ? "[#{addr}]" : addr "tcp://#{uri_host}:#{datastore['LPORT']}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uri_endpoint\n URI( self.endpoint )\n end", "def endpoint\n \"#{@scheme}://#{@host}#{@path}\"\n end", "def uri\n \"http://#{hostname}:#{port}#{path}\"\n end", "def uri\n uri_for({}, nil)\n end", "def uri\n URI::Generic.build(host: addr, port: port)\n end", ...
[ "0.7325379", "0.7067541", "0.69362664", "0.68755907", "0.6833908", "0.6833908", "0.6822668", "0.68175066", "0.6815521", "0.6815521", "0.6805717", "0.678122", "0.678122", "0.678122", "0.678122", "0.678122", "0.678122", "0.678122", "0.678122", "0.678122", "0.678122", "0.67812...
0.68975073
3
A URI describing where we are listening
def listener_uri(addr = datastore['ReverseListenerBindAddress']) addr = datastore['LHOST'] if addr.nil? || addr.empty? uri_host = Rex::Socket.is_ipv6?(addr) ? "[#{addr}]" : addr "tcp://#{uri_host}:#{bind_port}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uri(location, options={})\n ops = resolve_defaults(options)\n @listener.register(location, ops[:handler], ops[:in_front])\n end", "def listener_uri(addr = datastore['ReverseListenerBindAddress'])\n addr = datastore['LHOST'] if addr.nil? || addr.empty?\n uri_host = Rex::Socket.is_ipv6?(addr...
[ "0.7068179", "0.6658383", "0.65697294", "0.64794505", "0.6290014", "0.6240302", "0.6240302", "0.6240302", "0.62150824", "0.6081083", "0.60782856", "0.60782856", "0.6043254", "0.6019149", "0.60067594", "0.5982672", "0.5982672", "0.5911158", "0.5911158", "0.5911158", "0.5911158...
0.7039041
1
Starts monitoring for an inbound connection.
def start_handler queue = ::Queue.new local_port = bind_port handler_name = "ReverseTcpHandlerListener-#{local_port}" self.listener_thread = framework.threads.spawn(handler_name, false, queue) { |lqueue| loop do # Accept a client connection begin client = listener_sock.accept if client self.pending_connections += 1 lqueue.push(client) end rescue Errno::ENOTCONN nil rescue StandardError => e wlog [ "#{handler_name}: Exception raised during listener accept: #{e.class}", $ERROR_INFO.to_s, $ERROR_POSITION.join("\n") ].join("\n") end end } worker_name = "ReverseTcpHandlerWorker-#{local_port}" self.handler_thread = framework.threads.spawn(worker_name, false, queue) { |cqueue| loop do begin client = cqueue.pop unless client elog("#{worker_name}: Queue returned an empty result, exiting...") end # Timeout and datastore options need to be passed through to the client opts = { datastore: datastore, expiration: datastore['SessionExpirationTimeout'].to_i, comm_timeout: datastore['SessionCommunicationTimeout'].to_i, retry_total: datastore['SessionRetryTotal'].to_i, retry_wait: datastore['SessionRetryWait'].to_i } if datastore['ReverseListenerThreaded'] thread_name = "#{worker_name}-#{client.peerhost}" conn_threads << framework.threads.spawn(thread_name, false, client) do |client_copy| handle_connection(wrap_aes_socket(client_copy), opts) end else handle_connection(wrap_aes_socket(client), opts) end rescue StandardError => e elog('Exception raised from handle_connection', error: e) end end } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_monitoring_connection\n @connection_monitor_thread ||= Thread.new{monitor_connection}\n @connection_monitor_thread.abort_on_exception = true\n end", "def start\n while @mStatus <= 0\n connect\n monitor\n sleep 5\n end\n end", "def start()\n #start listening\n...
[ "0.7127821", "0.6537719", "0.6303413", "0.6227494", "0.6199862", "0.6177123", "0.61248994", "0.5987855", "0.58710474", "0.57403034", "0.5734516", "0.5710067", "0.5686743", "0.5679955", "0.5659746", "0.5648756", "0.563604", "0.56200635", "0.561724", "0.5589407", "0.552557", ...
0.0
-1
Stops monitoring for an inbound connection.
def stop_handler # Terminate the listener thread listener_thread.kill if listener_thread && listener_thread.alive? == true # Terminate the handler thread handler_thread.kill if handler_thread && handler_thread.alive? == true begin listener_sock.close if listener_sock rescue IOError # Ignore if it's listening on a dead session dlog("IOError closing listener sock; listening on dead session?", LEV_1) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disconnect()\n @connection.stop()\n @timer.stop()\n @broadcast.stop()\n end", "def disconnect!\n context.with_connection do |connection|\n connection.disconnect!\n end\n @monitor.stop! and true\n end", "def close\n stop_mon...
[ "0.6537387", "0.65260106", "0.64852804", "0.6484103", "0.64126724", "0.6323893", "0.62988794", "0.61819345", "0.61819345", "0.61819345", "0.615664", "0.5959128", "0.58726543", "0.5813472", "0.574481", "0.5726481", "0.57257944", "0.57007384", "0.56981146", "0.56845814", "0.567...
0.0
-1
GET /photos GET /photos.json
def index @photos = Photo.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def photos options={}\n response = client.get(\"/#{id}/photos\", options)\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BAS...
[ "0.8192671", "0.8084962", "0.7820687", "0.7662806", "0.76157993", "0.7597941", "0.7566764", "0.75608486", "0.7540451", "0.75032324", "0.7496815", "0.7360214", "0.7275886", "0.7223893", "0.72033954", "0.713234", "0.7127612", "0.7124163", "0.7120244", "0.7060392", "0.7055266", ...
0.6784411
77
GET /photos/1 GET /photos/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @ph...
[ "0.84863234", "0.7777037", "0.7566973", "0.7507857", "0.7482775", "0.742858", "0.73779064", "0.73423064", "0.73400605", "0.73322564", "0.73005956", "0.7280408", "0.725952", "0.7259299", "0.7214884", "0.719664", "0.719664", "0.719664", "0.719664", "0.719664", "0.719664", "0....
0.0
-1
POST /photos POST /photos.json
def create # This path within filesystem to which uploaded # file will be copied. Server can not write to # assets directory directory = "public/staging" # grab the ActionDispath::Http:UploadedFile object file = params[:photo][:file] # orig_name = file.original_filename # This is "path" for image per image_tag and asset # naming policy @image="/staging/#{orig_name}" if request.post? path = File.join(directory, orig_name) # copy tmp file into public FileUtils.copy(file.tempfile.path, path) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @photos = Photo.new(photos_params)\n if @photos.save\n render json: { id: @photos.id, url: @photos.gallery.url,\n size: @photos.gallery_file_size }\n else\n render json: { id: nil }\n end\n end", "def create\n @photo = Photo.new(photo_params)\n\n if @...
[ "0.7361035", "0.7185209", "0.6947464", "0.6922178", "0.6897456", "0.6851186", "0.66842484", "0.6675465", "0.66148436", "0.66095084", "0.6601552", "0.65587986", "0.6548897", "0.6548897", "0.6548897", "0.6548897", "0.6548897", "0.6544014", "0.64769965", "0.6464411", "0.6464411"...
0.0
-1
PATCH/PUT /photos/1 PATCH/PUT /photos/1.json
def update respond_to do |format| if @photo.update(photo_params) format.html { redirect_to @photo, notice: 'Photo was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @photo.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n puts y params['photo'].keys\n params['photo'].keys.each do |photo_id|\n photo = Photo.find(photo_id)\n photo.update_attributes(params['photo'][photo_id])\n end\n respond_to do |format|\n if true \n format.html { redirect_to photos_path, notice: 'Photos were successful...
[ "0.7049965", "0.6752749", "0.6740446", "0.67135185", "0.671254", "0.66867554", "0.66847605", "0.66847605", "0.66847605", "0.66847605", "0.66843224", "0.66707134", "0.66707134", "0.66707134", "0.66707134", "0.66707134", "0.66707134", "0.6667143", "0.6663248", "0.6657235", "0.6...
0.6510243
27
DELETE /photos/1 DELETE /photos/1.json
def destroy @photo.destroy respond_to do |format| format.html { redirect_to photos_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.ht...
[ "0.7743858", "0.7743858", "0.7743858", "0.7743858", "0.7743858", "0.7743858", "0.77150726", "0.77150726", "0.77150726", "0.77150726", "0.77150726", "0.77036476", "0.7683938", "0.7666516", "0.7651935", "0.7651935", "0.76373297", "0.75912905", "0.7588815", "0.7573956", "0.75101...
0.7664305
15
Use callbacks to share common setup or constraints between actions.
def set_photo @photo = Photo.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
def login session[:merchant_id] = 1 redirect_to '/products/index' end def logout session[:merchant_id] = nil redirect_to root_path end
def destroy session[:merchant_id] = nil redirect_to root_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cart_login\n unless @customer\n session[:redirect_to] = {\n :controller=>params[:controller],\n :action=>params[:action],\n :id=>params[:id]\n }\n redirect_to :controller=>'customer', :action=>'login'\n return false\n end\n end", "def auth_merchant\n unles...
[ "0.7686211", "0.76116234", "0.7477758", "0.73604983", "0.7119554", "0.6992907", "0.69868195", "0.69531965", "0.68408424", "0.6828867", "0.6812733", "0.67784804", "0.67595863", "0.67511255", "0.6749648", "0.6746092", "0.67373925", "0.6720976", "0.66721517", "0.66711617", "0.66...
0.70415086
5
Save record that user visited this country
def visit_country self.user_countries.create!(user_id: self.visitor_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visited\n self.visited_at = Time.now\n self.save!\n end", "def update\r\n @country = Country.find(params[:id])\r\n\r\n respond_to do |format|\r\n if\r\n case\r\n\t when params[:visited]\r\n\t\t unless @user.countries.include?(@country)\r\n\t\t\t @user.countrie...
[ "0.6624323", "0.6616378", "0.6532649", "0.6506247", "0.65031755", "0.62527263", "0.61437446", "0.5997392", "0.583226", "0.58318615", "0.5689034", "0.5671381", "0.5647143", "0.5634113", "0.5617625", "0.56017053", "0.5578527", "0.5572745", "0.55164605", "0.5498923", "0.5498923"...
0.6979638
0
here will be your CLI! it is not an AR class so you need to add attr
def run @user = "" welcome login_or_signup say_hi_to_user initial_menu end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attr; end", "def attr(name); end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def...
[ "0.65184337", "0.63212156", "0.61969703", "0.61969703", "0.61969703", "0.61969703", "0.61969703", "0.61969703", "0.61969703", "0.6149753", "0.6149753", "0.6149753", "0.6149753", "0.6149753", "0.6149753", "0.6149753", "0.6149753", "0.6149753", "0.6149753", "0.6149753", "0.6065...
0.0
-1
GET /enrolled_scores/1 GET /enrolled_scores/1.json
def show @enrolled_score = EnrolledScore.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render :json => @enrolled_score } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @enrolled_score = EnrolledScore.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @enrolled_score }\n end\n end", "def index\n @scores = Score.all\n\n respond_to do |format|\n format.html # index.html.erb\n form...
[ "0.7364148", "0.713677", "0.70864064", "0.6824758", "0.675787", "0.6751253", "0.6751253", "0.6747894", "0.6723467", "0.6696465", "0.6679241", "0.66767514", "0.6645658", "0.6629436", "0.65871304", "0.65810555", "0.65552485", "0.65534526", "0.65534526", "0.65534526", "0.652552"...
0.79492754
0
GET /enrolled_scores/new GET /enrolled_scores/new.json
def new @enrolled_score = EnrolledScore.new respond_to do |format| format.html # new.html.erb format.json { render :json => @enrolled_score } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @score = Score.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @score }\n end\n end", "def new\n @score = Score.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @score }\n end\n end"...
[ "0.7724893", "0.7724893", "0.7653757", "0.75568426", "0.75476986", "0.74960244", "0.72854", "0.72817767", "0.7274524", "0.7193825", "0.7137036", "0.71213657", "0.7111504", "0.7076221", "0.7067663", "0.7067663", "0.70469695", "0.70456177", "0.70261896", "0.6998579", "0.6982083...
0.8289539
0
POST /enrolled_scores POST /enrolled_scores.json
def create @enrolled_score = EnrolledScore.new(params[:enrolled_score]) respond_to do |format| if @enrolled_score.save format.html { redirect_to @enrolled_score, :notice => t('selecao_admin.flash_messages.successfully_created', :model => @enrolled_score.class.model_name.human) } format.json { render :json => @enrolled_score, :status => :created, :location => @enrolled_score } else format.html { render :action => "new" } format.json { render :json => @enrolled_score.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n score = current_user.scores.new(score_params)\n\n if score.save\n render json: score\n else\n render json: { errors: score.errors.join(',') }, status: 422\n end\n end", "def new\n @enrolled_score = EnrolledScore.new\n \n respond_to do |format|\n format.html #...
[ "0.72698176", "0.70734835", "0.6950084", "0.6886128", "0.68583757", "0.67395294", "0.67395294", "0.6681131", "0.6654938", "0.6654938", "0.66040945", "0.65855503", "0.65548396", "0.65105915", "0.6498581", "0.6495733", "0.6434336", "0.6415318", "0.6405162", "0.6282225", "0.6257...
0.7669158
0
PUT /enrolled_scores/1 PUT /enrolled_scores/1.json
def update @enrolled_score = EnrolledScore.find(params[:id]) respond_to do |format| if @enrolled_score.update_attributes(params[:enrolled_score]) format.html { redirect_to @enrolled_score, :notice => t('selecao_admin.flash_messages.successfully_updated', :model => @enrolled_score.class.model_name.human) } format.json { head :no_content } else format.html { render :action => "edit" } format.json { render :json => @enrolled_score.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_score\n question_params = params.require(:question).permit(:id, :score)\n\n render json: Question.update_score(question_params)\n end", "def update\n @score = Score.find(params[:id])\n\n respond_to do |format|\n if @score.update_attributes(params[:score])\n format.ht...
[ "0.7013944", "0.68859345", "0.68859345", "0.68859345", "0.6808532", "0.67891353", "0.67891353", "0.67891353", "0.67891353", "0.67533666", "0.671632", "0.6694003", "0.6692928", "0.6582246", "0.65721697", "0.65700793", "0.6567353", "0.6558193", "0.6521755", "0.6455358", "0.6434...
0.75799346
0
DELETE /enrolled_scores/1 DELETE /enrolled_scores/1.json
def destroy @enrolled_score = EnrolledScore.find(params[:id]) @enrolled_score.destroy respond_to do |format| format.html { redirect_to enrolled_scores_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @score.destroy\n respond_to do |format|\n format.html { redirect_to scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @score = Score.find(params[:id])\n @score.destroy\n\n respond_to do |format|\n format.html { redirect_to scores_url }\n ...
[ "0.75194716", "0.7400891", "0.7400891", "0.7400891", "0.7400891", "0.73859453", "0.73463345", "0.7313429", "0.7271169", "0.7227591", "0.7227591", "0.7227591", "0.7227591", "0.71666104", "0.71637857", "0.71455", "0.712116", "0.71194524", "0.71194524", "0.7104779", "0.7093619",...
0.77627677
0
override to pass around locale in URL
def default_url_options(options={}) logger.debug "default_url_options is passed options: #{options.inspect}\n" { :locale => I18n.locale } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link_with_locale(url)\n params.to_unsafe_h.include?('locale') ? \"#{url}?locale=#{I18n.locale}\" : url\n end", "def apply_locale; end", "def locale_switch_link(language)\n path = request.original_fullpath\n if params.to_unsafe_h.include? 'locale'\n path.gsub(%r{locale=#{I18n.locale}}, \"loca...
[ "0.8036451", "0.77054614", "0.7615752", "0.7599427", "0.74672794", "0.74232954", "0.7418797", "0.7369942", "0.73274446", "0.7310437", "0.7286583", "0.72471935", "0.72365606", "0.72263676", "0.7208749", "0.7208749", "0.7207714", "0.7194668", "0.7178869", "0.7157127", "0.708332...
0.0
-1
Rreturns the "raw" ruby hash that is returned by the solr ruby response writer. This is mostly for debugging purposes
def raw_response @raw_response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_r()\n #This is a stub, used for indexing\n end", "def raw\n results\n end", "def raw\n @raw ||= Hashie::Mash.new(@raw_plain)\n end", "def to_json_raw_object()\n #This is a stub, used for indexing\n end", "def raws\n @raws...
[ "0.6358643", "0.62891656", "0.6277915", "0.62566054", "0.62117857", "0.6204494", "0.61688954", "0.61471176", "0.60928553", "0.6083316", "0.60322994", "0.60156584", "0.5957474", "0.5947093", "0.5943808", "0.59371257", "0.5917214", "0.5917214", "0.5917214", "0.5917214", "0.5915...
0.6287385
2
Did we get some kind of valid response back from solr?
def success? !raw_response.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_raw_response_formats\n ruby_response = @solr.select(:q=>'*:*', :wt=>'ruby')\n assert ruby_response.is_a?(String)\n assert ruby_response =~ %r('wt'=>'ruby')\n # xml?\n xml_response = @solr.select(:q=>'*:*', :wt=>'xml')\n assert xml_response.is_a?(String)\n assert xml_response =~ %r(<st...
[ "0.6933756", "0.6826667", "0.6366733", "0.6313343", "0.628512", "0.6097142", "0.60822487", "0.6044353", "0.6037128", "0.601109", "0.59492934", "0.59212875", "0.591325", "0.5903227", "0.5867769", "0.5837197", "0.5834673", "0.5829921", "0.5782022", "0.57694876", "0.57681274", ...
0.5635302
33
Returns the total number of matches
def total @total ||= raw_response['response']['numFound'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matched_count\n @results[MATCHED_COUNT]\n end", "def total_count #:nodoc:\n total == 1 && !@group.nil? && @group['matches'] > 1 ? @group['matches'] : total\n end", "def return_count\n return @matchedCount\n end", "def total_matches_played\n count = 0\n\n matches.each do |match|\...
[ "0.82901007", "0.80776954", "0.7849813", "0.7797178", "0.7733856", "0.75885314", "0.75271666", "0.74795", "0.73759544", "0.7250011", "0.72131175", "0.7157691", "0.70960706", "0.70863444", "0.6987721", "0.6972723", "0.69141847", "0.6886655", "0.68537", "0.68452084", "0.6809910...
0.0
-1
Returns true if there no results
def blank? raw_response.blank? || total < 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hasResults?\n ! @results.empty?\n end", "def empty?\n self.results.empty?\n end", "def has_results?\n true\n end", "def results?() ! find(locator(:no_results_message)) end", "def nothing_found?\n @matching_documents.nil? or @matching_documents.entries.empty?\n end", ...
[ "0.84744436", "0.8451418", "0.82386595", "0.7921987", "0.7716501", "0.7706298", "0.75794435", "0.7445407", "0.7382858", "0.7337756", "0.73342586", "0.7311722", "0.72317296", "0.71836114", "0.7179955", "0.71251917", "0.7123628", "0.71051335", "0.7089195", "0.7081865", "0.70650...
0.6814806
46
Returns true if this response was pulled from the cache
def from_cache? @from_cache end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache?\n caching && true\n end", "def cacheable?(response)\n return false unless response.success?\n return false unless method.in? CACHEABLE_METHODS\n return false if header.cache_control && header.cache_control.include?('no-store')\n true\n end", "def may_cache?\n ...
[ "0.7861747", "0.7729373", "0.7553277", "0.7456046", "0.7452355", "0.7444855", "0.74419945", "0.7400149", "0.739624", "0.73956656", "0.7355506", "0.7350835", "0.7340451", "0.72834605", "0.7238636", "0.7236503", "0.72065", "0.7158383", "0.71472955", "0.7073289", "0.7073289", ...
0.7353403
11
Returns the offset that was given in the request
def offset @offset ||= raw_response['response']['start'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_offset\n @offset\n end", "def offset\n sanitize search_params['offset']\n end", "def offset()\n @offset__\n end", "def offset\n execute['offset']\n end", "def get_current_offset\n @offset < 0 ? 0 : @offset\n end", "def offset\n limit_an...
[ "0.83975756", "0.7800804", "0.7694254", "0.7447479", "0.74038315", "0.73133326", "0.730925", "0.73012954", "0.72694385", "0.7230044", "0.722516", "0.722283", "0.72023773", "0.7188196", "0.71738625", "0.70578796", "0.70578796", "0.70578796", "0.7044722", "0.69927454", "0.69457...
0.78759104
1
Returns the max score of the result set
def max_score @max_score ||= raw_response['response']['maxScore'].to_f end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max\n @raw.max_by(&:score)\n end", "def get_maximum_score()\n max_score = 0\n\n self.scores.each { |score| max_score = max_score + score.question.questionnaire.max_question_score }\n\n max_score\n end", "def highest_score\n sort\n all.first.score\n end", "def highest_score\n s...
[ "0.81702304", "0.81337494", "0.80125886", "0.79976743", "0.79252595", "0.7914158", "0.7716879", "0.7640378", "0.7635702", "0.7603991", "0.7563425", "0.7530126", "0.7330719", "0.7326194", "0.73214954", "0.7289592", "0.7270201", "0.72496164", "0.72360444", "0.7235313", "0.72141...
0.78459775
6
Returns an array of all the docs
def docs @docs ||= raw_response['response']['docs'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def docs\n @docs ||= []\n end", "def all\n include_docs!\n docs\n end", "def docs #returns string array of all documents in collection\n raise \"Must be implemented.\"\n return array_of_documents\n end", "def all; @docs.values end", "def docs\n @docs ||= ...
[ "0.8506609", "0.84213483", "0.83804363", "0.8107698", "0.80502105", "0.8047714", "0.7926224", "0.77764326", "0.7708408", "0.7634761", "0.76152265", "0.7586358", "0.7340457", "0.73344755", "0.73157185", "0.73089737", "0.73025316", "0.7271728", "0.7242812", "0.7221253", "0.7221...
0.7427923
12
Helper for displaying a given field (first tries the highlight, then the stored value)
def display_for(doc, field) highlights_for(doc['unique_id'], field) || doc[field] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def highlight(field_name)\n highlights(field_name).first\n end", "def render_field(label, value)\n render_field_content(label, (h value))\n end", "def display_field\n current_field_values_with_field_type_id(field_types.first.id).first.try(:value) || 'no display field available'\n end", "d...
[ "0.66360116", "0.65344566", "0.64229006", "0.64062375", "0.6378067", "0.63744247", "0.6296703", "0.60968494", "0.6080412", "0.60333765", "0.6029947", "0.6002301", "0.6001936", "0.5997678", "0.5971128", "0.59649956", "0.59589076", "0.59544677", "0.59321433", "0.5929533", "0.58...
0.7532586
0
Returns the highlights for a given id for a given field
def highlights_for(unique_id, field) raw_response['highlighting'] ||= {} raw_response['highlighting'][unique_id] ||= {} raw_response['highlighting'][unique_id][field] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def highlights(field_name = nil)\n if field_name.nil?\n highlights_cache.values.flatten \n else\n highlights_cache[field_name.to_sym]\n end || []\n end", "def highlight(field_name)\n highlights(field_name).first\n end", "def highlights\n @solr_data[:...
[ "0.72343576", "0.6988769", "0.66050494", "0.6603448", "0.65995955", "0.65995955", "0.65995955", "0.65439826", "0.62912464", "0.626399", "0.6263871", "0.6194471", "0.5993255", "0.58568305", "0.578976", "0.5739368", "0.5739368", "0.57009244", "0.5595658", "0.55736756", "0.54975...
0.79082835
0
Returns the query time in ms
def qtime @qtime ||= raw_response['responseHeader']['QTime'].to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_time\n @query_time ||= solr_response_header['QTime']\n end", "def query_start_time\n start_time - 1.hour\n end", "def time\n Integer(connection.write(\"get_time\", false))\n rescue ArgumentError\n 0\n end", "def time\n Integer(connection.write(\"get_ti...
[ "0.7600526", "0.7146715", "0.6846521", "0.6846521", "0.6846521", "0.66530037", "0.6624929", "0.6616107", "0.6568399", "0.65568304", "0.65524465", "0.65048677", "0.64481795", "0.64164495", "0.63695043", "0.63657445", "0.63170785", "0.63010645", "0.63010645", "0.6296276", "0.62...
0.60097265
61
Returns the status code (0 for success)
def status @status ||= raw_response['responseHeader']['status'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status_code\n STATUS_CODE\n end", "def getStatusCode\n @_statusCode\n end", "def status_code\n @response.status\n end", "def status_code\n @parser.status_code\n end", "def ok_status_code\n _undefined\n end", "def status_code\n response_value(:code)\n end", ...
[ "0.81736946", "0.79995483", "0.79879266", "0.79644084", "0.79485136", "0.7919869", "0.7877858", "0.782703", "0.7756851", "0.7756851", "0.77170295", "0.7622666", "0.76211065", "0.75552475", "0.7533311", "0.7533311", "0.7502882", "0.74981177", "0.74592346", "0.7403833", "0.7393...
0.687413
60
Returns the params hash
def params @params ||= raw_response['responseHeader']['params'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def params_to_hash\n {}\n end", "def to_h\n @params\n end", "def get_params()\n return self.params.keys\n end", "def params\n @params ||= {}\n end", "def params\n @params ||= {}\n end", "def params\n @params ||= {}\n end", "def params\n @pa...
[ "0.7996212", "0.7606688", "0.7545418", "0.7533114", "0.7533114", "0.7514495", "0.7514495", "0.7217556", "0.7210483", "0.7162941", "0.7156902", "0.7133004", "0.7077899", "0.7077899", "0.70688134", "0.7056327", "0.70452887", "0.70210683", "0.7015174", "0.6986102", "0.6974542", ...
0.0
-1
Returns the entire facet hash
def facets @facets ||= raw_response['facet_counts'] || {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def facet_map\n @facets ||= Domgen::OrderedHash.new\n end", "def facets\n @facets ||= raw[:facets]\n end", "def facet_map\n @facets ||= Reality::OrderedHash.new\n end", "def facet_json\n @facet_json ||= (self['facets'] || {}).select { |k, v| k != 'count' }\n end", "def f...
[ "0.75947857", "0.7558356", "0.75469875", "0.7227009", "0.6799414", "0.672242", "0.6700227", "0.66612697", "0.66612697", "0.6630373", "0.66186017", "0.6617633", "0.6548135", "0.6459091", "0.6406493", "0.635793", "0.6326085", "0.631624", "0.6287109", "0.62678635", "0.6200945", ...
0.6812832
4
Returns all of the facet queries
def facet_queries @facet_queries ||= facets['facet_queries'] || {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def facet_queries\n @facet_queries ||= facet_counts['facet_queries'] || {}\n end", "def facet_queries\n @facet_queries ||= facet_counts['facet_queries'] || {}\n end", "def facets\n self.facet_list.any? ? SearchFacet.where(:identifier.in => self.facet_list) : SearchFacet.visible\n end", "def facet...
[ "0.7699961", "0.7699961", "0.72593987", "0.6977772", "0.6948198", "0.68664515", "0.68663245", "0.6819633", "0.6814148", "0.67839456", "0.6762405", "0.661558", "0.65688324", "0.64851075", "0.6433383", "0.6424039", "0.6422826", "0.6400028", "0.63898635", "0.6382945", "0.6332879...
0.79379267
0
Returns an array of value/counts for a given field (ie: ['true', 123, 'false', 20]
def facet_field(field) facet_fields[field.to_s] || [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def facet_field_values(field)\n facet_field_values ||= {}\n facet_field_values[field.to_s] ||= begin\n a = []\n facet_field(field).each_with_index do |val_or_count, i|\n a << val_or_count if i % 2 == 0 && facet_field(field)[i+1] > 0\n end\n a\n en...
[ "0.74157274", "0.67636883", "0.63846666", "0.62543505", "0.62000453", "0.61635244", "0.6139715", "0.60916585", "0.60703045", "0.6066936", "0.60650957", "0.59519815", "0.5942008", "0.5937223", "0.5859856", "0.5786748", "0.57780814", "0.5776384", "0.57422227", "0.560179", "0.55...
0.5099709
65
Returns the array of field values for the given field in the order they were returned from solr
def facet_field_values(field) facet_field_values ||= {} facet_field_values[field.to_s] ||= begin a = [] facet_field(field).each_with_index do |val_or_count, i| a << val_or_count if i % 2 == 0 && facet_field(field)[i+1] > 0 end a end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def field(field)\n field = field.to_s\n result = []\n keys.sort.each do |name|\n result << self[name].get(field)\n end\n result\n end", "def [] field\n f = self.get(field)\n return nil if (f == nil)\n return f.values.to_a\n end", "def field_to_array(fi...
[ "0.7192572", "0.7118694", "0.6763858", "0.66980416", "0.66125596", "0.655609", "0.65227234", "0.6465807", "0.64163935", "0.6354185", "0.6345768", "0.6160645", "0.6131727", "0.60930157", "0.6083253", "0.6048469", "0.59683245", "0.5963907", "0.59533566", "0.59263676", "0.591202...
0.6630106
4
Returns the count for the given field/value pair
def facet_field_count(field, value) facet_fields_by_hash[field.to_s][value.to_s] if facet_fields_by_hash[field.to_s] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def field_count(field)\n return 0 if /^(\\w+)s_versions/.match?(field.to_s)\n\n # constantize is safe here because `field` is not user input\n FIELD_QUERIES[field]&.count || field.to_s.classify.constantize.count\n end", "def value_count(hash, value)\n hash.select { |_k, v| v == value }.length\nend", ...
[ "0.698522", "0.6873907", "0.6811726", "0.6738298", "0.66344357", "0.66197896", "0.6560104", "0.64770913", "0.6427973", "0.6368535", "0.6365065", "0.632001", "0.6258066", "0.62240195", "0.6157146", "0.6151686", "0.61318624", "0.60647434", "0.60407794", "0.60309434", "0.6027806...
0.7691915
0
Returns the counts for a given facet_query_name
def facet_query_count_by_key(facet_query_key) facet_queries[facet_query_key.to_s] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def facet_queries\n @facet_queries ||= facet_counts['facet_queries'] || {}\n end", "def facet_queries\n @facet_queries ||= facet_counts['facet_queries'] || {}\n end", "def results_count(query)\n refresh_elasticsearch\n Opportunity.__elasticsearch__.search(query: query[:query],\n ...
[ "0.69817835", "0.69817835", "0.68778104", "0.66933393", "0.6689976", "0.65545374", "0.6524657", "0.63777614", "0.63579404", "0.63351923", "0.6282268", "0.62799156", "0.62645364", "0.621667", "0.61970013", "0.6186021", "0.6163584", "0.6136508", "0.60974234", "0.60519683", "0.6...
0.8048948
0
Returns the url sent to solr
def request_url query_builder.request_string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solr_url\n @solr_url ||= endpoint_url.gsub(/\\/select$/, '')\n end", "def url\n \"http://127.0.0.1:#{port}/solr/\"\n end", "def solr_url(interactive = false)\n #proto = 'http'\n #host = 'junco.lib.virginia.edu'\n #port = '8080'\n #path = [\"#{proto}://#{host}:#{port}\...
[ "0.82492685", "0.7936817", "0.78816384", "0.7741377", "0.76472944", "0.7580428", "0.7425585", "0.7327176", "0.7187468", "0.71568745", "0.707513", "0.70441234", "0.70215863", "0.69254845", "0.691789", "0.69047755", "0.6898207", "0.6898207", "0.6848824", "0.6806426", "0.6806426...
0.67144024
27
and the same integer values in the same exact order
def array_equals(array1, array2) and_array = array1 && array2 if and_array == array1 && and_array == array2 return true else return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_17(val, _values)\n AST::IntegerEqual.new val.first, val.last \nend", "def equal_to_numbers(field_values = {})\n fields = {}\n \n field_values.each_pair do |field_name, v|\n bits = self.bits_for(field_name)\n fields[bits] = v if bits.length > 0\n end\n \n al...
[ "0.6159242", "0.585761", "0.5765157", "0.5712477", "0.5597186", "0.55308574", "0.54966176", "0.5495287", "0.5494517", "0.5486537", "0.54785156", "0.5408903", "0.5404704", "0.5379638", "0.53634465", "0.5340845", "0.5306288", "0.5276511", "0.52622193", "0.52535486", "0.5253087"...
0.0
-1
needed to get validations to run
def new_record? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_validations\n true\n end", "def validation; end", "def validation; end", "def validate\n \n \n end", "def validate; end", "def validate; end", "def validate; end", "def validate; end", "def validate\r\n\r\n end", "def validate\n end", "def validate!; en...
[ "0.8190892", "0.81529886", "0.81529886", "0.8027877", "0.7936746", "0.7936746", "0.7936746", "0.7936746", "0.79250276", "0.77923024", "0.77425694", "0.77425694", "0.77425694", "0.7654268", "0.7654268", "0.7654268", "0.76419175", "0.7635613", "0.76116097", "0.7478552", "0.7478...
0.0
-1
Create multiple rooms for the hotel.
def create_rooms(rooms_params) rooms_params[:extra_info] ||= "" rooms_params[:range].each do |number| rooms << Room.create( number: number.to_i, capacity: rooms_params[:capacity].to_i, extra_info: rooms_params[:extra_info], name: rooms_params[:name] ) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_hotel_rooms\n (1..20).each do |num|\n @all_rooms << num #Hotel::Room.new(num) I don't think I have to do this\n end\n end", "def create_rooms(rooms_id_array)\n if self.room_areas.empty?\n 1.upto(self.bedrooms) do \n room_area = RoomArea.new(:property_id => self.id,\n ...
[ "0.8082136", "0.7784406", "0.682074", "0.67886865", "0.6748974", "0.66174585", "0.66144365", "0.65795076", "0.65550345", "0.65462756", "0.6497435", "0.6491688", "0.64914095", "0.64692", "0.6443607", "0.6394163", "0.6339617", "0.63248146", "0.6320879", "0.6310198", "0.6309739"...
0.78060424
1
Returns the capcity of the hotel based on the sum of the capacity of its rooms
def capacity capacity = 0 rooms.all.each do |room| capacity += room.capacity end capacity end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def house_capacity\n has_reserved_seating? ? seatmap.seat_count : attributes['house_capacity']\n end", "def get_rooms_by_capacity(range_filter, room, rooms_capacity)\n range = split_string(range_filter)\n if room.capacity >= range[0].to_i && room.capacity < range[1].to_i\n rooms_capacity << room\n...
[ "0.65121174", "0.645556", "0.64078385", "0.6084425", "0.603976", "0.59885114", "0.59358305", "0.591256", "0.58992904", "0.58814365", "0.58691144", "0.5807097", "0.5793603", "0.5788157", "0.5742271", "0.57110983", "0.5663643", "0.56625175", "0.56538224", "0.5649196", "0.560322...
0.69363534
0
Returns an array with all users inside the rooms of the hotel
def users users = [] rooms.each do |room| room.users.each do |user| users << user end end users end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_all_rooms_in_hotel\n\n return @rooms.map { |room| room }\n end", "def users(*room_names)\n users = Hpricot(get.body).search(\"div.room\").collect do |room|\n if room_names.empty? || room_names.include?((room/\"h2/a\").inner_html)\n room.search(\"//li.user\").collect { |user|...
[ "0.7864", "0.7080872", "0.7049938", "0.7011431", "0.6878699", "0.6860403", "0.6707236", "0.66398877", "0.661424", "0.65959454", "0.6512391", "0.6502784", "0.6447893", "0.64208484", "0.64175427", "0.64134425", "0.6411824", "0.6397663", "0.6381197", "0.635584", "0.6349109", "...
0.79857415
0
Returns the number of people inside the hotel
def number_of_people users.length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_guests_in_rooms()\n guests_in_bar = 0\n for room in @rooms\n guests_in_bar += room.guests_in_room()\n end\n return guests_in_bar\n end", "def guest_count\n return @guests.count\n end", "def check_in_count()\n return @guests.length #guests array length\n end", "def passenge...
[ "0.6798899", "0.6787638", "0.6757495", "0.67293143", "0.66701454", "0.66249317", "0.6619746", "0.6609006", "0.66055214", "0.66024345", "0.6484868", "0.6467623", "0.6467442", "0.64547175", "0.6448798", "0.643226", "0.6425737", "0.6401865", "0.6401058", "0.63738364", "0.6348555...
0.6813858
0
Use callbacks to share common setup or constraints between actions.
def set_area_price @area_price = AreaPrice.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a trusted parameter "white list" through.
def area_price_params params.require(:area_price).permit(:price) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
=begin logic for sending Emails. if current_user.id matches the resource_requests/user_id then he is the project manager and the email should go to admin. else it will go to project managers from current_user.id parameters need to be passed current_user object and resource_request object. =end
def ResourceRequestsAndReply(current_user, resource_request, comments) @current_user = current_user @resource_request = resource_request @comments = comments if ['submitted'].include?(@resource_request.status) # @admin = true @message = "Hi, <br/> #{@current_user.full_name()} has requested resource for #{@resource_request.project.name} <br/> #{@comments.comment} <br/>Regards <br/> #{@comments.user.full_name()} <br/> #{@comments.user.email}".html_safe admin_emails = User.where(status: 'active', role_id: 1).select(:email) admin_emails.each do |admin| mail to: admin.email, subject: "[SOM] Resource requested by #{@current_user.full_name()} for #{@resource_request.project.name}", cc: Settings.developer_mails end else @message = "Hi, <br/> your requested resource for #{@resource_request.project.name} has been #{@resource_request.status} <br/> #{@comments.comment} <br/>Regards <br/> #{@comments.user.full_name()} <br/> #{@comments.user.email}".html_safe mail to: @current_user.email, subject: "[SOM] Resource request has been #{@resource_request.status}", cc: Settings.developer_mails end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def admin_request # :prefetch: :norobots:\n sender = @user\n pass_query_params\n if @project = find_or_goto_index(Project, params[:id].to_s)\n if request.method == :post\n subject = params[:email][:subject]\n content = params[:email][:content]\n for receiver in @project.admin_gro...
[ "0.68854", "0.6523105", "0.6332865", "0.62843895", "0.62825876", "0.62142384", "0.6180528", "0.61587936", "0.6148605", "0.6063049", "0.60549706", "0.60544926", "0.60397464", "0.6033936", "0.602889", "0.6026375", "0.6009743", "0.59850353", "0.59807867", "0.59780246", "0.597313...
0.6561742
1
GET /intervals/1 GET /intervals/1.json
def show @interval = Interval.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @interval } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intervals\n rest.get instrument_path('activeIntervals')\n end", "def show\n Interval.find(params[:id])\n end", "def get_interval_data(sensor_id, access_token, interval)\n data= MySmartGrid.get(\n \"/sensor/#{sensor_id}?interval=#{interval}&resolution=minute&unit=watt\",\n :headers ...
[ "0.80088484", "0.6778432", "0.6346739", "0.63318133", "0.6281635", "0.62257814", "0.6077866", "0.6046728", "0.60460895", "0.6005589", "0.5893589", "0.5859223", "0.58526427", "0.5831104", "0.5824255", "0.5784098", "0.5742841", "0.5730703", "0.5706181", "0.564695", "0.5617343",...
0.7081861
1
GET /intervals/new GET /intervals/new.json
def new @interval = Interval.new respond_to do |format| format.html # new.html.erb format.json { render json: @interval } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @interval = Interval.new(params[:interval])\n\n respond_to do |format|\n if @interval.save\n format.html { redirect_to @interval, notice: 'Interval was successfully created.' }\n format.json { render json: @interval, status: :created, location: @interval }\n else\n ...
[ "0.7264185", "0.7137619", "0.6408773", "0.6279478", "0.61838967", "0.615904", "0.60526365", "0.6005903", "0.598918", "0.5953488", "0.5936657", "0.5854133", "0.58369577", "0.579972", "0.5781284", "0.5769225", "0.5748122", "0.5702627", "0.5683337", "0.56713635", "0.56399065", ...
0.7943582
0
POST /intervals POST /intervals.json
def create @interval = Interval.new(params[:interval]) respond_to do |format| if @interval.save format.html { redirect_to @interval, notice: 'Interval was successfully created.' } format.json { render json: @interval, status: :created, location: @interval } else format.html { render action: "new" } format.json { render json: @interval.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @interval = Interval.new(interval_params)\n\n respond_to do |format|\n if @interval.save\n format.html { redirect_to @interval, notice: 'Interval was successfully created.' }\n format.json { render :show, status: :created, location: @interval }\n else\n format.html...
[ "0.6927481", "0.67218024", "0.6366835", "0.6256302", "0.59467745", "0.5943228", "0.5845371", "0.5840887", "0.57896054", "0.57688963", "0.5756314", "0.57203054", "0.5698124", "0.5609115", "0.5449912", "0.5426786", "0.5344713", "0.5296285", "0.5284035", "0.52645314", "0.5251820...
0.69765866
0
PUT /intervals/1 PUT /intervals/1.json
def update @interval = Interval.find(params[:id]) respond_to do |format| if @interval.update_attributes(params[:interval]) format.html { redirect_to @interval, notice: 'Interval was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @interval.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_interval\n @interval = Interval.find(params[:id])\n end", "def update\n respond_to do |format|\n if @interval.update(interval_params)\n format.html { redirect_to @interval, notice: 'Interval was successfully updated.' }\n format.json { render :show, status: :ok, location: @i...
[ "0.6427973", "0.63097686", "0.6118346", "0.5999847", "0.575412", "0.571396", "0.568996", "0.56198615", "0.56122905", "0.54825395", "0.5443053", "0.54045177", "0.5391283", "0.5360666", "0.5324008", "0.52961034", "0.52954674", "0.5286055", "0.526202", "0.5248202", "0.5248202", ...
0.6662279
0
DELETE /intervals/1 DELETE /intervals/1.json
def destroy @interval = Interval.find(params[:id]) @interval.destroy respond_to do |format| format.html { redirect_to intervals_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @interval = Interval.find(params[:id])\n @interval.destroy\n redirect_to(intervals_url)\n end", "def destroy\n @interval.destroy\n respond_to do |format|\n format.html { redirect_to intervals_url, notice: 'Interval was successfully destroyed.' }\n format.json { head :no_co...
[ "0.73726887", "0.7306665", "0.6756895", "0.6610774", "0.63216203", "0.62866354", "0.6198366", "0.615666", "0.61230856", "0.61127913", "0.60606503", "0.5990973", "0.59823424", "0.5953434", "0.59455365", "0.5942608", "0.59171945", "0.5908938", "0.5899089", "0.5884848", "0.58682...
0.76928604
0
initliaze method intializes the object
def initialize(prompt, answer) @prompt = prompt @answer = answer end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init; end", "def init; end", "def init; end", "def init; end", "def initialize\n\t\t\n\tend", "def init\n end", "def init\n end", "def init\n end", "def initialize\n init\n end", "def initialize() end", "def init\n\n end", "def initialize\n \n end", "def init...
[ "0.7735847", "0.7735847", "0.7735847", "0.7735847", "0.76654553", "0.7631351", "0.7631351", "0.7631351", "0.76197916", "0.75663346", "0.7490353", "0.7469086", "0.74536437", "0.74536437", "0.7419529", "0.7419529", "0.7392053", "0.7378716", "0.735957", "0.7347951", "0.7337372",...
0.0
-1
| aliases to compose, so you can do something like: (CreateOrder | ChargeCard.new(token: params[:token]) | SendThankYou).call
def compose(interactor) Interactors::Sequence.new.compose(self).compose(interactor) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compose proc1, proc2\n Proc.new do |x|\n proc2.call(proc1.call(x)) #put proc1 into parenthesis inorder for it to be done first\n end\nend", "def compose(g)\n\t\t\t\tlambda do |*a,&b|\n\t\t\t\t\tself.call(*g.call(*a,&b))\n\t\t\t\tend\n\t\t\tend", "def compose(proc1, proc2)\n Proc.new do |x|\n proc2...
[ "0.60123587", "0.6000457", "0.58178556", "0.57866865", "0.56954706", "0.569083", "0.569083", "0.569083", "0.5682402", "0.5670192", "0.5670192", "0.5670192", "0.5670192", "0.5665571", "0.5663256", "0.5595734", "0.55152327", "0.55152327", "0.55152327", "0.5508675", "0.54920864"...
0.4935292
50
def valid_move?(start_pos, end_pos) if piece_at(end_pos) Change to another error? return false end end
def show_board @grid.each_with_index do |row, row_index| row.each_with_index do |square, col_index| piece = self[row_index, col_index] if row_index.even? && col_index.even? print " #{piece.display} ".colorize( :color => :black, :background => :white ) if (piece && piece.color == :black) print " #{piece.display} ".colorize( :color => :red, :background => :white ) if (piece && piece.color == :red) print " ".colorize( :background => :white ) if piece.nil? elsif row_index.even? && col_index.odd? print " #{piece.display} ".colorize( :color => :black, :background => :light_white ) if (piece && piece.color == :black) print " #{piece.display} ".colorize( :color => :red, :background => :light_white ) if (piece && piece.color == :red) print " ".colorize( :background => :light_white ) if piece.nil? elsif row_index.odd? && col_index.even? print " #{piece.display} ".colorize( :color => :black, :background => :light_white ) if (piece && piece.color == :black) print " #{piece.display} ".colorize( :color => :red, :background => :light_white ) if (piece && piece.color == :red) print " ".colorize( :background => :light_white ) if piece.nil? elsif row_index.odd? && col_index.odd? print " #{piece.display} ".colorize( :color => :black, :background => :white ) if (piece && piece.color == :black) print " #{piece.display} ".colorize( :color => :red, :background => :white ) if (piece && piece.color == :red) print " ".colorize( :background => :white ) if piece.nil? end end puts "" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_move?(position)\n position.between?(0,8) && !position_taken?(position)\n end", "def check_move(start_pos, end_pos)\n # p start_pos\n # puts end_pos\n\n if self[[start_pos[0], start_pos[1]]].valid_move?(start_pos, end_pos, self)\n self[[start_pos[0], start_pos[1]]].move(start_pos, en...
[ "0.8373497", "0.8335318", "0.82131004", "0.82115114", "0.8182975", "0.81820804", "0.8172486", "0.8164463", "0.816233", "0.81604064", "0.81590617", "0.81519824", "0.8132961", "0.8115466", "0.81005144", "0.80969346", "0.8078271", "0.8078001", "0.8075221", "0.8063595", "0.806359...
0.0
-1
Retrieve the entries from the S3 Bucket
def contents(path = '') path = File.join(path, '') unless path.empty? @entries = [] generate_listing(path) @sorter.call(@entries) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def objects\n bucket_obj = Aws::S3::Bucket.new(name: bucket, client: s3_client)\n bucket_obj.objects( prefix: prefix)\n end", "def retrieve_objects_via_http(bucket)\n _log 'Retrieving objects via unauthenticated method.'\n r = http_request :get, \"https://#{bucket}.s3.amazonaws.com\"\n ...
[ "0.7989863", "0.7881867", "0.7813273", "0.77825546", "0.7710559", "0.7694403", "0.7669186", "0.7595509", "0.75795853", "0.75195915", "0.7511878", "0.74381304", "0.7397821", "0.7355452", "0.72402334", "0.72379464", "0.7181543", "0.71671", "0.71580243", "0.71076906", "0.7103537...
0.0
-1
Construct a BrowseEverything::FileEntry object
def entry_for(name, size, date, dir) BrowseEverything::FileEntry.new(name, [key, name].join(':'), File.basename(name), size, date, dir) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def directory_entry(file)\n BrowseEverything::FileEntry.new(file.id, \"#{key}:#{file.id}\", file.name, file.size, file.created_at, file.type == 'folder')\n end", "def make_entry()\n\n seq_id = @filehandler.readline.chomp\n puts seq_id\n sequence = @filehandler.readline.chomp\n ide...
[ "0.707368", "0.6435443", "0.60239404", "0.60206103", "0.6004584", "0.6004584", "0.5979974", "0.5979406", "0.5894683", "0.5795043", "0.5780083", "0.5776476", "0.5754656", "0.5693253", "0.5684063", "0.56812537", "0.55654967", "0.5563625", "0.55517024", "0.55432194", "0.551408",...
0.7328789
0
Populate the entries with FileEntry objects from an S3 listing
def add_directories(listing) listing.common_prefixes.each do |prefix| new_entry = entry_for(from_base(prefix.prefix), 0, Time.current, true) @entries << new_entry unless new_entry.nil? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract\n init_kms(@kms_opt)\n\n entries.map do |entry|\n local_file = File.join(@local_path, entry.name)\n logger.info \"Downloading #{entry.pathname} from S3 to #{local_file}\"\n File.open(local_file, 'wb') { |file| entry.raw.get({ response_target: file }.merge(encrypt_args)) }...
[ "0.6038653", "0.5990461", "0.5958862", "0.59039414", "0.58769494", "0.5701317", "0.5688382", "0.56877667", "0.5667212", "0.56515414", "0.56489974", "0.5635592", "0.5594798", "0.55798024", "0.5535442", "0.552656", "0.54811335", "0.5398207", "0.5394954", "0.5377686", "0.5371", ...
0.48745635
73
Given a listing and a S3 listing and path, populate the entries
def add_files(listing, path) listing.contents.each do |entry| key = from_base(entry.key) new_entry = entry_for(key, entry.size, entry.last_modified, false) @entries << new_entry unless strip(key) == strip(path) || new_entry.nil? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n foldernames = []\n if listing_params.has_key?('photo') && @listing.photo.present?\n foldernames.push(@listing.photo.match(/uploads.*/)[0])\n end\n if listing_params.has_key?('manual') && @listing.manual.present?\n foldernames.push(@listing.manual.match(/uploads.*/)[0])\n end\n...
[ "0.599189", "0.59633696", "0.5762322", "0.5449545", "0.53749627", "0.5353506", "0.5343103", "0.530078", "0.52214676", "0.5099324", "0.5081939", "0.5073247", "0.50525165", "0.5037741", "0.5031225", "0.49870032", "0.49837878", "0.49469855", "0.49145597", "0.49112913", "0.490404...
0.6207067
0
For a given path to a S3 resource, retrieve the listing object and construct the file entries
def generate_listing(path) client listing = client.list_objects(bucket: config[:bucket], delimiter: '/', prefix: full_path(path)) add_directories(listing) add_files(listing, path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(key, bucket = nil)\n # N.B. This is arguably a hack. From what the current S3 API exposes, when you retrieve a bucket, it\n # provides a listing of all the files in that bucket (assuming you haven't limited the scope of what it returns).\n # Each file in the listing contains inf...
[ "0.68217343", "0.6744861", "0.6474359", "0.64423645", "0.64038193", "0.63987315", "0.63371164", "0.63173354", "0.6277923", "0.62741095", "0.6269882", "0.6229742", "0.61944556", "0.61937547", "0.61828405", "0.61804193", "0.61804193", "0.614445", "0.6107718", "0.61048836", "0.6...
0.6373923
6
Upon creating or updating an event, refresh the JSON object in cache.
def delete_cache if self.id != nil && current_user != nil cache_key = "activities/Users/#{current_user.id}/#{self.class.name}/#{self.id}-#{(self.updated_at.to_f * 1000).round(0)}" Chorus.log_debug "-- BEFORE SAVE: Clearing cache for #{self.class.name} with ID = #{self.id} --" Rails.cache.delete(cache_key) return true # Prevent a missing key from the callback chain end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_reload(event)\n event.stack.events.reload\n event.stack.events.get(event.id)\n end", "def event_reload(event)\n event.stack.events.reload\n event.stack.events.get(event.id)\n end", "def after_create(event)\r\n expire_cache_for(event)\r\n end", "...
[ "0.6664616", "0.6664616", "0.6602877", "0.65721714", "0.6528613", "0.6528613", "0.6523786", "0.6523786", "0.624752", "0.61844945", "0.61637074", "0.6154492", "0.61538225", "0.60451144", "0.60427094", "0.60334074", "0.59853446", "0.5957249", "0.59554005", "0.5950356", "0.59052...
0.0
-1
Read the failing log from our test stack
def read_failing_log() failed_files = [] # Read in the file file = File.readlines(@failing_log) # Get lines which begin with rspec file.each do |line| if line =~ /rspec \.\// # Get the file name only failed_files << get_error_info(line) end end return failed_files end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log\n File.read(SPEC_LOG) rescue \"\"\n end", "def log_and_fail_test(exception)\n @logger.error(exception.inspect)\n bt = exception.backtrace\n @logger.pretty_backtrace(bt).each_line do |line|\n @logger.error(line)\n end\n @test_status = :error\n ...
[ "0.65006655", "0.62214607", "0.59948045", "0.59848666", "0.58924156", "0.5834719", "0.57631034", "0.5689074", "0.56279415", "0.56176585", "0.55789346", "0.55740136", "0.5520207", "0.5510251", "0.550669", "0.54862994", "0.54499424", "0.54341286", "0.54132015", "0.54132015", "0...
0.71612245
0
GET /session_events GET /session_events.json
def index @session_events = SessionEvent.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_event(session, options={})\n json_request \"get\", {:session => session}, options\n end", "def index\n @sessions = @event.sessions\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sessions }\n end\n end", "def show\n @session = @event.se...
[ "0.81535316", "0.8041107", "0.7728924", "0.7249225", "0.72150165", "0.7190642", "0.71063375", "0.70706964", "0.7054617", "0.6993031", "0.6838284", "0.67810035", "0.6740325", "0.67319626", "0.66829884", "0.66735524", "0.6621244", "0.6616195", "0.66060007", "0.6604854", "0.6588...
0.76977867
3
GET /session_events/1 GET /session_events/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_event(session, options={})\n json_request \"get\", {:session => session}, options\n end", "def index\n @sessions = @event.sessions\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sessions }\n end\n end", "def show\n @session = @event.se...
[ "0.79839754", "0.78951055", "0.78457177", "0.74457544", "0.7018805", "0.7003359", "0.6998226", "0.6875356", "0.68461466", "0.68285275", "0.6802894", "0.6756299", "0.66977733", "0.6591949", "0.6582734", "0.6579441", "0.657876", "0.6534581", "0.65330446", "0.65308124", "0.65238...
0.0
-1
POST /session_events POST /session_events.json
def create @session_event = SessionEvent.new(session_event_params) respond_to do |format| if @session_event.save format.html { redirect_to @session_event, notice: 'Session event was successfully created.' } format.json { render :show, status: :created, location: @session_event } else format.html { render :new } format.json { render json: @session_event.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @session = @event.sessions.new(params[:session])\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to [@event, @session], notice: 'Session was successfully created.' }\n format.json { render json: [@event, @session], status: :created, location: [@event, @s...
[ "0.7517827", "0.7058798", "0.6721352", "0.66793525", "0.6621008", "0.66182894", "0.6571327", "0.652709", "0.6447281", "0.6414531", "0.6405927", "0.6403908", "0.6388276", "0.6371743", "0.6354938", "0.6330283", "0.6285086", "0.6273645", "0.62593985", "0.616768", "0.6149811", ...
0.7557729
0
PATCH/PUT /session_events/1 PATCH/PUT /session_events/1.json
def update @sessions = SessionEvent.find(params[:id]) if @sessions.update_attributes(session_event_params) flash[:success] = "Your session has been updated" redirect_to @sessions end respond_to do |format| if @session_event.update(session_event_params) format.html { redirect_to @session_event, notice: 'Session event was successfully updated.' } format.json { render :show, status: :ok, location: @session_event } else format.html { render :edit } format.json { render json: @session_event.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @session = @event.sessions.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to [@event, @session], notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n forma...
[ "0.74524045", "0.70785767", "0.693216", "0.6891475", "0.6832877", "0.6813833", "0.678075", "0.67680013", "0.67508477", "0.6737696", "0.6701115", "0.6693", "0.6693", "0.66324633", "0.66089815", "0.65662587", "0.655137", "0.6519955", "0.6519955", "0.6516702", "0.6503276", "0....
0.702883
2
DELETE /session_events/1 DELETE /session_events/1.json
def destroy @session_event.destroy respond_to do |format| format.html { redirect_to session_events_url, notice: 'Session event was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n\n @session = @event.sessions.find(params[:id])\n\n #when destroying the last session, also destroy the related event\n #i know i can refactor this\n # event = Event.find(@session.event_id)\n # if event.sessions.count == 1\n # event.destroy\n # end\n \n @session.destroy\n\...
[ "0.7367564", "0.7260218", "0.71650034", "0.71180654", "0.71180654", "0.71180654", "0.7074594", "0.7038552", "0.7034156", "0.70272607", "0.7016465", "0.7013384", "0.70056844", "0.69898", "0.69881374", "0.69881374", "0.69881374", "0.69881374", "0.69881374", "0.69881374", "0.698...
0.75508803
0
Use callbacks to share common setup or constraints between actions.
def set_session_event @session_event = SessionEvent.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def session_event_params params.require(:session_event).permit(:behavior_square_id, :square_press_time, :duration_end_time, :session_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
test "should be able to view next steps cartridge page" do with_testable_app(true) get :next_steps, get_post_form assert_response :success assert_template :next_steps end
def get_post_form {:cartridge => {:name => 'mysql-5.1', :type => 'embedded'}, :application_id => with_testable_app.id, :domain_id => @domain.id} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reviewer_home\n\n post('index', {}, {})\n assert_response(:success)\n assert_template('tracker/index')\n \n post('index', {}, lee_hweng_session)\n assert_response(:success)\n assert_template('tracker/reviewer_home')\n\n #follow_redirect\n #assert_no_tag :content => \"POST Placem...
[ "0.704884", "0.6968581", "0.6948749", "0.6929162", "0.68421924", "0.6806146", "0.6805352", "0.6780715", "0.67715245", "0.6733005", "0.6733005", "0.6715396", "0.6679478", "0.66127753", "0.6574262", "0.6537527", "0.6527175", "0.6524942", "0.6504695", "0.65031224", "0.64984035",...
0.0
-1
All notes that this note links to
def child_notes @child_notes ||= NoteComponents::NoteLinks.new(contents).child_notes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notes\n\t\tNote.find(:all)\n\tend", "def links\n links = Hash.new([])\n order = []\n each_with_rescue(@notes) do |note|\n order << note.row\n links[note.row] += [link_helper(note)]\n end\n\n html = ''\n order.uniq!\n order.each do |row|\n ...
[ "0.72996134", "0.71618944", "0.7091816", "0.6826621", "0.6789827", "0.6771426", "0.6760867", "0.67252964", "0.6665089", "0.66399866", "0.66399866", "0.6625313", "0.6585849", "0.6563677", "0.6555844", "0.6555844", "0.6555844", "0.6555844", "0.6541238", "0.6503169", "0.64674056...
0.6413136
22
!!nil > !true > false !!user_instance > !false > true
def signed_in? !!current_user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logged_in?\n !!current_user #here !! converts @current_user into boolean\n end", "def is_user?\n user ? true : false\n end", "def has_user?\n !user.nil?\n end", "def create?\n @user&.admin?\n end", "def conditionally_true\n\t\t!!self\n\tend", "def create?\n @user != nil\n end", ...
[ "0.7081463", "0.6981775", "0.69145715", "0.67774826", "0.6678485", "0.66425925", "0.6598716", "0.65829813", "0.6555438", "0.65385294", "0.65313923", "0.652779", "0.6513366", "0.6513366", "0.6496771", "0.64951444", "0.64926803", "0.6475165", "0.64403534", "0.64403534", "0.6431...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_book @book = current_author.books.friendly.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def post_params params.require(:book).permit(:author_name, :name, :content, :image, :tag_list, :tag, { tag_ids: [] }, :tag_ids) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
name: select_exam explanation: this method associate select_exam view with this controller parameters: none return: select_exam
def select_exam end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_exam\n\t\t@exam = Exam.find(params[:id])\n\tend", "def set_exam\r\n @exam = Exam.find(params[:id])\r\n end", "def set_exam\n @exam = Exam.find(params[:id])\n end", "def set_exam\n @exam = Exam.find(params[:id])\n end", "def set_exam\n @exam = Exam.find(params[:id])\n end...
[ "0.7294504", "0.7265085", "0.7234758", "0.72006327", "0.7199503", "0.7199503", "0.7199503", "0.7199503", "0.7199503", "0.7199503", "0.7199503", "0.7199503", "0.7199503", "0.71032923", "0.706874", "0.70462865", "0.7034299", "0.6945866", "0.68353766", "0.67811567", "0.6737791",...
0.83269066
0
name: exams_statistics explanation: this method associate exams_statistics view with this controller parameters: none return: exams_statistics
def exams_statistics end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def statistics\n @survey = Survey.find(params[:survey_id])\n @result = @survey.results.find(params[:id])\n end", "def index\n @exam_results = ExamResult.order(:week_s => :desc).first(200)\n @exam_results_all = ExamResult.all\n\n @exam_results_weeks = ExamResult.count(:week_s)\n @exams_results_...
[ "0.6563129", "0.63776696", "0.63682985", "0.6346621", "0.63041836", "0.6240867", "0.6188893", "0.6098332", "0.6098332", "0.6098332", "0.60977805", "0.6015416", "0.60016423", "0.6000348", "0.5968198", "0.59553456", "0.5925617", "0.5903492", "0.5892124", "0.58904016", "0.586600...
0.7585871
0
name: answer_exam explanation: this method parameters: none return: questions of enemamigo
def answer_exam if params[:year_exam] questions ||= Question.where(year: params[:year_exam]) assert(questions.kind_of?(Question)) else questions ||= Question.all assert(questions.kind_of?(Question)) end if !questions.empty? auxiliar_exam ||= push_questions_auxiliar(questions) @exam = push_questions(auxiliar_exam) else redirect_to_back(select_exam_path) if params[:year_exam] flash[:danger] = t(:year_exam_not_found) else flash[:danger] = t(:exam_not_found) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quiz\n end", "def answers\n request('answers')\n end", "def questions\n \n end", "def questions_explanation\n puts \"Time to do the quiz!.\"\n puts \"\"\n puts \"Each question will be printed to the screen.\"\n puts \"Once you see it, simply type in your answer and hit the en...
[ "0.71127754", "0.7039764", "0.6930175", "0.68301004", "0.681634", "0.676265", "0.6695201", "0.6671346", "0.6658527", "0.66309214", "0.66309214", "0.66185904", "0.6578523", "0.6575479", "0.6536835", "0.65213466", "0.6467937", "0.6463808", "0.6453757", "0.64475524", "0.6426967"...
0.7520396
0
name: exam_result explanation: this method list result of the exam of enemamigo parameters: none
def exam_result if params[:exam_id] @exam = Exam.find(params[:exam_id]) assert(exam.kind_of?(Exam)) @exam = fill_user_answers(@exam) current_user.exams_total_questions += @exam.questions.count current_user.update_attribute(:exam_performance, current_user.exam_performance + [@exam.accepted_answers]) @exam.save return @exam.user_answers else return redirect_to_back flash[:danger] = t(:exam_message) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def result\n @exam = current_exam(params)\n\n @exam_reporter = @exam.evaluate(params[:answers])\n end", "def exam_details(ex)\n exams_data = ex.exams.all\n flag = false\n exams_data.each do |exam|\n exam.exam_scores.each do |es|\n flag = true if es.is_failed?\n end\n exams <...
[ "0.7414072", "0.68553007", "0.6782322", "0.669051", "0.65174335", "0.64520144", "0.63652766", "0.63248646", "0.6303901", "0.6285304", "0.62602276", "0.62182003", "0.6196837", "0.61287975", "0.6094099", "0.60848856", "0.6083606", "0.59941715", "0.59941715", "0.59879875", "0.59...
0.7052254
1
name: cancel_exam explanation: this method cancel of exam of enemamigo parameters: none return:redirect_to root_path
def cancel_exam exam = Exam.find(params[:exam_id]) assert(exam.kind_of?(Exam)) exam.destroy return redirect_to root_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancel\n redirect_to root_url, flash[:alert] = \"Something went wrong.\"\n end", "def cancel_and_redirect\r\n redirect_back\r\n end", "def cancel\n redirect_to checkid_request.cancel_url\n end", "def cancel\n @ride = Ride.find_by_id(params[:ride])\n current_user.cancel!(@ride)\n redi...
[ "0.65735763", "0.6524342", "0.6455042", "0.6442101", "0.6426792", "0.6405751", "0.6405751", "0.64008623", "0.63403577", "0.6338053", "0.63374233", "0.6292941", "0.62845296", "0.6270667", "0.6258545", "0.62511384", "0.6201362", "0.6198756", "0.6187564", "0.6184752", "0.6173746...
0.8292112
0
Float() style conversion, or false if conversion impossible.
def to_Float begin fl = Float stripn return fl rescue ArgumentError return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def float?\n !!Float(self)\n rescue ArgumentError, TypeError\n false\n end", "def float3?(input)\n Float(input) rescue false\nend", "def float?(str)\n true if Float(str) rescue false\n end", "def is_float?\n\t\tFloat(self) != nil rescue false\n\tend", "def is_float?\n ...
[ "0.76726866", "0.755282", "0.751132", "0.74429536", "0.7392249", "0.7293784", "0.7283553", "0.71981525", "0.7183453", "0.7047361", "0.70467025", "0.70077723", "0.6999853", "0.69730014", "0.696569", "0.69635713", "0.6942991", "0.69027007", "0.68591404", "0.6844093", "0.6785711...
0.8372635
0
Like strip, but also strips newlines.
def stripn encode( universal_newline: true ) .gsub("\n", "") .strip end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rstrip() end", "def strip_newlines(input); end", "def strip() end", "def rstrip!() end", "def strip_trailing_whitespace(text)\n text.split(\"\\n\").collect(&:strip).join(\"\\n\")\n end", "def lstrip() end", "def strip_lines(value)\n value.to_s.gsub(/\\n\\s*/, ' ')\n end", ...
[ "0.71943414", "0.7168402", "0.71346223", "0.705175", "0.69402874", "0.6912578", "0.68956614", "0.6710288", "0.659029", "0.6584463", "0.6574741", "0.6565644", "0.6553379", "0.6508228", "0.6503529", "0.64322543", "0.6400062", "0.6362053", "0.6362053", "0.63575774", "0.63425326"...
0.76229817
0
Joins a paragraph of possibly indented, newline separated lines into a single contiguous string.
def wring_heredoc encode(universal_newline: true) .split("\n") # split into lines .map( &:strip ) # strip them .delete_if( &:blank? ) # delete blank lines .join " " # and join with whitspace end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def included_paragraphs_joined\n PARAGRAPHS.join(\"\\n\\n\")\n end", "def to_s\n paragraphs.map(&:to_s).join(\"\\n\")\n end", "def to_s\n paragraphs.map(&:to_s).join(\"\\n\")\n end", "def wrap_paragraph(par)\n [\"\\n\\n\"] + par + [\"\\n\\n\"]\n end", "def join_lines\n\t\tou...
[ "0.6775684", "0.6325973", "0.6325973", "0.62695765", "0.62255144", "0.5991968", "0.5802499", "0.5792878", "0.5785576", "0.5773998", "0.57327443", "0.5731368", "0.5730906", "0.5730215", "0.5719407", "0.5691222", "0.56702656", "0.5646327", "0.5610952", "0.5592161", "0.55792415"...
0.5424445
28
If the string is empty, it gets replace with the string given as argument.
def default! default_string strip.empty? ? clear << default_string.to_s : self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace(input, string, replacement = T.unsafe(nil)); end", "def replace_first(input, string, replacement = T.unsafe(nil)); end", "def ReturnReplacementIfEmpty(valToCheck, replaceWithThis)\n\tvalToCheck.strip.empty? ? replaceWithThis : valToCheck.strip\nend", "def replace_empty(key, params, empty_str)\n ...
[ "0.78981394", "0.7640082", "0.7181888", "0.6774371", "0.66569054", "0.6484923", "0.64385533", "0.64264363", "0.64108145", "0.63817817", "0.6263712", "0.6263712", "0.62627834", "0.6188827", "0.6122005", "0.6114763", "0.6069158", "0.60131556", "0.59598213", "0.5958111", "0.5955...
0.61228013
14
Converts a string into a standard symbol. While Symbol class objects can be created from any string, it is good practice to keep symbols free of whitespaces and weird characters, so that the are typed easily, usable as variable names etc. This method thus removes punctuation, removes superfluous spaces, and underscores the remaining ones, before returning the string.
def standardize ς = self.dup ",.;".each_char { |c| ς.gsub! c, " " } ς.stripn .squeeze(" ") .underscore_spaces end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_symbol from_string\n return from_string.strip.gsub(\".\", \"_\").to_sym\n end", "def to_symbol(string)\n string.gsub(/[\\-_]/, '').to_sym\n end", "def clean(sym)\n sym.to_s.gsub(/\\W/, '_')\n end", "def symbolize(s)\n s.to_s.gsub(/\\s+/,\"_\").gsub(/\\W+/,\"\").downcase.to_s...
[ "0.72477216", "0.7233864", "0.6829905", "0.6685653", "0.6522683", "0.651278", "0.6493524", "0.64908737", "0.6216994", "0.6163831", "0.6108692", "0.608901", "0.60773325", "0.5976306", "0.5935041", "0.59102017", "0.5883745", "0.5811483", "0.58094615", "0.579811", "0.57681835", ...
0.0
-1
Applies standardize to the receiver and converts the result to a symbol.
def to_standardized_sym standardize .to_sym end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_sym() end", "def to_sym() end", "def to_sym() end", "def to_sym\n return super unless @to_s_sym\n value = self.to_s\n return value.nil? ? value : value.to_sym\n\t\tend", "def conform_to_symbol(text_or_symbol)\n underscore(text_or_symbol.to_s).downcase.to_sym\n en...
[ "0.63168347", "0.63168347", "0.63168347", "0.6195802", "0.60290104", "0.5988072", "0.594167", "0.5940939", "0.5937854", "0.5890646", "0.58764994", "0.58407253", "0.58407253", "0.58407253", "0.5827341", "0.5800763", "0.5800763", "0.57970273", "0.5778103", "0.57741684", "0.5763...
0.7052987
0
Capitalizes a string and append an exclamation mark. Also allows optional argument for string interpolation. Handy for constructing error messages.
def X! arg=nil arg.nil? ? capitalize + ?! : ( self % arg ).X! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def capitalize!() end", "def shout(phrase)\n return \"#{phrase.upcase} !!!!\"\n #return \"#{phrase}!!!!\".upcase\nend", "def yell(string)\n if !(string.instance_of?(String))\n raise \"The argument should be a String\"\n end\n string.upcase! << \"!\"\nend", "def prepare_string(string)\n s...
[ "0.6274294", "0.6097595", "0.604176", "0.60192037", "0.59975225", "0.5919082", "0.5913173", "0.58790773", "0.5859622", "0.5845386", "0.58413345", "0.5833665", "0.5832287", "0.58229315", "0.58094716", "0.58004147", "0.57796645", "0.5777359", "0.5758074", "0.57486945", "0.57300...
0.56561345
24
copy files to root, execute block, clean up when done
def in_environment(*extra_files) environment_files = [ ".env-#{environment}", "docker-compose-#{environment}.yml", 'docker-entrypoint.sh', 'Dockerfile' ].concat(extra_files) environment_files.each do |file| say "copying #{file} to #{@@root}", :green `cp #{path('.docker', environment.to_s, file)} #{@@root}` end begin yield rescue ensure environment_files.each do |file| say "removing #{file}", :green `rm #{path(file)}` end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stage\n\n @tempdir = Dir.mktmpdir\n\n begin\n\n # Copy the assets into the temp dir.\n files = Dir.glob(\"#{File.dirname(@file_path)}/#{@file_base}.*\")\n FileUtils.cp(files, @tempdir)\n\n # Change into the temp dir.\n FileUtils.cd(@tempdir) do yield e...
[ "0.69892544", "0.6814208", "0.64458007", "0.6431487", "0.629517", "0.61966956", "0.6076677", "0.6000064", "0.59686977", "0.5962716", "0.59523827", "0.59498274", "0.58872104", "0.5884997", "0.58756906", "0.58440083", "0.58411074", "0.58374614", "0.5827352", "0.5813597", "0.580...
0.0
-1