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
Detects nested lists and only add carets as necessary before: Docs after: Docs
def add_carets(node) if node.tag_name == "li" if node.children("ul").size > 0 node.prepend('<span class="caret caret-down"></span>') else node.prepend('<span class="caret caret-spacing"></span>') end end node.children.each do |child| add_carets(child) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block_docbook_simple_lists( text )\n orig_text = text.dup\n delimiter = \"\"\n text.gsub!( LISTS_RE ) do |match|\n lines = match.split( /\\n/ )\n last_line = -1\n depth = []\n lines.each_with_index do |line, line_id|\n if line =~ /...
[ "0.6608037", "0.65959847", "0.6397161", "0.6011906", "0.60066706", "0.5820863", "0.56875163", "0.5590006", "0.5567761", "0.55540615", "0.5523628", "0.5480896", "0.5474238", "0.54586685", "0.54418725", "0.5418801", "0.53959775", "0.5324092", "0.5275564", "0.5249979", "0.523513...
0.46062627
96
click on the all carets to initially close them
def init_carets @sidenav.children.each do |child| next unless child.tag_name == "li" carets = child.find("span.caret") carets.click end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_popups\n return if driver.doc.at('.cb_close').nil?\n driver.first('.cb_close').click\n end", "def close_tour(check_closed=true)\n # Close tour only if it is visible\n if page.has_css? 'div.hopscotch-bubble'\n find('div.hopscotch-bubble .hopscotch-bubble-close').click\n end\nend", "def cl...
[ "0.6829381", "0.61322427", "0.60186976", "0.59532416", "0.59463257", "0.59354156", "0.5908544", "0.5907754", "0.58829623", "0.5816998", "0.5788251", "0.5737297", "0.57227063", "0.5716071", "0.57139194", "0.57015586", "0.5686884", "0.56865543", "0.5656771", "0.5634313", "0.563...
0.52939725
61
Find current link associate with the currently viewed page, then walk up the parents and show
def expand_to_current current_location = $window.location.path # `window.location.pathname` # walk down tree links = @sidenav.find("a") current_link = links.select do |l| l.attr("href") == current_location end.first return unless current_link current_link.add_class("current-page") # walk back up tree starting with the sibling sibling = current_link.prev("span") sibling.click if sibling # walk back up rest of the tree uls = current_link.parents("ul") uls.each do |ul| span = ul.prevAll("span").first span.click if span end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @parent_path = set_parent_path\n end", "def find_pages_for_parents_list\n @pages_for_parents_list = []\n Page.find_all_by_parent_id(nil, :order => \"position ASC\").each do |page|\n @pages_for_parents_list << page\n @pages_for_parents_list += add_pages_branch_to_parents_list(page)\...
[ "0.6093502", "0.6035832", "0.6018221", "0.59428567", "0.58233255", "0.58202976", "0.57773834", "0.57773834", "0.57730484", "0.5717951", "0.56842506", "0.5655622", "0.5608482", "0.5592796", "0.55838126", "0.55795807", "0.554585", "0.5516596", "0.55038357", "0.55038357", "0.548...
0.6291414
0
Backup wallet to image file, it contain accounts image, assets image and keys image.
def backup_wallet client.make_request('/backup-wallet', 'post', params: {}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backup_image\n case provider\n when :libvirt\n system \"sudo virt-clone -o #{IMAGE_NAME} -n #{IMAGE_NAME}_sav --file /var/lib/libvirt/images/#{IMAGE_NAME}_sav.qcow2\"\n when :virtualbox\n # Shutdown the system\n system \"VBoxManage controlvm #{IMAGE_NAME} acpipowerbutton\"\n...
[ "0.6659576", "0.6521543", "0.6456153", "0.6359973", "0.6324028", "0.61434317", "0.6099499", "0.6090482", "0.6048025", "0.60380983", "0.5915952", "0.59055", "0.58923364", "0.58662075", "0.58524704", "0.5797919", "0.57369727", "0.57351327", "0.5733402", "0.5711486", "0.5711486"...
0.6738948
0
Restore wallet by image file.
def restore_wallet(account_image: {}, asset_image: {}, key_images: {}) params = { account_image: account_image, asset_image: asset_image, key_images: key_images } client.make_request('/restore-wallet', 'post', params: params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore_from_save_image(save_image)\n return if save_image.nil?\n restore_items_from_save_image(:active, save_image[:active_items])\n restore_items_from_save_image(:saved, save_image[:saved_items])\n end", "def restore\n path = PathHelper.path(fid)\n begin\n $mg.store_file(dkey, classnam...
[ "0.65408355", "0.61610854", "0.5873707", "0.58466434", "0.58148724", "0.5642125", "0.5641162", "0.5640173", "0.5584143", "0.5551671", "0.54848903", "0.54710484", "0.5460013", "0.5453181", "0.5422977", "0.5416861", "0.54148245", "0.5402313", "0.5390177", "0.5317422", "0.531717...
0.7391284
0
Trigger to rescan block information into related wallet.
def rescan_wallet client.make_request('/rescan-wallet', 'post', params: {}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_rescan\n EM.defer { @node.store.rescan }\n {:state => \"Rescanning ...\"}\n end", "def process( wallet )\n\t\tself.add_block do\n\t\t\tself.add_transaction( from: GENESIS_WALLET, to: wallet, amount: MINING_REWARD )\n\t\tend\n\tend", "def refresh(wallet_id)\n\t\t\t\tJuspayCheckout::ExpressChec...
[ "0.5701263", "0.5534253", "0.5416664", "0.53749126", "0.5366809", "0.5316177", "0.5277727", "0.5277727", "0.52421373", "0.52363616", "0.5136468", "0.51326907", "0.51172715", "0.5090018", "0.5064164", "0.50536823", "0.50529176", "0.50422734", "0.50383496", "0.50149024", "0.500...
0.72769284
0
Recovery wallet and accounts from root XPubs. All accounts and balances of bip44 multiaccount hierarchy for deterministic wallets can be restored via root xpubs.
def recovery_wallet(xpubs: []) client.make_request('/recovery-wallet', 'post', params: {xpubs: xpubs}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_derive_child_wallet\n addresses = []\n path = File.join(File.dirname(__FILE__), 'addresses.txt')\n File.open(path).read.each_line do |line|\n addresses << line.strip\n end\n xpub = \"xpub6EPbauBbH3SYLqJrdPAK8yQuyQDow7pY4HDV8SMezH3VVb5g5htLpMAb7gvFXVdXPRp6m2fYHc1J3bjurfbfRd2DuNZQ9rKKiKA...
[ "0.5695221", "0.54323214", "0.5343585", "0.5137428", "0.49947256", "0.49409306", "0.49350178", "0.48970926", "0.48897174", "0.47664508", "0.47620264", "0.47490352", "0.47310436", "0.47227284", "0.47217306", "0.47089007", "0.47069794", "0.47002456", "0.46941602", "0.46932575", ...
0.7513572
0
Return the information of wallet.
def wallet_info client.make_request('/wallet-info', 'post', params: {}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getwalletinfo\n node.wallet ? node.wallet.to_h : {}\n end", "def getwalletinfo\n @api.request 'getwalletinfo'\n end", "def wallet\n get 'wallet'\n end", "def wallet_information(wallet_id)\n add_timestamp\n add_salt\n headers = { 'content-type' => 'application/json',...
[ "0.86107737", "0.8168548", "0.7994915", "0.77760816", "0.7691275", "0.73840183", "0.6876495", "0.6849385", "0.67396706", "0.66357905", "0.65899664", "0.6556994", "0.64850205", "0.6466804", "0.64327633", "0.6405591", "0.63930184", "0.6382976", "0.637228", "0.63144517", "0.6276...
0.8846748
0
Get unspent utxos for the given addresses, returns a list of lists like so: [[address, txid, position (vout), amount (in satoshis)], ...]
def list_unspent(addresses) raise NotImplementedError end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unspent(addresses)\n get(\"addr/\"+addresses.join(\",\")+\"/utxo?noCache=1\")\n end", "def list_unspent(addresses)\n unspents = []\n addresses.in_groups_of(500, false).collect do |group|\n unspents += list_unspent_helper(group)\n end\n unspents\n end", "def list_unspent(oa_addre...
[ "0.8014979", "0.8006779", "0.7983811", "0.75588715", "0.75351995", "0.7373325", "0.7324532", "0.64809555", "0.6431202", "0.6269225", "0.6131479", "0.61166215", "0.61166215", "0.59714645", "0.5774702", "0.5766443", "0.5677136", "0.54803354", "0.54732054", "0.5461593", "0.54045...
0.7526553
5
Return a stored pdef
def definition(name) @pdef_registry[name.to_sym] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def definition\n return pj_info.definition\n end", "def get_definition\n\n end", "def parse (pdef)\n\n tree = case pdef\n when Array then pdef\n when String then parse_string(pdef)\n when Class then pdef.do_make\n when ProcessDefinition then pdef.do_make\n when Simp...
[ "0.6696077", "0.6584004", "0.62652695", "0.6237746", "0.61041343", "0.57534575", "0.57519424", "0.57488763", "0.5720119", "0.57179016", "0.5680229", "0.56553876", "0.56553876", "0.5616365", "0.55804884", "0.5560979", "0.5560979", "0.5532538", "0.5532538", "0.552494", "0.55107...
0.67768735
0
enum status: [:prop_waiting, :prop_accepted, :prop_refused, :app_waiting, :app_refused, :app_accepted, :direct_app_waiting, :direct_app_accepted, :direct_app_refused, :canceled]
def appointee_colored_icon(a) fa_icon, title = case when a.status.include?("prop_") ["fa-question-circle", "Proposta"] when a.status=="canceled" ["fa-times-circle", "Proposta/incarico annullato"] else ["fa-suitcase-rolling", "Incarico"] end fa_color = case when a.status=="direct_app" "green" when a.status.include?("_waiting") "grey" when a.status.include?("_accepted") "green" when a.status.include?("_refused") "red" when a.status=="canceled" "red" else "light-grey" end content_tag(:i, nil, class: "appointee-colored-icon fas #{fa_icon} fa-lg #{fa_color}", data: { toggle: "tooltip", placement: "top" }, title: title) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status_enum\n [\n [STATUSES.active],\n [STATUSES.resolved],\n [STATUSES.cancelled],\n [STATUSES.deleted]\n ]\n end", "def status_enum\n status_list\n end", "def statuses\n return ['canceled', 'completed'] if self.status == 'paid'\n return ['canceled', 'paid'] if...
[ "0.7980789", "0.74826306", "0.74757695", "0.7213033", "0.7167568", "0.70960367", "0.70032775", "0.69916046", "0.6886648", "0.6799852", "0.67238784", "0.668713", "0.66799235", "0.6661175", "0.6635721", "0.6624297", "0.6596435", "0.6593171", "0.6591134", "0.6584354", "0.6566999...
0.0
-1
just one logo for store
def one_logo if self.class_type == 'logo' && Multimedium.find_all_by_class_type('logo').count > 0 self.errors.add(:base, "This store already has one logo") false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logo; end", "def logo; end", "def logo\n\t\ts = image_tag('rails.png', :alt => \"Online Orders Application\")\n\t\treturn s\n\tend", "def logo\r\n \tlogo = image_tag(\"logo.png\", :alt => \"mens fashion today\", :class => \"round\")\r\n end", "def logo\n\t\timage_tag(\"logo.png\", :alt => \"jobradar\...
[ "0.7580324", "0.7580324", "0.7487482", "0.74149615", "0.739185", "0.73908037", "0.73888695", "0.7381284", "0.7364943", "0.731713", "0.7221564", "0.720779", "0.7193293", "0.71708304", "0.7159938", "0.7159938", "0.70722485", "0.7053646", "0.7004538", "0.6969171", "0.6963374", ...
0.7127193
16
just one banner for store
def one_banner if self.class_type == 'banner' && Multimedium.find_all_by_class_type('banner').count > 0 self.errors.add(:base, "This store already has one banner") false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def banner\n @data['banner']\n end", "def banner\n checkConnection()\n @banner\n end", "def banner\n checkConnection()\n @banner\n end", "def banner\n self.class.instance_variable_get(:@__banner)\n end", "def show\n banner = Banner.where(area: Banner.areas[:MemberShow]).first\n...
[ "0.71231735", "0.68731964", "0.68731964", "0.6748388", "0.6744911", "0.66055006", "0.64492196", "0.63693875", "0.61881524", "0.61881524", "0.6168486", "0.6160776", "0.6160776", "0.6160776", "0.6160776", "0.6160776", "0.6160776", "0.6159553", "0.6156885", "0.6155793", "0.61239...
0.7068478
1
set the style of the file accordingly to the class_type
def set_styles if self.class_type == 'variant' {:thumb => '300x300!'} elsif self.class_type == 'banner' {:banner => '800x100!'} elsif self.class_type == 'logo' {:logo => '400x60>'} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_class_style\n @class_style = ClassStyle.find(params[:id])\n end", "def fetch_style_class\n\t\tstyles = Dir.entries(\"./styles\").select do |entry|\n\t\t File.extname(entry).eql? \".rb\"\n\t\tend\n\n\t\tstyle_def = styles.detect do |style|\n\t\t File.basename(style, \".rb\") == @options[:sty...
[ "0.645608", "0.63567096", "0.6282099", "0.6250258", "0.6184444", "0.6184444", "0.6184444", "0.61592114", "0.6152576", "0.60998493", "0.60998493", "0.60998493", "0.6087915", "0.608073", "0.59904", "0.5940956", "0.59060866", "0.5902025", "0.58882016", "0.5883764", "0.5860706", ...
0.6458337
0
set the path where the files are going to be stored based on the class_type
def set_path_based_on_parent! if self.class_type == 'variant' ":rails_root/public/assets/upload/variants/:id/:style/:basename.:extension" elsif self.class_type == 'banner' ":rails_root/public/assets/upload/banner/:style/:basename.:extension" elsif self.class_type == 'logo' ":rails_root/public/assets/upload/logo/:style/:basename.:extension" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_path\n self.path = File.join(self.store_dir, self.filename)\n end", "def setup_class_info\n @file_model = nil\n @resource_assoc = :generic_files\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s....
[ "0.6750725", "0.63662887", "0.630653", "0.62392724", "0.62199235", "0.6179013", "0.6077784", "0.6059656", "0.60539013", "0.60539013", "0.60539013", "0.60539013", "0.60539013", "0.60539013", "0.60539013", "0.6053886", "0.5972618", "0.5909949", "0.59066343", "0.5880611", "0.587...
0.62961644
3
set the url where the files are going to be accessed based on the class_type
def set_url_base_on_parent! if self.class_type == 'variant' "/assets/upload/variants/:id/:style/:basename.:extension" elsif self.class_type == 'banner' "/assets/upload/banner/:style/:basename.:extension" elsif self.class_type == 'logo' "/assets/upload/logo/:style/:basename.:extension" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url_path_class=(klass)\n @_url_path_class = klass\n end", "def assign_download_endpoint(klass)\n endpoint_class = Class.new(klass)\n endpoint_class.opts[:shrine_class] = self\n const_set(:DownloadEndpoint, endpoint_class)\n end", "def url\n self.class.ur...
[ "0.7079703", "0.656588", "0.6538705", "0.63712037", "0.6356744", "0.6351664", "0.6223782", "0.61992407", "0.61583555", "0.6144934", "0.6142258", "0.6142258", "0.6142258", "0.6142258", "0.6142258", "0.6013497", "0.60076904", "0.59998655", "0.5993192", "0.59394485", "0.59394485...
0.6704642
1
for new layout test
def render_resolve_url_personal(work, show_youtube_iframe=false) url = work.attach_url obj = get_resolved_url_obj(url) case obj[:type] when "image" tag :img, src: "#{url}", onload: "onImageLoad(this)" when "audio" #compare to 2 tag :audio, controls: "controls", src: "#{url}", style: "width:100%;" when "video" tag :video, controls: "controls", src: "#{url}", width: "100%", height: "100%" when "youtube" matches = obj[:match_object] if show_youtube_iframe queryobj = {} queryobj["rel"] = 0 hashes = "" overrides = Rack::Utils.parse_query(URI.parse(matches[0]).query) overrides.delete("v") queryobj = queryobj.merge(overrides) if matches[4] != nil splits = matches[4].split('#') if splits.length > 1 hashes += "#" + splits[1] end end queryobj["enablejsapi"] = 1; if queryobj["t"].present? timeRe = /((?<min>\d+)[m])?((?<sec>\d+)[s])?/ time = queryobj["t"].scan(timeRe)[0] queryobj["start"] = (time[0] ? time[0].to_i : 0) * 60 + (time[1] ? time[1].to_i : 0) end querystr = Rack::Utils.build_query(queryobj) content_tag :iframe, '', src: "https://www.youtube.com/embed/#{matches[2]}?#{querystr}#{hashes}", width: '100%', frameborder: '0', height: '100%' else tag :img, src: "https://i.ytimg.com/vi/#{matches[2]}/hqdefault.jpg", onload: "onImageLoad(this)" end else # content_tag :div, :data => { :remote_url => url }, class: "remote-preview" do # content_tag(:div,'', style: 'background-image:url(' + work.remote_image_url + ')', class: 'preview-image') + # content_tag(:p, work.remote_description, class: 'preview-description') # end tag :img, src: "#{work.remote_image_url}", onload: "onImageLoad(this)" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def place_in_layout?; end", "def place_in_layout?; end", "def set_layout\n @layoutme = 1\n end", "def layout; end", "def layouts=(_arg0); end", "def layouts=(_arg0); end", "def layout=(_arg0); end", "def _implied_layout_name; end", "def layout_children\n \n end", "def validate_layout(la...
[ "0.7337308", "0.7337308", "0.7032893", "0.70090616", "0.69189703", "0.69189703", "0.6886924", "0.685819", "0.6836379", "0.6799751", "0.6680701", "0.6638515", "0.65718704", "0.6549206", "0.6513924", "0.6513924", "0.6474133", "0.64034104", "0.64034104", "0.6342727", "0.63080966...
0.0
-1
GET /cc_statements/1 GET /cc_statements/1.xml
def show @cc_statement = CcStatement.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @cc_statement } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @cc_statement = CcStatement.new\n @cc_statement.build_cc_all\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cc_statement }\n end\n end", "def show\n @query = Query.find(params[:id])\n client = GridClientClass.new\n @modifier =...
[ "0.5782129", "0.5696132", "0.5664426", "0.5581414", "0.55535257", "0.5533329", "0.5511199", "0.54803324", "0.5427989", "0.5340383", "0.5337714", "0.5327987", "0.5288051", "0.52879035", "0.5285559", "0.52842164", "0.52528435", "0.5233402", "0.520974", "0.520887", "0.520272", ...
0.6717177
0
GET /cc_statements/new GET /cc_statements/new.xml
def new @cc_statement = CcStatement.new @cc_statement.build_cc_all respond_to do |format| format.html # new.html.erb format.xml { render :xml => @cc_statement } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @statement = Statement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @statement }\n end\n end", "def new\n logger.debug 'new_some interesting information'\n @comdty = Comdty.new\n setvariables\n\n respond_to do |format|\n f...
[ "0.6758487", "0.6496736", "0.64260536", "0.6336849", "0.6275615", "0.62714225", "0.6238137", "0.621727", "0.6215843", "0.61640376", "0.60985094", "0.60966", "0.60966", "0.60935676", "0.6088341", "0.60805917", "0.6075441", "0.6073276", "0.6058147", "0.6033018", "0.60233384", ...
0.72920173
0
POST /cc_statements POST /cc_statements.xml
def create #I need :parent_id set to 0 by default for itself and next_sib if params[:cc_statement][:cc_all_attributes][:parent_id] == "" params[:cc_statement][:cc_all_attributes][:parent_id] = "0" end #we need the parent id to set next_sib params[:cc_statement][:cc_all_attributes][:next_sib] += "_" params[:cc_statement][:cc_all_attributes][:next_sib] += params[:cc_statement][:cc_all_attributes][:parent_id] #render :text => params.inspect #logger.debug "xxx in create1" @cc_statement = CcStatement.new(params[:cc_statement]) #render :text => "===" + @cc_statement.to_yaml + "===" respond_to do |format| if @cc_statement.save format.html { redirect_to(@cc_statement, :notice => 'Statement component was successfully created.') } format.xml { render :xml => @cc_statement, :status => :created, :location => @cc_statement } else format.html { render :action => "new" } format.xml { render :xml => @cc_statement.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @cc_statement = CcStatement.new\n @cc_statement.build_cc_all\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cc_statement }\n end\n end", "def commit(action, xml)\n headers = { 'Content-Type' => 'application/x-qbmsxml',\n ...
[ "0.559584", "0.55821294", "0.55568284", "0.5278184", "0.52586275", "0.5129247", "0.511046", "0.50929016", "0.5020656", "0.49388093", "0.4929368", "0.49190983", "0.4900148", "0.4897338", "0.4892051", "0.48857144", "0.48697066", "0.48474568", "0.4824941", "0.47993812", "0.47952...
0.5629144
0
PUT /cc_statements/1 PUT /cc_statements/1.xml
def update @cc_statement = CcStatement.find(params[:id]) #we need the parent id to set next_sib params[:cc_statement][:cc_all_attributes][:next_sib] += "_" params[:cc_statement][:cc_all_attributes][:next_sib] += params[:cc_statement][:cc_all_attributes][:parent_id] respond_to do |format| if @cc_statement.update_attributes(params[:cc_statement]) format.html { redirect_to(@cc_statement, :notice => 'Statement component was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @cc_statement.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "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 upd...
[ "0.59867", "0.57625973", "0.5627057", "0.55521697", "0.55391717", "0.5527649", "0.54677486", "0.5454499", "0.5450926", "0.54061204", "0.5397487", "0.53304625", "0.5282188", "0.5259503", "0.51997775", "0.5170253", "0.5165421", "0.5160235", "0.5158506", "0.5150662", "0.5147112"...
0.62415546
0
DELETE /cc_statements/1 DELETE /cc_statements/1.xml
def destroy @cc_statement = CcStatement.find(params[:id]) @cc_statement.destroy respond_to do |format| format.html { redirect_to(cc_statements_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def test_set3_06b_delete_res_object()\n user = \"test_user\"\n priv = \"test_privilege\"\n res_ob_type = \"test\"\n res_ob_adr = \"/db/temporary/t...
[ "0.662174", "0.6168364", "0.6022061", "0.6020586", "0.6015052", "0.5917231", "0.5910602", "0.5893439", "0.58675194", "0.5865821", "0.58591783", "0.5834734", "0.58099306", "0.5794646", "0.5792098", "0.5773454", "0.57732546", "0.57552093", "0.5739053", "0.57134885", "0.57123095...
0.70043576
0
return the name for DocumentFragment
def name '#document-fragment' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nodeName\n \"#document-fragment\"\n end", "def name\n 'document'\n end", "def name\n \"document\"\n end", "def nodeName\n \"#document\"\n end", "def identify doc = @doc\n doc.elements.first.name.to_sym\n end", "def element_name() @stag.element_name ...
[ "0.74869055", "0.657811", "0.6546116", "0.651247", "0.6367251", "0.63114816", "0.618698", "0.6081865", "0.60559905", "0.60472465", "0.6040165", "0.6040165", "0.5963048", "0.5959108", "0.5940602", "0.58966523", "0.58788687", "0.5871114", "0.58604616", "0.5835952", "0.583393", ...
0.75937766
1
Convert this DocumentFragment to a string
def to_s children.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_text\n @fragment.as_text\n end", "def to_s\n return @doc.to_s\n end", "def to_html\n output_options = Nokogiri::XML::Node::SaveOptions::DEFAULT_XHTML ^\n Nokogiri::XML::Node::SaveOptions::FORMAT\n @fragment.children.inject(\"\") do |out, child|\n out << child.serializ...
[ "0.7040761", "0.6586485", "0.6585457", "0.65789", "0.6465131", "0.6439616", "0.642836", "0.6408994", "0.63858193", "0.6223103", "0.6211244", "0.6164128", "0.61508507", "0.6039766", "0.6024613", "0.5984041", "0.59819186", "0.5965711", "0.5940833", "0.59408134", "0.5932487", ...
0.0
-1
Convert this DocumentFragment to html See Nokogiri::XML::NodeSetto_html
def to_html *args children.to_html(*args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_html\n output_options = Nokogiri::XML::Node::SaveOptions::DEFAULT_XHTML ^\n Nokogiri::XML::Node::SaveOptions::FORMAT\n @fragment.children.inject(\"\") do |out, child|\n out << child.serialize(:save_with => output_options, :encoding => 'UTF-8')\n end\n end", "def to_html\n ...
[ "0.7797146", "0.67270243", "0.64741755", "0.63890094", "0.61691463", "0.6167444", "0.6130691", "0.6108589", "0.60983074", "0.60131896", "0.6011186", "0.5843235", "0.58066255", "0.57945496", "0.579302", "0.57503366", "0.57231814", "0.57043225", "0.55740035", "0.55669665", "0.5...
0.0
-1
Convert this DocumentFragment to xhtml See Nokogiri::XML::NodeSetto_xhtml
def to_xhtml *args children.to_xhtml(*args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_html\n output_options = Nokogiri::XML::Node::SaveOptions::DEFAULT_XHTML ^\n Nokogiri::XML::Node::SaveOptions::FORMAT\n @fragment.children.inject(\"\") do |out, child|\n out << child.serialize(:save_with => output_options, :encoding => 'UTF-8')\n end\n end", "def convert_to_...
[ "0.75909334", "0.65748703", "0.64304495", "0.63292396", "0.6203852", "0.6203852", "0.61794204", "0.61794204", "0.61794204", "0.61794204", "0.60379475", "0.6004587", "0.59434855", "0.5938037", "0.5936284", "0.5931177", "0.5924429", "0.5878168", "0.5856903", "0.58411366", "0.57...
0.6413968
3
Convert this DocumentFragment to xml See Nokogiri::XML::NodeSetto_xml
def to_xml *args children.to_xml(*args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_xml\n to_node.document.to_xml\n end", "def to_xml\n @node.flatten.map(&:to_s).join\n end", "def to_html\n output_options = Nokogiri::XML::Node::SaveOptions::DEFAULT_XHTML ^\n Nokogiri::XML::Node::SaveOptions::FORMAT\n @fragment.children.inject(\"\") do |out, chil...
[ "0.7067382", "0.6635989", "0.6484199", "0.6475789", "0.64724755", "0.6376166", "0.6314287", "0.62018013", "0.62018013", "0.614489", "0.6102177", "0.607421", "0.60266334", "0.5977745", "0.5977745", "0.5961017", "0.59442425", "0.5932489", "0.59320796", "0.5918805", "0.5890942",...
0.57565
30
Search this fragment. See Nokogiri::XML::Nodecss
def css *args if children.any? children.css(*args) else NodeSet.new(document) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(xpath)\n return self.each_element( xpath ){}\n end", "def process_node_bookmark(xn)\n pull_node(xn)\n flag_match_found\n end", "def search(xpath)\n xpath = \".#{xpath}\" if !self.is_a?(REXML::Document) and xpath =~ /^\\//\n ret = REXML::XPath.match(self,xpath).map{|e...
[ "0.55615526", "0.5490382", "0.54466534", "0.5430819", "0.5322685", "0.5289006", "0.5241278", "0.524103", "0.5239676", "0.5239676", "0.523279", "0.5231627", "0.5204589", "0.5183271", "0.517583", "0.51520944", "0.514349", "0.5092402", "0.5076242", "0.5072232", "0.5072232", "0...
0.45222113
100
Renders venture setup page
def index @venture = Venture.find(params[:venture_id]) @setups = @venture.setups.order(:year) @selected_setup = @setups.where(year: params[:year]).first @categories = @selected_setup.categories @dimension = params[:dimension] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_html(req)\n @subsection = 'vehicle-view'\n @title = \"#{@vehicle.name}\"\n log.info('type=measure.render template=admin/vehicle/view.erb')\n render 'admin/vehicle/view.erb'\n end", "def speaker_tunings\n @page_title = \"Speaker Tunings\"\n render_template\n end", "def befo...
[ "0.58311015", "0.5781177", "0.56914216", "0.56742245", "0.564032", "0.56344867", "0.56220275", "0.55522627", "0.5528812", "0.55119693", "0.5511121", "0.5509864", "0.550881", "0.5497669", "0.54769564", "0.5457166", "0.5448989", "0.54335266", "0.54163194", "0.5392797", "0.53796...
0.0
-1
Renders archived positions page
def archived_positions @positions = Venture.find(params[:venture_id]).setups.where(year: params[:year]).first.positions.archived end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def archive\n render :file => cache_file and return if cached_file?\n @document = Document.public.find_by_path(params[:path].join('/'))\n raise ActiveRecord::RecordNotFound if @document.nil?\n\n \n @documents = @document.archive_for(params[:month], params[:year]).paginate :page => params[:page], :per_p...
[ "0.5944505", "0.5888091", "0.5882026", "0.5821814", "0.5705978", "0.56214726", "0.5610472", "0.5539115", "0.5460223", "0.5452496", "0.5449358", "0.5410006", "0.540135", "0.5375389", "0.53616065", "0.53390783", "0.53328735", "0.53272414", "0.5319085", "0.5318837", "0.52595586"...
0.56917876
5
Renders deleted positions page
def deleted_positions @positions = Venture.find(params[:venture_id]).setups.where(year: params[:year]).first.positions.deleted end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @position = Position.find(params[:id])\n\n if @position.layout_template.positions.count > 1 && !@position.main_position\n position_id = @position.id\n @position.destroy\n render :update do |page|\n page[\"position_row_#{position_id}\"].replace \"\"\n end\n else\n ...
[ "0.6936866", "0.62388176", "0.612356", "0.6112984", "0.60941917", "0.60399437", "0.5991937", "0.5991523", "0.59908736", "0.59902906", "0.59902906", "0.59902906", "0.5972272", "0.5962419", "0.5942675", "0.5901983", "0.5777597", "0.576103", "0.57317376", "0.5725054", "0.5662346...
0.5706772
20
Creates a new setup
def create from_setup = Setup.where(venture_id: params[:venture_id], year: params[:from_year]).first to_setup = Setup.where(venture_id: params[:venture_id], year: params[:to_year]).first # It is possible to overwrite the setup to_setup.destroy! if to_setup.present? # Create to year setup and copy all categories and positions and plan months if params[:mode] == "complete" return if from_setup.blank? to_setup = Setup.copy_setup_with_plan_months(from_setup, params[:to_year]) # Create to year setup and copy all categories and positions elsif params[:mode] == "structure" return if from_setup.blank? to_setup = Setup.copy_setup(from_setup, params[:to_year]) # Create to year setup elsif params[:mode] == "scratch" to_setup = Setup.create!(venture_id: from_setup.venture_id, year: params[:to_year]) end redirect_to setup_path(to_setup.venture_id, to_setup.year) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup()\n create_directories\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end"...
[ "0.68910825", "0.6706532", "0.6706532", "0.6706532", "0.6706532", "0.6706532", "0.6706532", "0.6706532", "0.6706532", "0.6706532", "0.6706532", "0.6706532", "0.6706532", "0.66938454", "0.66938454", "0.66938454", "0.66938454", "0.66938454", "0.6692558", "0.6633317", "0.6594617...
0.0
-1
Only the owner of the venture is allowed to perform certain actions
def authenticate_venture_owner! render "errors/404" unless Venture.find(params[:venture_id]).user_id == current_user.id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restrict_access\t\n\t\tif current_user.owner == false\n\t\t\tredirect_to user_path(current_user), notice: \"You can't view this page, contact your box owner\"\n\t\tend\t\n\tend", "def owner_only\n unless current_user == @organism.owner\n flash[:alert] = \"Vous ne pouvez executer cette action car vous...
[ "0.6973081", "0.6841731", "0.6821679", "0.6813689", "0.6787564", "0.67339927", "0.67339927", "0.6612551", "0.6594413", "0.6590633", "0.65861136", "0.6556369", "0.6508762", "0.64926624", "0.6481037", "0.64808524", "0.64669216", "0.6453985", "0.6416339", "0.63913333", "0.638294...
0.6882936
1
Permit parameters for setup
def setup_params params.require(:setup).permit(:year) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(*args) ; end", "def setup()\n setupParamListTable(getConf(:paramList)) ;\n super() ;\n end", "def setup(options = {}); end", "def setup(options); end", "def setup(options); end", "def setup_params\n params.require(:setup).permit(:tab_id, :jamma, :kick_harness, :button_layout, :r...
[ "0.70338935", "0.6993196", "0.67867893", "0.67655873", "0.67655873", "0.67441666", "0.67251885", "0.67251885", "0.67251885", "0.67251885", "0.67251885", "0.6672237", "0.6672237", "0.6634777", "0.66115165", "0.66115165", "0.6569988", "0.6564882", "0.65622264", "0.6518694", "0....
0.6227736
72
==== Parameters env:: A hash of environment keys to be merged into the default list. opt:: A hash of options (see below). ==== Options (opt) :post_body:: The post body for the request. :req:: The request string. This will only be used if :post_body is left out. ==== Returns FakeRequest:: A Request object that is built based on the parameters. ==== Notes If you pass a post body, the contenttype will be set to URLencoded.
def fake_request(env = {}, opt = {}) if opt[:post_body] req = opt[:post_body] env[:content_type] ||= "application/x-www-form-urlencoded" else req = opt[:req] end FakeRequest.new(env, StringIO.new(req || '')) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_request(params = {}, env = {})\n params = Merb::Parse.params_to_query_string(params)\n\n query_string = env[:query_string] || env['QUERY_STRING']\n env[:query_string] = query_string ? \"#{query_string}&#{params}\" : params\n \n post_body = env[:post_body] ||...
[ "0.6353609", "0.6209062", "0.6131766", "0.6115029", "0.5974974", "0.581073", "0.5722107", "0.564282", "0.56267667", "0.5513149", "0.54360497", "0.5433785", "0.5376233", "0.5373324", "0.5373324", "0.5338877", "0.5331835", "0.5328152", "0.5294705", "0.5287614", "0.5279952", "...
0.84626085
0
Dispatches an action to the given class. This bypasses the router and is suitable for unit testing of controllers. ==== Parameters controller_klass:: The controller class object that the action should be dispatched to. action:: The action name, as a symbol. params:: An optional hash that will end up as params in the controller instance. env:: An optional hash that is passed to the fake request. Any request options should go here (see +fake_request+), including :req or :post_body for setting the request body itself. &blk:: The controller is yielded to the block provided for actions prior to the action being dispatched. ==== Example dispatch_to(MyController, :create, :name => 'Homer' ) do |controller|
def dispatch_to(controller_klass, action, params = {}, env = {}, &blk) params = merge_controller_and_action(controller_klass, action, params) dispatch_request(build_request(params, env), controller_klass, action.to_s, &blk) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dispatch_request(request, controller_klass, action, &blk)\n controller = controller_klass.new(request)\n yield controller if block_given?\n controller._dispatch(action)\n\n Merb.logger.info controller._benchmarks.inspect\n Merb.logger.flush\n\n controller\n end", ...
[ "0.65754294", "0.6272057", "0.6201761", "0.6188878", "0.6188878", "0.6165436", "0.59402746", "0.5709275", "0.5654451", "0.56012523", "0.5565367", "0.54914284", "0.5461166", "0.5456916", "0.5330146", "0.5133331", "0.51305085", "0.50572914", "0.50066924", "0.4976123", "0.494327...
0.82633656
0
Keep track of cookie values in CookieJar within the context of the block; you need to set this up for secific controllers. ==== Parameters controller_classes:: Controller classes to operate on in the context of the block. &blk:: The context to operate on; optionally accepts the cookie jar as an argument.
def with_cookies(*controller_classes, &blk) cookie_jar = CookieJar.new before_cb = lambda { |c| c.cookies.update(cookie_jar) } after_cb = lambda { |c| cookie_jar.update_from_request(c.request) } controller_classes.each do |klass| klass._before_dispatch_callbacks << before_cb klass._after_dispatch_callbacks << after_cb end blk.arity == 1 ? blk.call(cookie_jar) : blk.call controller_classes.each do |klass| klass._before_dispatch_callbacks.delete before_cb klass._after_dispatch_callbacks.delete after_cb end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cookies\n @controller.send(:cookies)\n end", "def setup_controller(controller, env, vars)\n controller.env = env\n controller.headers = {}\n\n setup_controller_params(controller, env, vars)\n\n controller.cookies = Fastr::HTTP.parse_cookies(env)\n controller.app = self\n e...
[ "0.54777724", "0.52980036", "0.52752024", "0.5243587", "0.5195627", "0.51925117", "0.51736873", "0.51158464", "0.50753534", "0.49427766", "0.49427766", "0.4933547", "0.4933547", "0.492929", "0.49202102", "0.49036098", "0.49036098", "0.49036098", "0.49036098", "0.48680338", "0...
0.8127432
0
Dispatches an action to the given class and using HTTP Basic Authentication This bypasses the router and is suitable for unit testing of controllers. ==== Parameters controller_klass:: The controller class object that the action should be dispatched to. action:: The action name, as a symbol. username:: The username. password:: The password. params:: An optional hash that will end up as params in the controller instance. env:: An optional hash that is passed to the fake request. Any request options should go here (see +fake_request+), including :req or :post_body for setting the request body itself. &blk:: The controller is yielded to the block provided for actions prior to the action being dispatched. ==== Example dispatch_with_basic_authentication_to(MyController, :create, 'Fred', 'secret', :name => 'Homer' ) do |controller|
def dispatch_with_basic_authentication_to(controller_klass, action, username, password, params = {}, env = {}, &blk) env["X_HTTP_AUTHORIZATION"] = "Basic #{Base64.encode64("#{username}:#{password}")}" params = merge_controller_and_action(controller_klass, action, params) dispatch_request(build_request(params, env), controller_klass, action.to_s, &blk) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dispatch_to(controller_klass, action, params = {}, env = {}, &blk)\n params = merge_controller_and_action(controller_klass, action, params)\n dispatch_request(build_request(params, env), controller_klass, action.to_s, &blk)\n end", "def login(action, username, password, header = 'HTTP_AUTH...
[ "0.63134056", "0.5604175", "0.54849416", "0.5276103", "0.5151506", "0.51505333", "0.5140847", "0.5140847", "0.51384544", "0.5101595", "0.5095869", "0.5087563", "0.49385706", "0.4902698", "0.48784572", "0.47924063", "0.4785079", "0.47757378", "0.47638625", "0.47475797", "0.473...
0.8277525
0
Prepares and returns a request suitable for dispatching with dispatch_request. If you don't need to modify the request object before dispatching (e.g. to add cookies), you probably want to use dispatch_to instead. ==== Parameters params:: An optional hash that will end up as params in the controller instance. env:: An optional hash that is passed to the fake request. Any request options should go here (see +fake_request+), including :req or :post_body for setting the request body itself. ==== Example req = build_request(:id => 1) req.cookies['app_cookie'] = "testing" dispatch_request(req, MyController, :edit) ==== Notes Does not use routes.
def build_request(params = {}, env = {}) params = Merb::Parse.params_to_query_string(params) query_string = env[:query_string] || env['QUERY_STRING'] env[:query_string] = query_string ? "#{query_string}&#{params}" : params post_body = env[:post_body] || env['POST_BODY'] fake_request(env, { :post_body => post_body, :req => env[:req] }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_from_env(env)\n request = {}\n request['path'] = env['REQUEST_URI'].to_s\n request['method'] = env['REQUEST_METHOD']\n request['query'] = env['QUERY_STRING'].to_s\n request['Body'] = env['rack.input'].read\n\n env.each do |key, value|\n if key.mat...
[ "0.64752877", "0.62871164", "0.60735166", "0.6067896", "0.6020211", "0.59661824", "0.591714", "0.58941156", "0.58926606", "0.5741204", "0.57023144", "0.56853217", "0.56853217", "0.56585866", "0.5646141", "0.5642714", "0.56414986", "0.56279665", "0.55799675", "0.55749434", "0....
0.6666283
0
An HTTP GET request that operates through the router. ==== Parameters path:: The path that should go to the router as the request uri. params:: An optional hash that will end up as params in the controller instance. env:: An optional hash that is passed to the fake request. Any request options should go here (see +fake_request+). &blk:: The controller is yielded to the block provided for actions prior to the action being dispatched.
def get(path, params = {}, env = {}, &block) env[:request_method] = "GET" mock_request(path, params, env, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(path, params = {})\n\t\trequest(path, :get, params)\n\tend", "def get(path:, params: {})\n request(method: :get, path: path, params: params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params = {})\n request(:get, path, params)\n ...
[ "0.725828", "0.7179628", "0.7128158", "0.71200424", "0.71200424", "0.71187145", "0.71187145", "0.71187145", "0.71187145", "0.71187145", "0.71187145", "0.71187145", "0.71187145", "0.71187145", "0.71187145", "0.70910823", "0.70910823", "0.6973759", "0.68960845", "0.68934894", "...
0.7662946
0
An HTTP POST request that operates through the router. ==== Parameters path:: The path that should go to the router as the request uri. params:: An optional hash that will end up as params in the controller instance. env:: An optional hash that is passed to the fake request. Any request options should go here (see fake_request). &blk:: The controller is yielded to the block provided for actions prior to the action being dispatched.
def post(path, params = {}, env = {}, &block) env[:request_method] = "POST" mock_request(path, params, env, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(path, params)\n request(:post, path, params)\n end", "def post(path, params = {})\n\t\trequest(path, :post, params)\n\tend", "def post(path:, params: {})\n request(method: :post, path: path, params: params)\n end", "def post(path, params={})\n request(:post, path, params)\n e...
[ "0.7268376", "0.717251", "0.7144611", "0.7091272", "0.7091272", "0.7091272", "0.7076556", "0.7053185", "0.7053185", "0.7053185", "0.7053185", "0.7053185", "0.69848996", "0.68877596", "0.68677187", "0.6861362", "0.68173164", "0.67491925", "0.6692912", "0.6691374", "0.6682392",...
0.7627235
0
An HTTP PUT request that operates through the router. ==== Parameters path:: The path that should go to the router as the request uri. params:: An optional hash that will end up as params in the controller instance. env:: An optional hash that is passed to the fake request. Any request options should go here (see fake_request). &blk:: The controller is yielded to the block provided for actions prior to the action being dispatched.
def put(path, params = {}, env = {}, &block) env[:request_method] = "PUT" mock_request(path, params, env, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(path, params)\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def pu...
[ "0.7292966", "0.720389", "0.720389", "0.71866405", "0.7182192", "0.7182192", "0.7182192", "0.71755654", "0.71755654", "0.71755654", "0.71755654", "0.71755654", "0.71755654", "0.71755654", "0.71755654", "0.70728683", "0.70458686", "0.70229304", "0.6838001", "0.6824489", "0.665...
0.78555846
0
An HTTP DELETE request that operates through the router ==== Parameters path:: The path that should go to the router as the request uri. params:: An optional hash that will end up as params in the controller instance. env:: An optional hash that is passed to the fake request. Any request options should go here (see fake_request). &blk:: The controller is yielded to the block provided for actions prior to the action being dispatched.
def delete(path, params = {}, env = {}, &block) env[:request_method] = "DELETE" mock_request(path, params, env, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(path, params)\n request(:delete, path, {})\n end", "def delete(uri, params = {}, env = {}, &block)\n super(uri, params, env, &block).tap do |response|\n record_request_response_pair!('delete')\n end\n end", "def delete(path, params = {})\n request(:...
[ "0.74507517", "0.7417788", "0.73641765", "0.73641765", "0.73448855", "0.7332574", "0.7332574", "0.7332574", "0.73173976", "0.73173976", "0.73173976", "0.73173976", "0.73173976", "0.73173976", "0.73173976", "0.7291985", "0.72366655", "0.720572", "0.719558", "0.7047115", "0.699...
0.7987581
0
The workhorse for the dispatchto helpers. ==== Parameters request:: A request object that has been setup for testing. controller_klass:: The class object off the controller to dispatch the action to. action:: The action to dispatch the request to. &blk:: The controller is yielded to the block provided for actions prior to the action being dispatched. ==== Returns An instance of +controller_klass+ based on the parameters. ==== Notes Does not use routes.
def dispatch_request(request, controller_klass, action, &blk) controller = controller_klass.new(request) yield controller if block_given? controller._dispatch(action) Merb.logger.info controller._benchmarks.inspect Merb.logger.flush controller end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dispatch_to(controller_klass, action, params = {}, env = {}, &blk)\n params = merge_controller_and_action(controller_klass, action, params)\n dispatch_request(build_request(params, env), controller_klass, action.to_s, &blk)\n end", "def dispatch_action(klass, action, request, response, sta...
[ "0.7685033", "0.6669442", "0.6500708", "0.6006697", "0.58645815", "0.5860242", "0.57698756", "0.57698756", "0.57417244", "0.56490266", "0.56320757", "0.5626222", "0.54789835", "0.547776", "0.54732305", "0.53960145", "0.5360265", "0.53585404", "0.5329015", "0.5314386", "0.5295...
0.7396057
1
Checks to see that a request is routable. ==== Parameters request:: The request object to inspect. ==== Raises Merb::ControllerExceptions::BadRequest:: No matching route was found. ==== Returns Hash:: The parameters built based on the matching route.
def check_request_for_route(request) match = ::Merb::Router.match(request) if match[0].nil? && match[1].empty? raise ::Merb::ControllerExceptions::BadRequest, "No routes match the request. Request uri: #{request.uri}" else match[1] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call(request)\n @constraints.all? { |key, val| request.send(key).include? val }\n end", "def call(request)\n compile! unless compiled?\n pattern, verb, params = *parse_request(request)\n pattern = pattern.encode(Encoding.default_external)\n candidacies = match_with(pat...
[ "0.6007185", "0.5976569", "0.59397715", "0.5760299", "0.5580053", "0.5485739", "0.546998", "0.5440643", "0.541358", "0.537255", "0.53686225", "0.5368136", "0.53625286", "0.53019357", "0.52885294", "0.52464867", "0.521794", "0.52103597", "0.5199129", "0.5196158", "0.51958007",...
0.69358224
0
print out all between 1100, if mult 3 fizz, if mult 5 buzz, if mult 10 fizzbuzz
def fizzbuzz y = (1..100) y.each { |x| if x % 3 == 0 && x % 5 == 0 puts "fizzbuzz" elsif x % 3 == 0 puts "fizz" elsif x % 5 == 0 puts "buzz" else puts x end } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fizzbuzz\n\t(1..100).each do |num|\n\t if num % 3 == 0 && num % 5 == 0\n\t\tputs \"Fizzbuzz\"\n\t elsif num % 3 == 0\n\t\tputs \"Fizz\"\n\t elsif num % 5 == 0 \n\t\tputs \"Buzz\"\n\t else\n\t\tputs num\n\t end\n\tend\nend", "def fizzbuzz()\n numbers = Array(1..100)\n numbers.each do |num|\n if num ...
[ "0.8394218", "0.81584203", "0.8128392", "0.8122503", "0.81006026", "0.8041958", "0.8038834", "0.80252004", "0.8019587", "0.7988418", "0.7980908", "0.7962792", "0.79569644", "0.79488856", "0.7929194", "0.79289824", "0.7915785", "0.7900978", "0.78860044", "0.7875394", "0.787461...
0.803089
7
calcit calculator that can add, subtract, multiply, divide advanced exponents and square roots
def add(x,y) x+y end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc(expr, verbose=false)\n # hash of str: func for operations\n ops_hash = {'+': method(:add), '-': method(:subt),\n '*': method(:mult), '/': method(:div),\n '**': method(:pow), '^': method(:pow)}\n\n # parse expr\n expr.strip!\n expr_arr = expr.split\n\n # check expression val...
[ "0.71008295", "0.685444", "0.6852172", "0.68473864", "0.6801921", "0.6724995", "0.6724113", "0.6704965", "0.6680994", "0.65600675", "0.6534326", "0.6516459", "0.65036166", "0.63788366", "0.6355087", "0.634722", "0.6328821", "0.6307278", "0.62797296", "0.62679684", "0.62663305...
0.0
-1
Fetch Wallet list with client's permissions
def get_wallet_permission_all_using_get(opts = {}) data, _status_code, _headers = get_wallet_permission_all_using_get_with_http_info(opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wallet_transactions_listing(wallet_id, type)\n add_timestamp\n add_salt\n headers = { 'content-type' => 'application/json',\n 'signature' => signature('', 'get', \"/v1/user/#{wallet_id}/transactions?type=#{type}\"), 'salt' => salt, 'timestamp' => timestamp, 'access_key' => acces...
[ "0.6541657", "0.63796103", "0.63207394", "0.6275381", "0.6209335", "0.6205977", "0.6145387", "0.6141835", "0.6134418", "0.6079305", "0.60259145", "0.6017778", "0.6011842", "0.59754145", "0.5915374", "0.5905679", "0.58748984", "0.5851173", "0.5849543", "0.5849543", "0.5834174"...
0.5863406
17
Fetch Wallet list with client&39;s permissions
def get_wallet_permission_all_using_get_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WalletPermissionApi.get_wallet_permission_all_using_get ...' end # resource path local_var_path = '/wallet_permission' # query parameters query_params = {} query_params[:'nucleus_client_id'] = opts[:'nucleus_client_id'] if !opts[:'nucleus_client_id'].nil? query_params[:'is_active'] = opts[:'is_active'] if !opts[:'is_active'].nil? query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil? query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil? query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil? query_params[:'get_latest'] = opts[:'get_latest'] if !opts[:'get_latest'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'PageWalletPermissionResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: WalletPermissionApi#get_wallet_permission_all_using_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wallet_transactions_listing(wallet_id, type)\n add_timestamp\n add_salt\n headers = { 'content-type' => 'application/json',\n 'signature' => signature('', 'get', \"/v1/user/#{wallet_id}/transactions?type=#{type}\"), 'salt' => salt, 'timestamp' => timestamp, 'access_key' => acces...
[ "0.65433025", "0.6492362", "0.63008475", "0.61963177", "0.61601347", "0.6080165", "0.6070637", "0.6062939", "0.60466075", "0.60067785", "0.5993547", "0.5992091", "0.59845245", "0.5951983", "0.58824986", "0.5865882", "0.58523196", "0.5838608", "0.5821371", "0.58146477", "0.578...
0.58896345
14
Fetch Wallet's client permissions details
def get_wallet_permission_using_get(wallet_id, opts = {}) data, _status_code, _headers = get_wallet_permission_using_get_with_http_info(wallet_id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_permissions_facebook(api_client)\n api_request = 'me?fields=permissions'\n logger.debug2 \"api_request = #{api_request}\"\n begin\n api_response = api_client.get_object(api_request)\n rescue Koala::Facebook::ClientError => e\n e.logger = logger\n e.puts_exception(\"#{__method__}:...
[ "0.61460376", "0.6098816", "0.600442", "0.5946339", "0.5946339", "0.5912879", "0.58784074", "0.58379537", "0.5813389", "0.5790581", "0.5675754", "0.567379", "0.5617735", "0.55895376", "0.5583609", "0.5565665", "0.55527884", "0.554511", "0.5540676", "0.55083966", "0.55058956",...
0.0
-1
Fetch Wallet&39;s client permissions details
def get_wallet_permission_using_get_with_http_info(wallet_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WalletPermissionApi.get_wallet_permission_using_get ...' end # verify the required parameter 'wallet_id' is set if @api_client.config.client_side_validation && wallet_id.nil? fail ArgumentError, "Missing the required parameter 'wallet_id' when calling WalletPermissionApi.get_wallet_permission_using_get" end # resource path local_var_path = '/wallet_permission/{wallet_id}'.sub('{' + 'wallet_id' + '}', wallet_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'WalletPermissionResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: WalletPermissionApi#get_wallet_permission_using_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n authorize @client_profile\n end", "def get_permission_menu\n @client.raw('get', '/helpers/menu')\n end", "def index\n @client_profiles = ClientProfile.all\n\n authorize ClientProfile\n end", "def get_permission_menu\n return @client.raw(\"get\", \"/helpers/menu\")\n end", ...
[ "0.59261596", "0.5862964", "0.58017594", "0.5761688", "0.57591146", "0.5758449", "0.5630297", "0.56248444", "0.5608936", "0.55960566", "0.55872184", "0.55742043", "0.5569646", "0.5552916", "0.55364853", "0.55228555", "0.55228555", "0.5507539", "0.5506231", "0.54422176", "0.54...
0.0
-1
Update client's permission for provided Wallet
def update_wallet_permission_using_put(wallet_id, client_permissions, opts = {}) data, _status_code, _headers = update_wallet_permission_using_put_with_http_info(wallet_id, client_permissions, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_wallet_permission_using_put_with_http_info(wallet_id, client_permissions, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: WalletPermissionApi.update_wallet_permission_using_put ...'\n end\n # verify the required parameter 'wallet_id' is ...
[ "0.59180945", "0.57920545", "0.578783", "0.5779451", "0.5759536", "0.56594276", "0.563222", "0.5625595", "0.55976665", "0.55800337", "0.55740416", "0.55707705", "0.5520361", "0.55114096", "0.55114096", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.550872...
0.53582567
80
Update client&39;s permission for provided Wallet
def update_wallet_permission_using_put_with_http_info(wallet_id, client_permissions, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WalletPermissionApi.update_wallet_permission_using_put ...' end # verify the required parameter 'wallet_id' is set if @api_client.config.client_side_validation && wallet_id.nil? fail ArgumentError, "Missing the required parameter 'wallet_id' when calling WalletPermissionApi.update_wallet_permission_using_put" end # verify the required parameter 'client_permissions' is set if @api_client.config.client_side_validation && client_permissions.nil? fail ArgumentError, "Missing the required parameter 'client_permissions' when calling WalletPermissionApi.update_wallet_permission_using_put" end # resource path local_var_path = '/wallet_permission/{wallet_id}'.sub('{' + 'wallet_id' + '}', wallet_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(client_permissions) auth_names = ['oauth2'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'WalletPermissionResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: WalletPermissionApi#update_wallet_permission_using_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setAsAdmin\n self.clientType = CLIENT_TYPES[:administrator]\n end", "def update\n authorize! :update, Client\n load_client\n build_client\n save_client or render :edit\n end", "def update!(**args)\n @trust_settings_for_client = args[:trust_settings_for_client] if args.key?(:trust_...
[ "0.58043027", "0.57691044", "0.57562065", "0.56954324", "0.55856115", "0.55254626", "0.55041367", "0.54850465", "0.54640573", "0.5450176", "0.5440878", "0.5433542", "0.542459", "0.54207915", "0.54025215", "0.53998464", "0.53962314", "0.5392713", "0.5384155", "0.53773713", "0....
0.5662649
4
custom validation for uniqueness
def four_unique_answers array = [answer, distractor1, distractor2, distractor3] array.each_with_index do |v, k| a = array.delete_at(k) if array.include? v errors.add(v, "Questions require 4 unique options") end array.insert(k, v) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preconditions\n validator.kind == :uniqueness\n end", "def validates_uniqueness_of(*args)\n validates_with(UniquenessValidator, _merge_attributes(args))\n end", "def allows_unique?\n true\n end", "def validates_uniqueness_of(*args)\n validates_with(UniquenessValidat...
[ "0.7855296", "0.7746909", "0.7605428", "0.7602301", "0.7372961", "0.7351098", "0.7237629", "0.7133063", "0.7131976", "0.70436853", "0.690079", "0.6899203", "0.6892068", "0.6869978", "0.68205255", "0.6786011", "0.6718982", "0.66834176", "0.66461587", "0.66362333", "0.6609155",...
0.0
-1
require 'stopwords' def stopwords Terminology::STOPWORDS end def file File.read(Rails.root.join('public/2015/FY15_Tabular.xml')).to_s end def xml_doc Nokogiri::XML(file).to_s end
def get_text_node(node) text = nil if node and node.text text = node.text end text end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_stop_words\n # Meta-level: caller & caller_locations (inspect.stack in python)\n # p caller\n # p caller_locations.last(5).inspect\n if caller_locations[-3].label != 'extract_words'\n p caller_locations.last(5).inspect # just for debug\n return nil\n end\n stop_words = File.open('/Users/ravil/...
[ "0.6351007", "0.63177717", "0.62417823", "0.6241443", "0.5916587", "0.5877575", "0.5827767", "0.58040446", "0.56540775", "0.561389", "0.5593043", "0.5586844", "0.5540508", "0.549342", "0.5450978", "0.5449171", "0.54457766", "0.5399563", "0.5332813", "0.5329607", "0.53207", ...
0.0
-1
Configures the adapter to use for telemetry
def set_adapter(adapter) @instance = adapter end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adapter\n @adapter ||= adapter_class.new configuration\n end", "def initialize_adapter\n # if no adapter has been initialized, use memory adapter\n config[:adapter] ||= Adapters::Memory\n\n extend config[:adapter]\n after_initialize if respond_to? :after_initialize\n end", "d...
[ "0.6528803", "0.64820033", "0.63295126", "0.63270533", "0.63270533", "0.63130987", "0.62300193", "0.62179124", "0.62179124", "0.62179124", "0.61572814", "0.6125403", "0.61173004", "0.6108507", "0.6079167", "0.6046269", "0.6033778", "0.6027153", "0.59944105", "0.5957694", "0.5...
0.5801335
26
Registers the metrics to be collected
def register_metrics! return if @registered @registered = true with_instance do |t| # Worker related t.add_gauge :dynflow_active_workers, 'The number of currently busy workers', [:queue, :world] t.add_counter :dynflow_worker_events, 'The number of processed events', [:queue, :world, :worker] # Execution plan related t.add_gauge :dynflow_active_execution_plans, 'The number of active execution plans', [:action, :world, :state] t.add_gauge :dynflow_queue_size, 'Number of items in queue', [:queue, :world] t.add_counter :dynflow_finished_execution_plans, 'The number of execution plans', [:action, :world, :result] # Step related # TODO: Configure buckets in a sane manner t.add_histogram :dynflow_step_real_time, 'The time between the start end end of the step', [:action, :phase] t.add_histogram :dynflow_step_execution_time, 'The time spent executing a step', [:action, :phase] # Connector related t.add_counter :dynflow_connector_envelopes, 'The number of envelopes handled by a connector', [:world, :direction] # Persistence related t.add_histogram :dynflow_persistence, 'The time spent communicating with the database', [:world, :method] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(...)\n @metrics = {}\n register(...)\n end", "def collect(metrics)\n metrics\n end", "def setup_metrics\n end", "def setup_metrics\n end", "def setup_metrics\n end", "def metrics\n @metrics ||= collect_metrics\n end", "def collect_metrics(*)\n ...
[ "0.74799824", "0.74355805", "0.73074955", "0.73074955", "0.73074955", "0.72846323", "0.68729484", "0.6775329", "0.67341197", "0.6715236", "0.6691084", "0.6645215", "0.6636278", "0.6546899", "0.6383423", "0.63759995", "0.63454545", "0.6331616", "0.633156", "0.6291296", "0.6282...
0.74661225
1
Cleans up nokogiri search results
def cleanup(results) results.map { |r| r.value.strip }.reject(&:empty?).uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup_nokogiri_values(results)\n results.map { |a| a.value.strip }.reject { |s| s.empty? }.uniq\n end", "def cleanup_nokogiri_values(results)\n results.map { |a| a.value.strip }.reject { |s| s.empty? }.uniq\n end", "def clean_results(parse_results, existing_article_titles)\n parse_resu...
[ "0.6969907", "0.6969907", "0.6474414", "0.6459164", "0.63297373", "0.6205105", "0.6119024", "0.6105318", "0.60710776", "0.60671186", "0.60671186", "0.59995866", "0.5929215", "0.5851275", "0.5839145", "0.58225596", "0.5798297", "0.5768296", "0.5734931", "0.57054216", "0.564868...
0.6275678
6
initialize from an existing data structure
def initialize(k=5, data=nil) super(data) @k = k || 5 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(attrs={})\n from_hash(attrs)\n end", "def initialize(hash_that_represents_json)\n\t\t@data = hash_that_represents_json\n\tend", "def initialize(a_hash)\n from_h(a_hash)\n end", "def initialize(data)\n data.each { |key, value| send(\"#{key}=\", value) unless key.nil? }\n end", "de...
[ "0.6634179", "0.6486545", "0.6420666", "0.6391342", "0.6370806", "0.6345665", "0.63190126", "0.6297687", "0.62938595", "0.6274947", "0.6261995", "0.61940104", "0.61899304", "0.617698", "0.6168579", "0.615784", "0.6148702", "0.6121417", "0.61162597", "0.61074525", "0.61015946"...
0.0
-1
calculate contribution of each feature (f) for each class (k)
def calc_contribution(f) each_class do |k| a, b, c, d = get_A(f, k), get_B(f, k), get_C(f, k), get_D(f, k) s = 0.0 x, y = b+d, a+c s = (d/x)**(@k) - (c/y)**(@k) if not x.zero? and not y.zero? set_feature_score(f, k, s) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_contribution(f)\n each_class do |k|\n a, c = get_A(f, k), get_C(f, k)\n \n s =0.0\n x = a+c\n \n s = a/x if not x.zero?\n \n set_feature_score(f, k, s)\n end\n end", "def calc_contribution(f)\n each_class do |k|\n b, d = ge...
[ "0.78788304", "0.7792636", "0.7778219", "0.772977", "0.7694428", "0.76803815", "0.7582821", "0.7445391", "0.6979485", "0.6889027", "0.6828307", "0.63680226", "0.6309623", "0.62906444", "0.60808206", "0.5987632", "0.5912798", "0.59023523", "0.59009403", "0.5873083", "0.5818051...
0.7799466
1
Set the association reflection to use, and whether the association should be reloaded if an array method is called.
def initialize(instance, reflection, reload=nil) @instance = instance @reflection = reflection @reload = reload end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def association_reflection(association)\n uar = used_association_reflections\n Sequel.synchronize{uar[association] ||= true}\n super\n end", "def reflect_on_association(name)\n ActiveRecordAssociationAdapter.for_association(associations[name]) if associations[name]\n ...
[ "0.6733766", "0.6379622", "0.6260179", "0.61640126", "0.6122636", "0.6003784", "0.5981053", "0.5974207", "0.5963262", "0.59341407", "0.59227055", "0.58970326", "0.5863634", "0.5852786", "0.5820544", "0.57778937", "0.5755563", "0.5709747", "0.56878394", "0.56878394", "0.564435...
0.0
-1
Call the method given on the array of associated objects if the method is an array method, otherwise call the method on the association's dataset.
def method_missing(meth, *args, &block) (ARRAY.respond_to?(meth) ? @instance.send(:load_associated_objects, @reflection, @reload) : @instance.send(@reflection.dataset_method)). send(meth, *args, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def def_association_method(opts)\n association_module_def(opts.association_method, opts) do |*dynamic_opts, &block|\n Sequel::Deprecation.deprecate(\"Passing multiple arguments to ##{opts.association_method}\", \"Additional arguments are currently ignored\") if dynamic_opts.length > 1\n ...
[ "0.5923405", "0.5919031", "0.5654072", "0.56209105", "0.5603869", "0.5594049", "0.5547502", "0.55241543", "0.5513814", "0.54701936", "0.54488176", "0.5444896", "0.54447496", "0.54361165", "0.5424518", "0.53747237", "0.5359915", "0.5343474", "0.5343114", "0.53042823", "0.53014...
0.6684384
0
DRIVER TESTS GO BELOW THIS LINE
def assert raise "Assertion failed!" unless yield end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def running_test_case; end", "def testing\n # ...\n end", "def test_cases; end", "def running_test_step; end", "def test_step; end", "def test_case; end", "def test_steps; end", "def test_steps; end", "def tests; end", "def tests; end", "def testloop\n \n end", "def testing_en...
[ "0.7314821", "0.71384305", "0.7115481", "0.69865227", "0.69382966", "0.69194865", "0.68478084", "0.68478084", "0.6834436", "0.6834436", "0.6828251", "0.66902995", "0.66128016", "0.66128016", "0.66128016", "0.66114205", "0.66114205", "0.6592395", "0.6572524", "0.6570699", "0.6...
0.0
-1
GET /fractions GET /fractions.json
def index @totalReg = Fraction.all.count @limit = params.has_key?(:limit) ? params[:limit].to_i : 10 @page = params.has_key?(:page) ? params[:page].to_i : 1 @status = 200 @msg = "ok" @totalPage = @totalReg / @limit + (@totalReg % @limit != 0 ? 1 : 0) @start = ((@page-1) * @limit) +1 @sortDirection = params.has_key?(:sortDirection) && params[:sortDirection] == 'ascending' ? 'ASC' : 'DESC' @sortBy = params.has_key?(:sortBy) ? params[:sortBy] : 'name' @findBy = params.has_key?(:findBy) ? params[:findBy] : 'name' if !params.has_key?(:limit) && !params.has_key?(:page) && !params.has_key?(:findQuery) @fractions = Fraction.first(@limit) #raise @providers.size.to_yaml @end = Fraction.page(@page).last_page? ? @start + @fractions.size - 1 : @start + @limit -1 return end @fractions = Fraction.order("#{@sortBy} #{@sortDirection}").page(@page).per(@limit) if params[:findBy] || params[:findQuery] @fractions = Fraction.where("#{@findBy} like ?", "%#{params[:findQuery]}%").order("#{@sortBy} #{@sortDirection}").page(@page).per(@limit) @totalReg = @fractions.count @totalPage = @totalReg / @limit + (@totalReg % @limit != 0 ? 1 : 0) @start = ((@page-1) * @limit) +1 #raise @provider.to_yaml end @end = Fraction.page(@page).last_page? ? @start + @fractions.size - 1 : @start + @limit -1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fraction_params\n params.require(:fraction).permit(:fraction)\n end", "def show\n @fraction = Fraction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fraction }\n end\n end", "def type\n :fractional\n end", ...
[ "0.6959134", "0.68787956", "0.6531463", "0.65141433", "0.6512246", "0.6369864", "0.63340855", "0.6251424", "0.6208444", "0.6196881", "0.60611004", "0.6049666", "0.5980671", "0.59733593", "0.58948046", "0.58325404", "0.5831485", "0.57648724", "0.575185", "0.5750398", "0.571185...
0.55959487
33
GET /fractions/1 GET /fractions/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @fraction = Fraction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fraction }\n end\n end", "def fraction_params\n params.require(:fraction).permit(:fraction)\n end", "def set_fraction\n @fraction = Fraction....
[ "0.725403", "0.6951041", "0.69046235", "0.6887498", "0.66118616", "0.659512", "0.64443827", "0.63384795", "0.628042", "0.6266492", "0.6194288", "0.61718965", "0.6122079", "0.60069895", "0.60061103", "0.5995959", "0.59928447", "0.59596133", "0.59295726", "0.5925297", "0.586940...
0.0
-1
POST /fractions POST /fractions.json
def create @fraction = Fraction.new(fraction_params) respond_to do |format| if @fraction.save format.html { redirect_to @fraction, notice: 'Fraction was successfully created.' } format.json { render :show, status: :created, location: @fraction } else format.html { render :new } format.json { render json: @fraction.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fraction_params\n params.require(:fraction).permit(:fraction)\n end", "def member_fraction_params\n params.require(:member_fraction).permit(:parliament_id, :structural_id, :fraction_id)\n end", "def create\n @member_fraction = MemberFraction.new(member_fraction_params)\n\n respond_to ...
[ "0.77332985", "0.68102807", "0.67114794", "0.65384734", "0.6472182", "0.64225864", "0.6376123", "0.62741846", "0.6221947", "0.6160466", "0.60524327", "0.6049844", "0.59856796", "0.58795744", "0.58648354", "0.58358276", "0.58195025", "0.5819296", "0.5800493", "0.5794508", "0.5...
0.7197817
1
PATCH/PUT /fractions/1 PATCH/PUT /fractions/1.json
def update respond_to do |format| if @fraction.update(fraction_params) format.html { redirect_to @fraction, notice: 'Fraction was successfully updated.' } format.json { render :show, status: :ok, location: @fraction } else format.html { render :edit } format.json { render json: @fraction.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @member_fraction.update(member_fraction_params)\n format.html { redirect_to member_fractions_path, notice: 'Member fraction was successfully updated.' }\n format.json { render :show, status: :ok, location: @member_fraction }\n else\n format...
[ "0.69239014", "0.67371404", "0.66484714", "0.6586919", "0.65382516", "0.60311043", "0.60145515", "0.58613765", "0.58448154", "0.5799816", "0.57682145", "0.57394004", "0.5737671", "0.5685192", "0.5665652", "0.56449336", "0.56228745", "0.5622771", "0.5622771", "0.5612094", "0.5...
0.7464898
0
DELETE /fractions/1 DELETE /fractions/1.json
def destroy @fraction.destroy respond_to do |format| format.html { redirect_to fractions_url, notice: 'Fraction was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @fraction = Fraction.find(params[:id])\n @fraction.destroy\n\n respond_to do |format|\n format.html { redirect_to regions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @member_fraction.destroy\n respond_to do |format|\n format.html { redirec...
[ "0.7416597", "0.7099154", "0.6915712", "0.6339604", "0.62519103", "0.62268734", "0.61898583", "0.6156016", "0.6055814", "0.60532826", "0.6031578", "0.59887844", "0.5967448", "0.5965297", "0.59568524", "0.59512883", "0.59381354", "0.59381354", "0.5929808", "0.5929391", "0.5920...
0.75078803
0
Use callbacks to share common setup or constraints between actions.
def set_fraction @fraction = Fraction.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.6162554", "0.60452986", "0.5945278", "0.59169763", "0.58877826", "0.5834763", "0.5775349", "0.5704972", "0.5704972", "0.56543803", "0.5621491", "0.5427202", "0.54093206", "0.54093206", "0.54093206", "0.53975695", "0.53776276", "0.53562194", "0.5340594", "0.5337824", "0.532...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def fraction_params params.require(:fraction).permit(:fraction) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
GET /framedp_summaries/1 GET /framedp_summaries/1.json
def show @framedp_summary = FramedpSummary.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @framedp_summary } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @framedp_summary = FramedpSummary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @framedp_summary }\n end\n end", "def show\n @summaries = Summary.all \n end", "def summary\n response = get \"summary\", {}\n Hashie::Mash.new(...
[ "0.672472", "0.6032978", "0.598185", "0.59406495", "0.5869434", "0.58512163", "0.5845019", "0.5838353", "0.5756592", "0.5709459", "0.5709459", "0.5709459", "0.5709459", "0.5646136", "0.56455547", "0.5639625", "0.56332684", "0.56332684", "0.5599149", "0.5577415", "0.55582815",...
0.73398685
0
GET /framedp_summaries/new GET /framedp_summaries/new.json
def new @framedp_summary = FramedpSummary.new respond_to do |format| format.html # new.html.erb format.json { render json: @framedp_summary } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @framedp_summary = FramedpSummary.new(params[:framedp_summary])\n\n respond_to do |format|\n if @framedp_summary.save\n format.html { redirect_to @framedp_summary, notice: 'Framedp summary was successfully created.' }\n format.json { render json: @framedp_summary, status: :cre...
[ "0.7236628", "0.71282554", "0.6664434", "0.6633187", "0.661516", "0.65543383", "0.653464", "0.6522222", "0.65004045", "0.64370763", "0.6396831", "0.63895905", "0.634813", "0.6339417", "0.6336515", "0.6326113", "0.6310421", "0.6301756", "0.6294988", "0.6292946", "0.6289391", ...
0.7755582
0
POST /framedp_summaries POST /framedp_summaries.json
def create @framedp_summary = FramedpSummary.new(params[:framedp_summary]) respond_to do |format| if @framedp_summary.save format.html { redirect_to @framedp_summary, notice: 'Framedp summary was successfully created.' } format.json { render json: @framedp_summary, status: :created, location: @framedp_summary } else format.html { render action: "new" } format.json { render json: @framedp_summary.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @framedp_summary = FramedpSummary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @framedp_summary }\n end\n end", "def show\n @framedp_summary = FramedpSummary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html...
[ "0.6450295", "0.57815194", "0.56836575", "0.5571657", "0.554901", "0.55406606", "0.5516639", "0.5516639", "0.530029", "0.52817714", "0.5275705", "0.525951", "0.524886", "0.523936", "0.52131325", "0.52118635", "0.51829076", "0.5126057", "0.5103483", "0.5094349", "0.50934595", ...
0.70963943
0
PUT /framedp_summaries/1 PUT /framedp_summaries/1.json
def update @framedp_summary = FramedpSummary.find(params[:id]) respond_to do |format| if @framedp_summary.update_attributes(params[:framedp_summary]) format.html { redirect_to @framedp_summary, notice: 'Framedp summary was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @framedp_summary.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @framedp_summary = FramedpSummary.new(params[:framedp_summary])\n\n respond_to do |format|\n if @framedp_summary.save\n format.html { redirect_to @framedp_summary, notice: 'Framedp summary was successfully created.' }\n format.json { render json: @framedp_summary, status: :cre...
[ "0.64135617", "0.5950805", "0.5858234", "0.5852816", "0.58208823", "0.58208823", "0.58208823", "0.5786521", "0.5749176", "0.5700257", "0.533353", "0.533353", "0.533353", "0.533353", "0.53335214", "0.5329445", "0.5320898", "0.53115624", "0.5306827", "0.5278408", "0.527586", ...
0.6763906
0
DELETE /framedp_summaries/1 DELETE /framedp_summaries/1.json
def destroy @framedp_summary = FramedpSummary.find(params[:id]) @framedp_summary.destroy respond_to do |format| format.html { redirect_to framedp_summaries_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @summary.destroy\n respond_to do |format|\n format.html { redirect_to summaries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @summary = Summary.find(params[:id])\n @summary.destroy\n\n respond_to do |format|\n format.html { redirect_to summ...
[ "0.6990364", "0.67791474", "0.6769124", "0.66883564", "0.66883564", "0.6684811", "0.64169574", "0.6364307", "0.63125694", "0.62874836", "0.6266948", "0.6266192", "0.61698157", "0.61542654", "0.6138919", "0.61344963", "0.61334956", "0.6116587", "0.61095464", "0.60976297", "0.6...
0.76653886
0
Only allow a list of trusted parameters through.
def order_params params.require(:order).permit! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
Returns the requested node.
def requested_node scope = current_site.nodes.with_attributes.with_variant # If we have no path, use the first root page. Otherwise, find the page by # the requested URI. if node_uri.blank? home_page = scope.sorted.roots.first raise ActiveRecord::RecordNotFound.new if home_page.blank? home_page else scope.find_by_uri!(node_uri) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def node\n return @node\n end", "def get_node(node)\n\t\t\t@nodes[node]\n\t\tend", "def get_node\n # @@neo = Neography::Rest.new\n begin\n # qur = \"MATCH (n {object_id: \"+self.id.to_s+\", object_type: \\'\"+self.class.to_s+\"\\' }) RETURN n LIMIT 1\"\n # response = @@n...
[ "0.7991362", "0.7929335", "0.76970583", "0.7645739", "0.7645739", "0.76057637", "0.76057637", "0.76047325", "0.7593304", "0.74801105", "0.7387379", "0.73391944", "0.73084265", "0.7210616", "0.7207596", "0.7156161", "0.7093469", "0.70868737", "0.7012948", "0.6994086", "0.69834...
0.7435003
10
Overridden in PostBodyRequest and PostFileRequest
def make_request false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_request(object)\n end", "def post_data; end", "def multipart; end", "def set_request_body!(request); end", "def post_data=(_arg0); end", "def set_up_post_request(uri, data, headers, binary_key = nil)\n if !binary_key.nil?\n binary_data = data[binary_key]\n\n if binary_dat...
[ "0.6750536", "0.6492899", "0.6247419", "0.6195176", "0.61451447", "0.61445546", "0.6132749", "0.61242837", "0.6123576", "0.609281", "0.6086141", "0.6047472", "0.5963688", "0.5949453", "0.5889414", "0.58756244", "0.58436054", "0.5790417", "0.57813287", "0.5767067", "0.5757175"...
0.0
-1
Get root nodes count/array for explorer tree
def x_get_tree_roots(_count_only, _options) resolve = {} CustomButton.button_classes.each { |db| resolve[db] = ui_lookup(:model => db) } @sb[:target_classes] = resolve.invert resolve = Array(resolve.invert).sort resolve.collect do |typ| {:id => "ab_#{typ[1]}", :text => typ[0], :image => buttons_node_image(typ[1]), :tip => typ[0]} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def x_get_tree_roots\n count_only_or_objects(false, PxeServer.all, \"name\")\n end", "def x_get_tree_roots\n count_only_or_objects(false, StorageCluster.all)\n end", "def x_get_tree_roots\n count_only_or_objects(false, MiqPolicySet.all, :description)\n end", "def get_number_of_root_elements(eleme...
[ "0.769075", "0.7564679", "0.7150569", "0.7135373", "0.7068182", "0.7036481", "0.7035818", "0.70299476", "0.69325095", "0.6925408", "0.69242346", "0.6908054", "0.6880502", "0.68336684", "0.6818326", "0.681651", "0.6807408", "0.68010336", "0.6789652", "0.67728794", "0.67718107"...
0.6326881
51
before_action :authenticate_user! GET /posts GET /posts.json
def index @posts = Post.user_posts current_user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n if user_signed_in?\n\n @post = current_user.posts.find(params[:id])\n \n if @post.user_id == current_user.id\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n else\n redirect_t...
[ "0.72160757", "0.71537083", "0.7028036", "0.69634265", "0.6919625", "0.6865617", "0.68592584", "0.6849146", "0.6845703", "0.6809406", "0.67830193", "0.6704709", "0.6677335", "0.66742533", "0.6649936", "0.66110575", "0.6540277", "0.6530715", "0.6502842", "0.6497177", "0.649092...
0.6599342
16
GET /posts/1 GET /posts/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @posts = Post.find(params[:id])\n render json: @posts\n end", "def show\n render json: Post.find(params[\"id\"])\n end", "def show\r\n post = Post.find(params[:id])\r\n render json: post\r\n end", "def show\n @post = Post.find(params[:id])\n\n render json: @post\n end", ...
[ "0.77108145", "0.73538285", "0.73431885", "0.7337658", "0.73228896", "0.72930473", "0.7276023", "0.72562623", "0.716107", "0.7158095", "0.71544594", "0.71544594", "0.7118771", "0.70939285", "0.70939285", "0.70939285", "0.7093431", "0.7070624", "0.70599306", "0.70444286", "0.7...
0.0
-1
POST /posts POST /posts.json
def create user_post_param respond_to do |format| if @post.save format.html do redirect_to @post, notice: "Post was successfully created." end format.json { render :show, status: :created, location: @post } else format.html { render :new } format.json do render json: @post.errors, status: :unprocessable_entity end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n render json: Post.create(params[\"post\"])\n end", "def create\n respond_with Post.create(params[:posts])\n end", "def create\n @post = Post.create(post_params)\n render json: @post, serializer: PostSerializer\n end", "def create\n @post = Post.new(post_params)\n @po...
[ "0.74463975", "0.73221767", "0.73072433", "0.7123966", "0.7015686", "0.701327", "0.69841874", "0.6939327", "0.69313824", "0.69053805", "0.68196476", "0.6812792", "0.6793222", "0.6792862", "0.6779654", "0.6779654", "0.67625546", "0.67602354", "0.67515427", "0.6735786", "0.6698...
0.6443543
46
PATCH/PUT /posts/1 PATCH/PUT /posts/1.json
def update respond_to do |format| if @post.update(post_params) format.html do redirect_to @post, notice: "Post was successfully updated." end format.json { render :show, status: :ok, location: @post } else format.html { render :edit } format.json do render json: @post.errors, status: :unprocessable_entity end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end", "def update\n respond_with Post.update(params[:id], params[:posts])\n end", "def update\n @post = Post.find(params[:id])\n respond_to do |format|\n if @post.update_attributes(params[:post])\n forma...
[ "0.71867543", "0.7042899", "0.6774105", "0.67672604", "0.6669961", "0.6649129", "0.657972", "0.6556958", "0.6551495", "0.6549005", "0.6535034", "0.6531995", "0.6497553", "0.64958835", "0.6468818", "0.64319825", "0.6428907", "0.64275557", "0.64273673", "0.64193714", "0.6419366...
0.0
-1
DELETE /posts/1 DELETE /posts/1.json
def destroy @post.destroy respond_to do |format| format.html do redirect_to posts_url, notice: "Post was successfully destroyed." end format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n render json: Post.delete(params[\"id\"])\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n post = Post.find(params[:id])\n if post.destroy\n render json: {status: \"success\", data: {id: param...
[ "0.8046884", "0.76902676", "0.7583626", "0.75803024", "0.7568048", "0.75047046", "0.75031126", "0.74750155", "0.74671036", "0.74650854", "0.746482", "0.74589694", "0.74589694", "0.74589694", "0.74589694", "0.74579465", "0.74579465", "0.74579465", "0.74579465", "0.74579465", "...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_post @post = Post.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.6162554", "0.60452986", "0.5945278", "0.59169763", "0.58877826", "0.5834763", "0.5775349", "0.5704972", "0.5704972", "0.56543803", "0.5621491", "0.5427202", "0.54093206", "0.54093206", "0.54093206", "0.53975695", "0.53776276", "0.53562194", "0.5340594", "0.5337824", "0.532...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def post_params params.require(:post).permit(:subject, :description) 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
Use this boolean method to determine whether this customer_file can be used to collect a payment. Checks all of the following: The "authorized" flag is true. There is a minimum authorized amount. Customer and user records are attached, i.e., neither has been deleted.
def customer_has_authorized_payment? authorized and authorized_amount.try(:>, 0) and has_customer_account? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def charge_is_allowed?\n\t\tif not customer_has_authorized_payment?\n\t\t\terrors.add :base, I18n.t('views.customer_file.new_charge.you_are_not_authorized')\n\t\t\tfalse\n\t\telsif valid? and charge_amount.present? and authorized_amount and charge_amount.to_i <= authorized_amount\n\t\t\ttrue\n\t\telse\n\t\t\terror...
[ "0.71722645", "0.6657813", "0.6450728", "0.64218915", "0.64218915", "0.6343719", "0.6315825", "0.62663573", "0.6225009", "0.6186739", "0.61811507", "0.6180229", "0.61707926", "0.6163278", "0.6146223", "0.6146223", "0.6138449", "0.6123721", "0.6106551", "0.60813814", "0.603684...
0.7491831
0
Use this boolean method to determine whether the charge_amount can be collected. Also ensures that the customer still exists and has authorized payment to this provider.
def charge_is_allowed? if not customer_has_authorized_payment? errors.add :base, I18n.t('views.customer_file.new_charge.you_are_not_authorized') false elsif valid? and charge_amount.present? and authorized_amount and charge_amount.to_i <= authorized_amount true else errors.add :charge_amount, I18n.t('views.customer_file.new_charge.invalid', amount: charge_amount_usd) if errors.empty? false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def charge?\n false\n end", "def charges?\n true\n end", "def needs_handling_charge?\n true\n end", "def charged?\n stripe_charge_id.present?\n end", "def charge_credit_card(amount)\n true\n end", "def charge_credit_card(amount)\n true\n end", "def charged?\n comp...
[ "0.76029074", "0.74639976", "0.7239608", "0.70875794", "0.7015584", "0.7015584", "0.68862283", "0.6858936", "0.6799953", "0.6784267", "0.6779929", "0.6715737", "0.66347224", "0.66147065", "0.6591362", "0.6591362", "0.6519883", "0.6464177", "0.64519244", "0.6433467", "0.641175...
0.8083334
0
GET /term_counts/1 GET /term_counts/1.xml
def show @term_count = TermCount.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @term_count } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @term_count = TermCount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @term_count }\n end\n end", "def get_document_frequency(term)\n\t\t\t@term_hash[term]\n\t\tend", "def index\n @tags = Tag.counts\n\n respond_to do...
[ "0.65998244", "0.64372104", "0.6348661", "0.60904974", "0.60649526", "0.59661585", "0.59277576", "0.5901891", "0.5875368", "0.57677156", "0.5746671", "0.57270795", "0.5712348", "0.57084346", "0.57039905", "0.5695749", "0.5694083", "0.5687324", "0.5687266", "0.56584513", "0.56...
0.6985498
0
GET /term_counts/new GET /term_counts/new.xml
def new @term_count = TermCount.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @term_count } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @term_count = TermCount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @term_count }\n end\n end", "def create\n @term_count = TermCount.new(params[:term_count])\n\n respond_to do |format|\n if @term_count.save\n flash[:not...
[ "0.7337316", "0.6986773", "0.6798613", "0.6798613", "0.6798613", "0.6700379", "0.64070505", "0.6358499", "0.634079", "0.6280353", "0.6235569", "0.61859065", "0.61798096", "0.61019623", "0.6041338", "0.6019147", "0.60190517", "0.60175043", "0.59731585", "0.59415734", "0.589880...
0.76714236
0
POST /term_counts POST /term_counts.xml
def create @term_count = TermCount.new(params[:term_count]) respond_to do |format| if @term_count.save flash[:notice] = 'TermCount was successfully created.' format.html { redirect_to(@term_count) } format.xml { render :xml => @term_count, :status => :created, :location => @term_count } else format.html { render :action => "new" } format.xml { render :xml => @term_count.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @term_count = TermCount.new(params[:term_count])\n\n respond_to do |format|\n if @term_count.save\n format.html { redirect_to @term_count, notice: 'Term count was successfully created.' }\n format.json { render json: @term_count, status: :created, location: @term_count }\n ...
[ "0.6594808", "0.6192454", "0.6025294", "0.6024979", "0.601109", "0.5878424", "0.58438814", "0.58272964", "0.58189905", "0.57945263", "0.57408464", "0.57081825", "0.5697413", "0.5660348", "0.56443745", "0.56002575", "0.55988723", "0.5592685", "0.55294317", "0.5498483", "0.5489...
0.66856563
0
PUT /term_counts/1 PUT /term_counts/1.xml
def update @term_count = TermCount.find(params[:id]) respond_to do |format| if @term_count.update_attributes(params[:term_count]) flash[:notice] = 'TermCount was successfully updated.' format.html { redirect_to(@term_count) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @term_count.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @term_count = TermCount.find(params[:id])\n\n respond_to do |format|\n if @term_count.update_attributes(params[:term_count])\n format.html { redirect_to @term_count, notice: 'Term count was successfully updated.' }\n format.json { head :no_content }\n else\n format...
[ "0.69729066", "0.6414061", "0.6399268", "0.6270709", "0.62558436", "0.62392956", "0.61575913", "0.6156369", "0.6155693", "0.61327827", "0.60665816", "0.60652447", "0.6032292", "0.59789103", "0.5946453", "0.5768371", "0.57486767", "0.57068497", "0.57019806", "0.57019806", "0.5...
0.7043425
0
DELETE /term_counts/1 DELETE /term_counts/1.xml
def destroy @term_count = TermCount.find(params[:id]) @term_count.destroy respond_to do |format| format.html { redirect_to(term_counts_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @term_count = TermCount.find(params[:id])\n @term_count.destroy\n\n respond_to do |format|\n format.html { redirect_to term_counts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @term.destroy\n head :no_content\n end", "def destroy\n @term =...
[ "0.71198714", "0.6885946", "0.6883627", "0.6883627", "0.6785037", "0.6728722", "0.66893494", "0.665326", "0.664966", "0.6646468", "0.65508735", "0.639998", "0.6351535", "0.62913245", "0.62871677", "0.62644607", "0.62591547", "0.6256864", "0.6248882", "0.6244227", "0.6222459",...
0.7470937
0
Add a new tab interface backed by source.
def add_tab(host) @tabs.active.hide if tab hv = HostView.new( self, :host => host, :top => 1, :height => Curses.lines - 1 ) hv.on_state_change do |state| @tabs.render end @tabs << hv tab.show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_tab(*args)\n tabs << args\n end", "def add_tab(options = {}, &block)\n id = @tab_options[:id] ? (@tab_options[:id].to_s + \"_\" + (@tabs.size + 1).to_s) : nil\n \n tab = Tab.new({ :id => id, \n :class => @tab_options[:class]\n ...
[ "0.6939854", "0.65084684", "0.64965945", "0.62654364", "0.6218769", "0.61266065", "0.59611815", "0.5848245", "0.5809864", "0.5677942", "0.56179726", "0.5610298", "0.55483437", "0.5532572", "0.5496471", "0.53817207", "0.5349773", "0.53313017", "0.5271107", "0.52470094", "0.524...
0.6121976
6
Resize to fit display
def resize # We need to nuke ncurses to pick up the new dimensions Curses.def_prog_mode Curses.close_screen Curses.reset_prog_mode height, width = Curses.dimensions # Resize tabs @tabs.resize( :width => width, :height => height ) @tabs.render end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resize new_width, new_height\n win.resize new_width, new_height\n end", "def resize(width, height); end", "def resize_to(width, height); end", "def resize(width, height)\n end", "def resize_to_fit width, height\n process :resize_to_fit => [width, height]\n end", "def resize width...
[ "0.7331587", "0.7291365", "0.7209486", "0.6970077", "0.6927916", "0.68964875", "0.688549", "0.66455525", "0.6638066", "0.6615044", "0.6541229", "0.6541229", "0.6514034", "0.6469051", "0.6446277", "0.6443882", "0.64406425", "0.642693", "0.64204687", "0.638633", "0.6354829", ...
0.6716057
7
Switch to a different conversation
def switch(target = nil) if target # Switch to a specific tab @tabs.switch_to_label target else # Switch to the next tab @tabs.scroll end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conversation_start person\n\t\treturn nil if (person.is_not? :person)\n\t\t@mode = :conversation\n\t\t@talking_to = person\n\t\tGAME.window(:conversation).show\n\t\tGAME.window(:input).prompt = :conversation\n\tend", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "d...
[ "0.65577716", "0.64013493", "0.64013493", "0.64013493", "0.64013493", "0.64013493", "0.64013493", "0.64013493", "0.64013493", "0.64013493", "0.64013493", "0.64013493", "0.64013493", "0.64013493", "0.6382312", "0.6342955", "0.63158756", "0.63158756", "0.63158756", "0.63158756", ...
0.0
-1
See for more details.
def supports_optimizer_hints? !mariadb? && database_version >= "5.7.7" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def refutal()\n end", "def who_we_are\r\n end", "def usage; end", "def usage; end", "def schubert; end", "def verdi; end", "def loc; end", "def loc; end", "def loc; en...
[ "0.8107999", "0.71451133", "0.7124696", "0.7124696", "0.7124696", "0.7124696", "0.7040452", "0.6935659", "0.68564904", "0.68564904", "0.67835283", "0.67249644", "0.66593087", "0.66593087", "0.66593087", "0.66581976", "0.66429484", "0.6635239", "0.6620886", "0.66105586", "0.65...
0.0
-1
HELPER METHODS =========================================== The two drivers have slightly different ways of yielding hashes of results, so this method must be implemented to provide a uniform interface.
def each_hash(result) # :nodoc: raise NotImplementedError end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each_result(results = last_results, &block)\n results.each do |result|\n block.call(Hashie::Mash.new(result))\n end\nend", "def get_db_as_hash()\n db = get_db()\n db.results_as_hash = true \n return db\n end", "def each_hash(the_query, with_table_names = false, &block)\n b...
[ "0.57877463", "0.57007825", "0.56494826", "0.5632043", "0.56057423", "0.56017214", "0.55607474", "0.5553489", "0.555235", "0.55475515", "0.5543713", "0.55344355", "0.55117965", "0.54950285", "0.5489595", "0.5467286", "0.5443337", "0.54361165", "0.54039854", "0.53991973", "0.5...
0.6416849
0
Must return the MySQL error number from the exception, if the exception has an error number.
def error_number(exception) # :nodoc: raise NotImplementedError end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sqlite_error_code(exception)\n exception.resultCode.code if exception.respond_to?(:resultCode)\n end", "def error_code(exception)\n case exception\n when Java::JavaSql::SQLException\n exception.getErrorCode\n else\n nil\n end\n ...
[ "0.7294421", "0.72759324", "0.69282037", "0.6549092", "0.6456522", "0.64231855", "0.62017584", "0.61924934", "0.61848027", "0.61785", "0.61143553", "0.6101044", "0.6101044", "0.6101044", "0.5991355", "0.59792393", "0.5892648", "0.5855871", "0.58156127", "0.5814836", "0.580843...
0.7238417
2
DATABASE STATEMENTS ====================================== ++ Mysql2Adapter doesn't have to free a result after using it, but we use this method to write stuff in an abstract way without concerning ourselves about whether it needs to be explicitly freed or not.
def execute_and_free(sql, name = nil, async: false) # :nodoc: sql = transform_query(sql) check_if_write_query(sql) mark_transaction_written_if_write(sql) yield raw_execute(sql, name, async: async) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flushdb; end", "def commit(q)\n\t\tdbh=Mysql.init\n\t\tdbh.real_connect(@host, @user, @password, @db,@port,nil,Mysql::CLIENT_MULTI_RESULTS)\n\t\tdbh.query_with_result=false\n\t\tdbh.query(q)\n\t\t\tbegin\n\t\t\t rs = dbh.use_result\n\t\t\trescue Mysql::Error => e \n\t\t\t no_more_results=true\n\t\t\tend \...
[ "0.60829854", "0.5959344", "0.59277534", "0.58936864", "0.5889978", "0.58822626", "0.585421", "0.5847666", "0.5745714", "0.5745714", "0.5745504", "0.5716193", "0.5687672", "0.56662166", "0.56535983", "0.5642623", "0.56225", "0.5605796", "0.5549946", "0.55464476", "0.55241996"...
0.58788615
6