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
PUT /insurances/1 PUT /insurances/1.json
def update @breadcrumb = 'update' @insurance = Insurance.find(params[:id]) @insurance.updated_by = current_user.id if !current_user.nil? respond_to do |format| if @insurance.update_attributes(params[:insurance]) format.html { redirect_to @insurance, n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @interest = Interest.find(params[:id])\n \n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.json { head :ok }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n ...
[ "0.62293655", "0.6171783", "0.61701", "0.610971", "0.6035267", "0.6000996", "0.5981027", "0.5976915", "0.5976347", "0.597185", "0.5932742", "0.5932742", "0.5932742", "0.5914886", "0.58653986", "0.5851972", "0.58408606", "0.58258003", "0.5822766", "0.5820761", "0.5815371", "...
0.61889255
1
Returns an array of all the galleries that an artist has paintings in
def galleries Painting.all.map do |painting_instance| if painting_instance.artist == self painting_instance.gallery end end.compact.uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def galleries\n paintings.map {|p| p.gallery}\n end", "def galleries\n paintings.map {|painting| painting.gallery}\n end", "def all_artists_by_gallery\n paintings = Painting.all.select { |painting| painting.gallery == self }\n # paintings.map { |painting| painting.artist }\n end", "def ga...
[ "0.846802", "0.8272418", "0.82534474", "0.82506865", "0.82282174", "0.8226531", "0.8224111", "0.8136808", "0.8120395", "0.8120395", "0.8120395", "0.8095459", "0.8080331", "0.8023666", "0.7893244", "0.75780237", "0.756971", "0.7534802", "0.738552", "0.7238986", "0.7216759", ...
0.86001194
0
Return an array of all cities that an artist has paintings in
def cities Painting.all.map do |painting_instance| if painting_instance.artist == self painting_instance.gallery.city end end.compact.uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_cities\n city_arr = Painting.all.select do |painting_ob|\n #binding.pry\n painting_ob.artist == self\n end\n city_arr.map do |painting_ob|\n painting_ob.gallery.city\n end\nend", "def cities\n galleries.map {|g| g.city}\n end", "def cities \n galleries.map{|g| g.city}.uniq\n...
[ "0.7432719", "0.7427216", "0.71981937", "0.71691334", "0.7162481", "0.71181685", "0.7106441", "0.70468307", "0.7043161", "0.7043161", "0.68992716", "0.68612635", "0.68456364", "0.68456364", "0.6780894", "0.6775067", "0.67725056", "0.6625553", "0.6616456", "0.6600691", "0.6587...
0.8210998
0
Redirect to '/spslo' is required for SP initiated Single Logout
def after_sign_out_path_for(_) if session['saml_uid'] && session['saml_session_index'] && SAML_SETTINGS.idp_slo_service_url user_saml_omniauth_authorize_path(locale: nil) + '/spslo' else super end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logout \n sign_out\n# render :text => \"single sign off\" and return unless params[\"from_sso\"].nil?\n redirect_to \"#{my_addr}/#{app.name}/home\"\n end", "def sp_logout_request\n # LogoutRequest accepts plain browser requests w/o paramters\n settings = saml_settings(url_base)\n\n if s...
[ "0.7160668", "0.7114328", "0.71089625", "0.7065243", "0.70365137", "0.7002275", "0.652105", "0.63999045", "0.6385099", "0.6297313", "0.6290662", "0.62903583", "0.62686753", "0.62686753", "0.62686753", "0.62686753", "0.62686753", "0.62625086", "0.624771", "0.62417823", "0.6240...
0.7493845
0
Declares which content models will be included with the model EXAMPLE: has_content :articles, :tips
def has_yaml_content(*args) include HasYamlContent::InstanceMethods #get the already loaded content modules content_types = custom_content_types args.each do |arg| #load content model if arg.is_a?(Symbol) #singularize content model and append to array ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_content_model\n add_relationship(:has_model, \"info:fedora/hull-cModel:examPaper\")\n add_relationship(:has_model, \"info:fedora/hydra-cModel:compoundContent\")\n add_relationship(:has_model, \"info:fedora/hydra-cModel:commonMetadata\")\n end", "def set_content\n @content = @slide.conte...
[ "0.6334754", "0.6129015", "0.6087126", "0.60795563", "0.5967125", "0.58907115", "0.5809402", "0.5793399", "0.5793399", "0.5793399", "0.5793399", "0.5782194", "0.5782194", "0.5782194", "0.5782194", "0.5782194", "0.5782194", "0.5782194", "0.57793635", "0.57523406", "0.5708118",...
0.6385777
0
Gets the content model class
def get_content_model(model_name) model_hash = content_types.select{|x| x[:name] == model_name}.first return model_hash[:class_name].nil? ? model_name.constantize : model_hash[:class_name].constantize end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_class\n return @model_class || self.class.model_class\n end", "def class\n @model.class\n end", "def set_content_model\n @content_model_class_name = self.class.name.gsub(/Controller/,'').singularize.constantize\n end", "def model_class\n self.class.const_g...
[ "0.7543149", "0.7474377", "0.72985125", "0.72675735", "0.70565087", "0.70486283", "0.69520867", "0.69487506", "0.69052047", "0.69052047", "0.6850171", "0.68262625", "0.68163633", "0.68129766", "0.6802389", "0.6782626", "0.6760645", "0.67597884", "0.67597884", "0.6722085", "0....
0.7724374
0
Take the given hash and category, and set its children as appropriate
def set_children_for(category, hash) if hash['children'] hash['children'].each do |ch| child = Documents::Category.find(ch['id']) child.parent = category child.save set_children_for(child, ch) end else # Can't remove children, so nil out the p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_categories(product)\n categories = value('category').split('&')\n\n categories.each do |category_string|\n category_string.strip!\n subcategories = category_string.split('>')\n parent_id = self.root_category.id\n subcategories.each do |category_url_key|\n cate...
[ "0.6269093", "0.60685337", "0.60029465", "0.6001196", "0.58774406", "0.5875418", "0.5862771", "0.586245", "0.58206314", "0.57982236", "0.5791305", "0.5769516", "0.5747947", "0.5711258", "0.56724143", "0.5650478", "0.5640234", "0.55902344", "0.5530768", "0.55278486", "0.552538...
0.80368084
0
GET /challenges GET /challenges.xml
def index @challenges = Challenge.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @challenges } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @challenges }\n end\n end", "def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render...
[ "0.6803577", "0.6728107", "0.67091334", "0.6674856", "0.6674856", "0.6674856", "0.6674856", "0.6667852", "0.6463627", "0.6413808", "0.63771206", "0.6290307", "0.6281759", "0.6229143", "0.6097002", "0.6093464", "0.60923636", "0.6045768", "0.5998104", "0.58445114", "0.5817884",...
0.7461396
0
GET /challenges/new GET /challenges/new.xml
def new @challenge = Challenge.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @challenge } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @challenge = Challenge.new\n @charities = Charity.find(:all, :order => :name)\n @sponsors = Sponsor.find(:all, :order => :name)\n @activities = Activity.find(:all, :order => :name)\n @tags = Tag.find(:all, :order => :name)\n respond_to do |format|\n format.html # new.html.erb\n ...
[ "0.69985414", "0.69382435", "0.68544227", "0.68544227", "0.68544227", "0.6798342", "0.6798342", "0.6664263", "0.6553692", "0.65018755", "0.65003836", "0.6500273", "0.6492642", "0.64552945", "0.6454501", "0.6451231", "0.644716", "0.64124626", "0.6405961", "0.6402187", "0.63948...
0.7550485
0
POST /challenges POST /challenges.xml
def create @challenge = Challenge.new(params[:challenge]) respond_to do |format| if @challenge.save flash[:notice] = 'Challenge was successfully created.' format.html { redirect_to(@challenge) } format.xml { render :xml => @challenge, :status => :created, :location => @challenge ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @challenges }\n end\n end", "def new\n @challenge = Challenge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xm...
[ "0.6130845", "0.6104952", "0.599289", "0.5959405", "0.59540683", "0.5828759", "0.5825292", "0.57907087", "0.5732005", "0.57133687", "0.5711412", "0.5680116", "0.5673288", "0.56070834", "0.56000197", "0.5578913", "0.5567122", "0.5557702", "0.5557702", "0.55560833", "0.55448914...
0.6457111
0
PUT /challenges/1 PUT /challenges/1.xml
def update @challenge = Challenge.find(params[:id]) respond_to do |format| if @challenge.update_attributes(params[:challenge]) flash[:notice] = 'Challenge was successfully updated.' format.html { redirect_to(@challenge) } format.xml { head :ok } else format.html { r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n expose Challenge.update(@oauth_token, params[:challenge_id].strip,\n params[:data])\n end", "def update\n @challenge ||= Challenge.find(params[:id])\n\n respond_to do |format|\n if @challenge.update_attributes(params[:challenge])\n format.html { redirect_to @challenge, not...
[ "0.61307466", "0.59746647", "0.59345686", "0.59345686", "0.5857802", "0.57398766", "0.5711691", "0.56959635", "0.56398433", "0.56285036", "0.5594382", "0.55895764", "0.5561022", "0.55583876", "0.55583876", "0.55583876", "0.55583876", "0.55583876", "0.5556457", "0.55464333", "...
0.63591146
1
DELETE /challenges/1 DELETE /challenges/1.xml
def destroy @challenge = Challenge.find(params[:id]) @challenge.destroy respond_to do |format| format.html { redirect_to(challenges_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n #REQUIRES: existence of contest with :id\n #MODIFIES: the database\n #EFFECTS: deletes the information in the database of the contest with :id\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to(contests_url) }\n forma...
[ "0.6849034", "0.67672354", "0.67376816", "0.67376816", "0.67376816", "0.67259276", "0.67171764", "0.6706058", "0.6705198", "0.6659304", "0.664068", "0.66222394", "0.66201735", "0.6579831", "0.6557695", "0.64986295", "0.6492962", "0.64544207", "0.64317", "0.64219475", "0.64219...
0.74575585
1
Fetch new IP Address from first_ip and index function
def fetch_ip_address(first_ip, i) array = first_ip.split('.') change = (array.first 3).push(array[-1].to_i + i) new_ip = "" for i in change new_ip += "." + i.to_s end return new_ip[1..-1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_assigned\n Ip.find(:first, :conditions => \n ['address_i > ? AND service = ? and network_id is not null', self.address_i, self.service], :order => 'address_i asc')\n end", "def next_ip\n\t\t@ip_pos += 1\n\t\t@ip_pos = 0 if @ip_pos >= @arry_ips.length\n\tend", "def index\n \n @ip_jo...
[ "0.66371566", "0.6596373", "0.61871666", "0.6172259", "0.616404", "0.6148115", "0.6028361", "0.6011428", "0.59186774", "0.5909313", "0.58690965", "0.58351237", "0.5819356", "0.58111376", "0.5806595", "0.57783914", "0.57451355", "0.57383895", "0.57373255", "0.571526", "0.56981...
0.6818389
0
Public Methods callseq: Kconv.kconv(str, out_code, in_code = Kconv::AUTO) Convert str to out_code. out_code and in_code are given as constants of Kconv. Note This method decode MIME encoded string and convert halfwidth katakana to fullwidth katakana. If you don't want to decode them, use NKF.nkf.
def kconv(str, out_code, in_code = AUTO) opt = '-' case in_code when ::NKF::JIS opt << 'J' when ::NKF::EUC opt << 'E' when ::NKF::SJIS opt << 'S' when ::NKF::UTF8 opt << 'W' when ::NKF::UTF16 opt << 'W16' end case out_code when ::NKF::JIS opt ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_katakana(src)\n src\n .gsub(\"わ゙\",\"ヷ\")\n .gsub(\"い゙\",\"ヸ\")\n .gsub(\"え゙\",\"ヹ\")\n .gsub(\"を゙\",\"ヺ\")\n .tr(\"ぁ-ゖゝゞゟ\",\"ァ-ヶヽヾヿ\")\nend", "def toutf8(str)\n ::NKF::nkf('-wm', str)\n end", "def normalize!(string, options = {})\n unify_voiced_katakana!(string)\n normalize_charwid...
[ "0.6672627", "0.6035137", "0.60225886", "0.58952147", "0.58342874", "0.583078", "0.5820545", "0.5608768", "0.5592635", "0.5587364", "0.5504262", "0.5501117", "0.54515433", "0.54430974", "0.5441092", "0.53811884", "0.5379602", "0.53480047", "0.53326887", "0.53311425", "0.53265...
0.81049734
0
Encode to callseq: Kconv.tojis(str) > string Convert str to ISO2022JP Note This method decode MIME encoded string and convert halfwidth katakana to fullwidth katakana. If you don't want it, use NKF.nkf('jxm0', str).
def tojis(str) ::NKF::nkf('-jm', str) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tojis; Kconv.tojis(self) end", "def toutf8(str)\n ::NKF::nkf('-wm', str)\n end", "def tosjis; Kconv.tosjis(self) end", "def to_katakana(src)\n src\n .gsub(\"わ゙\",\"ヷ\")\n .gsub(\"い゙\",\"ヸ\")\n .gsub(\"え゙\",\"ヹ\")\n .gsub(\"を゙\",\"ヺ\")\n .tr(\"ぁ-ゖゝゞゟ\",\"ァ-ヶヽヾヿ\")\nend", "def kconv(str, out_co...
[ "0.708227", "0.6755341", "0.66166526", "0.6570429", "0.64216846", "0.63408977", "0.6247393", "0.615389", "0.61476034", "0.60412407", "0.6033712", "0.60058874", "0.5984637", "0.5964849", "0.59043354", "0.5874124", "0.5853941", "0.5785717", "0.5740667", "0.57272464", "0.5718444...
0.76257074
0
callseq: Kconv.toutf8(str) > string Convert str to UTF8 Note This method decode MIME encoded string and convert halfwidth katakana to fullwidth katakana. If you don't want it, use NKF.nkf('wxm0', str).
def toutf8(str) ::NKF::nkf('-wm', str) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_utf8(str)\n return Kconv.toutf8(str.strip)\n end", "def toutf8; Kconv.toutf8(self) end", "def to_utf8(str)\n if RUBY_VERSION == \"1.8.7\"\n str\n else\n str.force_encoding(Encoding::UTF_8.name)\n end\n end", "def to_utf8(str)\n str.encode(Encoding::UTF_8)\n en...
[ "0.8075774", "0.7412787", "0.67929983", "0.67686206", "0.67330045", "0.6707624", "0.6656892", "0.655789", "0.6537718", "0.6502155", "0.64538467", "0.6434924", "0.63885677", "0.63417566", "0.6299238", "0.6287334", "0.62757605", "0.6227602", "0.61906576", "0.61903065", "0.61630...
0.77158505
1
callseq: Kconv.toutf16(str) > string Convert str to UTF16 Note This method decode MIME encoded string and convert halfwidth katakana to fullwidth katakana. If you don't want it, use NKF.nkf('w16xm0', str).
def toutf16(str) ::NKF::nkf('-w16m', str) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_utf16(str)\n if str.respond_to?(:encode)\n str.encode('UTF-16BE')\n else\n Iconv.conv('UTF-16BE', 'UTF-8', str)\n end\n end", "def toutf16; Kconv.toutf16(self) end", "def get_utf16_of(character)\n character.encode('UTF-16BE').unpack('H*').first.up...
[ "0.8049237", "0.78257257", "0.7342039", "0.7328037", "0.7024019", "0.64593583", "0.62446725", "0.61012155", "0.59815633", "0.58657616", "0.5748576", "0.56195813", "0.5603677", "0.5586325", "0.5581748", "0.5555502", "0.55537474", "0.5509358", "0.54509634", "0.5442488", "0.5406...
0.86275566
0
guess callseq: Kconv.guess(str) > integer Guess input encoding by NKF.guess2
def guess(str) ::NKF::guess(str) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guess_old(str)\n ::NKF::guess1(str)\n end", "def score_string(guess)\n results = Array.new()\n guess.split('').each_with_index do |char, index|\n if char == @code[index]\n results[index] = :h\n elsif @code.include? char\n results[index] = :n\n else\n ...
[ "0.7673906", "0.64907783", "0.6242254", "0.62359", "0.6129248", "0.61051196", "0.6074401", "0.607052", "0.59913135", "0.59260213", "0.5920192", "0.58827853", "0.5854205", "0.5852523", "0.5802686", "0.579727", "0.5737099", "0.571667", "0.5707337", "0.5700339", "0.568195", "0...
0.7727014
0
callseq: Kconv.guess_old(str) > integer Guess input encoding by NKF.guess1
def guess_old(str) ::NKF::guess1(str) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guess(str)\n ::NKF::guess(str)\n end", "def guess_encoding(guesser = CharDet)\n Encoding.find(guesser.detect(self, :silent => true)[\"encoding\"])\n end", "def score_string(guess)\n results = Array.new()\n guess.split('').each_with_index do |char, index|\n if char == @code[index]\n...
[ "0.73427606", "0.6043232", "0.60032916", "0.59891504", "0.5946261", "0.59267485", "0.58515054", "0.5780548", "0.56909466", "0.55836755", "0.5577254", "0.55177957", "0.55114967", "0.5471276", "0.54660636", "0.54580706", "0.54511774", "0.54375833", "0.5425494", "0.54016185", "0...
0.81876945
0
callseq: Kconv.issjis(str) > obj or nil Returns whether input encoding is Shift_JIS or not. Note don't expect this return value is MatchData.
def issjis(str) RegexpShiftjis.match( str ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def issjis;\tKconv.issjis(self) end", "def tojis(str)\n ::NKF::nkf('-jm', str)\n end", "def sjis_to_jis(sjis)\n hi = (sjis >> 8) & 0xff\n lo = sjis & 0xff\n return lo if hi == 0\n hi -= (hi<=0x9f) ? 0x71 : 0xb1\n hi = hi * 2 + 1\n lo -= (lo > 0x7f) ? 1 : 0\n hi += (lo >= 0x9e) ? 1 : 0\n lo -= (lo >...
[ "0.7661919", "0.6343163", "0.6321212", "0.59379035", "0.58789", "0.5490069", "0.52220505", "0.4881004", "0.47428605", "0.46546423", "0.46505144", "0.4622918", "0.46080738", "0.46080738", "0.45883483", "0.4574256", "0.4567638", "0.45228842", "0.44611442", "0.44537628", "0.4451...
0.8358608
0
callseq: Kconv.isutf8(str) > obj or nil Returns whether input encoding is UTF8 or not. Note don't expect this return value is MatchData.
def isutf8(str) RegexpUtf8.match( str ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isutf8;\tKconv.isutf8(self) end", "def valid_utf8?(str)\n valid_utf8_bson?(str)\n end", "def is_utf8?\n case encoding\n when Encoding::UTF_8, Encoding::US_ASCII\n valid_encoding?\n when Encoding::ASCII_8BIT\n dup.force_encoding(Encoding::UTF_8).valid_encoding?\n else\n fa...
[ "0.80969024", "0.78433543", "0.78011835", "0.76702", "0.766819", "0.7629463", "0.7629463", "0.7285058", "0.7136782", "0.6962411", "0.67771316", "0.66091025", "0.64248896", "0.6385777", "0.63589907", "0.62616825", "0.62520456", "0.61481845", "0.61409163", "0.6046982", "0.60469...
0.80582535
1
to Encoding callseq: Stringtojis > string Convert self to ISO2022JP Note This method decode MIME encoded string and convert halfwidth katakana to fullwidth katakana. If you don't want it, use NKF.nkf('jxm0', str).
def tojis; Kconv.tojis(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tojis(str)\n ::NKF::nkf('-jm', str)\n end", "def to_katakana(src)\n src\n .gsub(\"わ゙\",\"ヷ\")\n .gsub(\"い゙\",\"ヸ\")\n .gsub(\"え゙\",\"ヹ\")\n .gsub(\"を゙\",\"ヺ\")\n .tr(\"ぁ-ゖゝゞゟ\",\"ァ-ヶヽヾヿ\")\nend", "def toutf8(str)\n ::NKF::nkf('-wm', str)\n end", "def decode_b(str)\n str.gsub!(/=\\?ISO-20...
[ "0.72973675", "0.6658342", "0.65902394", "0.65656745", "0.6443691", "0.6428121", "0.64044416", "0.6237717", "0.60328895", "0.6001594", "0.59991425", "0.5940418", "0.59331274", "0.59236026", "0.591415", "0.58946717", "0.5888195", "0.5881566", "0.5857376", "0.5840343", "0.58389...
0.6933535
1
callseq: Stringissjis > obj or nil Returns whether self's encoding is Shift_JIS or not. Note don't expect this return value is MatchData.
def issjis; Kconv.issjis(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def issjis(str)\n RegexpShiftjis.match( str )\n end", "def sjis_to_jis(sjis)\n hi = (sjis >> 8) & 0xff\n lo = sjis & 0xff\n return lo if hi == 0\n hi -= (hi<=0x9f) ? 0x71 : 0xb1\n hi = hi * 2 + 1\n lo -= (lo > 0x7f) ? 1 : 0\n hi += (lo >= 0x9e) ? 1 : 0\n lo -= (lo >= 0x9e) ? 0x7d : 0x1f\n return hi ...
[ "0.78617245", "0.63576937", "0.6075019", "0.5898598", "0.5733153", "0.5017433", "0.4953141", "0.4953141", "0.4833311", "0.4797285", "0.47745046", "0.47745046", "0.4661776", "0.46436983", "0.46217874", "0.45365956", "0.44326475", "0.44192865", "0.43909281", "0.43902507", "0.43...
0.7414598
1
callseq: Stringisutf8 > obj or nil Returns whether self's encoding is UTF8 or not. Note don't expect this return value is MatchData.
def isutf8; Kconv.isutf8(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_utf8?\n ActiveSupport::Multibyte::Handlers::UTF8Handler.consumes?(self)\n end", "def utf8?\n return true if encoding.nil?\n encoding == \"UTF-8\"\n end", "def utf8?\n return true if encoding.nil?\n encoding == \"UTF-8\"\n ...
[ "0.7808475", "0.77118534", "0.77118534", "0.7521071", "0.73302364", "0.7279393", "0.7240737", "0.692308", "0.69070244", "0.67988724", "0.6774854", "0.66129094", "0.6494309", "0.63954467", "0.6335002", "0.63066363", "0.6240951", "0.62139845", "0.61998117", "0.61885583", "0.617...
0.77797395
1
Whether the poll should be displayed.
def opinion_show_poll? begin !opinion_user.nil? rescue NoMethodError false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def none?\n self.display_on == \"none\"\n end", "def displayed?; end", "def visible?\n @visible\n end", "def visible?\n @visible\n end", "def visible?\n\t\t\t@visible\n\t\tend", "def visible?\n end", "def visible?; \n\t\t@visible = true if @visible == nil\n\t\t@visible\n\tend", "...
[ "0.6828312", "0.6826389", "0.67114335", "0.67114335", "0.6707115", "0.66168153", "0.65816414", "0.6580757", "0.6567434", "0.6566592", "0.654277", "0.6489286", "0.64805996", "0.64805996", "0.64805996", "0.64805996", "0.64422774", "0.6438991", "0.6374206", "0.6372065", "0.63672...
0.7540485
0
Create new favorite for current customer
def create fav_params = params.require(:favorite).permit(:content_id, :content_type) @favorite = Favorite.new(fav_params) @favorite.customer_id = current_person.user.id @favorite.save redirect_to request.referer end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def favorite\n\t\tclient = Client.find(params[:client_id])\n\t\tfavorite = Favorite.new(client_id: params[:client_id])\n\t\tcurrent_user.customer.favorites ||= []\n\t\tcurrent_user.customer.favorites << favorite\n\t\tredirect_to root_path, notice: \"Company added to favorites\"\n\tend", "def add_favorite options...
[ "0.8271767", "0.7489527", "0.7459689", "0.7435058", "0.7305186", "0.72869235", "0.7279919", "0.7273035", "0.7238405", "0.72163254", "0.71911955", "0.71271384", "0.70735866", "0.7070294", "0.70605356", "0.70605356", "0.70395124", "0.70105875", "0.70036817", "0.69478494", "0.69...
0.78577256
1
Reduce the land mass images generated from the Google Map tiles into tiles comprising of the square 2x2 of the parent tile. For example, 4 tiles from zoom level 2 will be used to create one tile at zoom level 1 This script assumes that all tiles at the maximum zoom level exist Option hash :limit_to => allows maximum nu...
def start(*options) limit_to = options[0][:limit_to].to_s if ( (options.length > 0) && (options[0].instance_of?(Hash)) ) overwrite = options[0].keys.include?(:overwrite) if ( (options.length > 0) && (options[0].instance_of?(Hash)) ) update_log_every = 100 tiles_processed = 0 tiles_limit ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_reduced_land_mass_image(x, y, zoom, accuracy_pixels, overwrite = false)\n land_mass_tile_path = LandMassTile.tile_path(x, y, zoom, accuracy_pixels)\n \n # exit if file already exists\n return false if (!overwrite && File.exists?(land_mass_tile_path))\n \n begin\n # build up square ...
[ "0.71161556", "0.61068445", "0.6008391", "0.5891905", "0.58417696", "0.5748425", "0.56101924", "0.55432343", "0.55327004", "0.53978735", "0.5359074", "0.5253409", "0.5205672", "0.5189787", "0.5148607", "0.513522", "0.51283264", "0.5098436", "0.509807", "0.5092467", "0.5091319...
0.63503176
1
Build land mass image from Google Map image Returns true if image created
def build_reduced_land_mass_image(x, y, zoom, accuracy_pixels, overwrite = false) land_mass_tile_path = LandMassTile.tile_path(x, y, zoom, accuracy_pixels) # exit if file already exists return false if (!overwrite && File.exists?(land_mass_tile_path)) begin # build up square of 4 childre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map_image(lat, long, width=500, height=400)\n \"http://maps.google.com/maps/api/staticmap?zoom=16&size=#{width}x#{height}&markers=#{lat},#{long}&sensor=false\"\n end", "def map_image location, width=500, height=275, zoom=15\n image_tag(\"http://maps.googleapis.com/maps/api/staticmap?center=#{location....
[ "0.65212107", "0.6318531", "0.60746366", "0.6005758", "0.5996662", "0.59701306", "0.59648114", "0.58217037", "0.5816226", "0.57740957", "0.57737017", "0.57700574", "0.5730569", "0.5672069", "0.5645524", "0.5635373", "0.56217074", "0.55699897", "0.5561187", "0.55515546", "0.55...
0.64696825
1
get x,y tiles for all tiles at maximum zoom level 1 down to zoom level 0 (1 tile)
def get_tiles tiles = [] accuracy_pixels_config = AppConfig.gmap_accuracy (0...AppConfig.gmap_max_zoom).reverse_each do |zoom| tiles_across = 2**zoom # the accuracy will go down by half at each zoom level with a floor of 1 i.e. 8 => 4, 7 => 2, 6 => 1, 5 => 1, 4 => 1 accuracy_pixels = (accu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def google_tile(tx, ty, zoom)\n [tx, (2**zoom - 1) - ty]\n end", "def tile_bounds(tx, ty, zoom)\n min_x, min_y = pixels_to_meters(tx * @tile_size, ty * @tile_size, zoom)\n max_x, max_y = pixels_to_meters((tx + 1) * @tile_size, (ty + 1) * @tile_size, zoom)\n [min_x, min_y, max_x, max_y]\n ...
[ "0.7280654", "0.70180815", "0.6971471", "0.68322015", "0.68322015", "0.6829012", "0.6770443", "0.6716278", "0.670656", "0.6472291", "0.6470912", "0.64243317", "0.6414456", "0.639209", "0.639209", "0.623337", "0.6219596", "0.6210064", "0.6206513", "0.62036145", "0.61381966", ...
0.78720015
0
returns all previously fetched entries; can be used to reprocess the events for, say, various historical analyses
def all_fetched_entries @entry_cache.all_entries end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entries\n @entries ||= each_entry.to_a\n end", "def fetch_entries\n entries.inject([]){ |all, entry| all << entry << addendas[entry] }.flatten.compact\n end", "def fetch_previous_entries\n batch_id = BatchRegistries.where(replay_name: @current_package.title).first.id\n BatchEn...
[ "0.6893237", "0.68743587", "0.6513726", "0.64541024", "0.6300125", "0.6283504", "0.6253153", "0.62425214", "0.62035984", "0.61733747", "0.616701", "0.6162796", "0.6152221", "0.6124355", "0.6108532", "0.60980844", "0.6086168", "0.60857993", "0.6068412", "0.6057965", "0.6057965...
0.7192802
0
Send points in batches of a hundred. I'm not sure exactly how much the API can cope with in a single call, so this might change.
def _send_point(body) body.each_slice(100) do |p| conn.post('/?f=wavefront', p.join("\n"), 'application/octet-stream') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_batch\n batch = @batch.map(&:first) # get the requests\n response = send_batch_request(batch)\n\n begin\n responses = JSON.parse(response)\n rescue\n raise Jimson::ClientError::InvalidJSON.new(json)\n end\n\n process_batch_response(responses)\n responses = ...
[ "0.61290437", "0.60472465", "0.5712649", "0.56227756", "0.56149447", "0.55629003", "0.5535943", "0.5477959", "0.5416563", "0.5410397", "0.5389276", "0.5386063", "0.53725266", "0.5363811", "0.53573585", "0.53545845", "0.5338584", "0.5328771", "0.5321805", "0.53210855", "0.5277...
0.6768508
0
Returns the primary file spec for self. This is used for reporting where we want a single file spec only. Uses the one with key :primary if present, otherwise a random one.
def primary_file_spec @file_specs[:primary] || @file_specs[@file_specs.keys.first] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def corresponding_primary_file\n return self if is_primary?\n\n cpct = corresponding_primary_content_type\n self.class.new(\n File.read(corresponding_primary_filename),\n cpct.language,\n corresponding_primary_filename,\n cpct\n )\n end", "def...
[ "0.7044957", "0.6303264", "0.61474293", "0.58819026", "0.5824097", "0.5817692", "0.5817692", "0.58163816", "0.5797509", "0.5704231", "0.56131697", "0.559982", "0.55916196", "0.556773", "0.5563159", "0.55624014", "0.55624014", "0.5524466", "0.55004084", "0.54994243", "0.549449...
0.88662577
1
Read browsers requirements from application config
def browsers(app) file = app.root.join('config/autoprefixer.yml') config = file.exist? ? YAML.load_file(file) : { 'browsers' => nil } config['browsers'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def browser_version\n ENV['BROWSER_VERSION']\n end", "def env_browser_name\n (ENV['BROWSER'] ||= 'firefox')\nend", "def browsers\n @browsers ||= @data[\"agents\"].keys.map{|b| PUBLIC_BROWSER_NAMES[b] }.sort\n end", "def browser_cmdline\n browser_env.each do |p|\n Launchy.log \"#{self.cla...
[ "0.60073966", "0.59629333", "0.59535635", "0.58589315", "0.57369584", "0.5692717", "0.56453407", "0.56441313", "0.5617939", "0.55933774", "0.55855405", "0.55812037", "0.5573661", "0.55695426", "0.5565853", "0.5520386", "0.55108476", "0.54708165", "0.53766215", "0.53762597", "...
0.6776741
0
Check if this block is valid, and appears after prev block
def after?(prev_block) (index - prev_block.index) == 1 && prev_block.time <= time && prev_block.hash == prev_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block_valid?(args = {})\n block = Block.find_by(id: args[:block_id])\n previous_block = block.previous_block\n neighbor_blocks_valid?(block, previous_block)\n end", "def valid_new_block?(new_block, previous_block)\n conditions = {\n (new_block.block_index != (previous_block.block_index + 1)...
[ "0.6610355", "0.64600044", "0.63057286", "0.62794924", "0.601952", "0.59391516", "0.59188473", "0.587369", "0.5873529", "0.58649486", "0.5832942", "0.5811153", "0.5779361", "0.5750054", "0.5728072", "0.5666664", "0.563097", "0.5600104", "0.5593506", "0.55910987", "0.556176", ...
0.70807743
0
The ID of the parent object
def parent_id object["parent_id"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parent_id\r\n return nil unless ar_object\r\n ar_object[ar_p]\r\n end", "def parent_id\n self.parent._id.to_s\n end", "def _parent_id\n send parent_column_name\n end", "def parent_id\n data[:parent_id]\n end", "def parent_id\n parent_ids.last\n ...
[ "0.8498718", "0.8495141", "0.8245423", "0.8177195", "0.8089715", "0.80414903", "0.79242724", "0.78445953", "0.78422195", "0.77200943", "0.76173955", "0.7470717", "0.7443227", "0.7436425", "0.74091744", "0.73936594", "0.73936594", "0.73936594", "0.73936594", "0.73807096", "0.7...
0.86632013
0
A value that indicates whether this object can be embedded
def is_embeddable? object["is_embeddable"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def embedded?\n @embedded == true\n end", "def embedded?\n false\n end", "def embedded?\n self.class.embedded?\n end", "def embedded?\n false\n end", "def allowed?\n true\n end", "def embedded?\n true\n en...
[ "0.70913744", "0.70547324", "0.70313805", "0.7007512", "0.6998188", "0.6970036", "0.69360363", "0.69360363", "0.6758669", "0.67512167", "0.66850674", "0.662582", "0.65062636", "0.65062636", "0.64918816", "0.64778477", "0.6449", "0.63562036", "0.62874985", "0.62709963", "0.626...
0.74746305
0
POST /dialogs POST /dialogs.json
def create @dialog = Dialog.new(dialog_params) respond_to do |format| if @dialog.save format.html { redirect_to @dialog, notice: 'Dialog was successfully created.' } format.json { render action: 'show', status: :created, location: @dialog } else format.html { render action: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @dialog = Dialog.new(dialog_params)\n\n respond_to do |format|\n if @dialog.save\n format.html { redirect_to @dialog, notice: 'Dialog was successfully created.' }\n format.json { render :show, status: :created, location: @dialog }\n else\n format.html { render :new...
[ "0.70405114", "0.64268047", "0.6369841", "0.6200411", "0.5840489", "0.57129604", "0.56838524", "0.5583967", "0.5543598", "0.55165863", "0.53946835", "0.5386971", "0.5373209", "0.5367648", "0.5350076", "0.5350076", "0.5350076", "0.5350076", "0.53438485", "0.534275", "0.5337176...
0.6973855
1
PATCH/PUT /dialogs/1 PATCH/PUT /dialogs/1.json
def update respond_to do |format| if @dialog.update(dialog_params) format.html { redirect_to @dialog, notice: 'Dialog was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @dialog.errors, status...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @dialog.update(dialog_params)\n format.html { redirect_to @dialog, notice: 'Dialog was successfully updated.' }\n format.json { render :show, status: :ok, location: @dialog }\n else\n format.html { render :edit }\n format.json { rend...
[ "0.6711888", "0.6221641", "0.61094123", "0.61021626", "0.60705394", "0.597629", "0.59345347", "0.59345347", "0.5899788", "0.5898362", "0.5882167", "0.5846475", "0.58138233", "0.57970893", "0.5794527", "0.5794527", "0.57880074", "0.5785946", "0.57852703", "0.57831985", "0.5783...
0.690267
0
DELETE /dialogs/1 DELETE /dialogs/1.json
def destroy @dialog.destroy respond_to do |format| format.html { redirect_to dialogs_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @dialog.destroy\n respond_to do |format|\n format.html { redirect_to dialogs_url, notice: 'Dialog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dialogue.destroy\n respond_to do |format|\n format.html { redirect_to dial...
[ "0.7144202", "0.6957655", "0.67515385", "0.67481536", "0.6690818", "0.66396296", "0.6588942", "0.6586188", "0.6555473", "0.6526668", "0.64984536", "0.6496319", "0.6484932", "0.6484932", "0.6475393", "0.6475393", "0.6475393", "0.6475393", "0.6474569", "0.64654595", "0.64654595...
0.7411259
0
Class is selected if listing type is currently selected
def get_new_listing_tab_class(listing_type) "new_listing_form_tab_#{@listing.listing_type.eql?(listing_type) ? 'selected' : 'unselected'}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_type_select_icon_class(category)\n \"listing_type_select_icon_#{@listing.category.eql?(category) ? 'selected' : 'unselected'}_#{category}\"\n end", "def get_listing_tab_class(tab_name)\n current_tab_name = params[:type] || \"list_view\"\n \"inbox_tab_#{current_tab_name.eql?(tab_name) ? 'selecte...
[ "0.6677346", "0.61910784", "0.61910784", "0.61910784", "0.60319775", "0.60249406", "0.60249406", "0.58472794", "0.5712906", "0.5561352", "0.5561352", "0.551788", "0.550998", "0.54952693", "0.54813576", "0.5461367", "0.54451317", "0.5444347", "0.5407138", "0.53911525", "0.5369...
0.70310605
0
Class is selected if category is currently selected
def get_type_select_icon_class(category) "listing_type_select_icon_#{@listing.category.eql?(category) ? 'selected' : 'unselected'}_#{category}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_category\n #Parbauda vai ekrans ir redzams\n @screens.screen_create_filter.visible?\n #Pievieno kategoriju no filtra datiem\n @screens.screen_create_filter.select_row(@filter_data.category)\n end", "def selected?; end", "def selected?; end", "def selected; end", "def selectCategory(...
[ "0.66410714", "0.600985", "0.600985", "0.59946895", "0.59726435", "0.5972357", "0.58467275", "0.5823109", "0.5822424", "0.5783398", "0.57212406", "0.5600886", "0.5572107", "0.5547639", "0.5541068", "0.5541068", "0.55362797", "0.55272615", "0.5481189", "0.54640514", "0.5458848...
0.644228
1
The classes the checkbox gets depend on to which categories its' share type belongs to.
def get_share_type_checkbox_classes(share_type) classes = "" Listing::VALID_CATEGORIES.each do |category| if Listing::VALID_SHARE_TYPES[@listing.listing_type][category] && Listing::VALID_SHARE_TYPES[@listing.listing_type][category].include?(share_type) classes += "#{category} " end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def custom_collect_class(cllt_type, resource)\n cllt_type == 'check_box' ? get_tag_class(resource.object.name) : resource.text\n end", "def get_type_select_icon_class(category)\n \"listing_type_select_icon_#{@listing.category.eql?(category) ? 'selected' : 'unselected'}_#{category}\"\n end", "def classe...
[ "0.6323129", "0.6007488", "0.5917209", "0.55293566", "0.5478942", "0.5374005", "0.529047", "0.52528554", "0.5248263", "0.5177959", "0.5177959", "0.51761925", "0.5149101", "0.5134327", "0.50972486", "0.5096677", "0.5091888", "0.5090738", "0.5084677", "0.50575995", "0.5053975",...
0.8373561
0
expects category_string to be "item", "favor", "rideshare" or "housing"
def localized_category_label(category_string) return nil if category_string.nil? category_string += "s" if ["item", "favor"].include?(category_string) return t("listings.index.#{category_string}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categories(str)\n raise NotImplementedError\n end", "def get_category_newsgroup(category)\n case category\n when \"sell\"\n \"tori.myydaan\"\n when \"buy\"\n \"tori.ostetaan\"\n when \"give\"\n \"tori.myydaan\"\n when \"lost\"\n \"tori.kadonnut\"\n when \"rides\"\n ...
[ "0.6675052", "0.6554733", "0.62667215", "0.62634283", "0.6251667", "0.61898476", "0.6129197", "0.6111593", "0.6038447", "0.6016033", "0.6002402", "0.5994601", "0.597574", "0.59210014", "0.59175265", "0.5908912", "0.5866291", "0.5859368", "0.5840229", "0.58114874", "0.5790943"...
0.6764951
0
returns an array of numbers each word corresponds to a code.
def generate_code(str) word_arr = str.split(" ") word_arr_simple = str.downcase.split(" ").each {|x| x.gsub!(/\W+/, '')} word_hash = {} counter = 1 word_arr_simple.each do |word| if word_hash[word] != nil else word_hash[word] = counter counter += 1 end end $new_array = [] word_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_code(codes)\n arr = []\n num = codes.scan(/\\d/).join('')\n str = codes.scan(/[a-zA-Z]+/)\n arr << str\n arr << num.to_i\n arr.flatten\nend", "def extract_code\n @original.chars.map do |c|\n @code.push c.to_i if c[/\\d+/]\n end\n end", "def codes\n ...
[ "0.7127428", "0.6868839", "0.6574209", "0.6448723", "0.6167941", "0.6123397", "0.600486", "0.5847377", "0.5833271", "0.5812114", "0.5800041", "0.57928276", "0.5792336", "0.57909817", "0.57486326", "0.57239693", "0.5693276", "0.56755674", "0.56707466", "0.5655128", "0.56320924...
0.6943731
1
DELETE /attachments/1 DELETE /attachments/1.json
def destroy @attachment = Attachment.find_by_name(params[:id]) @attachment.destroy respond_to do |format| format.html { redirect_to attachments_url } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @attachments = Attachment.find_by_id(params[:id])\n if @attachments.present?\n @attachments.destroy\n render :json=>{:response=>\"success\"}\n\t\tend\n end", "def destroy\n @attachment = Attachment.find(params[:id])\n @attachment.destroy\n\n respond_to do |format|\n f...
[ "0.7911042", "0.7847585", "0.78028", "0.78028", "0.78028", "0.76480836", "0.7554992", "0.7526424", "0.7526424", "0.7502131", "0.7484967", "0.74713784", "0.743854", "0.7387418", "0.7363765", "0.73254794", "0.73152685", "0.7279049", "0.72641194", "0.72299457", "0.72298086", "...
0.7915785
0
Method that calculates an attack against us by another set of attributes Returns true if we die, false otherwise
def attacked(attacker) attack = rand(2+attacker.agility)-rand(@agility) if attack>0 @health -= rand(attacker.strength) @game.message(self.name + " suffers " + attack.to_s + " damage!") end if self.health <= 0 return true else return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def battle(attacker, defender)\n if accuracy_check(attacker.accuracy) \n defender.hull - attacker.firepower\n else\n return false\n end\nend", "def under_attack \n return true if warrior.health < @health\n return false\n end", "def attack_effect(attacker)\n # Clear critical flag\n...
[ "0.7118146", "0.6769496", "0.67326003", "0.6707629", "0.65526336", "0.6523617", "0.6517811", "0.64987046", "0.64560974", "0.63728356", "0.63708013", "0.6298258", "0.6298258", "0.6248337", "0.62404156", "0.6232371", "0.61978626", "0.61903983", "0.61868703", "0.6182573", "0.617...
0.68720734
1
Adds an age unit to the creature. When it's too young or old, it should not be a very good fighter. During it's postpuberty, it may try to reproduce. If it grows too old, it will die. Returns false if it dies, true otherwise
def take_age @age += 1 @infertility -= 1 if @infertility > 0 @hunger += 1 if @age > @max_age return false end return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def age!\n @age < @max_age ? @age+=1 : @dead = true\n @height+=2 unless @height==20\n grow_fruit\n end", "def dead?\n @age >= 25\n end", "def levelup?\n if @monster.experience >= @monster.level**3\n @monster.level += 1\n @monster.turns = @monster.level\n @monster.health = 95+(5*...
[ "0.6399961", "0.63615847", "0.6212811", "0.60780495", "0.60689574", "0.60213107", "0.5997589", "0.595466", "0.5889478", "0.5887682", "0.5877463", "0.58593535", "0.5821057", "0.5795861", "0.5787952", "0.57857525", "0.5761596", "0.573856", "0.57152367", "0.56787217", "0.5670556...
0.718269
0
We consider the creature to be hungry when its hunger is superior to its max HP divided by two
def hungry? return (@hunger > @max_health/2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heal(h)\n if @health+h > @max_health\n @health = @max_health\n else\n @health += h\n end\n end", "def heal\n 2.times { super } # or self.helth = [self.helth + 2, MAX_HEALTH].min\n 'Ready for Battle!'\n end", "def heal!\n @health_remaining = @max_health\n end", "def hurt?\n\...
[ "0.75002056", "0.7095083", "0.7081408", "0.6958044", "0.69507575", "0.68810934", "0.6880237", "0.6843405", "0.68217933", "0.6779654", "0.6778553", "0.67660284", "0.67170787", "0.6700179", "0.66936404", "0.66322154", "0.66320914", "0.6614127", "0.6603931", "0.6598512", "0.6582...
0.75795424
0
The creature shall enter an infertility period
def enter_infertility @infertility = @p_o_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aide3()\n\n @indiceFortFlag = TRUE\n @timer.add(120)\n end", "def dead\r\n @energy < 0\r\n @gameover = true\r\n @timeout = true\r\n @time == 0\r\nend", "def encounter#instance method\n\n if !survive_attack?\n \"You died.\"\n elsif !outrun_zombie?\n \"You have been chased down.\"\...
[ "0.61666507", "0.6119798", "0.6045934", "0.59858143", "0.59858143", "0.5961142", "0.58706886", "0.5773955", "0.5705975", "0.57005566", "0.5657362", "0.5647225", "0.5645293", "0.56448597", "0.56198215", "0.5575726", "0.5540993", "0.55367315", "0.55191875", "0.5514104", "0.5503...
0.62831944
0
GET /request_templates GET /request_templates.json
def index @request_templates = RequestTemplate.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end", "def list\n @client.make_request :get, templates_path\n end", "def show\n redirect_to edit_request_path(@request) if current_user.admin? && @request.pending?\n @request_templates = Reque...
[ "0.73878103", "0.73573303", "0.7257521", "0.72427607", "0.7185743", "0.70785123", "0.7077442", "0.7074015", "0.68151075", "0.6721269", "0.6553466", "0.65324426", "0.65099543", "0.64859885", "0.6430347", "0.6420109", "0.63800323", "0.6360719", "0.63318795", "0.63074654", "0.62...
0.73790467
1
POST /request_templates POST /request_templates.json
def create @request_template = RequestTemplate.new(request_template_params) respond_to do |format| if @request_template.save respond format, 'Request template was successfully created.' else format.html { render :new } format.json { render json: @request_template.errors, sta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @request_templates = RequestTemplate.all\n end", "def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end", "def list\n @client.make_request :get, templates_path\n end", "def show\n redirect_to edit_request_path(@request) if curr...
[ "0.65851843", "0.64167845", "0.6336792", "0.6284566", "0.62101465", "0.6083735", "0.6068648", "0.6034663", "0.6013137", "0.59893763", "0.59628445", "0.59602255", "0.59482664", "0.5876555", "0.58422744", "0.57748574", "0.57510185", "0.57476985", "0.5728922", "0.5709782", "0.56...
0.67905277
0
PATCH/PUT /request_templates/1 PATCH/PUT /request_templates/1.json
def update respond_to do |format| if @request_template.update(request_template_params) respond format, 'Request template was successfully updated.' else format.html { render :edit } format.json { render json: @request_template.errors, status: :unprocessable_entity } end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_template_files(opts)\n template_id = opts.delete(:template_id)\n path = \"/template/update_files/#{template_id}\"\n prepare_files opts\n\n HelloSign::Resource::Template.new post(path, body: opts)\n end", "def set_request_template\n @request_template = RequestTemplat...
[ "0.629729", "0.6247277", "0.62214077", "0.61918956", "0.6136233", "0.609886", "0.6057968", "0.6029072", "0.60271925", "0.6007233", "0.6004755", "0.6003703", "0.59962213", "0.5988059", "0.59747094", "0.59622484", "0.594716", "0.5942636", "0.59343684", "0.5930996", "0.59290284"...
0.72079736
0
Returns a single translation status for the given project
def translation_status(project_id, status_id) c_r Lokalise::Resources::CustomTranslationStatus, :find, [project_id, status_id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trans_status_textual\r\n STATUSES[self['trans_status']]\r\n end", "def project_status\n\t\t@project = Project.find(params[:id])\n\n\t\trender 'projects/project_status'\n\tend", "def status_translations\n @status_translations ||= Assembla.statuses['ticket_statuses']\nend", "def create_transla...
[ "0.6844893", "0.6664638", "0.6339318", "0.63098574", "0.6105781", "0.6035228", "0.5992366", "0.59807795", "0.593065", "0.5915725", "0.5896544", "0.5891722", "0.5863265", "0.58352613", "0.5816226", "0.5814109", "0.58110774", "0.5767038", "0.57388294", "0.57296056", "0.5725027"...
0.81025016
0
Creates translation status inside the given project
def create_translation_status(project_id, params) c_r Lokalise::Resources::CustomTranslationStatus, :create, project_id, params end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_in_project(client, project: required(\"project\"), text: required(\"text\"), color: required(\"color\"), options: {}, **data)\n with_params = data.merge(text: text, color: color).reject { |_,v| v.nil? || Array(v).empty? }\n Resource.new(parse(client.post(\"/projects/#{project}/project_...
[ "0.6804595", "0.67013425", "0.65500647", "0.6343985", "0.62295705", "0.6156416", "0.61193246", "0.60826874", "0.6061255", "0.60582423", "0.60375607", "0.60368425", "0.6002224", "0.59719414", "0.5970482", "0.595719", "0.5935667", "0.59208035", "0.59108263", "0.5902242", "0.590...
0.82210314
0
Updates the given translation status inside the given project
def update_translation_status(project_id, status_id, params) c_r Lokalise::Resources::CustomTranslationStatus, :update, [project_id, status_id], params end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translation_status(project_id, status_id)\n c_r Lokalise::Resources::CustomTranslationStatus, :find, [project_id, status_id]\n end", "def edit_project(description, status)\n update!(description: description, status: status)\n end", "def create_translation_status(project_id, params)\n c_r L...
[ "0.6916143", "0.6741629", "0.6609215", "0.62971115", "0.6281249", "0.6244652", "0.62268203", "0.62059724", "0.61841774", "0.6163271", "0.6149499", "0.6109986", "0.61035675", "0.61026967", "0.61026967", "0.6099646", "0.6082145", "0.6034373", "0.5991403", "0.598226", "0.5966623...
0.81826407
0
Deletes translation status inside the given project
def destroy_translation_status(project_id, status_id) c_r Lokalise::Resources::CustomTranslationStatus, :destroy, [project_id, status_id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_translations\n end", "def destroy\n @project_status = ProjectStatus.find(params[:id])\n @project_status.destroy\n\n respond_to do |format|\n format.html { redirect_to(project_statuses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @project = AzProject.find(...
[ "0.70029676", "0.67618185", "0.67617273", "0.6732007", "0.67281353", "0.6712774", "0.6618373", "0.66147643", "0.6613793", "0.6609593", "0.6607866", "0.6600219", "0.65936816", "0.65766174", "0.6564709", "0.6532797", "0.65144646", "0.642646", "0.6416615", "0.6369575", "0.636551...
0.8149208
0
Returns an array of available colors that can be assigned to custom translation statuses
def translation_status_colors(project_id) c_r Lokalise::Resources::CustomTranslationStatus, :colors, [project_id, 'colors'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available_colors_translated\n colors_translated = {}\n Calendar::Event::COLORS.each do |color, hex|\n colors_translated[t(\"colors.#{color}\")] = hex;\n end\n colors_translated\n end", "def possible_colors\n %w(R G B Y)\n end", "def colorNames\n colors = [\"red\", \"ora...
[ "0.7453258", "0.7098631", "0.6880048", "0.68631685", "0.6662618", "0.6608648", "0.6596603", "0.656664", "0.65605634", "0.65172577", "0.65147156", "0.6432875", "0.63793206", "0.63533807", "0.6319983", "0.6305622", "0.6291686", "0.62278354", "0.62068564", "0.61579996", "0.61556...
0.77412397
0
makes a blast database from the query and the target
def makedb # check if the query is a nucleotide sequence query_file = Bio::FastaFormat.open(@query) query_file.each do |entry| raise "Query sequence looks like it's not nucleotide" if !entry.isNucl? end # check if the target is a nucl or prot seq target_file = Bio::FastaFormat.open(@targe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makedb\n # only scan the first few hundred entries\n n = 100\n # check if the query is a nucl or prot seq\n query_file = Bio::FastaFormat.open(@query)\n count_p=0\n count=0\n query_file.take(n).each do |entry|\n count_p += 1 if entry.isProt?\n count += 1\n ...
[ "0.76542264", "0.62342674", "0.6004211", "0.5931667", "0.57991505", "0.5712789", "0.5599148", "0.5586061", "0.5571026", "0.5544832", "0.55104125", "0.55101055", "0.54857016", "0.53862256", "0.53532094", "0.53528064", "0.5336783", "0.5306926", "0.5299666", "0.52707386", "0.527...
0.73802865
1
Checks if a charname exists for a given User
def exists?(user, charname) #TODO: Figure out why querying for user fails not Character.first(:user_id => user._id, :name => charname).nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def char_taken?(char)\n check_char = Character.find_by_name(char.name)\n if check_char == nil \n \"no_entry\"\n else\n if check_char.user_id == 0\n \"unassigned\"\n else\n check_char.user.name\n end\n end\n end", "def user_exists?(name)\n Etc.getpwnam(name).nam...
[ "0.7199486", "0.7026632", "0.6931521", "0.6828559", "0.6773235", "0.6740338", "0.67331254", "0.67331254", "0.6708668", "0.67040217", "0.6702168", "0.6701418", "0.6673328", "0.66070193", "0.6586637", "0.65844977", "0.6580599", "0.6556602", "0.6553824", "0.65457207", "0.651632"...
0.8671146
0
Checks if a character name is a reserved word
def reserved? charname ['create', 'list'].include? charname end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def carefull_name?(name)\n not !! (name =~ /\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}/)\nend", "def reserved_word?(str)\n RESERVED_WORDS.include?(str.downcase)\n end", "def identifier_char?(c)\n c =~ /[\\.a-zA-Z0-9_]/ ? true : false\n end", "def valid_name (name)\r\n /^\\w+$/.matc...
[ "0.6927531", "0.686184", "0.6846887", "0.6838027", "0.68100804", "0.6765642", "0.6752511", "0.6706572", "0.6697595", "0.6670274", "0.6651417", "0.6597012", "0.659397", "0.6545267", "0.6540057", "0.6538487", "0.6517937", "0.6443867", "0.6391634", "0.6381689", "0.63207966", "...
0.78915423
0
Determines how to display the invitation, depending on the invitation type. Options: :link_to_invitation will link to the invitee show page (for internal invitations) :expose_external_invitation_email will expose the external invitee's email (should only be exposed to sponsor)
def format_invitation(invitation, options = {}) expose_external_invitation_email = options.delete(:expose_external_invitation_email) || false link_to_invitation = options.delete(:link_to_invitation) || false if invitation.is_a? SurveyInvitation || NetworkInvitation then if link_to_invitation the...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invitation_url(type, employee)\n if type == :invite\n new_account_organization_invitation_path(current_account, current_organization, invitation: { employee_id: employee.id })\n else\n edit_account_organization_invitation_path(current_account, current_organization, employee.invitation)\n end...
[ "0.68081903", "0.65692526", "0.6463543", "0.634456", "0.6200775", "0.6004903", "0.599529", "0.5945305", "0.59146553", "0.59000784", "0.5894578", "0.5890768", "0.5882308", "0.58757615", "0.5873278", "0.5816881", "0.5806074", "0.58054644", "0.5804733", "0.5799731", "0.5790276",...
0.7751789
0
Auto links with links opening in a new window.
def auto_link_new_window(text) auto_link(text, :html => {:target => '_blank'}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def autolink(text)\n auto_link(text, :html => { :target => '_blank' })\n end", "def auto_pop_up_link(text, target, options, url = nil)\n link_to text, (url || '#'), {\n :class => \"auto_pop_up_link#{ \" #{options[:class]}\" if options[:class]}\", \n :title => options[:title], \n ...
[ "0.73316765", "0.62646824", "0.62419754", "0.61859185", "0.6129746", "0.6116993", "0.6114377", "0.6104605", "0.6089998", "0.60438794", "0.60173136", "0.60162044", "0.6000066", "0.6000066", "0.5998933", "0.5959792", "0.5959693", "0.59428495", "0.5940938", "0.59347", "0.5864641...
0.8422221
0
Determines the subdomain that should be used when creating a CS link for the organization Checks to see if the email address passed belongs to an uninitialized association member
def subdomain_for(params) organization = params[:organization] email = params[:email] organization = Organization.find_by_email(email) if email if organization && organization.association then organization.association.subdomain else '' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email_domain\n self.organization.email_domain\n end", "def email_domain\n if !self[:email].blank?\n split_host = URI.parse(\"#{self[:email]}\").path.split('@')\n \"#{split_host.last}\" if 2 == split_host.size\n else\n self.organization.site_domain if self.organization\n end\n res...
[ "0.6958954", "0.69572556", "0.6837677", "0.6816106", "0.68153965", "0.679085", "0.6783052", "0.6714236", "0.6680976", "0.66498625", "0.6596912", "0.6593131", "0.6574284", "0.65547556", "0.6538046", "0.6523232", "0.65048563", "0.6483532", "0.64826614", "0.64585835", "0.6445896...
0.7887933
0
determines how to display the association contact information based on what fields are available
def association_contact_information contact = "<a href='mailto: #{current_association.contact_email}'>#{current_association.contact_name.blank? ? current_association.name : current_association.contact_name}</a>" contact += " at #{current_association.formatted_contact_phone}" unless current_associatio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_contacts\n\n # HINT: Make use of this method in the display_all_contacts and search_by_attribute methods to keep your code DRY\n end", "def display_contacts\n\n # HINT: Make use of this method in the display_all_contacts and search_by_attribute methods to keep your code DRY\n end", "def dis...
[ "0.7142459", "0.7142459", "0.6882651", "0.67908657", "0.6738646", "0.6607511", "0.64317495", "0.63859105", "0.6362152", "0.634692", "0.6328542", "0.6311444", "0.6274218", "0.626543", "0.61689734", "0.61396945", "0.613674", "0.6133293", "0.6100573", "0.6086176", "0.60791934", ...
0.72065777
0
DELETE /artists/:artist_id/subscription/:id DELETE /users/:user_id/subscription/:id
def destroy @subscription.destroy respond_to do |format| format.html { redirect_to artist_subscription_path } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy \n Instagram.delete_subscription({:id => params[:id]})\n local_subscription = Subscription.find_by_original_id params[:id]\n local_subscription.destroy if local_subscription\n redirect_to :admin_subscriptions\n end", "def destroy\n @artist.destroy\n respond_to do |format|\n f...
[ "0.71585166", "0.7127667", "0.7106162", "0.70964944", "0.70713276", "0.7069454", "0.7045476", "0.7044647", "0.7041809", "0.7041801", "0.7041801", "0.7041801", "0.7041801", "0.7041557", "0.7011846", "0.7004748", "0.7003779", "0.70001084", "0.699246", "0.6980299", "0.69652104",...
0.8008545
0
Get associated subscription (two paths)
def lookup_subscription @subscription = if params.has_key?(:id) UserSubscription.find(params[:id]) else current_user.user_subscriptions.where(artist: @user).first end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_subscription subscription_name, options = {}\n subscriber.get_subscription subscription: subscription_path(subscription_name, options)\n end", "def subscription\n device = APN::Device.where(:subscriptions => {'$elemMatch' => { :_id => self.subscription_id }}).first\n device.subs...
[ "0.7095705", "0.70048296", "0.6807343", "0.6756315", "0.67531", "0.6704194", "0.6674504", "0.66607", "0.66307056", "0.6566782", "0.6546216", "0.6509602", "0.6486157", "0.6481763", "0.6481763", "0.6443684", "0.6433032", "0.63475186", "0.6336381", "0.6287016", "0.62773794", "...
0.70075405
1
Replaces existing query definition or registers new if not exists in the system with given queryName
def replace_query_definition(query_name, body, opts = {}) data, _status_code, _headers = replace_query_definition_with_http_info(query_name, body, opts) return data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addQueryName(theName)\n @metadata.addQueryName(theName)\n end", "def register_percolator_query(query_name, options = {})\n server.request(:put, percolator_query_path(query_name), nil, options)\n end", "def replace_query_definition_with_http_info(query_name, body, opts = {})\n if @api_clien...
[ "0.69548666", "0.63016075", "0.6243595", "0.62100554", "0.6203586", "0.5965975", "0.57209253", "0.5630554", "0.56028265", "0.55337507", "0.5507554", "0.5495231", "0.5403918", "0.53850263", "0.53686833", "0.5366283", "0.5349502", "0.53455186", "0.53083247", "0.5216415", "0.517...
0.6861961
1
Queries using query definition identified by queryName. Maps the result to concrete objects based on provided mapper.
def run_query(query_name, mapper, opts = {}) data, _status_code, _headers = run_query_with_http_info(query_name, mapper, opts) return data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_query_with_http_info(query_name, mapper, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomQueriesBPMApi.run_query ...\"\n end\n # verify the required parameter 'query_name' is set\n if @api_client.config.client_side_validation &&...
[ "0.6294075", "0.6183426", "0.5896972", "0.5798822", "0.5685007", "0.544019", "0.5319355", "0.5224888", "0.52176267", "0.5212605", "0.5209801", "0.5180315", "0.5123208", "0.50934714", "0.5091659", "0.5085034", "0.5085034", "0.50740755", "0.50318015", "0.50300777", "0.5011104",...
0.7422529
0
Queries using query definition identified by queryName. Maps the result to concrete objects based on provided mapper.
def run_query_with_http_info(query_name, mapper, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: CustomQueriesBPMApi.run_query ..." end # verify the required parameter 'query_name' is set if @api_client.config.client_side_validation && query_name....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_query(query_name, mapper, opts = {})\n data, _status_code, _headers = run_query_with_http_info(query_name, mapper, opts)\n return data\n end", "def run_query_filtered(query_name, mapper, opts = {})\n data, _status_code, _headers = run_query_filtered_with_http_info(query_name, mapper, op...
[ "0.7422529", "0.6183426", "0.5896972", "0.5798822", "0.5685007", "0.544019", "0.5319355", "0.5224888", "0.52176267", "0.5212605", "0.5209801", "0.5180315", "0.5123208", "0.50934714", "0.5091659", "0.5085034", "0.5085034", "0.50740755", "0.50318015", "0.50300777", "0.5011104",...
0.6294075
1
Queries using query definition identified by queryName. Maps the result to concrete objects based on provided mapper. Query is additional altered by the filter spec and/or builder
def run_query_filtered(query_name, mapper, opts = {}) data, _status_code, _headers = run_query_filtered_with_http_info(query_name, mapper, opts) return data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_query(query_name, mapper, opts = {})\n data, _status_code, _headers = run_query_with_http_info(query_name, mapper, opts)\n return data\n end", "def run_query_filtered_with_http_info(query_name, mapper, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug...
[ "0.7097004", "0.6756369", "0.63633746", "0.5915124", "0.5728005", "0.5716912", "0.57130307", "0.54632163", "0.53342247", "0.5326167", "0.5322422", "0.5305781", "0.52718717", "0.52591634", "0.52281404", "0.5193519", "0.51487064", "0.5137025", "0.5107997", "0.51018876", "0.5095...
0.698791
1
Returns a link to the current account management option create or show
def account_link return link_to I18n.t('user.show'), user_path(current_user) if current_user? link_to I18n.t('navigation.sign_up'), new_user_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_overview\n ::Liquid::Drops::Url.new(admin_account_path, 'Overview', '')\n end", "def admin_link\n admin_app_url(:host => CONSTANTS[:base_url_host], :offering => offering, :id => self)\n end", "def my_account_menu_link\n $tracer.trace(__method__)\n return ToolTag.new(a.classNam...
[ "0.62164557", "0.6179073", "0.6126623", "0.60785884", "0.6069009", "0.6066393", "0.60123086", "0.59928316", "0.5979095", "0.59702754", "0.59482783", "0.5910333", "0.5909117", "0.58749294", "0.5813938", "0.58120346", "0.57899845", "0.5786126", "0.5779666", "0.57669145", "0.574...
0.65996224
0
Pass many strings that will be include in the load path and require all ruby files in the specified dir
def load_paths=(dirs) dirs.each do |dir| directory = File.expand_path(dir) $LOAD_PATH.unshift(directory) unless $LOAD_PATH.include?(directory) Dir["#{directory}/*.rb"].each { |file| require file } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def require_all dir\n `ls #{dir}`.each_line do |file|\n require \"#{dir}/#{file.strip}\"\n end\nend", "def load_files(path)\n Dir[path].each {|file| require file}\nend", "def load_ruby_files(directory = '.')\n print \"Loading ruby files...\\n\\n\"\n files = `find #{directory} -type f -name '*.rb'`\n f...
[ "0.7451164", "0.7288219", "0.71746105", "0.71646607", "0.70494395", "0.70494395", "0.70494395", "0.70494395", "0.70494395", "0.70494395", "0.70494395", "0.70494395", "0.70494395", "0.70494395", "0.70494395", "0.70494395", "0.69871527", "0.69836235", "0.6956298", "0.6879192", ...
0.7348493
1
Perform all cascading deletes, destroys, or nullifies. Will delegate to the appropriate strategy to perform the operation.
def cascade! cascades.each do |name| if !metadata || !metadata.versioned? meta = relations[name] strategy = meta.cascade_strategy strategy.new(self, meta).cascade end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_cascade_on_associations\n # ensure all BQ data is cleaned up first\n self.delete_convention_data\n self.study_files.each do |file|\n DataArray.where(study_id: self.id, study_file_id: file.id).delete_all\n end\n Gene.where(study_id: self.id).delete_all\n CellMetadatum.where(study_i...
[ "0.6116815", "0.59378946", "0.5873705", "0.57567203", "0.5699463", "0.56989133", "0.56552595", "0.5633039", "0.5632568", "0.556307", "0.5531316", "0.5526761", "0.550779", "0.5497159", "0.549378", "0.549378", "0.5486672", "0.54841965", "0.5451491", "0.5448562", "0.5437481", ...
0.65323555
0
set locale for interface translating from current admin user
def set_locale I18n.locale = access_control.user.locale end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_locale\n I18n.locale = session[:admin_locale] = 'fr'\n end", "def set_locale\n I18n.locale = session[:admin_locale] = 'fr'\n end", "def set_locale\n # This requires a user model to work. I'm assuming there will be a \"current_user\" helper.\n # If we decide to use Devise, that will be def...
[ "0.8474383", "0.8474383", "0.8311592", "0.83046657", "0.82548475", "0.82160515", "0.81579983", "0.809985", "0.8067449", "0.8052016", "0.80170393", "0.79396313", "0.7939481", "0.7905847", "0.79028124", "0.78879565", "0.786118", "0.78127116", "0.78127116", "0.7800808", "0.77836...
0.853465
0
Notify the user of the backup operation results. `status` indicates one of the following: `:success` : The backup completed successfully. : Notification will be sent if `on_success` was set to `true` `:warning` : The backup completed successfully, but warnings were logged : Notification will be sent, including a copy o...
def notify!(status) name = case status when :success then 'Success' when :warning then 'Warning' when :failure then 'Failure' end message = '[Backup::%s]' % name send_message(message) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify!(status)\n name, color = case status\n when :success then ['Success', success_color]\n when :warning then ['Warning', warning_color]\n when :failure then ['Failure', failure_color]\n end\n message = \"[Back...
[ "0.8278428", "0.81858903", "0.79002845", "0.7889586", "0.717568", "0.66246635", "0.65507144", "0.6535309", "0.62342924", "0.5800433", "0.57868993", "0.57754713", "0.5775124", "0.57526803", "0.57137644", "0.56461227", "0.56210566", "0.5583124", "0.5565201", "0.5545352", "0.552...
0.8367057
0
get a class for each controller. This will be inserted as a class in the body tag.
def bodytag_class a = controller.class.to_s.underscore.gsub(/_controller$/, '').gsub(/\//, '-') "#{a}".gsub(/_/, '-') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def body_classes\n [controller.controller_name, controller.action_name].join(' ')\n end", "def body_class\n \"#{controller_name} #{action_name}\"\n end", "def body_css_class\n\t @body_css_classes ||= []\n\t view_css_class = [controller_path.split('/'), action_name, 'view'].flatten.join('-')\n...
[ "0.7761277", "0.7461699", "0.731144", "0.7213907", "0.7203787", "0.71533483", "0.7106747", "0.7050118", "0.7019383", "0.70045877", "0.6959391", "0.6845656", "0.6679478", "0.6662756", "0.6516676", "0.6367624", "0.63473815", "0.6293238", "0.6288641", "0.6274847", "0.62674886", ...
0.7681636
1
Selects messages from mailboxes then marking them with +flags+. If a block is given it is run after message marking. Unless :Noop was set, then it just prints out what it would do. Automatically called by IMAPClient::run
def run(message, flags) log message message_count = 0 mailboxes = find_mailboxes mailboxes.each do |mailbox| @mailbox = mailbox @imap.select @mailbox log "Selected #{@mailbox}" messages = find_messages next if messages.empty? message_count += messages.length ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark(messages, flags)\n messages.each_slice(500) do |chunk|\n @imap.store chunk, '+FLAGS.SILENT', flags\n end\n log \"Marked messages with flags\"\n end", "def run\n log \"Flagging tasty messages\"\n\n message_count = 0\n mailboxes = find_mailboxes\n\n mailboxes.each do |mailbox|\n...
[ "0.6881116", "0.6369226", "0.59382856", "0.5781145", "0.5588587", "0.54510194", "0.5292121", "0.52253366", "0.51770794", "0.5174547", "0.5079694", "0.5017648", "0.5015247", "0.49903208", "0.49552765", "0.48115832", "0.48081237", "0.4769843", "0.4767478", "0.47563472", "0.4742...
0.77104336
0
Connects to IMAP server +host+ at +port+ using ssl if +ssl+ is true then logs in as +username+ with +password+. IMAPClient will really only work with PLAIN auth on SSL sockets, sorry.
def connect(host, port, ssl, username, password, auth = nil) @imap = Net::IMAP.new host, port, ssl, nil, false log "Connected to #{host}:#{port}" if auth.nil? then auth_caps = @imap.capability.select { |c| c =~ /^AUTH/ } raise "Couldn't find a supported auth type" if auth_caps.empty? auth...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect(host = @options[:Host],\n port = @options[:Port],\n ssl = @options[:SSL],\n username = @options[:Username],\n password = @options[:Password],\n auth = @options[:Auth]) # :yields: Connection\n imap = Net::IMAP.new host, port, ssl, nil, ...
[ "0.7176973", "0.6581311", "0.6212626", "0.61302316", "0.61192966", "0.6048977", "0.59579426", "0.581526", "0.5681106", "0.56092703", "0.5598857", "0.5585831", "0.5579512", "0.55578923", "0.55496585", "0.53788626", "0.5363819", "0.5352832", "0.5330798", "0.53194284", "0.527399...
0.78387976
0
Finds mailboxes with messages that were selected by the :Boxes option.
def find_mailboxes mailboxes = @imap.list(@root, "*") if mailboxes.nil? then log "Found no mailboxes under #{@root.inspect}, you may have an incorrect root" return [] end mailboxes.reject! { |mailbox| mailbox.attr.include? :Noselect } mailboxes.map! { |mailbox| mailbox.name } @box...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_messages\n mailbox = @boxes.find { |box| @mailbox =~ /#{box}/ } # TODO: needs more work\n raise unless mailbox\n age = @cleanse[mailbox]\n before_date = (Time.now - 86400 * age).imapdate\n\n search [\n 'NOT', 'NEW',\n 'NOT', 'FLAGGED',\n 'BEFORE', before_date\n ], 'read, u...
[ "0.6662977", "0.6570647", "0.63797665", "0.63797665", "0.6059594", "0.6022075", "0.5973881", "0.5898137", "0.5675762", "0.56723934", "0.5640915", "0.555897", "0.5546591", "0.5534385", "0.55053604", "0.5480045", "0.54285777", "0.54090655", "0.54038024", "0.5403693", "0.5381436...
0.7471203
0
Searches for messages matching +query+ in the selected mailbox (see Net::IMAPselect). Logs 'Scanning for +message+' before searching.
def search(query, message) log " Scanning for #{message}" messages = @imap.search query log " Found #{messages.length} messages" return messages end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(query, &block)\n mailbox(get_right_box :all).search(query, &block)\n end", "def search_messages(options = {})\n raise ArgumentError, 'Required arguments :query missing' if options[:query].nil?\n if block_given?\n Pagination::Cursor.new(self, :search_messages, opt...
[ "0.68250227", "0.6796713", "0.6754854", "0.6514663", "0.64533526", "0.6420654", "0.633213", "0.61966133", "0.6152992", "0.61162645", "0.6069581", "0.6020681", "0.59750456", "0.59123677", "0.5904718", "0.58945495", "0.5879902", "0.5842571", "0.5825787", "0.57607925", "0.575007...
0.84486043
0
Marks +messages+ in the currently selected mailbox with +flags+ (see Net::IMAPstore).
def mark(messages, flags) messages.each_slice(500) do |chunk| @imap.store chunk, '+FLAGS.SILENT', flags end log "Marked messages with flags" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def markMail(imap, folder)\n pp \"MARKED #{folder}..\"\n message_ids = imap.uid_search(\"ALL\")\n imap.uid_store(message_ids, \"+FLAGS\", [:Seen])\n imap.expunge\nend", "def run(message, flags)\n log message\n\n message_count = 0\n mailboxes = find_mailboxes\n\n mailboxes.each do |mailbox...
[ "0.7403385", "0.6985612", "0.6520341", "0.6278484", "0.6079888", "0.60192335", "0.5938525", "0.5929803", "0.58774346", "0.5876065", "0.5719986", "0.5640212", "0.55904806", "0.5582521", "0.55778646", "0.5565348", "0.55587095", "0.54969263", "0.54630613", "0.54630613", "0.54388...
0.7488953
0
Reset the tracking of job executions.
def reset! executions.reset end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset\n @processed_job_ids = Set.new\n end", "def reset\n @jobexecution_dao.delete('je.job_execution_id': @queue.map(&:job_execution_id))\n @job_dao.delete(job_id: @jobs.map(&:id))\n @jobnet_dao.delete(jobnet_id: @jobnet.id)\n end", "def reset!\n @...
[ "0.7736411", "0.76488227", "0.68267167", "0.67323714", "0.66934985", "0.6565566", "0.65603065", "0.6537346", "0.6529518", "0.65283346", "0.6514642", "0.64965814", "0.6493098", "0.6465226", "0.6426591", "0.6360715", "0.6337814", "0.63360393", "0.6306765", "0.62928927", "0.6292...
0.8333738
0
Lookup storage class for a given options key
def lookup_storage(key) { memory: Storage::Memory, redis: Storage::Redis }[key] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def options_for_key(klass, key_name)\n DoesKeyValue.log(\"State: Querying options_for_key for class:#{klass.to_s} and key:#{key_name}\")\n key_def = (@keys[klass.to_s] || Array.new).find{|x| x[:name]==key_name.to_sym} || {}\n opts = key_def[:options]\n end", "def find(key)\n new(key: key, ...
[ "0.63969314", "0.621456", "0.61016005", "0.60994947", "0.5915228", "0.5910758", "0.58958244", "0.5893286", "0.5882253", "0.58746964", "0.5823028", "0.58201146", "0.57835674", "0.5744583", "0.5729365", "0.5724295", "0.56828845", "0.5619652", "0.5593931", "0.557526", "0.5558869...
0.7013423
0
Returns true if the system needs a reboot or is expected to reboot Note that we will silently miss any other platformspecific reboot notices besides Windows+Ubuntu.
def reboot_pending? # don't break when used as a mixin in contexts without #node (e.g. specs). if respond_to?(:node, true) && node.run_context.reboot_requested? true elsif platform?("windows") # PendingFileRenameOperations contains pairs (REG_MULTI_SZ) of filenames that canno...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reboot?\n !!@reboot\n end", "def booted?\n IO.popen([\"systemctl\", \"is-system-running\"], &:read).chomp != \"offline\"\n end", "def rebootable?\n return ((! self.phone_model.reboot_request_path.blank?) && (! self.ip_address.blank?))\n end", "def rebootable?\n\t\treturn (\n\t\t\t(! s...
[ "0.8150368", "0.7109402", "0.68908954", "0.6845607", "0.6690215", "0.6649649", "0.65636176", "0.6428496", "0.6424352", "0.6396949", "0.63483363", "0.6281973", "0.6275097", "0.62705183", "0.6260348", "0.6219535", "0.6199073", "0.6090886", "0.60894275", "0.60894275", "0.606515"...
0.7500692
1
GET /passwords/new GET /passwords/new.xml
def new @password = Password.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @password } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n resource = build_resource\n clean_up_passwords(resource)\n respond_with(resource, serialize_options(resource))\n end", "def create\n @password = Password.new(params[:password])\n\n respond_to do |format|\n if @password.save\n flash[:notice] = 'Password was successfully creat...
[ "0.63894254", "0.6375709", "0.62597334", "0.62486917", "0.62158316", "0.610603", "0.60975397", "0.6067552", "0.605343", "0.60152525", "0.59730095", "0.59646934", "0.59501183", "0.5931783", "0.5927788", "0.5913241", "0.59007305", "0.589568", "0.58935827", "0.5882246", "0.58764...
0.74518025
0
POST /passwords POST /passwords.xml
def create @password = Password.new(params[:password]) respond_to do |format| if @password.save flash[:notice] = 'Password was successfully created.' format.html { redirect_to(passwords_path) } format.xml { render :xml => @password, :status => :created, :location => @password } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_new_password(name)\n values = {\n name: name\n }\n @client.make_request :post,\n auth_path('request_new_password'),\n values\n end", "def set_password(opts = {})\n password(opts.merge(:verb => :post))\n end", "def ...
[ "0.6068599", "0.60035115", "0.59628624", "0.59448034", "0.5895309", "0.58103323", "0.5681038", "0.56606483", "0.5549036", "0.5524086", "0.55170894", "0.5500321", "0.5473855", "0.54644096", "0.54545057", "0.5451959", "0.5450218", "0.54493296", "0.5446402", "0.54262924", "0.539...
0.6287117
0
DELETE /passwords/1 DELETE /passwords/1.xml
def destroy @password = Password.find(params[:id]) @password.destroy respond_to do |format| format.html { redirect_to(passwords_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @password.destroy\n respond_to do |format|\n format.html { redirect_to passwords_url }\n format.json { head :no_content }\n end\n end", "def delete(context, name)\n res = context.transport.delete_request(context, \"security/users/#{name}\")\n\n context.err(name, res.body) ...
[ "0.6295106", "0.6156355", "0.6050771", "0.60501003", "0.5976177", "0.59415627", "0.59317946", "0.59114647", "0.588971", "0.5825659", "0.5807702", "0.58007574", "0.57900715", "0.5788657", "0.57840097", "0.5777547", "0.5772481", "0.576012", "0.573782", "0.57361627", "0.57289445...
0.67820287
0
Just word difference between the first and second half of a word Not really anagram
def word_diff return -1 unless (@word.size % 2 == 0) # initialize a hash with 26 lowercase alphabet character and set count for 0 word_hash = ('a'..'z').inject({}) {|h,c| h[c] = 0; h} # Increment count for first word len = @word.size / 2 @word[0..len-1].split("").each {|c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def second_anagram?(str_1, str_2)\n return false if str_1.length != str_2.length \n word_1 = str_1.chars\n word_2 = str_2.chars\n word_1.each_with_index do |char, idx| #\n idx_2 = word_2.find_index(char) \n if !idx_2.nil? #\n word_2.delete_at(idx_2) #m\n end\n end\n ...
[ "0.7132473", "0.7126409", "0.70953304", "0.7094452", "0.70440483", "0.7004377", "0.6986297", "0.6976105", "0.6944199", "0.6922921", "0.692022", "0.6911876", "0.6889321", "0.68606746", "0.6853448", "0.6844758", "0.68446684", "0.68432665", "0.6838505", "0.6834373", "0.68224996"...
0.71271855
1
Register the known input types for such a processor.
def _RegisterInputTypes @knownInputClasses.push(Rokuby::ProjectDescription) @knownInputClasses.push(Rokuby::ProjectConfiguration) @knownInputClasses.push(Rokuby::ProjectInstance) @knownInputClasses.push(Rokuby::VsProjectDescription) @knownInputClasses.push(Rokuby::VsProjectConfiguration) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _RegisterInputTypes\n @knownInputClasses.push(Rokuby::ProjectDescription)\n @knownInputClasses.push(Rokuby::ProjectConfiguration)\n @knownInputClasses.push(Rokuby::ProjectInstance)\n @knownInputClasses.push(Rokuby::GppProjectDescription)\n @knownInputClasses.push(Rokuby::GppProjectConf...
[ "0.7248186", "0.70079464", "0.61349016", "0.608289", "0.60565305", "0.6026795", "0.59526396", "0.5814985", "0.57171327", "0.5573388", "0.5551062", "0.55263644", "0.5521432", "0.5451655", "0.5423894", "0.5418293", "0.53842056", "0.537881", "0.5364725", "0.5359885", "0.53386736...
0.72125626
1
Time in years between BeginContract and Period.end
def years_of_service(period=nil) # TODO: need a real general purpose date diff by year # function since this is likely needed in multiple places. return 0 if contract_start.nil? period = Period.current if period.nil? if (period.finish > contract_start) tmp_date = period.finish count = 0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def years_count\n ((@end_date - @start_date).to_f / 365).to_f.round(1)\n end", "def end_year\n Time.now.year - 90\n end", "def get_begin_date\n get_end_date.prev_year\n end", "def years ; Duration[self * 365 * 86400, :years] ; end", "def calc_years_till\n (calc_months_till / 12.00).round(2...
[ "0.70306045", "0.6943798", "0.68555677", "0.6761447", "0.6695329", "0.6685416", "0.6632617", "0.65798104", "0.65458673", "0.6501599", "0.64775896", "0.64306146", "0.64249253", "0.64143413", "0.6328918", "0.62815076", "0.62363416", "0.6224437", "0.62092423", "0.61848634", "0.6...
0.6997837
1
Find out average number of hours per month based on the number of hours expected to work per day
def hours_per_month ((hours_day * days_week_to_i()) * WEEKS_IN_YEAR ).fdiv(MONTHS_IN_YEAR) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def work_per_month(ary_work)\n nary = ary_work.group_by{ |t| \n t[:date] \n }.transform_values { |tasks|\n tasks.reduce(0) { |sum, t|\n sum + t[:time] \n }\n }.to_a.group_by { |e|\n e[0][0..6]\n }.transform_values { |tasks|\n tasks.reduce(0) { |sum, t|\n ...
[ "0.68058556", "0.65134025", "0.64575714", "0.64242923", "0.6370657", "0.62075764", "0.60790074", "0.60242295", "0.6009189", "0.5961018", "0.59533054", "0.5938097", "0.59376955", "0.5915987", "0.5885641", "0.5884477", "0.5861767", "0.5859352", "0.5825722", "0.5796761", "0.5782...
0.7283312
0
Write the given ast to a string and returns it
def to_s(ast) @file = '' process(ast) @file end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ast; end", "def ast; end", "def inspect\n self.ast.to_s\n end", "def to_s\n PgQuery::Deparse.from ast\n end", "def inspect; to_ast.inspect end", "def dump_ast\n print_ast(@top_node, \"\")\n puts \"\"\n end", "def to_s\n StringIO.open do |buffer| # FIXME in RDF::Statement\n ...
[ "0.6575975", "0.6575975", "0.65392905", "0.65284336", "0.6398587", "0.6313835", "0.629045", "0.60831267", "0.5995759", "0.5972939", "0.5971942", "0.5971942", "0.5916045", "0.5868838", "0.5868838", "0.5849987", "0.58491004", "0.5847534", "0.5841547", "0.5839539", "0.58279616",...
0.7896145
0
POST /district_students POST /district_students.xml
def create @student = current_district.students.build(params[:student]) respond_to do |format| if @student.save flash[:notice] = "#{edit_obj_link(@student)} was successfully created.".html_safe format.html { redirect_to(index_url_with_page) } else format.html { render :actio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @district = District.new(params[:district])\n\n respond_to do |format|\n if @district.save\n flash[:notice] = 'District was successfully created.'\n format.html { redirect_to(@district) }\n format.xml { render :xml => @district, :status => :created, :location => @distr...
[ "0.6051043", "0.6018945", "0.60114187", "0.6004729", "0.5941816", "0.59369403", "0.5912328", "0.5904994", "0.58519346", "0.5834753", "0.5822872", "0.5810953", "0.58070296", "0.57837105", "0.5771113", "0.5764161", "0.5749433", "0.5728385", "0.57148653", "0.5708956", "0.5707696...
0.62399054
0
PUT /district_students/1 PUT /district_students/1.xml
def update @student = current_district.students.find(params[:id]) respond_to do |format| if @student.update_attributes(params[:student]) flash[:notice] = "#{edit_obj_link(@student)} was successfully updated.".html_safe format.html { redirect_to(index_url_with_page) } else fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n flash[:success] = t('student.updated')\n format.html { redirect_to(students_path) }\n format.xml { head :ok }\n else\n flash[:error] = t('def...
[ "0.65999484", "0.65223414", "0.6520604", "0.6509181", "0.64350975", "0.64350975", "0.64350975", "0.6429083", "0.6420107", "0.64090484", "0.63892967", "0.63090265", "0.629261", "0.6217182", "0.62101555", "0.62056375", "0.62056375", "0.62040377", "0.62040377", "0.62040377", "0....
0.6791229
0
DELETE /district_students/1 DELETE /district_students/1.xml
def destroy @student = current_district.students.find(params[:id]) @student.remove_from_district respond_to do |format| format.html { redirect_to(index_url_with_page) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @district = District.find(params[:id])\n @district.destroy\n\n respond_to do |format|\n format.html { redirect_to(districts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |forma...
[ "0.6762636", "0.6709687", "0.6709687", "0.6709687", "0.6709687", "0.6709687", "0.6709687", "0.66818243", "0.66232604", "0.6581956", "0.6573161", "0.6565127", "0.6514531", "0.6474491", "0.6458881", "0.64343095", "0.6402634", "0.6394218", "0.6387375", "0.6381286", "0.63591003",...
0.67999524
0
GET /evactivities/1 GET /evactivities/1.xml
def show @evactivity = Evactivity.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @evactivity } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activities\n get_call(\"1/activities.json\")\n end", "def activity(id)\n get(\"/activities/#{id}.json\")\n end", "def activity(id)\n get(\"/activities/#{id}.json\")\n end", "def activities(params = {})\n scope 'default'\n get('activities/', params)\n end", "def acti...
[ "0.7351188", "0.71314645", "0.71314645", "0.70323646", "0.68429315", "0.68257695", "0.67919326", "0.6781799", "0.67257005", "0.66720337", "0.6629581", "0.65464664", "0.64966106", "0.64431894", "0.6435166", "0.63953954", "0.6381463", "0.63732475", "0.63700044", "0.6361985", "0...
0.7229046
1
GET /evactivities/new GET /evactivities/new.xml
def new @evactivity = Evactivity.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @evactivity } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @today_activity = TodayActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @today_activity }\n end\n end", "def new\n @activity = Activity.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render...
[ "0.7294365", "0.7220735", "0.72131544", "0.72131544", "0.72131544", "0.7080277", "0.7013646", "0.70056605", "0.69765407", "0.6970709", "0.6862098", "0.68191683", "0.67986685", "0.67943275", "0.67650473", "0.6763463", "0.6763463", "0.67631245", "0.67413443", "0.673997", "0.673...
0.7709218
0
POST /evactivities POST /evactivities.xml
def create @evactivity = Evactivity.new(params[:evactivity]) respond_to do |format| if @evactivity.save flash[:notice] = 'Evactivity was successfully created.' format.html { redirect_to(@evactivity) } format.xml { render :xml => @evactivity, :status => :created, :location => @eva...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @activity = @user.activities.create(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Exercise event was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n ...
[ "0.6255689", "0.6192436", "0.583568", "0.57947034", "0.57549554", "0.57491106", "0.5717292", "0.5702986", "0.5659169", "0.5613048", "0.5596198", "0.5586512", "0.5584101", "0.55823994", "0.557413", "0.5558271", "0.5523054", "0.55002034", "0.549403", "0.5492629", "0.5470556", ...
0.67209995
0
PUT /evactivities/1 PUT /evactivities/1.xml
def update @evactivity = Evactivity.find(params[:id]) respond_to do |format| if @evactivity.update_attributes(params[:evactivity]) flash[:notice] = 'Evactivity was successfully updated.' format.html { redirect_to(@evactivity) } format.xml { head :ok } else format.ht...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n\n @title = Title.find(activity_params[:title_id])\n @event = Event.find(@title[:event_id])\n @activity = Activity.new(activity_params)\n @title.activities << @activity\n \n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to \"/events...
[ "0.6354809", "0.6318676", "0.6265058", "0.6138935", "0.6098074", "0.60712934", "0.6053803", "0.60464185", "0.59564817", "0.59441143", "0.5938981", "0.5910238", "0.59061784", "0.58936435", "0.5810343", "0.57765913", "0.5744259", "0.57358086", "0.57329607", "0.57205886", "0.571...
0.69408417
0
DELETE /evactivities/1 DELETE /evactivities/1.xml
def destroy @evactivity = Evactivity.find(params[:id]) @evactivity.destroy respond_to do |format| format.html { redirect_to(evactivities_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @today_activity = TodayActivity.find(params[:id])\n @today_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(today_activities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\...
[ "0.67443377", "0.67256325", "0.66694117", "0.66694117", "0.66694117", "0.66694117", "0.6667618", "0.6642356", "0.6613488", "0.65336293", "0.6502838", "0.6445771", "0.6426351", "0.63692576", "0.63592935", "0.635836", "0.6348664", "0.63441026", "0.6334772", "0.63179433", "0.627...
0.74623233
0