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
Returns the default FavoriteFolder for the Profile
def favorite_folder favorite_folders.where(is_permanent: true).first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_favorite_folder\n self.favorite_folder_id = profile.favorite_folder.id if favorite_folder.nil?\n end", "def root_folder\n folders.first({ title: Folder::DefaultFolder, folder_id: nil })\n end", "def create_favorite_folder\n favorite_folders.create(name: 'Favorites', is_permanent: true)...
[ "0.6917418", "0.63429517", "0.6157011", "0.61051327", "0.58951735", "0.5822102", "0.5635274", "0.56333554", "0.56272036", "0.5606955", "0.5606091", "0.5606091", "0.5606091", "0.55956393", "0.5574528", "0.5557467", "0.5478217", "0.54767954", "0.54449695", "0.5431579", "0.54028...
0.6833164
1
Returns the Profile's default ProfilePic, or nil if none.
def default_profile_pic profile_pics.where(is_default: true).first || ProfilePic.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def profile_pic_default\n if profile_pic.attached? \n profile_pic.variant(resize: \"150x150!\").processed\n else \n \"/default_profile.jpg\"\n end\n end", "def default_photo\n group.default_profile_persona==1 ? pers_photo : prof_photo\n end", "def ensure_default_pic\n if profile.de...
[ "0.81295836", "0.7692296", "0.7682994", "0.7592804", "0.7583608", "0.7477242", "0.7378508", "0.7342247", "0.7195807", "0.7195807", "0.7195807", "0.718254", "0.70377237", "0.701012", "0.6999235", "0.6990117", "0.697339", "0.69489634", "0.68785745", "0.686091", "0.6823661", "...
0.8244903
0
Returns whether or not the Profile has a profile pic. Useful for views.
def has_profile_pic? !default_profile_pic.new_record? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_profilepic?\n profile_pic != nil\n end", "def has_profile?\n vips_image.get_fields.include?('icc-profile-data')\n end", "def has_profile_image?\n branding_settings.try(:profile_image).present?\n end", "def has_avatar?\n key = 'profile_pic_url'\n user[key].present? && [us...
[ "0.878081", "0.83372474", "0.8087612", "0.80714804", "0.8066884", "0.7826075", "0.7621624", "0.75712556", "0.74197197", "0.73450696", "0.721835", "0.720555", "0.7157462", "0.7091938", "0.7069218", "0.7055408", "0.70396024", "0.70182055", "0.69774896", "0.6946005", "0.6843933"...
0.8057674
5
Convenience method to see if a favable has been faved by the Profile.
def has_faved?(favable) if favable.is_a?(Journal) return favorites.journals.pluck(:favable_id).include?(favable.id) elsif favable.is_a?(Submission) return favorites.submissions.pluck(:favable_id).include?(favable.id) elsif favable.is_a?(Stream) return favorites.streams.pluck(:favable_id).include?(favable.id) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_fav?(user)\n user.favs.find_by(post_id: self.id)\n end", "def favorited?(wallpaper)\n self.favorites.find_by_wallpaper_id(wallpaper.id)\n end", "def following_profile?(profile)\n return favorites.streams.where(favable_id: profile.stream_ids).count > 0\n end", "def is_favorite_of user...
[ "0.6752834", "0.67046946", "0.66517", "0.6635059", "0.65702885", "0.65658325", "0.6561765", "0.65327084", "0.65303963", "0.6526815", "0.6521099", "0.64913017", "0.63940847", "0.6377054", "0.636943", "0.6368255", "0.63442206", "0.6342617", "0.6255028", "0.62443566", "0.6244356...
0.75955886
0
Convenience method to see if a shareable has been shared by the Profile.
def has_shared?(shareable) if shareable.is_a?(Journal) return shares.journals.pluck(:shareable_id).include?(shareable.id) elsif shareable.is_a?(Submission) return shares.submissions.pluck(:shareable_id).include?(shareable.id) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_shareable?\n true\n end", "def shareable?(share_with)\n str = @asset.shared_with.to_s\n a = str.split(\",\")\n #Ensures that the file isn't being shared to ones self\n if share_with == current_user.id\n return false\n end\n #Ensures that the file isn't bein...
[ "0.7893161", "0.7678678", "0.75574946", "0.74350417", "0.7341167", "0.72782993", "0.72689086", "0.72508264", "0.71405876", "0.709594", "0.69490284", "0.6935312", "0.6889677", "0.68782365", "0.6872918", "0.6865559", "0.68396753", "0.6819766", "0.68005353", "0.6707821", "0.6667...
0.79115087
0
Convenience method to see if a votable has been voted on by the Profile.
def has_voted_on?(votable) # Ineffecient. Change to a better way. return votes.pluck(:votable_id).include?(votable.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def voted?(voteable)\n up_voted?(voteable) || down_voted?(voteable)\n end", "def voted_by?(user)\n !!vote_ups.find_by_user_id(user.id) if user\n end", "def voted_by?(voter)\n 0 < Vote.where(\n :voteable_id => self.id,\n :voteable_type => self.class.name,\n :voter_id ...
[ "0.7403104", "0.7316133", "0.72029334", "0.71755666", "0.7166118", "0.7166118", "0.7156923", "0.71274054", "0.70969784", "0.70348305", "0.70249265", "0.6950986", "0.68510604", "0.68180734", "0.68086594", "0.67786324", "0.6735513", "0.6702948", "0.6688358", "0.6640314", "0.662...
0.7544916
0
Is the Profile in the specified Filter?
def in_filter?(filter) profile_filters.include?(filter) and filter_profiles.where(filter: filter).first.is_approved? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_filter_is?(filter)\n session[:current_filter] == filter\n end", "def custom_filter?(filter)\n self.respond_to? filter\n end", "def current_filter?(ctype)\n (ctype.to_name_s('+') == params[:filter])\n end", "def filter?\n @filter.is_a?(Lolita::Configuration::Filter)\n ...
[ "0.6719729", "0.6650012", "0.6648726", "0.66081154", "0.65847987", "0.6551613", "0.6540032", "0.6537858", "0.6516742", "0.64769864", "0.64465624", "0.64295805", "0.63937163", "0.6377854", "0.63394606", "0.62887263", "0.6281544", "0.6280473", "0.6266715", "0.6238569", "0.62050...
0.81797576
0
Central method for faving an object
def fave(favable) favorite_folder.add_favable(favable) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_object\n end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; ...
[ "0.6632058", "0.61614996", "0.61614996", "0.61614996", "0.61614996", "0.61614996", "0.61614996", "0.61614996", "0.61614996", "0.61614996", "0.61614996", "0.61614996", "0.61614996", "0.61614996", "0.61614996", "0.61614996", "0.6025032", "0.5936384", "0.5891253", "0.58381754", ...
0.0
-1
Returns all the Streams the Profile has faved (is watching)
def faved_streams stream_ids = favorites.streams.pluck(:favable_id) return Stream.find(stream_ids) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_watching\n faved_favorites = favorites.streams\n profile_ids = faved_favorites.collect { |favorite| favorite.favable.profile_id }.uniq\n watches = []\n profile_ids.each do |profile_id|\n fave = faved_favorites.find { |favorite| profile_id == favorite.favable.profile_id }\n watches << W...
[ "0.7187029", "0.63561517", "0.6175879", "0.61235344", "0.59042203", "0.5815706", "0.5800484", "0.5740853", "0.5726954", "0.57252175", "0.56622845", "0.5651134", "0.5634016", "0.5534253", "0.5483522", "0.54815805", "0.54815805", "0.5428691", "0.54028046", "0.5389142", "0.53715...
0.74732125
0
"Follows" another profile, basically faves all of their default Streams
def follow_profile(profile) profile.streams.permanent.each do |stream| favorites.create(favable: stream) end profile.tidbits.create(targetable: self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def following_profiles\n stream_ids = favorites.streams.pluck(:favable_id).uniq\n profile_ids = Stream.where(id: stream_ids).pluck(:profile_id).uniq\n return Profile.where(id: profile_ids)\n end", "def followed_by_profiles\n profile_ids = Favorite.where(favable_type: 'Stream', favable_id: stream_ids...
[ "0.63275856", "0.62095255", "0.5983878", "0.5931994", "0.59178215", "0.58668286", "0.57670265", "0.57600915", "0.5729957", "0.566346", "0.5659037", "0.5645449", "0.56270003", "0.56270003", "0.5617737", "0.55944616", "0.55944616", "0.55944616", "0.55944616", "0.55944616", "0.5...
0.7402518
0
"Unfollows" another profile. Unfaves all streams that may have been faved.
def unfollow_profile(profile) favorites.streams.where(favable_id: profile.stream_ids).each do |favorite| favorite.destroy end tidbit = profile.tidbits.where(targetable_id: id, targetable_type: 'Profile').first tidbit.destroy if tidbit end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unfollow\n requested_profile.unfollow!(requested_follow_profile)\n redirect_to :action => 'following', :profile_id => current_user.profile\n end", "def unfollow\n current_profile.unfollow_profile(@profile)\n respond_to do |format|\n format.html { redirect_to profile_home_path(@profile.site_...
[ "0.7410559", "0.7104701", "0.6547433", "0.651463", "0.6464332", "0.6438071", "0.6421014", "0.6415792", "0.62981755", "0.62923276", "0.62774616", "0.6267269", "0.6256654", "0.6256654", "0.6256654", "0.6256596", "0.6242893", "0.6240033", "0.6240033", "0.6236129", "0.6236129", ...
0.759257
0
Is this Profile following another specified profile?
def following_profile?(profile) return favorites.streams.where(favable_id: profile.stream_ids).count > 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_follow_this_profile?(profile)\n # return current_user.profile.follows?(profile)\n\n @current_profile = current_user.profile\n return @current_profile.follows?(profile)\n# return profile.id == @current_profile.id\n\n end", "def switching_to_new_profile?(new_profile)\n @last_profile && @la...
[ "0.7550282", "0.7197669", "0.70086336", "0.6935615", "0.6935615", "0.6907541", "0.688647", "0.68478733", "0.6794659", "0.67699695", "0.6749816", "0.6728141", "0.6662959", "0.66626424", "0.6651874", "0.6570031", "0.6550485", "0.65424734", "0.6510863", "0.65088755", "0.6494133"...
0.7124868
2
Is this Profile following a specific stream?
def following_stream?(stream) return favorites.streams.pluck(:favable_id).include?(stream.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def following_profile?(profile)\n return favorites.streams.where(favable_id: profile.stream_ids).count > 0\n end", "def stream?\n return false\n end", "def stream?\n !!@stream\n end", "def stream?\n !!@stream\n end", "def declared_stream?(index)\n\t @streams && (@streams.size...
[ "0.75423414", "0.6628732", "0.65861034", "0.65861034", "0.65198433", "0.6480199", "0.6436376", "0.6421818", "0.6421818", "0.6393921", "0.6330527", "0.6289915", "0.62849385", "0.6265297", "0.6257137", "0.624649", "0.6200249", "0.6113432", "0.60683775", "0.60542357", "0.6045326...
0.7087718
1
Returns all the profiles that the Profile is following
def following_profiles stream_ids = favorites.streams.pluck(:favable_id).uniq profile_ids = Stream.where(id: stream_ids).pluck(:profile_id).uniq return Profile.where(id: profile_ids) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def profiles\n Management::Profile.all(self)\n end", "def profiles\n @profiles.sort_by(&:name)\n end", "def followed_by_profiles\n profile_ids = Favorite.where(favable_type: 'Stream', favable_id: stream_ids).pluck(:profile_id).uniq\n return Profile.where(:id => profile_ids)\n end", "de...
[ "0.75242394", "0.75082994", "0.73016447", "0.70161724", "0.70036083", "0.6968137", "0.69249505", "0.68886423", "0.6667675", "0.6642231", "0.6642231", "0.6600338", "0.6537163", "0.6536929", "0.64933467", "0.648818", "0.64389896", "0.63779783", "0.63262296", "0.6293618", "0.623...
0.7546731
0
Returns the count of the profiles the Profile is following
def following_profiles_count stream_ids = favorites.streams.pluck(:favable_id).uniq return Stream.where(:id => stream_ids).pluck(:profile_id).uniq.count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def followed_by_profiles_count\n return Favorite.where(favable_type: 'Stream', favable_id: stream_ids).pluck(:profile_id).uniq.count\n end", "def following_users_count\n following_users.count\n end", "def count_likes\n self.likers(Profile).length\n end", "def count_user\n count = 0\n @f_net...
[ "0.7726116", "0.740404", "0.72764474", "0.71368337", "0.7120438", "0.7067005", "0.6936207", "0.69345504", "0.69050354", "0.68962973", "0.68798244", "0.68655014", "0.68055564", "0.67416036", "0.6722522", "0.6719693", "0.66804093", "0.66756326", "0.663859", "0.6627735", "0.6621...
0.79783124
0
Returns all the profiles that the Profile is being followed by
def followed_by_profiles profile_ids = Favorite.where(favable_type: 'Stream', favable_id: stream_ids).pluck(:profile_id).uniq return Profile.where(:id => profile_ids) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def profiles\n @profiles.sort_by(&:name)\n end", "def following_profiles\n stream_ids = favorites.streams.pluck(:favable_id).uniq\n profile_ids = Stream.where(id: stream_ids).pluck(:profile_id).uniq\n return Profile.where(id: profile_ids)\n end", "def profiles; end", "def profiles\n Ma...
[ "0.75834244", "0.7304473", "0.72000647", "0.7148076", "0.7079121", "0.6977991", "0.69299686", "0.6884715", "0.6760448", "0.6751067", "0.6642137", "0.664115", "0.6445858", "0.63759214", "0.6367919", "0.6360475", "0.6353433", "0.63361883", "0.6330999", "0.6291929", "0.6279929",...
0.73051536
1
Returns the count of the profiles the Profile is being followed by
def followed_by_profiles_count return Favorite.where(favable_type: 'Stream', favable_id: stream_ids).pluck(:profile_id).uniq.count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def following_profiles_count\n stream_ids = favorites.streams.pluck(:favable_id).uniq\n return Stream.where(:id => stream_ids).pluck(:profile_id).uniq.count\n end", "def followers_count\n follow_count_for_a(:follower)\n end", "def count_likes\n self.likers(Profile).length\n end", "def ...
[ "0.7779168", "0.696203", "0.6929895", "0.68804663", "0.6865337", "0.6758966", "0.6756158", "0.6710119", "0.66650456", "0.66614187", "0.6627015", "0.6580047", "0.6558029", "0.65191793", "0.6503058", "0.6485435", "0.6483384", "0.6482262", "0.64769745", "0.6463789", "0.6434172",...
0.7749984
1
This is a special method. Because of how Stream objects work, sometimes we want to get who faved a Profile and when, for dash/streams views. If one profile faves a Submission stream and another a Journal stream, both count as "watches" or being "faved by." But, each watch is considered a single watch, even if 3 streams were faved over time, therefore we only count the furtherst back active fave as the actual "watch." returns Watch objects
def watched_by(options = {}) include_followed = options.delete(:include_followed) include_followed = true if include_followed.nil? stream_ids = streams.pluck(:id) faved_by_favorites = Favorite.streams.where(favable_id: stream_ids) profile_ids = faved_by_favorites.collect { |favorite| favorite.profile_id }.uniq if !include_followed followed_stream_ids = favorites.streams.pluck(:favable_id).uniq profile_ids -= Stream.where(:id => followed_stream_ids).pluck(:profile_id).uniq end watches = [] profile_ids.each do |profile_id| fave = faved_by_favorites.find { |favorite| profile_id == favorite.profile_id } watches << Watch.new(profile: fave.profile, created_at: fave.created_at, watched_profile: self) end return watches end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_watching\n faved_favorites = favorites.streams\n profile_ids = faved_favorites.collect { |favorite| favorite.favable.profile_id }.uniq\n watches = []\n profile_ids.each do |profile_id|\n fave = faved_favorites.find { |favorite| profile_id == favorite.favable.profile_id }\n watches << W...
[ "0.73949987", "0.5872559", "0.5795757", "0.57382846", "0.5723685", "0.55907184", "0.5271051", "0.52695966", "0.52025896", "0.52021366", "0.5161567", "0.51508945", "0.50044346", "0.5002256", "0.49725717", "0.49722734", "0.4966501", "0.4948782", "0.4906371", "0.49054608", "0.49...
0.68930334
1
Similar to watched_by above, this does the opposite, returning all that the current profile is "watching."
def is_watching faved_favorites = favorites.streams profile_ids = faved_favorites.collect { |favorite| favorite.favable.profile_id }.uniq watches = [] profile_ids.each do |profile_id| fave = faved_favorites.find { |favorite| profile_id == favorite.favable.profile_id } watches << Watch.new(profile: fave.profile, created_at: fave.created_at, watched_profile: fave.favable.profile) end return watches end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def watched_by(options = {})\n include_followed = options.delete(:include_followed)\n include_followed = true if include_followed.nil?\n\n stream_ids = streams.pluck(:id)\n faved_by_favorites = Favorite.streams.where(favable_id: stream_ids)\n profile_ids = faved_by_favorites.collect { |favorite| fav...
[ "0.6819214", "0.67793375", "0.62777394", "0.62424165", "0.6207947", "0.61769485", "0.6161091", "0.61454314", "0.6087437", "0.6066614", "0.60482126", "0.60241085", "0.5981749", "0.5964011", "0.5963655", "0.59266454", "0.58925", "0.58760184", "0.5847644", "0.58239985", "0.57923...
0.75770104
0
Approves another object that was collaborated on. Currently only for Submission for_profile: Set another one of the User's profiles as the collaborator.
def approves!(submission, options = {}) for_profile = options[:for_profile] collaboration = collaborations.where(submission: submission).first params = { is_approved: true } if for_profile and for_profile != self and user.profiles.include?(for_profile) params[:profile_id] = options[:for_profile].id end collaboration.update_attributes(params) # Remove the associated notification. notifications.where(notifyable_type: 'Collaboration', notifyable_id: collaboration.id).first.destroy end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_approver!(_ctx, user:, performer:, **)\n user.update!(approver_id: performer)\n end", "def assign_approver\n if approver == \"1\"\n document.approver = user\n document.save!\n end\n end", "def approve\n #get profile, and profile owner\n presenter = find_presenter\n ...
[ "0.67176545", "0.63946414", "0.6365974", "0.6158465", "0.60430634", "0.6041631", "0.5891752", "0.5863112", "0.5792993", "0.57623863", "0.57411826", "0.5735915", "0.5681341", "0.56434417", "0.5527686", "0.5513986", "0.5511334", "0.55044055", "0.5490463", "0.54810816", "0.54746...
0.68999445
0
Declines another object that was collaborated on. Currently only for Submission
def declines!(submission) collaboration = collaborations.where(submission: submission).first # Remove the associated notification. notifications.where(notifyable_type: 'Collaboration', notifyable_id: collaboration.id).first.destroy collaboration.destroy end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unsubmit(_ = nil)\n # Skip the state validation in answers.\n @unsubmitting = true\n\n unsubmit_current_answers\n self.points_awarded = nil\n self.draft_points_awarded = nil\n self.awarded_at = nil\n self.awarder = nil\n self.submitted_at = nil\n self.publisher = nil\n self.publis...
[ "0.6245273", "0.6226396", "0.6033461", "0.6024972", "0.5916875", "0.5915026", "0.5905213", "0.5895565", "0.58222264", "0.58006954", "0.57432663", "0.57366806", "0.57303405", "0.57298934", "0.5717303", "0.5700321", "0.5680015", "0.56501734", "0.5645212", "0.5637086", "0.562986...
0.6784207
0
Claims a Submission for the Profile. If not approved by the Submission owner, it will send a Notification
def claims!(submission) if not submission.claimed? and submission.owner != self submission.profile.notifications.create(notifyable: submission, rules: 'submission:claim') submission.owner = self submission.save end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def approves!(submission, options = {})\n for_profile = options[:for_profile]\n collaboration = collaborations.where(submission: submission).first\n params = { is_approved: true }\n if for_profile and for_profile != self and user.profiles.include?(for_profile)\n params[:profile_id] = options[:for_...
[ "0.7001318", "0.6952971", "0.6481175", "0.63447416", "0.6322751", "0.6223418", "0.62042594", "0.61513567", "0.6151309", "0.6079531", "0.6042198", "0.60342604", "0.5952765", "0.5939442", "0.5936628", "0.58959925", "0.5864538", "0.58637506", "0.58485425", "0.5828907", "0.581144...
0.82055664
0
Relinquishes a Submission to another Profile
def relinquishes!(submission) return false if submission.profile != self return nil if submission.owner.nil? submission.profile = submission.owner submission.save notification = notifications.where(notifyable_type: 'Submission', notifyable_id: submission.id).first notification.destroy if notification end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def approves!(submission, options = {})\n for_profile = options[:for_profile]\n collaboration = collaborations.where(submission: submission).first\n params = { is_approved: true }\n if for_profile and for_profile != self and user.profiles.include?(for_profile)\n params[:profile_id] = options[:for_...
[ "0.68257326", "0.6661748", "0.62931114", "0.6249205", "0.6098513", "0.5958011", "0.59574926", "0.5931018", "0.59201914", "0.59003514", "0.5887926", "0.5882185", "0.58649814", "0.5835284", "0.58283484", "0.5813526", "0.57974213", "0.5772153", "0.57611835", "0.57429385", "0.573...
0.73790526
0
True if the user has a banner image uploaded/set
def has_banner_image? !banner_image.path.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uploaded_image_displayed?\n displayed? UPLOADED_IMAGE\n end", "def images_add?\r\n\t\tuser_allowed_to_object?(user, record, [:edit])\r\n\tend", "def has_image?\n false\n end", "def image_upload_allowed?\n company = sender.company\n !!company.settings.recognition_editor_settings[:allow_uploa...
[ "0.724342", "0.70548373", "0.70257616", "0.69180375", "0.6917775", "0.6903815", "0.69025767", "0.6877166", "0.6874702", "0.6861911", "0.68586576", "0.68028206", "0.6752026", "0.673351", "0.67163944", "0.66765994", "0.66325486", "0.66325486", "0.66282356", "0.657947", "0.65722...
0.78178376
0
If the User doesn't have a Profile set yet, this becomes their default one.
def check_user_default_profile if user.default_profile.nil? user.default_profile = self end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_profile\n @profile = (current_user.profile ||= Profile.create)\n end", "def set_user_profile\n @user_profile = @user.user_profile\n @user_profile = @user.create_user_profile if @user_profile.nil?\n end", "def current_profile\n profile = profiles.detect {|a| a.default == true}\n unl...
[ "0.7562166", "0.74746656", "0.7363357", "0.73017025", "0.72980154", "0.7245776", "0.72247595", "0.7207279", "0.7201806", "0.71862376", "0.71590585", "0.71522146", "0.71522146", "0.71522146", "0.71522146", "0.71365", "0.70816046", "0.7069189", "0.7069189", "0.7069189", "0.7069...
0.86322314
0
Each Profile has a default set of streams which represents their whole output.
def create_default_streams streams.create(name: 'Submissions', is_public: true, is_permanent: true, rules: 'submissions:profile') streams.create(name: 'Journals', is_public: true, is_permanent: true, rules: 'journals:profile') streams.create(name: 'Favorites', is_public: true, is_permanent: true, rules: 'favorites:profile') streams.create(name: 'Comments', is_public: true, is_permanent: true, rules: 'comments:profile') streams.create(name: 'Shares', is_public: true, is_permanent: true, rules: 'shares:profile') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_streams\n [:default]\n end", "def set_default_outputs\n @output_options = OUTPUTS\n end", "def streams\n []\n end", "def stream_names\n @stream_names ||= init_stream_names\n end", "def all\n @available_profiles ||= yaml_config['profiles'].map(&:first)\n ...
[ "0.7510307", "0.60697895", "0.58937246", "0.57719284", "0.5718165", "0.5703624", "0.54087055", "0.539374", "0.5390301", "0.5368884", "0.5362589", "0.5320237", "0.5320237", "0.5320237", "0.5320237", "0.5320237", "0.5320237", "0.5320237", "0.5320237", "0.52842706", "0.5261305",...
0.68024737
1
Each Profile needs a default SubmissionFolder
def create_submission_folder submission_folders.create(name: 'Submissions', is_permanent: true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def submission_folder\n submission_folders.where(is_permanent: true).first\n end", "def default_profile\n super\n end", "def default_profile\n super\n end", "def default_profile\n super\n end", "def default_profile\n super\n end", "def default_profile\n super\n ...
[ "0.6201199", "0.60206765", "0.60206765", "0.60206765", "0.60206765", "0.60206765", "0.60206765", "0.60206765", "0.60206765", "0.5980128", "0.5836396", "0.5760552", "0.5732223", "0.5704259", "0.5606334", "0.5560545", "0.5560545", "0.5560545", "0.5560545", "0.5560545", "0.55605...
0.6293507
0
Each Profile needs a default FavoriteFolder
def create_favorite_folder favorite_folders.create(name: 'Favorites', is_permanent: true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_favorite_folder\n self.favorite_folder_id = profile.favorite_folder.id if favorite_folder.nil?\n end", "def favorite_folder\n favorite_folders.where(is_permanent: true).first\n end", "def user_selection\n if Dir.exist?('../profiles')\n Dir.chdir('../profiles')\n puts Dir.pwd\n ...
[ "0.7040821", "0.64406025", "0.6415199", "0.6291816", "0.60369307", "0.6025603", "0.59538645", "0.59525234", "0.59525234", "0.59525234", "0.59525234", "0.59525234", "0.59525234", "0.59525234", "0.59525234", "0.59072596", "0.58768934", "0.5857685", "0.57888454", "0.57547045", "...
0.6384023
3
This is here so we make sure that the data we put into the exposed profiles array is clean.
def ensure_only_fixnums_in_exposed_profiles # if exposed_profiles.collect { |i| false if not i.is_a?(Fixnum) }.compact.size > 0 if exposed_profiles.collect { |i| false if not i.to_i > 0 }.compact.size > 0 errors.add(:exposed_profiles, 'can only contain Fixnums') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def profiles_load_from_params(val)\r\n\r\nself.profiles_was = self.profiles.all if val\r\ncase val\r\nwhen Hash, HashWithIndifferentAccess\r\n self.profiles = val.map {|k, v|\r\n if k[/\\A(_|-)\\d+/] # CREATE\r\n elt = Profile.load_from_params(v)\r\n if !elt.valid?\r\n self.errors.add(:profile...
[ "0.6523503", "0.6438262", "0.6431235", "0.63764703", "0.63336694", "0.6317879", "0.62436306", "0.624318", "0.62121487", "0.60724974", "0.6034477", "0.593695", "0.59152323", "0.5841328", "0.5838905", "0.5815821", "0.5809506", "0.5801209", "0.5756801", "0.5753926", "0.5743988",...
0.0
-1
Also to make sure users can't add profiles they don't own.
def ensure_only_owned_profile_ids_in_exposed_profiles owned_profile_ids = user.profiles.pluck(:id) exposed_profiles.each do |profile_id| if not owned_profile_ids.include?(profile_id.to_i) errors.add(:exposed_profiles, 'can only contain valid profiles') break end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirm!\n # add if else here in case user already existed and is updating/changing data (email etc),\n # shouldn't add_profile again if profile already exists. can determine with a user db 'nil' value...\n unless self.profile\n add_profile\n end\n super\n end", "def ensure_user_has_pro...
[ "0.7163851", "0.7000907", "0.67993534", "0.67990386", "0.6725252", "0.6715535", "0.6633424", "0.66235256", "0.6610637", "0.65849584", "0.65414304", "0.6539946", "0.65318364", "0.65262693", "0.6521659", "0.6483847", "0.6450491", "0.6440159", "0.64304936", "0.64301705", "0.6416...
0.6540782
11
And just because, make sure self isn't included in exposed_profiles
def ensure_self_is_not_in_exposed_profiles if exposed_profiles.include?(id) errors.add(:exposed_profiles, 'should not include self') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def profile\n super\n end", "def profile\n super\n end", "def profile; end", "def profile; end", "def profiles; end", "def profile\n end", "def profile\n end", "def profile\n end", "def profile\n end", "def profile\n end", "def profile\n end", "def is_base_profile\n ...
[ "0.71922517", "0.71922517", "0.6859461", "0.6859461", "0.68083704", "0.6708177", "0.6708177", "0.6708177", "0.6708177", "0.6708177", "0.6708177", "0.6703474", "0.6703474", "0.6703474", "0.6703474", "0.6703474", "0.6703474", "0.6703474", "0.6703474", "0.6561943", "0.65501875",...
0.6486808
23
Create a New Test
def v2_tests_post(test_detail, opts = {}) if Configuration.debugging Configuration.logger.debug "Calling API: TestsApi#v2_tests_post ..." end # verify the required parameter 'test_detail' is set fail "Missing the required parameter 'test_detail' when calling v2_tests_post" if test_detail.nil? # resource path path = "/v2/tests".sub('{format}','json') # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json', 'text/json', 'application/xml', 'text/xml'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(test_detail) auth_names = [] result = @api_client.call_api(:POST, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'TestSummary') if Configuration.debugging Configuration.logger.debug "API called: TestsApi#v2_tests_post. Result: #{result.inspect}" end return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n result = Test.new.create_test(test_params)\n if result\n return render json: {message: 'Test was created succesfully', error: false }\n else\n return render json: {message: 'Error: Test was not created succesfully', error: true }\n end\n end", "def create\n @u...
[ "0.75821525", "0.72152174", "0.7087303", "0.7086398", "0.7007135", "0.7000394", "0.7000394", "0.7000394", "0.7000394", "0.7000394", "0.7000394", "0.6990102", "0.6987588", "0.69808096", "0.6957267", "0.6949139", "0.6947935", "0.684997", "0.6837486", "0.6828241", "0.6812094", ...
0.0
-1
This loads the Fedora and Solr config info from /config/fedora.yml You can load it from a different location by passing a file path as an argument.
def restore_spec_configuration ActiveFedora.init(:fedora_config_path=>File.join(File.dirname(__FILE__), "..", "config", "fedora.yml")) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_config_file(file_path)\n # Look for config file in order of precedence.\n unless file_path\n ['~/.catflap', '/usr/local/etc/catflap', '/etc/catflap'].each do |path|\n file = File.expand_path(path + '/config.yaml')\n if File.readable? file\n file_path = file\n bre...
[ "0.6352553", "0.63335985", "0.6191242", "0.61631376", "0.6159034", "0.61195856", "0.6101647", "0.60883844", "0.6022279", "0.5991187", "0.59670025", "0.59663105", "0.59246683", "0.59127057", "0.58676314", "0.585927", "0.58362114", "0.5829635", "0.58269745", "0.58008134", "0.57...
0.6302818
2
Default column formats used in to_table for active_record result arrays Hash options are: => :class => 'class_name' used to add a CSS class to the element => :formatter => A symbol denoting a method or a proc to be used to format the data element. It will be passed the elemet only.
def default_formats attr_formats = {} columns.each do |column| attr_formats[column.name] = case column.type when :integer, :float {:class => :right, :formatter => :number_with_delimiter} when :text, :string {} when :date, :datetime {} else {} end end attr_formats end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_table_format(table)\n #change to format module\n CliBuilder::Menu.modelcase(table).constantize\n end", "def table_opts\n {\n converters: [YEAR_NORMALIZER, :float],\n headers: true,\n header_converters: [->(header) { normalize_key(header) }],\n...
[ "0.61337984", "0.6084288", "0.60757965", "0.59496665", "0.5894705", "0.5869418", "0.58687", "0.58353573", "0.5810802", "0.5790085", "0.5765097", "0.5751316", "0.5728224", "0.56888396", "0.5676561", "0.56655", "0.56636524", "0.5658854", "0.56459844", "0.56388587", "0.5630745",...
0.71634996
0
GET /activities/1 GET /activities/1.xml
def show @activity = Activity.find(params[:id]) respond_to do |format| format.html { redirect_to activity_comments_url(@activity) } format.xml { render :xml => @activity.to_xml(:include => :user, :except => NB_CONFIG['api_exclude_fields']) } format.json { render :json => @activity.to_json(:include => :user, :except => NB_CONFIG['api_exclude_fields']) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activity(id)\n get(\"/activities/#{id}.json\")\n end", "def activity(id)\n get(\"/activities/#{id}.json\")\n end", "def activities\n get_call(\"1/activities.json\")\n end", "def activities(params = {})\n scope 'default'\n get('activities/', params)\n end", "def acti...
[ "0.7731679", "0.7731679", "0.76351863", "0.7527707", "0.72161454", "0.711193", "0.7065614", "0.70470214", "0.70470214", "0.70470214", "0.7036724", "0.7018399", "0.7012659", "0.6958606", "0.69390625", "0.69003683", "0.6875688", "0.6832548", "0.68305916", "0.67881495", "0.67348...
0.6583918
28
PUT /activities/1 PUT /activities/1.xml
def update @activity = Activity.find(params[:id]) respond_to do |format| if @activity.update_attributes(params[:activity]) flash[:notice] = 'Activity was successfully updated.' format.html { redirect_to(@activity) } format.xml { head :ok } else format.html { render :action => "edit" } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @activity = Activity.find(params[:id])\n \n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to activities_path }\n format.xml { render :nothing => true }\n else\n format.html { render :action => \"edit\" }\n ...
[ "0.6862971", "0.6569313", "0.6498651", "0.64108145", "0.6368879", "0.6354697", "0.63545364", "0.62864166", "0.6268945", "0.62602323", "0.6172049", "0.61713374", "0.6162832", "0.6157493", "0.6138612", "0.6126983", "0.6114587", "0.6088887", "0.6088887", "0.6088887", "0.60869735...
0.6607646
1
DELETE /activities/1 DELETE /activities/1.xml
def destroy @activity = Activity.find(params[:id]) access_denied unless current_user.is_admin? or @activity.user_id == current_user.id @activity.delete! respond_to do |format| format.html { redirect_to(activities_url) } format.js { render :update do |page| page.remove 'activity_and_comments_' + @activity.id.to_s end } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n \n respond_to do |format|\n format.html { redirect_to activities_url }\n format.xml { render :nothing => true }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n ...
[ "0.7310507", "0.72857684", "0.72857684", "0.72857684", "0.72857684", "0.7224048", "0.7177418", "0.71454453", "0.7138242", "0.70279837", "0.70270747", "0.695578", "0.69322395", "0.69255114", "0.6920724", "0.69080377", "0.689847", "0.68981403", "0.6897991", "0.6860247", "0.6860...
0.0
-1
Stamp (fill in) the current values into a ProjectStat. Uses database. rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/BlockLength
def stamp # Use a transaction to get values from a single consistent point in time. Project.transaction do # Count projects at different levels of completion STAT_VALUES.each do |completion| public_send "percent_ge_#{completion}=", Project.gteq(completion).count next if completion.to_i.zero? # Don't record percentage "0" > level 0 public_send "percent_1_ge_#{completion}=", Project.where( 'badge_percentage_1 >= ?', completion.to_i ).count public_send "percent_2_ge_#{completion}=", Project.where( 'badge_percentage_2 >= ?', completion.to_i ).count end self.projects_edited = Project.where('created_at < updated_at').count # These use 1.day.ago, so a create or updates in 24 hours + fractional # seconds won't be counted today, and *might* not be counted previously. # This isn't important enough to solve. self.created_since_yesterday = Project.created_since(1.day.ago).count # Exclude newly-created records from updated_since count self.updated_since_yesterday = Project.updated_since(1.day.ago).count - created_since_yesterday # Record the number of reminders sent within the day. self.reminders_sent = Project.where('last_reminder_at > ?', 1.day.ago).count # If an inactive project becomes active within REACTIVATION_PERIOD # number of days after a reminder, the reminder is likely to be the # cause. Record the number of such projects. self.reactivated_after_reminder = Project.where('last_reminder_at > ?', REACTIVATION_PERIOD.day.ago) .where('updated_at > ?', REACTIVATION_PERIOD.day.ago).count # Record the number of active project badge entries # (the number of project badge entries updated # within ACTIVE_PERIOD number of days) self.active_projects = Project.updated_since(ACTIVE_PERIOD.day.ago).count self.active_edited_projects = Project.updated_since(ACTIVE_PERIOD.day.ago) .where('created_at < updated_at').count self.active_in_progress = Project.updated_since(ACTIVE_PERIOD.day.ago) .where('badge_percentage_0 < 100').count self.active_edited_in_progress = Project.updated_since(ACTIVE_PERIOD.day.ago) .where('created_at < updated_at') .where('badge_percentage_0 < 100').count # The following nested transaction is defensive coding. # We don't need to use a nested transaction today, because Project and # User are implemented in a single database. However, we ever # implemented Project and User in multiple class-specific databases # in the future, and did not nest them, we would silently be # outside a transaction - and that bug would be hard to detect. See: # http://api.rubyonrails.org/classes/ActiveRecord/Transactions/ # ClassMethods.html User.transaction do # Some of these values can be calculated from others, but it's # convenient to provide them separately. self.users = User.count self.github_users = User.where(provider: 'github').count self.local_users = User.where(provider: 'local').count self.users_created_since_yesterday = User.created_since(1.day.ago).count self.users_updated_since_yesterday = User.updated_since(1.day.ago).count self.users_with_projects = Project.select(:user_id).distinct.count self.users_without_projects = users - users_with_projects self.users_with_multiple_projects = Project.unscoped.group(:user_id).having('count(*) > 1').count.length self.users_with_passing_projects = Project.select(:user_id) .where('badge_percentage_0 >= 100') .distinct.count self.users_with_silver_projects = Project.select(:user_id) .where('badge_percentage_1 >= 100') .distinct.count self.users_with_gold_projects = Project.select(:user_id) .where('badge_percentage_2 >= 100') .distinct.count end AdditionalRight.transaction do self.additional_rights_entries = AdditionalRight.count self.projects_with_additional_rights = AdditionalRight.select(:project_id).distinct.count self.users_with_additional_rights = AdditionalRight.select(:user_id).distinct.count end end self # Return self to support method chaining end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stamp\n # Use a transaction to get values from a single consistent point in time.\n Project.transaction do\n # Count projects at different levels of completion\n STAT_VALUES.each do |completion|\n public_send \"percent_ge_#{completion}=\", Project.gteq(completion).count\n next if ...
[ "0.7294709", "0.5942738", "0.58889896", "0.5885735", "0.5885735", "0.5598221", "0.5591669", "0.556972", "0.54707927", "0.5371175", "0.5318346", "0.5227757", "0.51856875", "0.51767117", "0.51197976", "0.51170975", "0.50983936", "0.5049087", "0.5045485", "0.5042649", "0.5040434...
0.72969025
0
if array.size <= 1 array.join elsif array.size == 2 array.join(" and ") else oxford_comma_str = "" last_index = array.index(array.last) array.each_with_index do |item, index| if index < last_index oxford_comma_str << item + ", " elsif index == last_index oxford_comma_str << "and " + item end end oxford_comma_str end end Refactored version
def oxford_comma(array) if array.size <= 1 array.join elsif array.size == 2 array.join(" and ") else array[-1] = "and #{array[-1]}" array.join(", ") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def oxford_comma(array)\nif array.count == 1 then array.join\nelsif array.count == 2 then array.join(\" and \")\nelsif array.count >= 3\n array[-1].insert(0, \"and \")\n array.join(', ')\nend\nend", "def oxford_comma(array)\n case array.length \nwhen 1\n \"#{array[0]}\"\nwhen 2\n array[0..1].join(\" and \...
[ "0.89852315", "0.8799718", "0.8726358", "0.8651788", "0.8648533", "0.84981644", "0.84804606", "0.8422566", "0.83131236", "0.82505035", "0.78595024", "0.78318816", "0.77893144", "0.7721073", "0.7721073", "0.77145743", "0.7524755", "0.74601454", "0.7254154", "0.72076666", "0.71...
0.8860078
1
////////////////////////////////////////////////////////////////////////// Public Methods ////////////////////////////////////////////////////////////////////////// Start processing
def start super create_menu_background if MENU_CONFIG::IMAGE_BG != "" @bg = Sprite.new @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG) @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY end @help_window = Window_Info_Help.new(0, 384, 640, 96, nil) @item_back_window = Window_Base.new(0, 56, 640, 328) @dataviews_window = Window_Dataviews.new(0, 56, 640, 56, MENU_CONFIG::ITEM_DATAVIEWS) @dataviews_window.active = false @dataviews_window.opacity = 0 @item_window = Window_Item.new(0, 96, 640, 272, $game_party.items, @dataviews_window.selected_view) @item_window.opacity = 0 @item_window.help_window = @help_window @equip_details_window = Window_EquipDetails.new(0,384,640,96,nil) @equip_details_window.visible = false @item_details_window = Window_ItemDetails.new(0,384,640,96,nil) @item_details_window.visible = false update_detail_window(@item_window.selected_item) @target_window = Window_Party_Status.new(0, 0, 480, 424, $game_party.members) hide_target_window end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_processing\n\t\t@processing = true\n\t\twhile @processing\n\t\t\tevent = self.read_next_event or next\n\t\t\tself.log.debug \"Read event: %p\" % [ event ]\n\t\t\tself.store_event( event )\n\t\tend\n\tend", "def start_processing\n @ran = true\n @start_time = Time.now\n end", "def process\...
[ "0.736045", "0.7347885", "0.7266092", "0.7151083", "0.7151083", "0.7151083", "0.7151083", "0.7151083", "0.7151083", "0.7151083", "0.7151083", "0.71170384", "0.6938804", "0.6854846", "0.6835116", "0.6801743", "0.6688487", "0.6644232", "0.6643913", "0.6638715", "0.6635144", "...
0.0
-1
Show Target Window right : Right justification flag (if false, left justification)
def show_target_window(right) @item_window.active = false width_remain = (640 - @target_window.width)/2 @target_window.x = width_remain.floor heigth_remain = (480 - @target_window.height)/2 @target_window.y = heigth_remain.floor @target_window.visible = true @target_window.active = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_target_window(right)\n @skill_window.active = false\n width_remain = (640 - @target_window.width)/2\n @target_window.x = width_remain.floor\n height_remain = (480 - @target_window.height)/2\n @target_window.y = height_remain.floor\n @target_window.visible = true\n @target_window.activ...
[ "0.7200702", "0.7200702", "0.6892037", "0.68704057", "0.6282701", "0.5989468", "0.58883464", "0.5704658", "0.5620539", "0.5594617", "0.55757606", "0.55240655", "0.55237436", "0.55237436", "0.5522732", "0.5501405", "0.5496942", "0.54969037", "0.54881877", "0.5469767", "0.54642...
0.71982646
3
Use Item (apply effects to nonally targets)
def use_item_nontarget Sound.play_use_item $game_party.consume_item(@item) @item_window.draw_item(@item_window.index) @target_window.window_update($game_party.members) if $game_party.all_dead? $scene = Scene_Gameover.new elsif @item.common_event_id > 0 $game_temp.common_event_id = @item.common_event_id $scene = Scene_Map.new end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tsbs_apply_item(target, item, subj = @subject)\n if $imported[\"YEA-LunaticObjects\"]\n lunatic_object_effect(:prepare, item, subj, target)\n target.item_apply(subj, item)\n lunatic_object_effect(:during, item, subj, target)\n else\n target.item_apply(subj, item)\n end\n return ...
[ "0.6785487", "0.6774538", "0.65688866", "0.6567589", "0.64800453", "0.6433749", "0.64088905", "0.61984843", "0.61818606", "0.6110066", "0.61091685", "0.6064877", "0.6061721", "0.6048598", "0.60112756", "0.59824234", "0.5979606", "0.5931261", "0.59245604", "0.5903592", "0.5885...
0.6578298
3
////////////////////////////////////////////////////////////////////////// Private Methods ////////////////////////////////////////////////////////////////////////// Update Detail window depending of the type of the drop item item : item object
def update_detail_window(item) if item.is_a?(RPG::Item) @item_window.detail_window = @item_details_window else @item_window.detail_window = @equip_details_window end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_detail_window(item) \n if item.is_a?(RPG::Item)\n @status_equip_window.detail_window = @item_details_window\n else\n @status_equip_window.detail_window = @equip_details_window\n end\n end", "def update_item_stats(item)\n @status_window.window_item_update(item)\n \n if i...
[ "0.77514905", "0.67040366", "0.6648111", "0.66225463", "0.6514827", "0.64024967", "0.6221454", "0.6201766", "0.61959785", "0.6134254", "0.6043631", "0.6013568", "0.600843", "0.5973486", "0.5954281", "0.5941197", "0.59089136", "0.5871729", "0.5850804", "0.58478534", "0.582355"...
0.7762185
1
////////////////////////////////////////////////////////////////////////// Scene input management methods ////////////////////////////////////////////////////////////////////////// Update Item Selection
def update_item_selection if Input.trigger?(Input::B) Sound.play_cancel return_scene elsif Input.trigger?(Input::C) @item = @item_window.item if @item != nil $game_party.last_item_id = @item.id end if $game_party.item_can_use?(@item) Sound.play_decision determine_item else Sound.play_buzzer end elsif Input.repeat?(Input::DOWN) || Input.repeat?(Input::UP) || Input.repeat?(Input::LEFT) || Input.repeat?(Input::RIGHT) update_detail_window(@item_window.selected_item) elsif (Input.repeat?(Input::Y) || Input.repeat?(Input::Z)) update_dataview_select(Input.press?(Input::Z), Input.trigger?(Input::Y) || Input.trigger?(Input::Z)) @item_window.window_update($game_party.items, @dataviews_window.selected_view) @item_window.index = 0 update_detail_window(@item_window.selected_item) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_item_selection\n @item_window.active = true\n @item_window.update\n @help_window.update\n #@item_back_window.update\n #@dataviews_window.update\n #@item_details_window.update\n \n if Input.trigger?(Input::B)\n Sound.play_cancel\n end_item_selection\n elsif Input.trig...
[ "0.7434585", "0.72449297", "0.7200805", "0.6843428", "0.6842225", "0.66929233", "0.6622607", "0.6588782", "0.652443", "0.6430995", "0.6430995", "0.6419656", "0.6381161", "0.62682647", "0.6215394", "0.61514556", "0.6117014", "0.60929716", "0.6083973", "0.6048916", "0.6044752",...
0.7708496
1
////////////////////////////////////////////////////////////////////////// Private Methods ////////////////////////////////////////////////////////////////////////// Update dataview selection isRight : true to move right, else false to move left wrap : Wraparound allowed
def update_dataview_select(isRight, wrap) if isRight @dataviews_window.cursor_right(wrap) else @dataviews_window.cursor_left(wrap) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cursor_right(wrap = false)\n if col_max >= 2 && (index % col_max == col_max - 1)\n select(index + 1 - col_max)\n elsif col_max >= 2 && (index < item_max - 1 || (wrap && horizontal?))\n select((index + 1) % item_max)\n end\n end", "def cursor_right(wrap = true)\n if col_max >= 2 && (ind...
[ "0.6363346", "0.6099808", "0.6089833", "0.56669605", "0.5643838", "0.5639921", "0.56260955", "0.55943596", "0.55943596", "0.5564115", "0.5515157", "0.54172504", "0.54148203", "0.5392361", "0.5331408", "0.5326833", "0.52453077", "0.5235586", "0.51773095", "0.5171804", "0.51229...
0.7621383
3
GET /zonecouverturemotifs GET /zonecouverturemotifs.json
def index @zonecouverturemotifs = Zonecouverturemotif.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_zonecouverturemotif\n @zonecouverturemotif = Zonecouverturemotif.find(params[:id])\n end", "def destroy\n @zonecouverturemotif.destroy\n respond_to do |format|\n format.html { redirect_to zonecouverturemotifs_url, notice: 'Zonecouverturemotif was successfully destroyed.' }\n forma...
[ "0.57900965", "0.54078645", "0.5314694", "0.5270981", "0.5242929", "0.52332264", "0.519038", "0.5164976", "0.51313806", "0.51272386", "0.5111732", "0.5106974", "0.50783706", "0.50778544", "0.5071389", "0.50621575", "0.5053847", "0.50374156", "0.50285816", "0.5017645", "0.5011...
0.7659042
0
GET /zonecouverturemotifs/1 GET /zonecouverturemotifs/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @zonecouverturemotifs = Zonecouverturemotif.all\n end", "def set_zonecouverturemotif\n @zonecouverturemotif = Zonecouverturemotif.find(params[:id])\n end", "def index\n @videoconferencias = Videoconferencium.all\n render json: @videoconferencias\n end", "def index\n @carbon_...
[ "0.7435125", "0.5879479", "0.5621125", "0.55713344", "0.5475978", "0.54696524", "0.54599977", "0.54118055", "0.54113334", "0.54088557", "0.5406756", "0.5395845", "0.53893226", "0.53147155", "0.5313368", "0.5240068", "0.5236464", "0.5232775", "0.51931334", "0.5169855", "0.5152...
0.0
-1
POST /zonecouverturemotifs POST /zonecouverturemotifs.json
def create @zonecouverturemotif = Zonecouverturemotif.new(zonecouverturemotif_params) respond_to do |format| if @zonecouverturemotif.save format.html { redirect_to @zonecouverturemotif, notice: 'Zonecouverturemotif was successfully created.' } format.json { render :show, status: :created, location: @zonecouverturemotif } else format.html { render :new } format.json { render json: @zonecouverturemotif.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @zonecouverturemotifs = Zonecouverturemotif.all\n end", "def set_zonecouverturemotif\n @zonecouverturemotif = Zonecouverturemotif.find(params[:id])\n end", "def zonecouverturemotif_params\n params.require(:zonecouverturemotif).permit(:name, :detail)\n end", "def update\n re...
[ "0.65320045", "0.6119078", "0.586399", "0.56500226", "0.55985355", "0.4716729", "0.4691479", "0.4622292", "0.45857358", "0.45664158", "0.45333663", "0.45240328", "0.45007583", "0.4483645", "0.44183508", "0.44125473", "0.44038448", "0.43935716", "0.4383626", "0.4378956", "0.43...
0.67654943
0
PATCH/PUT /zonecouverturemotifs/1 PATCH/PUT /zonecouverturemotifs/1.json
def update respond_to do |format| if @zonecouverturemotif.update(zonecouverturemotif_params) format.html { redirect_to @zonecouverturemotif, notice: 'Zonecouverturemotif was successfully updated.' } format.json { render :show, status: :ok, location: @zonecouverturemotif } else format.html { render :edit } format.json { render json: @zonecouverturemotif.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_zonecouverturemotif\n @zonecouverturemotif = Zonecouverturemotif.find(params[:id])\n end", "def update\n @frozen_tunnel_io = FrozenTunnelIo.find(params[:id])\n\n respond_to do |format|\n if @frozen_tunnel_io.update_attributes(params[:frozen_tunnel_io])\n format.html { redirect_t...
[ "0.572081", "0.55579704", "0.5466963", "0.54534185", "0.544183", "0.54191816", "0.5418677", "0.54153055", "0.5400722", "0.5379225", "0.5370675", "0.5352506", "0.5342021", "0.5332646", "0.5292283", "0.52906936", "0.5289504", "0.5285478", "0.5275294", "0.5250971", "0.5247129", ...
0.6737767
0
DELETE /zonecouverturemotifs/1 DELETE /zonecouverturemotifs/1.json
def destroy @zonecouverturemotif.destroy respond_to do |format| format.html { redirect_to zonecouverturemotifs_url, notice: 'Zonecouverturemotif was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @frozen_tunnel_io = FrozenTunnelIo.find(params[:id])\n @frozen_tunnel_io.destroy\n\n respond_to do |format|\n format.html { redirect_to frozen_tunnel_ios_url }\n format.json { head :no_content }\n end\n end", "def dest...
[ "0.6549853", "0.6463829", "0.6456104", "0.64367783", "0.63357973", "0.632753", "0.63163453", "0.62997645", "0.6277247", "0.6273182", "0.6251724", "0.6236162", "0.62325305", "0.6202492", "0.620006", "0.6199254", "0.61959654", "0.6186096", "0.6170561", "0.6158739", "0.615763", ...
0.7416015
0
Use callbacks to share common setup or constraints between actions.
def set_zonecouverturemotif @zonecouverturemotif = Zonecouverturemotif.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 zonecouverturemotif_params params.require(:zonecouverturemotif).permit(:name, :detail) 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
login handles the auth, but we just need the SetCookie header from that call.
def do_login @login_results = get_organizations end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_login\n @login_results = login\n @cookie = @login_results.headers['Set-Cookie'] || @login_results.headers['set-cookie']\n end", "def do_login\n @login_results = login\n @cookie = @login_results.headers['Set-Cookie']\n end", "def do_login\n @logi...
[ "0.82079947", "0.8078844", "0.8078844", "0.7410979", "0.73046273", "0.72840655", "0.72684896", "0.724582", "0.72285634", "0.71355045", "0.7024071", "0.7010081", "0.69883895", "0.6955119", "0.68978375", "0.68954074", "0.689349", "0.6880206", "0.6872914", "0.6872332", "0.686193...
0.0
-1
if Authorization and xtmrkauthorization are used, the xtmrkauthorization takes precendence.
def set_extra_headers_for(params) maor_headers = { 'x-tmrk-version' => @version, 'Date' => Time.now.utc.strftime("%a, %d %b %Y %H:%M:%S GMT"), } params[:headers].merge!(maor_headers) if params[:method]=="POST" || params[:method]=="PUT" params[:headers].merge!({"Content-Type" => 'application/xml'}) params[:headers].merge!({"Accept" => 'application/xml'}) end unless params[:body].empty? params[:headers].merge!({"x-tmrk-contenthash" => "Sha256 #{Base64.encode64(Digest::SHA2.digest(params[:body].to_s)).chomp}"}) end if @authentication_method == :basic_auth params[:headers].merge!({'Authorization' => "Basic #{Base64.encode64(@username+":"+@password).delete("\r\n")}"}) elsif @authentication_method == :cloud_api_auth signature = cloud_api_signature(params) params[:headers].merge!({ "x-tmrk-authorization" => %{CloudApi AccessKey="#{@access_key}" SignatureType="HmacSha256" Signature="#{signature}"} }) end params[:headers] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorization_mode; end", "def host_authorization; end", "def host_authorization; end", "def authorization\r\n@env['HTTP_AUTHORIZATION'] ||\r\n@env['X-HTTP_AUTHORIZATION'] ||\r\n@env['X_HTTP_AUTHORIZATION'] ||\r\n@env['REDIRECT_X_HTTP_AUTHORIZATION']\r\nend", "def type_authorization?()\n return(...
[ "0.64775383", "0.6415221", "0.6415221", "0.63654476", "0.6363209", "0.6346091", "0.6343814", "0.6327306", "0.62759554", "0.612655", "0.60361004", "0.6027044", "0.5883553", "0.58780205", "0.57881695", "0.5771016", "0.5768627", "0.5756947", "0.5756947", "0.57521564", "0.5742937...
0.0
-1
section 5.6.3.2 in the ~1000 page pdf spec
def canonicalize_headers(headers) tmp = headers.inject({}) {|ret, h| ret[h.first.downcase] = h.last if h.first.match(/^x-tmrk/i) ; ret } tmp.reject! {|k,v| k == "x-tmrk-authorization" } tmp = tmp.sort.map{|e| "#{e.first}:#{e.last}" }.join("\n") tmp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_pages() 1 end", "def num_pages\n 26\n end", "def get_pdf(x)\n end", "def calculate_pages\n pdftk_cmd = \"#{CONFIG[:pdftk]} #{@source} dump_data | grep NumberOfPages | grep -o -e \\\"\\\\([0-9]*\\\\)$\\\"\"\n @pages = %x[#{pdftk_cmd}].to_i\n end", "def pages=(_arg0); end", ...
[ "0.68278044", "0.67637146", "0.6596884", "0.64772546", "0.6451373", "0.64131147", "0.62737584", "0.62153804", "0.62149984", "0.621445", "0.6194159", "0.6193536", "0.6190711", "0.61596584", "0.6116279", "0.60954356", "0.60789025", "0.60658425", "0.6038165", "0.603087", "0.6010...
0.0
-1
section 5.6.3.3 in the ~1000 page pdf spec
def canonicalize_resource(path) uri, query_string = path.split("?") return uri if query_string.nil? query_string_pairs = query_string.split("&").sort.map{|e| e.split("=") } tm_query_string = query_string_pairs.map{|x| "#{x.first.downcase}:#{x.last}" }.join("\n") "#{uri.downcase}\n#{tm_query_string}\n" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_pages() 1 end", "def num_pages\n 26\n end", "def get_pdf(x)\n end", "def calculate_pages\n pdftk_cmd = \"#{CONFIG[:pdftk]} #{@source} dump_data | grep NumberOfPages | grep -o -e \\\"\\\\([0-9]*\\\\)$\\\"\"\n @pages = %x[#{pdftk_cmd}].to_i\n end", "def pages=(_arg0); end", ...
[ "0.6838527", "0.6765368", "0.6596198", "0.6451588", "0.64414686", "0.6389177", "0.6252836", "0.62155104", "0.62079287", "0.6201814", "0.61856556", "0.6184477", "0.61785793", "0.61714756", "0.61028093", "0.60918784", "0.6074996", "0.60634035", "0.6049127", "0.60133976", "0.599...
0.0
-1
initialize accepts these keys: manifest_path, s3_manager manifest_validator uses default one in production, specify one for testing sfs_prefix, java_path, tika_path uses default values in production, specify them for testing these are used to initialize FileIdentifier rubocop:disable Metrics/ParameterLists
def initialize(manifests_path:, s3_manager:, wasabi_manager:, file_identifier:, sfs_prefix:, manifest_validator: Manifests::ManifestValidator.new) @mom_path = manifests_path @manifest_of_manifests = Manifests::ManifestOfManifests.new(manifests_path) @s3_manager = s3_manager @wasabi_manager = wasabi_manager @file_identifier = file_identifier @manifest_validator = manifest_validator @sfs_prefix = sfs_prefix end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(file_path, asset_group_id, creator)\n @file_path = file_path\n @asset_group_id = asset_group_id\n @creator = creator\n end", "def initialize(path, storage_name = nil, version_id = nil)\n self.path = path\n self.storage_name = storage_name\n ...
[ "0.6725853", "0.6513833", "0.6513833", "0.6364639", "0.6323566", "0.6313766", "0.6266843", "0.62193346", "0.6216967", "0.6206041", "0.61701024", "0.6157762", "0.61535776", "0.6147147", "0.6136838", "0.6133997", "0.60987025", "0.60830456", "0.60830456", "0.60822856", "0.607193...
0.7252521
0
We want to preserve ingest date from ingest manifest
def populate_manifest_data(manifest_parameters:) add_ingest_date(storage_manifest: manifest_parameters.storage_manifest, ingest_manifest: manifest_parameters.ingest_manifest) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manifestation_date\n node = @meta.at_xpath('./a:identification/a:FRBRManifestation/a:FRBRdate[@name=\"Generation\"]', a: NS)\n node && node['date']\n end", "def creation_date=(_); end", "def date\n self.publicized_or_packaged || super\n end", "def date\n self.publicized_or_packaged ||...
[ "0.5877103", "0.5765949", "0.57560223", "0.57560223", "0.5727093", "0.56546026", "0.56412417", "0.55958384", "0.5568925", "0.5553548", "0.5539099", "0.55382705", "0.5538163", "0.55208343", "0.55053115", "0.54657334", "0.5444543", "0.54142195", "0.5340409", "0.53356683", "0.53...
0.60538566
0
def merge(arr1, arr2) result, idx1, idx2 = [], 0, 0 until result.size == (arr1.size + arr2.size) binding.pry result arr2[idx2] result << arr2[idx2] idx2 += 1 else result << arr1[idx1] idx1 += 1 end end result.flatten end
def merge(arr1, arr2) result, idx1, idx2 = [], 0, 0 until arr1[idx1] == nil || arr2[idx2] == nil if arr1[idx1] > arr2[idx2] result << arr2[idx2] idx2 += 1 else result << arr1[idx1] idx1 += 1 end end arr2[idx2] == nil ? result << arr1[idx1..-1] : result << arr2[idx2..-1] result.flatten end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge(arr1, arr2)\n new_arr = []\n i1=0\n i2=0\n while i1 < arr1.length\n if i2 == arr2.length\n new_arr.concat(arr1[i1..-1])\n break\n elsif (arr1[i1] < arr2[i2])\n new_arr << arr1[i1]\n i1 += 1\n else\n new_arr << arr2[i2]\n i2 += 1\n ...
[ "0.81899816", "0.81780326", "0.81568384", "0.80750686", "0.8050193", "0.80259115", "0.80088246", "0.8007267", "0.80035454", "0.796919", "0.7967253", "0.7962694", "0.7956635", "0.7952743", "0.7950511", "0.7939632", "0.7937356", "0.7933801", "0.7924142", "0.7892038", "0.7876394...
0.81889737
1
GET /lexicon_groups GET /lexicon_groups.json
def index semantic_breadcrumb @project.name, @project semantic_breadcrumb "Lexicons", project_lexicon_groups_path(@project) @lexicon_groups = @project.lexicon_groups.page params[:page] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @lexicon_groups = @current_user.lexicon_groups.page params[:page]\n end", "def list_groups()\n response = HTTParty.get(\"https://graph.microsoft.com/v1.0/groups\", { \n headers: {\n \"Authorization\" => \"Bearer #{b...
[ "0.77067095", "0.6876308", "0.6633894", "0.66124296", "0.65883696", "0.65668756", "0.6535312", "0.64661926", "0.6459579", "0.6411248", "0.6406686", "0.6391195", "0.6361674", "0.6361674", "0.6349755", "0.6290624", "0.6275057", "0.6273182", "0.6241101", "0.62315756", "0.6202745...
0.6809979
2
GET /lexicon_groups/1 GET /lexicon_groups/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @lexicon_groups = @current_user.lexicon_groups.page params[:page]\n end", "def list_groups()\n response = HTTParty.get(\"https://graph.microsoft.com/v1.0/groups\", { \n headers: {\n \"Authorization\" => \"Bearer #{b...
[ "0.7464293", "0.6629306", "0.6601527", "0.6593892", "0.6593892", "0.6567203", "0.65429837", "0.6454592", "0.6386187", "0.6369739", "0.6361721", "0.63470364", "0.6311041", "0.6281753", "0.6251991", "0.6251991", "0.6243298", "0.6239837", "0.6238075", "0.6215707", "0.6182415", ...
0.0
-1
POST /lexicon_groups POST /lexicon_groups.json
def create @lexicon_group = @project.lexicon_groups.new(lexicon_group_params) exit_if_not_manager and return respond_to do |format| if @lexicon_group.save format.html { redirect_to project_lexicon_groups_path(@project), notice: 'The lexicon was successfully created.' } format.json { render :show, status: :created, location: @lexicon_group } else format.html { render :new } format.json { render json: @lexicon_group.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @lexicon_group = @current_user.lexicon_groups.new(lexicon_group_params)\n\n respond_to do |format|\n if @lexicon_group.save\n format.html { redirect_to lexicon_groups_path, notice: 'The lexicon was successfully created.' }\n format.json { render :show, status: :created, locati...
[ "0.74808955", "0.6660414", "0.6660414", "0.65290314", "0.65290314", "0.6456983", "0.6436818", "0.633685", "0.6282125", "0.61760306", "0.61633605", "0.6156167", "0.6129094", "0.6006863", "0.6001743", "0.5983525", "0.5975104", "0.5946601", "0.5937564", "0.59256905", "0.5919004"...
0.69572777
1
PATCH/PUT /lexicon_groups/1 PATCH/PUT /lexicon_groups/1.json
def update @project = @lexicon_group.project exit_if_not_manager and return respond_to do |format| if @lexicon_group.update(lexicon_group_params) format.html { redirect_back fallback_location: project_lexicon_groups_path(@project), notice: 'The lexicon was successfully updated.' } format.json { render :show, status: :ok, location: @lexicon_group } else format.html { render :edit } format.json { render json: @lexicon_group.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @lexicon_group.update(lexicon_group_params)\n format.html { redirect_back fallback_location: lexicon_groups_url, notice: 'The lexicon was successfully updated.' }\n format.json { render :show, status: :ok, location: @lexicon_group }\n else\n ...
[ "0.700815", "0.6451334", "0.63774955", "0.6221691", "0.6167117", "0.61655796", "0.61082274", "0.60537034", "0.6041844", "0.6032862", "0.60293734", "0.6021031", "0.60132444", "0.6009674", "0.5997577", "0.5985086", "0.5981153", "0.59764755", "0.5969114", "0.5965825", "0.5957684...
0.649615
1
DELETE /lexicon_groups/1 DELETE /lexicon_groups/1.json
def destroy @project = @lexicon_group.project exit_if_not_manager and return @lexicon_group.destroy respond_to do |format| format.html { redirect_back fallback_location: project_lexicon_groups_path(@project), notice: 'The lexicon was successfully removed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @lexicon_group.destroy\n respond_to do |format|\n format.html { redirect_back fallback_location: lexicon_groups_url, notice: 'The lexicon was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # @group = @hub.groups.get(params[:id])\n ...
[ "0.76357", "0.6981577", "0.694934", "0.6929787", "0.6913778", "0.68710774", "0.6847948", "0.68143326", "0.68127996", "0.6803451", "0.6791398", "0.6787824", "0.6785405", "0.6773745", "0.676711", "0.6740162", "0.6728482", "0.6722152", "0.6718374", "0.670853", "0.670853", "0.6...
0.6991387
1
Use callbacks to share common setup or constraints between actions.
def set_lexicon_group @lexicon_group = LexiconGroup.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.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", ...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def lexicon_group_params params.require(:lexicon_group).permit(:name, :user_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def sort_column %w(name email role).include?(params[:sort]) ? params[:sort] : "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
Returns any object by key
def [](key) data[key.to_s] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(key)\n get_all(key).first\n end", "def find_by_key(key)\n by_key[key]\n end", "def find_by_key(key)\n by_key[key]\n end", "def find_by_key(key)\n find_by('key', key)\n end", "def [](key)\n all(key).first\n end", "def [](key)\n all(key).first\...
[ "0.7309044", "0.71252483", "0.71252483", "0.7033974", "0.697805", "0.68518275", "0.68160504", "0.67987305", "0.6777218", "0.6700533", "0.6698958", "0.6632812", "0.66160524", "0.66160524", "0.66160524", "0.66160524", "0.6571024", "0.65641856", "0.65210897", "0.64821345", "0.64...
0.0
-1
Checks VCR or not
def vcr? self['recorded'].include?('VCR') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vcr_cassette?\n return false unless extname == '.yml'\n return false unless lines.count > 2\n # VCR Cassettes have \"recorded_with: VCR\" in the second last line.\n return lines[-2].include?(\"recorded_with: VCR\")\n end", "def check_flrtvc\n raise FlrtvcNotFound unless ::File.e...
[ "0.62445784", "0.62021106", "0.60865355", "0.60268205", "0.5961382", "0.58974975", "0.5863126", "0.5775668", "0.5775028", "0.5765994", "0.56829", "0.56826854", "0.5658132", "0.5636338", "0.5631598", "0.5553012", "0.55396855", "0.5528906", "0.550714", "0.550405", "0.550405", ...
0.6624746
0
TODO: check Enumerablecycle for threadsafety and use it if possible
def next_cluster_host if @resurrect_at time = Time.now.to_i resurrect_cluster(time) if @resurrect_at <= time end host_n = @current_host_n loop do host = @hosts[host_n] if !host raise NoAliveHosts if host_n == 0 host_n = 0 else @current_host_n = host_n + 1 return host end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each_identity; end", "def each(&block); end", "def each(&block); end", "def each(&block); end", "def each(&block); end", "def each(&block); end", "def each(&block); end", "def each\n raise 'Not implemented'\n end", "def get_iterator\n\t\tend", "def thread_collect\n collection ...
[ "0.63172174", "0.6191738", "0.6191738", "0.6191738", "0.6191738", "0.6191738", "0.6191738", "0.60398245", "0.6039548", "0.60057664", "0.5997322", "0.59916496", "0.59373385", "0.59373385", "0.5891557", "0.5828818", "0.58186495", "0.5802129", "0.5771681", "0.5771681", "0.577168...
0.0
-1
GET /content_templates GET /content_templates.json
def index @content_templates = ContentTemplate.all.order("title asc") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list\n @client.make_request :get, templates_path\n end", "def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end", "def templates\n response = get 'templates'\n response.map{|item| Hashie::Mash.new(item)}\n end", "def list\n ...
[ "0.7636305", "0.7603739", "0.75576884", "0.74648446", "0.7339547", "0.7279077", "0.71188635", "0.7107492", "0.7032317", "0.69662637", "0.6904329", "0.6798601", "0.67112756", "0.6699583", "0.66273624", "0.6626291", "0.6625528", "0.6610629", "0.6593905", "0.6580744", "0.6555452...
0.6582273
19
GET /content_templates/1 GET /content_templates/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_content_template(id)\n @client.raw('get', \"/content/templates/#{id}\")\n end", "def list\n @client.make_request :get, templates_path\n end", "def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end", "def list\n @client.call(met...
[ "0.7567846", "0.7255007", "0.7243118", "0.70528", "0.6906261", "0.68930674", "0.68490475", "0.68404645", "0.6788293", "0.6745201", "0.6651474", "0.66351265", "0.6632217", "0.6585319", "0.6570884", "0.65275776", "0.6495893", "0.649194", "0.6477192", "0.6456836", "0.6456836", ...
0.0
-1
POST /content_templates POST /content_templates.json
def create @content_template = ContentTemplate.new(content_template_params) @content_template.user_id = current_user.id respond_to do |format| if @content_template.save format.html { redirect_to @content_template, notice: 'Content template was successfully created.' } format.json { render :show, status: :created, location: @content_template } else format.html { render :new } format.json { render json: @content_template.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def content_template_params\n params.require(:content_template).permit(:title, :content, :user_id)\n end", "def template_params\n params.require(:template).permit(:content)\n end", "def template_params\n params.require(:template).permit(:name, :content)\n end", "def duplicate_content_...
[ "0.6787498", "0.67010355", "0.64281994", "0.6379832", "0.6238398", "0.6183827", "0.61753386", "0.61388326", "0.6101253", "0.60761774", "0.60406697", "0.6013749", "0.60026795", "0.5956969", "0.5930031", "0.5905562", "0.5888784", "0.58796984", "0.58509994", "0.58477694", "0.583...
0.6658678
2
PATCH/PUT /content_templates/1 PATCH/PUT /content_templates/1.json
def update @content_template.user_id = current_user.id respond_to do |format| if @content_template.update(content_template_params) format.html { redirect_to @content_template, notice: 'Content template was successfully updated.' } format.json { render :show, status: :ok, location: @content_template } else format.html { render :edit } format.json { render json: @content_template.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @request_template.update(request_template_params)\n respond format, 'Request template was successfully updated.'\n else\n format.html { render :edit }\n format.json { render json: @request_template.errors, status: :unprocessable_entity }\n ...
[ "0.6458938", "0.63795716", "0.63657856", "0.62940645", "0.6285527", "0.62608224", "0.6241041", "0.6221259", "0.62160164", "0.6201193", "0.6194279", "0.61601645", "0.61566097", "0.615555", "0.6152052", "0.61249506", "0.6113478", "0.6110541", "0.6107147", "0.6104368", "0.608987...
0.6749464
0
DELETE /content_templates/1 DELETE /content_templates/1.json
def destroy @content_template.destroy respond_to do |format| format.html { redirect_to content_templates_url, notice: 'Content template was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n super \"/templates/#{template_id}.json\", {}\n end", "def delete_content_template(id)\n # TODO: Inform ContentTemplateController.destroy method has been modified\n @client.raw('delete', \"/content/templates/#{id}\")\n end", "def destroy\n @content_template = ContentTemplate.find(...
[ "0.7968512", "0.78693753", "0.7534557", "0.74206126", "0.7366134", "0.72815824", "0.7230088", "0.72026086", "0.71973485", "0.7197044", "0.7174071", "0.7147422", "0.7133437", "0.7131788", "0.713027", "0.71189326", "0.70753646", "0.7033746", "0.7027844", "0.701943", "0.7016655"...
0.76170975
2
Use callbacks to share common setup or constraints between actions.
def set_content_template @content_template = ContentTemplate.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.61637366", "0.60446453", "0.59452957", "0.591511", "0.58885515", "0.5834122", "0.57761765", "0.5702554", "0.5702554", "0.5652102", "0.5619581", "0.5423898", "0.5409782", "0.5409782", "0.5409782", "0.5394745", "0.53780794", "0.5356209", "0.5338898", "0.53381324", "0.5328622...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def content_template_params params.require(:content_template).permit(:title, :content, :user_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.629...
0.0
-1
Render a single entry for use within a list of items.
def list_item(pairs: nil, **opt) opt[:pairs] = model_index_fields.merge(pairs || {}) super(**opt) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_entry(entry)\n %{<div class=\"hentry\" id=\"#{entry[:id]}\">\n <h2 class=\"entry-title\">#{entry[:title]}</h2>\n <span class=\"entry-content\">#{entry[:content]}</span>\n #{entry[:published_at].to_html}\n <span class=\"byline\">Posted by <span class=\"author vc...
[ "0.70706666", "0.67859834", "0.6752964", "0.6234765", "0.6170786", "0.61403096", "0.6057502", "0.60006046", "0.5921321", "0.5905094", "0.58951604", "0.5893928", "0.5875571", "0.583983", "0.5812606", "0.58068323", "0.5734142", "0.5674621", "0.56641054", "0.56504816", "0.564693...
0.0
-1
Generate a menu of user instances.
def items_menu(**opt) unless administrator? hash = opt[:constraints]&.dup || {} user = hash.extract!(:user, :user_id).compact.values.first org = hash.extract!(:org, :org_id).compact.values.first if !user && !org && (user = current_user).present? added = (org = user.org) ? { org: org } : { user: user } opt[:constraints] = added.merge!(hash) end end opt[:sort] ||= { id: :asc } super(**opt) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_menu\n @menu = MenuTree.new\n\n return unless @sysuser\n\n @menu << MenuItem.new(_('Laboratories'),\n url_for(:controller => 'laboratories')) <<\n MenuItem.new(_('Profiles'),\n url_for(:controller => 'profiles')) <<\n MenuItem.new(_('Disk device...
[ "0.7223922", "0.6259721", "0.6215551", "0.6190089", "0.6162369", "0.6156815", "0.612283", "0.6120086", "0.6102321", "0.60965955", "0.6089776", "0.60378987", "0.60281265", "0.60135424", "0.5980422", "0.59570813", "0.59497666", "0.5905224", "0.58767647", "0.5871149", "0.5871149...
0.0
-1
Generate a prompt for items_menu.
def items_menu_prompt(**) 'Select an EMMA user account' # TODO: I18n end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def items_menu_prompt(user: nil, **)\n case user\n when nil, :all then 'Select an existing manifest' # TODO: I18n\n else 'Select a manifest you created' # TODO: I18n\n end\n end", "def dialog_menu(title, text, items, default_item = nil)\n\n dialog_args = []\n if ...
[ "0.7585605", "0.7039651", "0.69048077", "0.68863755", "0.6800484", "0.6777535", "0.6680955", "0.6604306", "0.6555531", "0.6532561", "0.65305144", "0.65216714", "0.64703983", "0.6465475", "0.64547974", "0.64279884", "0.6426202", "0.6421626", "0.64093006", "0.63866705", "0.6379...
0.78410417
0
Descriptive term for an item of the given type.
def model_item_name(model: nil, capitalize: true) model ? super : 'EMMA User Account' # TODO: I18n end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def describe_type\n puts \"I am a #{type} of Bees Wax\"\n end", "def human_type\n Core::TYPES_DESC[type]\n end", "def describe_type\n puts \"I am a #{type} type of Bees Wax\"\nend", "def type_label\n @type.underscore.humanize.titleize\n end", "def type_label\n @type.underscore.humanize....
[ "0.6773997", "0.66237", "0.6607809", "0.6428165", "0.6428165", "0.6380838", "0.62404037", "0.61705697", "0.6136823", "0.60892946", "0.6037207", "0.6037207", "0.6037207", "0.59759104", "0.59561867", "0.59108675", "0.58595026", "0.5856008", "0.5840712", "0.5837263", "0.58319855...
0.0
-1
Create a link to the details show page for the given item.
def show_control(**opt) opt[:label] ||= 'Show' # TODO: I18n opt[:path] ||= show_path button_link(**opt) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detail_item= item\n @detail_item = item\n configure_view\n end", "def create_link(item_nr)\n \"<a href=\\'/item/#{item_nr}\\'>#{self}</a>\"\n end", "def item_detail_url(id)\n \"#{@baseurl}/agdocs.aspx?doctype=agenda&itemid=#{id}\"\n end", "def item_link(item)\n if !item.new_record?\n ...
[ "0.7156965", "0.69034666", "0.67192304", "0.6395458", "0.6365223", "0.6261657", "0.6208158", "0.6138477", "0.6132661", "0.6131288", "0.61288196", "0.6122007", "0.61042726", "0.60963374", "0.6064591", "0.60233754", "0.601728", "0.59880626", "0.59689957", "0.5965178", "0.596517...
0.0
-1
Transform a field value for HTML rendering.
def render_value(value, field:, **opt) (value.to_s == 'roles') ? roles(**opt) : super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_field(label, value)\n render_field_content(label, (h value))\n end", "def html_value\n field.html_value(domain_value)\n end", "def process_field_value(value)\r\n value\r\n end", "def to_s\n label = @field.label\n val = @template.send(:h, formatted_value)\n if @bl...
[ "0.7225866", "0.6784884", "0.67787004", "0.6502021", "0.6465402", "0.6459753", "0.6431702", "0.64038724", "0.63656145", "0.6344369", "0.63138753", "0.63122666", "0.6290736", "0.6250949", "0.6206094", "0.61481845", "0.60984004", "0.6093737", "0.60866916", "0.6064504", "0.60364...
0.0
-1
Create a list of User roles.
def roles(**opt) roles = present? && object.role_list || [] html_tag(:ul, opt) do roles.map do |role| html_tag(:li, role) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_roles\n Role.create_roles(self)\n end", "def create\n chef_server_rest.post(\"roles\", self)\n self\n end", "def create_roles\n ['admin', 'lector', 'jefe_calidad', 'jefe_bodega', 'op_bodega'].each do |role_name|\n Role.create!(name: role_name)\n end\nend", "def roles\n @users...
[ "0.77016014", "0.7325713", "0.7233132", "0.70606047", "0.69342804", "0.6911493", "0.6911493", "0.68482864", "0.68214786", "0.67988175", "0.6768438", "0.67012525", "0.6698816", "0.6697594", "0.6647622", "0.65939754", "0.6588525", "0.6576331", "0.6547924", "0.653225", "0.653104...
0.64246273
28
Create a single term which describes the role level of item.
def role_prototype(**opt) prototype = Role.prototype_for(object) prepend_css!(opt, 'role-prototype') html_div(opt) do (prototype == :dso) ? 'DSO' : prototype.to_s.titleize end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n parent = params[:parent_id] ? Term.find(params[:parent_id]) : nil\n term = Term.new term_params\n term.user = current_user\n term.parent = parent\n term.save\n\n render_item term, :created\n end", "def create\n Statements::CreateRole.new(context: self)\n ...
[ "0.59276044", "0.58439505", "0.569484", "0.56412244", "0.55653524", "0.5545371", "0.54807436", "0.54628485", "0.5451513", "0.5440537", "0.5434937", "0.5410168", "0.5391336", "0.5383848", "0.5366448", "0.5366448", "0.53628504", "0.5360029", "0.5358137", "0.5351737", "0.5344481...
0.0
-1
Table values associated with the current decorator.
def table_values(**opt) controls = control_group { [show_control, edit_control, delete_control] } { actions: controls, **super } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def variables\n @table.keys\n end", "def list\n @table.keys # values\n end", "def base_table\n {\n \"Partner\" => ->(distribution) {\n distribution.partner.name\n },\n \"Date of Distribution\" => ->(distribution) {\n distribution.issued_at.strfti...
[ "0.6151042", "0.6057257", "0.6048", "0.5990407", "0.58934456", "0.5873856", "0.5873856", "0.5873856", "0.5873856", "0.5836227", "0.58293843", "0.58249485", "0.5807165", "0.57572055", "0.5754532", "0.5754532", "0.5754532", "0.5754532", "0.5754532", "0.5754532", "0.5754532", ...
0.57045466
21
Render prepopulated form fields, manually adding password field(s) (which are not in "emma.account.record").
def form_fields(pairs: nil, **opt) fields = AccountConcern::PASSWORD_KEYS fields = fields.excluding(:current_password) if manager? || administrator? added = fields.map { |k| [k.to_s.titleize, k] }.to_h pairs = pairs&.merge(added) || added super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def password_field; end", "def add_password_field(form, model, field, not_null=check_null?(model, field))\n html = <<-HTML\n <div class=\"form-group\">\n #{form.label field, class: 'col-sm-3 control-label no-padding-right'}\n <div class=\"col-sm-9\">\n #{form.password_field field, class: '...
[ "0.65779567", "0.6556874", "0.64991766", "0.64289343", "0.63264084", "0.6181519", "0.6033015", "0.5979741", "0.59206927", "0.59155774", "0.591032", "0.5847101", "0.58224934", "0.5807564", "0.57963", "0.57854307", "0.5768642", "0.57411623", "0.57404023", "0.5732054", "0.571734...
0.70674706
0
A table of abilities.
def ability_table(target = nil, columns: ABILITY_COLUMNS, **table_opt) row_count = 0 heading_rows = html_tag(:thead, role: 'rowgroup') do html_tag(:tr, role: 'row') do row_count += 1 columns.map do |css_class, label| html_tag(:th, label, role: 'columnheader', class: css_class) end end end data_rows = html_tag(:tbody, role: 'rowgroup') do divider = ability_table_divider ability_table_rows(target).flat_map do |_, rows| row_count += rows.size rows.values << divider end end table_opt[:role] ||= 'table' table_opt[:'aria-colcount'] = columns.size table_opt[:'aria-rowcount'] = row_count html_tag(:table, table_opt) do heading_rows << data_rows end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def abilities\n\t\t\t@abilities ||= {}\n\t\tend", "def abilities\n @abilities ||= Six.new\n end", "def abilities\n (read_attribute(:abilities) || '').split(' ')\n end", "def abilities\n get('/ability/')\n end", "def list_ability(pk)\n puts \"\"\n puts \"Abilities:\"\n ...
[ "0.726393", "0.6973107", "0.6827389", "0.6794882", "0.6562961", "0.6163284", "0.6139626", "0.61294657", "0.5918154", "0.58973294", "0.58827114", "0.58827114", "0.5872973", "0.5741355", "0.57296586", "0.57119215", "0.5660113", "0.5607175", "0.5533219", "0.55292726", "0.5479252...
0.5621767
17
A table row to visually separate groups of rows.
def ability_table_divider(css: '.blank-row', **opt) opt.reverse_merge!(role: 'presentation', 'aria-hidden': true) prepend_css!(opt, css) html_tag(:tr, opt) do ABILITY_COLUMNS.keys.map.with_index(1) do |cls, idx| html_tag(:td, role: 'cell', class: cls, 'aria-colindex': idx) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def row\n @vgroup.add(@vertical);\n alignments_reset ; widths_reset ; heights_reset\n end", "def print_group(type, headings)\n rows = @items.each_with_index.map do |item, i|\n [i + 1] + item.line if item.instance_of?(type)\n end\n rows.compact!\n table = Terminal::Table.new(headings...
[ "0.6692694", "0.65581906", "0.64353126", "0.642449", "0.63416713", "0.63299537", "0.62626255", "0.62526864", "0.61806345", "0.61795384", "0.617193", "0.616933", "0.6136591", "0.6132846", "0.61319435", "0.6125213", "0.6051691", "0.6015301", "0.6000498", "0.5977765", "0.5952232...
0.0
-1
writes an email to each victim can only be called after a victim list has been constructed
def compose terms = getUserQuery() VictimList.instance.victims.each { |vic| composed = String.new(@emailString) terms.each { |term| termString = term.to_s composed.gsub!(/\[#{termString}\]/, vic.attributes[term]) composed.gsub!(/\[_#{termString}\]/, vic.attributes[term].gsub(/[^0-9a-zA-Z]+/, "").downcase) } writeEmailToDisk(composed) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generateSubmitterMailList()\n\tsubmitter_map = {}\n\t# Handle duplicate users\n\t@submit_changes.each do |item|\n\t\tsubmitter_map[item.user_id] = item.user_email\n\tend\n\temail_to = \"\"\n\tsubmitter_map.each do |user_id, user_email|\n\t\temail_to = \"#{user_email}, #{email_to}\"\n\tend\n\t#Remove if exist\n...
[ "0.64249027", "0.60790384", "0.6065907", "0.59869826", "0.5831482", "0.58305794", "0.5822592", "0.58193237", "0.58119833", "0.5773577", "0.5737257", "0.5707481", "0.5704678", "0.56898636", "0.5684041", "0.56817937", "0.56814647", "0.56531435", "0.5652807", "0.5632272", "0.563...
0.52353424
79
extracts a query from an input email template returns an array of query terms
def parseInputEmail puts "extracting query terms from #{$file}" if $verbose @emailString = IO.read($file) stringTerms = @emailString.scan(/(?<=\[)([^_].*?)(?=\])/) stringTerms.flatten! terms = stringTerms.map { |s| s.to_sym } #abort if we can't find at least one query term abort("template did not contain any query terms") if terms.count <1 pp(terms) if $verbose return terms end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_query\n @results = str_to_obj.flatten.collect do |url|\n doc = Mechanize.new.get(url)\n els = doc.search(CGI.unescape(@xpath))\n els.map { |el| [el.text] }\n end\n @results = @results.flatten.map { |r| [r] }\n end", "def query_words\n @query_array ||= @query.split(' ')\n...
[ "0.5875435", "0.5751113", "0.56251365", "0.5556366", "0.55353475", "0.55353475", "0.5521229", "0.5504965", "0.5460101", "0.5454284", "0.5396457", "0.5386732", "0.5368156", "0.5363458", "0.5352186", "0.53207815", "0.52122414", "0.5206748", "0.5206735", "0.51834697", "0.5162988...
0.83341205
0
Split the string and check left right side is matched. Make sure str is existed str = "(.?)A(.?)p(.?)l(.?)n(.?)s(.?)" 'Applications'[Regexp.new str]
def similar_match str if !str || str == '' return Regexp.new('.*') end str_array = str.split('') reg_str = '(.*?)' str_array.each do |x| reg_str += "#{x}(.*?)" end return reg_str end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_both?(string)\n\t\t[\"elsif\",\"else\",\"when\",\"rescue\",\"ensure\"].each{|x|\n\t\treturn true if string.lstrip.slice(/^#{x}/)\n\t\t}\n\t\tfalse\n\tend", "def ABCheck(str)\n\n return \"true\" if str=~(/a...b/) or str=~(/b...a/)\n return \"false\"\n \nend", "def match(str)\n d, m = str.s...
[ "0.6125189", "0.5969353", "0.5794597", "0.5744071", "0.57118803", "0.56539655", "0.5631651", "0.56012166", "0.55760217", "0.55531883", "0.55481553", "0.5497437", "0.5496313", "0.54720145", "0.5465752", "0.5459749", "0.54544765", "0.54276043", "0.5415304", "0.54112536", "0.533...
0.0
-1
Implement a method stock_picker that takes in an array of stock prices, one for each hypothetical day. It should return a pair of days representing the best day to buy and the best day to sell. Days start at 0.
def stock_picker(stock_array) day_hash = Hash.new(0) day_index = 0 stock_array.each { |day_number| day_hash[day_index] = day_number day_index += 1 } day_hash_sell = day_hash.clone profit_best = Hash.new(0) profit_best_counter = nil day_hash.each do |key, value| buy = -value day_hash_sell.each do |key_sell, value_sell| #ensure day is only in futue if key_sell <= key then next end profit = buy + value_sell if profit_best_counter == nil || profit > profit_best_counter then #reset hash to ensure only 1 answer given profit_best = Hash.new(0) #track best days to buy/sell in array profit_best[key] = key_sell #keep track of best profit so far profit_best_counter = profit end end end puts profit_best end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stock_picker(prices)\n\t# Initialize everything to 0\n\tmin = 0\t\t\t# Day with lowest price so far\t\t\t\t\t\n\tbuy = 0\t\t\t# Buy day with best max_diff so far\n\tsell = 0\t\t# Sell day with best max_diff so far\n\tmax_diff = 0\t# Best value of prices[sell]-prices[buy]\n\t(1...prices.length).each do |i|\n\t\...
[ "0.85080934", "0.8472641", "0.8392055", "0.8387195", "0.83266234", "0.827471", "0.82364345", "0.8230924", "0.8205921", "0.8177308", "0.81558937", "0.81045365", "0.80941373", "0.808535", "0.80840015", "0.80608", "0.8052773", "0.80468076", "0.7987551", "0.79817116", "0.79674625...
0.7439717
49
GET /task_folders/1 GET /task_folders/1.json
def show @task_folder = TaskFolder.find(params[:id]) @project = @task_folder.project @sub_folders = TaskFolder.find(:all, :conditions => { :parent_id => @task_folder.id }) @tasks = @task_folder.tasks respond_to do |format| format.html # show.html.erb format.json { render json: @task_folder } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @folders = current_user.folders.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @folders }\n end\n end", "def get_folder folder_id\n get(\"/projects/#{folder_id}\")\n end", "def index\n @folders = Folder.all\n\n res...
[ "0.68403316", "0.676205", "0.6713361", "0.67127883", "0.6706953", "0.6687947", "0.6668367", "0.65466475", "0.65410817", "0.6532041", "0.65068096", "0.65068096", "0.64871347", "0.64755166", "0.6473541", "0.6416117", "0.6412791", "0.63971275", "0.63863105", "0.634852", "0.63123...
0.75168884
0
GET /task_folders/new GET /task_folders/new.json
def new @task_folder = TaskFolder.new @project = @task_folder.project respond_to do |format| format.html # new.html.erb format.json { render json: @task_folder } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @folder = current_user.folders.build\n\n respond_to do |format|\n format.html { render :layout => false }\n format.json { render :json => @folder }\n end\n end", "def create\n taskfolderparams = params[:task_folder]\n\t@project = Project.find(taskfolderparams[:project_id])\n\ttas...
[ "0.7186579", "0.7052831", "0.6929815", "0.67507464", "0.6744713", "0.67436004", "0.6709901", "0.67000586", "0.6678765", "0.65297216", "0.6525579", "0.6492838", "0.6476402", "0.6455437", "0.6447559", "0.6443958", "0.6417407", "0.640733", "0.63656557", "0.6363406", "0.632536", ...
0.7593267
0
POST /task_folders POST /task_folders.json
def create taskfolderparams = params[:task_folder] @project = Project.find(taskfolderparams[:project_id]) taskfolderparams[:project] = @project parent_id = taskfolderparams[:parent_id] @parent = nil if parent_id != nil && parent_id != "" @parent = TaskFolder.find(parent_id) end taskfolderparams[:parent] = @parent @task_folder = TaskFolder.new(taskfolderparams) respond_to do |format| if @task_folder.save format.html { redirect_to task_folder_url(@task_folder), notice: 'Task folder was successfully created.' } format.json { render json: @task_folder, status: :created, location: @task_folder } else format.html { render action: "new" } format.json { render json: @task_folder.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @task = @folder.tasks.new(task_params)\n @task.creator = @member\n\n respond_to do |format|\n if @foldership.permits?(:folder_tasks, :write) && @task.save\n format.html { redirect_to folder_path(@org, @folder), notice: 'Task was successfully created.' }\n format.json { rend...
[ "0.66054225", "0.65661", "0.6541363", "0.6500406", "0.6452406", "0.63676053", "0.63323796", "0.62154186", "0.6198504", "0.6157256", "0.61232233", "0.61169237", "0.61111236", "0.6106505", "0.608147", "0.60526824", "0.6032268", "0.60284513", "0.6022067", "0.6019618", "0.6015003...
0.6903262
0
PUT /task_folders/1 PUT /task_folders/1.json
def update @task_folder = TaskFolder.find(params[:id]) respond_to do |format| if @task_folder.update_attributes(params[:task_folder]) format.html { redirect_to task_folder_url(@task_folder), notice: 'Task folder was successfully updated.' } format.json { head :ok } else format.html { render action: "edit" } format.json { render json: @task_folder.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @foldership.permits?(:folder_tasks, :write) && @task.update(task_params)\n format.html { redirect_to folder_path(@org, @folder), notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n format.js\...
[ "0.6549574", "0.65208113", "0.65011394", "0.6451439", "0.62771183", "0.6185398", "0.6162572", "0.61499226", "0.6131892", "0.61277467", "0.611596", "0.61127067", "0.61127067", "0.61127067", "0.6092615", "0.60620403", "0.60620403", "0.603984", "0.6020298", "0.5973675", "0.59736...
0.7084691
0
DELETE /task_folders/1 DELETE /task_folders/1.json
def destroy @task_folder = TaskFolder.find(params[:id]) parent_id = @task_folder.parent_id project = @task_folder.project @task_folder.destroy if parent_id == nil respond_to do |format| format.html { redirect_to folders_project_url(project) } format.json { head :ok } end else respond_to do |format| format.html { redirect_to task_folder_url(parent_id) } format.json { head :ok } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @folder.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @task.destroy if @foldership.permits? :folder_tasks, :delete\n respond_to do |format|\n format.html { redirect_to folder_path(@org, @folder), notice: 'Task was successf...
[ "0.6965331", "0.6960245", "0.69063413", "0.68741596", "0.68125165", "0.6807701", "0.67882025", "0.67850614", "0.67679375", "0.6761518", "0.6752847", "0.6651588", "0.66359115", "0.66294426", "0.6605339", "0.6602021", "0.6584335", "0.652161", "0.652161", "0.652161", "0.652161",...
0.7029647
0
Change member's kanji or hiragana to alphabet
def fill_alphabet_from_kanji_name(member) # Last name if not member.last_name_alphabet.present? || ( (member.last_name_alphabet.present?) && (not member.last_name_alphabet.ascii_only?) ) # If not alphabet member.update(last_name_alphabet: kanji_to_romaji_jlp(member.last_name).capitalize ) end # First name if not member.first_name_alphabet.present? || ( (member.first_name_alphabet.present?) && (not member.first_name_alphabet.ascii_only?) ) # If not alphabet member.update(first_name_alphabet: kanji_to_romaji_jlp(member.first_name).capitalize ) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def canonize (key)\n key.tr(\"A-Z\",\"a-z\").gsub(/\\s/,\"\")\nend", "def to_katakana(src)\n src\n .gsub(\"わ゙\",\"ヷ\")\n .gsub(\"い゙\",\"ヸ\")\n .gsub(\"え゙\",\"ヹ\")\n .gsub(\"を゙\",\"ヺ\")\n .tr(\"ぁ-ゖゝゞゟ\",\"ァ-ヶヽヾヿ\")\nend", "def code_letter(name)\nname = name.downcase.tr(\"aeiou\", \"eioua\")\nname = name....
[ "0.641818", "0.6396406", "0.63107586", "0.626579", "0.62643725", "0.62607545", "0.62152207", "0.6191566", "0.6185905", "0.6185381", "0.61768043", "0.6154783", "0.6147527", "0.614084", "0.6140659", "0.6129468", "0.6120392", "0.6108651", "0.60950744", "0.60920125", "0.60851604"...
0.8078431
0
Show invalid properties with the reasons. Usually used together with valid?
def list_invalid_properties invalid_properties = Array.new if @beez_up_order_item_id.nil? invalid_properties.push("invalid value for 'beez_up_order_item_id', beez_up_order_item_id cannot be nil.") end if @order_item_order_item_type.nil? invalid_properties.push("invalid value for 'order_item_order_item_type', order_item_order_item_type cannot be nil.") end return invalid_properties end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil....
[ "0.7648174", "0.7648174", "0.7648174", "0.7648174", "0.7636107", "0.7636107", "0.7636107", "0.7636107", "0.7636107", "0.7636107", "0.7636107", "0.7636107", "0.735483", "0.7334006", "0.7266755", "0.7237471", "0.7230518", "0.7224262", "0.72067326", "0.7175052", "0.71689266", ...
0.0
-1