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
User should be redirected to the session expired page if they remain inactive longer than the session timeout in System Settings.
def test_session_expiry # Set the timeout really short settings = Goldberg::SystemSettings.find :first settings.session_timeout = 3 # Three seconds should be ample settings.save! form_login('admin', 'admin') get '/site_admin' assert_response :success # Wait longer than the timeout ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def session_expiry\n get_session_time_left\n unless @session_time_left > 0\n # Commented this out as this was showing when the server comes up after being idle\n # If a user's session times out, the user is shown the message in sessions_helper.rb, deny_access method\n # flash.now[:error] = \"Y...
[ "0.79838985", "0.7898004", "0.78851753", "0.7830281", "0.75875044", "0.75085723", "0.7504684", "0.740012", "0.7373675", "0.73571914", "0.7333183", "0.7324565", "0.7295497", "0.7261041", "0.71872", "0.7185458", "0.7184956", "0.7183178", "0.71706885", "0.7152349", "0.7140208", ...
0.7141187
20
User is not logged in if password is wrong
def test_wrong_password form_login('admin', 'foobar') assert_nil session[:goldberg][:user_id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login_faild\n\t\treturn error_log errors:{unauthenticated:[\"Incorrect User name and password\"]}\n\tend", "def needs_login?() false end", "def verify_password\n # dev_puts current_user.login\n # dev_puts params[:login]\n if current_user && current_user.login.eql?(params[:login])\n redirect_t...
[ "0.7452651", "0.7246233", "0.7180646", "0.7108283", "0.7107873", "0.707833", "0.70546377", "0.70078665", "0.70045483", "0.6999582", "0.69814914", "0.6975464", "0.6947882", "0.6944115", "0.69403857", "0.6926294", "0.69117796", "0.6903646", "0.68995106", "0.68856144", "0.688358...
0.6817186
36
A user who was not logged in was redirected to the login page because they tried accessing an action or page for which they lacked authorisation.
def assert_redirected_to_login assert_equal({ :controller => 'goldberg/auth', :action => 'login' }, response.redirected_to) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def umn_access_denied\n redirect_to(login_and_redirect_url)\n end", "def user_not_authorized\n flash[:danger] = \"Access denied.\"\n redirect_to (request.referrer || root_path)\n end", "def access_denied\n if @current_user\n render_401\n else\n redirect_to \"#{FUSESOURCE_URL}/l...
[ "0.76898485", "0.7559799", "0.74779254", "0.74602205", "0.74053", "0.739959", "0.7399084", "0.7384371", "0.73636234", "0.7361666", "0.72914517", "0.7264895", "0.72495013", "0.7246342", "0.72431004", "0.7221324", "0.72088486", "0.7206479", "0.72006655", "0.71902645", "0.716519...
0.0
-1
User was redirected to one of the standard Goldberg pages, as specified by :page_name.
def assert_redirected_to(page_name) assert_match(/#{Goldberg.settings.send(page_name).url}$/, response.redirected_to) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redirects_to_page\n nil\n end", "def redirects_to_page\n nil\n end", "def page_redirect?(title)\n page_info_contains_key(title, 'redirect')\n end", "def redirect?(page_title)\n form_data = {'action' => 'query', 'prop' => 'info', 'titles' => page_title}\n page = make_api_...
[ "0.6385528", "0.6385528", "0.6288785", "0.59316784", "0.5836392", "0.58329874", "0.58183014", "0.5749949", "0.57446724", "0.5699106", "0.5677953", "0.5643482", "0.55820036", "0.5563411", "0.55576754", "0.5556967", "0.5541795", "0.55359346", "0.55359346", "0.5528816", "0.55135...
0.6866571
0
GET /clientes/1 GET /clientes/1.json
def show @cliente = Cliente.find(params[:id]) respond_to do |format| format.json { render json: @cliente } format.html { render layout: nil } format.js end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n get_clientes\n end", "def index\n @clients = Client.all\n @uuid = params[:uuid]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end", "def index\n @clientes = Cliente.all\n\n respond_to do |format|\n forma...
[ "0.75573057", "0.7309607", "0.73035264", "0.72786754", "0.72786754", "0.72786754", "0.72786754", "0.720313", "0.71720743", "0.7152402", "0.7150072", "0.71132433", "0.6986462", "0.6986462", "0.6986462", "0.6986462", "0.6986462", "0.6986462", "0.6986462", "0.6986462", "0.695928...
0.0
-1
GET /clientes/new GET /clientes/new.json
def new @cliente = Cliente.new respond_to do |format| format.html { render layout: nil } # new.html.erb format.json { render json: @cliente } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @client = Client.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client }\n end\n end", "def new\n @client = Client.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client }\n end\n...
[ "0.7791358", "0.7791358", "0.7791358", "0.7791358", "0.75185454", "0.7481733", "0.7476371", "0.7476371", "0.7476371", "0.7476371", "0.7476371", "0.7448655", "0.74190474", "0.7380534", "0.73224896", "0.7316924", "0.731146", "0.73020333", "0.72485656", "0.7195978", "0.7176642",...
0.71203536
24
POST /clientes POST /clientes.json
def create @cliente = Cliente.new(params[:cliente]) respond_to do |format| if @cliente.save if params[:submit_and_go_to_new] flash.now[:notice] = t('general.messages.create_success', model_name: t('activerecord.models.cliente')) else flash[:notice] = t('general.message...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @client = Client.new(client_params)\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to clients_url, notice: 'El cliente se creó correctamente' }\n format.json { render :index, status: :created, location: @client }\n else\n format.html { render...
[ "0.6495907", "0.63909537", "0.62965876", "0.6295942", "0.62543184", "0.6213016", "0.62039846", "0.6170844", "0.6147487", "0.61167645", "0.6116049", "0.61076003", "0.6106851", "0.6090675", "0.6088888", "0.6088888", "0.6088888", "0.60771346", "0.6067053", "0.6066198", "0.606088...
0.0
-1
PUT /clientes/1 PUT /clientes/1.json
def update @cliente = Cliente.find(params[:id]) respond_to do |format| if @cliente.update_attributes(params[:cliente]) flash[:notice] = t('general.messages.update_success', model_name: t('activerecord.models.cliente')) format.html { redirect_to edit_cliente_path(@cliente) } format...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @client.update(client_params)\n render json: @client\n end", "def update\n client=Client.find_by_id params[:id]\n if client!= nil\n client.cedula=params[:cedula] ? params[:cedula]: client.cedula\n client.sector=params[:sector] ? params[:sector]: client.sector\n client.nom...
[ "0.6690034", "0.64942217", "0.62863994", "0.6246107", "0.6210129", "0.6190703", "0.6187221", "0.61714447", "0.6166241", "0.6140423", "0.61334056", "0.613253", "0.6110653", "0.6107967", "0.6101207", "0.60789", "0.60558504", "0.60558504", "0.6053401", "0.6053401", "0.6015174", ...
0.0
-1
DELETE /clientes/1 DELETE /clientes/1.json
def destroy @cliente = Cliente.find(params[:id]) if @cliente.destroy flash[:notice] = t('general.messages.delete_success', model_name: t('activerecord.models.cliente')) else flash[:error] = t('general.messages.delete_error') end respond_to do |format| format.html { redirect_to :ba...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_...
[ "0.7352608", "0.7324717", "0.73179483", "0.73179483", "0.7315194", "0.73058546", "0.73058546", "0.73058546", "0.73058546", "0.73058546", "0.73058546", "0.73058546", "0.73058546", "0.73058546", "0.727687", "0.72510153", "0.7250224", "0.72073656", "0.7204424", "0.72002566", "0....
0.0
-1
DELETE /clientes/batch_destroy?ids[]=1&ids[]=2 DELETE /clientes/batch_destroy.json?ids[]=1&ids[]=2
def batch_destroy if params[:ids] if Cliente.destroy_all(id: params[:ids]) flash[:notice] = t('general.messages.delete_success', model_name: t('activerecord.models.cliente')) else flash[:error] = t('general.messages.delete_error') end end respond_to do |format| forma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_destroy \n if params[:ids]\n if AdvogadosEscritorio.destroy_all(id: params[:ids])\n flash[:notice] = t('general.messages.delete_success', model_name: t('activerecord.models.advogados_escritorio'))\n else\n flash[:error] = t('general.messages.delete_error')\n end\n end\n...
[ "0.78662425", "0.77796423", "0.77360725", "0.77178943", "0.77096295", "0.758396", "0.757426", "0.7526884", "0.7515186", "0.7482943", "0.7319681", "0.7241536", "0.7241536", "0.72028124", "0.7188695", "0.71690756", "0.7132568", "0.7027711", "0.7027711", "0.702404", "0.7020117",...
0.8138669
0
def string_to_signed_integer(str) if DIGITS.keys.include?(str[0]) string_to_integer(str) elsif str[0] == '' string_to_integer(str[1..1]) elsif str[0] == '+' string_to_integer(str[1..1]) end end Solution
def string_to_signed_integer(str) str = '+' + str if DIGITS.keys.include?(str[0]) case str[0] when '-' -string_to_integer(str[1..-1]) when '+' string_to_integer(str[1..-1]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string_to_signed_integer(str)\n case str[0]\n when '-' then -string_to_integer(str.slice(1, str.length))\n when '+' then string_to_integer(str.slice(1, str.length))\n else string_to_integer(str)\n end\nend", "def string_to_signed_integer(str)\n case str[0]\n when '-' then -string_to_integer(s...
[ "0.9094753", "0.90089357", "0.89459884", "0.89312434", "0.8931188", "0.8931188", "0.8931188", "0.88741714", "0.8831388", "0.87706554", "0.8755908", "0.8751195", "0.8705121", "0.8697598", "0.86891615", "0.86679226", "0.8655456", "0.8642968", "0.85927266", "0.8562748", "0.84076...
0.9306741
0
Run when the guardfile changes.
def run_on_changes(paths) run_all() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_on_change(paths)\n restart_guard\n end", "def notify(changed_files)\n ::Guard.guards.each do |guard|\n paths = Watcher.match_files(guard, changed_files)\n guard.run_on_change paths unless paths.empty?\n end\n end", "def notify(changed_files)\n ::Guard.guards.each...
[ "0.6801636", "0.6713407", "0.66920966", "0.65033376", "0.64833283", "0.64813685", "0.6431551", "0.62666523", "0.61951303", "0.6136953", "0.60955215", "0.5890229", "0.58378386", "0.57938606", "0.57588196", "0.5747609", "0.5721689", "0.5706062", "0.5687843", "0.565531", "0.5651...
0.5735253
16
Compile each template at the passed in paths.
def run_on_modifications(paths = []) hash = {} # Get all files. paths = Dir.glob("#{@options[:input]}/**/*").select do |path| not File.directory? path end paths.each do |path| file = File.read path compiled = ::EJS.compile file hash[path] = com...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile_templates\n dir = File.join(Frank.root, Frank.dynamic_folder)\n\n Dir[File.join(dir, '**{,/*/**}/*')].each do |path|\n if File.file?(path) && !File.basename(path).match(/^(\\.|_)/)\n path = path[ (dir.size + 1)..-1 ]\n ext = File.extname(path)\n ...
[ "0.66127044", "0.6608776", "0.6529876", "0.64683676", "0.64278746", "0.63963604", "0.629751", "0.6251887", "0.62153065", "0.62115216", "0.61534846", "0.5997391", "0.5883053", "0.5875193", "0.58528715", "0.5844862", "0.58177215", "0.58141065", "0.5813606", "0.58024406", "0.576...
0.58092207
19
Create a new user registration. Signups must be enabled in the application config, otherwise the user is redirected to the landing page instead.
def create if Feedbunch::Application.config.signups_enabled super else Rails.logger.warn "Creation of new user attempted, but signups are disabled" redirect_to root_path end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def registration\n \tif request.post?\n user = User.new(user_params)\n if user.valid?\n user.save\n flash[:notice] = \"Registration Successful. Please Sign In!\"\n redirect_to root_url\n else\n flash[:alert] = user.errors.first[1]\n redirect_to users_registration_...
[ "0.78479755", "0.76806587", "0.7640544", "0.7592088", "0.758662", "0.75409293", "0.75333226", "0.74651617", "0.74647534", "0.74537516", "0.7401154", "0.73985773", "0.73751676", "0.7367006", "0.7361339", "0.7350986", "0.73375165", "0.733386", "0.7312259", "0.7310432", "0.73038...
0.8062108
0
Delete a user's profile. A password parameter must be submitted. The method validates that the submitted password is actually the user's password, otherwise an error is returned.
def destroy Rails.logger.warn "User #{current_user.id} - #{current_user.email} has requested account deletion" password = profiles_controller_destroy_params[:password] if current_user.valid_password? password Rails.logger.warn "User #{current_user.id} - #{current_user.email} provided correct password ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n if session[:user_id].to_s == params[:id].to_s then\n @user = User.find(params[:id])\n @user.destroy\n format.html { redirect_to(users_url) }\n else\n flash[:error_message] = \"You can only delete your own profile.\"\n render \"errors/index\"\n end\n end", "def del...
[ "0.70787627", "0.70478547", "0.6919179", "0.6816805", "0.6796702", "0.6777359", "0.66683024", "0.66538596", "0.6618067", "0.6613121", "0.6604135", "0.658043", "0.65734416", "0.6525344", "0.64861864", "0.6479297", "0.6415072", "0.64056915", "0.63987094", "0.6383247", "0.635284...
0.79747164
1
Redirect user to a static page after signup
def after_inactive_sign_up_path_for(resource) signup_success_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signup\n sign_out\n puts '----signup called.----'\n redirect_to '/users/sign_up'\n end", "def auth_user\n redirect_to new_user_registration_url unless user_signed_in?\n end", "def sign_up(resource_name, resource)\n redirect_to users_url\n end", "def success_signup\n redirect_to root_...
[ "0.7521241", "0.737316", "0.73471725", "0.72522306", "0.7242537", "0.7235561", "0.7141644", "0.71300656", "0.7120288", "0.7072754", "0.7054215", "0.7022118", "0.6965226", "0.6947462", "0.6907361", "0.68843275", "0.68546146", "0.68402815", "0.6822981", "0.6799683", "0.6791875"...
0.0
-1
As the params are returned as an array, the splat operator must be used ! e.g. execute(execute_dotenv_params, 'env') Note: we first do an echo, to avoid command map issues with the bash source command
def execute_dotenv_params(dotenv_path = '.env') # The .dot env file dotenv_file = deploy_path.join(dotenv_path) dotenv_keys = "$(cut --delimiter== --fields=1 #{dotenv_file})" ['echo', '.env', '&&', '.', dotenv_file, '&&', 'export', dotenv_keys, '&&'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def args_evaled\n args.map do |arg|\n arg.resolve_and_eval(env)\n end\n end", "def quoted_shell_params args\n args.map(&method(:quoted_shell_param))\n end", "def exec_args\n exec(*@args.to_exec)\n end", "def spawn_args\n result = Array.new\n unless environment.empty?\n ...
[ "0.60735756", "0.5945564", "0.56962645", "0.56712526", "0.5639599", "0.5603705", "0.55962914", "0.54962784", "0.54618853", "0.5432181", "0.5432181", "0.5432181", "0.5395727", "0.53735185", "0.5351603", "0.53443736", "0.52973896", "0.5285508", "0.52730626", "0.52689886", "0.52...
0.67158467
0
GET /wks GET /wks.json
def index @wks = Wk.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @wks = Wk.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wks }\n end\n end", "def jwks\n jwks_uri = URI(@issuer + '.well-known/jwks.json')\n @jwks ||= json_parse(Net::HTTP.get(jwks_uri))\n end", "def retrieve_jwks_k...
[ "0.7093479", "0.69775623", "0.64538056", "0.59831417", "0.57660794", "0.57660794", "0.57660794", "0.57660794", "0.57551545", "0.5747202", "0.55652475", "0.5517022", "0.55008817", "0.54961014", "0.5400836", "0.5385444", "0.5364971", "0.5362712", "0.5344093", "0.5310634", "0.53...
0.6937991
2
GET /wks/1 GET /wks/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @wks = Wk.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wks }\n end\n end", "def index\n @wks = Wk.all\n end", "def jwks\n jwks_uri = URI(@issuer + '.well-known/jwks.json')\n @jwks ||= json_parse(Net::HTTP.get(jwks_...
[ "0.6894039", "0.66282785", "0.63598686", "0.62685776", "0.5918176", "0.5896141", "0.5879346", "0.5771001", "0.5771001", "0.5771001", "0.5771001", "0.5619701", "0.54804367", "0.5434064", "0.5430149", "0.5398472", "0.5386683", "0.5382837", "0.53779626", "0.53576416", "0.5327944...
0.0
-1
POST /wks POST /wks.json
def create @wk = Wk.new(wk_params) respond_to do |format| if @wk.save format.html { redirect_to @wk, notice: 'Wk was successfully created.' } format.json { render :show, status: :created, location: @wk } else format.html { render :new } format.json { render json: @wk...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @wk = Wk.new(params[:wk])\n\n respond_to do |format|\n if @wk.save\n format.html { redirect_to @wk, notice: 'Wk was successfully created.' }\n format.json { render json: @wk, status: :created, location: @wk }\n else\n format.html { render action: \"new\" }\n ...
[ "0.62338173", "0.6149662", "0.57414025", "0.5728086", "0.5728086", "0.5728086", "0.5728086", "0.5586365", "0.5566709", "0.5555492", "0.55165595", "0.54937106", "0.54517657", "0.54117393", "0.5383088", "0.537579", "0.5336338", "0.53218573", "0.5321636", "0.52968204", "0.523000...
0.6222633
1
PATCH/PUT /wks/1 PATCH/PUT /wks/1.json
def update respond_to do |format| if @wk.update(wk_params) format.html { redirect_to @wk, notice: 'Wk was successfully updated.' } format.json { render :show, status: :ok, location: @wk } else format.html { render :edit } format.json { render json: @wk.errors, status: :un...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @whiskey.update(whiskey_params)\n format.html { redirect_to @whiskey, notice: \"Whiskey was successfully updated.\" }\n format.json { render :show, status: :ok, location: @whiskey }\n else\n format.html { render :edit, status: :unprocessabl...
[ "0.6297055", "0.62502956", "0.59815013", "0.5977065", "0.5946465", "0.5903731", "0.58681387", "0.5855074", "0.58307695", "0.5796792", "0.57821834", "0.57740355", "0.5765986", "0.5736371", "0.57303154", "0.5710278", "0.57045144", "0.5681112", "0.56725115", "0.5668429", "0.5660...
0.6056707
2
DELETE /wks/1 DELETE /wks/1.json
def destroy @wk.destroy respond_to do |format| format.html { redirect_to wks_url, notice: 'Wk was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @whiskey = Whiskey.find(params[:id])\n @whiskey.destroy\n\n respond_to do |format|\n format.html { redirect_to whiskeys_url }\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end", "def destroy\n @wk = Wk.find(params[:id])\n @wk.destroy\...
[ "0.6714574", "0.6694507", "0.65341717", "0.63789463", "0.6324421", "0.625525", "0.6238477", "0.6237576", "0.62177485", "0.6211226", "0.6205822", "0.61814934", "0.61773187", "0.61562806", "0.61389714", "0.6130029", "0.6117816", "0.60920376", "0.6084696", "0.60669994", "0.60477...
0.6500173
3
Use callbacks to share common setup or constraints between actions.
def set_wk @wk = Wk.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 wk_params params.require(:wk).permit(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.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
If the adapter has a method for it use that otherwise delegate the field over to the user and directly access that shit.
def fetch(data_field) data = @user.send(data_field) # Adapt the user data for this specific strategy if modified_data_fields.include?(data_field) data = self.send(data_field, data) end data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_missing(meth, *args, &block)\n return unless _user\n _user.send(meth, *args, &block)\n end", "def method_missing(method_name, *args)\n\t\tif DELEGATED_METHODS.include?(method_name)\n\t\t\t@user.send(method_name, *args)\n\t\telse\n\t\t\tsuper\n\t\tend\n\tend", "def method_mis...
[ "0.6430929", "0.6160538", "0.60604703", "0.5953054", "0.5857701", "0.583281", "0.5729424", "0.5711332", "0.56291157", "0.56291157", "0.56108034", "0.55814254", "0.5558123", "0.55402696", "0.5521766", "0.551937", "0.54924256", "0.5486404", "0.54807544", "0.5448405", "0.5433283...
0.539004
24
Each of these should have a custom method to get the correct selector string
def modified_data_fields [:gender, :hispanic_latino, :veteran_status, :disability_status] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define_selectors_(type, name, selector)\n define_method(\"#{name}_#{type}_selector\") do |text = nil|\n text ? extend_selector(selector, :text, text) : selector\n end\n\n define_method(\"#{name}_selector\") do |text = nil|\n text ? extend_selector(selector, :text, text) : selector\n end\n...
[ "0.69932485", "0.6928754", "0.6699882", "0.66123533", "0.6557176", "0.6551391", "0.65477365", "0.64465874", "0.64241165", "0.63635653", "0.6327294", "0.6297126", "0.6288885", "0.6197141", "0.616073", "0.61379176", "0.6108601", "0.6108601", "0.60703045", "0.6067625", "0.604214...
0.0
-1
nombre, nit, empleados, direccion, accionistas, jefe clientes, proveedores, proyectos
def initialize attributes = {} @nombre = attributes[:nombre] @nit = attributes[:nit] @empleados = [] @clientes = [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tecnicos_postulados\n coleccion = []\n self.request.each do |request|\n info = {}\n info[:id] = request.id\n info[:article] = request.article\n info[:servicio] = request.service.description\n info[:tecnicos] = request.proposal\n coleccion.append(info)\n end\n coleccion...
[ "0.6254824", "0.6160722", "0.60447556", "0.6026548", "0.6021995", "0.597624", "0.59487206", "0.5938603", "0.5909253", "0.5906235", "0.5902778", "0.58459103", "0.584026", "0.5837681", "0.5820892", "0.5803668", "0.5784483", "0.5770904", "0.5768011", "0.5766545", "0.57630914", ...
0.6415358
0
Define a method, e_words(str), that accepts a string as an argument. Your method return the number of words in the string that end with the letter "e". e_words("tree") => 1 e_words("Let be be finale of seem.") => 3
def e_words(str) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def e_words(str)\r\n count = 0\r\n str.split(\" \").each {|w| w[-1] == 'e' ? count += 1: next}\r\n count\r\nend", "def e_words(str)\r\n count = 0\r\n str.split(\" \").each {|w| w[-1] == 'e'? count += 1: next}\r\n count\r\nend", "def e_words(str)\n count = 0\n str.delete('.').split.each{|word| count = cou...
[ "0.8319334", "0.8310253", "0.8261909", "0.81131524", "0.80120724", "0.7992477", "0.76123154", "0.7581446", "0.74887365", "0.743333", "0.7413221", "0.7157062", "0.71106005", "0.7110168", "0.7062965", "0.7026183", "0.7003108", "0.69751036", "0.6885952", "0.6882922", "0.6864642"...
0.74975324
8
A magic number is a number whose digits, when added together, sum to 7, e.g., 34. Define a method that returns an array of the first n magic numbers. You may wish to write a helper method (magic_number?) that returns a boolean indicating whether a number is magic. This problem is harder than anything you'll receive on ...
def magic_number?(n) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def magic_numbers(count)\n num = 1\n result = []\n while result.length < count\n result << num if is_magic_number?(num)\n num += 1\n end\n result\nend", "def magic_numbers(count)\n index = 0\n array = []\n found = 0\n while found < count\n if is_magic_number?(index)\n arr...
[ "0.7842342", "0.7647983", "0.69448435", "0.6805817", "0.66013", "0.5937432", "0.59100515", "0.5892203", "0.5847835", "0.58425766", "0.58161426", "0.58121014", "0.57779187", "0.5762632", "0.57442963", "0.5743771", "0.5693381", "0.5670251", "0.5654391", "0.56476414", "0.5638786...
0.6723559
4
POST /addresses POST /addresses.json
def create @customer_ship_address = current_customer.build_customer_ship_address(customer_ship_address_params) respond_to do |format| if @customer_ship_address.save format.html { redirect_to edit_customer_registration_path, notice: t(:ship_address_suc_create) } format.json { redirect_to ed...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_and_verify(params = {})\n wrapped_params = {}\n wrapped_params[:address] = params\n\n @client.make_request(:post, 'addresses/create_and_verify', MODEL_CLASS, wrapped_params).address\n end", "def create\n @address = Address.new(params[:address])\n\n respond_to do |format|\n if @add...
[ "0.68061566", "0.6685573", "0.6685573", "0.6682515", "0.66288555", "0.6618585", "0.6546599", "0.65459967", "0.6544032", "0.6466024", "0.64591664", "0.6440685", "0.6428216", "0.6416642", "0.64042056", "0.6376917", "0.6362137", "0.6357422", "0.63465214", "0.6343014", "0.6340362...
0.56896555
82
PATCH/PUT /addresses/1 PATCH/PUT /addresses/1.json
def update respond_to do |format| if @customer_ship_address.update(customer_ship_address_params) format.html { redirect_to edit_customer_registration_path, notice: t(:ship_address_suc_update) } format.json { head :no_content } else format.html { render 'edit' } format.jso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @address.update(address_params)\n render json: @address\n else\n render json: @address.errors, status: :unprocessable_entity\n end\n end", "def update\n @address = @addressable.addresses.find_by_id(params[:id])\n\n respond_to do |format|\n if @address.update_attribu...
[ "0.691299", "0.6885459", "0.68517965", "0.6690486", "0.66741526", "0.6638526", "0.6638526", "0.6638526", "0.6638526", "0.6599404", "0.65100664", "0.64910126", "0.6489935", "0.6409057", "0.6399825", "0.63816184", "0.6366728", "0.63631535", "0.63442516", "0.63441676", "0.633073...
0.5900494
55
Use callbacks to share common setup or constraints between actions.
def set_address @customer_ship_address = CustomerShipAddress.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 customer_ship_address_params params.require(:customer_ship_address).permit(:address, :zipcode, :city, :phone, :country_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
Ensure all conditions eval to true for this context.
def matches_context?(context) @conditions.all? { |cblock| cblock.call(context) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allow_evals_if_active\n update_attribute(:allow_evals, true) unless placements.filled.empty?\n end", "def conditions\n @conditions + @condition_blocks\n end", "def conditions\n @generated_conditions.collect { |_, cond| cond }\n end", "def manually_awarded?\n # TODO: Correct...
[ "0.665031", "0.62056655", "0.60746443", "0.6069775", "0.6038562", "0.60210127", "0.593636", "0.58951163", "0.5887209", "0.5854426", "0.5827967", "0.57869446", "0.57869446", "0.5752398", "0.57208174", "0.5703754", "0.56455564", "0.5611337", "0.5605964", "0.5605964", "0.5603648...
0.0
-1
These should only be invoked by the deploy action.
def _run(context) return unless matches_context?(context) if @run_block puts "[#{context.host}] Executing \"#{self.name}\"..." @run_block.call(context) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deploy?; run_options[:deploy]; end", "def before_deploy(manifest)\n # do nothing by default\n end", "def action_before_deploy\n install_packages\n end", "def after_deploy(manifest)\n # do nothing by default\n end", "def deploy\n\t# This task is typiclly run aft...
[ "0.69465053", "0.6828911", "0.68257195", "0.66930354", "0.6592144", "0.6592144", "0.65200996", "0.64790547", "0.6356382", "0.63406986", "0.6286621", "0.6281362", "0.62740064", "0.62622106", "0.62547994", "0.62439144", "0.6208617", "0.6186955", "0.61867917", "0.6177789", "0.61...
0.0
-1
Method to add an item to a list input: item name and optional quantity
def add_item(item, quantity, list) # steps: # if the item is already in the list if list[item.to_sym] # add to the quantity #list[item.to_sym] = list[item.to_sym] + quantity list[item.to_sym] += quantity # otherwise else # make a new key with the input quantity list[item.to_sym] = quantity end # outp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_item(list, item_name, quantity = 1)\n\tlist[item_name] = quantity\n\tlist\nend", "def add_item(list, item_name, quantity = 1)\n\tlist[item_name] = quantity\n\tlist\nend", "def add_item(list, item_name, quantity = 1)\n\tlist[item_name] = quantity\n\tlist\nend", "def add_item(list, item_name, quantity)...
[ "0.8833022", "0.8833022", "0.8832608", "0.878819", "0.878819", "0.86017865", "0.85208696", "0.8414588", "0.8411319", "0.8409928", "0.8360311", "0.8334652", "0.8304705", "0.8302643", "0.8260448", "0.82578176", "0.8226007", "0.8206026", "0.81378907", "0.8126863", "0.8097782", ...
0.7977319
29
Method to remove an item from the list input: item to be removed, and the list
def remove_item(item, list) # steps: delete the item if it exists list.delete_if {|list_item| list_item == item.to_sym} # output: updated list list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_item(list, item)\n\tlist.delete(item)\n\tlist\nend", "def remove_item (list, item)\n list.delete(item)\nend", "def remove_item(list, item_removed)\n list.delete(item_removed)\nend", "def remove_item(item, list)\n list.delete(item)\nend", "def remove_item (list, item)\n list.delete(item)\nend"...
[ "0.87108666", "0.8698169", "0.86923087", "0.86907655", "0.86695224", "0.8643589", "0.8643589", "0.8640922", "0.86408067", "0.8637336", "0.86293983", "0.86293983", "0.86293983", "0.86293983", "0.8621942", "0.8621942", "0.86157966", "0.8613646", "0.86037713", "0.86003566", "0.8...
0.8669031
5
Method to update the quantity of an item input: item, new quantity and the list
def update(item, quantity, list) # steps: if the item is in the list if list.include? item.to_sym # update the quantity list[item.to_sym] = quantity else add_item(item, quantity, list) end # output: return the updated list list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_quantity(item, list, quantity)\n add_item(item, list, quantity)\nend", "def update_quantity(list, item, quantity)\n\tadd_to_list(list, item, quantity)\nend", "def update_quantity_of_item(list,item,quantity)\r\n add_item_to_list(list,item,quantity)\r\n list\r\nend", "def update_qty(shopping_list...
[ "0.90241814", "0.8909763", "0.8673279", "0.8670014", "0.85846543", "0.8532443", "0.85191935", "0.8506583", "0.8505529", "0.8505529", "0.8417739", "0.83993196", "0.8364638", "0.83529186", "0.83288836", "0.83044124", "0.8278999", "0.82786477", "0.8258891", "0.8251575", "0.82508...
0.8233032
24
Method to print a list and make it look pretty input: list
def print(list) # steps: # make a new string string = "This is the shopping list: \n" # iterate through the list list.each do |item, quantity| # add the items and quantities to the string and end with a newline string = string + "#{item}: #{quantity} \n" end # output: the string puts string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_pretty(list)\n list.each { |item, value| puts \"#{item} #{value}\" }\nend", "def pretty_list(list)\n\tlist.each do |item, quantity|\n\t\tputs \"There are #{quantity} #{item} on the grocery list.\"\n\tend\nend", "def pretty_print(list)\n list.each {|item, quantity| puts \"#{item} : #{quantity}\"...
[ "0.83632624", "0.80736405", "0.80035967", "0.79945534", "0.78249073", "0.78249073", "0.78032756", "0.7779632", "0.7763736", "0.77538294", "0.772886", "0.7664486", "0.75698185", "0.75251687", "0.75156623", "0.75105304", "0.75105304", "0.75105304", "0.75105304", "0.7508959", "0...
0.0
-1
Define the columns necessary for a trendable model
def trendables key :divergence, Float key :obp, Float end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_columns\n @columns = []\n valid_table = table.alias('valid_taxon_names')\n\n @columns.push({ header: 'ro', projected: rank_over(table, valid_table) })\n\n @columns.push({header: 'taxon_name_id', projected: table[:id].as('taxon_name_id') } )\n @columns.push({header:...
[ "0.6086686", "0.58148825", "0.5800583", "0.5657573", "0.5643371", "0.55989915", "0.5582116", "0.5538708", "0.5449571", "0.5449188", "0.54375696", "0.5400319", "0.5400319", "0.539702", "0.5322934", "0.52997017", "0.52714497", "0.526433", "0.52610934", "0.52460015", "0.5244287"...
0.6130973
0
Define the baseline class for this trend
def baseline(klass) @baseline_klass = klass end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def baseline_for(klass)\n @baseline_for = klass\n end", "def baseline( val )\n case val\n when :d; @baseline = \"text-before-edge\"\n when :u; @baseline = \"text-after-edge\"\n else @baseline = \"middle\"\n # else @baseline = \"auto\"\n ...
[ "0.758201", "0.67946863", "0.6793323", "0.5836638", "0.57255256", "0.5687953", "0.56415427", "0.55722225", "0.5567733", "0.55045986", "0.54779005", "0.5446492", "0.5279271", "0.52346253", "0.5210965", "0.5166881", "0.51260453", "0.51260453", "0.5095239", "0.50143033", "0.4985...
0.7586057
0
Define the class for trends
def trends_class(klass) @trends_klass = klass end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trend_class(klass)\n @trend_class = klass\n end", "def trend_for(klass)\n unless klass.constantize.ancestors.include?MongoMapper::Document\n raise ArgumentError, \"Class #{ klass } does not represent a DB Model\"\n else\n @trend_for = klass\n end\n end", "def trends\...
[ "0.800377", "0.7094337", "0.6867357", "0.63786834", "0.62219405", "0.6123967", "0.58058006", "0.57778686", "0.57456833", "0.56788826", "0.5674666", "0.5635601", "0.5492046", "0.54886013", "0.5453611", "0.5453611", "0.5423561", "0.5412123", "0.54058456", "0.5386182", "0.537905...
0.77963126
1
Aggregates and attempts to store it into the database. This would only work if the class that extends Octo::Counter includes from Cequel::Record
def aggregate!(ts = Time.now.floor) unless self.ancestors.include?MongoMapper::Document raise NoMethodError, 'aggregate! not defined for this counter' end aggr = aggregate(ts) sum = aggregate_sum(aggr) aggr.each do |_ts, counterVals| counterVals.each do |obj, count| ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aggregate!(ts = Time.now.floor)\n unless self.ancestors.include?MongoMapper::Document\n raise NoMethodError, \"aggregate! not defined for this counter\"\n end\n\n aggr = aggregate(ts)\n aggr.each do |_ts, counterVals|\n counterVals.each do |obj, count|\n args = gen_ar...
[ "0.6305808", "0.6042638", "0.60174215", "0.5967982", "0.5888071", "0.5864436", "0.5839969", "0.5772313", "0.57570124", "0.5738269", "0.5711469", "0.5669742", "0.56291944", "0.5596734", "0.55850697", "0.55541706", "0.55458385", "0.5537298", "0.54920673", "0.5488233", "0.547497...
0.63822687
0
Aggregates to find the sum of all counters for an enterprise at a time
def aggregate_sum(aggr) sum = {} aggr.each do |ts, counterVals| sum[ts] = {} unless sum.has_key?ts counterVals.each do |obj, count| if obj.respond_to?(:enterprise_id) eid = obj.public_send(:enterprise_id).to_s sum[ts][eid] = sum[ts].fetch(eid, 0) + count ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def local_count(duration, type)\n aggr = {}\n Octo::Enterprise.each do |enterprise|\n args = {\n enterprise_id: enterprise.id,\n ts: duration,\n type: type\n }\n aggr[enterprise.id.to_s] = {} unless aggr.has_key?(enterprise.id.to_s)\n results =...
[ "0.6735741", "0.6323065", "0.6104228", "0.60518384", "0.5949564", "0.59338886", "0.5905198", "0.5858847", "0.5792325", "0.57875454", "0.57817966", "0.57692665", "0.5765442", "0.5719036", "0.57179016", "0.57104254", "0.570674", "0.568595", "0.5670488", "0.5665655", "0.5664155"...
0.73374707
0
Get the baseline value for an object.
def get_baseline_value(baseline_type, object) clazz = @baseline_klass.constantize clazz.public_send(:get_baseline_value, baseline_type, object) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def baseline_value\n if (@reference_lines.key?(:baseline))\n @reference_lines[:baseline][:value]\n else\n nil\n end\n end", "def get_baseline_value(baseline_type, obj, ts = Time.now.ceil)\n unless Octo::Counter.constants.include?baseline_type\n raise ArgumentError, 'No such baseli...
[ "0.77635306", "0.73751456", "0.60519844", "0.59913254", "0.59191465", "0.5805236", "0.57715875", "0.5696999", "0.564793", "0.564793", "0.54436594", "0.52726555", "0.51569355", "0.5132164", "0.51189166", "0.5071943", "0.50718814", "0.5054961", "0.5002596", "0.4999913", "0.4963...
0.76885283
1
GET /tipomedallas/1 GET /tipomedallas/1.json
def show @tipomedalla = Tipomedalla.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @tipomedalla } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @tipomedalla = Tipomedalla.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipomedalla }\n end\n end", "def index\n @itemtipos = Itemtipo.all\n\n render json: @itemtipos\n end", "def show\n @tip_so = TipSo.find(params[:id])\n\n ...
[ "0.66024077", "0.6497607", "0.64623857", "0.6371572", "0.626839", "0.6248993", "0.6203002", "0.61574876", "0.61400914", "0.6106477", "0.6089209", "0.60408676", "0.6035103", "0.59855235", "0.5976387", "0.5975464", "0.59734136", "0.59734136", "0.5962659", "0.5961599", "0.594906...
0.6909978
0
GET /tipomedallas/new GET /tipomedallas/new.json
def new @tipomedalla = Tipomedalla.new respond_to do |format| format.html # new.html.erb format.json { render json: @tipomedalla } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @tip_so = TipSo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tip_so }\n end\n end", "def create\n @tipomedalla = Tipomedalla.new(params[:tipomedalla])\n\n respond_to do |format|\n if @tipomedalla.save\n format.html { red...
[ "0.7573674", "0.73563164", "0.7343601", "0.7318903", "0.7174541", "0.7063349", "0.7035842", "0.6995284", "0.69911915", "0.69697547", "0.69347453", "0.69184107", "0.69175667", "0.689904", "0.6891061", "0.68715113", "0.6862034", "0.685832", "0.6854868", "0.6851985", "0.684378",...
0.77826405
0
POST /tipomedallas POST /tipomedallas.json
def create @tipomedalla = Tipomedalla.new(params[:tipomedalla]) respond_to do |format| if @tipomedalla.save format.html { redirect_to @tipomedalla, notice: 'Tipomedalla was successfully created.' } format.json { render json: @tipomedalla, status: :created, location: @tipomedalla } e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @tipos_dato = TiposDato.new(tipos_dato_params)\n\n respond_to do |format|\n if @tipos_dato.save\n format.html { redirect_to @tipos_dato, notice: 'Tipos dato was successfully created.' }\n format.json { render :show, status: :created, location: @tipos_dato }\n else\n ...
[ "0.5948123", "0.56538385", "0.5637753", "0.5582372", "0.55769247", "0.5563003", "0.5546708", "0.5538916", "0.55280817", "0.5482391", "0.5475159", "0.542387", "0.53535205", "0.535107", "0.534565", "0.5333644", "0.53312624", "0.5319106", "0.53147274", "0.52699864", "0.52678335"...
0.6461634
0
PUT /tipomedallas/1 PUT /tipomedallas/1.json
def update @tipomedalla = Tipomedalla.find(params[:id]) respond_to do |format| if @tipomedalla.update_attributes(params[:tipomedalla]) format.html { redirect_to @tipomedalla, notice: 'Tipomedalla was successfully updated.' } format.json { head :no_content } else format.html ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @tip_so = TipSo.find(params[:id])\n\n respond_to do |format|\n if @tip_so.update_attributes(params[:tip_so])\n format.html { redirect_to @tip_so, notice: 'Tip so was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \...
[ "0.62673306", "0.6191104", "0.61864746", "0.61414194", "0.61279523", "0.61136293", "0.6095589", "0.6091027", "0.6078136", "0.59931976", "0.5961449", "0.59532094", "0.5951804", "0.5927767", "0.59271073", "0.58847237", "0.588389", "0.5867209", "0.58653444", "0.5852311", "0.5842...
0.6661455
0
DELETE /tipomedallas/1 DELETE /tipomedallas/1.json
def destroy @tipomedalla = Tipomedalla.find(params[:id]) @tipomedalla.destroy respond_to do |format| format.html { redirect_to tipomedallas_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @tipoveiculo.destroy\n respond_to do |format|\n format.html { redirect_to tipoveiculos_url }\n format.json { head :no_con...
[ "0.6984927", "0.6959283", "0.6906527", "0.6841814", "0.6833329", "0.6815777", "0.6808249", "0.6789995", "0.6789405", "0.6772504", "0.6768596", "0.67634475", "0.6745597", "0.67209625", "0.6685924", "0.6679869", "0.6677813", "0.6661958", "0.6661864", "0.665866", "0.66512805", ...
0.72492355
0
Helper method for user authentication. Whitelist approach: Assumes every page needs authentication unless you skip it explicitly in the controller.
def authorise unless User.find_by_id(session[:user_id]) redirect_to login_url, :notice => "Please log in" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def require_authentication\n\n # No matter what the app does a user can always login, forgot\n # password and register. The controllers provided by this\n # plugin alreaddy have these controllers/actions on an\n # exception list but this prevents a mistake an overridden\n ...
[ "0.7084425", "0.69491905", "0.69378", "0.6876959", "0.6853677", "0.684239", "0.68143547", "0.6811686", "0.680125", "0.6745313", "0.67344004", "0.67327917", "0.6725913", "0.6725763", "0.67201775", "0.6718509", "0.6677428", "0.6669119", "0.6653947", "0.6653589", "0.66475534", ...
0.0
-1
Helper method overloading redirect_to which allows a redirect after an AJAX action (like submitting the new play form)
def redirect_to(options = {}, response_status = {}) if request.xhr? render(:update) {|page| page.redirect_to(options)} else super(options, response_status) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ajax_redirect(redirect_url)\n respond_to do |format|\n @redirect_url = redirect_url\n format.js { render :template => 'misc/redirect', :handlers => [:erb], :content_type => 'application/javascript' }\n end\n end", "def redirect_to(options = {}, response_status = {})\n\t\tif request.xhr?\n\t\...
[ "0.67494375", "0.6459608", "0.6413107", "0.6378689", "0.6378689", "0.6337191", "0.6298483", "0.6298483", "0.627193", "0.62471044", "0.61790925", "0.61472535", "0.6109193", "0.6024026", "0.60095423", "0.60089004", "0.6008232", "0.5990786", "0.59894776", "0.5983687", "0.5983548...
0.632315
6
Helper method to get rid of the flash messages that build up on AJAX pages. I skip this after creating a new play, as that form uses AJAX but I need a confirmation flash message.
def discard_flash_if_xhr flash.discard if request.xhr? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_flash_message\n [:blue_notice, :lightgrey_notice, :success, :danger, :warning, :info,\n :light, :dark].each do |x|\n flash[x] = nil\n end\n end", "def discard_flash\n flash.discard\n end", "def flash_messages\n %w(notice warning error).map do |msg|\n conte...
[ "0.70968825", "0.6960991", "0.690354", "0.690183", "0.69007075", "0.6859271", "0.68473047", "0.6772219", "0.67304415", "0.672376", "0.6722434", "0.6706596", "0.6699839", "0.66242623", "0.66216123", "0.65884507", "0.6584703", "0.65627414", "0.65334105", "0.65296465", "0.652584...
0.6591693
15
Complete each step below according to the challenge directions and include it in this file. Also make sure everything that isn't code is commented in the file. I worked on this challenge [by myself, with: ]. 1. Pseudocode What is the input? an array What is the output? (i.e. What should the code return?) the middle val...
def median(array) middle = nil array.sort! if array.length % 2 == 0 middle = (array[array.length / 2] + array[array.length / 2 - 1]) / 2.0 else middle = array[(array.length - 1) / 2] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def middle_number(array)\n if array.length == 0\n return nil\n elsif array.length % 2 == 0\n (array[array.length / 2] + array[array.length / 2] -1).to_f / 2\n else\n array[array.length / 2]\n end\nend", "def find_middle_array_element(array)\n\n return 0 if array.size == 1 \n if array.size.odd?\n ...
[ "0.7313771", "0.7236398", "0.72161365", "0.71940684", "0.7159368", "0.69085807", "0.6895506", "0.6869064", "0.68623793", "0.6788985", "0.6782649", "0.6778526", "0.66847724", "0.6676971", "0.667662", "0.6663536", "0.6662409", "0.665999", "0.66419005", "0.66401166", "0.6624869"...
0.7028988
5
3. Refactored Solution I'm feeling pretty good about my solution. I'm curious to see anyone's suggestions on refactoring. Here is the code with comments.
def median(array) middle = nil # defining the future median array.sort! # sorting the array. I used a destructive method for this, so that it goes to the if statement if array.length % 2 == 0 # if the array has an even amount, we need the average of the middle 2 elements middle = (array[array.length / 2] + ar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def collection_order(items) #nicer collection method - the unnecessary loops and arrays. (task 6)\n\n item_indexes = []\n collection_order = []\n\n for item in items\n item_indexes << find_index_at_value(item)\n end\n\n sorted_indexes = item_indexes.sort\n\n for index in sorted_indexes\n ...
[ "0.5632365", "0.54522395", "0.5391752", "0.51050377", "0.5094218", "0.50755024", "0.50687355", "0.5001272", "0.49624127", "0.4956931", "0.49563465", "0.49168733", "0.49168733", "0.49074787", "0.4867106", "0.48564324", "0.4839165", "0.48378906", "0.48025158", "0.47950128", "0....
0.0
-1
the collection of elements present in both sets
def intersection(other) self.class.from_a(to_a & other.to_a) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersection(other_set)\n new_set = []\n # Fill our empty array with elements that are members of both sets\n other_set.set.each do |element|\n new_set.push(element) if @set.include?(element)\n end\n Set.new(new_set)\n end", "def subset?(other_set)\n other_set.set.all? { |element| inc...
[ "0.7445003", "0.7015118", "0.69984496", "0.6961912", "0.6900949", "0.68498856", "0.68342406", "0.68334407", "0.6829491", "0.68270385", "0.6519843", "0.6463365", "0.6447336", "0.63856393", "0.62959737", "0.6291875", "0.618183", "0.6181515", "0.6143394", "0.6134717", "0.6105436...
0.60861397
23
the collection of all elements present in either set
def union(other) self.class.from_a(to_a | other.to_a) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def union(other_set)\n new_set = @set\n # Create an array with elements that are members of either set\n other_set.set.each do |element|\n new_set.push(element)\n end\n Set.new(new_set)\n end", "def intersection(other_set)\n new_set = []\n # Fill our empty array with elements that are ...
[ "0.7330926", "0.7322416", "0.69194245", "0.68846256", "0.6624547", "0.65046644", "0.64946836", "0.6480074", "0.64357775", "0.6351482", "0.6349665", "0.6342067", "0.6303854", "0.623127", "0.6188991", "0.6158984", "0.6152373", "0.6093342", "0.6089314", "0.6064211", "0.6054842",...
0.0
-1
the collection of elements from this set with any elements from the other set removed
def difference(other) self.class.from_a(to_a - other.to_a) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def difference(other_set)\n new_set = @set\n # Delete elements from our array that are in the other set\n other_set.set.each do |element|\n new_set.delete(element)\n end\n Set.new(new_set)\n end", "def minus(other)\n set = MyHashSet.new\n to_a.each { |el| set.insert(el) unless other.in...
[ "0.7593658", "0.75309813", "0.7341346", "0.72070885", "0.70602685", "0.69636077", "0.6897555", "0.6811307", "0.6805353", "0.6717283", "0.66786796", "0.65918976", "0.65903825", "0.6559408", "0.6484544", "0.6367502", "0.6356439", "0.6266633", "0.6265051", "0.6133735", "0.610941...
0.0
-1
the collection of elements that are members of exactly one of the sets
def symmetric_difference(other) union(other).difference( intersection(other) ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subset?(other_set)\n other_set.set.all? { |element| include?(element) }\n end", "def superset?(set)\n self.all? { |val| set.include?(val) }\n end", "def subset?(set)\n set.all? { |val| self.include?(val) }\n end", "def subset_of?( other_collection )\n all? {|e| other_collection.inc...
[ "0.6873679", "0.6799299", "0.67004114", "0.6699642", "0.66908765", "0.63255936", "0.6325398", "0.6316632", "0.62766576", "0.62194294", "0.6189079", "0.6176104", "0.6148696", "0.6136667", "0.6120195", "0.6116317", "0.6112926", "0.6088552", "0.605765", "0.604022", "0.6030911", ...
0.0
-1
the collection of elements that are not members of this set
def complement self.class.all.difference(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def without_empty_sets\n collection = clone\n collection.sets.reject!(&:empty?)\n collection\n end", "def complement\n self.class.all.difference(self)\n end", "def which_elements_missing? desired_elements\n database_elements = as_set\n desired_elements = Set.new(desired_elements...
[ "0.7307051", "0.6698988", "0.66897887", "0.6659754", "0.66539854", "0.6440104", "0.64056814", "0.63812095", "0.635346", "0.63264704", "0.62935007", "0.6157786", "0.6139484", "0.6084729", "0.6066492", "0.606459", "0.60243416", "0.6019124", "0.6016958", "0.60013896", "0.5987149...
0.669631
2
Compare for equality, ignoring order and duplicates
def =~ other @normalized_pitch_classes ||= @pitch_classes.uniq.sort @normalized_pitch_classes == case when other.respond_to?(:pitch_classes) then other.pitch_classes.uniq.sort when (other.is_a? Array and other.frozen?) then other when other.respond_to?(:to_a) then other.to_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eql?(other)\n other.class == self.class &&\n other.id == self.id &&\n other.operands.sort_by(&:to_s) == self.operands.sort_by(&:to_s)\n end", "def ==(other); false; end", "def ==(other)\n if other.is_a? self.class\n collect(&:id).sort == other.collect(&:id).sort\n els...
[ "0.6712737", "0.67003924", "0.6683063", "0.66784984", "0.6638063", "0.6638063", "0.6614801", "0.6600455", "0.6600455", "0.6600455", "0.6600455", "0.6600455", "0.6600455", "0.6600455", "0.6600455", "0.6600455", "0.6600455", "0.6600455", "0.6600455", "0.6600455", "0.6600455", ...
0.0
-1
GET /circles GET /circles.json
def index @circles = Circle.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @circle = current_user.circle\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @circle }\n end\n end", "def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend", "def show\n @circle = Circle.find(params[:id...
[ "0.7484646", "0.73138803", "0.7197082", "0.7155239", "0.6725961", "0.63376987", "0.63168573", "0.63034815", "0.63034815", "0.6273125", "0.62562346", "0.62343293", "0.6225809", "0.6105686", "0.60478145", "0.60374385", "0.60374385", "0.6002041", "0.59485286", "0.593329", "0.591...
0.7190375
3
GET /circles/1 GET /circles/1.json
def show @recents = @circle.recents end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @circle = Circle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @circle }\n end\n end", "def show\n @circle = Circle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { r...
[ "0.76458657", "0.7601106", "0.75422454", "0.7041951", "0.6995876", "0.6820755", "0.6820755", "0.6582667", "0.64598536", "0.64227897", "0.6358491", "0.6315501", "0.6315501", "0.6289137", "0.6289137", "0.61710626", "0.6161252", "0.61327714", "0.61131406", "0.6093879", "0.606014...
0.558353
41
POST /circles POST /circles.json
def create @circle = Circle.new(circle_params) current_user.add_role(:owner, @circle) respond_to do |format| if @circle.save format.html { redirect_to @circle, notice: 'Circle was successfully created.' } format.json { render :show, status: :created, location: @circle } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @circle = Circle.new(params[:circle])\n @circle.user = current_user\n \n respond_to do |format|\n if @circle.save\n format.html { redirect_to @circle, :notice => 'Circle was successfully created.' }\n format.json { render :json => @circle, :status => :created, :location ...
[ "0.7368445", "0.7293516", "0.7193256", "0.68230915", "0.65687287", "0.64309543", "0.6428214", "0.6428214", "0.6351642", "0.62205863", "0.6118326", "0.610242", "0.6060388", "0.5932615", "0.5932615", "0.5931351", "0.5915893", "0.590707", "0.588749", "0.5874788", "0.5854617", ...
0.65500444
5
PATCH/PUT /circles/1 PATCH/PUT /circles/1.json
def update respond_to do |format| if @circle.update(circle_params) format.html { redirect_to @circle, notice: 'Circle was successfully updated.' } format.json { render :show, status: :ok, location: @circle } else format.html { render :edit } format.json { render json: @ci...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @circle = Circle.find(params[:id])\n\n respond_to do |format|\n if @circle.update_attributes(params[:circle])\n format.html { redirect_to @circle, :notice => 'Circle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :acti...
[ "0.75676835", "0.7538444", "0.7538444", "0.7237855", "0.659366", "0.64841455", "0.6473821", "0.61811185", "0.61735976", "0.6159464", "0.60976195", "0.60976195", "0.60677433", "0.6050749", "0.6037844", "0.5989796", "0.5967441", "0.5935556", "0.5923504", "0.58812666", "0.588126...
0.7405154
3
DELETE /circles/1 DELETE /circles/1.json
def destroy @circle.destroy respond_to do |format| format.html { redirect_to circles_url, notice: 'Circle was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @circle = Circle.find(params[:id])\n @circle.destroy\n\n respond_to do |format|\n format.html { redirect_to circles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @circle = Circle.find(params[:id])\n @circle.destroy\n\n respond_to do |format|\n...
[ "0.7906571", "0.7906571", "0.7596188", "0.7483723", "0.7348654", "0.7237059", "0.7110125", "0.6873949", "0.6805337", "0.6778534", "0.66757864", "0.6646662", "0.6629113", "0.65654445", "0.65654445", "0.65654445", "0.65654445", "0.6547623", "0.6458799", "0.6457974", "0.64198214...
0.7595404
3
Use callbacks to share common setup or constraints between actions.
def set_circle @circle = Circle.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 circle_params params.require(:circle).permit(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.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
POST method. Moves the description to a new parent object.
def create return unless check_src_exists! && check_src_permission! @description = @src return unless check_dest_exists! @delete_after = (params[:delete] == "1") move_description end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n respond_to do |format|\n if @parent.save\n format.html { redirect_to @parent, notice: 'Parent was successfully created.' }\n format.json { render :show, status: :created, location: @parent }\n else\n format.html { render :new }\n format.json { render json: @par...
[ "0.5950226", "0.5912248", "0.5888652", "0.5871669", "0.5866811", "0.5858598", "0.5856959", "0.5809358", "0.580789", "0.5790786", "0.5790786", "0.5790786", "0.5790786", "0.57868314", "0.5776996", "0.5725857", "0.5725181", "0.5714346", "0.5711559", "0.57020676", "0.5700503", ...
0.0
-1
Perform actual move of a description from one name to another.
def move_description if @delete_after move_description_to_another_name else clone_description_to_another_name end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_description_to_another_name\n src_was_default = (@src.parent.description_id == @src.id)\n make_dest_default = @dest.description_id.nil? && src_was_default\n\n remove_parent_default_desc_and_log_it if src_was_default\n set_src_parent_to_dest_and_log_it\n\n if make_dest_default && @...
[ "0.76751935", "0.7188334", "0.6972318", "0.60817116", "0.5977602", "0.5977602", "0.5956515", "0.5800715", "0.5760582", "0.57537323", "0.5751244", "0.5724583", "0.5724583", "0.5696011", "0.56306756", "0.56306756", "0.5607791", "0.5573002", "0.55573267", "0.5557224", "0.5543557...
0.80434346
0
Just transfer the description over.
def move_description_to_another_name src_was_default = (@src.parent.description_id == @src.id) make_dest_default = @dest.description_id.nil? && src_was_default remove_parent_default_desc_and_log_it if src_was_default set_src_parent_to_dest_and_log_it if make_dest_default && @src.fully_pu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def description\n description = \"\"\n end", "def desc( description )\n @description = description\n end", "def describe(description)\n @description = description\n end", "def description\n @description = \"Espresso\"\n end", "def description\n @description = \"Dark Roa...
[ "0.76040584", "0.75775146", "0.74485856", "0.72863346", "0.7189267", "0.7185482", "0.7180591", "0.7180591", "0.7170464", "0.7170464", "0.7170464", "0.7170464", "0.7170464", "0.7170464", "0.7170464", "0.7170464", "0.7170464", "0.7170464", "0.7155773", "0.7153805", "0.7149839",...
0.0
-1
Create a clone in the destination name/location.
def clone_description_to_another_name desc = clone_src_description # I think a reviewer should be required to pass off on this before it # gets shared with reputable sources. Synonymy is never a clean science. # if dest.is_a?(Name) # desc.review_status = src.review_status # desc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clone(uri, destination = Dir.mktmpdir)\n hg('clone', uri, destination.to_s)\n destination\n end", "def clone() end", "def clone\n end", "def clone\n end", "def clone\n end", "def clone\n end", "def clone(uri, destination = Dir.mktmpdir)\n git(\"clone\", uri, destinat...
[ "0.7508387", "0.7197686", "0.7105262", "0.706015", "0.706015", "0.706015", "0.70155865", "0.6987096", "0.6987096", "0.6987096", "0.69487876", "0.6930352", "0.6930352", "0.690831", "0.68734616", "0.6789284", "0.67850703", "0.67051625", "0.66333836", "0.6537286", "0.6499803", ...
0.0
-1
Can also depend on ffmpeg, but this pulls in a lot of extra stuff that you don't need unless you're doing video analysis, and some of it isn't in Homebrew anyway. Will depend on openexr if it's installed. Fix nonASCII characters breaking in Java 1.7
def patches; DATA; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iconv() end", "def fix_wikimedia_characters(res)\n res.media.where(w: nil).find_each do |img|\n next if img.source_url =~ /(svg|ogg|ogv)$/\n string = img.source_page_url.sub(/^.*File:/, '').sub(/\\..{3,4}$/, '')\n good_name = URI.decode(string)\n bad_name = img.source_url.sub...
[ "0.6451382", "0.58924633", "0.575135", "0.57302094", "0.568496", "0.56680065", "0.5638196", "0.5620797", "0.55974364", "0.55944777", "0.55518204", "0.5529528", "0.55274147", "0.5527373", "0.5516918", "0.5516106", "0.5516106", "0.5506837", "0.5505633", "0.55026764", "0.5501163...
0.0
-1
GET /canvases/1 GET /canvases/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @api_v1_canvases = Api::V1::Canvas.all\n render json: @api_v1_canvases\n end", "def index\n @canvasses = Canvass.all\n end", "def show\n @crate = Crate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @crate }\n ...
[ "0.77266663", "0.6332059", "0.6130716", "0.6113924", "0.6040045", "0.5940255", "0.59176743", "0.5917475", "0.5890408", "0.5886574", "0.5868536", "0.58612585", "0.58596545", "0.5775973", "0.57672673", "0.5760075", "0.57448703", "0.5701849", "0.5685464", "0.565484", "0.56512135...
0.0
-1
POST /canvases POST /canvases.json
def create # byebug @canvas = Canvas.create(canvas_params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @api_v1_canvases = Api::V1::Canvas.all\n render json: @api_v1_canvases\n end", "def create\n @canvass = Canvass.new(canvass_params)\n\n respond_to do |format|\n if @canvass.save\n format.html { redirect_to @canvass, notice: 'Canvass was successfully created.' }\n forma...
[ "0.63452834", "0.55093384", "0.54977375", "0.5433294", "0.53722274", "0.5313643", "0.51956123", "0.5169837", "0.51688015", "0.5159939", "0.5159822", "0.5151713", "0.5148308", "0.5133318", "0.51220995", "0.5109538", "0.5108416", "0.5094524", "0.5080792", "0.5073739", "0.506529...
0.56525177
1
Override: Serve compiled Vite assets from the temporary folder as needed.
def set_filename(req, res) original_root = @root.dup if req.path_info.start_with?("/#{ ViteRuby.config.public_output_dir }/") @root = ViteRuby.config.root.join(ViteRuby.config.public_dir) end super.tap { @root = original_root } 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.6245569", "0.61481994", "0.60465103", "0.5869882", "0.5822381", "0.5822381", "0.57500505", "0.5696645", "0.5671623", "0.56449544", "0.56247234", "0.5618038", "0.5612587", "0.56122994", "0.55878514", "0.55772454", "0.5514543", "0.5501433", "0.5479167", "0.5472352", "0.54226...
0.5017926
77
Override: Detect the special status set by the Proxy Servlet and use the default Jekyll response instead.
def service(req, res) proxy_servlet.service(req, res) if res.status == STATUS_SERVE_ORIGINAL res.status = 200 super end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status\n response.headers[\"EbuIo-PlugIt-NoTemplate\"] = ''\n render layout: false\n end", "def default_body\n\t\t\t# response.headers[Rack::CONTENT_TYPE] = 'text/html'\n\t\t\tRack::Utils::HTTP_STATUS_CODES[status]\n\t\tend", "def index\n head params[:response_status]\n end", "def fall...
[ "0.6483493", "0.64413863", "0.63813686", "0.63172305", "0.6268197", "0.6258335", "0.61214626", "0.6094544", "0.6089192", "0.6061517", "0.6061517", "0.6051867", "0.5976675", "0.5954118", "0.59191585", "0.5887591", "0.58846796", "0.5862268", "0.581586", "0.5780671", "0.5780671"...
0.6513465
0
Internal: A WEBRick servlet that uses a Rack proxy internally.
def proxy_servlet @proxy_servlet ||= begin # Called by the proxy if a request shouldn't be served by Vite. app = ->(_env) { [STATUS_SERVE_ORIGINAL, {}, []] } # Initialize the proxy which is a Rack app. proxy = ViteRuby::DevServerProxy.new(app) # Return a servlet compliant with WEBric...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_missing(m, *args, &block) \n \t\t@proxy_servlet.send(m, *args, &block)\n \t\tend", "def rackup(app); return @@rack.call(app); end", "def run opts = {}\n server = opts.delete(:server)\n (server && Rack::Handler.const_defined?(server)) || (server = HTTP__DEFAULT_SERVER)\n\n port = opts.d...
[ "0.6680522", "0.63276285", "0.623795", "0.6078304", "0.60108167", "0.5999523", "0.5979407", "0.5963275", "0.5939506", "0.58955073", "0.58579063", "0.5787052", "0.5781891", "0.5758993", "0.57560396", "0.5741701", "0.57299423", "0.5711665", "0.57111436", "0.57056063", "0.566103...
0.7642291
0
produit /produits/:produit_id/comments produit /produits/:produit_id/comments.xml
def create @produit = Produit.find(params[:produit_id]) @comment = @produit.comments.new(comment_params) @comment.user_id = current_user.id if @comment.save! redirect_to(@produit, :notice => 'Comment was successfully created.') else redirect_to(@produit, :notice => 'Comment was not succe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @comments_users = @produit.comments\n @comment = Comment.new( :produit => @produit )\n add_breadcrumb @produit.nom\n end", "def destroy\n produit = Produit.find(params[:produit_id])\n @comment = produit.comments.find(params[:id])\n @comment.destroy\n redirect_to(produit)\n end",...
[ "0.6922308", "0.6339981", "0.62497264", "0.61025816", "0.6069149", "0.6005901", "0.59322804", "0.5926561", "0.5897295", "0.5840528", "0.58395463", "0.570879", "0.57009226", "0.5696383", "0.56926006", "0.5690446", "0.5622133", "0.5621888", "0.5615248", "0.56019646", "0.5601964...
0.6229512
3
PUT /produits/:produit_id/comments/:id PUT /produits/:produit_id/comments/:id.xml
def update @produit = Produit.find(params[:produit_id]) @comment = @produit.comments.find(params[:id]) if @comment.update(comment_params) redirect_to produit_path(@produit) else render 'edit' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n produit = Produit.find(params[:produit_id])\n @comment = produit.comments.find(params[:id])\n @comment.destroy\n redirect_to(produit)\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n ...
[ "0.64693546", "0.6386276", "0.6310435", "0.6284097", "0.6219969", "0.6164034", "0.6151481", "0.60832435", "0.6054472", "0.60363495", "0.60219777", "0.5993083", "0.59480816", "0.59330875", "0.59326977", "0.591263", "0.5876238", "0.5876238", "0.5876238", "0.5876238", "0.5876238...
0.73852026
0
DELETE /produits/:produit_id/comments/1 DELETE /produits/:produit_id/comments/1.xml
def destroy produit = Produit.find(params[:produit_id]) @comment = produit.comments.find(params[:id]) @comment.destroy redirect_to(produit) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n \n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok } \n end\n end", "def destroy\n @pieces_commande = PiecesCommande.find(params[:id])\n @pieces_commande.destroy\n\n respond...
[ "0.69181466", "0.68174696", "0.6814674", "0.6814674", "0.6814674", "0.6814674", "0.6814674", "0.6814674", "0.6814674", "0.6814674", "0.6814674", "0.6814674", "0.6814674", "0.6814674", "0.6814674", "0.6813854", "0.68024486", "0.67750335", "0.6752967", "0.67449576", "0.67366606...
0.7932869
0
get file ext and return language as 'ruby', 'javascript', 'php' or nil if unknown
def get_lang_from_path case File.extname(@path).downcase when '.rb' 'ruby' when '.js' 'javascript' when '.php' 'php' else nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def what_language? filename\n test = filename.partition(\".\").last\n case test\n when \"rb\", \"ru\", \"erb\", \"slim\", \"haml\"\n \"Ruby\"\n when \"py\"\n \"Python\"\n when \"java\", \"jsp\", \"jsf\"\n \"Java\"\n when \"cpp\"\n \"C++\"\n when \"m\"\n \"Obj-C\"\n when \"c\"\n \"C\"\n w...
[ "0.7980527", "0.75729376", "0.7356253", "0.7317682", "0.72551733", "0.70484656", "0.70160365", "0.6998845", "0.6996185", "0.69735336", "0.69735336", "0.69735336", "0.69714", "0.69623494", "0.6911831", "0.69026136", "0.68462425", "0.68385476", "0.68360823", "0.67881036", "0.67...
0.8090765
0
this method removes some digits from the solution to create a puzzle
def puzzle(sudoku) for i in (1..65) b = rand(81) sudoku[b] = 0 end sudoku end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def puzzle(sudoku)\n#this method is yours to implement\n#need to remove 2 numbers from grid\nsudoku =sudoku.dup\n# [10,20,30,40,23,45,56,76,34,56,77,21].each do |index| \n(1.upto(81).to_a.shuffle.slice(0,25)).each do |index|\n sudoku[index]=''\nend\n # random_values =Array.new(10.upto(37).to_a).shuffle\n\t# random...
[ "0.6630241", "0.6603103", "0.6479867", "0.645885", "0.643311", "0.6350987", "0.63352233", "0.6247261", "0.6136404", "0.6121963", "0.611602", "0.61033034", "0.60841864", "0.6058191", "0.6054813", "0.5986607", "0.5978528", "0.5911764", "0.5894846", "0.5894596", "0.5866746", "...
0.528458
78
Command.new Command.new("python setup.py develop") Command.new("python", "setup.py develop") Command.new(:executable => "python", :arguments => "setup.py develop")
def initialize(*args) return self if args.empty? parsed_args = args.first.is_a?(Hash) ? args.first : parse_string_args(args) self.executable = parsed_args[:executable] self.arguments = parsed_args[:arguments] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def command\n return \"#{adjust_python_path} python #{kernel} #{args.join(' ')}\"\n end", "def install\n #python executable files\n end", "def command\n return \"#{adjust_python_path} python -E -m #{kernel} #{args.join(' ')}\"\n end", "def command(config_file)\n return \"#{...
[ "0.66831625", "0.6345593", "0.6195621", "0.6131005", "0.6092067", "0.60749716", "0.6055056", "0.5969341", "0.5913273", "0.58938974", "0.58938974", "0.5866773", "0.5811224", "0.5801952", "0.5778984", "0.57231665", "0.57064617", "0.5676634", "0.5640744", "0.56379783", "0.562070...
0.0
-1
Is this even needed? Would be better for closed permanently.
def destroy @service = Service.find(params[:id]) @service.destroy flash[:notice] = "This service profile was successfully deleted!" redirect_to root_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closed?() end", "def closed?() end", "def closed?() end", "def can_close?; end", "def closed?() @closed end", "def closed?; end", "def closed?; end", "def closed?; end", "def closed?; end", "def close; true; end", "def close; true; end", "def closing?; end", "def local_closed?; end", ...
[ "0.810322", "0.810322", "0.810322", "0.7989454", "0.79796726", "0.7963492", "0.7963492", "0.7963492", "0.7963492", "0.79068047", "0.79068047", "0.7906733", "0.7841984", "0.7782149", "0.7782149", "0.75757694", "0.75736946", "0.75615305", "0.7557933", "0.7557933", "0.7525222", ...
0.0
-1
Given an array_of_ints, find the highest_product you can get from three of the integers. The input array_of_ints will always have at least three integers.
def highest_prod(arr) highest_prod_2 = (arr[0] * arr[1]) highest = [arr[0], arr[1]].max lowest_prod_2 = (arr[0] * arr[1]) lowest = [arr[0], arr[1]].min highest_prod_3 = (arr[0] * arr[1] * arr[2]) i = 3 while i < arr.length current_num = arr[i] highest_prod_3 = [(highest_prod_3), (highest_prod_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def highest_product_brute(array_of_ints)\n array_size = array_of_ints.size\n return \"Input array has to contain at least 3 integers.\" if array_size < 3\n highest_three_integers = array_of_ints.sort.slice(array_size-3, 3)\n result = highest_three_integers.inject(:*)\nend", "def highest_product(array_of_ints...
[ "0.9015864", "0.9003911", "0.8827398", "0.8286441", "0.82428896", "0.8175804", "0.8039223", "0.8019383", "0.7986481", "0.7892683", "0.7569545", "0.7522142", "0.7353798", "0.7205806", "0.7187349", "0.7157381", "0.7116738", "0.7081951", "0.7081662", "0.7081112", "0.70750123", ...
0.7598373
10
GET /contract_types GET /contract_types.json
def index @contract_types = ContractType.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @catalog_contract_types = Catalog::ContractType.all\n end", "def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n format.ext_json { render :json => find_contract_types.to_ext_json(:class => ContractType, :count => ContractType.count(options...
[ "0.74401224", "0.73112357", "0.67024934", "0.66291046", "0.6443496", "0.6438471", "0.64239883", "0.6417786", "0.6372192", "0.6345555", "0.6333953", "0.6257367", "0.623534", "0.61868924", "0.60556024", "0.6040715", "0.60224223", "0.60074395", "0.59987634", "0.59763765", "0.593...
0.7589344
0
GET /contract_types/1 GET /contract_types/1.json
def show; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @contract_types = ContractType.all\n end", "def show\n @contract_type = ContractType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contract_type }\n end\n end", "def index\n @catalog_contract_types = Catalog::Cont...
[ "0.735163", "0.7318586", "0.7159336", "0.6987832", "0.6798586", "0.6604466", "0.64876574", "0.64831585", "0.64618206", "0.6412737", "0.63638276", "0.6192943", "0.61903983", "0.6189911", "0.61557996", "0.6150395", "0.6131736", "0.6083396", "0.6082328", "0.6069207", "0.6040501"...
0.0
-1
POST /contract_types POST /contract_types.json
def create @contract_type = ContractType.new(contract_type_params) respond_to do |format| if @contract_type.save format.html { redirect_to @contract_type, notice: 'Contract type was successfully created.' } format.json { render :show, status: :created, location: @contract_type } els...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @contract_type = ContractType.new(params[:contract_type])\n\n respond_to do |format|\n if @contract_type.save\n format.html { redirect_to @contract_type, notice: 'Contract type was successfully created.' }\n format.json { render json: @contract_type, status: :created, location...
[ "0.688606", "0.6743591", "0.6657519", "0.6286757", "0.62736064", "0.6022759", "0.6010107", "0.6010107", "0.60035205", "0.5984668", "0.5984668", "0.594178", "0.5876881", "0.58379835", "0.58207333", "0.57992494", "0.5787266", "0.56615996", "0.5620094", "0.5604673", "0.56029123"...
0.69430673
0
PATCH/PUT /contract_types/1 PATCH/PUT /contract_types/1.json
def update respond_to do |format| if @contract_type.update(contract_type_params) format.html { redirect_to @contract_type, notice: 'Contract type was successfully updated.' } format.json { render :show, status: :ok, location: @contract_type } else format.html { render :edit } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @contract_type = ContractType.find(params[:id])\n\n respond_to do |format|\n if @contract_type.update_attributes(params[:contract_type])\n format.html { redirect_to @contract_type, notice: 'Contract type was successfully updated.' }\n format.json { head :ok }\n else\n ...
[ "0.7207683", "0.68870896", "0.65656745", "0.6520061", "0.6359224", "0.6334131", "0.62755436", "0.62638175", "0.62541133", "0.62541133", "0.62541133", "0.62541133", "0.62541133", "0.62541133", "0.62541133", "0.62541133", "0.6178551", "0.6176161", "0.6157937", "0.6114515", "0.6...
0.7157341
1
DELETE /contract_types/1 DELETE /contract_types/1.json
def destroy @contract_type.destroy respond_to do |format| format.html { redirect_to contract_types_url, notice: 'Contract type a bien été supprimé.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @contract_type = ContractType.find(params[:id])\n @contract_type.destroy\n\n respond_to do |format|\n format.html { redirect_to contract_types_url }\n format.json { head :ok }\n end\n end", "def destroy\n @catalog_contract_type.destroy\n respond_to do |format|\n fo...
[ "0.7959721", "0.7453693", "0.74344695", "0.7017001", "0.69922185", "0.6919042", "0.6893774", "0.68892115", "0.68268746", "0.6819625", "0.68063986", "0.6790901", "0.67893827", "0.67856747", "0.67761445", "0.67761445", "0.67761445", "0.67761445", "0.67761445", "0.67761445", "0....
0.7544191
1
Use callbacks to share common setup or constraints between actions.
def set_contract_type @contract_type = ContractType.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 contract_type_params params.require(:contract_type).permit(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.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
What does the dependee depend on?
def dependents_for(dependee) recursive_ancestors_for(dependee, :dependee, :values) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dependent; end", "def dependent; end", "def referenced; end", "def deco_class; end", "def direct_dependencies; end", "def deco_call; end", "def isolated; end", "def isolated; end", "def deter\n \n end", "def referenced?; end", "def offences_by; end", "def member_discovered; end", ...
[ "0.702986", "0.702986", "0.6760438", "0.6694745", "0.6407893", "0.6384447", "0.63821757", "0.63821757", "0.6312859", "0.6141245", "0.6077533", "0.591267", "0.5865318", "0.5865318", "0.5865318", "0.58299094", "0.5773099", "0.57362646", "0.57362646", "0.57362646", "0.57362646",...
0.5347953
69
What depends on the dependent?
def dependees_for(dependent) recursive_ancestors_for(dependent, :dependent, :keys) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dependent; end", "def dependent; end", "def direct_dependencies; end", "def dependent=(_arg0); end", "def dependent=(_arg0); end", "def dependencies; end", "def dependencies; end", "def dependencies; end", "def dependency_respects_ordering?; @dependency_respects_ordering; end", "def dependenc...
[ "0.826476", "0.826476", "0.76061094", "0.7366693", "0.7366693", "0.7128831", "0.7128831", "0.7128831", "0.7087399", "0.6855507", "0.6754188", "0.6569828", "0.65674025", "0.6437103", "0.639396", "0.639396", "0.639396", "0.63657147", "0.6267131", "0.6251363", "0.6248284", "0....
0.0
-1
We just clean it up to produce readable YAML
def serialize_value(v) case v when TZOffset, Geo::Coord, Reality::Link, Reality::Measure, Money::Currency v.inspect when Array v.map(&method(:serialize_value)) when String, Numeric, Date, Time v else fail ArgumentError, "Not a basic value in the entity: #{v.inspect}" end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_yaml() end", "def clean_yaml(yaml_input)\n yaml_output = yaml_input\n\n # Had some issues with different versions of ruby giving different results\n yaml_output.gsub!(%r(!ruby/sym(bol)? ), ':')\n\n # Also, some versions appear to dump out trailing whitespace\n yaml_output.gsub!(/\\s+$/, '')...
[ "0.69963205", "0.69689363", "0.6724254", "0.6713931", "0.6600182", "0.6567452", "0.6564286", "0.64849705", "0.6396009", "0.639494", "0.6394839", "0.63523746", "0.6342155", "0.62883675", "0.6283837", "0.62625605", "0.6253107", "0.6253107", "0.62486553", "0.62360626", "0.618421...
0.0
-1
Around callback that makes sure default ENV variables needed for JWT authentication are set by default. It is still possible to overwrite some of the ENV vars for specific case. class MyControllerTest < ContainerService::IntegrationTest test "env var needs to be stubed for this test" do ClimateControl.modify(JWT_VALIDA...
def around ClimateControl.modify(default_env_vars) do super end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def with_env(env)\n before = Rucola::RCApp.env\n Rucola::RCApp.stubs(:env).returns(env)\n yield\n Rucola::RCApp.stubs(:env).returns(before)\nend", "def with_test_env\n in_separate_environment do\n # Overwrite environment variables with values for testing\n Dotenv.overload '.env.test'\n yield...
[ "0.6268718", "0.62559694", "0.61264926", "0.5924378", "0.5914845", "0.58495575", "0.584014", "0.5840076", "0.58018583", "0.5797311", "0.5729719", "0.5719577", "0.5699933", "0.5633475", "0.5633475", "0.5633475", "0.5629018", "0.5570114", "0.5570114", "0.5570114", "0.55536133",...
0.661659
0
Updates conditions with user defined conditions if necessary
def merge_find_next_or_previous_options(defaults, options) if options.include?(:conditions) if !options[:conditions].is_a?(String) raise "Only string conditions are supported at the moment, not #{options[:conditions].inspect}" end defaults[:conditions][0] = "#{defaults[:conditi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_conditions(conditions, new_condition)\n conditions ||= {}\n updated_conditions = conditions.clone rescue nil\n if updated_conditions.blank?\n if new_condition.is_a? String\n new_condition.sub!(/^\\s*(or|OR|and|AND)\\s*/, '')\n elsif new_condition[0].is_a? String\n new_co...
[ "0.7448997", "0.7239395", "0.722131", "0.7204148", "0.706663", "0.6886071", "0.6800891", "0.675354", "0.67337924", "0.67337924", "0.6682157", "0.6661057", "0.6605485", "0.65796435", "0.65647304", "0.6560264", "0.6553708", "0.6495578", "0.6474252", "0.64631075", "0.644045", ...
0.0
-1
Finds the rows to the left of the row having the given ID
def find_previous_rows(limit = 1, options = {}) defaults = { :conditions => [ "id < ?", id], :order => 'id desc', :limit => limit } self.class.find_next_or_previous(defaults, options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def part_of_row_left(starting, ending)\n row(starting[1])[(ending[0] + 1)..(starting[0] -1)]\n end", "def left!(origin, stop)\n y = origin.column\n\n while y >= stop.column\n add_result extract!(IndexPath[origin.row, y])\n\n y -= 1\n end\n\n # Begin moving up from the start ...
[ "0.6539652", "0.57730544", "0.57422006", "0.56987196", "0.55574346", "0.54924315", "0.543752", "0.5403212", "0.53444016", "0.5282624", "0.5280158", "0.5274416", "0.52705294", "0.5234603", "0.521539", "0.5174197", "0.51444995", "0.51415", "0.5124756", "0.5111826", "0.5081334",...
0.5558226
4
row level methods go here extract the first three stanzas from each filename e.g 'webgl_shadowmap_viewer.html' > ['webgl', 'shadowmap', 'viewer'] def extract_name_info_from_fn(fn:)
def extract_stanzas(fn:) result = [] # switch on the number of "stanzas" in the fn # three or greater stanzas if fn.match(/([^_\.]+)_([^_]+)_([^_\.]+)/) m = fn.match(/([^_\.]+)_([^_]+)_([^_\.]+)/) result[0] = m[1] result[1] = m[2] result[2] = m[3] # two stanzas elsif fn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nameparts(f)\n File.basename(f).scan(/([^_]+)_([\\d]+)([^\\.]*)/)[0]\nend", "def get_name(url)\n (url.match('features\\/(.*)\\z') || [])[1]\n end", "def find_test_name( filename )\n check = /^[^\\.+$]\\w+_(of.*)\\..*/.match( filename )\n return check[ 1 ].to_s if check\n return \"\"\n...
[ "0.5933342", "0.58435005", "0.582112", "0.5815148", "0.5760268", "0.5718312", "0.5676467", "0.56536233", "0.5646949", "0.5642925", "0.56335354", "0.5613722", "0.5546375", "0.5543171", "0.5508722", "0.5505124", "0.5480278", "0.5475095", "0.5474165", "0.5469148", "0.5459991", ...
0.71773297
0