query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
TODO: Might want to allow specific versions of the gems in addition to their names
def load_gems(an_array_of_strings) print "Installing gems as necessary ... " if $debug gemfile do source 'https://rubygems.org' Array(an_array_of_strings).each do |gem_name| print gem_name + ' ' if $debug gem gem_name end end puts 'done' if $debug end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gems; end", "def gems; end", "def gems; end", "def version_constraint(gem_name); end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspecs; end", "def merge_gem(ge...
[ "0.7146048", "0.7146048", "0.7146048", "0.70495504", "0.69230133", "0.69230133", "0.69230133", "0.69230133", "0.69230133", "0.69230133", "0.69230133", "0.69230133", "0.6867758", "0.68503255", "0.6844531", "0.67740107", "0.6765926", "0.67566085", "0.674175", "0.6690752", "0.66...
0.0
-1
current_user Setter (similar to attr_writer)
def current_user=(user) @current_user = user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_user=(user) # assignment to current_user, method current_user= with arg as (user) \n\t@current_user = user \n end", "def current_user=(user) #This is the \"current_user=\" method which takes \"user\" as it's argument - See Listing 8.2.3 - special syntax for defining such an assignment function\n ...
[ "0.8386623", "0.835274", "0.8292259", "0.8255152", "0.82487124", "0.8246854", "0.82434285", "0.82212365", "0.82192814", "0.8188731", "0.8188731", "0.8188731", "0.8188731", "0.8188731", "0.8188731", "0.8188731", "0.8188731", "0.8188731", "0.8188731", "0.8188731", "0.8188731", ...
0.81675446
48
this is to support linking to documents which haven't get been published, but will be published within 5 seconds
def published_very_soon? Edition .scheduled .where("scheduled_publication <= ?", 5.seconds.from_now) .exists?(document_id: id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def published?; end", "def published?; end", "def publish!(current_time = Time.current)\n PublishPageJob.perform_later(id, public_on: current_time)\n end", "def changed_since_publication?\n return true unless on_flickr?\n\n last_updated > published_at + 1.second\n end", "def no_spamming\n ...
[ "0.60099053", "0.60099053", "0.5798468", "0.5692947", "0.5530894", "0.54855776", "0.5475899", "0.54628366", "0.5447674", "0.54242545", "0.5402708", "0.5384268", "0.5369184", "0.5363765", "0.5356312", "0.53371483", "0.53370637", "0.53298306", "0.5324341", "0.5321073", "0.53082...
0.6128061
0
Use callbacks to share common setup or constraints between actions.
def set_banner @banner = Banner.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a trusted parameter "white list" through.
def banner_params params.require(:banner).permit(:image_url, :name, :link_url, :description, :banner_type_id, :user_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.71217275", "0.7052942", "0.6947555", "0.6903013", "0.6735074", "0.67167085", "0.6687677", "0.66765445", "0.66602796", "0.65548825", "0.6524274", "0.6455697", "0.6451343", "0.645123", "0.64465624", "0.6433475", "0.64118403", "0.64118403", "0.6390524", "0.6378871", "0.637887...
0.0
-1
one or more query args
def or( *args ); { $or => args } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_params=(_arg0); end", "def update!(**args)\n @query = args[:query] if args.key?(:query)\n end", "def update!(**args)\n @query = args[:query] if args.key?(:query)\n end", "def url *args\n if args.first\n Url.current.qs(*args)\n else\n U...
[ "0.6945981", "0.6563754", "0.6563754", "0.65182006", "0.6513487", "0.6498599", "0.6463222", "0.64526814", "0.64526814", "0.6423105", "0.6358332", "0.63409734", "0.6276685", "0.62659097", "0.6240446", "0.62185264", "0.62126017", "0.62086713", "0.61908495", "0.61522883", "0.615...
0.0
-1
one or more query args
def nor( *args ); { $nor => args } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_params=(_arg0); end", "def update!(**args)\n @query = args[:query] if args.key?(:query)\n end", "def update!(**args)\n @query = args[:query] if args.key?(:query)\n end", "def url *args\n if args.first\n Url.current.qs(*args)\n else\n U...
[ "0.6945981", "0.6563754", "0.6563754", "0.65182006", "0.6513487", "0.6498599", "0.6463222", "0.64526814", "0.64526814", "0.6423105", "0.6358332", "0.63409734", "0.6276685", "0.62659097", "0.6240446", "0.62185264", "0.62126017", "0.62086713", "0.61908495", "0.61522883", "0.615...
0.0
-1
one or more query args
def not( arg ); { $not => arg } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_params=(_arg0); end", "def update!(**args)\n @query = args[:query] if args.key?(:query)\n end", "def update!(**args)\n @query = args[:query] if args.key?(:query)\n end", "def url *args\n if args.first\n Url.current.qs(*args)\n else\n U...
[ "0.6945981", "0.6563754", "0.6563754", "0.65182006", "0.6513487", "0.6498599", "0.6463222", "0.64526814", "0.64526814", "0.6423105", "0.6358332", "0.63409734", "0.6276685", "0.62659097", "0.6240446", "0.62185264", "0.62126017", "0.62086713", "0.61908495", "0.61522883", "0.615...
0.0
-1
single query argument only REGEX EXPRESSION
def rx(pattern, *qualifiers) r = { $regex => pattern } qualifiers.each {|q| r.merge!(q)} r end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regexp=(_arg0); end", "def regexp; end", "def regexp; end", "def match_query(query); end", "def db_string_regex(type)\n \"--#{type}='?([a-zA-Z0-9!@\\#$%^&*-=+]+)'?\\s\"\nend", "def query( query )\n query.downcase!\n case query\n when /^:r:/ then query_regexp query.gsub(/^:r:/, '')\n when...
[ "0.6850321", "0.66515607", "0.66515607", "0.65931064", "0.65792364", "0.6371894", "0.63537276", "0.63537276", "0.6261565", "0.6256756", "0.6168645", "0.6167046", "0.6086029", "0.60780025", "0.606317", "0.60428166", "0.6032823", "0.6026284", "0.5986315", "0.59667206", "0.59667...
0.0
-1
GET /meritbadges/1 GET /meritbadges/1.xml
def show @meritbadge = Meritbadge.find(params[:id]) # @requirements = Requirement.find_all_by_meritbadge_id(params[:id]) @requirements = ScouterMeritbadges.find_by_meritbadge_id_and_scouter_id(params[:id], current_scouter) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @meritbadge } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @badge = Badge.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @badge }\n end\n end", "def index\n respond_to do |format|\n format.html { render_template } # index.html.erb\n format.xml { render xml: @badges }\n ...
[ "0.6807002", "0.67914253", "0.67023546", "0.66645074", "0.66372997", "0.65869355", "0.64991987", "0.6419964", "0.6370848", "0.61633366", "0.61053044", "0.6067279", "0.594563", "0.59016097", "0.58613956", "0.5845339", "0.58339494", "0.57819206", "0.57422364", "0.5738378", "0.5...
0.60555875
12
GET /meritbadges/new GET /meritbadges/new.xml
def new @meritbadge = Meritbadge.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @meritbadge } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @badge = Badge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @badge }\n end\n end", "def new\n @badge = Badge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @badge }\n end\n ...
[ "0.7895689", "0.728731", "0.7106795", "0.7097692", "0.7087708", "0.7043732", "0.6933522", "0.6862122", "0.6858908", "0.6838625", "0.68361115", "0.6795957", "0.6785452", "0.67755395", "0.677269", "0.67245364", "0.6706276", "0.67058474", "0.66972893", "0.6681884", "0.6681884", ...
0.79703856
0
POST /meritbadges POST /meritbadges.xml
def create @meritbadge = Meritbadge.new(params[:meritbadge]) respond_to do |format| if @meritbadge.save format.html { redirect_to(@meritbadge, :notice => 'Meritbadge was successfully created.') } format.xml { render :xml => @meritbadge, :status => :created, :location => @meritbadge } else format.html { render :action => "new" } format.xml { render :xml => @meritbadge.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @badge = Badge.new(params[:badge])\n\n respond_to do |format|\n if @badge.save\n flash[:notice] = 'Badge was successfully created.'\n format.html { redirect_to organization_segment_badge_url(@organization, @segment, @badge) }\n format.xml { render :xml => @badge, :sta...
[ "0.6467544", "0.62444633", "0.62402076", "0.61709225", "0.6096838", "0.5934599", "0.5841155", "0.57675755", "0.55995065", "0.55966574", "0.5592986", "0.5532006", "0.5520978", "0.5483995", "0.54759586", "0.5458158", "0.54496646", "0.543881", "0.54207", "0.54123706", "0.5378502...
0.6848053
0
PUT /meritbadges/1 PUT /meritbadges/1.xml
def update @meritbadge = Meritbadge.find(params[:id]) respond_to do |format| if @meritbadge.update_attributes(params[:meritbadge]) format.html { redirect_to(@meritbadge, :notice => 'Meritbadge was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @meritbadge.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @badge = Badge.find(params[:id])\n respond_to do |format|\n if @badge.update_attributes(params[:badge])\n flash[:notice] = 'Badge was successfully updated.'\n format.html { redirect_to organization_segment_badge_url(@organization,@segment, @badge) }\n format.xml { hea...
[ "0.7060702", "0.6700735", "0.66110116", "0.65699905", "0.6471246", "0.60722655", "0.5916678", "0.59036523", "0.58616453", "0.58616453", "0.58616453", "0.5834647", "0.58337355", "0.579756", "0.5751719", "0.5751719", "0.5713504", "0.5692206", "0.5676312", "0.5674642", "0.566613...
0.7052432
1
DELETE /meritbadges/1 DELETE /meritbadges/1.xml
def destroy @meritbadge = Meritbadge.find(params[:id]) @meritbadge.destroy respond_to do |format| format.html { redirect_to(meritbadges_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to(organization_segment_badges_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |fo...
[ "0.72764754", "0.71850234", "0.7118867", "0.7032155", "0.66948384", "0.6673091", "0.65397954", "0.6480118", "0.6313315", "0.631105", "0.630555", "0.6301216", "0.62981385", "0.6290999", "0.6196758", "0.6195093", "0.6183383", "0.61586386", "0.6155658", "0.6132766", "0.60993433"...
0.7402945
0
Use callbacks to share common setup or constraints between actions.
def set_result @result = Result.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a list of trusted parameters through.
def result_params params.require(:result).permit(:result_data, :enquete_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
instantiates all artist objects for rendering in right column
def get_artist_objects_for_right_column artist, for_home_page = false begin @artist_musics = artist.limited_artist_musics(for_home_page) @photo_albums = artist.limited_artist_albums(for_home_page, 2) @artist_music_count = @artist_musics.size @photo_album_count = @photo_albums.size @has_admin_access = @actor == artist @show_count = artist.upcoming_shows_count @artist_member_count = artist.artist_members.size @artist_fan_count = artist.followers_count @artist_connection_count = artist.connections_count @featured_songs = artist.limited_artist_featured_songs @artist_shows = artist.limited_artist_shows @artist_members = artist.limited_artist_members @artist_fans = artist.limited_followers @connected_artists = artist.connected_artists rescue =>exp logger.error "Error in Application::GetArtistObjectsForRightColumn :=> #{exp.message}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def artist()\n sql = \"SELECT * FROM artists WHERE id = $1\"\n values = [@artist_id]\n artists = SqlRunner.run(sql, values)\n result = artists.map {|artist| Artist.new(artist)}\n return result\n end", "def artists\n super.map do |artist|\n Spotify::SDK::Artist.new(artist, parent)\...
[ "0.6325042", "0.6269698", "0.62411284", "0.6199255", "0.61940205", "0.61755514", "0.60743994", "0.6036598", "0.60176826", "0.59942967", "0.5950292", "0.5932699", "0.5920566", "0.58802366", "0.58780426", "0.5876717", "0.587148", "0.5843", "0.5835382", "0.5818706", "0.58014053"...
0.645142
0
instantiates all venue objects for rendering in right column
def get_venue_objects_for_right_column venue, for_home_page = false begin @has_admin_access = @actor == venue @photo_albums = venue.limited_albums(for_home_page, 2) @photo_album_count = @photo_albums.size @show_count = venue.upcoming_shows_count @fan_count = venue.followers_count @shows = venue.limited_shows @fans = venue.limited_followers rescue =>exp logger.error "Error in Application::GetVenueObjectsForRightColumn :=> #{exp.message}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_values\n get_venues.each do |post|\n venue = Venue.new\n venue.name = post.css(\"h3 > a\").text\n venue.area = post.css(\"p:eq(1)\").text\n venue.hours = post.css(\"p:eq(2)\").text\n venue.description = post.css(\"p:eq(4)\").text\n binding.pry\n end\n end", "def in...
[ "0.6375899", "0.6232598", "0.60996926", "0.6023361", "0.6002287", "0.599667", "0.5888162", "0.5841004", "0.57848364", "0.5772576", "0.5764265", "0.57503664", "0.5730896", "0.57285666", "0.5720278", "0.5691194", "0.5647604", "0.5625004", "0.5624067", "0.5622957", "0.5611181", ...
0.62360185
1
checks for loggedin useriem(artist/venue) and if not present returns current user
def current_actor begin if (class_name=session[:useritem_type]).present? and (id=session[:useritem_id]).present? @actor = eval(class_name).find(id) else @actor = current_user end rescue =>exp logger.error "Error in CurrentActor :=> #{exp.message}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_user\n User.find_by({ id: session[:user_id] }) || Artist.find_by({ id: session[:artist_id] })\n end", "def current_user\n if Artist.find_by_id(session[:artist_id])\n @current_user ||= Artist.find_by_id(session[:artist_id]) if session[:artist_id]\n elsif Organization.find_by_id(session[...
[ "0.78718215", "0.7779183", "0.72997576", "0.7195714", "0.7137502", "0.71222395", "0.70862776", "0.7049851", "0.6993298", "0.6970255", "0.6969764", "0.6957513", "0.69427437", "0.6932221", "0.69223046", "0.6910452", "0.69003344", "0.68957317", "0.6887035", "0.68826556", "0.6873...
0.0
-1
sets the current user item id(switch to user item profile like artist, venue)
def set_current_useritem useritem session[:useritem_id] = useritem.id session[:useritem_type] = useritem.class.name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_item\n @item = current_user.items.find(params[:id])\n end", "def set_item\n @item = current_user.items.find(params[:id])\n end", "def set_item\n @item = current_user.items.find(params[:id])\n end", "def set_item\n @item = current_user.items.find(params[:id])\n end", "def...
[ "0.800709", "0.800709", "0.800709", "0.7919911", "0.7527381", "0.73651046", "0.7201023", "0.7197031", "0.71211284", "0.70586646", "0.70586646", "0.70586646", "0.7016697", "0.6995752", "0.68949485", "0.68402445", "0.67726386", "0.67231876", "0.67084396", "0.6683857", "0.666186...
0.76046824
4
removes the current user item id(switch back to fan profile)
def reset_current_useritem session[:useritem_id] = nil session[:useritem_type] = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_item\n\tsaved = current_user.saved\n\titem = saved.items.find(params[:item])\n saved.items.delete(item)\n redirect_to :back\n\tend", "def destroy\n \t@user = User.find(params[:user_id])\n \t@item = @user.items.find(params[:id])\n \t@item.destroy\n \tredirect_to @user\n \tend", "de...
[ "0.70153975", "0.6920236", "0.6716234", "0.6707282", "0.6645206", "0.65835464", "0.6533365", "0.6512473", "0.6482205", "0.64532816", "0.6422977", "0.63822365", "0.6366511", "0.63431704", "0.63275623", "0.6322994", "0.6266936", "0.623708", "0.6235554", "0.6231363", "0.62303555...
0.7365805
0
added to restrict the site from anonymous access
def http_basic_authenticate authenticate_or_request_with_http_basic do |username, password| username == "mustang" && password == 'mustang' #"must@ngs0undm3l0n" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restrict_anonymous_access\n return unless current_user.nil?\n\n handle_http_401(t('application.errors.restricted_access'))\n end", "def restrict_access\n head :unauthorized and return false unless current_user\n end", "def restrict_access\t\n\t\tif current_user.owner == false\n\t\t\tredirect_to ...
[ "0.7845366", "0.7786535", "0.752278", "0.7383711", "0.7279264", "0.70562273", "0.70510423", "0.7039989", "0.6970149", "0.6911217", "0.6903905", "0.68878454", "0.68395585", "0.68145525", "0.6802921", "0.6789178", "0.6783014", "0.67349505", "0.67293847", "0.67062664", "0.668233...
0.0
-1
helper func in status 3
def find_poll_addr(message_addr) uri = URI.parse('https://www.googleapis.com/civicinfo/v2/voterinfo?address=' + \ message_addr + '&electionId=2000&key=' + ENV["GOOGLE_API_KEY"]) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Get.new(uri.request_uri) response = http.request(request) res_hash = JSON.parse(response.body) address_hash = res_hash['pollingLocations'][0]['address'] locationName = address_hash['locationName'] line1 = address_hash['line1'] || "" line2 = address_hash['line2'] || "" line3 = address_hash['line3'] || "" return "We found the closest polling location to you:\n" + locationName+line1+line2+line3 + "\n" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status(*) end", "def private; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def probers; end", "def suivre; end", "def status_effect; end", "def custom...
[ "0.66783226", "0.6527302", "0.6439539", "0.6439539", "0.6439539", "0.6439539", "0.6439539", "0.6439539", "0.6439539", "0.6439539", "0.6439539", "0.6382768", "0.6306741", "0.62294143", "0.6218227", "0.6218227", "0.611444", "0.60570574", "0.6028253", "0.6025361", "0.6025361", ...
0.0
-1
Day 2: op codes
def parse_input(input_file); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ord(day)\n\nend", "def day() end", "def cwday\n end", "def yday() end", "def day; end", "def yday\n end", "def op_code\n 2002\n end", "def w_day; end", "def day=(_arg0); end", "def day\n end", "def op_code\n 2004\n end", "def wday() end", "def result(day)\n ...
[ "0.6482918", "0.6241792", "0.6132691", "0.60208154", "0.59965605", "0.5995656", "0.59619784", "0.59547377", "0.58266705", "0.58170474", "0.57775", "0.5717483", "0.5710482", "0.5670838", "0.56505424", "0.55530334", "0.55461603", "0.55342007", "0.55195963", "0.55059403", "0.544...
0.0
-1
Return 1 if not reachable, return depth if reachable
def search(other = 'SAN', cost = -2) return cost if @name == other return -1 if @searched @searched = true @children.each do |child| d = child.search(other, cost + 1) return d if d != -1 end @parent.search(other, cost + 1) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def depth\n if empty?\n 0\n else\n if @left==nil || @right==nil\n if (@left==nil&&@right==nil) then 1\n else -1\n end\n else\n left, right = @left.depth, @right.depth\n if left==-1||right==-1||left!=right then -1\n else 1+left\n end\n end\n...
[ "0.7106869", "0.6948148", "0.6913469", "0.68522567", "0.68028563", "0.67921066", "0.6782934", "0.6760673", "0.67577994", "0.6755805", "0.6735536", "0.6734407", "0.67092323", "0.66820556", "0.66781145", "0.66781145", "0.65971714", "0.6584824", "0.65635717", "0.6512745", "0.650...
0.0
-1
Check if the current date is a holiday. Returns true or false. Date.civil('20080101').holiday?(:ca) => true
def holiday?(*options) holidays = self.holidays(options) holidays && !holidays.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def holiday?\n @holiday\n end", "def public_holiday?\n HOLIDAYS.include? to_date\n end", "def today_holiday?(issue)\n day = Date.today\n check_holiday(day, issue)\n end", "def is_a_2014_bank_holiday?(date)\nend", "def is_a_2014_bank_holiday?(date)\nend", "def business_day?\n ...
[ "0.8339427", "0.8088759", "0.8062158", "0.788005", "0.788005", "0.78043735", "0.780186", "0.78001785", "0.77290857", "0.76779425", "0.7659887", "0.7604297", "0.7438477", "0.7415547", "0.7378318", "0.736215", "0.728039", "0.7263016", "0.7262411", "0.7204585", "0.70653516", "...
0.72027934
20
input_text The string to be encrypted. offset Integer to define how much text will be encrypted. Examples encrypt('hello', 3) => 'KHOOR' Returns the input_text encrypted. Raises error if input_text = '' Raises error if offset = 0
def encrypt(input_text, offset) # Error messages for: empty strings & offset == 0. raise ArgumentError, 'String must not be empty' if input_text == '' raise ArgumentError, 'Offset must not be zero' if offset == 0 # Makes the input text uppercase letters only. input_text = input_text.upcase # Will hold all letters from input_text. text_list = [] # Defines each letter with a number using index. letter_index = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] # The encrypted text goes here. encrypted_text = '' # Stopping infinite loops. counter = 0 # Sends each character in the input text in to their own element in an array(text_list). while counter < input_text.length text_list << input_text[counter] counter += 1 end # Resets the counter. counter = 0 # Goes through each character in the list. while counter < text_list.size # Resets the new_letter. new_letter = '' # Goes through the alphabet for comparison reasons. letter_index.each { |x| # Error message for: current element in array == nil. raise ArgumentError, 'Element must not be nil' if text_list[counter] == nil # Checks if current element in text_list is = to currently selected letter in the alphabet. if text_list[counter] == x # Declares a temporary variable to hold the new offset. temp = letter_index.index(text_list[counter]) + offset # Makes sure that the offset for a new letter isn't a value that is bigger than the lenght of the alphabet. if temp > letter_index.size - 1 temp = temp - letter_index.size end # Declares which new letter whom is to be added to the encrypted text. new_letter = letter_index[temp] end } # Makes sure to keep spaces so the text don't get messy. if new_letter == '' new_letter = text_list[counter] end # Adds the new letter to the end of the encrypted text. encrypted_text += new_letter # Increments the counter. counter += 1 end # Returns the encrypted text. return encrypted_text end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decrypt(input_text, offset)\n\n # Takes original offset and inverts it.\n offset *= -1\n\n # Calls the encrypt function using the inverted offset to get the decrypted text, also makes the text lowercase.\n decrypted_text = encrypt(input_text, offset).downcase\n\n # Returns the decrypted text.\n return de...
[ "0.75915086", "0.6897929", "0.64598566", "0.6287137", "0.62204075", "0.61552507", "0.6106338", "0.6088311", "0.6044194", "0.60428244", "0.6037299", "0.60262364", "0.60171527", "0.59535915", "0.5903312", "0.5893209", "0.5860533", "0.58421016", "0.5815008", "0.58055204", "0.574...
0.7937112
0
Public: Decrypts encrypted text using original offset. input_text The string to be decrypted. offset Integer to define how much the text was encrypted. Examples encrypt('KHOOR', 3) => 'hello' Returns the input_text decrypted.
def decrypt(input_text, offset) # Takes original offset and inverts it. offset *= -1 # Calls the encrypt function using the inverted offset to get the decrypted text, also makes the text lowercase. decrypted_text = encrypt(input_text, offset).downcase # Returns the decrypted text. return decrypted_text end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encrypt(input_text, offset)\n # Error messages for: empty strings & offset == 0.\n raise ArgumentError, 'String must not be empty' if input_text == ''\n raise ArgumentError, 'Offset must not be zero' if offset == 0\n\n # Makes the input text uppercase letters only.\n input_text = input_text.upcase\n\n # ...
[ "0.7043189", "0.6960902", "0.6590964", "0.6399447", "0.6169473", "0.61292565", "0.60938627", "0.6073996", "0.60176146", "0.586588", "0.58364224", "0.5800653", "0.5800653", "0.57738584", "0.5754454", "0.575226", "0.5733048", "0.5690624", "0.56748265", "0.5657698", "0.56217057"...
0.84749436
0
conversations are only displayed on a profile page once the user has received a message
def index #find the current user object @user = User.find(session[:user_id]) #get the id of current user user_id = User.find(session[:user_id]).id #get all conversations of current user @started_conversations = @user.started_conversations @joined_conversations = @user.joined_conversations end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n if user_signed_in?\n @message_has_been_sent = conversation_exist?\nend\n end", "def show\n puts \"############ messages show ###############\"\n @message = current_user.messages.find_by_id(params[:id])\n if !@message.nil?\n @conversations = @message.conversations.includes(:sende...
[ "0.7602931", "0.7025084", "0.6957228", "0.69067365", "0.68854684", "0.68810326", "0.685082", "0.6818137", "0.6678468", "0.6668855", "0.6666441", "0.6633107", "0.66254395", "0.66181904", "0.66112846", "0.6604742", "0.6604277", "0.65954876", "0.6586888", "0.6573701", "0.6525246...
0.6316284
40
INSTANCE METHODS Adds track to playlist
def add_track(track) unless self.tracks.include?(track) self.tracks << track end track end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_track(playlistID, track, artist)\n post(:session, {:method => \"playlist.addTrack\", :playlistID => playlistID, :track => track, :artist => artist})\n end", "def add_songs tracklist, playlist_object\n playlist_object.add_tracks!(tracklist)\n end", "def add_track_to_playlist(playlist_id:...
[ "0.78346854", "0.7723498", "0.76396567", "0.7474559", "0.74607456", "0.7374839", "0.7259369", "0.7178513", "0.70501864", "0.7048047", "0.70357656", "0.7030941", "0.7030941", "0.7030941", "0.7030941", "0.7030941", "0.7030941", "0.70298153", "0.701875", "0.70176506", "0.6961990...
0.73279107
6
Remove tracks from playlist
def remove_tracks(tracks) tracks.each do |track| self.tracks.destroy(track) # remove association end tracks end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_track_from_tracklist(playlist_id=1439475515)\n \t url = \"playlist/#{playlist_id}/tracks\"\n request_data = {:params=>{'access_token' => Setting.access_token,\"songs\"=>\"118584990\"}}\n Deezer.oauth_delete(url,request_data)\n \n \t end", "def rem_dead_tracks playlist\n beg...
[ "0.7906113", "0.7742684", "0.7614736", "0.7567032", "0.746745", "0.71691644", "0.6984256", "0.69751453", "0.6974582", "0.6875641", "0.68536085", "0.67852074", "0.6593922", "0.65427065", "0.6536019", "0.6527785", "0.64177126", "0.6397805", "0.6391453", "0.6379138", "0.6371864"...
0.7225097
5
Checks if a spotify id exists in playlist
def has_track_with_id(spotify_id) self.tracks.exists?(spotify_id: spotify_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_song?(song)\n songs.include?(song)\n end", "def playlist_deleted?(playlist)\n changes[\"playlists\"][\"delete\"].include?(playlist[\"id\"])\nend", "def extract_spotify_id(query)\n if query.start_with?('http://open.spotify.com/track/', 'https://open.spotify.com/track/', 'https://play.spoti...
[ "0.65746737", "0.64258116", "0.64054716", "0.6382589", "0.6368138", "0.63386935", "0.6312566", "0.6312142", "0.62907964", "0.6286473", "0.6271978", "0.6253216", "0.6249683", "0.6181349", "0.61791307", "0.61373484", "0.6102101", "0.6075516", "0.60652274", "0.60652274", "0.6065...
0.7707543
0
Return the number of tracks
def track_count self.tracks.count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_of_tracks\n\t\t@tracks.count\t \n\tend", "def track_count\n return @tracks.length\n end", "def number_of_tracklists\n tracklists.size\n end", "def track_count\n @ole.TrackCount\n end", "def song_count\n return @songs.count\n end", "def number_of_tracks(talks)\n @total_talks...
[ "0.91699684", "0.9051332", "0.80762345", "0.7970268", "0.78959143", "0.78725076", "0.7822141", "0.7803569", "0.7803569", "0.78015196", "0.7633333", "0.75969553", "0.7593778", "0.7533053", "0.75079685", "0.7385961", "0.73316914", "0.72461635", "0.72426194", "0.71706706", "0.71...
0.8923095
2
Returns an RSpotify::Playlist object of the playlist
def rspotify_playlist if !self.spotify_id.nil? @rspotify_playlist ||= RSpotify::Playlist.find_by_id(self.spotify_id) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def playlist(options={})\n get(:session, {:method => \"radio.getPlaylist\"}.merge(options))\n end", "def playlist\n IITPlaylist.new(@ole.Playlist)\n end", "def find_playlist\n @playlist = Playlist.find(params[:id])\n end", "def get_playlist!(user, playlist_title)\n playlist = u...
[ "0.7588961", "0.75864476", "0.74376553", "0.7324536", "0.7209875", "0.7201795", "0.71858406", "0.71858406", "0.71858406", "0.71858406", "0.71858406", "0.71858406", "0.71858406", "0.71858406", "0.71858406", "0.71858406", "0.7131987", "0.71257377", "0.71137553", "0.71137553", "...
0.78642195
0
Creates a playlist on Spotify under the owner's account
def add_to_spotify if self.spotify_id.nil? playlist = self.group.owner.rspotify_user.create_playlist!(self.name) self.spotify_id = playlist.id self.save self else nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_playlist(name)\n uri = 'https://api.deezer.com/user/me/playlists'\n headers = {params: {access_token: @access_token, title: name}}\n RestWrapper.perform_request(uri, :post, headers)\n end", "def create_playlist!(name, description: nil, public: true, collaborative: false)\n url =...
[ "0.76553774", "0.7637564", "0.7585483", "0.7548931", "0.7436754", "0.742888", "0.7393493", "0.73895884", "0.7245579", "0.72315216", "0.7225669", "0.71993524", "0.719028", "0.7172791", "0.71712863", "0.7165599", "0.71290624", "0.71083194", "0.70832026", "0.70266587", "0.702129...
0.7758122
0
Syncs all tracks with its Spotify playlist
def sync_tracks_to_spotify if self.spotify_id.nil? self.add_to_spotify end owner = self.group.owner.rspotify_user tracks = self.tracks.map(&:rspotify_track) self.rspotify_playlist.replace_tracks!(tracks) self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_songs tracklist, playlist_object\n playlist_object.add_tracks!(tracklist)\n end", "def sync_details_to_spotify\n owner = self.group.owner.rspotify_user\n \n self.rspotify_playlist.change_details!(name: self.name)\n\n self\n end", "def topsongs\n tracks = Array.new\n ...
[ "0.690083", "0.65498984", "0.6534414", "0.64843297", "0.64843166", "0.64583725", "0.63815236", "0.63722014", "0.6347113", "0.62693244", "0.62359893", "0.6216239", "0.617799", "0.6168172", "0.6070419", "0.5945404", "0.5908702", "0.5907294", "0.5904523", "0.59039915", "0.589450...
0.813684
0
Syncs playlist name with its spotify playlist
def sync_details_to_spotify owner = self.group.owner.rspotify_user self.rspotify_playlist.change_details!(name: self.name) self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sync_tracks_to_spotify\n if self.spotify_id.nil?\n self.add_to_spotify\n end\n\n owner = self.group.owner.rspotify_user\n\n tracks = self.tracks.map(&:rspotify_track)\n\n self.rspotify_playlist.replace_tracks!(tracks)\n\n self\n end", "def update\n p...
[ "0.6808443", "0.66115075", "0.66027445", "0.65986896", "0.65877056", "0.6506672", "0.6506672", "0.6506672", "0.6506672", "0.6506672", "0.6506672", "0.6506672", "0.6506672", "0.6506672", "0.6506672", "0.649071", "0.6487564", "0.64737666", "0.64623535", "0.6457122", "0.64488906...
0.7128123
0
GET /twenties GET /twenties.json
def index @twenties = Twenty.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @specialties = Specialty.all\n\n render json: @specialties\n end", "def show_user_tweets\n @user_tweets = TwitterClient.user_timeline(params[:name])\n render json: @user_tweets\n end", "def index\n @twentyeights = Twentyeight.all\n end", "def tweets\n user = User.find(params[...
[ "0.6633355", "0.6487623", "0.6419868", "0.63646036", "0.63292855", "0.62206596", "0.6175852", "0.61634433", "0.6152529", "0.6071321", "0.6066663", "0.6052348", "0.6025977", "0.6006222", "0.59879833", "0.59401584", "0.59312594", "0.5930281", "0.5925703", "0.5893208", "0.588953...
0.67849153
0
GET /twenties/1 GET /twenties/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @twenties = Twenty.all\n end", "def show_user_tweets\n @user_tweets = TwitterClient.user_timeline(params[:name])\n render json: @user_tweets\n end", "def index\n @twentyeights = Twentyeight.all\n end", "def index\n @specialties = Specialty.all\n\n render json: @specialties\n ...
[ "0.6877098", "0.64909244", "0.6472772", "0.646151", "0.63388467", "0.63244635", "0.62527335", "0.6209075", "0.61967903", "0.6179303", "0.6156872", "0.61466444", "0.61458427", "0.61098635", "0.60187924", "0.6001646", "0.5979707", "0.5960681", "0.5958041", "0.59563804", "0.5954...
0.0
-1
POST /twenties POST /twenties.json
def create @twenty = Twenty.new(twenty_params) respond_to do |format| if @twenty.save format.html { redirect_to @twenty, notice: 'Twenty was successfully created.' } format.json { render action: 'show', status: :created, location: @twenty } else format.html { render action: 'new' } format.json { render json: @twenty.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_twit(twit)\n RestClient.post configuration.base_url + '/twits',\n { twit: twit }.to_json,\n content_type: :json,\n accept: :json\n end", "def tweet_from_api\n @tweet_api = User.find(2).tweets.create(tweet_params)\n render jso...
[ "0.6976653", "0.6296775", "0.6255078", "0.62171686", "0.61633307", "0.60790575", "0.5978975", "0.59632075", "0.5949221", "0.5899765", "0.5849821", "0.57688034", "0.57622486", "0.57304776", "0.56886935", "0.56601274", "0.5631199", "0.5619798", "0.56192565", "0.5490892", "0.548...
0.55198747
19
PATCH/PUT /twenties/1 PATCH/PUT /twenties/1.json
def update respond_to do |format| if @twenty.update(twenty_params) format.html { redirect_to @twenty, notice: 'Twenty was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @twenty.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @twet.update(twet_params)\n format.html { redirect_to @twet, notice: \"Twet was successfully updated.\" }\n format.json { render :show, status: :ok, location: @twet }\n else\n format.html { render :edit, status: :unprocessable_entity }\n ...
[ "0.64769435", "0.64665633", "0.6329846", "0.6290282", "0.628578", "0.6262618", "0.6259913", "0.6185525", "0.61588293", "0.6066754", "0.60537595", "0.60537595", "0.60537595", "0.60426986", "0.6037968", "0.6014813", "0.5998606", "0.5974109", "0.59718585", "0.595085", "0.5906799...
0.61491084
9
DELETE /twenties/1 DELETE /twenties/1.json
def destroy @twenty.destroy respond_to do |format| format.html { redirect_to twenties_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @twentyeight.destroy\n respond_to do |format|\n format.html { redirect_to twentyeights_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ty.destroy\n respond_to do |format|\n format.html { redirect_to ties_url }\n format.json { head :no_conte...
[ "0.72650033", "0.7072935", "0.7072166", "0.7070212", "0.7031501", "0.68091536", "0.68079627", "0.6778834", "0.67443436", "0.6737289", "0.67176116", "0.67092115", "0.6706858", "0.67020583", "0.6681248", "0.6658527", "0.6624856", "0.6617935", "0.6615308", "0.6612985", "0.658582...
0.7407506
0
Use callbacks to share common setup or constraints between actions.
def set_twenty @twenty = Twenty.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def twenty_params params.require(:twenty).permit(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
escreve cada elemento de content_array como uma linha em file_name aposto que nao vai usar mais; tais discorda
def write_file(file_name, content_array) output = File.new(file_name, 'w') content_array.each { |line| output.write line } output.close end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFileContent(dir, file):Array\n arr = Array.new\n File.open(\"#{dir}/#{file}\", \"r\").each do |line|\n arr.push line\n end\n arr\n end", "def files\n entries.map(&:filepath)\n end", "def stringify_files(files)\n is_array = files.is_a? Array\n unless is_array\n...
[ "0.6276106", "0.6274108", "0.61509126", "0.61125165", "0.59446204", "0.59300315", "0.5905068", "0.5891633", "0.58873093", "0.58873093", "0.58873093", "0.58630943", "0.58536243", "0.58419836", "0.58407795", "0.58407795", "0.5838471", "0.5830778", "0.5800543", "0.57939464", "0....
0.0
-1
GET /headquators/1 GET /headquators/1.xml
def show @headquator = Headquator.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @headquator } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def head\n %Q[<?xml version=\"1.0\" encoding=\"UTF-8\"?>]\n end", "def new\n @headquator = Headquator.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @headquator }\n end\n end", "def head query = nil\n\t\tif (query = make_query query)\n\t\t...
[ "0.61721504", "0.6140149", "0.5923144", "0.5719944", "0.56328714", "0.55198026", "0.5514903", "0.549202", "0.54816", "0.5473694", "0.54668933", "0.5442111", "0.5427904", "0.54243803", "0.5402602", "0.5395741", "0.5387486", "0.5384736", "0.53746945", "0.5370071", "0.5366921", ...
0.7150592
0
GET /headquators/new GET /headquators/new.xml
def new @headquator = Headquator.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @headquator } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @headquator = Headquator.new(params[:headquator])\n\n respond_to do |format|\n if @headquator.save\n format.html { redirect_to(@headquator, :notice => 'Headquator was successfully created.') }\n format.xml { render :xml => @headquator, :status => :created, :location => @headq...
[ "0.6737741", "0.631609", "0.63094646", "0.63084173", "0.63073486", "0.6301065", "0.6255681", "0.6222336", "0.6217683", "0.62158895", "0.62125945", "0.62124187", "0.61874855", "0.618706", "0.61821973", "0.618035", "0.6179234", "0.61714435", "0.6165111", "0.6143605", "0.6122988...
0.755256
0
POST /headquators POST /headquators.xml
def create @headquator = Headquator.new(params[:headquator]) respond_to do |format| if @headquator.save format.html { redirect_to(@headquator, :notice => 'Headquator was successfully created.') } format.xml { render :xml => @headquator, :status => :created, :location => @headquator } else format.html { render :action => "new" } format.xml { render :xml => @headquator.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @headquator = Headquator.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @headquator }\n end\n end", "def destroy\n @headquator = Headquator.find(params[:id])\n @headquator.destroy\n\n respond_to do |format|\n format.html { re...
[ "0.58205545", "0.5449114", "0.5383568", "0.5197703", "0.5140698", "0.4997477", "0.48170918", "0.4812262", "0.479707", "0.4761118", "0.47443432", "0.47443017", "0.47001404", "0.47001016", "0.4688218", "0.4676331", "0.46733665", "0.46501395", "0.4642042", "0.46408108", "0.46203...
0.6862091
0
PUT /headquators/1 PUT /headquators/1.xml
def update @headquator = Headquator.find(params[:id]) respond_to do |format| if @headquator.update_attributes(params[:headquator]) format.html { redirect_to(@headquator, :notice => 'Headquator was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @headquator.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @headquator = Headquator.new(params[:headquator])\n\n respond_to do |format|\n if @headquator.save\n format.html { redirect_to(@headquator, :notice => 'Headquator was successfully created.') }\n format.xml { render :xml => @headquator, :status => :created, :location => @headq...
[ "0.59322625", "0.569877", "0.56955814", "0.55690753", "0.54230475", "0.5353984", "0.533188", "0.5251245", "0.52377087", "0.5223536", "0.51981825", "0.5136684", "0.5111712", "0.50622356", "0.50552976", "0.5021294", "0.5019818", "0.49839807", "0.4982577", "0.49671143", "0.49627...
0.67867374
0
DELETE /headquators/1 DELETE /headquators/1.xml
def destroy @headquator = Headquator.find(params[:id]) @headquator.destroy respond_to do |format| format.html { redirect_to(headquators_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def delete_head\r\n delete_node @head\r\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body...
[ "0.6648874", "0.6513472", "0.6381885", "0.63475996", "0.63135624", "0.6282626", "0.6210661", "0.6205523", "0.62039584", "0.61943126", "0.61932594", "0.61932594", "0.61755735", "0.6136469", "0.6110759", "0.6097845", "0.6093979", "0.6082628", "0.60577977", "0.6057759", "0.60548...
0.72183216
0
Convert a Kramdown syntax tree into Hexp.
def convert(el) #Kernel.p el ; exit @type, @value, @attr, @children, @options = el.type, el.value, el.attr, el.children, el.options send(type) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_kramdown(content)\n ::Kramdown::Document.new content, :input => 'QuickStartParser' \n end", "def create_tree(exp)\n \toperatorStack, nodeStack = [], []\n \n # define function to create new tree segment\n subtree = Proc.new {\n # pop operands where\n # a [operator] b\...
[ "0.55865425", "0.54643977", "0.53277147", "0.5200297", "0.51239187", "0.51188624", "0.5115421", "0.50310653", "0.5016224", "0.49735567", "0.49331287", "0.49244583", "0.48948383", "0.48464245", "0.48175794", "0.47823796", "0.4780571", "0.4777318", "0.47656757", "0.47617742", "...
0.0
-1
Process a Kramdown :root type element
def root H[:html, [H[:head], tag!(:body)]] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def root_node; end", "def build_root(type)\n root = create_node(type: 'atom:entry')\n\n add_namespaces root, determine_namespaces(type)\n root << create_node(type: 'apps:category', attrs: Atom::CATEGORY[type.to_sym]) if Atom::CATEGORY[type.to_sym]\n\n root\n end", "def visit_ro...
[ "0.6079737", "0.59344727", "0.587767", "0.58291143", "0.57911354", "0.57059175", "0.5668774", "0.5592321", "0.54855967", "0.5479368", "0.5475543", "0.54603463", "0.5443226", "0.5443226", "0.5433922", "0.54273045", "0.5379477", "0.53635925", "0.5363529", "0.5363529", "0.535930...
0.0
-1
Process a Kramdown :header type element
def header tag! "h#{options[:level]}".intern end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_header!(header_node_text='ueNTP HA4UC/|EHUU') \n # getting header text\n header_text = self.doc.xpath('//body/header/para').first.text\n \n # create para header\n body_childs = self.doc.xpath('//body').first.children\n \n # getting header\n h = body_childs.xpath('//header').f...
[ "0.6583759", "0.6554613", "0.6389795", "0.6322335", "0.6311881", "0.62779695", "0.62211275", "0.62211275", "0.61010206", "0.60568136", "0.6051297", "0.6023408", "0.5908964", "0.5908894", "0.58926713", "0.5880238", "0.5859904", "0.5858297", "0.58371717", "0.58136153", "0.58078...
0.61219215
8
Process a Kramdown :codeblock type element
def codeblock H[:pre, attr, H[:code, value]] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_codeblock; end", "def block_name \n :CodeBlock \n end", "def block_name \n :CodeBlock \n end", "def parse_codeblocks(html); end", "def block_code(code, language)\n if language.present?\n CodeRay.scan(code, language).div\n else\n...
[ "0.69157934", "0.659008", "0.659008", "0.65192616", "0.6324901", "0.63150156", "0.63084704", "0.6289033", "0.61813116", "0.61350846", "0.6072912", "0.60016435", "0.59592175", "0.5941496", "0.59025866", "0.5804636", "0.5681923", "0.56796026", "0.5635969", "0.56140715", "0.5606...
0.68126065
1
Create a Hexp::Node from the current element Helper for when you want to turn the Kramdown element straight into a Hexp::Node with the same attributes, and a onetoone mapping of the child elements.
def tag!(tag) H[tag, attr, convert_children] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def child_node=(_); end", "def node element, attributes = {}\n Nokogiri::XML::Node.new(element, Nokogiri::HTML::Document.new).tap do |node|\n attributes.each do |name, value|\n node[name] = value\n end\n end\n end", "def from_xml_elem(ctx, root)\n #p [:from_xml_elem, :ctx, root]\...
[ "0.58852583", "0.57961506", "0.57594633", "0.5648332", "0.56478107", "0.56442785", "0.5592797", "0.5553527", "0.54036546", "0.53917366", "0.53894705", "0.53894705", "0.5365862", "0.5356107", "0.5339896", "0.53077227", "0.5297015", "0.5281672", "0.5273951", "0.52297074", "0.52...
0.0
-1
Convert the children of the Kramdown element to Hexps In other words, recurse down the tree. This will pass each child element into the converter.
def convert_children children.map {|ch| convert ch }.compact end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def children_to_latex\n array_to_latex(@children)\n end", "def inner(ke)\n ke.children.each { |child| convert(child) }\n end", "def to_plain_text(collector = '')\n before, after = Kramdown::Converter::PlainText.convert_el(self, {})\n collector << before if before\n # walk the tr...
[ "0.60098773", "0.5782909", "0.5701173", "0.5618474", "0.5603786", "0.5545951", "0.55259764", "0.54377055", "0.5426286", "0.53993624", "0.5362588", "0.5346504", "0.5337393", "0.5319728", "0.52911586", "0.51790816", "0.513311", "0.51225877", "0.5118056", "0.51178896", "0.508678...
0.6919884
0
GET /tipo_de_exercicios/1 GET /tipo_de_exercicios/1.xml
def show @tipo_de_exercicio = TipoDeExercicio.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @tipo_de_exercicio } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @exercicio = Exercicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @exercicio }\n end\n end", "def new\n @tipo_de_exercicio = TipoDeExercicio.new\n\n respond_to do |format|\n format.html # new.html.erb\n ...
[ "0.685804", "0.64032596", "0.6390884", "0.63872635", "0.63830364", "0.6357885", "0.6330351", "0.63199484", "0.6319741", "0.6303083", "0.6302576", "0.62839997", "0.6272332", "0.6268013", "0.6253281", "0.619141", "0.6189341", "0.614247", "0.61356384", "0.61315197", "0.6130224",...
0.71717477
0
GET /tipo_de_exercicios/new GET /tipo_de_exercicios/new.xml
def new @tipo_de_exercicio = TipoDeExercicio.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @tipo_de_exercicio } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @exercicio = Exercicio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @exercicio }\n end\n end", "def new\n @tipo_nota = TipoNota.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @t...
[ "0.76087147", "0.7438733", "0.7389868", "0.73064727", "0.7213991", "0.7202084", "0.71932304", "0.7192418", "0.7192105", "0.7165306", "0.7164036", "0.71629536", "0.71590674", "0.7156632", "0.71553713", "0.7134204", "0.7134089", "0.7131176", "0.713023", "0.71198124", "0.7112111...
0.77752113
0
POST /tipo_de_exercicios POST /tipo_de_exercicios.xml
def create @tipo_de_exercicio = TipoDeExercicio.new(params[:tipo_de_exercicio]) respond_to do |format| if @tipo_de_exercicio.save flash[:notice] = 'TipoDeExercicio was successfully created.' format.html { redirect_to(@tipo_de_exercicio) } format.xml { render :xml => @tipo_de_exercicio, :status => :created, :location => @tipo_de_exercicio } else format.html { render :action => "new" } format.xml { render :xml => @tipo_de_exercicio.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def treino_exercicio_params\n params.require(:treino_exercicio).permit(:serie, :repeticoes, :treino_id, :exercicio_id)\n end", "def create\n @exercicio = Exercicio.new(params[:exercicio])\n\n respond_to do |format|\n if @exercicio.save\n flash[:notice] = 'Exercicio registrado com sucesso.'\...
[ "0.64708215", "0.64309597", "0.63465434", "0.6178716", "0.60800153", "0.5958576", "0.59514344", "0.5936718", "0.5923433", "0.5903062", "0.5901552", "0.58497334", "0.58361286", "0.5831301", "0.57955927", "0.5786819", "0.5767383", "0.5738581", "0.5736849", "0.5730634", "0.56995...
0.6983183
0
PUT /tipo_de_exercicios/1 PUT /tipo_de_exercicios/1.xml
def update @tipo_de_exercicio = TipoDeExercicio.find(params[:id]) respond_to do |format| if @tipo_de_exercicio.update_attributes(params[:tipo_de_exercicio]) flash[:notice] = 'TipoDeExercicio was successfully updated.' format.html { redirect_to(@tipo_de_exercicio) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @tipo_de_exercicio.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @exercicio = Exercicio.find(params[:id])\n\n respond_to do |format|\n if @exercicio.update_attributes(params[:exercicio])\n flash[:notice] = 'Exercicio was successfully updated.'\n format.html { redirect_to(@exercicio) }\n format.xml { head :ok }\n else\n f...
[ "0.6527013", "0.60689497", "0.60612434", "0.60359985", "0.6017723", "0.59839725", "0.5946717", "0.59210664", "0.5918133", "0.58798826", "0.5869662", "0.585655", "0.58377635", "0.58233434", "0.5821217", "0.5802019", "0.5792552", "0.57806206", "0.57593733", "0.5758389", "0.5749...
0.69656354
0
DELETE /tipo_de_exercicios/1 DELETE /tipo_de_exercicios/1.xml
def destroy @tipo_de_exercicio = TipoDeExercicio.find(params[:id]) @tipo_de_exercicio.destroy respond_to do |format| format.html { redirect_to(tipo_de_exercicios_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @exercicio = Exercicio.find(params[:id])\n @exercicio.destroy\n\n respond_to do |format|\n format.html { redirect_to(exercicios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tipo_de_documento = TipoDeDocumento.find(params[:id])\n @tipo_de_documento.des...
[ "0.7092605", "0.6940472", "0.6893472", "0.678931", "0.6766567", "0.675999", "0.6746952", "0.67298824", "0.67297417", "0.67252904", "0.6718005", "0.66936976", "0.6692495", "0.6690704", "0.66636795", "0.66620797", "0.66563565", "0.66535497", "0.6645902", "0.66364646", "0.663127...
0.7308653
0
need this to show for only current user or school, how ?
def index course = Course.find(params[:course_id]) sections = course.sections.all render json: sections.order(:id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\r\n @principals = User.where(:user_type => \"principal\")\r\n @teachers = User.where(:user_type => \"teacher\")\r\n @activePrincipals = SchoolUser.all\r\n @activeTeachers = SchoolUser.all\r\n\r\n end", "def current_user_is_school_admin?\n current_user.admin_profile ? true : false\n end"...
[ "0.700337", "0.68638355", "0.6810058", "0.6790284", "0.6755825", "0.6664296", "0.66620874", "0.66234004", "0.65983754", "0.65404385", "0.6514974", "0.64971447", "0.64563346", "0.64394796", "0.64313984", "0.641263", "0.6383612", "0.6370492", "0.6369466", "0.6352184", "0.634353...
0.0
-1
Return the array of all possible search indexes for the including connection
def search_indexes Search.indexes(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def indexes\n @indexes ||= []\n end", "def all_indices\n @indices ||= []\n @indices.dup\n end", "def indices\n @indices.to_a\n end", "def get_all_indexes(options = GetAllIndexesOptions.new)\n res = @backend.search_index_get_all(options.timeout)\n ...
[ "0.68979806", "0.6312606", "0.6287566", "0.6282928", "0.6150243", "0.6137769", "0.61369145", "0.613041", "0.61274236", "0.60852426", "0.6077488", "0.6044167", "0.5997088", "0.5950629", "0.5931371", "0.59130454", "0.59130454", "0.58852124", "0.58486444", "0.5798439", "0.578973...
0.69436
0
Allows you to queue a wizard report to run == Parameters: name: The name of the configured wizard report that you want to run. The returned value is one of the following: an HTTP status code 204, which indicates success or an error message. ==== Example response = client.queue_report 'example_report'
def queue_report(name) response = @client.get('arborws/reports/queue', api_key: @api_key, name: name) response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report\n # generate_report()\n ReportWorker.perform_async(\"07-01-2018\", \"08-01-2018\")\n render \\\n json: {status: 'SUCCESS', message:'REQUEST TO GENERATE A REPORT ADDED TO THE QUEUE'},\n status: :ok\n end", "def create\n if current_user.company.reports.any?...
[ "0.68168336", "0.6232649", "0.57779914", "0.5743355", "0.5719628", "0.5683511", "0.5682297", "0.55267787", "0.5491283", "0.54424334", "0.54214203", "0.533692", "0.5313298", "0.5287723", "0.527407", "0.52734834", "0.52701294", "0.5250728", "0.5246043", "0.5244353", "0.51684046...
0.8210118
0
Allows you to view a list of wizard report results that can be downloaded from Peakflow SP. == Parameters: filter: (Optional) Keywords by which you want to filter search results. You can enter the same search strings that you can enter in the Search box on the Alerts pages in the Web UI. limit: (Optional) The maximum number of alerts to return that match the filter. format: The format in which you want the data returned: 'json' or 'xml' ==== Example response = client.report_results
def report_results(filter = nil, limit = nil, format = 'json') url_filter_limit_format_request('arborws/reports/results', filter, limit, format) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list(filter, pager=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'filter', filter)\n\t\t\tclient.add_param(kparams, 'pager', pager)\n\t\t\tclient.queue_service_action_call('report', 'list', 'KalturaReportListResponse', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn ni...
[ "0.70561653", "0.64172703", "0.64172703", "0.6289339", "0.59298134", "0.5898456", "0.5890375", "0.58881295", "0.58881295", "0.5881203", "0.5834895", "0.58247143", "0.58108866", "0.5806037", "0.5713658", "0.5710281", "0.5668213", "0.5646049", "0.5641916", "0.5625447", "0.55925...
0.7861755
0
Allows you to download a completed wizard report. == Parameters: name: The name of the configured wizard report result that you want to download. request_time: The time of the wizard report result that you want to download, which can be one of the following: last (The "last" parameter downloads the most recent wizard report result), time (the "time" parameter is the time at which a wizard report ran, in seconds and microseconds since the epoch.) format: The format in which you want a wizard report returned, which can be one of the following: "PDF", "XML", "CSV". ==== Example response = client.download_report 'myReport', 'last', 'PDF'
def download_report(name, request_time, format) response = @client.get('arborws/reports/configured', api_key: @api_key, name: name, request_time: request_time, format: format) response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report_file_download(report)\n\t\t\tpost= { \"token\" => @token, \"report\" => report }\n\t\t\tfile = nil\n\t\t\tfile=nessus_http_request('file/report/download', post)\n\t\t\tif file.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\treturn file\n\t\tend", "def report_file1_download(report)\n\t\t\tpost= { \"token\" => @...
[ "0.5987375", "0.58703387", "0.57214636", "0.56755275", "0.5602422", "0.55886596", "0.55713606", "0.55525887", "0.5523315", "0.5491981", "0.5316375", "0.52744836", "0.5268636", "0.52576995", "0.5115445", "0.5108097", "0.5097864", "0.50948036", "0.5083391", "0.5038411", "0.5033...
0.74230826
0
type casts to the class specified in :type parameter E.g. d = Kase.new(:type => :idea) d.kind == :idea > true Kase.new(:type => "Problem") > Problem
def new_with_cast(*a, &b) if (h = a.first).is_a? Hash and (type = h[:type] || h['type']) and (k = type.class == Class ? type : (type.class == Symbol ? klass(type): type.constantize)) != self raise "type not descendent of Kase" unless k < self # klass should be a descendant of us return k.new(*a, &b) end new_without_cast(*a, &b) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_type\n @type = params[:type]\n @klass = @type.constantize\n end", "def type(type); end", "def conv_itype(itype)\n case itype\n when 'concept' : itype\n when 'query_doctrack' : 'query'\n else 'document'\n end\nend", "def class_from_type(type)\n send(\"#{type}_class\") if respond...
[ "0.69831944", "0.6882322", "0.6725567", "0.671087", "0.67067087", "0.6544368", "0.64396137", "0.6373952", "0.63659585", "0.6345306", "0.6317789", "0.63123333", "0.63022447", "0.63022447", "0.62673885", "0.6243633", "0.6238834", "0.62067133", "0.6169275", "0.61639166", "0.6155...
0.0
-1
finds a kase class by kind/type, e.g. Kase.klass(:idea) > Idea
def klass(a_kind=nil) ordered_subclasses.each do |sc| return sc if !a_kind.blank? && sc.kind == a_kind.to_sym end Kase end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def klass(kind=nil)\n [BlogPost, DictionaryEntry, PressRelease].each do |sc|\n return sc if kind && sc.name.underscore.to_sym == kind.to_sym\n end\n Article\n end", "def klass\n @klass ||= begin\n @klass_name.split('::').inject(Object){|n,i| n.const_get(i)}\n rescue NameError ...
[ "0.70774615", "0.69298786", "0.6862651", "0.6799662", "0.67743", "0.67743", "0.66387236", "0.66375136", "0.662512", "0.65980667", "0.65980667", "0.6579968", "0.6561203", "0.65389085", "0.65061307", "0.64780265", "0.64780265", "0.64780265", "0.6470698", "0.6470698", "0.6451751...
0.7813404
2
subclasses in logical order
def ordered_subclasses [Advocate, Client] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ordered_subclasses\n [Question, Idea, Problem, Praise]\n end", "def inherited(subclass); end", "def _subclasses\n @_subclasses ||= []\n end", "def subclasses; end", "def subclasses; end", "def ordered_subclasses\n [Question]\n end", "def instantiate_subclasses(klass); end", "d...
[ "0.71943414", "0.6926279", "0.69014895", "0.6894449", "0.6894449", "0.67920446", "0.67521554", "0.6663974", "0.6663974", "0.6609742", "0.65239793", "0.6456865", "0.6415817", "0.6359624", "0.63572264", "0.63572264", "0.6208138", "0.6134584", "0.6106695", "0.609934", "0.5893974...
0.68681705
5
e.g. Question.kind => :question
def kind self.name.underscore.to_sym end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kind\n # returns nil, overridden and returning :question, :problem, etc. in sublcass\n end", "def kind; end", "def kind; end", "def kind; end", "def kind; end", "def kind; end", "def kind; end", "def get_kind\n\t\tend", "def kind\n self.class.kind\n end", "def kind\n self.class...
[ "0.77010584", "0.7137537", "0.7137537", "0.7137537", "0.7137537", "0.7137537", "0.7137537", "0.7130781", "0.6997862", "0.6997862", "0.6997862", "0.6970308", "0.6829932", "0.6798781", "0.6791797", "0.6791797", "0.6791797", "0.6791797", "0.6791797", "0.6791797", "0.670659", "...
0.6974923
12
instance methods returns a 8digit customer number, e.g. "0000012"
def number "#{self.id}".rjust(8, "0") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clearinghouse_customer_number(return_integer = false)\n raw = read_attribute(:clearinghouse_customer_number)\n return nil if raw.nil?\n return_integer ? raw : raw.to_s.rjust(6, \"0\")\n end", "def gen_int_phone_num\n \"011-#{rand(100) + 1}-#{rand(100) + 10}-#{rand(1000) + 1000}\"\nend", "def zip...
[ "0.76719403", "0.6945491", "0.69052804", "0.6892586", "0.683928", "0.6720782", "0.6716963", "0.66040534", "0.6547215", "0.6547215", "0.6526106", "0.6512696", "0.64943266", "0.64932674", "0.6482574", "0.64668417", "0.64448154", "0.641889", "0.6408821", "0.63944227", "0.6309069...
0.66196907
9
returns the latest enrollment
def enrollment self.enrollments.last end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_last_assessment\n Assessment.find_by(year: year - 1)\n end", "def get_last_assessment\n Assessment.find_by(year: year - 1)\n end", "def last_accomplished_mission_enrollment\n mission_enrollments.accomplished.last\n end", "def enrollment\n @enrollment_cache ||= self.enrollments.select {...
[ "0.6875794", "0.6875794", "0.6852576", "0.6685162", "0.629084", "0.6278809", "0.62735724", "0.62139535", "0.61888784", "0.61478907", "0.6077877", "0.6028155", "0.6004027", "0.59450257", "0.59405184", "0.59318125", "0.5784264", "0.57594675", "0.57486266", "0.5743878", "0.57360...
0.78898907
0
has the person's associated user been registered? meaning activated the account
def activated? self.user && self.user.activated? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_activate?\n self.person && self.email_match?\n end", "def can_activate?\n self.person && self.person_match? && self.has_not_expired?\n end", "def registered?\n begin\n self.get_registration\n true\n rescue => e\n # any error should be treated as the user not being registere...
[ "0.7682655", "0.75680363", "0.7391955", "0.73564136", "0.73564136", "0.70202273", "0.69462174", "0.6898552", "0.68913835", "0.6889975", "0.6772264", "0.6770597", "0.6739277", "0.67191344", "0.6686761", "0.6681086", "0.6659964", "0.6647341", "0.66242516", "0.662148", "0.660315...
0.74954903
2
returns "geschlossen" etc. for current_state
def human_current_state_name self.user.human_current_state_name if self.user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_state_s\n self.current_state.to_s.humanize.downcase\n end", "def current_state_s\n self.current_state.to_s.humanize.downcase\n end", "def show_current_state\n {created: 'criado', ready: 'pronto', delivered: 'entregue', paid: 'pago'}[current_state.to_sym]\n end", "def state\n object...
[ "0.7826781", "0.7826781", "0.72963756", "0.72802246", "0.7194272", "0.7094045", "0.70532185", "0.7048708", "0.703888", "0.7033188", "0.7026596", "0.70138025", "0.69948965", "0.6965707", "0.69049436", "0.6893221", "0.68930256", "0.6889834", "0.68579406", "0.6843311", "0.684246...
0.67404735
28
creates a name string e.g. Adam Smith Note: if a name is not available, the username will be returned instead
def name result = [] result << self.first_name result << self.last_name if result.compact.empty? self.user.login if self.user else result.compact.map {|m| m.to_s.strip}.reject {|i| i.blank?}.join(' ') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n if first_name.present? || last_name.present?\n [first_name, last_name].join(\" \").strip\n else\n username\n end\n end", "def name\n name_str = \"#{first_name} #{last_name}\".strip\n if name_str.length < 1\n name_str = email\n end\n if name_str.length < 1\n na...
[ "0.80377674", "0.8035141", "0.7860904", "0.75853467", "0.75197107", "0.74458915", "0.74392164", "0.7437511", "0.7415983", "0.7412413", "0.7411916", "0.7406122", "0.7368832", "0.73683083", "0.7359976", "0.735213", "0.7340668", "0.7336819", "0.73229766", "0.7300836", "0.7296538...
0.7107688
44
e.g. "Herr" or "Frau" or dative "Herrn" or "Frau"
def salutation(dative=false) result = [] if dative result << "Frau" if self.female? result << "Herrn" if self.male? else result << "Frau" if self.female? result << "Herr" if self.male? end result.compact.map {|m| m.to_s.strip}.reject {|i| i.blank?}.join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type_first_letter(facture)\n return 'n' if facture.class.equal?(Reportable)\n return 'r' if facture.class.equal?(Report)\n return 'f' if facture.class.equal?(Debit)\n return 'd' if facture.class.equal?(Diverse)\n end", "def get_type_in_french\n type = ''\n if !self.achievement_type.nil?\n ...
[ "0.63404155", "0.6146179", "0.6102264", "0.6081641", "0.60694754", "0.60625833", "0.59928286", "0.59859973", "0.5983804", "0.59795755", "0.5979415", "0.5928813", "0.59272015", "0.5915895", "0.59003204", "0.58969945", "0.58664525", "0.5865926", "0.5857387", "0.5855538", "0.585...
0.5509561
95
e.g. Herr Prof. Dr. Schmiedl Herr Meier
def salutation_and_title_and_last_name(dative=false) result = [] result << self.salutation(dative) result << self.academic_title.name if self.academic_title && self.academic_title != AcademicTitle.no_title result << self.last_name || (self.user ? self.user.login : "anonym") result.compact.map {|m| m.to_s.strip}.reject {|i| i.blank?}.join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def herebody_s; end", "def schumann; end", "def schubert; end", "def his_her\n \"[his_her]\"\n end", "def meme_phrase; end", "def get_full_name\n # [Steve, 20140725] Too long/repetitive: \"#{description} #{header_year} - #{get_federation_type}\"\n description\n end", "def wookie_sentence...
[ "0.6452695", "0.6184721", "0.61117744", "0.60569096", "0.6016784", "0.59918237", "0.5985452", "0.5978279", "0.5928363", "0.59170043", "0.5888587", "0.588501", "0.5873228", "0.58656913", "0.5849656", "0.5838284", "0.5817728", "0.58055174", "0.5800064", "0.57946", "0.5791084", ...
0.0
-1
e.g. Herr Prof. Dr. Arndt Schmiedl Herr Peter Meier
def salutation_and_title_and_name(dative=false) result = [] result << self.salutation(dative) result << self.academic_title.name if self.academic_title && self.academic_title != AcademicTitle.no_title result << self.first_name result << self.last_name result.compact.map {|m| m.to_s.strip}.reject {|i| i.blank?}.join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def herebody_s; end", "def formation; end", "def most_interesting_man_in_the_world; end", "def schubert; end", "def schumann; end", "def herald; end", "def who_we_are\r\n end", "def wookie_sentence; end", "def meme_phrase; end", "def anchored; end", "def probers; end", "def get_full_name\n ...
[ "0.6343542", "0.61143285", "0.60209286", "0.5975634", "0.5972388", "0.59369403", "0.59252423", "0.59220666", "0.59209085", "0.5913631", "0.59097224", "0.5897986", "0.5894701", "0.58927095", "0.5846115", "0.58329016", "0.58299685", "0.5829502", "0.5829502", "0.5829502", "0.582...
0.0
-1
e.g. Prof. Dr. Hans Schmiedl Peter Meier
def title_and_name result = [] result << self.academic_title.name if self.academic_title && self.academic_title != AcademicTitle.no_title result << self.name result.compact.map {|m| m.to_s.strip}.reject {|i| i.blank?}.join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def herebody_s; end", "def schubert; end", "def formation; end", "def schumann; end", "def offences_by; end", "def probers; end", "def most_interesting_man_in_the_world; end", "def human_from_name; end", "def nice_author(author)\n return nice_author(\"#{$2} #{$1}\") if author =~ /^(.+),\\s+(.+)$/\...
[ "0.63934255", "0.6275564", "0.626137", "0.61397326", "0.6101863", "0.6066351", "0.6039316", "0.6023427", "0.59933245", "0.5981302", "0.5962846", "0.5927447", "0.58925134", "0.5880038", "0.5848655", "0.58372676", "0.5819298", "0.5816516", "0.58102804", "0.5806934", "0.5803374"...
0.0
-1
returns true for female
def female? self.gender == 'f' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def female?\n @sex == 'f'\n end", "def female?\n gender == 2\n end", "def female?\n (gender == FEMALE)\n end", "def male?\n gender == 1\n end", "def male?\n @sex == 'm'\n end", "def is_female?\n gender && gender.first == 'f'\n end", "def male?\n (gender == MAL...
[ "0.89693743", "0.8727517", "0.86737585", "0.83187467", "0.82244366", "0.80829954", "0.79527", "0.7854686", "0.7735857", "0.77059525", "0.7684026", "0.7308613", "0.7207727", "0.71447766", "0.7129296", "0.6995639", "0.6966487", "0.6913533", "0.6806662", "0.6800568", "0.679516",...
0.8452764
3
returns true for male
def male? self.gender == 'm' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def male?\n @sex == 'm'\n end", "def male?\n gender == 1\n end", "def male?\n (gender == MALE)\n end", "def is_male?\n gender && gender.first == 'm'\n end", "def female?\n @sex == 'f'\n end", "def female?\n self.gender == 'f'\n end", "def female?\n (gender == FEMA...
[ "0.8727008", "0.8715162", "0.8459104", "0.83583957", "0.83237565", "0.8196603", "0.8150859", "0.80998546", "0.7910511", "0.78887457", "0.74561435", "0.7389497", "0.73059106", "0.7298595", "0.726518", "0.72324383", "0.7021502", "0.70045847", "0.70030075", "0.6990809", "0.68731...
0.8344914
4
e.g. Sehr geehrter Herr Prof. Dr. Dr. Dr. Dr. Schmiedl Sehr geehrte Frau Dr. Merkel
def notifier_salutation_and_title_and_last_name result = [] result << (self.female? ? "Sehr geehrte" : "Sehr geehrter") result << self.salutation_and_title_and_last_name result.compact.map {|m| m.to_s.strip}.reject {|i| i.blank?}.join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schumann; end", "def schubert; end", "def fineline_accurate_title\n return nil\n end", "def drittelworte( wertung )\n if wertung < 1\n string1 = ''\n elsif wertung < 2\n string1 = 'eins'\n elsif wertung < 3\n string1 = 'zwei'\n elsif wertung < 4\n string1 = 'drei'\...
[ "0.65281945", "0.62909174", "0.6019223", "0.6011506", "0.5852892", "0.5838564", "0.58169866", "0.5803454", "0.57412636", "0.5739201", "0.57367355", "0.5729574", "0.57203", "0.5716793", "0.57113564", "0.5690619", "0.5620518", "0.56135285", "0.5602668", "0.55966175", "0.5565694...
0.55711836
20
returns a pretty print email formatted like e.g. "Dan Nye" dan_n.yahoo.com
def name_and_email email_address = Notifier.unprettify(self.email) self.name.blank? ? email_address : "\"#{self.name}\" <#{email_address}>" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formatted_email\n \"#{@name} <#{@email}>\"\n end", "def formatted_email\n \"#{name} <#{email}>\"\n end", "def formatted_email\n\t\t# because @name and @email are both instance variables, they are available in formatted_email\n\t\t\"#{@name} <#{@email}>\"\n\tend", "def formatted_email\n \"#...
[ "0.6735265", "0.6704584", "0.6551026", "0.64961016", "0.63830614", "0.6374627", "0.6297712", "0.6248919", "0.61758846", "0.6119888", "0.6072221", "0.6059989", "0.60452354", "0.6006014", "0.6003404", "0.59813154", "0.5966018", "0.58890873", "0.58664685", "0.58641523", "0.58516...
0.56039757
45
returns the name if available, otherwise, the email address this is used in invitations, where the invitee does only have email.
def name_or_email self.name.blank? ? self.email : self.name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email_name\n @email_name || if self[:email]\n split_host = URI.parse(\"#{self[:email]}\").path.split('@')\n \"#{split_host.first}\" if 2 == split_host.size\n end\n rescue URI::InvalidURIError\n nil\n end", "def name_and_email\r\n if email\r\n return \"#{self.entire_full_name} <#{...
[ "0.8162572", "0.79058945", "0.7699624", "0.75961804", "0.7561063", "0.75258774", "0.74597234", "0.74057114", "0.73968345", "0.738199", "0.7343954", "0.7300308", "0.72453123", "0.72338074", "0.72338074", "0.72338074", "0.7211618", "0.7084154", "0.7082131", "0.70808923", "0.707...
0.69949424
27
references the state from the attached user
def state self.user.state if self.user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_user_state\n @user_state = UserState.find(params[:id])\n end", "def set_user_state\n @user_state = UserState.find(params[:id])\n end", "def change_state!(_ctx, user:, **)\n role(user).activate!\n end", "def set_user\n\t\t@active = \"user\"\n\t\t@user = current_user\n\tend"...
[ "0.6603933", "0.6603933", "0.6441401", "0.6244552", "0.62360114", "0.62265754", "0.6169604", "0.6161938", "0.61085325", "0.6066012", "0.6038307", "0.59542286", "0.59542286", "0.5953332", "0.5861914", "0.58454907", "0.5821111", "0.57838356", "0.5763728", "0.57149994", "0.57004...
0.6966436
0
returns the newsletter enrollment for this person's enrollment type
def enrollment @enrollment_cache ||= self.enrollments.select {|r| r.class == self.class.enrollment_class}.first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enrollment_code_for(subject)\n Enrollment.find(:first, :conditions => {\n :user_id => self.id, :school_id => subject.school.id\n }).enrollment_code\n end", "def enrollment\n self.enrollments.last\n end", "def enrollment_class\n (params[:enrollment].blank? || params[:enrollment][:type].bl...
[ "0.62547576", "0.6156864", "0.6107583", "0.6100212", "0.6100212", "0.54374915", "0.5418792", "0.53990847", "0.52851766", "0.5195948", "0.50459254", "0.5044301", "0.5041658", "0.49603242", "0.4943003", "0.4932121", "0.4932121", "0.4932121", "0.4932121", "0.48653826", "0.486386...
0.66372126
0
prints either user.login, user.person.name or user.id
def user_id raise "Implement in Client or Advocate" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_person\n puts \"Name: #{name}\"\n puts \"Age: #{age} years old\"\n puts \"ID: VCN#{id}\"\n end", "def display_user(user)\n user.name\n end", "def print_details\n puts '=================: User-details: ============'\n puts \"Email-address: #{email}\"\n puts \"Domain name: #{doma...
[ "0.6688281", "0.66745484", "0.6457652", "0.63715786", "0.63321674", "0.6327497", "0.63260406", "0.63248664", "0.6317732", "0.6302515", "0.6287544", "0.6246894", "0.6231818", "0.61940676", "0.6188206", "0.61879027", "0.6182281", "0.6147786", "0.61392564", "0.6138977", "0.61242...
0.0
-1
has the client reviewed this advocate before?
def has_reviewed?(advocate) if self.is_a?(Client) !!self.reviews.find(:first, :conditions => ["reviews.reviewee_id = ?", advocate.id]) else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def just_reviewed?\n reviewed? and reviewed_changed?\n end", "def reviewed?\n !application_review_decision_type.nil?\n end", "def has_reviewed?(advocate)\n !!Review.find(:first, :conditions => [\"reviews.reviewer_id = ? AND reviews.reviewee_id = ?\", self.id, advocate.id])\n end", "def admited?\n...
[ "0.6962723", "0.6951596", "0.6888432", "0.6821519", "0.6724138", "0.6673054", "0.6649695", "0.66393495", "0.6584116", "0.65825", "0.6529163", "0.6506099", "0.64961934", "0.6485253", "0.64809805", "0.64794403", "0.64785326", "0.646771", "0.64576954", "0.64523226", "0.6444143",...
0.7062574
0
used for static map
def location_s self.location.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_map;\t@map \t\tend", "def generate_map\n end", "def map_name; end", "def mapping; end", "def mapping; end", "def map\n end", "def map; end", "def map\n end", "def map\n end", "def initialize\n @maps = {}\n end", "def template_map\n \n end", "def map\n\n end", ...
[ "0.7201", "0.7165845", "0.71357703", "0.71326274", "0.71326274", "0.7051928", "0.70053315", "0.6945554", "0.6945554", "0.69272983", "0.6915656", "0.689771", "0.6503429", "0.64925945", "0.64537233", "0.64056957", "0.6356393", "0.63456017", "0.6305316", "0.62915653", "0.6288407...
0.0
-1
can this person create a review about the given person?
def can_review?(person) self.is_a?(Client) && person.is_a?(Advocate) && !self.has_reviewed?(person) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def review\n end", "def review\n return access_denied unless @course.has_teacher(current_user) || @submission.group.has_reviewer?(current_user) || (@exercise.collaborative_mode == 'review' && (@course_instance.has_student(current_user) || @course_instance.has_assistant(current_user)))\n\n review = @submis...
[ "0.6855303", "0.681485", "0.67106456", "0.6673272", "0.66153204", "0.6605965", "0.6579222", "0.6559396", "0.6529452", "0.65129364", "0.6470003", "0.6427482", "0.6423194", "0.6358315", "0.6333888", "0.6333271", "0.6324867", "0.62956345", "0.628313", "0.62813956", "0.62672687",...
0.71082467
0
has this person already reviewed given person
def has_reviewed?(advocate) !!Review.find(:first, :conditions => ["reviews.reviewer_id = ? AND reviews.reviewee_id = ?", self.id, advocate.id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reviewed_by?(reviewer)\n return TeamReviewResponseMap.count(:conditions => ['reviewee_id = ? AND reviewer_id = ? AND reviewed_object_id = ?', \n self.id, reviewer.id, assignment.id]) > 0\n end", "def reviewed_by?(reviewer)\n return TeamReviewResponseMap.count(:con...
[ "0.74520993", "0.74520993", "0.74280393", "0.7403383", "0.7389714", "0.7338263", "0.7276387", "0.7127658", "0.70303196", "0.6954791", "0.689957", "0.68929625", "0.6875074", "0.6758047", "0.6754056", "0.6746109", "0.67353076", "0.6699243", "0.6687265", "0.6679876", "0.6605922"...
0.73290366
6
is an image assigned?
def image? self.image.file? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_image?(image)\n # FIXME\n true\n end", "def image?\n image ? true : false\n end", "def image?\n !!image\n end", "def has_image?\n !image.nil?\n end", "def new_image?\n @new_image\n end", "def has_image?\n\t\treturn File.exists? image_filename\n\tend", "def...
[ "0.73693824", "0.7257541", "0.7180311", "0.7178402", "0.7136997", "0.7131363", "0.71245015", "0.71201515", "0.71073306", "0.701647", "0.70154244", "0.7006234", "0.7006234", "0.6970317", "0.6849444", "0.6799971", "0.6785884", "0.6779696", "0.67743456", "0.66749257", "0.6620711...
0.69597024
15
creates the newsletter enrollment and activated
def create_enrollment(activate=true) if self.newsletter? if er = self.enrollment_class.find_by_email(self.enrollment_attributes[:email]) # check if an enrollment with this person's email exists and assign if !er.person || er.person != self er.attributes = self.enrollment_attributes end else er = self.enrollment ? self.enrollment : self.enrollments.build(self.enrollment_attributes) end if activate er.suppress_notifications! er.activate! else er.register! end else self.destroy_enrollment end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_enrollment\n\n end", "def create\n # Checks that the email is in fact an email address\n if !(EmailValidator.valid?(params[:instructor][:email]))\n flash[:danger] = \"Invalid Email Address and/or credentials.\"\n redirect_to instructor_index_path\n return\n end\n \n @ins...
[ "0.67457676", "0.63505316", "0.63146865", "0.6161125", "0.61570984", "0.6129536", "0.6109285", "0.60504663", "0.60328275", "0.5948842", "0.59308094", "0.59216565", "0.59023297", "0.5883201", "0.5816914", "0.57894444", "0.57855713", "0.5765749", "0.5760391", "0.5749214", "0.57...
0.74858135
0
returns true if the objec has been geo coded with lat/lng attributes
def geo_coded? !!(self.lat && self.lng) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def latlng_good?\n self.addr_latlng && self.addr_latlng.lat && self.addr_latlng.lng\n end", "def geocoded?\n read_coordinates.compact.size > 0\n end", "def resembles_latlng?\n !!coordinates\n end", "def geocoded?\r\n super && (self.latitude != 0 && self.longitude != 0)\r\n end", "def is_lat...
[ "0.7542206", "0.73923594", "0.7351973", "0.7329002", "0.71704954", "0.71055436", "0.71055436", "0.69511706", "0.6938236", "0.68745995", "0.6870327", "0.6699527", "0.65736705", "0.6562153", "0.64862335", "0.645738", "0.64289486", "0.6372341", "0.6349615", "0.63229674", "0.6286...
0.7920914
2
geocode address in case it is a personal or business address assigns person's location to either personal or business address
def geocode_addresses address = if self.is_a?(Advocate) self.business_address elsif self.is_a?(Client) # self.personal_address <- not for now end return unless address if !self.geo_coded? || address.changed? res = GeoKit::Geocoders::MultiGeocoder.geocode(address.to_s) if res.success self.lat = res.lat self.lng = res.lng self.province_code = Project.province_name_to_code(res.state) end end rescue GeoKit::Geocoders::GeocodeError => ex logger.error "Exception #{ex.message} caught when geocoding #{address.to_s}" return end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def geocode_address\n full_address or address\n end", "def geocode_address\n geo = Geokit::Geocoders::MultiGeocoder.geocode(self.address_string)\n if geo.success\n self.lat, self.lng = geo.lat, geo.lng\n else\n puts geo.class\n errors.add(:address, \"Could not Geocode address\")\n ...
[ "0.811499", "0.7417637", "0.73391336", "0.7053819", "0.7048741", "0.7045621", "0.6958479", "0.69554603", "0.6918603", "0.6878275", "0.68685997", "0.6787906", "0.6736527", "0.673223", "0.66999745", "0.6647118", "0.66170776", "0.66060317", "0.6525566", "0.6521968", "0.65118384"...
0.72713256
3
Your task is to make a function that can take any nonnegative integer as a argument and return it with it's digits in descending order. Descending order means that you take the highest digit and place the next highest digit immediately after it. Examples: Input: 145263 Output: 654321 Input: 1254859723 Output: 9875543221 I got the best method on the first try!
def descending_order(n) n.to_s.chars.sort.reverse.join.to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def descending_order(n)\n if n.to_i >= 0\n n.digits.sort.reverse.join.to_i\n end\n\nend", "def descending_order(n)\n n.digits.sort().reverse.join.to_i\nend", "def descending_order(n)\n n.digits.sort.reverse.join.to_i\nend", "def descending_digits(int)\n # your code goes here\n int.to_s.split...
[ "0.80337495", "0.80115885", "0.79985154", "0.7913285", "0.7806443", "0.7806443", "0.77892256", "0.77722615", "0.7738622", "0.771025", "0.7699451", "0.7691196", "0.7682387", "0.7668052", "0.7665334", "0.76613444", "0.7647545", "0.76208866", "0.75996983", "0.7596235", "0.755925...
0.73497415
25
TODO: This override doesn't work in Thor 1.1+
def options original_options = super defaults = Thor::CoreExt::HashWithIndifferentAccess.new( { width: 72, count: 200, }, ) config_path = File.expand_path(ENV.fetch('AUGURY_CFG_PATH', '~/.augury.yml')) if File.file?(config_path) config_options = Thor::CoreExt::HashWithIndifferentAccess.new(YAML.load_file(config_path) || {}) defaults = defaults.merge(config_options) end # Enforce implied options defaults[:links] = true if original_options[:remove_links] || defaults[:remove_links] Thor::CoreExt::HashWithIndifferentAccess.new(defaults.merge(original_options)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def custom; end", "def custom; end", "def overrides; end", "def special\n override\n end", "def terpene; end", "def specialty; end", "def extra; end", "def weber; end", "def macro; raise No...
[ "0.6994615", "0.67503333", "0.67503333", "0.67503333", "0.67503333", "0.6723926", "0.6723926", "0.6442793", "0.63892657", "0.6305259", "0.6247896", "0.6245778", "0.6182148", "0.61293143", "0.61293143", "0.61293143", "0.61014074", "0.60961944", "0.60961944", "0.6072764", "0.60...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_domain @domain = Domain.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a trusted parameter "white list" through.
def domain_params params.require(:domain).permit(:name, :ext_id, :origin_server) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
GET /studyplan/courses/1 GET /studyplan/courses/1.xml
def show # OBSOLETE authorize! :read, @study_plan @skill = Skill.find(params[:id]) @competence = Competence.find(params[:competence_id]) @prereq_ids = @skill.prereq_ids.to_set @prereq_courses = @skill.prereq_courses.includes([:localized_description, {:skills => :localized_description}]).uniq log("view_skill #{@skill.id}") render :action => 'show', :layout => 'leftnav' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_courses\n if current_user.is_admin?\n @user = User.find(params[:id])\n @courses = @user.courses\n respond_to do |format|\n format.xml { render :xml => @courses }\n end\n else\n respond_to do |format|\n format.xml { render :text => \"error\" }\n end\n ...
[ "0.6759158", "0.6597344", "0.6515803", "0.63642734", "0.6305661", "0.6305661", "0.6305661", "0.6305661", "0.6305661", "0.6305661", "0.6305661", "0.630328", "0.62499666", "0.6228452", "0.6226252", "0.62173665", "0.6210035", "0.62073815", "0.6184006", "0.6138438", "0.6077063", ...
0.0
-1