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
Indicates if the client was supplied an OAuth access token or Basic Auth username and password
def user_authenticated? basic_authenticated? || token_authenticated? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client_has_valid_token?\n request.headers[\"Authorization\"] == Rails.application.credentials.guessing_access_token\n end", "def credentials?\n if credentials[:access_token]\n true\n elsif credentials[:client_id] && credentials[:client_secret]\n true\n else\n false\n ...
[ "0.72329444", "0.7203453", "0.7171518", "0.71127486", "0.71085393", "0.700524", "0.69892454", "0.6894595", "0.6887713", "0.68743134", "0.68363786", "0.68149793", "0.67873245", "0.6770077", "0.6763327", "0.6762382", "0.6726179", "0.67177385", "0.6716413", "0.6709228", "0.67081...
0.66623807
31
Indicates if the client has OAuth Application client_id and secret credentials to make anonymous requests at a higher rate limit
def application_authenticated? !!(@client_id && @client_secret) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client_has_valid_token?\n request.headers[\"Authorization\"] == Rails.application.credentials.guessing_access_token\n end", "def authorized?\n if token.present?\n # Client is confidential, therefore client authentication & authorization\n # is required\n if token.application_id?\n ...
[ "0.68140227", "0.68010455", "0.67048883", "0.6550516", "0.6548622", "0.6538636", "0.648622", "0.6467054", "0.6463103", "0.6437301", "0.640978", "0.63796645", "0.6345875", "0.63417816", "0.6339645", "0.6336406", "0.63173836", "0.63017696", "0.62852883", "0.6241573", "0.6241573...
0.73536944
0
is bcc an array of comma separated emails?
def send_to_bcc! sender = "#{self.sender.first_name} #{self.sender.last_name} <#{EMAIL_FROM_ADDRESS}>" emails = self.bcc.split(/[, ]/).map(&:strip).map(&:downcase).reject(&:blank?) emails.each do |email| mlse = MailingListSentEmail.new( :mailing_list_email_id => ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bcc_addrs\n bcc ? [bcc].flatten : []\n end", "def get_cc_addresses\n\n return [] if self.cc_addresses.nil?\n return self.cc_addresses.split(Email::ADDRESS_SEPARATOR)\n end", "def get_bcc_addresses\n\n return [] if self.bcc_addresses.nil?\n return self.bcc_addresses.split(Email::ADDRESS...
[ "0.72611177", "0.7225404", "0.7152572", "0.70718265", "0.68694055", "0.6854981", "0.68423533", "0.67691314", "0.67506605", "0.66019803", "0.6584537", "0.64197034", "0.6393236", "0.6377948", "0.63722456", "0.62892705", "0.6288491", "0.6245716", "0.6229045", "0.6226178", "0.618...
0.6370756
15
Returns the contributor record hash or nil if not found.
def get_contributor(username) contributor = @database.get_item( table_name: contributors_table_name, key: { "username" => username }, consistent_read: true )[:item] contributor end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def referrer\n if self.contributions.first.try(:referrer_id) &&\n self.contributions.first.try(:contributor_id) &&\n self.contributions.first.referrer_id == self.contributions.first.contributor_id\n self.contributions.first.referrer\n .slice(:id, :first_name, :last_name, :email, :title, ...
[ "0.55597264", "0.5465566", "0.5384791", "0.53130054", "0.5311183", "0.5302109", "0.5259776", "0.5166528", "0.51456374", "0.514283", "0.5112733", "0.51089126", "0.5107741", "0.5089194", "0.5057773", "0.50566787", "0.504649", "0.504316", "0.5040452", "0.50244987", "0.50108576",...
0.5754707
0
Returns the candidate record hash or nil if not found.
def get_candidate(username) candidate = @database.get_item( table_name: candidates_table_name, key: { "username" => username }, consistent_read: true )[:item] candidate['votes'] = candidate['votes'].to_i if candidate candidate end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def latest_block\n hash = db.best_hash\n return nil unless hash\n find_entry_by_hash(hash)\n end", "def candidate\n self['candidate']\n end", "def get_broadhash\n blocks = self.blocks_get_status\n if blocks[\"success\"]\n return blocks[\"broadhash\"]\n el...
[ "0.57597417", "0.5742317", "0.5686659", "0.56793964", "0.5650187", "0.5641952", "0.5569106", "0.55647385", "0.555714", "0.5522676", "0.5520755", "0.5478836", "0.54706997", "0.5429282", "0.54230314", "0.54212546", "0.54116493", "0.5410404", "0.5395033", "0.538786", "0.5371703"...
0.0
-1
Returns an array of contributor hashes.
def get_contributors(consistent_read) contributors = [] params = { table_name: contributors_table_name, consistent_read: consistent_read } loop do result = @database.scan(params) # Add the contributor to the contributors array. result.items.each do |contributor| c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contributors\n []\n end", "def contributor_usernames\n @contributor_usernames ||= contributors.map(&:username)\n end", "def contributor_names\n @contributor_names ||= contributors.map {|c| c.realname || c.username }\n end", "def contributors\n return @contributors\n ...
[ "0.71499044", "0.6911675", "0.68497324", "0.6636762", "0.6556633", "0.61711675", "0.61489975", "0.61105293", "0.60079455", "0.59737074", "0.5973009", "0.59419924", "0.5892135", "0.5876319", "0.5856334", "0.5856334", "0.58009416", "0.57958937", "0.5775109", "0.57742715", "0.57...
0.5973526
10
Returns an array of candidate hashes.
def get_candidates(consistent_read) candidates = [] params = { table_name: candidates_table_name, consistent_read: consistent_read } loop do result = @database.scan(params) # Convert votes to an integer and add the candidate to the candidates array. result.items.each do |...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hashes\n return @hashes\n end", "def slug_candidates\n\t\tran = SecureRandom.random_number(34567)\n\t\thash_id = SecureRandom.urlsafe_base64(24).gsub(/-|_/,('a'..'z').to_a[rand(26)])\n\t\t[\n\t\t\t[hash_id],\n\t\t\t[hash_id, ran],\n\t\t]\n\tend", "def candidates\n players.m...
[ "0.62824214", "0.6257396", "0.5757189", "0.5673912", "0.5637853", "0.5472196", "0.54384667", "0.543641", "0.53910834", "0.53854847", "0.53803545", "0.5327459", "0.53199553", "0.5307186", "0.5300672", "0.5217122", "0.52109116", "0.52089036", "0.5198153", "0.5147798", "0.513209...
0.5511653
5
Creates a new candidate.
def register(contributor, description, donation_url) @database.transact_write_items( { transact_items: [ { put: { table_name: candidates_table_name, item: { 'username' => contributor['username'], 'avatar_url' => contribu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @candidate = current_user.candidates.new(candidate_params)\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: 'Candidate was successfully created.' }\n format.json { render :show, status: :created, location: @candidate }\n else\n...
[ "0.6954908", "0.69140303", "0.685781", "0.68327385", "0.67839783", "0.67805976", "0.67392725", "0.67392725", "0.67392725", "0.67392725", "0.6693748", "0.66888285", "0.6670961", "0.66583806", "0.6511356", "0.6364799", "0.63594574", "0.63540465", "0.63402176", "0.6324286", "0.6...
0.0
-1
Updates a candidates description.
def update_description(username, description) @database.transact_write_items( { transact_items: [ { update: { table_name: candidates_table_name, key: { 'username' => username }, update_expression: 'SET description = :description', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n json_response(@description.update!(description_params))\n end", "def update(description) # :nodoc:\n @description = description\n self\n end", "def update(description) # :nodoc:\n @description = description\n self\n end", "def update!(**args)\n ...
[ "0.6582486", "0.65591246", "0.65591246", "0.6444794", "0.6444794", "0.6444794", "0.6444794", "0.6444794", "0.60821915", "0.60821915", "0.5964254", "0.58287567", "0.5725394", "0.57011575", "0.5601904", "0.55997974", "0.55949056", "0.5585244", "0.5581039", "0.55604976", "0.5539...
0.6366794
8
Updates a candidates donation_url.
def update_donation_url(username, donation_url) @database.transact_write_items( { transact_items: [ { update: { table_name: candidates_table_name, key: { 'username' => username }, update_expression: 'SET donation_url = :donation_url', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @donation.update(donation_params)\n redirect_to campaign_solicitation_path(@campaign, @solicitation), notice: 'Donation was successfully updated.'\n else\n render :edit\n end\n end", "def update\n respond_to do |format|\n if @donation.update(donation_params)\n f...
[ "0.581466", "0.5592", "0.5500944", "0.54879576", "0.54879576", "0.54879576", "0.54879576", "0.54849917", "0.53796774", "0.53671443", "0.53485507", "0.53369886", "0.5336891", "0.53344125", "0.5313526", "0.5306757", "0.52155346", "0.5209595", "0.51901484", "0.51473784", "0.5143...
0.7173025
0
Returns the contributor with username
def update_access_token(username, access_token) contributor = @database.update_item( { table_name: contributors_table_name, key: { 'username' => username }, update_expression: 'set access_token = :access_token', expression_attribute_values: { ':access_token' => access_token }, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_contributor(username)\n contributor = @database.get_item(\n table_name: contributors_table_name,\n key: { \"username\" => username },\n consistent_read: true\n )[:item]\n\n contributor\n end", "def contributor_names\n @contributor_names ||= contributors.map {|c| c.realname || ...
[ "0.87882906", "0.7045192", "0.69435745", "0.68999815", "0.68946624", "0.66966695", "0.66510856", "0.65186566", "0.65024716", "0.6349133", "0.62918943", "0.6285987", "0.6280689", "0.6268436", "0.62449276", "0.62093544", "0.62009573", "0.6192398", "0.6159521", "0.6139168", "0.6...
0.0
-1
private override the devise helper to store the current location so we can redirect to it after loggin in or out. This override makes signing in and signing up work automatically.
def store_current_location # To redirect to the url user hit before signin. store_location_for(:user, request.url) # devise handles redirect after sign in using session[:user_return_to] # updating redirect url for api session[:user_return_to] = params[:redirect_url] if params['redirect_url'].present...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_sign_in_path_for(resource)\n stored_location_for(:user) || super\n end", "def store_location\n # after registration is another special case - do not redirect to \"current page\"\n session[:user_return_to] = request.url unless [\"devise/passwords\", \"devise/sessions\", \"devise/registrations\...
[ "0.7925834", "0.78647333", "0.75276893", "0.7526515", "0.7471577", "0.7458663", "0.74543965", "0.7451203", "0.7442518", "0.7436072", "0.7432715", "0.73845494", "0.7374266", "0.7350391", "0.7339476", "0.73271686", "0.73214835", "0.73191226", "0.7317135", "0.7317135", "0.731701...
0.7804509
2
this can be used to customize the strategy used by owns to determine ownership, fx to support alternative ORMs
def licenses *names names.to_strings.each do |name| begin module_name = "#{name.camelize}License" clazz = module_name.constantize clazz.new(self).enforce! rescue raise "License #{module_name} not found" end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def owns?(object); object.owners.include?(self) end", "def owned?() end", "def owner\n self.company.present? ? self.company.owner : self\n end", "def owned?\n !owner.nil?\n end", "def owns?(what)\n if what.respond_to?(:user_ids)\n return what.user_ids.include?(self.id)\n elsif what.respo...
[ "0.63892275", "0.6272719", "0.6235042", "0.6127273", "0.60320115", "0.59940016", "0.59570116", "0.5955525", "0.592976", "0.5912521", "0.5912521", "0.59100163", "0.59016037", "0.5889379", "0.5880425", "0.58284223", "0.58046263", "0.580122", "0.57990885", "0.5788612", "0.577692...
0.0
-1
ex: "ELA / G2 / M1 / U1 / lesson 8"
def title pieces.join(' / ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def galactic_words_to_roman # returns roman representaion \n\t\t@pattern.split.map{ |e| @@galactic_words_roman_symbol_assignments[e] }.join\n\tend", "def galactic_words_to_roman # returns roman representaion \n\t\t@pattern.split.map{ |e| @@galactic_words_roman_symbol_assignments[e] }.join\n\tend", "def five_...
[ "0.5915658", "0.5915658", "0.5680137", "0.55940413", "0.5561822", "0.55574626", "0.5548208", "0.55388016", "0.5488114", "0.5473622", "0.54667974", "0.5393369", "0.53898555", "0.5385775", "0.53778934", "0.5353229", "0.5353229", "0.5351726", "0.53485644", "0.5339325", "0.532645...
0.5628696
3
GET /commercial_units GET /commercial_units.json
def index @commercial_units = CommercialUnit.where(manager_id: current_manager.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def foods_units\n get('/foods/units.json')\n end", "def index\n response = HTTParty.get(\"https://casa-core.herokuapp.com/api/units\", :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n @units = JSON.parse(response.body)\n return @units\n end", "def show\n @units = @commercial_...
[ "0.7396081", "0.7142066", "0.70291334", "0.6752632", "0.663217", "0.6624248", "0.65880096", "0.64707536", "0.64707536", "0.64707536", "0.64707536", "0.64707536", "0.64707536", "0.6342297", "0.6261357", "0.6244988", "0.6239747", "0.62388617", "0.6229985", "0.6229985", "0.62299...
0.73199826
1
GET /commercial_units/1 GET /commercial_units/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def foods_units\n get('/foods/units.json')\n end", "def show\n query = {\n 'id' => unit_params[:id]\n }\n response = HTTParty.get(\"https://casa-core.herokuapp.com/api/units/?id\", :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n ...
[ "0.72203463", "0.7174411", "0.710666", "0.71001995", "0.6896511", "0.68167305", "0.68108517", "0.68108517", "0.68108517", "0.674761", "0.671397", "0.66979825", "0.6670597", "0.6638138", "0.66297495", "0.66206133", "0.64801615", "0.6440675", "0.6425323", "0.6425323", "0.642532...
0.0
-1
POST /commercial_units POST /commercial_units.json
def create @commercial_unit = CommercialUnit.new(commercial_unit_params) @commercial_unit.manager_id = current_manager.id respond_to do |format| if @commercial_unit.save format.html { redirect_to @commercial_unit, notice: 'Commercial unit was successfully created.' } format.json { ren...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @retail_unit = RetailUnit.new(params[:retail_unit])\n\n respond_to do |format|\n if @retail_unit.save\n format.html { redirect_to @retail_unit, notice: 'Retail unit was successfully created.' }\n format.json { render json: @retail_unit, status: :created, location: @retail_unit...
[ "0.6597211", "0.6527221", "0.6425032", "0.6390354", "0.6390354", "0.6371961", "0.6371789", "0.6304161", "0.62638354", "0.6247032", "0.6223485", "0.62094903", "0.6208019", "0.6205605", "0.6196492", "0.61806726", "0.61719733", "0.6133327", "0.6132768", "0.61229014", "0.61206526...
0.7174377
0
PATCH/PUT /commercial_units/1 PATCH/PUT /commercial_units/1.json
def update respond_to do |format| if @commercial_unit.update(commercial_unit_params) format.html { redirect_to @commercial_unit, notice: 'Commercial unit was successfully updated.' } format.json { render :show, status: :ok, location: @commercial_unit } else format.html { render :...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n params.require(%i[id units])\n retrieve_and_validate_put.update!(units: params[:units])\n head :no_content\n end", "def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query...
[ "0.7325795", "0.6933477", "0.6746921", "0.66769266", "0.6650716", "0.66360396", "0.66119146", "0.6591864", "0.65802586", "0.6550638", "0.6505085", "0.6499993", "0.64896506", "0.6469143", "0.6426935", "0.64203036", "0.64099556", "0.63845104", "0.6351422", "0.63101315", "0.6302...
0.7261334
1
DELETE /commercial_units/1 DELETE /commercial_units/1.json
def destroy @commercial_unit.destroy respond_to do |format| format.html { redirect_to commercial_units_url, notice: 'Commercial unit was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n response = HTTParty.delete(url, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n redirect_to units_url, notice: 'Unit was successfully deleted.'\n end", "def destroy\n @base_unit.destroy\n respond_to do ...
[ "0.7436055", "0.7400683", "0.73065764", "0.7261996", "0.72168434", "0.7165095", "0.7165095", "0.7165095", "0.7165095", "0.71451515", "0.7140231", "0.71108127", "0.71077573", "0.7106991", "0.7082467", "0.70809644", "0.7047275", "0.7033625", "0.70232356", "0.6975547", "0.697248...
0.74651873
0
Use callbacks to share common setup or constraints between actions.
def set_commercial_unit @commercial_unit = CommercialUnit.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a list of trusted parameters through.
def commercial_unit_params params.require(:commercial_unit).permit(:owner, :address, :shops, :sqmt, :parking, :price, :photo, :photo_cache) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
The method above does not result in an array
def test_it_can_find_items_by_description item_repo = ItemRepository.new(self, "./data/items.csv") description = "oil painting on stretched canvas 45x60 cm" results = item_repo.find_all_with_description(description) assert_equal 263399825, results.first.id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_a; Array(force) end", "def get_items\r\n @arr.to_a\r\n end", "def to_a; [Array]; end", "def to_a; [self] end", "def to_a; [self] end", "def converted_arrays; end", "def to_ary; []; end", "def array\n @array\n end", "def to_a; []; end", "def to_ary\n\t []\n\tend", "def to_ary()...
[ "0.75852287", "0.7194747", "0.7169123", "0.70382065", "0.70382065", "0.70259875", "0.7016237", "0.7004402", "0.6983973", "0.69661", "0.69622666", "0.69531405", "0.6908512", "0.68851", "0.68851", "0.68851", "0.68851", "0.68851", "0.68851", "0.68851", "0.68851", "0.68806934",...
0.0
-1
TODO: move to Ability
def browsable_by?(user) return true if space.member?(user) browsable && folder.browsable_by?(user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def who_we_are\r\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def permitted?; end", "def accessibility; end", "def access_control\n \n end", "def intensifier; end", "def specialty; end", "def schubert; end", "def weber; end", ...
[ "0.72233003", "0.6181409", "0.61412567", "0.61412567", "0.61412567", "0.61412567", "0.612563", "0.60737", "0.6028953", "0.6004688", "0.5981688", "0.5940479", "0.5937913", "0.5936922", "0.5929281", "0.5913632", "0.5913632", "0.58854944", "0.5870347", "0.58529526", "0.58529526"...
0.0
-1
Replaces the content of the carbon copy and the page with the snapshot taken from the specified revision. All revisions created after the specified one will be destroyed.
def rollback(target_revision) new_content = snapshot(target_revision) current_content = self.content.dup unless carbon_copy.update({ content: new_content }) return false end unless self.update({ content: new_content }) carbon_copy.update!({ content: current_content }) return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_revision(revision)\n if revision.save\n revision.page.body = revision.contents\n revision.page.file_path = revision.file_path\n flash[:success] = 'Revision created.'\n redirect_to revision.page and return if revision.page.save\n else\n flash[:danger] = 'Revisio...
[ "0.62807816", "0.609603", "0.6057037", "0.5955726", "0.58299303", "0.5628498", "0.5585409", "0.55806434", "0.5530285", "0.55208594", "0.54790926", "0.5477019", "0.54659843", "0.54280823", "0.53896964", "0.5387779", "0.53854376", "0.5372894", "0.5331899", "0.53277606", "0.5293...
0.5431303
13
when configuration writes, it will setup ssh, ensure that happens only once
def setup_ssh # create pem certificate FileUtils.mkdir_p("#{@path}/.ssh") %x(ssh-keygen -t rsa -b 2048 -v -N '' -f #{@path}/.ssh/#{@vm_name}) # File.rename("#{@path}/.ssh/#{@vm_name}", "#{@path}/.ssh/#{@vm_name}.pem") File.rename( [@path, '.ssh', @vm_name].join('/'), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configuration_for(host, use_ssh_config); end", "def apply_config!\n if self.connect then\n @ssh_connection.exec!(\"/usr/etc/rc.d/rc.softrestart\") or raise\n #@ssh_connection.exec!(\"ubntconf -c /tmp/system.cfg\") or raise\n #@ssh_connection.exec!(\"cfgmtd -p /etc/\") or rai...
[ "0.6979926", "0.69679457", "0.6893198", "0.6865094", "0.66081595", "0.65191454", "0.6487562", "0.644562", "0.64274216", "0.6425361", "0.6390827", "0.6347461", "0.6263291", "0.6217432", "0.6171159", "0.61665905", "0.61298907", "0.60933125", "0.60402495", "0.60385907", "0.60259...
0.6339997
12
ALWAYS restart your server after changing this file
def mytag(opts) Rails.logger.info "Own method mytag is active" "<b>#{opts[:text]}</b>" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reload\n run \"touch #{current_path}/rack/tmp/restart.txt\"\n end", "def reload\n load 'config/environment.rb'\nend", "def reload_server\n restart_server\n end", "def reload\n load 'config/environment.rb'\nend", "def reload\n load 'config/environment.rb'\nend", "def reload\n...
[ "0.66244173", "0.66142625", "0.63408613", "0.6324575", "0.6324575", "0.6324575", "0.6324575", "0.6324575", "0.6324575", "0.6324575", "0.6324575", "0.6324575", "0.6324575", "0.6324575", "0.6324575", "0.6324575", "0.6309358", "0.6247265", "0.6185574", "0.6185574", "0.6185574", ...
0.0
-1
GET /ferias_funcionarios GET /ferias_funcionarios.json
def index @ferias_funcionarios = FeriasFuncionario.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @funcionarios = Funcionario.all\n end", "def index\n @funcionarios = Funcionario.all\n end", "def show\n @funcionario = Funcionario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @funcionario }\n end\n end", "def...
[ "0.69417876", "0.69417876", "0.67575157", "0.6749783", "0.67449415", "0.6724178", "0.6659449", "0.65441644", "0.6535477", "0.64129937", "0.6257983", "0.6250344", "0.62077063", "0.61920947", "0.61752886", "0.6153016", "0.6116095", "0.6104317", "0.6054541", "0.6005901", "0.5994...
0.7488909
0
GET /ferias_funcionarios/1 GET /ferias_funcionarios/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @ferias_funcionarios = FeriasFuncionario.all\n end", "def show\n @funcionario = Funcionario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @funcionario }\n end\n end", "def set_ferias_funcionario\n @ferias_funcion...
[ "0.72571933", "0.69503736", "0.678912", "0.67188656", "0.67188656", "0.6584141", "0.65320134", "0.6522609", "0.6452813", "0.6369268", "0.6368773", "0.6344268", "0.6322654", "0.6264034", "0.61279356", "0.6114198", "0.6088407", "0.6071505", "0.60692656", "0.6067657", "0.6061499...
0.0
-1
POST /ferias_funcionarios POST /ferias_funcionarios.json
def create @ferias_funcionario = FeriasFuncionario.new(ferias_funcionario_params) respond_to do |format| if @ferias_funcionario.save format.html { redirect_to @ferias_funcionario, notice: 'Ferias funcionario was successfully created.' } format.json { render :show, status: :created, locati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @funcionario = Funcionario.new(funcionario_params)\n respond_to do |format|\n if @funcionario.save\n format.html { redirect_to @funcionario, notice: 'Funcionário cadastrado com sucesso' }\n format.json { render :show, status: :created, location: @funcionario }\n else\n ...
[ "0.73245543", "0.73051065", "0.7167074", "0.70945144", "0.70621324", "0.68746006", "0.68276304", "0.6784931", "0.6533982", "0.652876", "0.64396787", "0.6421163", "0.64006793", "0.6371963", "0.6282111", "0.6242771", "0.6187138", "0.61486876", "0.6108886", "0.6097135", "0.60771...
0.74704206
0
PATCH/PUT /ferias_funcionarios/1 PATCH/PUT /ferias_funcionarios/1.json
def update respond_to do |format| if @ferias_funcionario.update(ferias_funcionario_params) format.html { redirect_to @ferias_funcionario, notice: 'Ferias funcionario was successfully updated.' } format.json { render :show, status: :ok, location: @ferias_funcionario } else format....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @funcionario = Funcionario.find(params[:id])\n\n respond_to do |format|\n if @funcionario.update_attributes(params[:funcionario])\n format.html { render :json => {:success => true} }\n format.xml { render :xml => @funcionario, :status => :created, :location => @funcionario }\...
[ "0.72380495", "0.7206474", "0.71148604", "0.70648986", "0.702696", "0.6927133", "0.69124603", "0.6726409", "0.65457916", "0.6261136", "0.6236437", "0.6200669", "0.6184337", "0.6179786", "0.61639136", "0.61314493", "0.6114128", "0.6111926", "0.61047786", "0.6096767", "0.609667...
0.7311799
0
DELETE /ferias_funcionarios/1 DELETE /ferias_funcionarios/1.json
def destroy @ferias_funcionario.destroy respond_to do |format| format.html { redirect_to ferias_funcionarios_url, notice: 'Ferias funcionario was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @funcionario = Funcionario.find(params[:id])\n @funcionario.destroy\n\n respond_to do |format|\n format.html { redirect_to funcionarios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @funcionario = Funcionario.find(params[:id])\n @funcionario.dest...
[ "0.7569371", "0.7542009", "0.75087744", "0.7465003", "0.74008065", "0.73031473", "0.72360563", "0.7199599", "0.714851", "0.7038195", "0.6997979", "0.68634546", "0.68131095", "0.67870545", "0.67841226", "0.67686677", "0.6765227", "0.67480874", "0.67466277", "0.673563", "0.6734...
0.74847734
3
Use callbacks to share common setup or constraints between actions.
def set_ferias_funcionario @ferias_funcionario = FeriasFuncionario.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 ferias_funcionario_params params.require(:ferias_funcionario).permit(:funcionario_id, :data_inicio, :data_fim) 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
empty array to keep track of all dogs.
def initialize(name, breed, age) #initialize with 3 arguments. @name = name @breed = breed @age = age DOGS << self #showell into empty DOGS array. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dogs \n dogs = self.walks.map {|walk| walk.dog}\n dogs.uniq\n end", "def dogs_by_size_results\n dogs_by_size_results = []\n end", "def small_dogs\n small_array = []\n @dogs.each do |dog|\n if dog[:size] == :small\n small_array << dog\n end\n end\n p small_array...
[ "0.71311396", "0.68865633", "0.6658669", "0.6538792", "0.65092516", "0.6412032", "0.62956345", "0.62956345", "0.62697953", "0.62041503", "0.6012745", "0.60009533", "0.5940987", "0.59308016", "0.5894328", "0.58900523", "0.5875867", "0.58193594", "0.57767", "0.5745893", "0.5733...
0.5722883
22
Create an XML builder. Available options are: :root:: Root element. All nodes created by the builder will be attached to it. :encoding:: Document encoding, e.g. "UTF8". Will be used in XML instruction: Builder compatibility options: :indent:: Number of spaces used for indentation. Default is 0. :margin:: Amount of init...
def initialize(options = {}) if options[:target] ::Kernel.raise ::ArgumentError, "':target' option is not supported." end @indent = options[:indent].to_i @margin = options[:margin].to_i @root = options[:root] || XML::Document.new @encoding = options[:encoding] || "UTF-8" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xml_builder\n @xml_builder ||= begin\n @options[:indent] ||= 2\n builder = @options[:builder] ||= ::Builder::XmlMarkup.new(:indent => 2)\n unless @options[:skip_instruct]\n builder.instruct!\n @options[:skip_instruct] = true\n end\n builder\n end\n...
[ "0.7802451", "0.7768169", "0.7662021", "0.75103754", "0.6737179", "0.6735147", "0.67348915", "0.66501755", "0.66305375", "0.6482468", "0.63880026", "0.6307061", "0.6292888", "0.6261908", "0.62465763", "0.6226191", "0.6226191", "0.61121625", "0.61121625", "0.60765564", "0.6037...
0.6603757
9
Returns the target XML string.
def target! # FIXME Temp solution for encoding constant lookup. # (till bugfix release https://github.com/xml4r/libxml-ruby/pull/45 to be published) const_name = @encoding.upcase.gsub!("-", "_") encoding = XML::Encoding.const_get(const_name) XML.indent_tree_output = (@indent > 0) XML.default_tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n @xml\n end", "def to_s\n return self.xml\n end", "def to_xml\n return to_s\n end", "def to_xml\n return to_s\n end", "def to_xml\n return @doc.to_s\n end", "def xml_str # :nodoc:\n @writer.string\n end", "def to_str\n str = ...
[ "0.7200863", "0.7190277", "0.70904136", "0.70904136", "0.70629394", "0.7059575", "0.68799436", "0.6872141", "0.68628246", "0.68529105", "0.68526405", "0.68526405", "0.6829246", "0.67188036", "0.6642312", "0.6642312", "0.66313595", "0.66313595", "0.6605385", "0.65988654", "0.6...
0.6854506
9
XML declarations are not yet supported.
def declare!(inst, *args, &block) __warn("XML declarations are not yet supported. Pull requests are welcome!") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xml_decl; end", "def xmldecl ver, enc, stand\n # ignore xml declaration\n end", "def xmldecl(version, encoding, standalone); end", "def xmldecl(version, encoding, standalone); end", "def xmldecl(version, encoding, standalone); end", "def xmldecl(version, encoding, standalone); end", "de...
[ "0.8242332", "0.7771365", "0.7536437", "0.7536437", "0.7536437", "0.7536437", "0.7470103", "0.7334333", "0.6869797", "0.67549336", "0.67549336", "0.66941863", "0.6540186", "0.6473897", "0.64630574", "0.637613", "0.6169421", "0.6168188", "0.6136635", "0.6095454", "0.60163724",...
0.8063021
1
Custom XML instructions are not supported. Left here for Builder API compatibility.
def instruct!(*args) # TODO should we switch XML instruction off if `instruct!` is not called? __warn("Custom XML instructions are not supported") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_xml\n raise NotImplementedError, \"Override build_xml in subclass\"\n end", "def xml?; end", "def xml?; end", "def to_xml(*args)\n super\n end", "def xml; end", "def md_xml_instr(target, code)\n md_el(:xml_instr, [], :target => target, :code => code)\n end", "d...
[ "0.6561434", "0.6533893", "0.6533893", "0.636604", "0.634459", "0.6235615", "0.6185245", "0.6185245", "0.6113211", "0.6020409", "0.6011679", "0.6011679", "0.6011679", "0.6011679", "0.6011679", "0.6011679", "0.5935728", "0.58837944", "0.5812568", "0.5806724", "0.5773592", "0...
0.6876741
0
Syntactical suger for the DSL for adding directories
def directories(&block) return @directories unless block_given? instance_eval(&block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_dirs; end", "def directories; end", "def directories; end", "def dirs; end", "def dirs; end", "def register_directories(*dirs); end", "def hook_add_directories\n @flavor.class.after_add_directories do |directories|\n directories.each do |dir|\n actions_taken << \"crea...
[ "0.7441028", "0.7149348", "0.7149348", "0.6961987", "0.6961987", "0.69522536", "0.69289124", "0.6831544", "0.664982", "0.6461235", "0.639728", "0.639728", "0.6382119", "0.6365555", "0.63174665", "0.63010025", "0.62782013", "0.62747705", "0.6206182", "0.6169919", "0.61644053",...
0.5721216
83
For Cloud Syncers, +pattern+ can be a string (with shellstyle wildcards) or a regex. For RSync, each +pattern+ will be passed to rsync's exclude option.
def exclude(pattern) excludes << pattern end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exclude(pattern)\n excludes << pattern\n end", "def exclude(*patterns, &block)\n patterns.each do |pat|\n if pat.respond_to? :to_ary\n exclude(*pat.to_ary)\n else\n @exclude_patterns << Rake.from_pathname(pat)\n end\n end\n @exclude_procs << block...
[ "0.73415345", "0.69117004", "0.68318725", "0.67540616", "0.67211926", "0.67211926", "0.64985883", "0.6298318", "0.6270728", "0.623346", "0.6210273", "0.6008651", "0.5945942", "0.5933234", "0.5916862", "0.59110963", "0.5888143", "0.5882572", "0.58549356", "0.5779183", "0.57522...
0.730099
1
Pass either a path to a csv file to parse which will return an array of hashes (stringified keys) or pass an array of hashes and an array of column names See readme.rdoc for more detaild information
def CSVHash arg, columns=nil if arg.is_a?(File) CSVHash.from_file(arg.path) elsif arg.is_a?(String) CSVHash.from_file(arg) elsif arg.is_a?(Array) && columns.is_a?(Array) CSVHash.to_string(arg,columns) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_csv_data(infile)\n csv_data = CSV.read infile\n headers = csv_data.shift.map {|i| i.to_s }\n string_data = csv_data.map {|row| row.map {|cell| cell.to_s } }\n return string_data.map {|row| Hash[*headers.zip(row).flatten] }\nend", "def get_csv_data(infile)\n csv_data = CSV.read infile\n headers = c...
[ "0.7093382", "0.7093382", "0.7015091", "0.6880396", "0.6840101", "0.6746664", "0.6717812", "0.6699293", "0.6654217", "0.6637972", "0.6636219", "0.6579863", "0.65691733", "0.6556659", "0.65560937", "0.6511675", "0.65082663", "0.64926404", "0.6471098", "0.6459849", "0.6448597",...
0.7044502
2
Convenience method to allow configuration options to be set in a block
def configure yield self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure(&block)\n raise ArgumentError, \"Block is required.\" unless block_given?\n yield @options\n end", "def config(&block)\n instance_eval(&block) if block_given?\n end", "def configure_with_block(&block)\n self.instance_eval(&block) if block_given?\n end", "def configure_wit...
[ "0.8478099", "0.8120963", "0.81001765", "0.81001765", "0.8010885", "0.7984564", "0.7981057", "0.7940716", "0.79392976", "0.7935303", "0.7903023", "0.7882659", "0.7882427", "0.787986", "0.7873399", "0.78668606", "0.78619075", "0.78619075", "0.78616524", "0.7843603", "0.7843267...
0.0
-1
Autocomplete the form category
def auto_complete_for_category_name_with_security Category.with_user_scope(current_user) do auto_complete_for_category_name_without_security end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAutocompleteCategory( str, language)\n params = Hash.new\n params['str'] = str\n params['language'] = language\n return doCurl(\"get\",\"/autocomplete/category\",params)\n end", "def bu_autocomplete\n search_term = params[:term]\n\n species_id = Specie.find_by_scientificname(params[:spe...
[ "0.66870415", "0.6530423", "0.6386781", "0.6267195", "0.62239426", "0.61836475", "0.61587936", "0.61587936", "0.61587936", "0.60495496", "0.6003028", "0.5985617", "0.59835297", "0.5954984", "0.59404993", "0.5893356", "0.58546704", "0.5852212", "0.58342177", "0.58282536", "0.5...
0.7366821
0
GET /addstocks GET /addstocks.json
def index @addstocks = Addstock.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @addstock = Addstock.new(addstock_params)\n\n respond_to do |format|\n if @addstock.save\n format.html { redirect_to @addstock, notice: 'Addstock was successfully created.' }\n format.json { render :show, status: :created, location: @addstock }\n else\n format.html...
[ "0.7281211", "0.6959875", "0.6807572", "0.67278796", "0.67086136", "0.6679112", "0.6679112", "0.6679112", "0.6679112", "0.666614", "0.66246843", "0.66246843", "0.66246843", "0.66246843", "0.66246843", "0.66246843", "0.6576963", "0.6573532", "0.65395045", "0.653386", "0.652492...
0.68355906
2
GET /addstocks/1 GET /addstocks/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @addstock = Addstock.new(addstock_params)\n\n respond_to do |format|\n if @addstock.save\n format.html { redirect_to @addstock, notice: 'Addstock was successfully created.' }\n format.json { render :show, status: :created, location: @addstock }\n else\n format.html...
[ "0.7404231", "0.7087501", "0.704782", "0.6864292", "0.6861232", "0.68578446", "0.68313915", "0.68313915", "0.68313915", "0.68313915", "0.68146974", "0.676879", "0.676879", "0.676879", "0.676879", "0.676879", "0.676879", "0.673112", "0.6720973", "0.665438", "0.66515833", "0....
0.0
-1
POST /addstocks POST /addstocks.json
def create @addstock = Addstock.new(addstock_params) respond_to do |format| if @addstock.save format.html { redirect_to @addstock, notice: 'Addstock was successfully created.' } format.json { render :show, status: :created, location: @addstock } else format.html { render :ne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n symbol = params[:symbol].upcase\n is_existing_stock = current_user.stocks.where(symbol: symbol, run_id: params[:run_id]).flatten.size > 0\n num_of_stocks = current_user.stocks.where( run_id: params[:run_id]).flatten.size\n respond_to do |format|\n if !is_existing_stock && num_of_stock...
[ "0.7333773", "0.70670575", "0.7022942", "0.7007119", "0.7007119", "0.7007119", "0.7007119", "0.69861895", "0.69861895", "0.69861895", "0.69861895", "0.69861895", "0.69861895", "0.6880555", "0.68796635", "0.6821348", "0.68168044", "0.674483", "0.6739394", "0.6737049", "0.67003...
0.75397074
0
PATCH/PUT /addstocks/1 PATCH/PUT /addstocks/1.json
def update respond_to do |format| if @addstock.update(addstock_params) format.html { redirect_to @addstock, notice: 'Addstock was successfully updated.' } format.json { render :show, status: :ok, location: @addstock } else format.html { render :edit } format.json { render...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n if @stock.update_attributes(params[:stock])\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json...
[ "0.6773529", "0.6648417", "0.66384536", "0.66384536", "0.66384536", "0.66207194", "0.6609417", "0.6609417", "0.6608444", "0.66070586", "0.66070586", "0.66070586", "0.66070586", "0.66070586", "0.66070586", "0.66070586", "0.66070586", "0.66070586", "0.66070586", "0.66070586", "...
0.71080697
0
DELETE /addstocks/1 DELETE /addstocks/1.json
def destroy @addstock.destroy respond_to do |format| format.html { redirect_to addstocks_url, notice: 'Addstock was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n ...
[ "0.7361664", "0.7361664", "0.7335121", "0.7329498", "0.7329498", "0.7329498", "0.7329498", "0.7329498", "0.7329498", "0.7322084", "0.7287127", "0.7199586", "0.71924746", "0.71582764", "0.71582764", "0.7120182", "0.7077413", "0.7077413", "0.7077413", "0.7077413", "0.7077413", ...
0.75992185
0
Use callbacks to share common setup or constraints between actions.
def set_addstock @addstock = Addstock.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 addstock_params params.require(:addstock).permit(:stock, :unit, :material_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
make sure player cannot choose filled square
def player_choice(b) begin puts "\n\nChoose an empty position (from 1 to 9) to place a piece:\n\n" playerchoice = gets.chomp.to_i end until board_available(b).include?(playerchoice) b[playerchoice] = "X" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def game_over \n # all the grid's cells are full and different numbers \n end", "def validate_player_move(move)\r\n \r\n #Return a value of false is the square has already been\r\n #selected\r\n return false if move == \"A1\" && $A1 != \" \"\r\n return false if move == \"B1\" && $B1 != \" \"\r...
[ "0.6828403", "0.6746637", "0.6722422", "0.66740584", "0.664277", "0.66280955", "0.66272354", "0.6559149", "0.6555058", "0.65492386", "0.6548637", "0.654123", "0.6526309", "0.65249103", "0.65160805", "0.65093213", "0.65090036", "0.64929694", "0.64904696", "0.64878106", "0.6476...
0.0
-1
check if there is a winner
def winner_check(b) # player = "player" # computer = "computer" win_trio = [ [1,2,3], [4,5,6], [7,8,9], [1,4,7], [2,5,8], [3,6,9], [1,5,9], [3,5,7]] win_player = b.select { |k, val| val == "X"}.keys win_computer = b.select { |k, val| val == "0"}.keys win_trio.each do |trio| return "Player" if b.value...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_winner\n cells_t = cells.transpose\n row_winner(cells)\n row_winner(cells_t)\n diagonal_winner unless winner\n announce_winner if winner\n winner\n end", "def winner?\n\t\t@winner\n\tend", "def someone_won?(brd)\n !!detect_winner(brd)\n end", "def check_winner\r\n\t\tif board...
[ "0.82038", "0.81528497", "0.814194", "0.81285906", "0.81269085", "0.80461913", "0.80247366", "0.8003806", "0.79087687", "0.78886515", "0.7877979", "0.7839675", "0.78274584", "0.7826408", "0.7766096", "0.7758782", "0.7730314", "0.77260387", "0.7705936", "0.77046925", "0.770169...
0.0
-1
get array of empty key positions on board
def board_available(b) b.select { |k, val| val == " "}.keys end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_empty_positions(board)\n board.select {|k, v| v.to_s!='X' && v.to_s!='O' }.keys\nend", "def free_positions\n\t\tboard.select {|position, value| value == 0}.keys\n\tend", "def get_empty_posns \n empty_posns = []\n\n @board.rows.each_with_index do |row, idx1| \n row.each_with_index do |block,...
[ "0.8254043", "0.77471715", "0.7633575", "0.7318649", "0.71292037", "0.7115373", "0.7039924", "0.6999765", "0.6999436", "0.6983314", "0.6813239", "0.6716003", "0.6680455", "0.6680455", "0.6655165", "0.66497815", "0.6585931", "0.64746433", "0.6459374", "0.6420759", "0.64177525"...
0.6365164
21
GET /notes GET /notes.json
def index_json @ni = Note.all p = params() if (p.has_key?("lat") && p.has_key?("lon")) @ni = notes_in_range(p['lat'].to_f, p['lon'].to_f) end @notes = @ni render :json => @notes.to_json( ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notes params=nil\n @nimble.get \"contact/#{self.id}/notes\", params\n end", "def get_notes(opts = {})\n data, status_code, headers = get_notes_with_http_info(opts)\n return data\n end", "def show\n render json: @notes\n end", "def index\n @notes = Note.all\n render json: @n...
[ "0.7888495", "0.77273864", "0.76676124", "0.7562425", "0.75259924", "0.7427192", "0.74179333", "0.7416583", "0.7335508", "0.7207159", "0.71307474", "0.71302974", "0.70627224", "0.70556515", "0.70113915", "0.70113915", "0.6990608", "0.6954989", "0.6910081", "0.68994814", "0.68...
0.6327769
65
GET /notes/1 GET /notes/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notes params=nil\n @nimble.get \"contact/#{self.id}/notes\", params\n end", "def show\n render json: @notes\n end", "def index\n @notes = Note.all\n render json: @notes\n end", "def notes\n return bad_request unless params[:note_id] and request.format.json? || request.format.js?\n ...
[ "0.74820447", "0.7437405", "0.7307661", "0.7270627", "0.72662115", "0.7252734", "0.71594936", "0.7126105", "0.7100044", "0.7091931", "0.7080441", "0.7052108", "0.70353377", "0.699191", "0.69709283", "0.69689095", "0.6956307", "0.69396627", "0.6926014", "0.68916845", "0.682284...
0.0
-1
POST /notes POST /notes.json
def create @note = Note.new(note_params) respond_to do |format| if @note.save format.html { redirect_to @note, notice: 'Note was successfully created.' } format.json { render action: 'show', status: :created, location: @note } else format.html { render action: 'new' } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @note = @current_user.notes.create(note_params)\n render json: @note\n end", "def create\n @note = Note.new(note_params)\n if @note.save\n render json: @note, status: :created, location: note_url(@note)\n else\n render json: @note.errors, status: :unprocessable_entity\n ...
[ "0.7317462", "0.7093732", "0.7041963", "0.699901", "0.695662", "0.6886458", "0.6869696", "0.68476456", "0.68290967", "0.68206424", "0.6811218", "0.6739828", "0.67388856", "0.67308867", "0.67130756", "0.66989064", "0.6669153", "0.66080385", "0.66080385", "0.65897906", "0.65889...
0.6520501
26
PATCH/PUT /notes/1 PATCH/PUT /notes/1.json
def update respond_to do |format| if @note.update(note_params) format.html { redirect_to @note, notice: 'Note was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @note.errors, status: :unproce...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n note = Note.find(params[\"id\"])\n note.update_attributes(note_params)\n respond_with note, json: note\n end", "def update\n if @note.update(note_params)\n render json: @note\n else\n render json: @note.errors, status: :unprocessable_entity\n end\n end", "def update\n...
[ "0.70452726", "0.7044096", "0.6724931", "0.6716891", "0.67166126", "0.66816556", "0.6664434", "0.66621363", "0.6618653", "0.6617309", "0.6593774", "0.6591015", "0.6576411", "0.6555879", "0.65397567", "0.65208673", "0.6514819", "0.65081424", "0.65042055", "0.65042055", "0.6504...
0.6632908
8
DELETE /notes/1 DELETE /notes/1.json
def destroy @note.destroy respond_to do |format| format.html { redirect_to notes_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @note = Note.find(params[:id])\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to(notes_url) }\n format.json { head :ok }\n end\n end", "def destroy\n @note = Note.find(params[:id])\n @note.destroy\n\n respond_to do |format|\n format.html { ...
[ "0.7653342", "0.7651466", "0.7630277", "0.7628467", "0.76282763", "0.7615507", "0.7541189", "0.7538272", "0.75136083", "0.738551", "0.7383657", "0.73587185", "0.7328386", "0.7328386", "0.730473", "0.7296089", "0.727885", "0.72535753", "0.72535753", "0.72535753", "0.72535753",...
0.7600995
9
Use callbacks to share common setup or constraints between actions.
def set_note @note = Note.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 note_params params.permit(:id, :title, :note, :audio_path, :latitude, :longitude, :sender, :recipient, :visible_range) 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.6980384", "0.6782743", "0.6746196", "0.6742575", "0.6736", "0.6594004", "0.65037984", "0.6496699", "0.64819324", "0.64791185", "0.6456292", "0.64403296", "0.63795286", "0.6375975", "0.6365291", "0.63210756", "0.6300542", "0.6299717", "0.62943304", "0.6292561", "0.6290683",...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_liste @liste = Liste.find(params[:liste_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
GET /gifs GET /gifs.json
def index if params[:tag] #puts "TAG IS " + params[:tag] #puts "PARMAS ARE " + params[:sort].to_s if params[:sort] == "most_recent" @gifs = Gif.tagged_with(params[:tag]).where("approved = ? AND deleted = ?", true, false).order("created_at DESC") else @gifs = Gif.tagged_with(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @gifs = Gif.sorted.paginate(page: params[:page], per_page: 12)\n\n respond_to do |format|\n format.html\n format.json { render json: @gifs }\n end\n end", "def index\n @gifts = current_host.gifts\n end", "def index_by_user\n @gifts = @current_user.gifts\n render json: ...
[ "0.7427869", "0.7401046", "0.70986855", "0.7079148", "0.70318115", "0.69469386", "0.6912402", "0.6883898", "0.68798333", "0.6648624", "0.6617612", "0.65903455", "0.65833277", "0.65207064", "0.65207064", "0.6493849", "0.64115983", "0.6360232", "0.6358811", "0.6358811", "0.6358...
0.5953058
49
GET /gifs/1 GET /gifs/1.json
def show @gifdex = session[:gifdex] session[:position] = session[:gifdex].index(@gif.id) if params[:gif_id] @last_gif = Gif.find(params[:gif_id]) puts "last_gif "+@last_gif.id.to_s if params[:v] == "true" puts "up vote" @last_gif.upvotes += 1 elsif params[:v] == "fals...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @indexed_gif = IndexedGif.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @indexed_gif }\n end\n end", "def index\n @gifts = current_host.gifts\n end", "def index\n @gifs = Gif.sorted.paginate(page: params[:page], per...
[ "0.7377249", "0.72448164", "0.7227653", "0.7164022", "0.71438843", "0.70446396", "0.69739276", "0.68742996", "0.6831827", "0.67935544", "0.67935544", "0.67935544", "0.67935544", "0.67935544", "0.66617644", "0.66490483", "0.6594627", "0.65433973", "0.65327436", "0.6479315", "0...
0.56489235
99
POST /gifs POST /gifs.json
def create @gif = Gif.new(gif_params) @gif.avatar_remote_url(@gif.url) @gif.approved = false @gif.deleted = false @gif.upvotes = 0 @gif.downvotes = 0 @gif.ratio = 0 @gif.views = 0 respond_to do |format| if @gif.save format.html { redirect_to @gif, notice: 'Gif was succ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @gif = Gif.new(gif_params)\n\n respond_to do |format|\n if @gif.save\n format.html { redirect_to @gif, notice: 'Gif was successfully created.' }\n format.js {@gifs = Gif.all.order('created_at DESC')}\n else\n format.js {render :new }\n end\n end\n end", ...
[ "0.7055485", "0.70122415", "0.67548144", "0.6753195", "0.6713765", "0.67066705", "0.6675472", "0.6675023", "0.6651848", "0.6611398", "0.6305645", "0.62784857", "0.6229959", "0.61351866", "0.61351866", "0.61351866", "0.61351866", "0.61351866", "0.60120505", "0.5972649", "0.591...
0.744921
0
PATCH/PUT /gifs/1 PATCH/PUT /gifs/1.json
def update authorize! :index, @user, :message => 'Not authorized as an administrator.' respond_to do |format| if @gif.update(gif_params) format.html { redirect_to @gif, notice: 'Gif was successfully updated.' } format.json { head :no_content } else format.html { render action...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @gif.update(gif_params)\n format.html do\n if params[:commit].include? \"More\"\n redirect_to edit_gif_path(Gif.untagged.first), notice: 'Gif was successfully updated.'\n else\n redirect_to @gif, notice: 'Gif was succes...
[ "0.7086002", "0.70371795", "0.69746923", "0.67879516", "0.6522257", "0.63150895", "0.63150895", "0.63150895", "0.63150895", "0.63150895", "0.6169841", "0.61221", "0.6093425", "0.60763735", "0.60312307", "0.5998008", "0.5970987", "0.5936366", "0.59173715", "0.5910893", "0.5850...
0.7351782
0
DELETE /gifs/1 DELETE /gifs/1.json
def destroy authorize! :index, @user, :message => 'Not authorized as an administrator.' #ToDo This (v) should use destroy but the the life of me I cannot understand why it doesn't work with rolify @gif.delete respond_to do |format| format.html { redirect_to gifs_url } format.json { head :no_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @gif.destroy\n respond_to do |format|\n format.html { redirect_to gifs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @indexed_gif = IndexedGif.find(params[:id])\n @indexed_gif.destroy\n\n respond_to do |format|\n format.html { redirect_to in...
[ "0.7889604", "0.76698923", "0.72716624", "0.7241756", "0.67820066", "0.66659045", "0.6642979", "0.66204745", "0.6603957", "0.6598002", "0.6557389", "0.65467733", "0.6538493", "0.65379274", "0.6522805", "0.6517902", "0.6487572", "0.6483887", "0.64837366", "0.6472128", "0.64566...
0.7112794
4
Use callbacks to share common setup or constraints between actions.
def set_gif @gif = Gif.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 gif_params params.require(:gif).permit(:caption, :upvotes, :downvotes, :views, :ratio, :avatar, :url, :tag_list) 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.6980384", "0.6782743", "0.6746196", "0.6742575", "0.6736", "0.6594004", "0.65037984", "0.6496699", "0.64819324", "0.64791185", "0.6456292", "0.64403296", "0.63795286", "0.6375975", "0.6365291", "0.63210756", "0.6300542", "0.6299717", "0.62943304", "0.6292561", "0.6290683",...
0.0
-1
default password is set to "12345"
def passwd @password = "12345" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_password\n self.password = \"password_dummy\"\n self.password_confirmation = \"password_dummy\"\n end", "def set_default_password\r\nself.password = :random\r\nend", "def password=(new_password); end", "def password=(_arg0); end", "def password=(_arg0); end", "def password=(_arg0); end...
[ "0.8178926", "0.81533414", "0.7951153", "0.78789103", "0.78789103", "0.78789103", "0.78789103", "0.7817211", "0.7782664", "0.7782664", "0.7782664", "0.7782664", "0.7782664", "0.7782664", "0.77382535", "0.76266557", "0.76207006", "0.75961703", "0.7531806", "0.74698466", "0.746...
0.8041261
2
Used by stations to lookup the in App ID
def find @station = Station.find_by(hardware_uid: params[:hardware_uid]) respond_to do |format| format.html { redirect_to @station } format.json { render json: @station, status: :found } # Support for legacy ardiuno units format.yaml { render text: { id: @station.to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def application_id\n get_key('ALGOLIA_APPLICATION_ID', 'application_id')\n end", "def app_identifier\n return @app_identifier\n end", "def app_item_id\n read('app_item_id')\n end", "def app_id\n return @app_id\n end", "def app_id\n ...
[ "0.713623", "0.7074216", "0.70446855", "0.7022182", "0.7022182", "0.7022182", "0.7013252", "0.69839764", "0.69839764", "0.69592595", "0.68347454", "0.68307835", "0.6798427", "0.6783446", "0.6783446", "0.67242604", "0.67093176", "0.67093176", "0.67093176", "0.6707524", "0.6612...
0.0
-1
GET /mechanisms/1 GET /mechanisms/1.xml
def show @mechanism = Mechanism.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @mechanism } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @mechanism = Mechanism.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mechanism }\n end\n end", "def show\n @permission = Permission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml ...
[ "0.5949589", "0.5880779", "0.5880779", "0.570021", "0.5647773", "0.55930525", "0.5566591", "0.5542025", "0.5518998", "0.5473268", "0.54391205", "0.5427904", "0.54198605", "0.53903615", "0.53801435", "0.5368562", "0.5354741", "0.53414035", "0.53370386", "0.5322287", "0.5311671...
0.64170927
0
GET /mechanisms/new GET /mechanisms/new.xml
def new @mechanism = Mechanism.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @mechanism } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @permission = Permission.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @permission }\n end\n end", "def new\n @membership_kind = MembershipKind.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { re...
[ "0.6927293", "0.67058295", "0.65999997", "0.65992314", "0.65990114", "0.6545103", "0.65401375", "0.6523459", "0.65202934", "0.65116245", "0.64835334", "0.6481884", "0.6474231", "0.6463438", "0.64541215", "0.64386624", "0.6434241", "0.6429472", "0.6425155", "0.6425155", "0.642...
0.7277967
0
POST /mechanisms POST /mechanisms.xml
def create @mechanism = Mechanism.new(params[:mechanism]) respond_to do |format| if @mechanism.save flash[:notice] = 'Mechanism was successfully created.' format.html { redirect_to(@mechanism) } format.xml { render :xml => @mechanism, :status => :created, :location => @mechanism ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @mechanism = Mechanism.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mechanism }\n end\n end", "def allowed_mechs=(mechanisms)\n Cproton.pn_sasl_allowed_mechs(@impl, mechanisms)\n end", "def create\n @descriptor = Descriptor...
[ "0.55980515", "0.54617304", "0.5396261", "0.5130077", "0.5098312", "0.50412863", "0.50279844", "0.4983591", "0.49498665", "0.4942463", "0.49271342", "0.49268597", "0.49154198", "0.48704177", "0.4858015", "0.48437506", "0.48216453", "0.48129702", "0.48124796", "0.48082784", "0...
0.6320354
0
PUT /mechanisms/1 PUT /mechanisms/1.xml
def update @mechanism = Mechanism.find(params[:id]) respond_to do |format| if @mechanism.update_attributes(params[:mechanism]) flash[:notice] = 'Mechanism was successfully updated.' format.html { redirect_to(@mechanism) } format.xml { head :ok } else format.html { r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @expectation_stem = RiGse::ExpectationStem.find(params[:id])\n\n respond_to do |format|\n if @expectation_stem.update_attributes(params[:expectation_stem])\n flash[:notice] = 'RiGse::ExpectationStem.was successfully updated.'\n format.html { redirect_to(@expectation_stem) }\n ...
[ "0.54429954", "0.5307151", "0.5300582", "0.5290838", "0.52863777", "0.5261671", "0.52183706", "0.51725304", "0.5147121", "0.5135756", "0.51206493", "0.51125", "0.5090425", "0.5082326", "0.5079212", "0.50542784", "0.5045158", "0.5041287", "0.5032068", "0.50275534", "0.5012067"...
0.6408862
0
DELETE /mechanisms/1 DELETE /mechanisms/1.xml
def destroy @mechanism = Mechanism.find(params[:id]) @mechanism.destroy respond_to do |format| format.html { redirect_to(mechanisms_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @mutant.destroy\n head :no_content\n end", "def destroy\n @expectation_stem = RiGse::ExpectationStem.find(params[:id])\n @expectation_stem.destroy\n\n respond_to do |format|\n format.html { redirect_to(expectation_stems_url) }\n format.xml { head :ok }\n end\n end", ...
[ "0.6202614", "0.61993724", "0.611242", "0.61040217", "0.60701126", "0.60181385", "0.6014727", "0.5984611", "0.596375", "0.5949094", "0.5943886", "0.5933609", "0.59038424", "0.58983475", "0.58950853", "0.58940554", "0.58887035", "0.5887321", "0.58841735", "0.58622557", "0.5859...
0.7181848
0
mapping to AR user
def user User.find(self[:user_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map_user_from_ad(ad_user)\n self.ad_map.each do |user_object_field, ad_object_field| \n self.send(\"#{user_object_field}=\", ad_user.send(ad_object_field).to_s)\n end\n self.ad_user = ad_user\n end", "def user\n {\n id: object.user.id,\n email: ...
[ "0.691931", "0.6703884", "0.6604516", "0.6601019", "0.6564838", "0.6564838", "0.65575355", "0.65302354", "0.65177625", "0.640833", "0.6391569", "0.63672763", "0.6294431", "0.6259133", "0.62542653", "0.62504476", "0.6145774", "0.6135394", "0.61216986", "0.61211497", "0.6120127...
0.62821424
13
mapping to AR user
def user=(user) self.update_attributes(:user_id => user.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map_user_from_ad(ad_user)\n self.ad_map.each do |user_object_field, ad_object_field| \n self.send(\"#{user_object_field}=\", ad_user.send(ad_object_field).to_s)\n end\n self.ad_user = ad_user\n end", "def user\n {\n id: object.user.id,\n email: ...
[ "0.691931", "0.6703884", "0.6604516", "0.6601019", "0.6564838", "0.6564838", "0.65575355", "0.65302354", "0.65177625", "0.640833", "0.6391569", "0.63672763", "0.6294431", "0.62821424", "0.6259133", "0.62542653", "0.62504476", "0.6145774", "0.6135394", "0.61216986", "0.6121149...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_user @user = User.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a trusted parameter "white list" through.
def user_params params.require(:user).permit(:password, :mobile, :email, :name, :reset_password_token, :reset_password_sent_at, :remember_created_at, :sign_in_count, :current_sign_in_at, :last_sign_in_at, :current_sign_in_ip, :last_sign_in_ip, :avatar, :organization_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
Must be "new", "refurbished", or "used".
def condition(product) product.property("condition") || "new" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def used?; end", "def usable?; end", "def status\n\t\t:not_acceptable\n\tend", "def status\n\t\t:not_acceptable\n\tend", "def terms_of_use\n end", "def reason; end", "def reason; end", "def new_status?\r\n status == 'new'\r\n end", "def miss_reason; end", "def reserved; end", "def new\n\t\...
[ "0.6179232", "0.6161603", "0.6149644", "0.6149644", "0.6094116", "0.6054275", "0.6054275", "0.6009337", "0.595765", "0.5922012", "0.5900637", "0.5892316", "0.58733195", "0.58490795", "0.584082", "0.5813682", "0.57792974", "0.576391", "0.5760787", "0.57557595", "0.57557595", ...
0.0
-1
Must be "in stock", "preorder" or "out of stock"
def availability(product) product.master.in_stock? ? 'in stock' : 'out of stock' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_stock?\n true\n end", "def in_stock?\n if @stock <= 0\n false\n else\n true\n end\n end", "def in_stock?\n \t\tif stock > 0 \n \t\t\tTRUE\n \t\telse \n \t\t\tFALSE \n \t\tend\n \tend", "def out_of_stock_message(product)\r\n \"out of stock\" unless product \r\n ...
[ "0.7292864", "0.7256667", "0.71056324", "0.71004504", "0.70393574", "0.6944227", "0.6933683", "0.68574125", "0.6833951", "0.67923427", "0.66774327", "0.6602115", "0.6555857", "0.65146166", "0.6480697", "0.6475247", "0.6451819", "0.6398972", "0.6381295", "0.6373466", "0.635599...
0.6015902
41
Convert a 2 or 3 letter (ISO6391 or ISO6393) code to language name
def display_language(val) lang = LanguageList::LanguageInfo.find(val) lang ? lang.name : val end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_language_from_code code\n ISO_639.find(code).english_name if not(code.nil?)\n end", "def language_for_code(code)\n # ISO_639 maps -1 and -2. LanguageList maps -3.\n ISO_639.find(code)&.english_name || LanguageList::LanguageInfo.find(code)&.name\n end", "def three_char_code(lang:)\n ...
[ "0.79115415", "0.78602993", "0.7603336", "0.74254155", "0.7376872", "0.7240623", "0.70831114", "0.70811087", "0.701362", "0.6875618", "0.68340194", "0.68133193", "0.6804098", "0.6797712", "0.67486185", "0.6725595", "0.66615576", "0.6642182", "0.6621301", "0.6620451", "0.66115...
0.57136625
93
Override Blacklight so that we don't show anything for collections.
def render_facet_value(facet_solr_field, item, options ={}) return if facet_solr_field == 'human_readable_type_sim' && item.value == 'Collection' super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exclude; end", "def excluded; end", "def filter\n super\n end", "def show\n add_breadcrumb 'Blacklist'\n end", "def unfiltered_content; end", "def unfiltered_content; end", "def unfiltered_content; end", "def ignores; end", "def hide; end", "def hide; end", "def relation_base_bl...
[ "0.6122197", "0.60684925", "0.5927078", "0.5846794", "0.5823685", "0.5823685", "0.5823685", "0.5808597", "0.5805817", "0.5805817", "0.5790465", "0.5751412", "0.57264936", "0.56918895", "0.56918895", "0.5608835", "0.5598604", "0.5573801", "0.55670387", "0.5548629", "0.5542287"...
0.0
-1
TODO remove with blacklight 5.5 (projectblacklight/blacklight933) Renders the list of values removes any elements where render_facet_item returns a nil value. This enables an application to filter undesireable facet items so they don't appear in the UI
def render_facet_limit_list(paginator, solr_field, wrapping_element=:li) safe_join(paginator.items. map { |item| render_facet_item(solr_field, item) }.compact. map { |item| content_tag(wrapping_element,item)} ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_facet_value(facet_solr_field, item, options ={})\n return if facet_solr_field == 'human_readable_type_sim' && item.value == 'Collection'\n super\n end", "def facet_blocks(facet, values)\n values.map do |value|\n allowed_value = facet[\"allowed_values\"].detect { |av| av[\"value\"] == va...
[ "0.6690217", "0.65609443", "0.65377", "0.6426683", "0.6421156", "0.64147305", "0.6387306", "0.635737", "0.63122195", "0.6308391", "0.62553483", "0.6162838", "0.61487734", "0.6142461", "0.60971826", "0.59946644", "0.59813976", "0.59713525", "0.59644204", "0.59577245", "0.59204...
0.57799816
28
TODO remove with blacklight 5.5 (projectblacklight/blacklight933) Renders a single facet item
def render_facet_item(solr_field, item) if facet_in_params?( solr_field, item.value ) render_selected_facet_value(solr_field, item) else render_facet_value(solr_field, item) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_facet_item(facet_field, item)\n return if controller.controller_name == 'collections' &&\n (controller.action_name == 'index' || controller.action_name == 'facet') &&\n item.value == 'Collections'\n\n if facet_in_params?(facet_field, item.value)\n render_selected_facet...
[ "0.79322827", "0.75706416", "0.7444061", "0.7235731", "0.7116363", "0.7019897", "0.6937454", "0.69258106", "0.6865974", "0.68473107", "0.6833077", "0.6817511", "0.68046176", "0.6666048", "0.6555", "0.6489586", "0.6467051", "0.64339155", "0.6407008", "0.6391423", "0.63824886",...
0.7816462
1
Override blacklight so we don't display the "Type of Work" when the only item is "Collections" which is hidden.
def should_render_facet?(display_facet) return false if display_facet.name == 'human_readable_type_sim' && display_facet.items.reject { |item| item.value == 'Collection'}.empty? super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relation_base_blacklight_config\n # don't show collection facet\n blacklight_config.facet_fields['collection_name_ssim'].show = false\n blacklight_config.facet_fields['collection_name_ssim'].if = false\n # collapse remaining facets\n blacklight_config.facet_fields['subject_facet_ssim']...
[ "0.57917124", "0.5709164", "0.5709164", "0.56713754", "0.55636126", "0.5525543", "0.55126494", "0.5475877", "0.54745597", "0.5464668", "0.5463776", "0.5462916", "0.5371812", "0.53616226", "0.53616226", "0.52467775", "0.52399755", "0.52166", "0.52056974", "0.52056974", "0.5200...
0.5402128
12
Randomly selects a card from the deck, removes it from the deck then returns it. This is
def pick_random_card random_card = @all_cards.sample remove_card(random_card) return random_card end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_card\n num_random = rand(@cards.length)\n card = @cards[num_random]\n @cards.delete_at(num_random)\n card\n end", "def random_card\n result = @deck.sample(1)\n @deck.delete result\n result.first\n end", "def pick_random\n if @cards.length == 0\n return false\n end\n...
[ "0.87667406", "0.84100354", "0.8335165", "0.8123795", "0.791422", "0.7897326", "0.78233826", "0.7704866", "0.762161", "0.75629455", "0.746035", "0.7409654", "0.73853123", "0.73776764", "0.7336767", "0.72686034", "0.7228874", "0.72104806", "0.71441865", "0.71286416", "0.711836...
0.8540378
1
A private method that removes a card from the deck to remove the chance of a player getting the same card multiple times
def remove_card(card) @all_cards.delete(card) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deal_card\r\n random = rand(@playable_cards.size)\r\n @playable_cards.delete_at(random)\r\n end", "def deal_card\n random = rand(@playable_cards.size)\n @playable_cards.delete_at(random)\n end", "def hit(deck)\n rand_card = deck.sample # pulls a random card from the playing deck.\n deck.de...
[ "0.82226527", "0.8194141", "0.81682515", "0.78790855", "0.7805583", "0.7761923", "0.77204114", "0.76750064", "0.76576656", "0.7633439", "0.7564431", "0.7532182", "0.74870175", "0.7460638", "0.74399143", "0.7435756", "0.74231994", "0.7412905", "0.7385747", "0.7378234", "0.7366...
0.76150644
10
GET /matches GET /matches.xml
def index @matches = search_all(Match) @advert = Advert.random('matches_list') respond_to do |format| format.html # index.html.erb format.js { render :partial => @matches } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @matches = Match.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @matches }\n end\n end", "def index\n @matches = @contest.matches\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => ...
[ "0.7509046", "0.7447785", "0.700722", "0.69469506", "0.6889987", "0.6802948", "0.6802948", "0.6754387", "0.67325824", "0.6687517", "0.666518", "0.6590457", "0.6590457", "0.6590457", "0.6590457", "0.6590457", "0.65374875", "0.6528783", "0.63969916", "0.6287292", "0.6282322", ...
0.5793939
44
GET /matches/1 GET /matches/1.xml
def show @match = Match.find(params[:id]) @match.increment!(:click_count) @editors = @match.match_editors.distinct @num_edits = @match.match_editors.count if @num_edits > 0 @last_update = @match.match_editors.last.created_at else @last_update = @match.created_at end @advert =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @matches = Match.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @matches }\n end\n end", "def index\n @matches = @contest.matches\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => ...
[ "0.7444577", "0.7418395", "0.7153598", "0.7047252", "0.6915199", "0.6910285", "0.6910285", "0.68434966", "0.67317855", "0.66961443", "0.65884537", "0.65770024", "0.647346", "0.6413077", "0.6413077", "0.6413077", "0.6413077", "0.6413077", "0.63739043", "0.63326854", "0.6279511...
0.5750189
43
GET /matches/new GET /matches/new.xml
def new @match = Match.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @match } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @match = @contest.matches.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @match }\n end\n end", "def new\n @matchup = Matchup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mat...
[ "0.73426104", "0.72122383", "0.7088592", "0.70129484", "0.70129484", "0.70129484", "0.70129484", "0.70023394", "0.6868399", "0.67119443", "0.66768295", "0.66207623", "0.65686643", "0.65686643", "0.6518226", "0.6441806", "0.6348934", "0.6326938", "0.6320011", "0.62959534", "0....
0.76295495
2
POST /matches POST /matches.xml
def create @match = Match.new(params[:match]) @match.user_id = current_user.id respond_to do |format| if @match.save flash[:notice] = 'Match was successfully created.' format.html { redirect_to(@match) } format.xml { render :xml => @match, :status => :created, :location => @m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @match = Match.new(match_params)\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to matches_url, notice: 'Match créé avec succès' }\n format.json { render :index, status: :created, location: @match }\n else\n format.html { render :new }\n ...
[ "0.6281315", "0.61621773", "0.6114007", "0.6114007", "0.61094874", "0.61025006", "0.6098369", "0.6098369", "0.6098369", "0.6098369", "0.6098369", "0.6098369", "0.6089259", "0.60432345", "0.6031449", "0.6018669", "0.6018669", "0.6018669", "0.6015699", "0.58603215", "0.5818601"...
0.60655326
13
PUT /matches/1 PUT /matches/1.xml
def update @match = Match.find(params[:id]) @match.match_editors.create({:user_id => current_user.id}) respond_to do |format| if @match.update_attributes(params[:match]) flash[:notice] = 'Match was successfully updated.' format.html { redirect_to(@match) } format.xml { head :...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @match = @contest.matches.find(params[:id])\n\n respond_to do |format|\n if @match.update_attributes(params[:match])\n flash[:notice] = 'Match was successfully updated.'\n format.html { redirect_to(contest_path) }\n format.xml { head :ok }\n else\n format.h...
[ "0.6221481", "0.6132483", "0.61235803", "0.61235803", "0.60396826", "0.59832984", "0.5933065", "0.5865453", "0.5849326", "0.5786664", "0.57812816", "0.5776896", "0.5757311", "0.5749162", "0.56937647", "0.56577986", "0.5642815", "0.56379384", "0.5618383", "0.5618139", "0.56039...
0.5723352
14
DELETE /matches/1 DELETE /matches/1.xml
def destroy @match = Match.find(params[:id]) @match.destroy respond_to do |format| format.html { redirect_to(matches_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @match = @contest.matches.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to(@contest) }\n format.xml { head :ok }\n end\n end", "def destroy\n @match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n ...
[ "0.7255616", "0.722305", "0.7181599", "0.6847635", "0.66737944", "0.6665572", "0.665354", "0.665354", "0.665354", "0.6622728", "0.6602933", "0.6598933", "0.65852314", "0.65832067", "0.65253663", "0.64059335", "0.6352573", "0.6328058", "0.62803894", "0.62803894", "0.62803894",...
0.71989024
2
return an array of parent ids from the first list with parent nil
def lineage parents = [] list = self while list.parentlist_id list = List.find(list.parentlist_id) parents << list end if parents.length > 0 parents.reverse!.slice(1..-1) else parents end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parent_ids\n []\n end", "def find_parent_ids(array=nil)\n parent_id = []\n\n puts array.class\n parent = Parent.find_by(array)\n puts parent\n\n parent_id << parent.children.pluck(:child_id)\n\n parent.children.each do |child| \n unless child.children.blank?\n parent_id << c...
[ "0.79399574", "0.76538986", "0.7651689", "0.7546582", "0.7525001", "0.7103874", "0.7054672", "0.70269066", "0.7015052", "0.6912886", "0.68941385", "0.68808466", "0.6871159", "0.6762905", "0.67555416", "0.67478776", "0.6746144", "0.67417705", "0.6647703", "0.6631561", "0.66290...
0.6356194
37
Returns the path of achievement badge, if badge is present. Otherwise, return default achievement badge.
def achievement_badge_path(achievement = nil) image_path(achievement&.badge&.medium&.url || 'achievement_blank.png') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def badge\n if badge_id\n Merit::Badge.find(badge_id)\n else\n Merit::Badge.find_by_name_and_level(badge_name, level)\n end\n end", "def badge\n if @badge.nil?\n badges = Badge.by_name(badge_name)\n badges = badges.by_level(level) unless level.nil?\n @bad...
[ "0.67215705", "0.6684433", "0.58756673", "0.5837338", "0.5823648", "0.5666622", "0.5562072", "0.5532227", "0.5503637", "0.5499935", "0.54080063", "0.5407551", "0.5404681", "0.5360531", "0.53344667", "0.53318334", "0.5281302", "0.52686495", "0.5259279", "0.52391034", "0.523417...
0.82024664
0
Takes an unsorted array of numbers, divides it in half, and keeps dividing it in half, until each array is one element. Merges and sorts these arrays, one by one, until the original fulllength array is sorted.
def merge(a, b) answer = [] until a.empty? || b.empty? if a[0] <= b[0] answer << a[0] a.shift else answer << b[0] b.shift end end if a.empty? b.each do |item| answer << item end end if b.empty? a.each do |item| ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_sort(array)\n return array if array.length <= 1\n\n first_half = array.take(array.length / 2)\n second_half = array.drop(first_half.length)\n\n merge( merge_sort(first_half), merge_sort(second_half) )\nend", "def merge_sort(array)\n return array if array.length == 1\n\n mid_index = array.length /...
[ "0.7936022", "0.789102", "0.7795039", "0.7785001", "0.77693284", "0.77200174", "0.77136683", "0.76884925", "0.7654818", "0.76524377", "0.76491696", "0.7633179", "0.7611429", "0.7598241", "0.7594511", "0.75743794", "0.7524428", "0.75054455", "0.744538", "0.73917425", "0.739172...
0.0
-1
Authenticate s2s streams by comparing their domain to their SSL certificate.
def external_auth(stanza) domain = Base64.decode64(stanza.text) cert = get_peer_cert ? OpenSSL::X509::Certificate.new(get_peer_cert) : nil if cert.nil? || !OpenSSL::SSL.verify_certificate_identity(cert, domain) send_auth_fail(SaslErrors::NotAuthorized.new) else @remot...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def external_auth(stanza)\n domain = Base64.decode64(stanza.text)\n cert = OpenSSL::X509::Certificate.new(stream.get_peer_cert) rescue nil\n if (!OpenSSL::SSL.verify_certificate_identity(cert, domain) rescue false)\n send_auth_fail(SaslErrors::NotAuthorized.new)\n s...
[ "0.61342895", "0.5402311", "0.5283922", "0.5273757", "0.5264448", "0.52583873", "0.5205737", "0.51635516", "0.5162857", "0.51497597", "0.5137273", "0.51021755", "0.50975674", "0.50813115", "0.5027133", "0.5020757", "0.49892202", "0.49887034", "0.4975993", "0.49473822", "0.493...
0.56953394
1
Authenticate c2s streams using a username and password. Call the authentication module in a separate thread to avoid blocking stanza processing for other users.
def plain_auth(stanza) jid, node, password = Base64.decode64(stanza.text).split("\000") jid = [node, @domain].join('@') if jid.nil? || jid.empty? op = proc do begin log.info("Authenticating user: %s" % jid) @storage.authenticate(jid, password) || SaslErrors::No...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth(password)\n begin\n if @stream_mechanisms.include? 'DIGEST-MD5'\n auth_sasl SASL.new(self, 'DIGEST-MD5'), password\n elsif @stream_mechanisms.include? 'PLAIN'\n auth_sasl SASL.new(self, 'PLAIN'), password\n else\n auth_nonsasl(password)\n end\n ...
[ "0.6881519", "0.6549165", "0.6525849", "0.63679993", "0.6342264", "0.6248436", "0.61692286", "0.6132236", "0.6065101", "0.6040262", "0.6038498", "0.6015139", "0.59925276", "0.597795", "0.59706676", "0.59656394", "0.5958919", "0.59423846", "0.594204", "0.5931132", "0.5912343",...
0.5559602
61
implements the sieve of Erastosthenes and returns the resulting primes in an array. This version doesn't bother sieving or checking the even numbers > 2
def primes_array(options = {}) limit = options[:limit] || ARRAY_DEFAULT_LIMIT field = Array.new(limit+1, true) # sieve the number field 3.step(field.size / 2, 2) do |k| (3 * k).step(field.size, 2 * k) do |n| field[n] = false end end # collect the field into an array, sta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def primes()\n return [] if @number < 2\n # build Boolean array to use for sieve with buffer to align indices\n sieve_array = Array.new(2, false) + Array.new(@number-1, true)\n # perform Sieve of Eratosthenes eliminations\n (2..Math.sqrt(@number).to_i).each do |i|\n (i**2..@number).step(i) {|...
[ "0.836698", "0.81067497", "0.8027843", "0.7990807", "0.7971302", "0.78773576", "0.7863403", "0.78615946", "0.7840438", "0.77753276", "0.77457017", "0.77457017", "0.77407074", "0.76845217", "0.76837397", "0.76167333", "0.7607624", "0.75948346", "0.7554536", "0.7548542", "0.753...
0.7128803
65