query
stringlengths
7
6.41k
document
stringlengths
12
28.8k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
5
10
document_rank
stringclasses
2 values
Returns the bin index corresponding to _value_.
def bin_index(value) return -1 if(value < @range_min or value > @range_max) (@num_bins*(value - @range_min)/(@range_max - @range_min)).to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def binary_search(value)\n search_result = binary_search_internal(value)\n return search_result[0] ? search_result[1] : -1\n end", "def raw_count(value)\n @bins[value] || 0\n end", "def value(bin_index)\n @range_min + (bin_index + 0.5)*(@range_max - @range_min)/@num_bins.to_f\n end", "...
[ "0.6910767", "0.67883694", "0.62572676", "0.6224203", "0.6101795", "0.6090049", "0.596754", "0.5899062", "0.5862317", "0.5853283", "0.584395", "0.58358526", "0.5833961", "0.57845455", "0.57845455", "0.5701703", "0.5691766", "0.5652859", "0.56436414", "0.562319", "0.559947", ...
0.8275749
0
Returns the mean value of bin _bin_index_.
def value(bin_index) @range_min + (bin_index + 0.5)*(@range_max - @range_min)/@num_bins.to_f end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean\n return 0.0 if @count.zero?\n return @sum / @count\n end", "def mean\n @sum / @count\n end", "def mean\n stats.mean\n end", "def mean\n sum / count.to_f\n end", "def mean\n @cleaned_data.map(&:to_f).sum / n.to_f\n end", "def mean\n get_mean\n e...
[ "0.645113", "0.62902164", "0.6277264", "0.6002737", "0.59984004", "0.59034187", "0.58576417", "0.5840206", "0.5817501", "0.5807346", "0.57853055", "0.5761594", "0.5751396", "0.57219946", "0.5708449", "0.5659274", "0.56562865", "0.5637644", "0.56335825", "0.56172955", "0.55988...
0.6714202
0
Returns the Kinvar object w/ name _kinvar_
def [](kinvar) @kinvars.each{|kv| return kv if(kv.name == kinvar)}; nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_variable(name)\n NetCDF::Variable.new(@netcdf_elmt.findVariable(name))\n end", "def variable(name)\n var = nc.var(name) # NetCDFVar\n get(var)\n end", "def to_nvar(name)\n self.class.to_nvar(name)\n end", "def ivg(o,vn)\n o.instance_variable_get(vn.to_s)\nend", "d...
[ "0.5574428", "0.555881", "0.54744893", "0.53321457", "0.52964014", "0.528263", "0.5251821", "0.5219873", "0.519401", "0.5190307", "0.5189282", "0.5126412", "0.5079791", "0.50745654", "0.50486016", "0.50392187", "0.5038823", "0.5004229", "0.49497256", "0.4946956", "0.4941458",...
0.73486245
0
Read the next event's kinematic variables (returns their values via Hash)
def read num_kv = @kinvars.length unpck = String.new num_kv.times{unpck += 'd'} vals = @file.read(num_kv*8).unpack(unpck) vals_hash = Hash.new num_kv.times{|kv| vals_hash[@kinvars[kv].name] = vals[kv]} vals_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vars\n @vars ||= soln.keys\n @vars\n end", "def data\r\n @obj.read_var(@name)\r\n end", "def values\n @values ||= keys.map do |key|\n request_context.params[\"ks_prev_#{key}\".to_sym]\n end\n end", "def read_player_info_block\n keys, ret = [],...
[ "0.5379749", "0.52060366", "0.5157811", "0.515696", "0.5100735", "0.5043836", "0.50337374", "0.5033514", "0.5022739", "0.4956222", "0.4904913", "0.48614565", "0.48614565", "0.48283133", "0.4802302", "0.4792526", "0.47711322", "0.47711322", "0.4757023", "0.47393623", "0.472951...
0.5852097
0
5 points Extend your previous program to act like a smart grandfather clock. Given both the hour of the day and a sound, your program will display the sound that many times. For example: $ ruby exercise6.rb 4 GONGGG! GONGGG! GONGGG! GONGGG! GONGGG!
def grandfather_clock(hour, sound, &block) hour.times do block.call(sound) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def speak(number_of_times)\n\t\tindex = 0\n\t\tuntil number_of_times == index \n\t\t\tputs \"Ho, ho, ho!, Haaaappy holidays!\"\n\t\t\tindex +=1\n\t\tend \n\tend", "def speak(repetitions)\n repetitions.times {puts \"Woof!\"}\n end", "def mayday\n\tprint \"Les ennemis attaquent \"\n\t\t3.times do\n\t\tsleep(...
[ "0.6780683", "0.6447429", "0.63293344", "0.6293141", "0.62922144", "0.62651974", "0.62627226", "0.6220753", "0.6175988", "0.61480397", "0.6140392", "0.613198", "0.6079507", "0.60727185", "0.6062683", "0.60451233", "0.6015646", "0.60102326", "0.5997692", "0.5988598", "0.598111...
0.7293099
0
Why's aorta method to edit an object in YAML, awesome! Source:
def aorta( obj ) tempfile = File.join('/tmp',"yobj_#{ Time.now.to_i }") File.open( tempfile, 'w' ) { |f| f << obj.to_yaml } system( "#{ ENV['EDITOR'] || 'vi' } #{ tempfile }" ) return obj unless File.exists?( tempfile ) content = YAML::load( File.open( tempfile ) ) File.delete( tempfile ) content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def y(obj)\n puts obj.to_yaml\nend", "def y(obj)\n puts obj.to_yaml\nend", "def edit_yaml(yaml_location, &block)\n d = YAML.load_file(yaml_location)\n block.call(d)\n File.open(yaml_location, 'w') {|f| f.write d.to_yaml }\n end", "def yaml(object) \n title = split(object)\n category...
[ "0.65748596", "0.65748596", "0.64384025", "0.64170545", "0.63207906", "0.6252102", "0.6248266", "0.6248266", "0.6248266", "0.6248266", "0.6248266", "0.6248266", "0.6248266", "0.6228083", "0.60380065", "0.60380065", "0.5968703", "0.5968123", "0.5836689", "0.5795446", "0.579061...
0.7580655
0
GET /definitions/new GET /definitions/new.json
def new @definition = Definition.new respond_to do |format| format.html # new.html.erb format.json { render json: @definition } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @import_def = ImportDef.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @import_def }\n end\n end", "def new\n\n @definition = Definition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml =...
[ "0.6930692", "0.68009335", "0.6758711", "0.67394155", "0.65274596", "0.6403782", "0.6383718", "0.6373029", "0.6325937", "0.63258094", "0.6313153", "0.6310018", "0.63092446", "0.6306276", "0.62651294", "0.6259509", "0.62584955", "0.62469876", "0.6246857", "0.62422776", "0.6231...
0.7344656
1
Build the url to be called using this class' +base_url+ and a +word+. Returns an url to where +word+'s synonyms can be obtained.
def build_call_url(word) URI.parse(URI.escape(base_url + word)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_lesson_word_synonym\n begin\n @course = Course.find(params[:course_id])\n @lesson = Lesson.find(params[:lesson_id])\n @lesson_word_synonym = LessonWordSynonym.find_by!(synonym_id: params[:synonym_id], lesson_word_id: params[:lesson_word_id])\n end\n end", "def base_url\n 'htt...
[ "0.5757154", "0.57283103", "0.55813503", "0.55706763", "0.545224", "0.54491234", "0.54320055", "0.53744864", "0.5324914", "0.5320462", "0.5312278", "0.52938926", "0.52938926", "0.52938926", "0.5291178", "0.52752894", "0.5244829", "0.5220654", "0.5218501", "0.5127033", "0.5120...
0.6646363
0
Obtain synonyms of a +word+ from Educalingo.
def synonyms(word, options = {}) response = call(word) doc = Nokogiri.HTML(response) synonyms = Array.new doc.css('#wordcloud1 > span').each do |synonym| score = Integer(synonym.values[0]) synonyms.push({ word: synonym.inner_html, score: score }) unless score < 75 # A m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def synonyms\n @synonyms ||= {\n /^awesome$/i => %w[great excellent cool awesome splendid],\n /^okay$/i => %w[okay great alright],\n /^hello$/i => %w[hello hi greetings],\n /^yes$/i => %w[yes affirmative definitely correct certainly],\n /^no$/i => %w[...
[ "0.6837809", "0.683243", "0.65248585", "0.65157163", "0.6513385", "0.6448367", "0.64279884", "0.64008737", "0.6371983", "0.6346837", "0.63074297", "0.62453896", "0.6231569", "0.6192896", "0.6081743", "0.6066702", "0.6061148", "0.60483044", "0.60175085", "0.59807175", "0.59734...
0.7307483
0
GET /byoins/1 GET /byoins/1.json
def show @byoin = Byoin.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @byoin } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @innings = Inning.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @innings }\n end\n end", "def show\n @osoba = Osoba.find(params[:id])\n\n render json: @osoba\n end", "def index\n @dinos = Dino.where(query_params)\n render...
[ "0.6513531", "0.6388622", "0.6372817", "0.63000786", "0.6272199", "0.6264514", "0.62585986", "0.6224663", "0.6191145", "0.6146437", "0.613376", "0.61313856", "0.6099681", "0.6079414", "0.60769194", "0.60614854", "0.60572386", "0.6053703", "0.6046992", "0.60383904", "0.6037119...
0.66625655
0
GET /byoins/new GET /byoins/new.json
def new @byoin = Byoin.new respond_to do |format| format.html # new.html.erb format.json { render json: @byoin } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @inning = Inning.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inning }\n end\n end", "def new\n @ongoing = Ongoing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ongoing }\n en...
[ "0.74631023", "0.72607964", "0.7131678", "0.7076896", "0.7056005", "0.70374966", "0.7020581", "0.69768405", "0.696636", "0.69607735", "0.6946114", "0.69424623", "0.6937767", "0.6930798", "0.6920706", "0.6919153", "0.69183034", "0.6918192", "0.69159484", "0.68863875", "0.68857...
0.7550706
0
POST /byoins POST /byoins.json
def create @byoin = Byoin.new(params[:byoin]) respond_to do |format| if @byoin.save format.html { redirect_to @byoin, notice: 'Byoin was successfully created.' } format.json { render json: @byoin, status: :created, location: @byoin } else format.html { render action: "new" }...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @yaopin = Yaopin.new(params[:yaopin])\n\n respond_to do |format|\n if @yaopin.save\n format.html { redirect_to @yaopin, notice: 'Yaopin was successfully created.' }\n format.json { render json: @yaopin, status: :created, location: @yaopin }\n else\n format.html { r...
[ "0.57724303", "0.5531953", "0.543413", "0.5430458", "0.5376896", "0.53581923", "0.5354088", "0.53494644", "0.53471196", "0.5323087", "0.5304842", "0.52863526", "0.5217852", "0.51786345", "0.51729107", "0.5149248", "0.51343036", "0.5129744", "0.51244557", "0.51180446", "0.5102...
0.56098133
1
DELETE /byoins/1 DELETE /byoins/1.json
def destroy @byoin = Byoin.find(params[:id]) @byoin.destroy respond_to do |format| format.html { redirect_to byoins_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circl...
[ "0.71535367", "0.6996581", "0.69334257", "0.6872575", "0.6849983", "0.6773241", "0.67722857", "0.6752195", "0.6746345", "0.6733793", "0.6733225", "0.673185", "0.673185", "0.673185", "0.673185", "0.67070353", "0.67050636", "0.66941684", "0.66412836", "0.66408604", "0.66259706"...
0.69972354
1
Search params : byoinNm
def search #conditions = Byoin.where("\"byoinCd\" NOT ?", nil) conditions = Byoin.where("1 = ?", 1) conditions = conditions.where("\"byoinNm\" LIKE ?", params[:byoinNm] + "%") if params[:byoinNm] != "" logger.debug(conditions) records = conditions.count limit = params[:rows].to_i page = pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(arg, by: nil)\n\t\t\tr={type: \"search\", arg: arg}\n\t\t\tr[:by]=by if by\n\t\t\t# if :by is not specified, aur defaults to name-desc\n\t\t\tself.query(r)\n\t\tend", "def search(criteria = {})\r\n \r\n end", "def search_params\n params.require(:search).permit(:result_no, :generate_no, ...
[ "0.71156377", "0.7031753", "0.69069177", "0.6891742", "0.67376006", "0.67093253", "0.66832936", "0.6678318", "0.66602284", "0.6644997", "0.6616747", "0.6605426", "0.65893465", "0.6588739", "0.65704", "0.6560714", "0.65601283", "0.65523684", "0.6551555", "0.6551555", "0.655155...
0.7040071
1
GET /connpasses GET /connpasses.json
def index @connpasses = Connpass.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def passes\n command = RequestPasses.call(@current_user, serialNumbers)\n if command.success?\n @passes = command.result\n render 'passes.json.jbuilder', status: :ok\n else\n render json: {error: command.errors}, status: :bad_request\n end\n end", "...
[ "0.66384435", "0.63989335", "0.633204", "0.6001866", "0.56572056", "0.5623348", "0.562248", "0.55092794", "0.5311898", "0.5266798", "0.5261784", "0.5215726", "0.5214483", "0.5211567", "0.5207906", "0.5153614", "0.51375157", "0.5136857", "0.5130621", "0.51173353", "0.5087707",...
0.70516884
0
POST /connpasses POST /connpasses.json
def create @connpass = Connpass.new(connpass_params) respond_to do |format| if @connpass.save format.html { redirect_to @connpass, notice: 'Connpass was successfully created.' } format.json { render :show, status: :created, location: @connpass } else format.html { render :ne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def passes\n command = RequestPasses.call(@current_user, serialNumbers)\n if command.success?\n @passes = command.result\n render 'passes.json.jbuilder', status: :ok\n else\n render json: {error: command.errors}, status: :bad_request\n end\n end", "...
[ "0.6327074", "0.6069031", "0.58198714", "0.5750625", "0.56613624", "0.5652071", "0.54286885", "0.53455895", "0.5343968", "0.5333515", "0.53334546", "0.518195", "0.51461405", "0.51389295", "0.5119878", "0.5071819", "0.50663686", "0.506427", "0.49650648", "0.49422172", "0.49315...
0.61146283
1
DELETE /connpasses/1 DELETE /connpasses/1.json
def destroy @connpass.destroy respond_to do |format| format.html { redirect_to connpasses_url, notice: 'Connpass was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @pass = Pass.find(params[:id])\n @pass.destroy\n\n respond_to do |format|\n format.html { redirect_to passes_url }\n format.json { head :no_content }\n end\n end", "def d...
[ "0.6568274", "0.6541548", "0.6541548", "0.64127207", "0.6385443", "0.6331785", "0.63183075", "0.6239806", "0.6233033", "0.6220353", "0.62014693", "0.61795956", "0.61683464", "0.61445504", "0.609677", "0.6096424", "0.60917306", "0.60782784", "0.6069781", "0.60662496", "0.60655...
0.70593244
0
Description: This method process get lastest roadmap
def get_lastest_roadmaps(user_id) UserCategory.where(user_id: user_id).order_by(created_at: -1).limit(ITEM_PER_PAGE) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_new_road\n return nil if finding_new_road?\n return nil if Params::NEW_ROOT_FIND_PERCENTAGE < rand(Params::PERCENT_DENOMINATOR)\n\n found_mini_map_ids = mini_map_roads.collect{|r| r.end_mini_map_id}\n found_mini_map_ids << id\n not_found_mini_map_ids = MiniMap.all.collect{|m| m.id} - found_...
[ "0.6195852", "0.58092445", "0.5718303", "0.5710238", "0.5674145", "0.56470186", "0.5635778", "0.55787253", "0.54382527", "0.54308456", "0.5414753", "0.54028016", "0.54028016", "0.53753495", "0.53672177", "0.5356196", "0.530149", "0.5286058", "0.525225", "0.5235575", "0.519769...
0.6390302
0
::: bp_class ::: 31/05/2012 ................................................................................................... Format and clean class strings
def bp_class class_param class_param.blank? ? '' : class_param.strip().html_safe end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitize_class_name(name)\n name.gsub(/[^_0-9A-Za-z:]/, '')\n end", "def safe_class_name()\n self.class.name.downcase.gsub(/[^\\d\\w]/, '_')\n end", "def formatClass(theLines)\n\n\treplaceVoids(\t\ttheLines);\n\tspaceMethods(\t\ttheLines);\n\tindentMembers(\t\ttheLines);\n\t...
[ "0.65835106", "0.635127", "0.62413734", "0.62387645", "0.6185513", "0.613174", "0.6123613", "0.60226506", "0.6001884", "0.59962213", "0.5991192", "0.5987389", "0.5956613", "0.59025335", "0.59025335", "0.58830607", "0.5874535", "0.5852366", "0.5786725", "0.5786725", "0.5760469...
0.6800241
0
::: bp_html_print ::: 31/05/2012 ................................................................................................... Format and print final HTML code Supports: crude html code Returns: Safe html without spaces
def bp_html_print html if html.blank? out = 'The helper <b>bp_html_print</b> received <b>empty</b> or <b>null</b>.' else out = html.gsub(/ /, ' ') out = out.gsub('id=""', '') out = out.gsub('class=""', '') out = out.gsub('style=""', '') end out.try(:html_safe) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lstrip_html\n return if self.blank?\n\n m = self.match(/\\A(\\s*?[^<]|(.*?)>\\s*[^<])/) #Find first printing character\n return self unless m\n \n ldr = m[0]\n ldr_last = ldr.slice(ldr.size-1, ldr.size)\n ldr = ldr.slice(0,ldr.size-1) # portion up to the first printing character\n bdy =...
[ "0.67625797", "0.6468834", "0.64069545", "0.6398988", "0.6371578", "0.63500065", "0.6339608", "0.6325233", "0.6299458", "0.62365186", "0.62347203", "0.6229011", "0.6223172", "0.62172127", "0.6183147", "0.6183147", "0.6183147", "0.6183147", "0.61737597", "0.6169585", "0.615587...
0.82362944
0
::: bp_group :: (ANTES group_inputs_form) ................................................................................................... Agrupar elementos Admite: Label, ID y Class
def bp_group options, &block label = options[:label].blank? ? "" : options[:label] id = options[:id].blank? ? "" : options[:id] style = options[:style].blank? ? "" : options[:style] out = content_tag :li, :class => bp_class("group #{options[:class]}"), :id => "#{id}", :style => style do content_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input_text_group(name, values = [])\n field = field_content(name)\n field_name = prop(field, 'name') || name\n group = {}\n unless field.nil?\n group[:legend] = prop(field, 'label')\n group[:description] = prop(field, 'description')\n group[:description_id] = \"label-description-#{na...
[ "0.69598037", "0.681094", "0.6604592", "0.6582853", "0.6241212", "0.6157816", "0.6093225", "0.6055335", "0.6012496", "0.5998035", "0.5973409", "0.59482056", "0.5943536", "0.59414554", "0.59224075", "0.59200114", "0.59200114", "0.5899451", "0.5890195", "0.5889951", "0.58669263...
0.682712
1
::: bp_inline :: (ANTES inline_inputs_form) ................................................................................................... Campos en linea Admite: Label, ID y Class
def bp_inline options, &block label = options[:label].blank? ? "" : options[:label] not_label = label.blank? ? "not-label" : "" id = options[:id].blank? ? "" : "id='#{options[:id]}'" cols = options[:cols].blank? ? "" : "cols-#{options[:cols]}" msgerr = cols.blank? ? "No se ha definido el numero de...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inline(label = nil, &block)\n template.content_tag(:div) do\n template.concat template.content_tag(:label, label) if label.present?\n template.concat template.content_tag(:div, :class => 'input') {\n template.content_tag(:div, :class => 'inline-inputs') do\n template.fields_for(\n ...
[ "0.7214832", "0.606171", "0.6002291", "0.59069973", "0.5879961", "0.58013624", "0.5620312", "0.55915844", "0.55696326", "0.55614364", "0.55156434", "0.55125856", "0.55068195", "0.54988736", "0.5491041", "0.5444681", "0.54299146", "0.5392373", "0.53789926", "0.53639644", "0.53...
0.6378602
1
::: action_button ::: ................................................................................................... Boton de estilo Accion (accion positiva) Muestra un enlace A con estilo Accion Admite: Label, URL y clases adicionales
def action_button_form options label = options[:label] ? options[:label] : "Boton" url = options[:url] ? options[:url] : "#" myclass = options[:class] ? "btn-action #{options[:class]}" : "btn-action" "<li><div class='#{myclass}'>#{link_to(label, url)}</div></li>".html_safe end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_click\n\t\tend", "def edit(action = 'Objective Action')\n click_on(SELECTOR_MAPPING[action]['Edit']['button'][$janus::ELEMENT])\n end", "def add_actions; end", "def aide2()\n indice = IndiceMoyen.create(@map)\n res = indice.envoyerIndice.indice.split(\"-\")\n\n x=res[0].to_i\n y=re...
[ "0.5849234", "0.5811676", "0.572514", "0.56416357", "0.5608865", "0.55964136", "0.55945385", "0.5587969", "0.5579181", "0.55044335", "0.546723", "0.5453149", "0.54288894", "0.5420646", "0.5381472", "0.53785914", "0.53780025", "0.53739834", "0.53295493", "0.5313517", "0.531268...
0.58680916
0
::: custom_item ::: ................................................................................................... Elemento personalizado: texto, link,... Admite: ID, label, hint, HTML Ejemplo: custom_item_form :label => 'Visita mi web', :html => link_to('miweb.es','
def custom_item_form options group_html = "<li id='#{options[:id]}' class='p'>" group_html += options[:label] ? "<label for='#{options[:id]}'>#{options[:label]}</label>" : "" group_html += "<div class='wrap-custom-html'>#{options[:html]}</div>" group_html += options[:hint] ? "<p class='inline-hints'>#{o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mostrar_item(menu)\n\n\t\t# Si el item tiene url, controlador o accion, arma link, sino solo label\n\t\tif (menu.controller != '') or (menu.action != '') or (menu.url != '')\n\t\t\tif menu.url != ''\n\t\t\t\tlink_to menu.nombre, menu.url\n\t\t\telse\n\t\t\t\tlink_to menu.nombre, :controller => menu.controller,...
[ "0.62943274", "0.6286281", "0.61402404", "0.6097704", "0.60930884", "0.60856867", "0.6066599", "0.59867543", "0.5954744", "0.59289163", "0.5901942", "0.58983815", "0.58983815", "0.5868188", "0.5823106", "0.58228856", "0.5783654", "0.57812494", "0.5779564", "0.57718223", "0.57...
0.69687176
0
::: bp_directory_index ::: Muestra un arbol de carpetas y vistas en funcion del path del request
def bp_directory_index tree_hash = BP.same_level_views("/base_project#{request.env['PATH_INFO']}") p tree_hash out = "<ul>" tree_hash.keys.each do |tree_hash_key| thk = tree_hash_key.gsub(".html.erb", "") thk = thk.gsub("/mocks", "") out += content_tag :li, thk.gsub("/", "") out += "<ul>" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def directory_index\n end", "def path(*) end", "def bp_mock_directory_index\n\n tree_hash = BP.same_level_views(\"/mocks\")\n\n out = \"<ul>\"\n\n tree_hash.keys.each do |tree_hash_key|\n thk = tree_hash_key.gsub(\".html.erb\", \"\")\n thk = thk.gsub(\"/mocks\", \"\")\n\n out += content_tag :li,...
[ "0.75283045", "0.6429611", "0.62999487", "0.6243415", "0.61129963", "0.6066627", "0.60164326", "0.5972681", "0.5972681", "0.5972681", "0.5968441", "0.5968441", "0.5949979", "0.5949979", "0.5946509", "0.5946509", "0.5946509", "0.59423995", "0.59423995", "0.59423995", "0.594239...
0.67258483
1
::: bp_mock_directory_index ::: Muestra un arbol de carpetas y vistas dentro de la carpeta mocks
def bp_mock_directory_index tree_hash = BP.same_level_views("/mocks") out = "<ul>" tree_hash.keys.each do |tree_hash_key| thk = tree_hash_key.gsub(".html.erb", "") thk = thk.gsub("/mocks", "") out += content_tag :li, thk.gsub("/", "") out += "<ul>" tree_hash[tree_hash_key].each do |tree_h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def directory_index\n end", "def test_directory_with_index\n assert_pattern_match [ \"/directory\", \"index.vwf\", nil, nil ], \"/directory/\"\n end", "def bp_directory_index\n tree_hash = BP.same_level_views(\"/base_project#{request.env['PATH_INFO']}\")\n\n p tree_hash\n\n out = \"<ul>\"\n\n tree_h...
[ "0.6691094", "0.66083425", "0.6074296", "0.60325736", "0.59579116", "0.5950772", "0.58903176", "0.58669245", "0.586233", "0.5782827", "0.5778735", "0.5760948", "0.5714595", "0.56046224", "0.56026816", "0.5549639", "0.55079776", "0.5466253", "0.54230106", "0.5415844", "0.54143...
0.6713913
0
::: bp_meta_tags ::: 31/05/2012 ................................................................................................... Add baseproject meta tags
def bp_meta_tags "<meta name='base-project-version' content='#{bp_version}'>".html_safe end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_meta_tags_title\n set_meta_tags site: 'benradler.com'\n end", "def set_meta_tags(meta_tags)\n self.meta_tags.update(meta_tags)\n end", "def add_tags\n raise NotImplementedError\n end", "def render_custom(tags)\n meta_tags.meta_tags.each do |name, data|\n Array(data).ea...
[ "0.66166747", "0.64490247", "0.6427762", "0.63269556", "0.63182783", "0.63060045", "0.62989634", "0.61403334", "0.61169416", "0.6104548", "0.6090257", "0.6070195", "0.6065026", "0.60502315", "0.6030636", "0.60273206", "0.60210395", "0.60089767", "0.5995537", "0.59758747", "0....
0.66026044
1
filter by post type. TODO
def by_type filter(:type) do |post, type| post.post_type.casecmp(type).zero? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_post_types(args = {}, output = 'names', operator = 'and')\n field = ( 'names' == output ) ? 'name' : false\n\n wp_filter_object_list(Railspress.GLOBAL.wp_post_types, args, operator, field)\n end", "def index\n \n @post_type = params[:type] \n the_posts = Post.all\n if !@post_type.bl...
[ "0.6780538", "0.6536971", "0.64968675", "0.6395417", "0.6232085", "0.6226156", "0.62162143", "0.6113875", "0.6113875", "0.60949653", "0.6090159", "0.60430235", "0.5985461", "0.597882", "0.5977049", "0.59760654", "0.59688866", "0.59646165", "0.59646165", "0.5956579", "0.594894...
0.8877474
0
POST /schmos POST /schmos.json
def create @schmo = Schmo.new(schmo_params) respond_to do |format| if @schmo.save format.html { redirect_to @schmo, notice: 'Schmo was successfully created.' } format.json { render :show, status: :created, location: @schmo } else format.html { render :new } format.js...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n megam_rest.post_promos(to_hash) #WONT BE USED AS OF NOW\n end", "def create\n @swm = Swm.new(swm_params)\n\n respond_to do |format|\n if @swm.save\n format.html { redirect_to @swm, notice: 'Swm was successfully created.' }\n format.json { render :show, status: :creat...
[ "0.58984995", "0.550309", "0.5471433", "0.5392018", "0.5322792", "0.53135544", "0.53125525", "0.5302609", "0.5298284", "0.5283186", "0.52796805", "0.52739847", "0.5272804", "0.5253575", "0.5250156", "0.5247957", "0.5247251", "0.5244934", "0.52402085", "0.52375656", "0.5232637...
0.6403342
0
PATCH/PUT /schmos/1 PATCH/PUT /schmos/1.json
def update respond_to do |format| if @schmo.update(schmo_params) format.html { redirect_to @schmo, notice: 'Schmo was successfully updated.' } format.json { render :show, status: :ok, location: @schmo } else format.html { render :edit } format.json { render json: @schmo.e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n @squishee_cup = SquisheeCup.find(params[:id])\n puts p...
[ "0.60670775", "0.60602576", "0.60271037", "0.59614265", "0.594393", "0.59209156", "0.5903024", "0.5900323", "0.58891106", "0.5885256", "0.588278", "0.58802676", "0.586252", "0.5852165", "0.58440155", "0.5823932", "0.582176", "0.58198524", "0.58171576", "0.58167857", "0.581063...
0.62560153
0
DELETE /schmos/1 DELETE /schmos/1.json
def destroy @schmo.destroy respond_to do |format| format.html { redirect_to schmos_url, notice: 'Schmo was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @sm = Sm.find(params[:id])\n @sm.destroy\n\n respond_to do |format|\n format.html { redirect_to sms_url }\n format.json { head :no_content }\n end\n end", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n ...
[ "0.6819303", "0.68119663", "0.6769391", "0.6734435", "0.67130286", "0.66772836", "0.66752416", "0.6663666", "0.66578764", "0.6643312", "0.66416097", "0.6622077", "0.6617451", "0.6602217", "0.6601949", "0.659684", "0.6590565", "0.65671605", "0.65500444", "0.6539571", "0.653761...
0.71664554
0
write chain index to file. The file is a binary file, and payload of +block_list+ and +newest_block+ are stored.
def write_to_file File.open(config.block_list_path, 'a') do |f| block_count = old_newest_block ? (block_list.size - old_newest_block.height - 1) : block_list.size block_list = self.block_list.sort{|(k1, v1), (k2, v2)| v1.height <=> v2.height} block_list = block_list[(old_newest_blo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_block(type,index,payload)\n return Logfiles.write_block(wio,type,index,payload)\n end", "def save\n File.open(@index_file, 'wb') do |f|\n f.puts Marshal::dump([@terms, @index])\n end\n end", "def save\n File.open(@index_file, 'wb') do |f|\n Marshal.dump([@terms, ...
[ "0.6083968", "0.58898723", "0.5857545", "0.58295625", "0.5742699", "0.5708285", "0.5688307", "0.56623816", "0.5633655", "0.5600889", "0.55661744", "0.5563343", "0.5554566", "0.54835206", "0.54814553", "0.5410083", "0.5393533", "0.530612", "0.52935255", "0.5284443", "0.5175669...
0.7374174
0
GET /spells, GET /
def spells get_schools get_classes respond_to do |format| format.json { get_all_spells render json: @spells.sort_by {|k, v| v['name']}.to_json } format.html {} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @spells = Spell.all\n end", "def index\n\t\t@player_spells = PlayerSpell.all\n\tend", "def spell\n fetch('harry_potter.spells')\n end", "def index\n @class_spells = ClassSpell.all\n end", "def index\n @prepared_spells = PreparedSpell.all\n end", "def show\n resp...
[ "0.7501938", "0.71436214", "0.70778805", "0.6834009", "0.6431804", "0.6240029", "0.5946355", "0.5910445", "0.5861392", "0.5855386", "0.56545186", "0.5642606", "0.5577761", "0.55225134", "0.5487532", "0.546907", "0.54669714", "0.5465389", "0.54424864", "0.54284704", "0.5420462...
0.76316035
0
update /etc/instancecontroller/logs.json for uploading presto logs to s3
def s3LogJsonUpdate(presto_log_dir) println "presto log dir : #{presto_log_dir}" logs_json_path = "/etc/instance-controller/logs.json" println "Updating #{logs_json_path}" json_obj=JSON.parse(File.read("#{logs_json_path}")); sections = json_obj["logFileTypes"] sections.each { |section| if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def s3LogJsonUpdate(kafka_log_dir)\n println \"kafka log dir : #{kafka_log_dir}\"\n logs_json_path = \"/etc/instance-controller/logs.json\"\n println \"Updating #{logs_json_path}\"\n json_obj=JSON.parse(File.read(\"#{logs_json_path}\"));\n sections = json_obj[\"logFileTypes\"]\n sections.each { |section|\n ...
[ "0.81232107", "0.7113302", "0.66561186", "0.64058024", "0.63489264", "0.6261095", "0.61307114", "0.6074673", "0.59518933", "0.5686657", "0.56133616", "0.556654", "0.55525357", "0.5549918", "0.5539249", "0.55168897", "0.5476781", "0.5461878", "0.5405351", "0.54021746", "0.5399...
0.8267899
0
write /etc/init.d/prestolauncher & /etc/servicenanny/presto.conf for servicenanny to monitor
def writePrestoFilesForServiceNanny println "Making /etc/init.d/presto-launcher" File.open('/tmp/presto-launcher', 'w') do |f| f.write(<<EOF /home/hadoop/presto-server/bin/launcher $@ EOF ) end sudo "mv /tmp/presto-launcher /etc/init.d/presto-launcher && chmod a+x /etc/init.d/presto-launcher" println...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_server(type, date)\n Shell.execute \"start #{upstart_script_filename(type, date).gsub(/^#{script_directory}\\//, '').gsub(/\\.conf$/, '')}\"\n end", "def configureStartup\n `chkconfig --add nagios`\n `chkconfig --level 35 nagios on`\n `chkconfig --add httpd`\n `chkconfig --l...
[ "0.5744976", "0.5652129", "0.5627625", "0.55946445", "0.555321", "0.5506026", "0.5491714", "0.5488017", "0.5487081", "0.54798007", "0.547484", "0.54664207", "0.54534304", "0.54130334", "0.5410498", "0.5402819", "0.5366143", "0.5358174", "0.53487986", "0.53475213", "0.5308171"...
0.7807695
0
Turns query results into a hash keyed by event name, values are a set of unique user IDs for that event
def data @data ||= begin event_users = Hash.new do |h, uuid| h[uuid] = Set.new end # IDEA: maybe there's a block form if this we can do that yields results as it loads them # to go slightly faster fetch_results.each do |row| event_users[row['name']] << ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data\n @data ||= begin\n event_users = Hash.new do |h, event_name|\n h[event_name] = Set.new\n end\n\n # IDEA: maybe there's a block form if this we can do that yields results as it loads them\n # to go slightly faster\n fetch_results.each do |row|\n ev...
[ "0.7278814", "0.6213512", "0.6115961", "0.6013456", "0.5996851", "0.59955543", "0.59932077", "0.5943491", "0.59336543", "0.5907099", "0.58147174", "0.5800028", "0.57987255", "0.57955736", "0.57641184", "0.57549167", "0.5732454", "0.5695671", "0.5689444", "0.5679773", "0.56595...
0.72536796
1
Returns the user ID, if authentication was successful.
def user_id return nil unless success? @user_id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth_user_id\n session[:current_user_id] unless session[:current_user_id].nil?\n end", "def auth_user_id\n auth[:user_id]\n end", "def get_authenticated_user # rubocop:disable Style/AccessorMethodName\n @user_id = YourMembership::Member.isAuthenticated(self)\n end", "def user_id\n ...
[ "0.74364185", "0.7347219", "0.7345716", "0.7201236", "0.68811125", "0.68785864", "0.6862121", "0.67895925", "0.67840147", "0.6758222", "0.67141813", "0.6712152", "0.6667868", "0.66666687", "0.6646331", "0.6638658", "0.6637823", "0.66047096", "0.6556569", "0.6555979", "0.65470...
0.7841099
0
Returns the meta data, if authentication was successful.
def meta_data return nil unless success? @meta_data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metadata\n @meta_data\n end", "def meta_data\n @meta_data ||= params['metaData']\n end", "def user_info\n auth_hash['user_info']\n end", "def metadata\n return @metadata if defined? @metadata\n\n @metadata = Henkei.read :metadata, data\n end", "def metadata\n r...
[ "0.65194994", "0.6234556", "0.61730164", "0.61438113", "0.61438113", "0.6120869", "0.6114129", "0.6085272", "0.6083562", "0.59939694", "0.5990944", "0.5949814", "0.5948992", "0.5938612", "0.5899271", "0.58932984", "0.5873987", "0.585858", "0.58571815", "0.5852336", "0.5828417...
0.7379037
0
Calculates a notched path that flows between the outer edge of the box (outside_line) and inner (inside_line). Relative location of these lines also defines the direction and orientation of the box, and hence the notches. We always want to create a symmetric path that has a notch in the middle (for center_out = true) o...
def path(edge) shifts = define_shifts(edge) path = NotchedPath.new if fill_corners r1 = Geometry::Rect.new(edge.inside.p1, edge.outside.p1) r2 = Geometry::Rect.new(edge.inside.p2, edge.outside.p2) path.corner_boxes << r1 path.corner_boxes <...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_path\n nodes = []\n angle = 2 * Math::PI / @sides\n theta = angle / 2 + Math::PI / 2\n @sides.times do |n|\n nodes[n] = []\n nodes[n][0] = @radius * Math.cos(angle * n + theta) + @x\n nodes[n][1] = @radius * Math.sin(angle * n + theta) + @y\n end...
[ "0.511261", "0.4895138", "0.47951463", "0.47733837", "0.47640806", "0.47473344", "0.4678335", "0.46684912", "0.46418127", "0.4598969", "0.45607543", "0.45571336", "0.45404562", "0.44949138", "0.4469788", "0.44570097", "0.44404832", "0.44040582", "0.44034803", "0.43955457", "0...
0.5554023
0
Returns the Dot label for the object.
def dot_label x @dot_label[x] ||= _dot_label x end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dot_label x, opts = EMPTY_HASH\n @dot_label[[x, opts]] ||=\n case x\n when Cabar::Component\n # * name and version\n # * directory\n # * facets (optional)\n str = ''\n\n if show_component_name\n str << \"#{x.name}\"\n ...
[ "0.6645834", "0.6621758", "0.6618855", "0.65489244", "0.64943224", "0.64486957", "0.64289665", "0.63742244", "0.6331173", "0.62375253", "0.6218592", "0.6146182", "0.6093772", "0.6090563", "0.6084557", "0.60368735", "0.6014525", "0.601225", "0.6010103", "0.5991288", "0.5949476...
0.7634909
0
Renders the StateMachine as Dot syntax.
def render_StateMachine sm, dot_opts = nil return if @rendered[sm] @rendered[sm] = true dot_opts ||= { } hide_decomposition = dot_opts.delete(:hide_decomposition) stream.puts "\n// {#{sm.inspect}" name = dot_opts.delete(:_node_name) || dot_name(sm) type = "subgraph #{name}" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dot(options = {})\r\n Dot::Digraph.new(:fontsize => 10, :shape => :box, :size => 5) do |g|\r\n states.each do |state|\r\n g.node(state, :label => state.items.values.collect{|item| item.to_s(options)}.join(\"\\n\"))\r\n @transitions[state].each do |symbol, dest_state|\r\n ...
[ "0.67595047", "0.65789276", "0.64541173", "0.6320492", "0.6315098", "0.62033975", "0.6202185", "0.6199375", "0.6190483", "0.61005193", "0.60155636", "0.5951069", "0.5931403", "0.588383", "0.588383", "0.588383", "0.58591586", "0.5856718", "0.57959205", "0.5767704", "0.5762307"...
0.69742304
0
Renders the State object as Dot syntax.
def render_State s return if @rendered[s] @rendered[s] = true stream.puts "\n// #{s.inspect}" sequence = [ ] if options[:history] options[:history].each_with_index do | hist, i | if hist[:new_state] && s.is_a_superstate_of?(hist[:new_state]) seq...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dot(options = {})\r\n Dot::Digraph.new(:fontsize => 10, :shape => :box, :size => 5) do |g|\r\n states.each do |state|\r\n g.node(state, :label => state.items.values.collect{|item| item.to_s(options)}.join(\"\\n\"))\r\n @transitions[state].each do |symbol, dest_state|\r\n ...
[ "0.6585954", "0.6584424", "0.625206", "0.6133405", "0.6100282", "0.60859656", "0.60828495", "0.6012448", "0.5981349", "0.59612155", "0.59532315", "0.5949806", "0.5942158", "0.5941734", "0.5939078", "0.59364545", "0.592749", "0.592196", "0.5915447", "0.59081256", "0.5907804", ...
0.6983836
0
Returns SVG data of the graph, using a temporary file.
def render_graph_svg_data machine, opts = { } require 'tempfile' tmp = Tempfile.new("red_steak_dot") self.file_dot = tmp.path + ".dot" self.file_svg = nil render_graph(machine, opts) result = File.open(self.file_svg, "r") { | fh | fh.read } if opts[:xml_header] == false || opti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def svg\n # Only recompile the SVG if it doesn't already exist\n unless File.exist? self.svg_name\n File.open(\"#{@name}.tex\", 'w') { |f| f.write document }\n # TODO Catch pdflatex errors\n system \"lib/latex2svg #{@name}\"\n end\n # Unless latex2svg was successful, use a placeholder SV...
[ "0.6770629", "0.64702153", "0.63917065", "0.6349254", "0.59822357", "0.59413344", "0.5889963", "0.5875585", "0.58580434", "0.5775845", "0.5728519", "0.5686561", "0.5671862", "0.56661004", "0.556634", "0.5539929", "0.5539929", "0.5527675", "0.5497888", "0.54803985", "0.5468873...
0.72526675
0
Instructions for selecting the PCR program template
def select_program_template(program:) file = program_template_file(program: program) "Choose the program template <b>#{file}</b>" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def program_template_file(program:)\n template_file(\n template_name: program.program_template_name,\n extension: :PROGRAM_EXT\n )\n end", "def select_layout_template(program:)\n file = layout_template_file(program: program)\n \"Choose the layout template <b>#{file}</b>\"\n end", "def s...
[ "0.5921452", "0.5792563", "0.5792563", "0.5756914", "0.558119", "0.55104923", "0.5504259", "0.55035883", "0.5481071", "0.5431782", "0.54145294", "0.5328151", "0.5320709", "0.5311426", "0.5306174", "0.52413887", "0.5228297", "0.5195293", "0.5186276", "0.51830405", "0.51774436"...
0.70982546
1
Image Methods These probably should NOT be overridden in the concrete classes Image for opening the lid
def open_lid_image image_path(image_name: params[:open_lid_image]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image; end", "def image\n end", "def image\n end", "def image\n end", "def image\n end", "def img(*) # :nodoc:\n raise \"no!\"\n end", "def image\n\n end", "def software_image\n super\n end", "def images; end", "def lnbPicture _obj, _args\n \"_obj lnbPicture _arg...
[ "0.658728", "0.6332638", "0.6332638", "0.63191813", "0.63191813", "0.62466085", "0.6234033", "0.6117571", "0.61137795", "0.59641474", "0.5951442", "0.59288824", "0.5893418", "0.58625954", "0.58527726", "0.58515096", "0.5824615", "0.5768901", "0.5768901", "0.57505876", "0.5736...
0.6672793
0
Image for closing the lid
def close_lid_image image_path(image_name: params[:close_lid_image]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_image\n @p.close_image(self)\n end", "def unload_image(image_handle)\n end", "def log_out\n @image.each do |row|\n Useditor::Log.ok row.join('')\n end\n end", "def close_lid()\n \"Click the <b>Close Lid</b> button\"\n end", "def close_lid\n 'Click the <b>...
[ "0.69690794", "0.6879279", "0.6075848", "0.59752357", "0.59243983", "0.59243983", "0.5857775", "0.5681803", "0.56230766", "0.5590997", "0.55268186", "0.5516993", "0.549218", "0.548369", "0.5475284", "0.5454886", "0.5454886", "0.54181063", "0.5398258", "0.53867817", "0.5373282...
0.7274951
0
Image for starting the run
def start_run_image image_path(image_name: params[:start_run_image]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_run; end", "def S(args)\n puts \"\\n=>\\n\"\n @image.show\n end", "def start_run()\n \"Click the <b>Start Run</b> button\"\n end", "def run_sketch\n ensure_exists(filename)\n spin_up('run.rb', filename, argc)\n end", "def run_sketch\n ensure_exists(filename)\n ...
[ "0.6666087", "0.6606987", "0.64159364", "0.6324118", "0.6324118", "0.6310767", "0.6298047", "0.62764716", "0.62764716", "0.62551796", "0.62311065", "0.62242466", "0.6207501", "0.6207501", "0.6207501", "0.6207501", "0.6207501", "0.6207501", "0.6207501", "0.6207501", "0.6174432...
0.6864887
0
Instructions for selecting the plate layout template in the software
def select_layout_template(program:) file = layout_template_file(program: program) "Choose the layout template <b>#{file}</b>" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rit_plate!(layout_name, instance_name, plate_name)\n Rit::Plate.get(layout_name, instance_name, plate_name, session[:preview_time])\n end", "def select_program_template(program:)\n file = program_template_file(program: program)\n \"Choose the program template <b>#{file}</b>\"\n end", "def se...
[ "0.5981433", "0.59103215", "0.59103215", "0.5826337", "0.57864827", "0.5761337", "0.5741535", "0.5670217", "0.5623198", "0.5589102", "0.55701387", "0.55457544", "0.5529409", "0.5521252", "0.5429765", "0.5416005", "0.539734", "0.5386494", "0.53474295", "0.53448063", "0.5324138...
0.654298
1
Instructions for saving an experiment file
def save_experiment_file(filename:) "Save the experiment as #{filename} in #{params[:experiment_filepath]}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(filename)\n writeln(\"save '#{filename}'\")\n end", "def save fname, options={}\n File.open(fname,\"wb\"){ |f| f << export(options) }\n end", "def cmd_save argv\n setup argv\n e = @hash['elements']\n filepath = @hash['filepath'] || \"config.json\"\n response = @api.save(e, ...
[ "0.6622182", "0.6557741", "0.6496792", "0.6463734", "0.6424857", "0.6406966", "0.6372905", "0.63271034", "0.63140875", "0.62960327", "0.62960327", "0.62960327", "0.62904435", "0.6282151", "0.625785", "0.625785", "0.625785", "0.625785", "0.625785", "0.6221952", "0.621788", "...
0.7985602
1
Image for setting up the software workspace
def setup_workspace_image image_path(image_name: params[:setup_workspace_image]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def software_image\n super\n end", "def setup\n \n\t# The size function is a statement that tells the computer \n\t# how large to make the window.\n\t# Each function statement has zero or more parameters. \n\t# Parameters are data passed into the function\n\t# and used as values for specifying what the ...
[ "0.62298185", "0.59079564", "0.5849817", "0.5832239", "0.5625588", "0.5610854", "0.5549253", "0.5538865", "0.5517123", "0.54581565", "0.54345095", "0.5427078", "0.5419188", "0.5403232", "0.5342143", "0.53417796", "0.531983", "0.5312845", "0.53070337", "0.53043455", "0.5285931...
0.67364115
0
Image for selecting the plate layout template in the software
def setup_plate_layout_image image_path(image_name: params[:setup_plate_layout_image]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rit_plate!(layout_name, instance_name, plate_name)\n Rit::Plate.get(layout_name, instance_name, plate_name, session[:preview_time])\n end", "def display_plate(outname, ops, stamp_columns=false)\n plate = Array.new(8) { Array.new(12, \"-\") }\n if stamp_columns\n ops.each do |...
[ "0.62516433", "0.61311", "0.59882915", "0.57847077", "0.5745068", "0.5744303", "0.5673395", "0.5671538", "0.56513345", "0.56513345", "0.56241345", "0.5583765", "0.5580931", "0.55490214", "0.55105335", "0.545998", "0.5439056", "0.540604", "0.540604", "0.5346053", "0.53329927",...
0.65077204
0
Getter Methods These should NOT be overridden in the concrete classes The name of the software that controls the thermocycler
def software_name self.class.const_get(:SOFTWARE_NAME) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def class_name; end", "def class_name; end", "def system_name\n self.name\n end", "def name; end", "def name; end", "def name; end", "def name; end", "def name; end", "def name; end", "def name; end", "def name; end", "def name; end", "def name; end", "def name; end", "def name; end...
[ "0.64199996", "0.64199996", "0.6346704", "0.62954015", "0.62954015", "0.62954015", "0.62954015", "0.62954015", "0.62954015", "0.62954015", "0.62954015", "0.62954015", "0.62954015", "0.62954015", "0.62954015", "0.62954015", "0.62954015", "0.62954015", "0.62954015", "0.62954015",...
0.65451866
0
Run block with spinner by default if all, or when using verbose. Do not use spinner if silent.
def maybe_spinner(msg, &block) if (all? || verbose?) && !silent? spinner(msg, &block) else yield end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spinner(title, &block)\n return yield unless ui_enabled?\n\n results = concurrently do |actions|\n actions.await(title, &block)\n end\n\n results[title]\n end", "def spinner; end", "def spinner\n spinner = Enumerator.new do |e|\n loop do\n e.yield '|'\n ...
[ "0.6790666", "0.6763934", "0.65852416", "0.64971924", "0.62405556", "0.61833227", "0.6161981", "0.6105399", "0.5904148", "0.5759274", "0.5719988", "0.56380135", "0.5634144", "0.5574754", "0.5569722", "0.5542122", "0.55204594", "0.5489452", "0.54360396", "0.539193", "0.5368920...
0.81976056
0
GET /absences/new GET /absences/new.json
def new @absence = Absence.new @title = "New Absence" respond_to do |format| format.html # new.html.erb format.json { render json: @absence } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @absence = Absence.new\n @member = Member.find(params[:member_id])\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @absence }\n end\n end", "def new\n @attendence = Attendence.new\n\n respond_to do |format|\n format.html # new.h...
[ "0.7155519", "0.71454966", "0.70242625", "0.69607604", "0.6881329", "0.6860444", "0.68438476", "0.68144476", "0.6806807", "0.6793683", "0.6791644", "0.67862946", "0.67815584", "0.67811006", "0.67811006", "0.67811006", "0.67760485", "0.67666113", "0.67657375", "0.6743591", "0....
0.79217684
0
PUT /absences/1 PUT /absences/1.json
def update @absence = Absence.find(params[:id]) respond_to do |format| if @absence.update_attributes(params[:absence]) format.html { redirect_to @absence, notice: 'Absence was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @absence.update(absence_params)\n format.html { redirect_to @absence, notice: 'Absence was successfully updated.' }\n format.json { render :show, status: :ok, location: @absence }\n else\n format.html { render :edit }\n format.json {...
[ "0.673988", "0.63281626", "0.6126415", "0.61207175", "0.6088544", "0.6088544", "0.6030452", "0.59950113", "0.59950113", "0.59950113", "0.59755456", "0.59593606", "0.5880443", "0.5872303", "0.5852316", "0.58421165", "0.58198327", "0.5800365", "0.5791689", "0.5760923", "0.57560...
0.6931707
0
DELETE /absences/1 DELETE /absences/1.json
def destroy @absence = Absence.find(params[:id]) @absence.destroy respond_to do |format| format.html { redirect_to absences_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @absence.destroy\n respond_to do |format|\n format.html { redirect_to absences_url, notice: 'Отсутствие успешно удалено.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @absence.destroy\n respond_to do |format|\n format.html { redirect_to absences_u...
[ "0.71855885", "0.7158314", "0.711689", "0.69589007", "0.69473207", "0.6840893", "0.68064064", "0.6739354", "0.67037237", "0.6648273", "0.66268414", "0.6621664", "0.6621664", "0.6615619", "0.6605322", "0.65750706", "0.6563305", "0.6555502", "0.6535823", "0.65335476", "0.652619...
0.74988055
0
GET /bandas/new GET /bandas/new.xml
def new @banda = Banda.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @banda } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @band = Band.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @band }\n end\n end", "def new\n @bands = Band.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @venue }\n end\n end"...
[ "0.7781639", "0.7585077", "0.70602906", "0.7034137", "0.69205695", "0.6918481", "0.6870744", "0.68522644", "0.6804117", "0.67506343", "0.66630876", "0.6642369", "0.6631867", "0.656169", "0.6539684", "0.6515332", "0.65061045", "0.65051293", "0.6497788", "0.64974594", "0.648973...
0.7614722
1
psuedocode define method that remoces item from list remove item from groceries list output update list
def remove_item(items, groceries_list) groceries_list.delete(items) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_item(groceries_list, item_to_remove)\n\t# remove item from list\n\tgroceries_list.delete(item_to_remove)\n\t# return updated list\n\tgroceries_list\nend", "def remove_item(grocery_list, item)\r\n\tgrocery_list.delete(item)\r\n\tgrocery_list\r\nend", "def remove_item_from_list(grocery_list, item) \n ...
[ "0.7932899", "0.7868345", "0.77573794", "0.77104795", "0.7689352", "0.7668525", "0.76387864", "0.76387864", "0.76131606", "0.7584837", "0.753534", "0.753534", "0.75050735", "0.74758095", "0.74758095", "0.7463809", "0.745401", "0.74512774", "0.7448878", "0.7407783", "0.7407783...
0.802964
0
pseudocode define a method that updates the quantities for items in groceries_list update quantity output updated groceries_list
def update_quantity(item, quantity, groceries_list) groceries_list[item] = quantity end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_quantity(grocery_list, item_to_update, qty)\n grocery_list[item_to_update] = qty\n grocery_list\nend", "def update_qty(grocery_list, item, qty)\n grocery_list[item] = qty\n grocery_list\nend", "def update_quantity(grocery_list, item_name, quantity)\n\tadd_item(grocery_list, item_name, quantity)\...
[ "0.831808", "0.8193134", "0.8124504", "0.8051816", "0.8045623", "0.8045038", "0.80172306", "0.8003595", "0.8003595", "0.80034715", "0.798681", "0.7981079", "0.79737353", "0.7960213", "0.79327357", "0.792873", "0.7888591", "0.78861636", "0.7858827", "0.78580713", "0.78390515",...
0.8507145
0
given a user_id, return a count of unviewed photos
def num_new_photos user_id = params[:user_id] # if request.format != :json # render :status=>406, :json=>{:message=>"The request must be json"} # return # end if user_id.nil? render :status=>400, :json=>{:message=>"The request must contain a user_id."} return end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_unviewed_ids(user); end", "def missed_answers_count(user)\n answers.where('answers.created_at > ?', latest_profile_view(user))\n .where.not(answers: { id: user.viewed_answers.ids }).count\n end", "def get_user_tag_count(owner_user_id)\n count = USER_TAGS.where(owner_user_id: owner_user...
[ "0.69725084", "0.66770416", "0.6536266", "0.62331814", "0.6231103", "0.62043285", "0.61953264", "0.6180939", "0.61220324", "0.60758746", "0.60401505", "0.6034242", "0.5928755", "0.59164304", "0.58941805", "0.58730865", "0.58436304", "0.5835657", "0.5789464", "0.57615155", "0....
0.67354274
1
This function finds refining parameters via ConstraintBlocks/ConstraintElements from the given VerificationElement. It highlights elements that have no expressions for constraints and missing units. Params: +requirement+:: A Requirement element to look for refining parameters.
def findRefinedParameters(element) for relation in element.get_relationshipOfRelatedElement() if StereotypesHelper.hasStereotype(relation, $veRelationshipStereotype) req = ModelHelper.getSupplierElement(relation) for relation in req.get_relationshipOfRelatedElement() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findOrCreateRefinedParameters(element)\n $logger.log(element.getName())\n refinedParams = []\n for relation in element.get_relationshipOfRelatedElement()\n if StereotypesHelper.hasStereotype(relation, $veRelationshipStereotype)\n req = ModelHelper.getSupplierElement(relation)\n ...
[ "0.5749455", "0.44763222", "0.44315758", "0.4352625", "0.4322531", "0.43136698", "0.43060756", "0.43060756", "0.42866355", "0.4275223", "0.42378175", "0.42247254", "0.42140144", "0.41912305", "0.41748738", "0.41725275", "0.41723344", "0.416857", "0.4160564", "0.4095127", "0.4...
0.6318507
0
This function executes the function looking for all refining parameters for a VerficationElement and then parses through all owned elements from the given one. Params: +element+:: SysML element from the containment tree.
def recursiveTreeTraversal(element) if StereotypesHelper.hasStereotype(element, $veStereotype) findRefinedParameters(element) end for child in element.getOwnedElement() recursiveTreeTraversal(child) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findRefinedParameters(element)\n for relation in element.get_relationshipOfRelatedElement()\n if StereotypesHelper.hasStereotype(relation, $veRelationshipStereotype)\n req = ModelHelper.getSupplierElement(relation)\n for relation in req.get_relationshipOfRelatedElement()\n ...
[ "0.6251317", "0.5669195", "0.56206685", "0.55190295", "0.54181707", "0.5233958", "0.5215337", "0.5130344", "0.50303537", "0.48875755", "0.485756", "0.48551494", "0.48365498", "0.47645643", "0.47489664", "0.4689144", "0.46206036", "0.46146134", "0.4564588", "0.45195627", "0.45...
0.5862605
1
encoding: utf8 Function creates a paragraph from string p and writes them out to file f
def paragraph(p,f) # Replaces everything that has <b>, </b>, etc. value = p.gsub(/<b>|<\/b>|<a>|<\/a>/, "") arr = value.split(/</) # Gets rid of anything else from .* to > # and fixes spaces between numbers arr.each {|x| x.gsub!(/.*>\d*/, ""); x.gsub!(/\&\#\d*\;/, " "); } arr.each {|x| if x == a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def utf8write(str,f)\n File.open(f,\"wb:utf-8\"){|ff|\n ff.write(str)\n }\nend", "def body_text(fp,text)\n\t\tfp.puts text\n\tend", "def mapf_format_paragraph(text, max_width = contents_width)\n text = text.clone\n # Create a Dummy Contents - I wanted to boost compatibility by using the \n # def...
[ "0.61327845", "0.56369334", "0.5628283", "0.561192", "0.55925214", "0.55839455", "0.5569195", "0.5524371", "0.55093324", "0.5389055", "0.5369106", "0.5335553", "0.5329922", "0.5271824", "0.5261514", "0.5216091", "0.51790136", "0.51734936", "0.5169409", "0.514829", "0.51154953...
0.6710374
0
This function keeps loop going until "DONE" is seen Otherwise, function get_info will be called to use To extract first two paragraphs from Wikipedia
def get_info_loop file loop do line = file.gets if line == nil then break end words = line.scan(/\S+/) words.each{ |word| case word when /DONE/ return else get_info(word) end } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_info(w)\n\trequire 'open-uri'\n\tparagraph = []\n\tcontents = open('http://en.wikipedia.org/wiki/' + w) {|f| \n\t\tf.readlines.each {|x| \n\t\t\tif x =~ /<p>(.*)<\\/p>/\n\t\t\tparagraph.push($1)\n\t\t\tend\n\t}}\n\n\t# If a file name was passed in to be stored somewhere\n\t# Otherwise, Temp.doc will be cre...
[ "0.6863866", "0.646372", "0.60471344", "0.60028046", "0.59979093", "0.59979093", "0.59979093", "0.59979093", "0.5923486", "0.5832639", "0.5690334", "0.5682024", "0.56792265", "0.5672313", "0.5624293", "0.5579209", "0.5571328", "0.55658877", "0.5555031", "0.5525902", "0.551827...
0.6730045
1
Takes a Transaction ready to be signed. Returns an Array of signature dictionaries.
def signatures(transaction, names: [:primary]) transaction.inputs.map do |input| path = input.output.metadata[:wallet_path] node = self.path(path) sig_hash = transaction.sig_hash(input, node.script) node.signatures(sig_hash, names: names) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signatures\n parsed {\n @signatures \n }\n end", "def sign(wallet)\n tx = Arweave::Transaction.new(data: @commit.message.to_s)\n @commit.to_tags.each do |name, value|\n tx.add_tag(name: name, value: value)\n end\n tx.sign(wallet)\n end", "def transactions\n\t\treturn M...
[ "0.6689318", "0.6305804", "0.6164084", "0.6159831", "0.6077063", "0.606096", "0.604645", "0.6042075", "0.5902153", "0.58294094", "0.57881963", "0.5778881", "0.577542", "0.57421714", "0.57016987", "0.5696778", "0.56844485", "0.5684061", "0.5680799", "0.56645614", "0.5657761", ...
0.7225957
0
Takes a Transaction and any number of Arrays of signature dictionaries. Each sig_dict in an Array corresponds to the Input with the same index. Uses the combined signatures from all the signers to generate and set the script_sig for each Input. Returns the transaction.
def authorize(transaction, *signers) transaction.set_script_sigs *signers do |input, *sig_dicts| node = self.path(input.output.metadata[:wallet_path]) signatures = combine_signatures(*sig_dicts) node.script_sig(signatures) end transaction end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signatures(transaction, names: [:primary])\n transaction.inputs.map do |input|\n path = input.output.metadata[:wallet_path]\n node = self.path(path)\n sig_hash = transaction.sig_hash(input, node.script)\n node.signatures(sig_hash, names: names)\n end\n end", "def crea...
[ "0.6639156", "0.612882", "0.58752424", "0.57744056", "0.5283584", "0.5280524", "0.5243925", "0.5218904", "0.51741624", "0.5125728", "0.50553656", "0.49807802", "0.4972517", "0.4966449", "0.49388856", "0.48918334", "0.4776902", "0.4749058", "0.47110122", "0.46888185", "0.46682...
0.62909025
1
Takes any number of "signature dictionaries", which are Hashes where the keys are tree names, and the values are base58encoded signatures for a single input. Returns an Array of the signatures in binary, sorted by their tree names.
def combine_signatures(*sig_dicts) combined = {} sig_dicts.each do |sig_dict| sig_dict.each do |tree, signature| decoded_sig = decode_base58(signature) low_s_der_sig = Bitcoin::Script.is_low_der_signature?(decoded_sig) ? decoded_sig : Bitcoin::OpenSSL_EC.signature_to_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signatures(transaction, names: [:primary])\n transaction.inputs.map do |input|\n path = input.output.metadata[:wallet_path]\n node = self.path(path)\n sig_hash = transaction.sig_hash(input, node.script)\n node.signatures(sig_hash, names: names)\n end\n end", "def sign...
[ "0.65369296", "0.60533875", "0.56763816", "0.5333135", "0.51653075", "0.51449525", "0.51133287", "0.5111311", "0.5094485", "0.5030817", "0.5017331", "0.500569", "0.5000744", "0.4992892", "0.49517483", "0.49517483", "0.49464738", "0.4941667", "0.4897451", "0.48931602", "0.4889...
0.6638893
0
GET /percentual_gorduras GET /percentual_gorduras.json
def index @percentual_gorduras = PercentualGordura.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def percentual_gordura_params\n params.require(:percentual_gordura).permit(:triceps, :supra_f, :supra_m, :abdomen, :coxa, :subescapular, :aluno_id)\n end", "def index\n @ultimo_grado_de_estudios = UltimoGradoDeEstudio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format....
[ "0.62293714", "0.6123777", "0.6120381", "0.6110766", "0.6083583", "0.60833114", "0.60608304", "0.5996981", "0.59409225", "0.5912513", "0.5906495", "0.5892862", "0.5881434", "0.58792657", "0.58535", "0.5851153", "0.583435", "0.5825544", "0.5820827", "0.5817334", "0.58156675", ...
0.72092944
0
GET /percentual_gorduras/1 GET /percentual_gorduras/1.json GET /percentual_gorduras/new
def new @percentual_gordura = PercentualGordura.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @percentual_gordura = PercentualGordura.new(percentual_gordura_params)\n\n respond_to do |format|\n if @percentual_gordura.save\n format.html { redirect_to @percentual_gordura, notice: 'Percentual gordura was successfully created.' }\n format.json { render action: 'show', stat...
[ "0.73144186", "0.718344", "0.7113081", "0.70378065", "0.70282924", "0.6991537", "0.69895655", "0.69735026", "0.6972975", "0.6971929", "0.69666976", "0.69528383", "0.6947008", "0.6947008", "0.69383025", "0.6930364", "0.69276536", "0.6905504", "0.6898198", "0.6888249", "0.68777...
0.73092353
1
POST /percentual_gorduras POST /percentual_gorduras.json
def create @percentual_gordura = PercentualGordura.new(percentual_gordura_params) respond_to do |format| if @percentual_gordura.save format.html { redirect_to @percentual_gordura, notice: 'Percentual gordura was successfully created.' } format.json { render action: 'show', status: :create...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def percentual_gordura_params\n params.require(:percentual_gordura).permit(:triceps, :supra_f, :supra_m, :abdomen, :coxa, :subescapular, :aluno_id)\n end", "def create\n @percentage = Percentage.new(percentage_params)\n\n respond_to do |format|\n if @percentage.save\n format.html { redi...
[ "0.7150448", "0.62979126", "0.6180992", "0.6161287", "0.61237556", "0.6109472", "0.6044457", "0.6028358", "0.59720045", "0.58923197", "0.5858864", "0.58372694", "0.58051026", "0.57812005", "0.5759819", "0.57506216", "0.57377195", "0.5720735", "0.5710153", "0.57080644", "0.569...
0.7277088
0
PATCH/PUT /percentual_gorduras/1 PATCH/PUT /percentual_gorduras/1.json
def update respond_to do |format| if @percentual_gordura.update(percentual_gordura_params) format.html { redirect_to @percentual_gordura, notice: 'Percentual gordura was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @percentage.update(percentage_params)\n format.html { redirect_to @percentage, notice: 'Percentage was successfully updated.' }\n format.json { render :show, status: :ok, location: @percentage }\n else\n format.html { render :edit }\n ...
[ "0.6449922", "0.6418719", "0.6373279", "0.63250875", "0.6314283", "0.6263335", "0.6250542", "0.62065995", "0.6191897", "0.61912084", "0.6182195", "0.61621815", "0.61554587", "0.61468124", "0.613154", "0.6119767", "0.61173636", "0.61115474", "0.6108085", "0.6104613", "0.610128...
0.7079142
0
DELETE /percentual_gorduras/1 DELETE /percentual_gorduras/1.json
def destroy @percentual_gordura.destroy respond_to do |format| format.html { redirect_to percentual_gorduras_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @gran_unidad.destroy\n respond_to do |format|\n format.html { redirect_to gran_unidad_index_url }\n format.json { head :no_content }\n end\n end", "def d...
[ "0.70852894", "0.6984501", "0.6965684", "0.6944373", "0.6895366", "0.6895366", "0.6893692", "0.6875281", "0.68725795", "0.68618196", "0.682656", "0.6819026", "0.68109673", "0.6802638", "0.6800843", "0.67951196", "0.67933226", "0.67906606", "0.6790544", "0.6779892", "0.6776726...
0.76227844
0
POST /producers POST /producers.json
def create @producer = Pusher.create_producer(params[:producer]) if @producer.valid? render json: @producer, status: :created, location: @producer else render json: @producer.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @producer = Producer.new(producer_params)\n\n respond_to do |format|\n if @producer.save\n format.html { redirect_to @producer, notice: \"Producer was successfully created.\" }\n format.json { render :show, status: :created, location: @producer }\n else\n format.ht...
[ "0.64211977", "0.6359898", "0.632868", "0.62813336", "0.6151703", "0.6080644", "0.602942", "0.57641", "0.5659043", "0.5625165", "0.55608875", "0.5547983", "0.548863", "0.5449561", "0.54396296", "0.54346067", "0.54153997", "0.5385405", "0.5384478", "0.53835094", "0.5378103", ...
0.66820544
0
propose a new item with quantity
def propose_item_with_quantity(name, price, quantity, selling_mode, increment, end_time, description = "", log = true) item = self.propose_item(name,price,selling_mode,increment,end_time, quantity, description,log) item end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add\n @item.increment(:quantity)\n @item.save!\n\n refresh\n end", "def add_item(product_id:, quantity: 1)\n product = Product.find(product_id)\n\n order_item = order.items.find_or_create_by(\n product_id: product_id\n )\n\n order_item.price = product.price\n order_item.quantity...
[ "0.7752051", "0.7704649", "0.75937855", "0.7586079", "0.7562667", "0.7522789", "0.75090563", "0.7491194", "0.74564815", "0.7416457", "0.74152505", "0.7402384", "0.73710334", "0.73679346", "0.7359215", "0.7333172", "0.73271745", "0.72894347", "0.7275302", "0.7266912", "0.72657...
0.785348
0
propose a new item
def propose_item(name, price, selling_mode, increment, end_time, quantity = 1, description = "", log = true) if selling_mode == :fixed item = Item.fixed(name, price, self, description) elsif selling_mode == :auction item = Item.auction(name, price, self, increment.to_i, end_time, descrip...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_item(new_item)\n item = Item.new(new_item)\n items.push(item)\n end", "def add_item(new_item)\n item = Item.new(new_item)\n @items.push(item)\n end", "def propose_item(name, price, selling_mode, increment, end_time, description = \"\", log = true)\n if selling_mode == \"fixed\"\n ...
[ "0.6981362", "0.6852838", "0.674562", "0.6734719", "0.6647732", "0.6625688", "0.6613227", "0.6558322", "0.65454644", "0.650865", "0.6504293", "0.64834315", "0.6445756", "0.64384943", "0.6434799", "0.64330024", "0.64062095", "0.6404805", "0.6404805", "0.6404805", "0.6393626", ...
0.7235941
0
sell item matching an offer
def sell_to_offer(offer,item) active = item.active? item.activate if !active #offer.from.credits +=offer.price*offer.quantity purchase = Purchase.create(item,offer.quantity,item.owner,offer.from) purchase.adapt_price_to_offer(offer) purchase.prepare PurchaseActivity.succ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sell(item)\r\n self.add_credits(item.price * item.quantity)\r\n Marketplace::Activity.create(Activity.ITEM_SOLD, item, \"#{item.name} has been sold by #{self.name}\")\r\n Marketplace::Activity.create(Activity.USER_SOLD_ITEM, self, \"#{self.name} sold #{item.name}\")\r\n end", "def sell_requ...
[ "0.7122848", "0.69785243", "0.6918258", "0.6728744", "0.66711533", "0.6624512", "0.65788925", "0.65503424", "0.64741457", "0.6469359", "0.6461519", "0.64297235", "0.642102", "0.6401419", "0.63795", "0.6374036", "0.63039875", "0.6261828", "0.6261102", "0.6260047", "0.62582946"...
0.76911545
0
get a list of all active items of a user
def get_active_items self.items.select { |i| i.active? } #TODO only fixed or only auction end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_all_active_items\n @items.values.select{|item| item.active}\n end", "def get_active_items\n self.items.select { |i| i.active? } #TODO only fixed or only auction\n end", "def index\n @items = @current_user.items\n end", "def index \n \t@items = Item.paginate(page: params[:...
[ "0.7867313", "0.73099804", "0.7211172", "0.7211117", "0.7161697", "0.710768", "0.7060774", "0.7047599", "0.70148796", "0.6965865", "0.69565445", "0.6945257", "0.68824565", "0.6881317", "0.68749595", "0.6871562", "0.686274", "0.686274", "0.68104917", "0.68051094", "0.68002504"...
0.7312948
1
attach a bought item to the user. If the bought item matches an already owned item, items will be composed, i.e their respective quantities will be added
def attach_item(item) equal_item = self.check_for_equal_item(item.name,item.price,item.description) if equal_item == nil self.items << item item.owner = self item.deactivate else equal_item.quantity += item.quantity equal_item.deactivate item.de...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buy_item(user, item)\r\n if(self.has_enough_money(item) and user.has_item(item))\r\n self.get_item(user, item)\r\n self.pay_amount(user, item.get_price)\r\n else\r\n #transaction not possible\r\n end\r\n end", "def buy_new_item(item_to_buy, quantity, a...
[ "0.73715043", "0.7309045", "0.7253374", "0.70903224", "0.7074505", "0.70599717", "0.69619083", "0.6961877", "0.6881912", "0.68477535", "0.6728815", "0.6710392", "0.66967636", "0.6684488", "0.66226447", "0.66168904", "0.6609025", "0.65925187", "0.6570102", "0.6564247", "0.6559...
0.7787981
0
releases a certain quantity of an item
def release_quantity_of_item(item, quantity) if self.items.include?(item) item.quantity -= quantity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use_item(item_name:, quantity:)\n total_items_quantity[item_name] -= quantity\n end", "def reserve_inventory!(order_quantity)\n self.quantity -= order_quantity\n save!\n end", "def sell_inventory(material, quantity)\n material.quantity -= quantity\n end", "def purchase\n \t@stock -= 1\n ...
[ "0.7100202", "0.7001074", "0.69820267", "0.687481", "0.67463577", "0.67162484", "0.67162484", "0.66184425", "0.6617048", "0.6597131", "0.6555539", "0.654294", "0.65269905", "0.6490382", "0.64864016", "0.6464276", "0.64587927", "0.63866997", "0.6383126", "0.6379867", "0.636671...
0.79756016
0
deletes the owner of an item to release it
def release_item(item) if self.items.include?(item) item.owner = nil self.items.delete(item) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def release_item(item)\n if self.items.include?(item)\n item.owner = nil\n self.items.delete(item)\n end\n end", "def remove_item(item)\r\n items.delete(item)\r\n item.owner = nil\r\n end", "def dispose_item(item)\n if self == item.owner\n equipments.delete(item....
[ "0.85387784", "0.789855", "0.71152526", "0.7090574", "0.6851771", "0.68334115", "0.6792848", "0.6687587", "0.66385573", "0.64041644", "0.63915133", "0.6359432", "0.6359343", "0.6342233", "0.63086724", "0.62975305", "0.62655383", "0.62579817", "0.62361425", "0.6233602", "0.622...
0.8555008
0
confirm a previously prepared purchase
def confirm_purchase(purchase) purchase.confirm end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirm!\n return false if purchased?\n confirmed!\n end", "def successful_purchase_response\n end", "def confirm!\n confirm_integration product_payload\n variants_payload.each { |key, v| confirm_integration v }\n end", "def confirmation\n @merchant = @current_merchant\n ...
[ "0.80120355", "0.71839976", "0.7034328", "0.69552207", "0.69417167", "0.6840967", "0.68290037", "0.68160766", "0.67721665", "0.67500556", "0.67412174", "0.67292356", "0.6726638", "0.67259914", "0.66930574", "0.666647", "0.662746", "0.6584693", "0.65668005", "0.65359044", "0.6...
0.8436574
0
confirms all pending purchases
def confirm_all_pending_purchases self.pending_purchases.each{|purchase| purchase.confirm} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirm!\n self.pending = false\n self.save\n self.createDebts\n end", "def confirm_purchase(purchase)\r\n purchase.confirm\r\n end", "def confirm!\n return false if purchased?\n confirmed!\n end", "def void_pending_purchase_orders\n self.purchase_orders.se...
[ "0.7165871", "0.710431", "0.6915711", "0.671638", "0.66638136", "0.65216666", "0.65216666", "0.6379331", "0.6322846", "0.630819", "0.63065654", "0.62531257", "0.6160262", "0.6138251", "0.61300164", "0.6119833", "0.6099496", "0.6082478", "0.6058828", "0.60534346", "0.60512286"...
0.87315136
0
add purchase to user's pending purchases list
def add_to_pending(purchase) self.pending_purchases.push(purchase) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_purchases(purchase_record)\n @purchases << purchase_record\n end", "def pending!(purchase)\n post(purchase, \"#{collection_path}/pending\")\n end", "def pending!(purchase)\n post(purchase, \"#{collection_path}/pending\")\n end", "def do_purchase\n user.purchases.crea...
[ "0.7393064", "0.6969941", "0.6969941", "0.67944", "0.6484065", "0.6417725", "0.6390281", "0.6367429", "0.62931055", "0.62603235", "0.6224885", "0.6166776", "0.6166744", "0.60608613", "0.59752727", "0.5958694", "0.59393317", "0.5899517", "0.589537", "0.58802223", "0.58519614",...
0.8696216
0
delete purchase from user's pending purchases list
def delete_pending(purchase) self.pending_purchases.delete(purchase) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_purchase_order_items\n purchase_order_items.destroy_all\n end", "def destroy\n @purchase_list.destroy\n end", "def destroy\n @purchase = Purchase.find(params[:id])\n if current_user == @purchase.user\n @purchase.destroy\n end\n redirect_to \"/products\"\n end", "def remov...
[ "0.7128409", "0.69421244", "0.6914868", "0.69054824", "0.67975605", "0.66891444", "0.6648817", "0.6601199", "0.652107", "0.6518998", "0.65046024", "0.64683145", "0.64472157", "0.6365561", "0.6346627", "0.6293252", "0.62929934", "0.6292903", "0.62905794", "0.6240558", "0.61875...
0.85486287
0
returns true if user is allowed to buy item
def can_buy?(item) item.buyable_by?(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_buy?(item)\n item.buyable_by?(self)\n end", "def check_buyable\n raise PermissionDeniedError, \"出品したアイテムはサポートできません\" if @item.owner?(current_user)\n end", "def test_can_buy_org_item\n user = User.named(\"user\")\n org = Organization.named(\"org\")\n\n item = org.propose_item(\"Item...
[ "0.83556855", "0.80316854", "0.7427995", "0.7392608", "0.7370311", "0.72309196", "0.7112417", "0.7045148", "0.7044457", "0.6986249", "0.69859576", "0.69794226", "0.69610906", "0.69420904", "0.6913748", "0.6912129", "0.6909094", "0.6885142", "0.68847775", "0.6845791", "0.68448...
0.8416713
0
returns true if user is allowed to activate an item
def can_activate?(item) item.activatable_by?(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_activate?(item)\n item.activatable_by?(self)\n end", "def activated?\n self.user && self.user.activated?\n end", "def can_activate?\n self.person && self.person_match? && self.has_not_expired?\n end", "def can_activate?\n self.person && self.email_match?\n end", "def can_activat...
[ "0.8513891", "0.7573564", "0.7317395", "0.71086276", "0.7026378", "0.70057917", "0.6754494", "0.6717668", "0.67154217", "0.67154217", "0.6700493", "0.66995585", "0.66611975", "0.66611975", "0.66450006", "0.66209126", "0.6610475", "0.6610475", "0.6592199", "0.657829", "0.65740...
0.85580724
0
GET /moneyboxes GET /moneyboxes.json
def index @moneyboxes = Moneybox.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @cashboxes = Cashbox.all\n end", "def list_all_tenantcircles_for_a_version_box(args = {}) \n get(\"/aosversions.json/aosversionbox/circles/#{args[:aosVersionBoxId]}\", args)\nend", "def list_all_aos_version_boxes(args = {}) \n get(\"/aosversions.json/aosversionbox\", args)\nend", "def get_coi...
[ "0.6577376", "0.6549823", "0.65441465", "0.64175475", "0.63030446", "0.62492555", "0.6243145", "0.6115511", "0.6090706", "0.60815036", "0.60267776", "0.6010496", "0.5971386", "0.59683895", "0.59509456", "0.58704364", "0.5822551", "0.58150595", "0.581109", "0.5799254", "0.5778...
0.7581377
0
POST /moneyboxes POST /moneyboxes.json
def create @account = Account.new # data = params[:moneybox] @account.name = params[:name] respond_to do |format| if @moneybox.save format.html { redirect_to @moneybox, notice: 'Moneybox was successfully created.' } format.json { render action...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @moneyboxes = Moneybox.all\n end", "def set_moneybox\n @moneybox = Moneybox.find(params[:id])\n end", "def create\n @box = current_user.boxes.build(params[:box])\n @box.status = 'draft'\n\n respond_to do |format|\n if current_user.address.blank?\n flash[:not...
[ "0.62224865", "0.6189699", "0.6116553", "0.6081428", "0.60730594", "0.6062627", "0.59471655", "0.5901364", "0.58348054", "0.580331", "0.5766668", "0.5752638", "0.5741719", "0.57053983", "0.5652516", "0.5641717", "0.5632716", "0.559753", "0.5586972", "0.55226356", "0.5512933",...
0.65258867
0
PATCH/PUT /moneyboxes/1 PATCH/PUT /moneyboxes/1.json
def update respond_to do |format| if @moneybox.update(moneybox_params) format.html { redirect_to @moneybox, notice: 'Moneybox was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @box = Box.find(params[:id])\n\n respond_to do |format|\n if @box.update_attributes(params[:box])\n format.html { redirect_to @box, notice: 'Box was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format...
[ "0.68441975", "0.65989393", "0.657906", "0.65616673", "0.64943945", "0.6387296", "0.63081044", "0.62886214", "0.62861", "0.6283163", "0.6246032", "0.62444025", "0.62130284", "0.61920047", "0.61198187", "0.6110951", "0.6061957", "0.6053636", "0.60061836", "0.6005279", "0.59672...
0.72163934
0
DELETE /moneyboxes/1 DELETE /moneyboxes/1.json
def destroy @moneybox.destroy respond_to do |format| format.html { redirect_to moneyboxes_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @cashbox.destroy\n respond_to do |format|\n format.html { redirect_to cashbox_index_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cashbox.destroy\n respond_to do |format|\n format.html { redirect_to cashboxes_url, notice: 'Cashbox was successf...
[ "0.7229852", "0.7117079", "0.70890284", "0.7074077", "0.6972092", "0.69267416", "0.67843646", "0.66681075", "0.66362035", "0.66166526", "0.6606855", "0.6599356", "0.6599271", "0.6522575", "0.651303", "0.65083313", "0.6485756", "0.64824367", "0.6472177", "0.6461107", "0.645996...
0.7852458
0
GET /suggested_ages GET /suggested_ages.json
def index @suggested_ages = SuggestedAge.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_suggested_age\n @suggested_age = SuggestedAge.find(params[:id])\n end", "def suggested_age_params\n params.require(:suggested_age).permit(:name)\n end", "def index_by_age_sorted_by_price\n @age = Age.find(params[:age_id])\n @gifts = @age.gifts\n render json: @gifts, inclu...
[ "0.64890534", "0.617056", "0.58913225", "0.58588105", "0.5774988", "0.57044846", "0.5673096", "0.5631754", "0.55987513", "0.5589724", "0.55795664", "0.55722576", "0.5570519", "0.5561018", "0.5551909", "0.55376065", "0.55047417", "0.54952925", "0.5468958", "0.5448533", "0.5438...
0.7210646
0
POST /suggested_ages POST /suggested_ages.json
def create @suggested_age = SuggestedAge.new(suggested_age_params) respond_to do |format| if @suggested_age.save format.html { flash[:notice] = 'La edad sugerida se creó satisfactoriamente.' redirect_to suggested_ages_path } format.json { render :show, status:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suggested_age_params\n params.require(:suggested_age).permit(:name)\n end", "def set_suggested_age\n @suggested_age = SuggestedAge.find(params[:id])\n end", "def index\n @suggested_ages = SuggestedAge.all\n end", "def update\n respond_to do |format|\n if @suggested_age.update(...
[ "0.6687431", "0.62753564", "0.6156147", "0.59321713", "0.5755394", "0.55906904", "0.54308695", "0.5430047", "0.54174876", "0.539183", "0.539162", "0.53759205", "0.53399396", "0.53324497", "0.5327658", "0.5311165", "0.53110087", "0.5286432", "0.52847314", "0.5279038", "0.52531...
0.6861874
0
PATCH/PUT /suggested_ages/1 PATCH/PUT /suggested_ages/1.json
def update respond_to do |format| if @suggested_age.update(suggested_age_params) format.html { flash[:notice] = 'La edad sugerida se actualizó satisfactoriamente.' redirect_to suggested_ages_path } format.json { render :show, status: :ok, location: @suggested_age }...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_suggested_age\n @suggested_age = SuggestedAge.find(params[:id])\n end", "def update\n @gage = Gage.find(params[:id])\n\n respond_to do |format|\n if @gage.update_attributes(params[:gage])\n format.html { redirect_to @gage, notice: 'Gage was successfully updated.' }\n form...
[ "0.64502907", "0.6194011", "0.61906266", "0.60452795", "0.6040802", "0.60342443", "0.60311645", "0.6014141", "0.60067177", "0.5993743", "0.59886533", "0.5961253", "0.59359497", "0.59280133", "0.5927895", "0.5898095", "0.58975756", "0.5894361", "0.5892792", "0.5889187", "0.588...
0.7048096
0
DELETE /suggested_ages/1 DELETE /suggested_ages/1.json
def destroy @suggested_age.destroy respond_to do |format| format.html { flash[:notice] = 'La edad sugerida se eliminó satisfactoriamente.' redirect_to suggested_ages_path } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @gage = Gage.find(params[:id])\n @gage.destroy\n\n respond_to do |format|\n format.html { redirect_to gages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @advocacy = Advocacy.find(params[:id])\n @advocacy.destroy\n\n respond_to do |format|\n ...
[ "0.6958503", "0.6870441", "0.67324245", "0.67225105", "0.6712022", "0.66936725", "0.668789", "0.66814315", "0.6667803", "0.6658467", "0.6640429", "0.66345865", "0.66145176", "0.66112804", "0.65976185", "0.65950966", "0.6594942", "0.65878034", "0.6583884", "0.657517", "0.65729...
0.7465402
0
See comments for base_url in lib/pact_broker/doc/controllers/app.rb
def ui_base_url request.env["pactbroker.base_url"] || "" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base_url\n # Using the X-Forwarded headers in the UI can leave the app vulnerable\n # https://www.acunetix.com/blog/articles/automated-detection-of-host-header-attacks/\n # Either use the explicitly configured base url or an empty string,\n # rather than request.base_url, wh...
[ "0.73768973", "0.7365687", "0.71546173", "0.7089082", "0.701406", "0.7009818", "0.697468", "0.6877361", "0.68367034", "0.68036413", "0.6803307", "0.6749636", "0.67450804", "0.67395866", "0.66945314", "0.6660361", "0.6650225", "0.6573239", "0.6567789", "0.6558564", "0.65317833...
0.7721294
0
Ensure we have valid JSON if a JSON body is required OR if a body has been provided
def content_type_is_json_but_invalid_json_provided? content_type_json? && ((request_body_required? || any_request_body?) && invalid_json?) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_json(json)\n JSON(json)\n #NOTE: Rescuing TypeError too in case json is not a String\n rescue ::JSON::ParserError, TypeError\n nil\n end", "def format_body(body, json)\n if json && !body.is_a?(String) && !body.nil?\n body.to_json\n elsif body.is_a?(Stri...
[ "0.71599287", "0.7132338", "0.6883168", "0.6831633", "0.67973024", "0.6708845", "0.66111934", "0.64998543", "0.64998543", "0.6497647", "0.6497647", "0.6452888", "0.6445513", "0.6441618", "0.6435888", "0.64142275", "0.641292", "0.6410751", "0.6361437", "0.63413286", "0.6321772...
0.7447415
0
TODO rename to put_to_create_supported, otherwise it sounds like it's a policy issue Not a Webmachine method. This is used by security policy code to identify whether a PUT to a non existing resource can create a new object.
def put_can_create? false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_create?(obj)\n false\n end", "def can_create?(obj)\n false\n end", "def patch_can_create?\n false\n end", "def http_method_modifies_resource?\n ['PUT','POST','PATCH'].include?(method.to_s.upcase)\n end", "def should_fail_to_create(key, value, error, message)\n ...
[ "0.712357", "0.712357", "0.7070993", "0.6593049", "0.6552015", "0.62096786", "0.6202629", "0.60856044", "0.60856044", "0.6028774", "0.5995979", "0.5974593", "0.5965384", "0.59235704", "0.589666", "0.58952254", "0.5871741", "0.5871741", "0.5871741", "0.5871741", "0.5871741", ...
0.7974128
0
TODO rename to patch_to_create_supported, otherwise it sounds like it's a policy issue Not a Webmachine method. This is used by security policy code to identify whether a PATCH to a non existing resource can create a new object.
def patch_can_create? false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_create?(obj)\n false\n end", "def can_create?(obj)\n false\n end", "def put_can_create?\n false\n end", "def http_method_modifies_resource?\n ['PUT','POST','PATCH'].include?(method.to_s.upcase)\n end", "def can_create?\n allows_current_user_access_to? :create\...
[ "0.7045069", "0.7045069", "0.66991454", "0.6512275", "0.61496884", "0.6131855", "0.608308", "0.60082823", "0.598155", "0.594934", "0.594934", "0.594934", "0.594934", "0.594934", "0.594934", "0.594934", "0.59413767", "0.59257287", "0.59175366", "0.590046", "0.5866973", "0.58...
0.81165093
0
Repo default branch repo String Returns String
def default_branch(repo) api.repository(repo).default_branch end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_branch(remote)\n remote_url = `git config remote.#{Shellwords.escape remote}.url`.chomp\n repo_name = begin\n URI.parse(remote_url).path[1..-5]\n rescue ::URI::InvalidURIError\n remote_url.split(':', 2).last[0..-5]\n end\n\n if File.basename(repo_name).end_with? '.github.io'\n ...
[ "0.75469035", "0.7525122", "0.7379428", "0.7341523", "0.7315713", "0.7303584", "0.7209377", "0.70735836", "0.7045799", "0.703733", "0.70351595", "0.6949105", "0.69330627", "0.69186383", "0.6903201", "0.6899998", "0.68956953", "0.68951356", "0.68821067", "0.6851813", "0.681878...
0.7686027
0
Create repo hooks repo String endpoint String Yields hook_id Integer
def add_hooks(repo, endpoint) hook = api.create_hook( repo, 'web', { url: endpoint, secret: ENV['GITHUB_SECRET_TOKEN'] }, { events: %w(push pull_request), active: true, } ) yield hook.id rescue Octokit::UnprocessableEntity => error raise unl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_hook!\n hook = client.create_hook(\n full_name,\n 'web',\n {\n url: Constants::HOOK_URL,\n content_type: 'json'\n },\n {\n events: ['release'],\n active: true\n }\n )\n\n self.github_hook_id = hook.id\n end", "def create_hook...
[ "0.66037405", "0.64660376", "0.6086982", "0.58305615", "0.577721", "0.57249194", "0.5651576", "0.55900484", "0.55421305", "0.545491", "0.5410556", "0.54031986", "0.5331591", "0.52813524", "0.5265054", "0.52487266", "0.522663", "0.5203098", "0.51766807", "0.5162217", "0.512093...
0.69875586
0