query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
GET /reports/new GET /reports/new.json
def new @event = Event.find(params[:event_id]) @report = @event.reports.new respond_to do |format| format.html # new.html.erb format.json { render json: @report } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @report = Report.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @report }\n end\n end", "def new\n @report = Report.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @report }\n end\n...
[ "0.7988625", "0.7988625", "0.7988625", "0.7988625", "0.76395464", "0.76291704", "0.76113766", "0.74465275", "0.7443538", "0.7383569", "0.7328537", "0.7328116", "0.72734195", "0.7206323", "0.71970457", "0.71902096", "0.716774", "0.71378624", "0.7120984", "0.7101704", "0.709850...
0.76825714
4
POST /reports POST /reports.json
def create @event = Event.find(params[:event_id]) @report = @event.reports.new(params[:report]) @report.attributes = params[:report] @report.member_id = current_member.id respond_to do |format| if @report.save format.html { redirect_to(event_path(@event)) } format.json { render json: @report, status: :created, location: @report } else format.html { render action: "new" } format.json { render json: @report.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report\n @report = Report.create(reports_params)\n if @report.valid?\n render json: {}, status: :created\n else\n render json: { error: 'failed to create report' }, status: :internal_server_error\n end\n end", "def create\n @report = Report.new(report_params)\n\n re...
[ "0.77267456", "0.71440965", "0.7033348", "0.70297456", "0.7006169", "0.6989695", "0.6989695", "0.698222", "0.6979302", "0.6979302", "0.6979302", "0.6961894", "0.6960234", "0.695844", "0.68224156", "0.6808665", "0.68054426", "0.67791307", "0.6777732", "0.67731243", "0.67679095...
0.66784614
25
PUT /reports/1 PUT /reports/1.json
def update @event = Event.find(params[:event_id]) @report = @event.reports.find(params[:id]) @report.member_id = current_member.id respond_to do |format| if @report.update_attributes(params[:report]) format.html { redirect_to(event_path(@event))} format.json { head :ok } else format.html { render action: "edit" } format.json { render json: @report.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @custom_report = CustomReport.find(params[:id])\n\n if @custom_report.update(params[:custom_report])\n head :no_content\n else\n render json: @custom_report.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @report.update(rep...
[ "0.691297", "0.68930006", "0.6880123", "0.6866398", "0.6830857", "0.6827557", "0.6824345", "0.6824345", "0.6786194", "0.67788744", "0.6769023", "0.6764582", "0.6762239", "0.6762239", "0.6762239", "0.6762239", "0.6762239", "0.6762239", "0.6762239", "0.6762239", "0.6762239", ...
0.6498523
35
DELETE /reports/1 DELETE /reports/1.json
def destroy @event = Event.find(params[:event_id]) @report = Report.find(params[:id]) @report.destroy respond_to do |format| format.html { redirect_to(event_path(@event)) } format.html { redirect_to reports_url } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @report.destroy!\n render json: {status: :ok}\n end", "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @report.destroy\n respond_to do |format|\n ...
[ "0.78883916", "0.77925867", "0.7791945", "0.7791945", "0.7791945", "0.7768737", "0.7727435", "0.7727435", "0.7727435", "0.7727435", "0.7672675", "0.75966144", "0.75292933", "0.75292933", "0.75199825", "0.7518596", "0.7518159", "0.7505007", "0.7485241", "0.7485241", "0.7485241...
0.70875955
83
Before filters Confirms an fabrication user.
def fabrication_user redirect_to(login_path) unless current_user.admin? || current_user.fabrication? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_user_background\n self.status = Status::PENDING_ADMIN_ACTION if offender && offender.new_user?\n end", "def correct_user\n set_user\n unless current_user?(@user)\n flash[:danger] = 'This action is not permitted for this account since you are not the owner'\n redirect_to overview_use...
[ "0.61558485", "0.6043502", "0.5894625", "0.58887404", "0.57658273", "0.57492685", "0.5745981", "0.57442343", "0.57432103", "0.5716345", "0.57160395", "0.5705513", "0.57035697", "0.5678733", "0.5674565", "0.5651818", "0.5639535", "0.5638961", "0.56248444", "0.55933315", "0.557...
0.63966686
0
Confirms a loggedin user.
def logged_in_user unless logged_in? store_location flash[:danger] = "Please log in." redirect_to login_url end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def correct_user\n @user = User.find(params[:id])\n if !current_user?(@user)\n message = \"currently logged in as #{current_user.name}. Not you? \"\n message += \"#{view_context.link_to('Log out.', log_out)}\".html_safe\n flash[:warning] = message\n redirect_to(root_url)\n ...
[ "0.70087826", "0.6982988", "0.6919373", "0.688131", "0.6845446", "0.68326277", "0.67944413", "0.67929715", "0.6642435", "0.6624581", "0.66114175", "0.66022736", "0.6589018", "0.65539706", "0.65349805", "0.65303934", "0.6512816", "0.650312", "0.64878744", "0.6487622", "0.64804...
0.0
-1
GET /words/1 GET /words/1.json
def show @word = Word.find(params[:id]) #debug @texts = @word.texts ############################ respond_to do |format| format.html # show.html.erb format.json { render json: @word } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @words = Word.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @words }\n end\n end", "def index\n @words = Word.order(:word).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @words...
[ "0.7429448", "0.7319466", "0.6972863", "0.6967815", "0.6967815", "0.6967815", "0.6967815", "0.69490016", "0.6882972", "0.6844286", "0.6784204", "0.67738223", "0.6706241", "0.666595", "0.66490847", "0.66206956", "0.66147673", "0.6596243", "0.65929395", "0.6562485", "0.6520743"...
0.70108694
2
GET /words/new GET /words/new.json
def new @word = Word.new respond_to do |format| format.html # new.html.erb format.json { render json: @word } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @words_page = WordsPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @words_page }\n end\n end", "def new\n @word_list = WordList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wor...
[ "0.7466666", "0.7447213", "0.73636746", "0.71447676", "0.7127438", "0.7099524", "0.70336705", "0.7018312", "0.70074964", "0.6959061", "0.69574195", "0.69189286", "0.6905182", "0.6838113", "0.6837291", "0.6831426", "0.67910624", "0.6773387", "0.67628574", "0.6759837", "0.67575...
0.7744984
4
POST /words POST /words.json
def create #debug logout("Creating a new Word instance...") @word = Word.new(params[:word]) ################################################\ text_id = @word.text_id # text = Text.find(:id => text_id.to_i) text = Text.find(text_id.to_i) if text != nil logout("text.id => " + text.id.to_s) else logout("text == nil") end # logout(text.) # text.words << @word # logout(text.words << @word) # res = text.words << @word # logout("res=" + res) # @word.texts << text #=> "text.. << ..word" or "word.. << ..text" #=> Both generate the same entry in the join table #=> So, you only need to do either of the two. ################################################/ logout("Saving a new Word instance...") respond_to do |format| if @word.save #debug text.words << @word format.html { redirect_to @word, notice: 'Word was successfully created.' } format.json { render json: @word, status: :created, location: @word } else format.html { render action: "new" } format.json { render json: @word.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created }\n else\n format.html { render :new }\n format.json do\n ...
[ "0.7019656", "0.6971481", "0.6971185", "0.6971185", "0.6931771", "0.6931771", "0.6931771", "0.6914835", "0.690951", "0.68520063", "0.6836471", "0.67519444", "0.66731495", "0.663265", "0.66108733", "0.65689427", "0.6567912", "0.65574676", "0.65227306", "0.65026134", "0.6484531...
0.6595425
15
PUT /words/1 PUT /words/1.json
def update @word = Word.find(params[:id]) respond_to do |format| if @word.update_attributes(params[:word]) format.html { redirect_to @word, notice: 'Word was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @word.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @word = Word.find(params[:id])\n\n respond_to do |format|\n\n if @word.update_attributes(params[:word])\n format.json { head :no_content }\n else\n format.json { render :json => @word.errors,\n :status => :unprocessable_entity }\n end\n...
[ "0.72861445", "0.6889494", "0.6697661", "0.6688726", "0.6656439", "0.65344167", "0.65316314", "0.6530054", "0.6528661", "0.6512278", "0.6512278", "0.6512278", "0.6512278", "0.6512278", "0.6489293", "0.6433598", "0.6264915", "0.6223157", "0.62184626", "0.6218441", "0.62070066"...
0.68070537
5
DELETE /words/1 DELETE /words/1.json
def destroy @word = Word.find(params[:id]) @word.destroy respond_to do |format| format.html { redirect_to words_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n check_access\n @word.destroy\n respond_to do |format|\n format.html { redirect_to words_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @word.destroy\n respond_to do |format|\n format.html { redirect_to words_url }\n format.json { head :n...
[ "0.748589", "0.74083376", "0.7274209", "0.72464556", "0.71613306", "0.7130053", "0.7130053", "0.7130053", "0.7130053", "0.7130053", "0.713002", "0.705873", "0.70178014", "0.700136", "0.68921345", "0.68765783", "0.68703896", "0.68493503", "0.68372613", "0.68112844", "0.6804299...
0.74687207
5
Try to get the description from the matcher. If an error is raised, we deduct the description from the matcher name, but it will be shown in english.
def get_description_from_matcher(should_or_should_not, method, *args, &block) #:nodoc: verb = should_or_should_not.to_s.gsub('_', ' ') desc = Remarkable::Matchers.send(method, *args, &block).spec(self).description verb = Remarkable.t("remarkable.core.#{should_or_should_not}", :default => verb) rescue desc = method.to_s.gsub('_', ' ') ensure verb << ' ' << desc end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def description\n \"#{match.description} #{label}\"\n end", "def rspec_matcher_message(matcher)\n if @negated\n if matcher.respond_to?(:failure_message_for_should_not)\n return matcher.failure_message_for_should_not\n end\n if matcher.respond_to?(:negative_failure_message)\...
[ "0.7002824", "0.66776544", "0.6568877", "0.6486126", "0.63613474", "0.6265471", "0.62402743", "0.6230549", "0.61934453", "0.61049885", "0.60743594", "0.6069768", "0.6023861", "0.601955", "0.601955", "0.60113716", "0.5983235", "0.59459275", "0.5935159", "0.5926294", "0.5917065...
0.7149734
0
GET /motoristas GET /motoristas.json
def index @motoristas = Motorista.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @motorista = Motoristum.all\n end", "def index\n @mercado_meta = MercadoMetum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mercado_meta }\n end\n end", "def index\n @tutorados = Tutorado.all\n\n render json: @tutorados, st...
[ "0.71268445", "0.64786047", "0.64438635", "0.62762994", "0.6254317", "0.6237113", "0.6219183", "0.6195382", "0.617555", "0.61468154", "0.61306137", "0.61289227", "0.6125743", "0.6114985", "0.611412", "0.6096815", "0.6061208", "0.6054718", "0.60536295", "0.6051012", "0.6042802...
0.7240977
0
GET /motoristas/1 GET /motoristas/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @motoristas = Motorista.all\n end", "def index\n @motorista = Motoristum.all\n end", "def show\n @torso = Torso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torso }\n end\n end", "def index\n v = params[:id...
[ "0.7002091", "0.6971629", "0.6404238", "0.63316697", "0.6318471", "0.6311078", "0.6207347", "0.62027127", "0.61509025", "0.61397725", "0.61222917", "0.61208224", "0.61065495", "0.6082121", "0.60673916", "0.60580117", "0.60546964", "0.6039412", "0.6035925", "0.6035052", "0.602...
0.0
-1
POST /motoristas POST /motoristas.json
def create @motorista = Motorista.new(motorista_params) respond_to do |format| if @motorista.save format.html { redirect_to @motorista, notice: 'Motorista was successfully created.' } format.json { render :show, status: :created, location: @motorista } else format.html { render :new } format.json { render json: @motorista.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @motoristum = Motoristum.new(motoristum_params)\n\n respond_to do |format|\n if @motoristum.save\n format.html { redirect_to @motoristum, notice: 'Motoristum was successfully created.' }\n format.json { render :show, status: :created, location: @motoristum }\n else\n ...
[ "0.6973218", "0.64795464", "0.61836296", "0.6046953", "0.59461075", "0.59159255", "0.5911643", "0.59076995", "0.5877525", "0.583053", "0.5827453", "0.5786268", "0.5768061", "0.57550406", "0.5731662", "0.5709958", "0.57027006", "0.5691608", "0.5689551", "0.5686744", "0.5678864...
0.7145234
0
PATCH/PUT /motoristas/1 PATCH/PUT /motoristas/1.json
def update respond_to do |format| if @motorista.update(motorista_params) format.html { redirect_to @motorista, notice: 'Motorista was successfully updated.' } format.json { render :show, status: :ok, location: @motorista } else format.html { render :edit } format.json { render json: @motorista.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @veiculo_motorista.update(veiculo_motorista_params)\n format.html { redirect_to @veiculo_motorista, notice: 'Veiculo motorista was successfully updated.' }\n format.json { render :show, status: :ok, location: @veiculo_motorista }\n else\n f...
[ "0.63907456", "0.6326866", "0.6192396", "0.61508685", "0.59999245", "0.5987547", "0.59737253", "0.59448296", "0.59365195", "0.5935309", "0.592544", "0.59203774", "0.5916898", "0.5910878", "0.5880277", "0.58800596", "0.5879342", "0.5878335", "0.58735615", "0.58569324", "0.5846...
0.65347147
0
DELETE /motoristas/1 DELETE /motoristas/1.json
def destroy @motorista.destroy respond_to do |format| format.html { redirect_to motoristas_url, notice: 'Motorista was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @motoristum.destroy\n respond_to do |format|\n format.html { redirect_to motorista_url, notice: 'Motoristum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @veiculo_motori...
[ "0.72965306", "0.71745193", "0.71325684", "0.70704013", "0.7045409", "0.69561356", "0.6911008", "0.68941575", "0.68762916", "0.68703395", "0.68029547", "0.6795974", "0.6789046", "0.67864674", "0.67797166", "0.67718273", "0.6763237", "0.6755851", "0.67514765", "0.6744306", "0....
0.72577024
1
Use callbacks to share common setup or constraints between actions.
def set_motorista @motorista = Motorista.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 motorista_params params.require(:motorista).permit(:nome, :cnh, :telefone, :email, :cpf, :empresa_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
def palindrome(string) word = string reverse = string.reverse if word == reverse return true end end
def palindrome(string) word_array = string.split("") word_array.each_with_index do |letter,index| if letter[index] == letter[-index] return true end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def palindrome (string)\n\n if string.reverse == string\n return true\n else\n return false\n end\n \nend", "def palindrome(string)\n\tif string == string.reverse\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "def palindrome?(string)\r\n reverse_string = string.reverse\r\n ...
[ "0.9336616", "0.9218545", "0.91843647", "0.9179143", "0.9152535", "0.9152158", "0.9141703", "0.9141703", "0.9141703", "0.91265595", "0.9113413", "0.91000974", "0.90819865", "0.90819865", "0.90819865", "0.9081845", "0.90729034", "0.9065183", "0.9049281", "0.90339994", "0.90220...
0.8747479
96
Checks if node has any parent matching selectors.
def parent?(*selectors, &block) !lookup_parents(*selectors, &block).empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parent?(node, maybe_child = nil)\n if maybe_child.nil?\n !offsprings(node).empty?\n else\n offsprings(node).include? maybe_child\n end\n end", "def hasParent?(node)\n if node.parent != nil\n true\n else\n false\n end\nend", "def has_parent?\n !parent.nil?\n ...
[ "0.6674149", "0.667322", "0.6494785", "0.6388815", "0.63018084", "0.6196651", "0.61748534", "0.61590326", "0.61387646", "0.6098957", "0.60971165", "0.60971165", "0.6090368", "0.6071196", "0.6071196", "0.6066654", "0.6065231", "0.6036568", "0.60309654", "0.6001819", "0.5997662...
0.8076362
0
Selects nodes of current list (and only it, no children checks), which are matching selectors.
def find(*selectors, &block) _find(Selector.new(*selectors, &block)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_nodes(&block)\n each_node.select &block\n end", "def query_selector_all(expr)\n Traverser.new(expr).evaluate(Context.new(node: self))\n end", "def search(*selectors)\n NodeSet.new selectors.map {|selector|\n xpath(selector).to_a.concat(css(selector).to_a)\n }.flatten.uniq\n e...
[ "0.6534402", "0.64425373", "0.6235902", "0.6086775", "0.60485935", "0.57681435", "0.57300156", "0.56777847", "0.5664146", "0.5655001", "0.5649252", "0.55901766", "0.55865365", "0.55747336", "0.5566006", "0.55041295", "0.5503651", "0.5465239", "0.54225886", "0.5377368", "0.537...
0.5134655
41
Pass a Date, DateTime, or Time object and the week will represent the corresponding week. Notice that the Week class itself _always_ uses Date objects.
def initialize(d=Date.today) if d.instance_of? Time rd = Date.civil(d.year, d.month, d.day) elsif d.instance_of? DateTime rd = Date.jd(d.jd) else rd = d.dup # always make a duplicate before modifying arguments end raise ArgumentError, "Must pass Date, DateTime, or Time object" unless rd.instance_of? Date @attachments = [] @days = [] rd -= 1 while rd.wday > 0 # puts "Got past first while" # puts rd @days << rd for i in (1...7) @days[i] = (rd + i) end # puts "Got past for" @days.freeze end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_week\n if self.class == Date\n self + 7\n elsif self.class == Time\n self + (60 * 60 * 24 * 7)\n end\n end", "def next_week\n if self.class == Date\n self + 7\n elsif self.class == Time\n self + (60 * 60 * 24 * 7)\n end\n end", "def week\...
[ "0.7315921", "0.7315921", "0.7309314", "0.72571933", "0.72561663", "0.72278", "0.71980786", "0.711146", "0.7108396", "0.709764", "0.7032981", "0.70024335", "0.69977105", "0.69673663", "0.695979", "0.6889895", "0.6872078", "0.6866533", "0.6774309", "0.67288446", "0.6709155", ...
0.0
-1
Comparisons are made based on the first day of the week.
def <=>(other) @days[0] <=> other.days[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_start_of_week(p_date)\n if p_date.wday == 0 #sundays count as end of week for vehicle app\n return p_date - 6\n else\n (p_date - p_date.wday.days) + 1 #start on monday\n end\n end", "def first_wday\n case Setting.start_of_week.to_i\n when 1\n @first_dow ||= (...
[ "0.73119575", "0.7291786", "0.72146505", "0.7170177", "0.7048601", "0.7048601", "0.7021083", "0.69725907", "0.69536245", "0.6914289", "0.6909187", "0.6884129", "0.6884129", "0.6827239", "0.68233365", "0.6770212", "0.67677927", "0.67477155", "0.67307955", "0.67146695", "0.6703...
0.0
-1
If the given day falls within this week, true. Otherwise, false. If the given weeks are equal, true.
def ===(other) case other when Date @days.include? Date.jd(other.jd) #in case it's a DateTime when Time @days.include? Date.civil(other.year, other.month, other.day) else super end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def includesDay(weekDay)\r\n if !@start_day.nil?\r\n if @end_day.nil? \r\n @start_day == weekDay\r\n elsif @start_day < @end_day \r\n @start_day <= weekDay and weekDay <= @end_day\r\n else\r\n @start_day <= weekDay and weekDay <= (@end_day + 7)\r\n end\r\n else\r\n ...
[ "0.74965", "0.7228022", "0.6807555", "0.67584014", "0.67451155", "0.67336875", "0.6725367", "0.6688218", "0.6663906", "0.663276", "0.66192675", "0.657433", "0.6569847", "0.64960074", "0.6482339", "0.64580894", "0.64580894", "0.6427656", "0.639208", "0.63573384", "0.6295151", ...
0.0
-1
Important! The number of days you give is added to the LAST day of the week. The week in which the resulting date falls is returned.
def +(num) # raise ArgumentError, "Must pass Integer or Float" unless rnum = num.to_i Week.new(@days[6] + num.to_i) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weeks() 7 * days end", "def end_of_week; self + (6 - wday).days end", "def day_of_week(date)\n 7 - date.cwday\n end", "def week\n @week ||= (((date-start_of_month)+1)/7.0).ceil\n end", "def week\n first_day_of_week = @date.monday\n \n days_of_week = []\n 7.times do |time|\n ...
[ "0.7989634", "0.79788303", "0.7741537", "0.7638159", "0.76166636", "0.7614125", "0.75797147", "0.7523931", "0.7507982", "0.7507562", "0.7500643", "0.7484982", "0.74762887", "0.7461137", "0.74500984", "0.7404251", "0.7404251", "0.7378122", "0.73756313", "0.737297", "0.7345152"...
0.0
-1
Important! The number of days you give is subtracted from the FIRST day of the week. The week in which the resulting date falls is returned.
def -(num) # raise ArgumentError, "Must pass Integer or Float" unless rnum = num.to_i Week.new(@days[0] - num.to_i) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def day_of_week(date)\n 7 - date.cwday\n end", "def start_of_week; self - wday.days end", "def weeks() 7 * days end", "def days_past_in_week\n to_date.cwday\n end", "def day_in_week(args = nil)\n if args\n args.each do |key, val|\n case key\n when :mfirst\n else...
[ "0.8044246", "0.7908057", "0.7848722", "0.7843773", "0.764321", "0.7639585", "0.760378", "0.75906277", "0.75687903", "0.7513285", "0.74920464", "0.7472344", "0.74634", "0.74622154", "0.74158984", "0.7409358", "0.7380959", "0.7380018", "0.7372159", "0.7369252", "0.734191", "...
0.0
-1
Allows forwarding of messages to the days array, letting you leave off the .days call
def method_missing(symbol, *args, &block) if @days.methods.include? symbol.to_s @days.send(symbol, *args, &block) else super end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def receive_work(man_days)\n @man_days_done += man_days\n end", "def day(member)\n puts \"sending for #{member.login}\"\n @day = member.days.latest\n @watchings = @day.watchings\n @followings = @day.followings\n @watchers = @day.watchers\n @followers = @day.followers\n mail from: \"Gitda...
[ "0.65688765", "0.5846179", "0.5836208", "0.5809509", "0.57889366", "0.57007915", "0.567565", "0.56367415", "0.5558957", "0.5552465", "0.5467556", "0.54533666", "0.5431738", "0.538641", "0.5381316", "0.53801763", "0.53378224", "0.5322494", "0.5278249", "0.5257306", "0.5233246"...
0.0
-1
returns a symbol that represents suspended flag
def suspended_mark suspended? ? raw('&#x2611;') : raw('&#x2610;') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status_sym\n (status || :off).to_sym\n end", "def symbol\n STATUS_CODE_TO_SYMBOL[status]\n end", "def suspended?\n (status == SUSPENDED)\n end", "def suspended?\n !active?\n end", "def suspend\n\t\t@state = STATE_SUSPENDED\n\tend", "def status_sym\n return nil if status.nil?\n ...
[ "0.63390607", "0.5988226", "0.5972483", "0.58482766", "0.58225286", "0.58116007", "0.5791923", "0.57038116", "0.56957954", "0.5681396", "0.5664024", "0.5649835", "0.5642211", "0.5613901", "0.56073767", "0.56073767", "0.5605848", "0.55522746", "0.5529583", "0.5489729", "0.5485...
0.68228626
0
method assumes that stock already exists
def updated_last_price return StockQuote::Stock.quote(self.ticker).latest_price end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_stock_on_create\n # Update current Stock\n if !update_stock(product, store, quantity, true)\n return false\n end\n true\n end", "def item_stock(item)\n item_stocks.create(item_id: item.id)\n end", "def in_stock?\n stock\n end", "def in_stock?\n true\n end", ...
[ "0.71235585", "0.7049322", "0.7047918", "0.7031588", "0.6898572", "0.6887311", "0.68510324", "0.68491966", "0.683364", "0.6795614", "0.67753506", "0.6740849", "0.6736913", "0.67093736", "0.6696805", "0.6652004", "0.6628446", "0.66139024", "0.66032904", "0.6569054", "0.6554962...
0.0
-1
A function to create a new ontology (if already Acronym already existing on the portal it will return HTTPConflict)
def create_ontology(ont_info) uri = URI.parse(TARGET_API) http = Net::HTTP.new(uri.host, uri.port) req = Net::HTTP::Put.new("/ontologies/#{ont_info['acronym']}") req['Content-Type'] = 'application/json' req['Authorization'] = "apikey token=#{TARGET_APIKEY}" if ont_info['viewingRestriction'] == 'private' # In case of private ontology (acl: list of user that have the right to see the ontology) req.body = { 'acronym': ont_info['acronym'], 'name': ont_info['name'], 'group': ont_info['group'], 'hasDomain': ont_info['hasDomain'], 'administeredBy': [TARGETED_PORTAL_USER], 'viewingRestriction': 'private', 'acl': [TARGETED_PORTAL_USER] }.to_json else req.body = { 'acronym': ont_info['acronym'], 'name': ont_info['name'], 'group': ont_info['group'], 'hasDomain': ont_info['hasDomain'], 'administeredBy': [TARGETED_PORTAL_USER] }.to_json end response = http.start do |http| http.request(req) end return response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @ontology = SYMPH::Ontology.save(params[:ontology])\n \n respond_to do |format|\n if @ontology\n flash[:notice] = 'Ontology was successfully created.'\n else\n flash[:notice] = 'Failed on create ontology.'\n end\n format.html { redirect_to :action => :edi...
[ "0.7271292", "0.6949649", "0.66326207", "0.6442707", "0.6077809", "0.5670109", "0.5624913", "0.554292", "0.55407727", "0.55388", "0.55112106", "0.550927", "0.5501485", "0.5495997", "0.5493747", "0.5487365", "0.54849344", "0.54723203", "0.54704416", "0.54096454", "0.54089075",...
0.7561418
0
A function that take the submission informations from the source BioPortal to create a new submission 2 possibilities: the source BioPortal pulls the ontology from an URL (pullLocation is filled), in this case we directly pull from this URL Or it stores it directly in the portal, in this case we pull it from the portal download link
def upload_submission(sub_info) uri = URI.parse(TARGET_API) http = Net::HTTP.new(uri.host, uri.port) req = Net::HTTP::Post.new("/ontologies/#{sub_info['ontology']['acronym']}/submissions") req['Content-Type'] = 'application/json' req['Authorization'] = "apikey token=#{TARGET_APIKEY}" # Check if the source BioPortal is pulling the ontology from an URL # If yes then we will pull the ontology from this place (allow auto update of the ontology when the ontology is changed in its source URL) if sub_info['pullLocation'].nil? pull_location = "#{sub_info['ontology']['links']['download']}?apikey=#{SOURCE_APIKEY}" else pull_location = sub_info['pullLocation'] end # Extract contacts contacts = [] sub_info['contact'].each do |contact| contacts.push({'name': contact['name'],'email': contact['email']}) end # Build the json body # hasOntologyLanguage options: OWL, UMLS, SKOS, OBO # status: alpha, beta, production, retired req.body = { 'contact': contacts, 'hasOntologyLanguage': sub_info['hasOntologyLanguage'], 'released': sub_info['released'], 'ontology': "#{TARGET_API}/ontologies/#{sub_info['ontology']['acronym']}", 'description': sub_info['description'], 'status': sub_info['status'], 'version': sub_info['version'], 'homepage': sub_info['homepage'], 'documentation': sub_info['documentation'], 'publication': sub_info['publication'], 'naturalLanguage': sub_info['naturalLanguage'], 'pullLocation': pull_location }.to_json #puts req.body.to_s response = http.start do |http| http.request(req) end return response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n if request.headers['Content-Disposition']\n filename = request.headers['Content-Disposition'].split('filename=').last\n filename = filename.scan(/(?<=\")[^\"]+/).first if filename.include?('\"')\n filename = filename.split('/').last.split('.')\n extension = filename.pop\n n...
[ "0.5649767", "0.56100667", "0.55535525", "0.55441594", "0.5515882", "0.5458805", "0.5457302", "0.54464966", "0.54051596", "0.5384959", "0.5334929", "0.52833927", "0.5260168", "0.5233047", "0.5232275", "0.52251667", "0.5220731", "0.52132803", "0.5170259", "0.5158985", "0.51400...
0.6659864
0
Yields the zone popped from the params, or dies
def zone(&block) @zone ||= params.delete(:zone) die('You need to specify the zone (-z)') unless @zone yield @zone end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zone() end", "def zone; end", "def next\n return nil unless next?\n ensure_zone!\n @zone.records token: token\n end", "def each_map_block_z(z)\n (0...world.map.x_count_block).each { |xb|\n xl = world.map.block_index[xb]\n (0...wor...
[ "0.5713295", "0.5017873", "0.4931837", "0.49039322", "0.4888995", "0.4888995", "0.4888995", "0.48075408", "0.48059946", "0.465223", "0.46478957", "0.4632612", "0.46271023", "0.4625216", "0.46119002", "0.46028662", "0.45916173", "0.45834133", "0.45800078", "0.45733187", "0.456...
0.5689667
1
A place to gather params for queries
def params @params ||= {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_params; end", "def query_parameters\n end", "def query_params\n get_query_params\n end", "def query_parameters; end", "def query ; @request.params ; end", "def query_params=(_arg0); end", "def query_params\n params[:query]\n end", "def query_params\n\t\t\t\t{}...
[ "0.78267217", "0.77497673", "0.76982087", "0.7670583", "0.7630246", "0.75341403", "0.7456918", "0.72966474", "0.7284023", "0.7228162", "0.7221131", "0.7219457", "0.7182455", "0.7182455", "0.7182455", "0.7182455", "0.71676576", "0.71163285", "0.7108905", "0.7100892", "0.710089...
0.6892246
34
Sets a param for a query (used by options)
def set(params = {}) self.params.merge!(params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_param\n send \"#{param_column}=\", to_param if param_column?\n end", "def set_param\n send \"#{param_column}=\", to_param if param_column?\n end", "def set_param\n @param = Param.find(params[:id])\n end", "def custom_param(query_str)\n @query[:custom_param] = query_str\n sel...
[ "0.70625216", "0.70625216", "0.7032536", "0.695381", "0.68071157", "0.6643035", "0.6628128", "0.65771925", "0.6576773", "0.6576773", "0.6576773", "0.6576773", "0.6576773", "0.6576773", "0.6576773", "0.6576773", "0.6576773", "0.6576773", "0.6576773", "0.6576773", "0.6576773", ...
0.56144774
81
Creates a record (using params)
def create(path) output { post(path, params) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(params = {})\n record = new(params)\n record.save && record\n end", "def create(params_or_record)\n object = self.new(params_or_record).save\n return(object)\n end", "def new_record(params = {})\n @model_class.new(params)\n end", "def new_record(params = {})\n ...
[ "0.83115643", "0.77874005", "0.7515071", "0.7515071", "0.7502461", "0.74137306", "0.7399444", "0.7335601", "0.7325915", "0.73166263", "0.7270073", "0.7202101", "0.71921194", "0.71312827", "0.7057416", "0.70565736", "0.6996313", "0.69147545", "0.6903617", "0.68497604", "0.6844...
0.0
-1
Updates a record (using params)
def update(path) output { patch(path, params) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!(**args)\n @record = args[:record] if args.key?(:record)\n end", "def update( params )\n deleted! if @deleted\n params.delete( :id ) # Prevent overwriting ID\n params_to_group( params )\n save\n end", "def update(params)\n update_model(params)\n end", "de...
[ "0.7906671", "0.7748208", "0.7537292", "0.7377426", "0.73487103", "0.72133434", "0.72133434", "0.72039163", "0.7109807", "0.709509", "0.7018792", "0.7015995", "0.6999119", "0.6960068", "0.69366854", "0.6930825", "0.69222075", "0.6902034", "0.6898588", "0.6898588", "0.6881032"...
0.0
-1
Gets and shows a single resource
def show(path) output { get(path) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @resource = find_resource\n end", "def show\n @resource = Resource.find(params[:id])\n end", "def show\n @resource = @lode.resource\n end", "def show\n @resource = Resource.find(params[:id]) || not_found\n\n respond_to do |format|\n format.html{}\n end\n\n end", "d...
[ "0.857318", "0.8491575", "0.8253959", "0.8071098", "0.80473316", "0.8019633", "0.7946187", "0.7849157", "0.7849157", "0.78351355", "0.78173614", "0.7777013", "0.7742617", "0.7742617", "0.7742617", "0.7742617", "0.7723311", "0.7715909", "0.7666395", "0.7620698", "0.7606124", ...
0.0
-1
Deletes and shows a resource
def destroy(path) output { delete(path) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n @resource.delete\n end", "def destroy\n @resource = Resource.find(params[:id])\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_resources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @resource = Resource.fin...
[ "0.7930213", "0.75867844", "0.75824195", "0.7405654", "0.7405654", "0.7405654", "0.73991716", "0.7358275", "0.7353621", "0.7346555", "0.7313564", "0.7313564", "0.7313564", "0.7313564", "0.7259649", "0.718843", "0.71829224", "0.71140265", "0.7110537", "0.70854896", "0.70854896...
0.0
-1
Gets and lists multiple resources
def list(path) output { get(path) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list(abs_url = nil)\n @ro_resource_mixin.list(abs_url)\n end", "def all\n api_get(path)\n end", "def all\n setup_request \"#{@@resource_url}s\"\n end", "def resources(*args)\n run_context.resource_collection.find(*args)\n end", "def resource_list\n self.resources\n e...
[ "0.7482138", "0.73923355", "0.73765105", "0.73497945", "0.72665364", "0.71792644", "0.7146611", "0.71258026", "0.7122452", "0.7105908", "0.70165956", "0.70165956", "0.70165956", "0.7008122", "0.69850475", "0.6978499", "0.6954797", "0.6954797", "0.6954797", "0.6921697", "0.688...
0.63144517
72
Updates a resource (using params)
def patch(path, params) time("PATCH #{path}") { Cloudflarer.new.patch(path, params) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_resource(resource, params)\n check_id_uniformity(params)\n resource.assign_attributes(json_api_attributes(params))\n authorize resource, :update?\n resource.save!\n resource\n end", "def update_params\n resource_params\n end", "def update(params = ...
[ "0.81749994", "0.7932477", "0.7854059", "0.7660937", "0.7644063", "0.7643435", "0.7640448", "0.7528947", "0.7515824", "0.75125176", "0.7508459", "0.7406225", "0.7406225", "0.73692954", "0.7353602", "0.7352406", "0.7347537", "0.73300165", "0.7281376", "0.7270772", "0.7258894",...
0.0
-1
Creates a resource (using params)
def post(path, params) time("POST #{path}") { Cloudflarer.new.post(path, params) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_resource(_params)\n resource_class.new(resource_params)\n end", "def create(params={})\n raise '`create` method is not supported for this resource.'\n end", "def create(params={})\n raise '`create` method is not supported for this resource.'\n end", "def create(...
[ "0.8038756", "0.77995247", "0.77995247", "0.77995247", "0.77995247", "0.74930555", "0.73900896", "0.7145998", "0.7129411", "0.70722467", "0.7033437", "0.70312685", "0.7029785", "0.70165426", "0.70147645", "0.70045555", "0.69847596", "0.6958901", "0.69364464", "0.6910834", "0....
0.0
-1
Times the block, which should return something with a status
def time(msg, &block) return(yield) unless $verbose print "#{msg}..." t = Time.now.to_f response = yield print "(%0.2f ms) " % (Time.now.to_f - t) if info = response['result_info'] print "[%s/%s/%s/%s] " % info.values_at(*%w(page per_page count total_count)).map(&:to_s) end puts "OK" if response.fetch('success') puts "FAIL" unless response.fetch('success') response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_block\n start = Time.now\n yield\n time = Time.now - start\n puts \"Block took basically 0 time\" if time < 0.001\n raise \"Block took #{time} to execute\" if time > 0.001\nend", "def blocks() end", "def wait!\n now = Time.now.utc.to_i\n duration = (reset.to_i - now) + 1\n\n ...
[ "0.66684616", "0.6550262", "0.65420234", "0.63574857", "0.63162214", "0.6297031", "0.62832326", "0.6251779", "0.6251779", "0.6251779", "0.6237385", "0.619507", "0.61873746", "0.61489886", "0.61454946", "0.61154616", "0.61081624", "0.61081624", "0.607967", "0.6049715", "0.6044...
0.5977489
48
Gets the template with which to present the object
def template(template = nil) $template ||= template $template || '{{id}} {{name}}' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def template\n if object.respond_to?(:template)\n object.template\n else\n @template\n end\n end", "def get_template\n @template\n end", "def template\n @template\n end", "def template\n return @template\n end", "def template\n @template ||...
[ "0.8609773", "0.82843673", "0.8250206", "0.81566197", "0.7966955", "0.7959011", "0.794204", "0.78318834", "0.781101", "0.77835923", "0.7770449", "0.7770449", "0.749457", "0.74828225", "0.7440903", "0.7398247", "0.7389937", "0.7336901", "0.73202145", "0.72370833", "0.70498323"...
0.66935205
43
Renders the given object through the Mustache template
def render(template, object) return object.map { |o| render(template, o) } if object.is_a?(Array) Mustache.render(template, object) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render(obj = Object.new, locals = {})\n output = template.result(obj.instance_eval {binding})\n end", "def do_render\n Mustache.render(template, self)\n end", "def render(obj = Object.new, locals = {})\n output = template.result(obj.instance_eval { binding })\n (view == 'document' || view...
[ "0.7980166", "0.7684051", "0.76394004", "0.7332673", "0.72325504", "0.7113874", "0.7107714", "0.68976176", "0.68203485", "0.6758187", "0.6666337", "0.6630318", "0.65714633", "0.6534585", "0.6534585", "0.65289366", "0.65073854", "0.6492334", "0.64819914", "0.64652354", "0.6459...
0.770412
1
Filters results, if required. Currently doesn't do anything.
def filter(&block) result = yield return result.map { |o| filter { o } } if result.is_a?(Array) result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter\n end", "def apply_filters(results:)\n return results unless filter_params.present?\n\n if filter_params[:organization_id].present? && !filter_params[:funder_id].present?\n return DataManagementPlan.find_by_organization(\n organization_id: filter_params[:organization_id]\n )\...
[ "0.7014599", "0.7004172", "0.6955037", "0.68003637", "0.68003637", "0.67957115", "0.67957115", "0.67957115", "0.6778556", "0.6692871", "0.66635954", "0.6650928", "0.6579915", "0.6495273", "0.64921397", "0.6484661", "0.64292973", "0.6422561", "0.6371785", "0.6343838", "0.63229...
0.0
-1
Outputs in the format requested
def output(&block) response = yield if response.fetch('success') puts format { filter { response.fetch('result') } } else puts format { response.fetch('error') } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output; end", "def output; end", "def output; end", "def output; end", "def output; end", "def output; end", "def output; end", "def output; end", "def output; end", "def output; end", "def output; end", "def output; end", "def output; end", "def output; end", "def output; end", "...
[ "0.69920653", "0.69920653", "0.69920653", "0.69920653", "0.69920653", "0.69920653", "0.69920653", "0.69920653", "0.69920653", "0.69920653", "0.69920653", "0.69920653", "0.69920653", "0.69920653", "0.69920653", "0.69020075", "0.69020075", "0.68682283", "0.68141276", "0.67783153"...
0.0
-1
Print the result of the block, if $debug is on
def debug(msg, &block) result = yield puts "-- #{msg} #{'-' * (74 - msg.length)}" if $debug result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_debug\n # debugging = true\n debugging = false\n puts yield if debugging\n end", "def print_result(&block)\n result_from_block = block.call()\n puts result_from_block\nend", "def print_block_result\n block_result = yield\n puts block_result\nend", "def log(block_description, &block)\n p...
[ "0.72527605", "0.70238465", "0.69374347", "0.6735437", "0.6679339", "0.6656832", "0.658984", "0.65872645", "0.65650886", "0.6513287", "0.65014493", "0.6453734", "0.6452337", "0.6438555", "0.6429438", "0.6406007", "0.6384022", "0.6359256", "0.63459283", "0.62587935", "0.623418...
0.7316369
0
Print the message to STDERR and exit (nonzero)
def die(msg, code = 1) STDERR.puts msg exit code end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def err(message)\n STDERR.puts(message)\n exit 1\n end", "def error(message) puts(message) || exit end", "def error(msg, code)\n STDERR.puts msg\n exit code\nend", "def error(msg, code)\n STDERR.puts msg\n exit code\nend", "def error(msg)\n return if @nolog\n puts msg...
[ "0.78771806", "0.7484435", "0.74838984", "0.74838984", "0.73715675", "0.7357841", "0.7353057", "0.7312527", "0.7224767", "0.718928", "0.7150245", "0.7150245", "0.7150245", "0.7150245", "0.7150245", "0.71294975", "0.71248037", "0.7085673", "0.69787973", "0.69486785", "0.694698...
0.6880408
24
Use callbacks to share common setup or constraints between actions.
def set_request power = Power.new current_user if action_name == 'update' @requests = power.patchable_requests else @requests = power.requests end if @requests && params[:id] @request = @requests.find(params[:id]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a trusted parameter "white list" through.
def request_params params.require(:data).permit(:attributes => [:from, :to, :description, :status]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
Initializes a new call to the API
def initialize(package_name:, subscription_id:, token:, authorization:) @package_name = package_name @subscription_id = subscription_id @token = token @authorization = authorization end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize base_url, api_key\n\t\t\t\t\t@connection = Freshdesk::Api::Client::Request.new base_url, api_key\n\t\t\t\tend", "def initialize guid\n\t\t@O365_path = URI.parse \"#{O365_url}?format=json&clientrequestid=#{guid}\"\n\t\t@O365_Services = Array.new\n\t\tapiCall()\n\tend", "def initialize(api_url)\n\...
[ "0.7423539", "0.7152052", "0.71363467", "0.694578", "0.68810785", "0.67518497", "0.67509687", "0.6742351", "0.66611034", "0.6549212", "0.654588", "0.6527427", "0.64901084", "0.6476024", "0.6469621", "0.6465359", "0.64649844", "0.64509666", "0.6436581", "0.6428146", "0.6425072...
0.0
-1
Performs the verification against the remote server
def call! verify! if valid? CandyCheck::PlayStore::SubscriptionPurchases::SubscriptionPurchase.new(@response[:result]) else CandyCheck::PlayStore::VerificationFailure.new(@response[:error]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify\n head :ok\n end", "def verify_host\n @j_del.isVerifyHost\n end", "def verify()\n # TODO\n end", "def verify_response\n\n self.exec\n end", "def verify\n end", "def verify\n @request = Net::HTTP::Get.new(@uri.path)\n @request.basic_auth @username, @password\n\n...
[ "0.65726405", "0.64871275", "0.64840114", "0.6443163", "0.64313745", "0.6412832", "0.63469756", "0.631293", "0.63073355", "0.630698", "0.62975115", "0.62939465", "0.62864965", "0.6285914", "0.6285914", "0.6285914", "0.6213488", "0.6209537", "0.61947185", "0.6184355", "0.61626...
0.0
-1
If this is a boolean, return the boolean value If this is a string, transform it into a boolean If the value is nil or can't be determined, assume it is NOT embargoed
def abstract_embargoed return self['abstract_embargoed_bsi'] unless self['abstract_embargoed_bsi'].nil? return self['abstract_embargoed_tesim'].first.to_s == "true" if self['abstract_embargoed_tesim'] false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value_or_false(value)\n if value\n if value == \"false\"\n return false\n else\n return value.to_s\n end\n else\n return false\n end\n end", "def to_bool(questionable_string)\n\tbool = true\n\tunless questionable_string == \"...
[ "0.73274994", "0.72663236", "0.72076094", "0.71415013", "0.713029", "0.7124012", "0.7108244", "0.7086997", "0.7079444", "0.7078587", "0.7063841", "0.7057956", "0.7018843", "0.7015791", "0.69898677", "0.6988938", "0.6988007", "0.69836855", "0.6953038", "0.69380736", "0.6923668...
0.65042335
67
If this is a boolean, return the boolean value If this is a string, transform it into a boolean If the value is nil or can't be determined, assume it is NOT embargoed
def toc_embargoed return self['toc_embargoed_bsi'] unless self['toc_embargoed_bsi'].nil? return self['toc_embargoed_tesim'].first.to_s == "true" if self['toc_embargoed_tesim'] false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value_or_false(value)\n if value\n if value == \"false\"\n return false\n else\n return value.to_s\n end\n else\n return false\n end\n end", "def to_bool(questionable_string)\n\tbool = true\n\tunless questionable_string == \"...
[ "0.7326403", "0.7266422", "0.72070575", "0.71419686", "0.71297586", "0.7123432", "0.71078455", "0.7086585", "0.70796096", "0.70788544", "0.70639795", "0.70573103", "0.7018029", "0.7014779", "0.69894034", "0.6988317", "0.6988307", "0.6983034", "0.69534695", "0.69374865", "0.69...
0.0
-1
If this is a boolean, return the boolean value If this is a string, transform it into a boolean If the value is nil or can't be determined, assume it is NOT embargoed
def files_embargoed return self['files_embargoed_bsi'] unless self['files_embargoed_bsi'].nil? return self['files_embargoed_tesim'].first.to_s == "true" if self['files_embargoed_tesim'] false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value_or_false(value)\n if value\n if value == \"false\"\n return false\n else\n return value.to_s\n end\n else\n return false\n end\n end", "def to_bool(questionable_string)\n\tbool = true\n\tunless questionable_string == \"...
[ "0.7326642", "0.726557", "0.7206163", "0.71411216", "0.71293676", "0.7122449", "0.7106824", "0.70860136", "0.7079318", "0.70778996", "0.7063147", "0.70571184", "0.70182437", "0.70141536", "0.6989152", "0.6988148", "0.69872695", "0.69830734", "0.6952694", "0.6936932", "0.69223...
0.0
-1
by default it is public
def getArea() getWidth() * getHeight() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def public; end", "def public; end", "def private; end", "def private_method\n end", "def public_method; end", "def internal; end", "def accessibility; end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def expose; end", "def private_method; end", ...
[ "0.8676107", "0.8676107", "0.8493612", "0.79321975", "0.7929678", "0.76884186", "0.7519491", "0.740781", "0.740781", "0.740781", "0.740781", "0.72921646", "0.7268171", "0.7225565", "0.7225565", "0.72068334", "0.6988834", "0.6988834", "0.695748", "0.6940428", "0.69270766", "...
0.0
-1
Sum all the numbers in the array an_array can contain lots of different things Be sure to only sum the numbers (Hint: the is_a? method might be useful here)
def sum_only_numbers(an_array) summation = 0 for item in an_array if item.is_a? Integer summation += item end if item.is_a? Float summation += item end end return summation end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_array(some_array) \n sum = 0\n\tsome_array.each do |x|\n\t if x.is_a?Integer\n\t sum = sum + x\n\t end\n\t \n\t end\n\t \n\tsum\n end", "def sum_only_numbers(an_array)\n count = 0\n an_array.map do |array|\n \tif array.is_a? Fixnum or array.is_a? Float\n \t\tcount = count + array\n \tend\n...
[ "0.8185389", "0.81185967", "0.8099753", "0.80074984", "0.7969775", "0.79321116", "0.79144245", "0.78782403", "0.78435063", "0.7821529", "0.78141195", "0.7786568", "0.77773464", "0.7762329", "0.7743433", "0.7738563", "0.7733282", "0.773083", "0.77176064", "0.76855844", "0.7673...
0.82406664
0
For i from 1 to 100, return an array. The elements in the array should follow this algorithm: If i is a multiple of 3, the element is 'Fizz' If i is a multiple of 5, the element is 'Buzz' If i is a multiple of 3 and 5, the element is 'FizzBuzz' Otherwise, the element is simply the value of i For example [1, 2, 'Fizz', 4, 'Buzz', 'Fizz', ..., 14, 'FizzBuzz', ...]
def fizzbuzz count = 0 an_array = [] while count <100 an_array[count] = count if count%5 == 0 an_array[count] = 'Buzz' end if count%3 == 0 if count%5 == 0 an_array[count] = 'FizzBuzz' else an_array[count] = 'Fizz' end end count +=1 end return an_array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fizzbuzz(n)\n array = (1..n).to_a\n answer = []\n for i in array do\n if (i % 15 == 0)\n answer.push('FizzBuzz')\n elsif (i % 3 == 0)\n answer.push('Fizz')\n elsif (i % 5 == 0)\n answer.push('Buzz')\n else \n answer.push(i)\n end\n end\n answer\nend", "def super_fizzbu...
[ "0.78673506", "0.78616196", "0.78616196", "0.7839122", "0.7801473", "0.7786212", "0.77661586", "0.7739433", "0.77350104", "0.76979953", "0.7682183", "0.7641783", "0.763855", "0.7619943", "0.7605832", "0.75558245", "0.75355273", "0.75259423", "0.7520132", "0.7515772", "0.75110...
0.7453955
25
Converts the modifier to a String.
def to_s if @value then "#{@name}=#{@value}" else "#{@name}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modifier_string\n modifiers = {}\n java_signature.modifiers.reject(&:annotation?).each {|m| modifiers[m.to_s] = m.to_s}\n is_static = static || modifiers[\"static\"]\n static_str = is_static ? ' static' : ''\n abstract_str = modifiers[\"abstract\"] ? ' abstract' : ''\n final_str =...
[ "0.66025764", "0.5959435", "0.57542884", "0.5637711", "0.5637711", "0.5637711", "0.5637711", "0.5635407", "0.561553", "0.55933285", "0.55933285", "0.55933285", "0.55933285", "0.5578763", "0.5575891", "0.555735", "0.55384153", "0.55147225", "0.5507583", "0.5489441", "0.5489441...
0.0
-1
Returns a partial SPARQL grammar for this operator.
def to_sparql(**options) "langMatches(" + operands.first.to_sparql(**options) + ", " + operands.last.to_sparql(**options) + ")" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_sparql(**options)\n \"(!\" + operands.first.to_sparql(**options) + \")\"\n end", "def to_sparql(**options)\n '(' + operands.to_sparql(delimiter: '/', **options) + ')'\n end", "def to_sparql(**options)\n operands.first.to_sparql(reduced: true, **options)\n end", "def...
[ "0.64040565", "0.6321709", "0.631144", "0.6310281", "0.62468004", "0.6241794", "0.6177385", "0.5944844", "0.59406114", "0.5841583", "0.57748723", "0.5691575", "0.5639666", "0.55992645", "0.5555632", "0.5552082", "0.55493504", "0.5544813", "0.5524246", "0.55005145", "0.5481131...
0.5945824
7
GET /unit_subtitles/1 GET /unit_subtitles/1.json
def show @unit_subtitle = UnitSubtitle.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @unit_subtitle } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_sub_titles\n show_all_titles_and_subtitles(\"subtitle\")\n return @subtitles\n end", "def obtenerTemasPorSubCapitulo\n @subchapter_id = params[:subchapter_id]\n \t@contents = Content.where(\"subchapter_id = ?\",@subchapter_id)\n \trespond_with @contents.to_json\n end", "def d...
[ "0.66943616", "0.6368722", "0.62953895", "0.6239616", "0.6219279", "0.60648423", "0.59224117", "0.5862047", "0.57523733", "0.5737071", "0.57284683", "0.56832254", "0.56643414", "0.5605449", "0.55477804", "0.55237556", "0.5521637", "0.5484477", "0.54842746", "0.5480688", "0.54...
0.7196764
0
GET /unit_subtitles/new GET /unit_subtitles/new.json
def new @unit_subtitle = UnitSubtitle.new respond_to do |format| format.html # new.html.erb format.json { render json: @unit_subtitle } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @unit_subtitle = UnitSubtitle.new(unit_subtitle_params)\n\n respond_to do |format|\n if @unit_subtitle.save\n format.html { redirect_to @unit_subtitle, notice: 'Unit subtitle was successfully created.' }\n format.json { render json: @unit_subtitle, status: :created, location: ...
[ "0.72160935", "0.66383743", "0.65909666", "0.65081346", "0.6502154", "0.6431786", "0.642902", "0.6374463", "0.63440573", "0.63410103", "0.63007265", "0.6290782", "0.62896425", "0.62896425", "0.62896425", "0.628582", "0.6283426", "0.62584054", "0.62034166", "0.6196945", "0.619...
0.7736823
0
POST /unit_subtitles POST /unit_subtitles.json
def create @unit_subtitle = UnitSubtitle.new(unit_subtitle_params) respond_to do |format| if @unit_subtitle.save format.html { redirect_to @unit_subtitle, notice: 'Unit subtitle was successfully created.' } format.json { render json: @unit_subtitle, status: :created, location: @unit_subtitle } else format.html { render "new" } format.json { render json: @unit_subtitle.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @subtitle = Subtitle.new(subtitle_params)\n\n respond_to do |format|\n if @subtitle.save\n format.html { redirect_to @subtitle, notice: 'Subtitle was successfully created.' }\n format.json { render :show, status: :created, location: @subtitle }\n else\n format.html...
[ "0.6366155", "0.62582225", "0.6182948", "0.6154036", "0.60943747", "0.60600054", "0.58860666", "0.58691365", "0.5701577", "0.5612405", "0.5465881", "0.54639", "0.5449202", "0.54275066", "0.5337624", "0.52874315", "0.5268927", "0.52622026", "0.52378106", "0.523586", "0.5234362...
0.6979298
0
PUT /unit_subtitles/1 PUT /unit_subtitles/1.json
def update @unit_subtitle = UnitSubtitle.find(params[:id]) respond_to do |format| if @unit_subtitle.update_attributes(unit_subtitle_params) format.html { redirect_to @unit_subtitle, notice: 'Unit subtitle was successfully updated.' } format.json { head :no_content } else format.html { render "edit" } format.json { render json: @unit_subtitle.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @subtitle.update(subtitle_params)\n format.html { redirect_to @subtitle, notice: 'Subtitle was successfully updated.' }\n format.json { render :show, status: :ok, location: @subtitle }\n else\n format.html { render :edit }\n format.j...
[ "0.6617242", "0.6510062", "0.6421815", "0.6355887", "0.62092596", "0.5980381", "0.5860617", "0.5860454", "0.5843101", "0.58287257", "0.5812874", "0.5806216", "0.579591", "0.57779545", "0.5700642", "0.5699247", "0.56943", "0.5639395", "0.56252515", "0.5604793", "0.5598513", ...
0.7208653
0
DELETE /unit_subtitles/1 DELETE /unit_subtitles/1.json
def destroy @unit_subtitle = UnitSubtitle.find(params[:id]) @unit_subtitle.destroy respond_to do |format| format.html { redirect_to unit_subtitles_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @msubtitle.destroy\n respond_to do |format|\n format.html { redirect_to msubtitles_url, notice: \"Subtitles deleted\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @subtitle.destroy\n respond_to do |format|\n format.html { redirect_to subtitles_url...
[ "0.7531952", "0.7376081", "0.7137856", "0.6953793", "0.68472946", "0.68033224", "0.6761944", "0.6750631", "0.67505723", "0.6746785", "0.67199606", "0.6706363", "0.67054874", "0.6694117", "0.6680609", "0.66791385", "0.66517305", "0.66505533", "0.66505533", "0.66427356", "0.664...
0.7943684
0
Default does not support transactions
def transaction(&block) yield end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use_transactions; end", "def use_transactions; end", "def transaction; end", "def transaction; end", "def transaction; end", "def within_transaction; end", "def within_transaction; end", "def transaction(&block); end", "def begin_transaction\n return System.begin_transaction\n end", "def ...
[ "0.8751014", "0.8751014", "0.8204587", "0.8204587", "0.8204587", "0.80551183", "0.80551183", "0.7917137", "0.75374496", "0.7512458", "0.7512458", "0.7480007", "0.74769205", "0.73820823", "0.73194414", "0.7312939", "0.7283435", "0.72676903", "0.7251318", "0.7239439", "0.723451...
0.7275503
18
promedio del valor de los platos
def average_plate(plates) a = 0 plates.each{ |key,value| a += value } valor_promedio = a / plates.length puts "el valor promedio de los platos es: #{valor_promedio}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_val()\n val = (@proteinas * 4) + (@lipidos * 9) + (@glucidos * 4)\n end", "def platos\n\t\treturn @platos\n\tend", "def atribuirValor\n\t\t@@compras.each do |produto|\n\t\t\ti = @@compras.index(produto)\n\t\t\tcase produto\n\t\t\t\twhen \"par de meias\"\n\t\t\t\t\t@@compras[i] = 11.99\n\t\t\t\twhen...
[ "0.6649821", "0.66219914", "0.65882254", "0.65359807", "0.64510757", "0.6364158", "0.6339727", "0.6319608", "0.6283859", "0.6263212", "0.6248645", "0.6147921", "0.6127937", "0.61254734", "0.610999", "0.61096954", "0.6069698", "0.6048493", "0.6042599", "0.59673744", "0.5933688...
0.0
-1
GET /phones/1 GET /phones/1.xml
def show @phone = Phone.find(params[:id]) respond_to do |format| format.html # show.html.erb #format.xml { render :xml => @phone } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @phone = Phone.find(params[:id])\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @phone.to_xml }\n end\n end", "def show\n @phonecall = Phonecall.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.x...
[ "0.687084", "0.66046023", "0.65417874", "0.6507365", "0.64304966", "0.63952434", "0.6281796", "0.62619853", "0.6199249", "0.6163654", "0.60985035", "0.6047223", "0.60133463", "0.5942656", "0.5942656", "0.5908734", "0.5908734", "0.589049", "0.5881239", "0.5827004", "0.58251595...
0.6790701
1
GET /phones/new GET /phones/new.xml
def new @phone = Phone.new respond_to do |format| format.html # new.html.erb #format.xml { render :xml => @phone } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @phone = Phone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @phone }\n end\n end", "def new\n @phone_number = PhoneNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @phone_n...
[ "0.74246264", "0.7072408", "0.7007888", "0.6890192", "0.68208647", "0.67813987", "0.67813987", "0.6733705", "0.67132246", "0.67132246", "0.6705926", "0.6638342", "0.6615934", "0.66084146", "0.65861785", "0.6558476", "0.65250653", "0.65129167", "0.64921504", "0.64855635", "0.6...
0.73714054
1
POST /phones POST /phones.xml
def create @phone = Phone.new(params[:phone]) respond_to do |format| if @phone.save flash[:notice] = 'Phone_number was successfully created.' format.html { redirect_to(@phone) } #format.xml { render :xml => @phone, :status => :created, :location => @phone } else format.html { render :action => "new" } # format.xml { render :xml => @phone.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @phone = Phone.new(params[:phone])\n\n respond_to do |format|\n if @phone.save\n format.html { redirect_to(@phone, :notice => 'Phone was successfully created.') }\n format.xml { render :xml => @phone, :status => :created, :location => @phone }\n else\n format.html...
[ "0.6181841", "0.59031016", "0.58249104", "0.582337", "0.5807239", "0.5792198", "0.5755267", "0.57458353", "0.5745718", "0.5721402", "0.5708313", "0.5708313", "0.5676491", "0.5671819", "0.5669718", "0.56625193", "0.5636468", "0.5632127", "0.5622178", "0.5594599", "0.55767745",...
0.6053368
1
PUT /phones/1 PUT /phones/1.xml
def update @phone = Phone.find(params[:id]) respond_to do |format| if @phone.update_attributes(params[:phone]) flash[:notice] = 'Phone_number was successfully updated.' format.html { redirect_to(@phone) } #format.xml { head :ok } else format.html { render :action => "new" } #format.xml { render :xml => @phone.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update\n @phone = Phone.find(params[:id])\n\n respond_to do |format|\n if @phone.update_attributes(params[:phone])\n form...
[ "0.62563837", "0.62480336", "0.62180805", "0.60205746", "0.5971546", "0.59494334", "0.5944685", "0.58624893", "0.58589834", "0.5850684", "0.5821497", "0.58148295", "0.57969403", "0.5767096", "0.57607913", "0.5752338", "0.5723744", "0.56896794", "0.5673832", "0.56518346", "0.5...
0.62937087
0
DELETE /phones/1 DELETE /phones/1.xml
def destroy @phone = Phone.find(params[:id]) @phone.destroy respond_to do |format| format.html { redirect_to(phones_url) } #format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @phone = Phone.find(params[:id])\n @phone.destroy\n\n respond_to do |format|\n format.html { redirect_to phones_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @phone = Phone.find(params[:id])\n @phone.destroy\n\n respond_to do |format|\n format.ht...
[ "0.71410155", "0.70022", "0.6855812", "0.6786509", "0.6783369", "0.6774937", "0.672152", "0.6679304", "0.66575253", "0.66421914", "0.6636651", "0.66162246", "0.6595595", "0.65854585", "0.6579966", "0.6579953", "0.65647084", "0.65647084", "0.65602106", "0.6513807", "0.6495321"...
0.69878066
2
ask user for their name and return alias
def alias_manager puts "Hello please provide your first name" name_1 = gets.chomp puts "please provide your last name" name_2 = gets.chomp full_name = name_1 + " " + name_2 puts "Thank, you. Your secret agent name is: " puts alias_method(full_name) #push name and alias into data structure data_structure = {} data_structure[full_name] = alias_method(full_name) #allow user to enter multiple names until they ask to quit puts "If you would like to try another name, please enter another first and last name. If not, please type 'quit' " full_name = gets.chomp until full_name.downcase == "quit" puts "Thank, you. Your secret agent name is:" puts alias_method(full_name) #store each name in a data structure data_structure[full_name] = alias_method(full_name) puts "If you would like to try another name, please enter another first and last name. If not, please type 'quit' " full_name = gets.chomp end data_structure.each do |name,new_name| puts "#{name} will be known as #{new_name}" end puts "Thank, you. have a nice day." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAlias(name)\n\t# Downcase + Swap the first and last name\n\talias_name = name.downcase\n\talias_name = alias_name.split(' ')\n\talias_name.reverse!\n\n\t# Convert string to char array in order to call nextLetters()\n\talias_name = alias_name.join(' ')\n\talias_name = alias_name.split('')\n\talias_name = nex...
[ "0.72967225", "0.70202404", "0.6902794", "0.67359024", "0.6705761", "0.6700125", "0.6666819", "0.66185385", "0.65945077", "0.6586485", "0.6565013", "0.655878", "0.6533265", "0.6446372", "0.6444951", "0.63473237", "0.63411933", "0.63308775", "0.63304096", "0.63174725", "0.6302...
0.6326986
19
Create a relationship field with specified channels
def relationships_specified_channels if debug? channel_fields = ChannelFieldForm.new channel_fields.create_field( group_id: 1, type: 'Relationships', label: 'Relationships', fields: { limit: 25, relationship_order_field: 'Entry Date', relationship_order_dir: 'Descending (Z-A)', relationship_allow_multiple: 'n', relationship_future: '1' } ) do |page| # TODO: Come back and make sure these _actually_ export properly page.find('input[name="relationship_channels[]"][value="2"]').click # page.find('input[name="relationship_authors[]"][value="g_1"]').click # page.find('input[name="relationship_statuses[]"][value="open"]').click end @page.load else $db.query(IO.read('channel_sets/relationships-specified-channels.sql')) clear_db_result end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relationships_all_channels\n if debug?\n channel_fields = ChannelFieldForm.new\n channel_fields.create_field(\n group_id: 1,\n type: 'Relationships',\n label: 'Relationships',\n fields: {\n limit: 25,\n relationship_order_field: 'Entr...
[ "0.59219193", "0.5779044", "0.57429296", "0.5672505", "0.5603399", "0.5563528", "0.5532825", "0.5284068", "0.5278161", "0.5229415", "0.5223319", "0.5223238", "0.52154475", "0.5196564", "0.5190695", "0.51653016", "0.5164807", "0.5158302", "0.51458466", "0.51422006", "0.5113148...
0.6931357
0
Create a relationship field with all channels
def relationships_all_channels if debug? channel_fields = ChannelFieldForm.new channel_fields.create_field( group_id: 1, type: 'Relationships', label: 'Relationships', fields: { limit: 25, relationship_order_field: 'Entry Date', relationship_order_dir: 'Descending (Z-A)', relationship_allow_multiple: 'n', relationship_future: '1' } ) @page.load else $db.query(IO.read('channel_sets/relationships-all-channels.sql')) clear_db_result end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relationships_specified_channels\n if debug?\n channel_fields = ChannelFieldForm.new\n channel_fields.create_field(\n group_id: 1,\n type: 'Relationships',\n label: 'Relationships',\n fields: {\n limit: 25,\n relationship_order_field: 'Entry Date...
[ "0.6853118", "0.6162632", "0.58410907", "0.57956815", "0.57096314", "0.552167", "0.54998493", "0.54869527", "0.54329735", "0.54144245", "0.5401981", "0.53961897", "0.5395021", "0.53905857", "0.5378362", "0.5329566", "0.5314495", "0.5310524", "0.53043497", "0.5291167", "0.5246...
0.70103097
0
Create all other custom fields for export testing
def custom_fields if debug? channel_fields = ChannelFieldForm.new channel_fields.create_field( group_id: 1, type: 'Checkboxes', label: 'Checkboxes', fields: { field_list_items: "Yes\nNo\nMaybe" } ) channel_fields.create_field( group_id: 1, type: 'Radio Buttons', label: 'Radio Buttons', fields: { field_list_items: "Left\nCenter\nRight" } ) channel_fields.create_field( group_id: 1, type: 'Multi Select', label: 'Multi Select', fields: { field_list_items: "Red\nGreen\nBlue" } ) channel_fields.create_field( group_id: 1, type: 'Select Dropdown', label: 'Select Dropdown', fields: { field_list_items: "Mac\nWindows\nLinux" } ) channel_fields.create_field( group_id: 1, type: 'Select Dropdown', label: 'Prepopulated', fields: { field_pre_populate: 'y' } ) channel_fields.create_field( group_id: 1, type: 'Rich Text Editor', label: 'Rich Text Editor', fields: { field_ta_rows: 20, field_text_direction: 'Right to left' } ) channel_fields.create_field( group_id: 1, type: 'Toggle', label: 'Toggle' ) channel_fields.create_field( group_id: 1, type: 'Text Input', label: 'Text Input', fields: { field_maxl: 100, field_fmt: 'None', field_show_fmt: 'y', field_text_direction: 'Right to left', field_content_type: 'Decimal', field_show_smileys: 'y', field_show_file_selector: 'y' } ) channel_fields.create_field( group_id: 1, type: 'Textarea', label: 'Textarea', fields: { field_ta_rows: 20, field_fmt: 'None', field_show_fmt: 'y', field_text_direction: 'Right to left', field_show_formatting_btns: 'y', field_show_smileys: 'y', field_show_file_selector: 'y' } ) channel_fields.create_field( group_id: 1, type: 'URL', label: 'URL Field', fields: { url_scheme_placeholder: '// (Protocol Relative URL)' } ) do |page| page.all('input[name="allowed_url_schemes[]"]').each do |element| element.click unless element.checked? end end @page.load else $db.query(IO.read('channel_sets/custom-fields.sql')) clear_db_result end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_custom_fields\n fields = service.get_custom_fields(contact_point_list)\n existing_fields = fields.map(&:FieldName)\n\n [\n { name: \"organization_id\", type: 'Number' },\n { name: \"organization_name\", type: 'Text' },\n { name: \"cop_status\", type: 'Text' },\n { name: ...
[ "0.709429", "0.67483604", "0.650958", "0.63334054", "0.6265992", "0.6248013", "0.616463", "0.61159194", "0.60811967", "0.6072718", "0.6046267", "0.6033252", "0.6024622", "0.60180855", "0.5930892", "0.59228337", "0.5914665", "0.58985263", "0.58657753", "0.5821581", "0.5808163"...
0.60033065
14
Create all other custom fields for export testing
def fluid_field $db.query(IO.read('channel_sets/channel-with-fluid-field.sql')) clear_db_result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_custom_fields\n fields = service.get_custom_fields(contact_point_list)\n existing_fields = fields.map(&:FieldName)\n\n [\n { name: \"organization_id\", type: 'Number' },\n { name: \"organization_name\", type: 'Text' },\n { name: \"cop_status\", type: 'Text' },\n { name: ...
[ "0.709429", "0.67483604", "0.650958", "0.63334054", "0.6265992", "0.6248013", "0.616463", "0.61159194", "0.60811967", "0.6072718", "0.6046267", "0.6033252", "0.6024622", "0.60180855", "0.60033065", "0.5930892", "0.59228337", "0.5914665", "0.58985263", "0.58657753", "0.5821581...
0.0
-1
Prepare our grid test data for comparison to JSON
def prepare_test_data(data) case data[:type][1] when 'file' then data[:file_type] = data[:file_type][1] data[:allowed_dirs] = data[:allowed_dirs][1] when 'relationship' then data[:channels] = data[:channels][0] data[:categories] = [] #data[:categories][1] #@todo swtich to names? data[:authors] = [] #data[:authors][1] #@todo swtich to names? data[:statuses] = [] #data[:statuses][1] data[:order_field] = data[:order_field][1] data[:order_dir] = data[:order_dir][1] when 'text' then data[:field_fmt] = data[:field_fmt][1] data[:field_content_type] = data[:field_content_type][1] data[:field_text_direction] = data[:field_text_direction][1] when 'textarea' then data[:field_fmt] = data[:field_fmt][1] data[:field_text_direction] = data[:field_text_direction][1] when 'rte' then data[:field_text_direction] = data[:field_text_direction][1] when 'checkboxes', 'multi_select', 'radio', 'select' then data[:field_fmt] = data[:field_fmt][1] end return data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_data\n initial_data_eval \n initial_sorting if self.data_grid.sorting?\n filter\n global_summary_array\n pagination\n summary_array\n self.data_grid.row_styler\n prepare_data_for_filters\n end", "def prepare\n super\n\n @test_list = @builder.te...
[ "0.70918274", "0.652278", "0.6121159", "0.6117876", "0.5799827", "0.5737087", "0.57369775", "0.5722309", "0.5720199", "0.57144374", "0.5694303", "0.56690365", "0.56561667", "0.56311715", "0.5630555", "0.5590429", "0.5578866", "0.55754733", "0.5574927", "0.5501163", "0.5465919...
0.66536283
1
Initialize Alarms based on OBIX source The source will be parsed lazily source A Hash of options (see OBIXparse for details).
def initialize(source) @source = source end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(source, options); end", "def initialize(source); end", "def connect source\n new OBIX.parse source\n end", "def connect source\n new OBIX.parse source\n end", "def initialize(options = { }, &block)\n @global_events_prefix = nil\n @versions = { }\n\n ...
[ "0.58642143", "0.5716808", "0.5510416", "0.5510416", "0.54898775", "0.54115707", "0.5388794", "0.5366033", "0.5290314", "0.5264079", "0.5257186", "0.52439344", "0.5217197", "0.5204141", "0.51784354", "0.51616406", "0.5151232", "0.51506627", "0.5140463", "0.51303744", "0.51302...
0.52609897
11
Returns the number of response groups (count of group responses enterted) for this question group
def count_group_responses(questions) questions.map{|q| responses.select{|r| (r.question_id.to_i == q.id.to_i) && !r.response_group.nil?}.group_by(&:response_group).size }.max end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_group_responses(group)\n counts = []\n group.questions.each do |question|\n counts << Response.count(\"response_group\",:conditions => [\"response_set_id =? AND question_id=? AND response_group IS NOT NULL\", self.id, question.id], :distinct => true)\n end\n \n counts.max #since respo...
[ "0.8620558", "0.69745713", "0.69694227", "0.6930384", "0.6847445", "0.6847445", "0.68378717", "0.6802697", "0.6570383", "0.6493158", "0.64603144", "0.64127916", "0.63765365", "0.6372252", "0.6363155", "0.63095856", "0.62354326", "0.6204931", "0.61896515", "0.6049254", "0.6008...
0.81958276
1
Check existence of responses to questions from a given survey_section
def no_responses_for_section?(section) self.responses.count(:conditions => {:survey_section_id => section.id}) == 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hasResponses(surveyId)\n return survey_responses.exists?({:survey_id => surveyId})\n end", "def no_responses\n #below is code to fix a bizarre bug. When triggered by the \"cut\" function, for some reason survey_id is erased. Have not found reason yet. Temporary fix.\n if !survey_section && ...
[ "0.6925076", "0.67882264", "0.63455725", "0.63118255", "0.63105035", "0.63077605", "0.6297729", "0.624825", "0.6205175", "0.6205175", "0.6185276", "0.61745644", "0.6151244", "0.61209434", "0.6120474", "0.60738045", "0.60016626", "0.59954983", "0.5991264", "0.59798354", "0.592...
0.760719
0
This needs refactoring rubocop:disable Metrics/AbcSize
def user_stars return Repo.search(query: params[:query], user_id: current_user.id) if params[:query] return current_user.untagged_repos if params[:no_tags] if current_user.repos_with_tag(params[:tag]).empty? current_user.repos else current_user.repos_with_tag(params[:tag]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def implementation; end", "def implementation; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def refutal()\n end", "def probers; end", "def strategy; end", "def schubert; end", "def used?; end", "def internal; end", "def private_...
[ "0.74532384", "0.5962321", "0.5962321", "0.5859583", "0.5859583", "0.5859583", "0.5859583", "0.58419424", "0.5833512", "0.5688098", "0.56629604", "0.56008303", "0.5594652", "0.5524752", "0.5517621", "0.5517621", "0.54836285", "0.54652226", "0.54652226", "0.54563695", "0.53899...
0.0
-1
Compute the name to use for the command based on the sublcass name.
def name prefix_length = 19 # 'bindl::subcommand::'.length self.class.name.downcase[prefix_length..-1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def command_name\n @command_name ||= if command = name.to_s.split(\"::\").last\n command.chomp!(\"Command\")\n command.underscore\n end\n end", "def command_name(cmd)\n cmd\n end", "def command_to_name(command)\n command = command.upcase\n ...
[ "0.7344768", "0.68345374", "0.6791084", "0.6782777", "0.66501945", "0.6643057", "0.65648335", "0.65315235", "0.65026224", "0.6495125", "0.6468221", "0.64168495", "0.6408696", "0.63987494", "0.63901746", "0.63888985", "0.63883924", "0.6382028", "0.6363692", "0.63551885", "0.63...
0.75936735
0
Override these methods for your subclasses A very short description of what the command does. It should start with an uppercase letter, but not be a sentence. e.g. "Prints an entry".
def description raise "description not provided for command #{name}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def command(name,aliases,desc,long_desc,arg_name,arg_options)\n abstract!\n end", "def create_command_help\n puts \"The Ruby Farm - a simple command line animals app\"\n puts\n puts \"Command Usage:\"\n puts \" [create | c] <name=> <type=> creates a animal with ...
[ "0.73035896", "0.728588", "0.72343796", "0.72040427", "0.7115491", "0.7061776", "0.7053624", "0.7018617", "0.6992636", "0.6979914", "0.6963588", "0.6953356", "0.69145167", "0.690983", "0.68977416", "0.68779117", "0.68279856", "0.68132585", "0.6810316", "0.68052423", "0.678867...
0.72506547
2
This method takes a list of arguments, like ARGV, and parses them into a format that `run` can use.
def parse(args) { unused: args } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_arguments\n @arguments = ARGV.collect { |arg| arg.strip }\n @filename = Pathname.new(@arguments.first)\n end", "def _run(argv = [])\n execute(parse_options(argv))\n end", "def run(argv = ARGV)\n parser.parse(argv)\n end", "def process_args\n args = @args.dup\n ...
[ "0.6732753", "0.6566507", "0.65051776", "0.64905834", "0.64735997", "0.64288145", "0.64288145", "0.64288145", "0.64288145", "0.64288145", "0.64288145", "0.64288145", "0.64288145", "0.6426637", "0.6396478", "0.6364957", "0.63519025", "0.63146853", "0.6307814", "0.62216455", "0...
0.0
-1
Run the actual command to do things.
def run(_options) raise "command '#{name}' is not implemented" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\n raise \"`#{ real_command }' failed\" unless Kernel.system( real_command )\n end", "def run\n # TODO: include a parse step here and remove duplicate parsing code from\n # individual commands\n execute\n end", "def run\n raise \"A subclass should override the `CLAide::Command...
[ "0.7580002", "0.74416274", "0.7421543", "0.7356702", "0.7158314", "0.7119945", "0.71037936", "0.7098815", "0.7071887", "0.69994146", "0.69828266", "0.69828266", "0.69402456", "0.6934521", "0.6926384", "0.68780595", "0.68498814", "0.68418574", "0.6840678", "0.68243784", "0.680...
0.66201794
45
GET /segment_details GET /segment_details.xml
def index @segment_details = SegmentDetail.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @segment_details } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @segment_detail = SegmentDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @segment_detail }\n end\n end", "def details\n response = @create_send.get \"/segments/#{segment_id}.json\", {}\n Hashie::Mash.new(res...
[ "0.78502387", "0.74923897", "0.73614955", "0.7111675", "0.7070573", "0.6907828", "0.67042226", "0.66595954", "0.6616332", "0.63681513", "0.60242254", "0.60128653", "0.5984052", "0.59641826", "0.59553576", "0.5948118", "0.5874706", "0.5854033", "0.58465695", "0.5749703", "0.57...
0.74017316
2
GET /segment_details/1 GET /segment_details/1.xml
def show @segment_detail = SegmentDetail.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @segment_detail } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @segment_details = SegmentDetail.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @segment_details }\n end\n end", "def show\n @segmento = Segmento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n ...
[ "0.74286205", "0.6977575", "0.69317085", "0.69232386", "0.6865475", "0.6743212", "0.66995007", "0.6494297", "0.64096165", "0.63835496", "0.6021028", "0.59483045", "0.5920563", "0.59060186", "0.5853764", "0.5852168", "0.5793294", "0.57753426", "0.5764834", "0.57479", "0.573254...
0.7782766
0
GET /segment_details/new GET /segment_details/new.xml
def new @segment_detail = SegmentDetail.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @segment_detail } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @segment = Segment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @segment }\n end\n end", "def new\n @segment_name = SegmentName.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @seg...
[ "0.8108429", "0.74569124", "0.74530596", "0.74029505", "0.7210794", "0.72010845", "0.6749213", "0.6720394", "0.6639488", "0.6604743", "0.6585704", "0.6492658", "0.64920527", "0.6423549", "0.63855344", "0.6356545", "0.6317527", "0.6306043", "0.6303016", "0.6288522", "0.6273023...
0.8061535
1
POST /segment_details POST /segment_details.xml
def create @segment_detail = SegmentDetail.new(params[:segment_detail]) respond_to do |format| if @segment_detail.save flash[:notice] = 'SegmentDetail was successfully created.' format.html { redirect_to(@segment_detail) } format.xml { render :xml => @segment_detail, :status => :created, :location => @segment_detail } else format.html { render :action => "new" } format.xml { render :xml => @segment_detail.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @segment = @segmentation_variable.segments.create(params[:segment])\n\n respond_to do |format|\n if @segment.save\n format.html { redirect_to @segmentation_variable, notice: t2('create.notice')}\n format.json { render json: @segment, status: :created, location: @segment }\n ...
[ "0.67233413", "0.6623453", "0.6470942", "0.64519393", "0.6252491", "0.61831737", "0.61475676", "0.6143552", "0.6090877", "0.6055049", "0.5945731", "0.5845884", "0.58166075", "0.5810354", "0.5768429", "0.57647675", "0.57066005", "0.56816685", "0.56676966", "0.56659144", "0.564...
0.71251535
0
PUT /segment_details/1 PUT /segment_details/1.xml
def update @segment_detail = SegmentDetail.find(params[:id]) respond_to do |format| if @segment_detail.update_attributes(params[:segment_detail]) flash[:notice] = 'SegmentDetail was successfully updated.' format.html { redirect_to(@segment_detail) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @segment_detail.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @segment = Segment.find(params[:id])\n\n respond_to do |format|\n if @segment.update_attributes(params[:segment])\n flash[:notice] = 'Segment was successfully updated.'\n format.html { redirect_to(@segment) }\n format.xml { head :ok }\n else\n format.html {...
[ "0.69685614", "0.65614504", "0.6335639", "0.62533617", "0.6078525", "0.60068125", "0.59873915", "0.58676314", "0.58030415", "0.58023304", "0.575506", "0.57326716", "0.57287043", "0.5697373", "0.5696757", "0.56945884", "0.5601884", "0.5559498", "0.5522233", "0.5514453", "0.551...
0.7013535
0
DELETE /segment_details/1 DELETE /segment_details/1.xml
def destroy @segment_detail = SegmentDetail.find(params[:id]) @segment_detail.destroy respond_to do |format| format.html { redirect_to(segment_details_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @segment = Segment.find(params[:id])\n @segment.destroy\n\n respond_to do |format|\n format.html { redirect_to(worldreach_segments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @segmento = Segmento.find(params[:id])\n @segmento.destroy\n\n respond_to...
[ "0.7258829", "0.69901866", "0.6716874", "0.66938573", "0.65638965", "0.6478642", "0.6470066", "0.6433648", "0.64247984", "0.63037634", "0.62927014", "0.6252023", "0.6181474", "0.6176666", "0.6135924", "0.61338055", "0.61188513", "0.6091441", "0.6082414", "0.60784847", "0.6078...
0.75788414
0
def link_to(name = nil, options = nil, html_options = nil, &block) super(name, options.nil? ? name : options, html_options, &block) end
def blink_to(body, url, html_options = {}) if html_options[:class] html_options[:class] = "button " + html_options[:class] else html_options[:class] = "button" end link_to body, url, html_options end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link_to(name, url, options = {}); end", "def link_to(name = nil, options = nil, html_options = nil, &block)\n\t\t\t\tmethod = html_options[:method] if html_options\n\t\t\t\t# puts \"Name: #{name}, Action View Override - Method: '#{method}', Options:#{options}\"\n\t\t\t\tif options.class == String || method =...
[ "0.8531927", "0.8446093", "0.7890204", "0.7884788", "0.7788064", "0.7661728", "0.7521376", "0.7488133", "0.7401217", "0.7383431", "0.72800374", "0.7173195", "0.71588814", "0.7132131", "0.7096386", "0.7076448", "0.7051319", "0.70064634", "0.70007646", "0.6975321", "0.6952796",...
0.0
-1
TO SHOW PROFILE OF A USER
def show @user=User.find(params[:id]) @question=Question.where(:user_id => @user.id).paginate(:per_page => 14, :page => params[:page]) @answer=Answer.where(:user_id => @user.id).paginate(:per_page => 14, :page => params[:page]) @followers=@user.followers(User) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def profile\n \n end", "def profile\n end", "def profile\n end", "def profile\n end", "def profile\n end", "def profile\n end", "def profile\n end", "def profile\n\n end", "def get_profile_information\n # body = {\n # cmd: \"get_profile_information\"\n # }\n\n end", ...
[ "0.74522597", "0.74489814", "0.74489814", "0.74489814", "0.74489814", "0.74489814", "0.74489814", "0.7416261", "0.738378", "0.7380556", "0.7327375", "0.71808755", "0.7163945", "0.71422976", "0.71422976", "0.71073025", "0.7075687", "0.69762415", "0.69748163", "0.6974473", "0.6...
0.0
-1
TO EDIT PROFILE OF A USER
def edit respond_to do |format| format.js{ } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_profile_edit\n\n\n end", "def edit_profile\n end", "def profile_edit\n @user = User.find(current_user.id)\n end", "def edit_profile\n \t@user = current_user\n end", "def edit\n\t\t@user = User.find( params[:user_id] )\n\t\t@profile = @user.profile\n\tend", "def edit\n user = User.fin...
[ "0.78234357", "0.77756894", "0.7707126", "0.76832885", "0.7655943", "0.75136787", "0.7504444", "0.74967426", "0.7440206", "0.74400157", "0.7350655", "0.73287946", "0.72736406", "0.724645", "0.72063786", "0.72059953", "0.71543604", "0.711882", "0.71131676", "0.7108727", "0.708...
0.0
-1
TO UPDATE PROFILE OF A USER
def update if @user.update(user_params) if params[:user][:avatar].present? render :crop else redirect_to @user end else flash.now[:alert]="Something went wrong Please try again" render :edit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_profile(body)\n post(\"user/#{user_id}/profile.json\", body)\n end", "def update_profile(params)\n post('/account/update_profile.json', params)\n end", "def update\n \n if current_user.update(user_params)\n Rails.cache.write(current_user.id,current_user)\n redirect_to ...
[ "0.77945364", "0.7793967", "0.77882373", "0.7773454", "0.76213527", "0.76161647", "0.7601185", "0.75504804", "0.75108135", "0.7499574", "0.74800617", "0.74784654", "0.7467572", "0.74500895", "0.7436757", "0.74307", "0.74247956", "0.738757", "0.7373977", "0.7373674", "0.737247...
0.0
-1
hm, how to test an SVG string/file? ask nokogiri for help?
def test_cube # @cube.to_svgfile('/tmp/a.svg') { '#444' } # @cube.to_svgfile('/tmp/a.svg') # @cube.to_svgfile('/tmp/a.svg', :gamma => 4) # Visualizer::SVGimg.new(@cube).svg # did we build the cube right? assert_equal(@cube1.data[0][0][0],4) assert_equal(@cube1.data[0][4][9],10) assert_equal(@cube1.data[5],nil) assert_equal(@cube1.data[4][6],nil) assert_equal(@cube1.data[4][5][10],nil) assert_equal(@cube1.data.flatten.length,5*6*10) # now test the svg? # @cube1.to_svgfile('/tmp/a.svg', :pixsizew => 2, :inner_cols => 1) @cube1.to_svgfile('/tmp/a.svg', :inner_mode => :cols, :pixaspectratio => 0.25, :inner_rows => 1, :marks => {0 => :bullet} ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_extract_svg\n scraper = Scrapevg::SvgScraper.new(@html_with_no_svg)\n assert_equal scraper.svg_elements.size(), 0\n scraper = Scrapevg::SvgScraper.new(@html_with_wrong_svg)\n assert_equal scraper.svg_elements.size(), 0\n scraper = Scrapevg::SvgScraper.new(@html_with_svg)\n assert_equal s...
[ "0.7286783", "0.72128665", "0.68230516", "0.67013514", "0.64804006", "0.6328876", "0.63017184", "0.6242811", "0.6242811", "0.62055534", "0.616007", "0.6101697", "0.6019872", "0.60147965", "0.59894204", "0.5871186", "0.57283354", "0.5716771", "0.5670736", "0.5651042", "0.56507...
0.4878559
53
Keep the output DRY
def output {"Min" => @min, "FiveMin" => @five_min, "Hour" => @hour, "Main" => @main_tray} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output\n # adds header to beginning of main array then joins all elements with a blank space\n (@main.unshift(@header)).join(' ')\n end", "def output_for items\n output = \"\"\n items.each_with_index do |item, position|\n output += \"#{position + 1}) #{item.type.capitalize}: #{item.details}...
[ "0.61571604", "0.60962677", "0.5872198", "0.5872198", "0.5872198", "0.5872198", "0.5872198", "0.5872198", "0.5872198", "0.5872198", "0.5872198", "0.5872198", "0.5872198", "0.5872198", "0.5872198", "0.5872198", "0.5872198", "0.5858909", "0.5772284", "0.5734267", "0.57089025", ...
0.0
-1
Output to debug easier
def pretty_output JSON.pretty_generate(output) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debug; end", "def debug; end", "def debug; end", "def debug; end", "def debug?; end", "def debug?; end", "def debug1(text) debug text, 1 end", "def debug_output=(arg); end", "def dumpDebugState\n\t\tif(@hasMore)\n\t\t\tputs 'Has more solutions\\n'\n\t\telse\n\t\t\tputs 'No more solutions\\n'\n\...
[ "0.74496126", "0.74496126", "0.74496126", "0.74496126", "0.7126697", "0.7126697", "0.70861816", "0.7079684", "0.7009927", "0.6979419", "0.69144607", "0.687602", "0.6873708", "0.68673486", "0.68277687", "0.6812026", "0.6809737", "0.6784037", "0.6770373", "0.6763799", "0.671930...
0.0
-1