query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Constructing frag attributes hash that can be assigned to page or translation also returning list of frag identifiers so we can destroy old ones | def construct_fragments_attributes(hash, record, path)
frag_identifiers = []
frag_attributes = hash.collect do |frag_header, frag_content|
tag, identifier = frag_header.split
frag_hash = {
identifier: identifier,
tag: tag
}
# tracking fragments tha... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def passive\t\n\thash=Digest::MD5.hexdigest(@tagpattern)\n\t[{:name=>\"tag pattern hash\",:string=>hash}]\nend",
"def hash\n [anchor_allow_white_space_in_characters, anchor_allow_white_space_in_characters_metadata, anchor_case_sensitive, anchor_case_sensitive_metadata, anchor_horizontal_alignment, anchor_ho... | [
"0.56959295",
"0.5492727",
"0.5431907",
"0.54316825",
"0.52419615",
"0.5200731",
"0.51992965",
"0.51354253",
"0.5129367",
"0.5119489",
"0.51079667",
"0.5104444",
"0.5085642",
"0.5038109",
"0.5033512",
"0.5024392",
"0.5009743",
"0.50096923",
"0.4981868",
"0.49810797",
"0.49733... | 0.7121471 | 0 |
Preparing fragment attachments. Returns hashes with file data for ActiveStorage and a list of ids of old attachements to destroy | def files_content(record, identifier, path, frag_content)
# preparing attachments
files = frag_content.split("\n").collect do |filename|
file_handler = File.open(File.join(path, filename))
{
io: file_handler,
filename: filename,
content_type: MimeM... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def construct_fragments_attributes(hash, record, path)\n frag_identifiers = []\n frag_attributes = hash.collect do |frag_header, frag_content|\n tag, identifier = frag_header.split\n frag_hash = {\n identifier: identifier,\n tag: tag\n }\n\n # tracking... | [
"0.5711943",
"0.5473956",
"0.5419085",
"0.5418018",
"0.54128456",
"0.5406729",
"0.5288619",
"0.526177",
"0.5248263",
"0.5184201",
"0.51345015",
"0.5119709",
"0.50968635",
"0.50938916",
"0.5088327",
"0.5069423",
"0.50668746",
"0.5064317",
"0.50563747",
"0.50323266",
"0.502208"... | 0.60471237 | 0 |
callseq: shim[index] = value Sets the _value_ at the given _index_. The array shim applies it's offset to the _index_ before setting the _value_. | def []=( index, value )
@ary[index + @offset] = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def []=(index, value)\n set(index, value)\n end",
"def []=(index, value)\n end",
"def set(index, val)\n \n end",
"def []=(indx, value)\n elements[indx] = value\n end",
"def []=(index, value)\n %x{\n var size = #{self}.length;\n\n if (index < 0) {\n index += ... | [
"0.7118109",
"0.7027778",
"0.70017946",
"0.69859034",
"0.692407",
"0.692382",
"0.68966824",
"0.68679464",
"0.676832",
"0.6716316",
"0.65789926",
"0.65663934",
"0.65489966",
"0.6540345",
"0.6508133",
"0.64684135",
"0.6463302",
"0.6429215",
"0.6403789",
"0.63974446",
"0.6350883... | 0.71751994 | 0 |
Initialize the WindowsLiveLogin module with the application ID, secret key, and security algorithm. We recommend that you employ strong measures to protect the secret key. The secret key should never be exposed to the Web or other users. Be aware that if you do not supply these settings at initialization time, you may ... | def initialize(appid=nil, secret=nil, securityalgorithm=nil)
self.appid = appid if appid
self.secret = secret if secret
self.securityalgorithm = securityalgorithm if securityalgorithm
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(config_file=CONFIG_FILE)\n confs = YAML.load_file(config_file)['windows_live']\n @wll = WindowsLiveLogin.new(confs['appid'], confs['secret'], confs['security_algorithm'],\n nil, confs['policy_url'], confs['return_url'])\n end",
"def initialize(site_key... | [
"0.6391889",
"0.6072822",
"0.58830136",
"0.5791015",
"0.5763441",
"0.57166785",
"0.5680368",
"0.5667496",
"0.5651198",
"0.5635684",
"0.56341505",
"0.5616238",
"0.55980647",
"0.5581414",
"0.55349207",
"0.55346906",
"0.55217296",
"0.55135465",
"0.55135465",
"0.55086654",
"0.550... | 0.6196991 | 1 |
Processes the login response from Windows Live Login. 'query' contains the preprocessed POST table such as that returned by CGI.params or by Rails (the unprocessed POST string might also be used here but we do not recommend it). The method returns a User object on successful login; otherwise nil. | def processLogin(query)
query = parse query
unless query
debug("Error: processLogin: Failed to parse query.")
return
end
action = query['action']
unless action == 'login'
debug("Warning: processLogin: query action ignored: #{action}.")
return
end
token = query['stoken... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_login_response(email, password, response)\n @email = email\n @password = password\n @token = Parser.extract_user_token response\n @id = Parser.login_object_id response\n @xp = Parser.extract_xp response\n end",
"def mssql_parse_login( data )\n status = data.slice!(0,1).unpack('C')[... | [
"0.64101493",
"0.62186843",
"0.607636",
"0.6073617",
"0.58467793",
"0.5785018",
"0.57692057",
"0.5732156",
"0.5619241",
"0.5597066",
"0.5578833",
"0.5560396",
"0.5556798",
"0.5544963",
"0.5528954",
"0.55257267",
"0.54738307",
"0.5452557",
"0.5418772",
"0.5417434",
"0.5417233"... | 0.7210024 | 0 |
Returns the sign in URL to use for Windows Live Login. We recommend that you use the Sign In control instead. If you specify it, 'context' will be returned asis in the login response for sitespecific use. | def getLoginUrl(context=nil)
url = baseurl + "wlogin.srf?appid=#{appid}"
url += "&alg=#{securityalgorithm}"
url += "&appctx=#{CGI.escape(context)}" if context
url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_login_url\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => 'https://login.microsoftonline.com',\n :authorize_url => '/common/oauth2/v2.0/authorize',\n :token_ur... | [
"0.63973886",
"0.6394544",
"0.63663894",
"0.63637626",
"0.63618356",
"0.62533516",
"0.6235935",
"0.6221486",
"0.61892045",
"0.6148634",
"0.61156213",
"0.6032322",
"0.6030715",
"0.60246867",
"0.5973245",
"0.5967262",
"0.5954301",
"0.58876354",
"0.58760905",
"0.58620197",
"0.58... | 0.73321176 | 0 |
Decodes and validates a Web Authentication token. Returns a User object on success. If a context is passed in, it will be returned as the context field in the User object. | def processToken(token, context=nil)
if token.nil? or token.empty?
debug("Error: processToken: Null/empty token.")
return
end
stoken = decodeToken token
stoken = validateToken stoken
stoken = parse stoken
unless stoken
debug("Error: processToken: Failed to decode/validate token... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_user_from_auth_token\n @user = decode_auth_token ? User.find(decode_auth_token['user_id']) : nil\n errors.add(:token, 'invalid token') if @user.nil?\n @user\n end",
"def user\n @user ||= User.find(decoded_auth_token[:user_id]) if decoded_auth_token\n @user || errors.add(:token, 'Invalid... | [
"0.7168519",
"0.69986945",
"0.6748731",
"0.65587443",
"0.65553015",
"0.65211195",
"0.6463288",
"0.6443721",
"0.6402856",
"0.63865834",
"0.628275",
"0.6259999",
"0.62578785",
"0.6251611",
"0.62302315",
"0.6227669",
"0.6218266",
"0.6191184",
"0.6191184",
"0.6187849",
"0.6176318... | 0.719658 | 0 |
Decode the given token. Returns nil on failure. First, the string is URL unescaped and base64 decoded. Second, the IV is extracted from the first 16 bytes of the string. Finally, the string is decrypted by using the encryption key. | def decodeToken(token)
if (@cryptkey.nil? or @cryptkey.empty?)
fatal("Error: decodeToken: Secret key was not set. Aborting.")
end
token = u64(token)
if (token.nil? or (token.size <= 16) or !(token.size % 16).zero?)
debug("Error: decodeToken: Attempted to decode invalid token.")
return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode(token)\n key = \"IOUWHEIJHDLKJHPiuhpsdih98392hjhsad\"\n decipher = OpenSSL::Cipher::AES.new(128, :CBC)\n decipher.decrypt\n decipher.key = key\n decipher.iv = key\n plain = decipher.update(Base64.decode64(token)) + decipher.final\n plain.split(\"|\")\n end",
"def decode_token(tok... | [
"0.7597639",
"0.69577426",
"0.6544236",
"0.6514142",
"0.6473481",
"0.6400813",
"0.6393597",
"0.6346292",
"0.63426423",
"0.63349575",
"0.6285962",
"0.6247357",
"0.62250423",
"0.62195003",
"0.6212333",
"0.61973614",
"0.61848575",
"0.61698127",
"0.6156153",
"0.61307895",
"0.6111... | 0.7602891 | 0 |
Extracts the signature from the token and validates it. | def validateToken(token)
if (token.nil? or token.empty?)
debug("Error: validateToken: nil/empty token.")
return
end
body, sig = token.split("&sig=")
if (body.nil? or sig.nil?)
debug("Error: validateToken: Invalid token: #{token}")
return
end
sig = u64(sig)
return toke... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_signature\n return_code, response = send_command(\"verify_signature\", token)\n return_code == \"200\"\n end",
"def signature_valid?; end",
"def verify_signature(result); end",
"def valid_signature?(token)\n return false unless token =~ /&HMACSHA256=(.*)$/\n original_signatu... | [
"0.69256896",
"0.6737397",
"0.6732493",
"0.6550796",
"0.6527263",
"0.6522467",
"0.6494987",
"0.64163303",
"0.634485",
"0.63407254",
"0.6321816",
"0.6308899",
"0.6298884",
"0.6298884",
"0.6269522",
"0.62395346",
"0.62395346",
"0.6208952",
"0.6175401",
"0.61685306",
"0.61681896... | 0.772585 | 0 |
Returns the trusted login token in the format that is needed by a control doing trusted login. User to be trusted on the local site is passed in as string 'user'. | def getTrustedToken(user)
if user.nil? or user.empty?
debug('Error: getTrustedToken: Null user specified.')
return
end
token = "appid=#{appid}&uid=#{CGI.escape(user)}&ts=#{timestamp}"
token += "&sig=#{e64(signToken(token))}"
CGI.escape token
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login_token(expire, target_user=nil)\n target_user ||= @options[:srv_user]\n token_txt = \"#{@options[:srv_user]}:#{target_user}:#{expire}\"\n\n token = encrypt(token_txt)\n token64 = Base64::encode64(token).strip.delete(\"\\n\")\n\n return \"#{@options[:srv_user]}:#{ta... | [
"0.67274153",
"0.6524272",
"0.63731164",
"0.628952",
"0.60528266",
"0.60426486",
"0.5943037",
"0.5787221",
"0.5784507",
"0.57456094",
"0.57272243",
"0.57187355",
"0.57174355",
"0.5717183",
"0.57077575",
"0.5648105",
"0.5551832",
"0.5548856",
"0.5535382",
"0.55308986",
"0.5523... | 0.787101 | 0 |
Returns the trusted signin URL to use for Windows Live Login. | def getTrustedLoginUrl
secureurl + "wlogin.srf"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_login_url\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => 'https://login.microsoftonline.com',\n :authorize_url => '/common/oauth2/v2.0/authorize',\n :token_ur... | [
"0.6110511",
"0.60972184",
"0.60664225",
"0.6062476",
"0.6018684",
"0.5890429",
"0.5876816",
"0.5866468",
"0.586374",
"0.5830568",
"0.5816381",
"0.5771454",
"0.5747807",
"0.57270265",
"0.56978095",
"0.5675226",
"0.5674305",
"0.5594671",
"0.5590295",
"0.55298615",
"0.5516508",... | 0.75443554 | 0 |
Returns the trusted signout URL to use for Windows Live Login. | def getTrustedLogoutUrl
secureurl + "logout.srf?appid=#{appid}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTrustedLoginUrl\n secureurl + \"wlogin.srf\"\n end",
"def auth0_logout_url\n # auth0_client.logout_url(root_url.to_s, include_client: true).to_s\n auth0_client.logout_url(root_url.to_s).to_s\n end",
"def logout_url\n return @logout_url\n end",
"def default_redirect... | [
"0.65467715",
"0.6066032",
"0.60452795",
"0.602472",
"0.5952062",
"0.5891592",
"0.5863794",
"0.5802973",
"0.57728964",
"0.5756296",
"0.5729752",
"0.5729752",
"0.5684871",
"0.5657452",
"0.5641936",
"0.5622903",
"0.55558",
"0.5530776",
"0.55238944",
"0.55150867",
"0.54941493",
... | 0.7174158 | 0 |
Derive the key, given the secret key and prefix as described in the SDK documentation. | def derive(secret, prefix)
begin
fatal("Nil/empty secret.") if (secret.nil? or secret.empty?)
key = prefix + secret
key = OpenSSL::Digest::SHA256.digest(key)
return key[0..15]
rescue Exception => e
debug("Error: derive: #{e}")
return
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_secret_key\n r = Aws::Kms.new('saas', 'saas').decrypt(@client.api_salt)\n return r unless r.success?\n\n api_salt_d = r.data[:plaintext]\n\n client_api_secret_d = SecureRandom.hex\n\n r = LocalCipher.new(api_salt_d).encrypt(client_api_secret_d)\n return r unle... | [
"0.64601755",
"0.62765664",
"0.62494075",
"0.6161934",
"0.6121936",
"0.6121936",
"0.6108348",
"0.6108348",
"0.6108348",
"0.6108348",
"0.60910314",
"0.6086225",
"0.6085",
"0.60610837",
"0.605582",
"0.605582",
"0.604447",
"0.6031439",
"0.6028146",
"0.6016201",
"0.5999857",
"0... | 0.767483 | 0 |
grab likes from yesterday | def todays_likes
dayEnd = DateTime.now.beginning_of_day
dayStart = dayEnd - 1.day
likes.where("likes.created_at > ? and likes.created_at < ?", dayStart, dayEnd)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def previous_tweets\n model.previous_tweets.sort_by(&:created_at)\n end",
"def followers_history; counter_per_day(:followers); end",
"def receive_likers\n media = instagram_service.media_by_shortcode(event.url)\n media_id = media['data']['id']\n likes = instagram_service.media_likes(me... | [
"0.60466987",
"0.5933825",
"0.59185225",
"0.5778807",
"0.5764836",
"0.5762797",
"0.57621896",
"0.57602346",
"0.5725603",
"0.5697936",
"0.56364685",
"0.55990434",
"0.55655414",
"0.55576384",
"0.55509365",
"0.5548458",
"0.55339324",
"0.5515068",
"0.5505095",
"0.5504594",
"0.550... | 0.70552945 | 0 |
gets the next video in the order. accepts an id. | def next_video(current_id)
@video_ids = airings.map {|a| a.video_id }
@current_index = @video_ids.index current_id.to_i
if @current_index
next_index = (@current_index + 1) % self.videos.count
Video.find(@video_ids[next_index])
else
# give the next video or the first if current_index no... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next\n\t\tself.class.where(\"id > ?\", id).first\n\tend",
"def next\n \tself.class.where(\"id > ?\", id).first\n \tend",
"def next\n room.players.where(\"id > ?\", id).first || room.players.first\n end",
"def next_video\n if episode?\n episode = content.next_ep\n unless episode.nil?\... | [
"0.69828856",
"0.69269556",
"0.6831194",
"0.6784713",
"0.6774003",
"0.66639847",
"0.6660575",
"0.65003794",
"0.6432579",
"0.63965386",
"0.6365845",
"0.62642115",
"0.622143",
"0.62100786",
"0.62015307",
"0.6150377",
"0.6130871",
"0.6088212",
"0.6073662",
"0.5991493",
"0.596576... | 0.803972 | 0 |
All the shows where the contact is the promoter. | def promoter_shows
Show.where(promoter_id: id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @promoters = Promoter.find(:all).sort_by{|p| p.name_or_contact_info}\n end",
"def show\r\n # @provider_masters = ProvierMaster.all\r\n end",
"def show\n @pdestaf = Mercadorium.where fabricante: @fabrica.name\n\n end",
"def show\n @presenters = Presenter.all\n @meetings = Meeting.al... | [
"0.63855946",
"0.62670064",
"0.59467316",
"0.5840493",
"0.58328736",
"0.58328736",
"0.57074666",
"0.5696384",
"0.56671005",
"0.5632648",
"0.56320554",
"0.5624344",
"0.5603016",
"0.5592168",
"0.55871433",
"0.55705273",
"0.5558642",
"0.5556958",
"0.5537548",
"0.5531207",
"0.552... | 0.7458325 | 0 |
Connect a venue to the contact. | def connect(venue)
ContactVenueRelationship.create(contact_id: id,
venue_id: venue.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_venue\n @venue = Venue.find(params[:id])\n end",
"def set_venue\n @venue = Venue.find(params[:id])\n end",
"def set_venue\n @venue = Venue.find(params[:id])\n end",
"def set_venue\n @venue = Venue.find(params[:id])\n end",
"def set_venue\n @venue = Venue.find(pa... | [
"0.60933495",
"0.60933495",
"0.60933495",
"0.60933495",
"0.60933495",
"0.60421574",
"0.6031163",
"0.6031163",
"0.59471613",
"0.59471613",
"0.59378403",
"0.59378403",
"0.59378403",
"0.59378403",
"0.58844155",
"0.58124757",
"0.58124757",
"0.5761003",
"0.5761003",
"0.56730825",
... | 0.8409064 | 0 |
Unconnects the contact and a venue. | def unconnect
relationship = ContactVenueRelationship.find_by(contact_id: id,
venue_id: venue.id)
relationship.destroy
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unfollow(user, contact)\n destroy(conn(user, contact))\n other_connection = conn(contact, user)\n if !other_connection.nil?\n if other_connection.status == ACCEPTED\n other_connection.status = PENDING\n other_connection.save\n elsif other_connection.st... | [
"0.6354718",
"0.6132487",
"0.5783989",
"0.57795966",
"0.5773787",
"0.5703839",
"0.5615233",
"0.55814004",
"0.5576573",
"0.55573374",
"0.55552423",
"0.5515391",
"0.5503913",
"0.5503913",
"0.54789364",
"0.5447988",
"0.5444858",
"0.5421188",
"0.54152054",
"0.5400742",
"0.5400669... | 0.8274814 | 0 |
The venues that are not connected to the contact. | def unconnected_venues
unconnected = []
Venue.all.each do |venue|
unconnected << venue if venues.exclude? venue
end
return unconnected
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_nearby_venues\n Venue.where([\"neighbourhood_id = ? and id <> ?\", self.neighbourhood_id, self.id])\n end",
"def is_not_at_facility\n Venue.all - self.venues\n end",
"def blockable_venues\n venues = Venue.joins(\"JOIN centers_venues ON venues.id = centers_venues.venue_id\").where('center... | [
"0.7064674",
"0.6641354",
"0.619172",
"0.5953587",
"0.59016824",
"0.58992624",
"0.58362865",
"0.5779905",
"0.57712513",
"0.5760179",
"0.56878024",
"0.56847376",
"0.56773937",
"0.5638697",
"0.56229407",
"0.55814725",
"0.5548656",
"0.5518197",
"0.55110043",
"0.5488991",
"0.5486... | 0.78305715 | 0 |
Initialize the EC2 Client object | def initialize(aws_region:)
@ec2_client ||= Aws::EC2::Client.new(region: aws_region)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(config)\n @aws_ec2 = AWS::EC2.new(config)\n end",
"def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, params={})\n init({ :name => 'EC2',\n :default_host => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).host : DEFAULT_HOST,\n ... | [
"0.74037623",
"0.7393521",
"0.7350949",
"0.7343247",
"0.73235685",
"0.7240159",
"0.7196345",
"0.7194741",
"0.71862525",
"0.7168115",
"0.71036536",
"0.6996494",
"0.69579196",
"0.6937662",
"0.6897118",
"0.6885941",
"0.6849786",
"0.6848727",
"0.68415356",
"0.67978597",
"0.676124... | 0.77925855 | 0 |
fixed argument lists are represented as :array nodes, e.g. [:array, [argnode1, argnode2, ...]] | def process_args(args_node)
return [] unless args_node
if args_node.first == :array
args_node.last.map { |node| to_sexp(node) }
else
raise "variable arguments not allowed"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aryfy(arg)\n ast AST::ASTArray, :children => [arg]\n end",
"def convert_args_node(node)\n if node.kind_of?(String) || node.kind_of?(Symbol) || node.kind_of?(Numeric) || \n node.kind_of?(TrueClass) || node.kind_of?(FalseClass) || node.kind_of?(NilClass)\n node\n elsif node.instance_of?(Ar... | [
"0.7347744",
"0.6768978",
"0.64906603",
"0.63761955",
"0.6326545",
"0.6276517",
"0.61711496",
"0.60801065",
"0.6058233",
"0.6034769",
"0.60234267",
"0.60181403",
"0.6016173",
"0.6003154",
"0.5987587",
"0.5978011",
"0.59675026",
"0.59292954",
"0.5909316",
"0.5908178",
"0.57782... | 0.6949441 | 1 |
Internal: Receives a collection of inputs and interpolates the values to fit the end year of the new scenario. For example, if the start year is 2020 and the source scenario is 2050, and an input starts and 0 and the source value is 100, and the new scenario is based in 2030, the input value will be 50. Returns the int... | def interpolate_input_collection(collection)
num_years = @scenario.end_year - @year
total_years = @scenario.end_year - @scenario.start_year
collection.each_with_object(collection.class.new) do |(key, value), interp|
if (input = Input.get(key))
interp[key] = interpolate_input(input, value, tot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interpolate_input(input, value, total_years, num_years)\n return value if input.enum?\n\n start = input.start_value_for(@scenario)\n change_per_year = (value - start) / total_years\n\n start + change_per_year * (total_years - num_years)\n end",
"def interpolate(frequency, operation)\n # puts \... | [
"0.7225483",
"0.5076649",
"0.5070885",
"0.50320387",
"0.49417526",
"0.49219903",
"0.48959297",
"0.4779482",
"0.4729065",
"0.4681909",
"0.46788168",
"0.46556127",
"0.46552408",
"0.46462598",
"0.46358004",
"0.4625349",
"0.46188203",
"0.45875785",
"0.45875785",
"0.45736602",
"0.... | 0.70665866 | 1 |
Internal: Calculates the interpolated value of an input based on its current value in the original scenario. Returns a Numeric or String value for the new user values. | def interpolate_input(input, value, total_years, num_years)
return value if input.enum?
start = input.start_value_for(@scenario)
change_per_year = (value - start) / total_years
start + change_per_year * (total_years - num_years)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value_of element\n element = super # eval Procs\n case element\n when Numeric then @value.transpose(element) if @value # add interval\n when PitchClass then @value.nearest(element) if @value\n else element\n end\n end",
"def convert_value_by_type\n case... | [
"0.5457691",
"0.5402587",
"0.5399055",
"0.5345718",
"0.5322939",
"0.5307462",
"0.52730906",
"0.5248776",
"0.52367425",
"0.5236653",
"0.52281356",
"0.5223321",
"0.521307",
"0.51618254",
"0.51554567",
"0.5151672",
"0.51174605",
"0.50771004",
"0.5070582",
"0.50676274",
"0.503541... | 0.7015107 | 0 |
and a result which is also an array that is empty at first. The all_perms method is a recursive method. We make a list of the elements that are not present in the result. We add the first element from this to the result. All the permutations of the prefix in the result with the remaining elements are printed. The added... | def perms(arr)
result = []
all_perms(arr, 0, result)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permutations(base, result = [])\n base = base.dup\n base.empty? ? [result] : base.shift.map { |value| permutations(base, result + [value]) }.flatten(1)\n end",
"def permutations(arr)\n # return nil if arr.empty?\n return [arr] if arr.length == 1\n # grab first element to app... | [
"0.67402077",
"0.67389166",
"0.67088866",
"0.6592986",
"0.6546746",
"0.6484407",
"0.64838177",
"0.6465498",
"0.64506906",
"0.6434295",
"0.641186",
"0.6406546",
"0.6396502",
"0.63918483",
"0.639125",
"0.6358306",
"0.63490385",
"0.63415337",
"0.63324124",
"0.6324909",
"0.628236... | 0.728698 | 0 |
GET /image_position_templates GET /image_position_templates.json | def index
@image_position_templates = ImagePositionTemplate.ordered
respond_to do |format|
format.html # index.html.erb
format.json { render json: @image_position_templates }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @image_position_template = ImagePositionTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_position_template }\n end\n end",
"def new\n @image_position_template = ImagePositionTemplate.new\n\n respond_to do ... | [
"0.68678117",
"0.63442534",
"0.6235765",
"0.61869854",
"0.6064893",
"0.5938527",
"0.5885065",
"0.5804216",
"0.56918854",
"0.562584",
"0.5612658",
"0.55722386",
"0.5570342",
"0.55579114",
"0.55075425",
"0.55052894",
"0.5487735",
"0.5479869",
"0.5471034",
"0.5466857",
"0.543403... | 0.738866 | 0 |
GET /image_position_templates/1 GET /image_position_templates/1.json | def show
@image_position_template = ImagePositionTemplate.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @image_position_template }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @image_position_templates = ImagePositionTemplate.ordered\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @image_position_templates }\n end\n end",
"def new\n @image_position_template = ImagePositionTemplate.new\n\n respond_to do |forma... | [
"0.73890805",
"0.68279374",
"0.6288571",
"0.62319326",
"0.6127538",
"0.60175127",
"0.59898174",
"0.5963749",
"0.5944063",
"0.58987486",
"0.581372",
"0.5775024",
"0.5762081",
"0.57003486",
"0.56834006",
"0.5639023",
"0.563465",
"0.5609671",
"0.55893975",
"0.5556625",
"0.554252... | 0.7391674 | 0 |
GET /image_position_templates/new GET /image_position_templates/new.json | def new
@image_position_template = ImagePositionTemplate.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @image_position_template }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @image_position_template = ImagePositionTemplate.new(params[:image_position_template])\n\n respond_to do |format|\n if @image_position_template.save\n format.html { redirect_to @image_position_template, notice: 'Image position template was successfully created.' }\n format.jso... | [
"0.74638766",
"0.69190323",
"0.68910676",
"0.66938114",
"0.6672162",
"0.66231436",
"0.6608281",
"0.6594944",
"0.65694916",
"0.65694916",
"0.65694916",
"0.64584553",
"0.6456591",
"0.641446",
"0.6414122",
"0.63989407",
"0.6364294",
"0.63399637",
"0.6293575",
"0.62831295",
"0.62... | 0.81139064 | 0 |
POST /image_position_templates POST /image_position_templates.json | def create
@image_position_template = ImagePositionTemplate.new(params[:image_position_template])
respond_to do |format|
if @image_position_template.save
format.html { redirect_to @image_position_template, notice: 'Image position template was successfully created.' }
format.json { render ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @position = Position.new(position_params)\n respond_to do |format|\n if @position.save\n @position.create_images(params[:images]) if params[:images]\n format.html { redirect_to @position, notice: 'Position was successfully created.' }\n format.json { render :show, statu... | [
"0.63672435",
"0.6351562",
"0.6257164",
"0.61694825",
"0.6147034",
"0.57744765",
"0.5747771",
"0.56924856",
"0.5689383",
"0.56399775",
"0.5632281",
"0.5597104",
"0.55703723",
"0.55645263",
"0.54897726",
"0.54753214",
"0.54661465",
"0.54628426",
"0.5450453",
"0.54218036",
"0.5... | 0.7288086 | 0 |
PUT /image_position_templates/1 PUT /image_position_templates/1.json | def update
@image_position_template = ImagePositionTemplate.find(params[:id])
respond_to do |format|
if @image_position_template.update_attributes(params[:image_position_template])
format.html { redirect_to @image_position_template, notice: 'Image position template was successfully updated.' }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_template_with_image_id(template)\n params = template.parameters\n params.each do |key, value|\n update_params_with_image_id(params, key, value)\n end\n end",
"def create\n @image_position_template = ImagePositionTemplate.new(params[:image_position_templa... | [
"0.6828326",
"0.6690431",
"0.6384763",
"0.63631153",
"0.6201784",
"0.615003",
"0.6104498",
"0.608083",
"0.6065748",
"0.59648013",
"0.5955816",
"0.5943629",
"0.5906332",
"0.5838658",
"0.580589",
"0.5748051",
"0.57070994",
"0.5676574",
"0.5656723",
"0.56497896",
"0.5598645",
... | 0.70944154 | 0 |
DELETE /image_position_templates/1 DELETE /image_position_templates/1.json | def destroy
@image_position_template = ImagePositionTemplate.find(params[:id])
@image_position_template.destroy
respond_to do |format|
format.html { redirect_to image_position_templates_url }
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 destroy\n @item_template.destroy\n respond_to do |format|\n format.html { redirect_to item_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @template.destroy\n respond_to do |... | [
"0.74777067",
"0.6999338",
"0.692979",
"0.6883951",
"0.6875389",
"0.6872521",
"0.6865867",
"0.68420476",
"0.68387175",
"0.68291",
"0.6822052",
"0.6822051",
"0.68148935",
"0.681022",
"0.679123",
"0.67889833",
"0.6770979",
"0.67598546",
"0.675668",
"0.6750477",
"0.6746375",
"... | 0.79537046 | 0 |
Check to see if the virtual machine is in execute mode. | def execute_mode?
@context[:mode] == :execute
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute?(cmd)\n execution_result = execute(cmd)\n !execution_result.nil? && execution_result\n end",
"def executable?\n @executable || (@executable.nil? && !garbage? && plan && plan.executable?)\n end",
"def exec?(cmd, options={})\n exit_status, stdout, stderr, cmd = exec(cm... | [
"0.68815583",
"0.6647718",
"0.66271204",
"0.65706",
"0.6523622",
"0.6426441",
"0.6400111",
"0.6391803",
"0.6379353",
"0.6357611",
"0.6354427",
"0.63116443",
"0.6283339",
"0.62677944",
"0.6232029",
"0.61867726",
"0.61867726",
"0.6167567",
"0.61664593",
"0.612819",
"0.6090543",... | 0.74717116 | 0 |
test_request comes mostly from the guts of route! in Sinatra::Base | def test_request(method, path, params={})
@params = indifferent_params(params)
@request = Sinatra::Request.new(env)
@request.path_info = path # sinatra 1.3.3
@__protected_ivars = instance_variables + ["@__protected_ivars"]
# routes are stored by uppercase method, but I wanted the test i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call(request)\n test request\n end",
"def setup\n @requester = Rack::MockRequest.new(SampleApp)\n end",
"def test_request\n get \"/example/route\"\n assert last_response.ok?\n body = last_response.body\n assert body[\"Hello\"]\n end",
"def test_request\n if defined?(Action... | [
"0.72975296",
"0.7008018",
"0.6993671",
"0.6619649",
"0.6544158",
"0.6453145",
"0.64409834",
"0.6398676",
"0.63839465",
"0.62799424",
"0.6253341",
"0.6247639",
"0.6230568",
"0.62281245",
"0.6222703",
"0.6220136",
"0.6187071",
"0.61861247",
"0.617266",
"0.617266",
"0.617266",
... | 0.7403231 | 0 |
gets called from the form to enqueue a new job | def create
arg = params[:email]
counter = Job.enqueue(arg)
render :status => :accepted, :json => { jobId: counter }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def queue_job; end",
"def enqueue\n # We need to save before passing to perform_later b/c perform_later will need our ID.\n # For this reason, the job_id col can't have a null constraint.\n save! unless persisted?\n job = job_class.constantize.perform_later(self, **job_params)\n update!(job_id: jo... | [
"0.70713866",
"0.70490044",
"0.70153135",
"0.70076525",
"0.6959974",
"0.69463587",
"0.69284946",
"0.6899085",
"0.68229795",
"0.6789745",
"0.6780809",
"0.6766544",
"0.67414296",
"0.6725607",
"0.66737664",
"0.6652128",
"0.66479874",
"0.6635255",
"0.66175157",
"0.66040653",
"0.6... | 0.70989615 | 0 |
Returns the body as String. | def to_s
@body.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n body.to_s\n end",
"def to_s\n @body\n end",
"def to_s\n body\n end",
"def to_s\n @body\n end",
"def to_s\n @body\n end",
"def body\n if @parsed_body\n parsed_body.to_s\n else\n @body\n end\n end",
"def to_s\n body\n end",
"def... | [
"0.8695328",
"0.85691285",
"0.8489503",
"0.84837383",
"0.84837383",
"0.82008815",
"0.81878483",
"0.8039237",
"0.77034086",
"0.76867884",
"0.76867884",
"0.76867884",
"0.76867884",
"0.76742005",
"0.7669744",
"0.76410764",
"0.7593768",
"0.75935155",
"0.7587039",
"0.75865614",
"0... | 0.8647939 | 1 |
Detect and geocode any location information present in the report text | def detect_location
if self.text
LOCATION_PATTERNS.find { |p| self.text[p] }
self.location = Location.geocode($1) if $1
self.zip = location.postal_code if !self.zip && (self.location && location.postal_code)
end
if !self.location && self.zip
self.location = Location.geocode(self.zip)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_location(str)\n u=URI.encode(\"http://maps.google.com/maps/api/geocode/xml?sensor=false&address=#{str}\")\n loc=(Hpricot.XML(open(u)))/'//location'\n h={} \n h['lat']=(loc/:lat).inner_text\n h['lng']=(loc/:lng).inner_text\n h\n end",
"def test_location_detection\n # Google geocoder ... | [
"0.64249235",
"0.636456",
"0.6233864",
"0.6180585",
"0.6166833",
"0.61370474",
"0.59910446",
"0.596455",
"0.59637463",
"0.5858849",
"0.57827604",
"0.577601",
"0.571293",
"0.57094467",
"0.56417775",
"0.5622916",
"0.55897534",
"0.5581972",
"0.55818427",
"0.557348",
"0.5544919",... | 0.7488999 | 1 |
append tag_string to report text if supplied (iphone, android) | def append_tags
self.text += (" "+self.tag_string) if !self.tag_string.blank?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def see_tag(text); end",
"def add_string(_tag, _val)\n raise NotImplementedError\n end",
"def note_tag(text); end",
"def tag(string); end",
"def abstract_tag(text); end",
"def tag_text=(value)\n self.tag=(value)\n end",
"def api_tag(text); end",
"def return_tag(text); end",
"def append_... | [
"0.6162789",
"0.59935844",
"0.5926792",
"0.5882301",
"0.583451",
"0.57093275",
"0.56849265",
"0.56290036",
"0.5609136",
"0.5569981",
"0.5550646",
"0.55478644",
"0.5528541",
"0.55203676",
"0.55201995",
"0.5513261",
"0.5477375",
"0.5472482",
"0.54571325",
"0.54562527",
"0.54432... | 0.669592 | 1 |
Create an integration for the specified app. | def create_integration(app_id, integration_create_body, opts = {})
data, _status_code, _headers = create_integration_with_http_info(app_id, integration_create_body, opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_integration_with_http_info(app_id, integration_create_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: IntegrationApi.create_integration ...\"\n end\n # verify the required parameter 'app_id' is set\n if @api_client.config.cli... | [
"0.6851142",
"0.6613742",
"0.6320141",
"0.6286776",
"0.6243598",
"0.61107016",
"0.6092274",
"0.60061455",
"0.59643096",
"0.5952713",
"0.5895749",
"0.5852185",
"0.57128704",
"0.5695547",
"0.5677204",
"0.56629384",
"0.56376237",
"0.5623359",
"0.56065327",
"0.56010187",
"0.55648... | 0.7144803 | 0 |
Create an integration for the specified app. | def create_integration_with_http_info(app_id, integration_create_body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: IntegrationApi.create_integration ..."
end
# verify the required parameter 'app_id' is set
if @api_client.config.client_side_val... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_integration(app_id, integration_create_body, opts = {})\n data, _status_code, _headers = create_integration_with_http_info(app_id, integration_create_body, opts)\n return data\n end",
"def create_for_app(app_auth_request = nil)\n build_request(app_auth_request || { api_key: @api_ke... | [
"0.7144803",
"0.6613742",
"0.6320141",
"0.6286776",
"0.6243598",
"0.61107016",
"0.6092274",
"0.60061455",
"0.59643096",
"0.5952713",
"0.5895749",
"0.5852185",
"0.57128704",
"0.5695547",
"0.5677204",
"0.56629384",
"0.56376237",
"0.5623359",
"0.56065327",
"0.56010187",
"0.55648... | 0.6851142 | 1 |
Get the specified integration. | def get_integration(app_id, integration_id, opts = {})
data, _status_code, _headers = get_integration_with_http_info(app_id, integration_id, opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def integration\n @integration\n end",
"def set_integration\n @integration = Integration.find(params[:id])\n end",
"def set_integration\n @integration = Integration.find(params[:id])\n end",
"def integration_name; end",
"def integration_path(integration)\n \"spec/integration/#{... | [
"0.72498006",
"0.615705",
"0.615705",
"0.6006859",
"0.5965343",
"0.59372413",
"0.57735324",
"0.5680734",
"0.5329793",
"0.529376",
"0.529376",
"0.529376",
"0.5270806",
"0.52328277",
"0.5192563",
"0.51766986",
"0.5165119",
"0.5150433",
"0.51286215",
"0.5099464",
"0.5062347",
... | 0.67320865 | 1 |
List integrations for the specified app. | def list_integrations(app_id, opts = {})
data, _status_code, _headers = list_integrations_with_http_info(app_id, opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_integrations_with_http_info(app_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: IntegrationApi.list_integrations ...\"\n end\n # verify the required parameter 'app_id' is set\n if @api_client.config.client_side_validation && app_... | [
"0.69517565",
"0.66954434",
"0.6122563",
"0.6005462",
"0.5984",
"0.59315574",
"0.588744",
"0.587151",
"0.5828431",
"0.58080006",
"0.5699765",
"0.56705964",
"0.56573564",
"0.5644541",
"0.5643877",
"0.5595212",
"0.55887514",
"0.55709916",
"0.5567373",
"0.55255437",
"0.5505226",... | 0.7768685 | 0 |
List integrations for the specified app. | def list_integrations_with_http_info(app_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: IntegrationApi.list_integrations ..."
end
# verify the required parameter 'app_id' is set
if @api_client.config.client_side_validation && app_id.nil?
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_integrations(app_id, opts = {})\n data, _status_code, _headers = list_integrations_with_http_info(app_id, opts)\n return data\n end",
"def index\n @cargapp_integrations = CargappIntegration.all\n end",
"def gcp_integration_list\n request(Net::HTTP::Get, \"/api/#{API_VERSION}/in... | [
"0.7768685",
"0.66954434",
"0.6122563",
"0.6005462",
"0.5984",
"0.59315574",
"0.588744",
"0.587151",
"0.5828431",
"0.58080006",
"0.5699765",
"0.56705964",
"0.56573564",
"0.5644541",
"0.5643877",
"0.5595212",
"0.55887514",
"0.55709916",
"0.5567373",
"0.55255437",
"0.5505226",
... | 0.69517565 | 1 |
Get History Returns the transaction history for an address or addresses. | def get_history(coin_type, addresses, opts = {})
data, _status_code, _headers = get_history_with_http_info(coin_type, addresses, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_history\n get('account/history')\n end",
"def history(source = nil)\n params = {\n source: source\n }.compact\n\n _get(\"/account/history\", params) { |json| json }\n end",
"def history\n return @history\n end",
"def history\n ... | [
"0.6927592",
"0.6697385",
"0.66865224",
"0.66865224",
"0.66652024",
"0.6635105",
"0.662819",
"0.6581782",
"0.65809345",
"0.65712684",
"0.6365599",
"0.6362947",
"0.6352777",
"0.634292",
"0.633991",
"0.62977517",
"0.62903494",
"0.62755895",
"0.62742704",
"0.6235512",
"0.6234274... | 0.746888 | 0 |
Returns USVolume object with size equal to the number in cups. | def cups
Measurements::USVolume.new(self, :cup)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def volume_size\n # If not user-specified, I'm using a fudge factor of 1.5 on the volume size -- arbitrarily chosen\n @volume_size || (`du -x #{volume_to_bundle}`.split(/\\n/)[-1].split[0].to_f * 1.5 / 1024).ceil\n end",
"def size\n sku.size * amount\n end",
"def piece_count=(v)\n return if v.nil... | [
"0.59053004",
"0.5895638",
"0.53773814",
"0.5276277",
"0.5270556",
"0.5211324",
"0.515371",
"0.5089328",
"0.5083918",
"0.5066057",
"0.5033164",
"0.50311327",
"0.49864823",
"0.49481007",
"0.4923944",
"0.4914555",
"0.4902628",
"0.48771346",
"0.48523316",
"0.48504195",
"0.483769... | 0.6999369 | 0 |
Returns USVolume object with size equal to the number in pints. | def pints
Measurements::USVolume.new(self, :pint)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def volume_size\n # If not user-specified, I'm using a fudge factor of 1.5 on the volume size -- arbitrarily chosen\n @volume_size || (`du -x #{volume_to_bundle}`.split(/\\n/)[-1].split[0].to_f * 1.5 / 1024).ceil\n end",
"def size(num)\n params(size: num)\n end",
"def bid_volume\n @bi... | [
"0.54818875",
"0.52362853",
"0.51518744",
"0.50460017",
"0.49586555",
"0.4953716",
"0.49293515",
"0.49263522",
"0.49217504",
"0.49129778",
"0.49011004",
"0.48987666",
"0.48982686",
"0.48757625",
"0.48498526",
"0.48389614",
"0.4837991",
"0.4832898",
"0.4831524",
"0.48302537",
... | 0.591707 | 0 |
Returns USVolume object with size equal to the number in quarts. | def quarts
Measurements::USVolume.new(self, :quart)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def volume_size\n # If not user-specified, I'm using a fudge factor of 1.5 on the volume size -- arbitrarily chosen\n @volume_size || (`du -x #{volume_to_bundle}`.split(/\\n/)[-1].split[0].to_f * 1.5 / 1024).ceil\n end",
"def size\n sku.size * amount\n end",
"def get_volume_of_cuboid(length, width, ... | [
"0.58693725",
"0.57066494",
"0.55376124",
"0.5508433",
"0.54773945",
"0.5356651",
"0.5325346",
"0.5288244",
"0.52838975",
"0.52795494",
"0.52773076",
"0.526648",
"0.52329814",
"0.51955104",
"0.51882565",
"0.51796865",
"0.5142378",
"0.511737",
"0.50706977",
"0.5068005",
"0.504... | 0.6697649 | 0 |
Returns USVolume object with size equal to the number in gallons. | def gallons
Measurements::USVolume.new(self, :gallon)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preboil_volume_gallons\n boil_off_gallons + @batch_size_gallons\n end",
"def volume_size\n # If not user-specified, I'm using a fudge factor of 1.5 on the volume size -- arbitrarily chosen\n @volume_size || (`du -x #{volume_to_bundle}`.split(/\\n/)[-1].split[0].to_f * 1.5 / 1024).ceil\n end",
... | [
"0.54164016",
"0.54120004",
"0.54046893",
"0.51552993",
"0.5092678",
"0.5036013",
"0.5012161",
"0.5001489",
"0.49648178",
"0.49374592",
"0.49356452",
"0.49311453",
"0.49130836",
"0.4911076",
"0.4909478",
"0.49091643",
"0.4909143",
"0.49090102",
"0.48976865",
"0.48694587",
"0.... | 0.6488842 | 0 |
Purchase the article, and redirect to it | def purchase
load_and_verify_payment_method(params)
redirect_to new_article_order_path(@article, payment_method_params) and return unless @payment_method
@order = current_user.orders.create :article=>@article
@transaction = Samurai::Processor.the_processor.purchase(
@payment_method.token,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def purchase\r\n redirect_to \"http://www.1shoppingcart.com/app/javanof.asp?MerchantID=31593&ProductID=3257357\"\r\n end",
"def link_form\n @purchase = Purchase.find_by_id params[:id]\n if !@purchase\n redirect_to '/admin/purchases'\n return\n end\n end",
"def publish\n\t\t@article.publ... | [
"0.7462033",
"0.6610919",
"0.6511793",
"0.6447817",
"0.6308654",
"0.6249633",
"0.6147074",
"0.6108893",
"0.6039982",
"0.59578794",
"0.5948272",
"0.59429306",
"0.5930706",
"0.5916562",
"0.5914955",
"0.59072477",
"0.5904656",
"0.5895368",
"0.5848823",
"0.5847925",
"0.584238",
... | 0.7350066 | 1 |
GET /billing_infos/1 GET /billing_infos/1.json | def show
@billing_info = BillingInfo.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @billing_info }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @billing_infos = BillingInfo.all\n end",
"def index\n @billing_infos = BillingInfo.all\n end",
"def billing\n request('billing', :get)\n end",
"def new\n @billing_info = BillingInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render ... | [
"0.75080043",
"0.75080043",
"0.74623305",
"0.7396445",
"0.72180706",
"0.68948686",
"0.6824466",
"0.6790777",
"0.6790777",
"0.6718435",
"0.67106795",
"0.6700457",
"0.66852",
"0.6640941",
"0.66219884",
"0.65196025",
"0.65196025",
"0.6509366",
"0.6470568",
"0.6448489",
"0.644394... | 0.81548774 | 0 |
GET /billing_infos/new GET /billing_infos/new.json | def new
@billing_info = BillingInfo.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @billing_info }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @billing_info = BillingInfo.new(params[:billing_info])\n\n respond_to do |format|\n if @billing_info.save\n format.html { redirect_to @billing_info, notice: 'Billing info was successfully created.' }\n format.json { render json: @billing_info, status: :created, location: @bill... | [
"0.7669924",
"0.75603896",
"0.7530572",
"0.72412294",
"0.72412294",
"0.7150039",
"0.712442",
"0.70535386",
"0.70535386",
"0.7028865",
"0.7011408",
"0.7000077",
"0.69844526",
"0.69825524",
"0.69704396",
"0.69704396",
"0.69704396",
"0.6957729",
"0.6957729",
"0.6937579",
"0.6932... | 0.8308673 | 0 |
POST /billing_infos POST /billing_infos.json | def create
@billing_info = BillingInfo.new(params[:billing_info])
respond_to do |format|
if @billing_info.save
format.html { redirect_to @billing_info, notice: 'Billing info was successfully created.' }
format.json { render json: @billing_info, status: :created, location: @billing_info }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @billing_info = BillingInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @billing_info }\n end\n end",
"def create\n @billing_info = BillingInfo.new(billing_info_params)\n @billing_info.company_id = current_user.company_id\n\n res... | [
"0.72587776",
"0.7185455",
"0.69965315",
"0.69143224",
"0.6884329",
"0.68250376",
"0.6822092",
"0.6804976",
"0.6750653",
"0.6750653",
"0.66991025",
"0.66827124",
"0.66827124",
"0.6565685",
"0.6546315",
"0.650386",
"0.6472567",
"0.6433595",
"0.63902986",
"0.6374602",
"0.637036... | 0.7785259 | 0 |
PUT /billing_infos/1 PUT /billing_infos/1.json | def update
@billing_info = BillingInfo.find(params[:id])
respond_to do |format|
if @billing_info.update_attributes(params[:billing_info])
format.html { redirect_to @billing_info, notice: 'Billing info was successfully updated.' }
format.json { head :no_content }
else
format.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @billing_info.update(billing_info_params)\n format.html { redirect_to @billing_info, notice: 'Billing info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json {... | [
"0.7353004",
"0.72369725",
"0.72369725",
"0.7159049",
"0.704509",
"0.70017296",
"0.6880946",
"0.6879077",
"0.68785393",
"0.68317735",
"0.6506148",
"0.6471375",
"0.6402917",
"0.63708013",
"0.63098514",
"0.63009953",
"0.62468094",
"0.62392145",
"0.6224508",
"0.6224508",
"0.6224... | 0.75241995 | 0 |
DELETE /billing_infos/1 DELETE /billing_infos/1.json | def destroy
@billing_info = BillingInfo.find(params[:id])
@billing_info.destroy
respond_to do |format|
format.html { redirect_to billing_infos_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @billing_info.destroy\n respond_to do |format|\n format.html { redirect_to billing_infos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @billing_info.destroy\n respond_to do |format|\n format.html { redirect_to select_plan_path }\n format.j... | [
"0.8067053",
"0.79237777",
"0.7494958",
"0.7356279",
"0.7349171",
"0.72781503",
"0.7186637",
"0.7138617",
"0.70773065",
"0.7047433",
"0.70213205",
"0.688862",
"0.681967",
"0.67866445",
"0.6781592",
"0.6772383",
"0.6701584",
"0.6701584",
"0.66995645",
"0.66784316",
"0.6646599"... | 0.80869853 | 0 |
Provides a route to redirect after order completion | def completion_route
order_path(@order, :checkout_complete => true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def completion_route\n thankyou_order_url(@order)\n end",
"def completion_route\n return order_path(@order) unless @order.user.anonymous?\n token_order_path(@order, @order.user.token)\n end",
"def completion_route\n order_path(@order)\n end",
"def redirect_or_complete_order\n @order = Sp... | [
"0.74368024",
"0.7307958",
"0.72201335",
"0.69129425",
"0.66553843",
"0.6452472",
"0.62485075",
"0.62060976",
"0.6169361",
"0.611184",
"0.6103027",
"0.6096453",
"0.6055876",
"0.60554457",
"0.60248774",
"0.60073847",
"0.6004088",
"0.59874326",
"0.5986176",
"0.5959058",
"0.5949... | 0.74656683 | 0 |
Send +message+ back to the HipChat server. If +to+ == +:room+, replies to the room. If +to+ == nil, responds in the manner the original message was sent. Otherwise, PMs the message to +to+. | def reply(message, to = nil)
if to == :room
reply_to.reply(message, nil)
else
reply_to.reply(message, to || private_sender)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reply_message(params)\n room_id = self.room_id || params.delete(:room_id)\n raise ArgumentError.new(\"room_id required\") unless room_id\n call_api(:method => :post, :uri => @api_base.merge(\"room/#{room_id}/reply\"), :body_params => params)\n end",
"def broadcast_to(room, msg)\n\t\t\tm = G... | [
"0.66002274",
"0.63776666",
"0.6189043",
"0.6087626",
"0.579443",
"0.55950856",
"0.55942017",
"0.5593525",
"0.5549418",
"0.5490347",
"0.5483273",
"0.5465405",
"0.54620755",
"0.5447426",
"0.54408777",
"0.542646",
"0.5415297",
"0.54127085",
"0.5405789",
"0.53953594",
"0.5394616... | 0.78462917 | 0 |
An ordered list of all words in the message with any reference to the bot's nick stripped out. If +command+ is passed in, it is also stripped out. This is useful to separate the 'parameters' from the 'commands' in a message. | def words(message, command = nil)
reply = at_nick.downcase
command = command.downcase if command
message.split.reject {|word| word.downcase == reply || word.downcase == command }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def without_nick(message)\n possible_nick, command = message.split(' ', 2)\n if possible_nick.casecmp(at_nick) == 0\n command\n else\n message\n end\n end",
"def words\n message.split\n end",
"def command_list m\n get_list escape m.channel.to_s #logic/pug\n end",
"def strip_mes... | [
"0.5913243",
"0.5908133",
"0.55127823",
"0.5350945",
"0.5346824",
"0.5246391",
"0.52345324",
"0.51931435",
"0.51899606",
"0.51899606",
"0.5138439",
"0.5127919",
"0.5068915",
"0.50436324",
"0.5021841",
"0.50095546",
"0.49676156",
"0.4961847",
"0.49489635",
"0.49471855",
"0.494... | 0.7779327 | 0 |
Removes the first word in message if it is a reference to the bot's nick | def without_nick(message)
possible_nick, command = message.split(' ', 2)
if possible_nick.casecmp(at_nick) == 0
command
else
message
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nick_part(nick, reason=nil)\n return if not @names.include?(nick)\n\n @names.delete(nick)\n reason = \" (#{reason})\" if reason\n @bridge.add(:xmpp, :irc, SYSTEM_USER, \"#{nick} just left the IRC channel#{reason}\")\n end",
"def part msg\n msg.connection.channels.each_value do |chan|\n ... | [
"0.6668592",
"0.6528002",
"0.64406157",
"0.6282258",
"0.616248",
"0.6085518",
"0.6074179",
"0.60251206",
"0.5927969",
"0.5865599",
"0.57653135",
"0.5722443",
"0.56778085",
"0.5623015",
"0.55778295",
"0.55585176",
"0.55238044",
"0.5521788",
"0.55213225",
"0.55183566",
"0.55121... | 0.7735524 | 0 |
Find and run all the actions associated with matchers that match +message+. | def find_match(message)
matchers.each do |regexp, options, action, description|
if options[:sent_to_me] && !sent_to_me?(message)
next
end
if match_data = without_nick(message).match(regexp)
# Return true explicitly if this matcher explicitly returned true
break true if ins... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match_message(message)\n @routes\n .reduce(Set.new) do |memo, (matcher, handlers)|\n memo = memo.merge(handlers) if matcher.matches_message?(message)\n memo\n end\n end",
"def find_all_actions_matching(matcher)\n actions.find_all ... | [
"0.6615374",
"0.5999747",
"0.5943788",
"0.59328794",
"0.5838377",
"0.57649815",
"0.5702747",
"0.5565897",
"0.55282384",
"0.55019957",
"0.54770076",
"0.543302",
"0.53932214",
"0.5376062",
"0.5372585",
"0.5343184",
"0.5332027",
"0.529163",
"0.52706647",
"0.52423775",
"0.5238046... | 0.63537383 | 1 |
GET /disatance_and_times GET /disatance_and_times.json | def index
@disatance_and_times = DisatanceAndTime.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n render :json => @timecard.to_json(:include => :time_entry), status: :ok\n end",
"def set_disatance_and_time\n @disatance_and_time = DisatanceAndTime.find(params[:id])\n end",
"def index\n @timecards = TimeCard.all\n render :json => @timecards.to_json(:include => :time_entry), statu... | [
"0.64136195",
"0.6285597",
"0.62769437",
"0.62163085",
"0.6099392",
"0.60022205",
"0.5944305",
"0.5899647",
"0.58721507",
"0.58182645",
"0.5808619",
"0.5808281",
"0.57819",
"0.5777804",
"0.57705355",
"0.57500273",
"0.57400453",
"0.5731615",
"0.56889737",
"0.5687546",
"0.56570... | 0.7489211 | 0 |
POST /disatance_and_times POST /disatance_and_times.json | def create
@disatance_and_time = DisatanceAndTime.new(disatance_and_time_params)
respond_to do |format|
if @disatance_and_time.save
format.html { redirect_to @disatance_and_time, notice: 'Disatance and time was successfully created.' }
format.json { render :show, status: :created, locatio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disatance_and_time_params\n params.require(:disatance_and_time).permit(:start_id, :end_id, :cost_time, :distance)\n end",
"def set_disatance_and_time\n @disatance_and_time = DisatanceAndTime.find(params[:id])\n end",
"def index\n @disatance_and_times = DisatanceAndTime.all\n end",
"de... | [
"0.6476341",
"0.64049864",
"0.6137282",
"0.59819573",
"0.59797984",
"0.58441556",
"0.5719973",
"0.57143366",
"0.57141",
"0.56469536",
"0.5605883",
"0.5602034",
"0.55547816",
"0.5551453",
"0.54402834",
"0.54284286",
"0.5420759",
"0.5411625",
"0.53763384",
"0.5375875",
"0.53628... | 0.71925676 | 0 |
PATCH/PUT /disatance_and_times/1 PATCH/PUT /disatance_and_times/1.json | def update
respond_to do |format|
if @disatance_and_time.update(disatance_and_time_params)
format.html { redirect_to @disatance_and_time, notice: 'Disatance and time was successfully updated.' }
format.json { render :show, status: :ok, location: @disatance_and_time }
else
format.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @time_off_request = TimeOffRequest.find(params[:id])\n respond_to do |format|\n if @time_off_request.update_attributes(params[:time_off_request])\n format.html { redirect_to admin_time_off_requests_url, notice: 'Time off request was successfully updated.' }\n format.json {... | [
"0.64765316",
"0.6354351",
"0.6337179",
"0.63341516",
"0.6331484",
"0.6283852",
"0.6266696",
"0.6223409",
"0.6210575",
"0.6158644",
"0.6134187",
"0.61199147",
"0.6117282",
"0.60922605",
"0.60922605",
"0.6075431",
"0.6071622",
"0.60702175",
"0.6068346",
"0.60498685",
"0.604288... | 0.7111923 | 0 |
DELETE /disatance_and_times/1 DELETE /disatance_and_times/1.json | def destroy
@disatance_and_time.destroy
respond_to do |format|
format.html { redirect_to disatance_and_times_url, notice: 'Disatance and time was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @nursing_time = NursingTime.find(params[:id])\n @nursing_time.destroy\n\n respond_to do |format|\n format.html { redirect_to nursing_times_url }\n format.json { head :ok }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @time_gap = Ti... | [
"0.694231",
"0.6882681",
"0.6847577",
"0.68420106",
"0.6825202",
"0.68122077",
"0.67942166",
"0.675718",
"0.6752113",
"0.67442197",
"0.6717403",
"0.6713383",
"0.67035717",
"0.6677627",
"0.66670835",
"0.6655729",
"0.66526985",
"0.66516083",
"0.66468483",
"0.6644592",
"0.662652... | 0.7547343 | 0 |
Build an order by expression for the given db relation based on the criteria | def order(criteria, relation)
return relation unless criteria.order?
order_str = convert_order_exprs(criteria.order_by)
relation.order(order_str)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ordered_expression_sql(oe)\n \"#{literal(oe.expression)} #{oe.descending ? 'DESC' : 'ASC'}\"\n end",
"def order_clause\n col = case sort_params[:sort_col]\n when 'title'\n 'data_management_plans.title'\n when 'funder'\n 'affiliations_fundings.name'\n ... | [
"0.75010216",
"0.7099373",
"0.68840533",
"0.67797357",
"0.67084724",
"0.66659886",
"0.6641338",
"0.65924454",
"0.6576974",
"0.65731865",
"0.6567868",
"0.6567868",
"0.6567868",
"0.64731634",
"0.64426976",
"0.6419537",
"0.64078844",
"0.6319218",
"0.62645566",
"0.6216829",
"0.61... | 0.7313954 | 1 |
Reads from the socket until an EOT is found Extra characters may be read from the socket, but they are kept in a buffer to be used with the next call to read_until_eot(). If there is a gap in transmission longer than the timeout, nil will be returned. The total time spent waiting for data may be longer than the timeout... | def read_until_eot(timeout)
#Read until eot or timeout.
eot_index = @buf.index("\004")
received = nil
gotMessage = nil
#Do we already have a message ready?
unless eot_index
#Read until EOT or timeout
while gotMessage = IO.select([@socket], nil, nil, timeout) do
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read timeout = DEFAULT_READ_TIMEOUT\n return @responses.shift unless @responses.empty?\n\n results = select([ @socket ], nil, nil, timeout)\n\n @buff += @socket.recv(4 * 1024) if (results and results[0].include? @socket) # results nil on timeout\n\n if @buff =~ /^(.*\\r\\n)(.*)$/m # network ... | [
"0.7202537",
"0.6935118",
"0.6922779",
"0.6868883",
"0.68577427",
"0.68392587",
"0.6663246",
"0.6610376",
"0.65222",
"0.6501486",
"0.6442421",
"0.6406714",
"0.63326937",
"0.6298922",
"0.62532824",
"0.62458324",
"0.6205767",
"0.61006474",
"0.60950625",
"0.6082923",
"0.6075475"... | 0.8419876 | 0 |
GET /test_suites/1 GET /test_suites/1.json | def show
@test_suite = TestSuite.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @test_suite }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @testsuites = Testsuite.all\n end",
"def index\n @test_suite = TestSuite.find(params[:test_suite_id])\n @test_cases = @test_suite.test_cases\n end",
"def get_test_suite(page, options = {})\n options[:basic_auth] = @auth\n options[:body] = {\n page: page\n }\n self.class.... | [
"0.7127071",
"0.66317534",
"0.6518662",
"0.6468737",
"0.6447091",
"0.64078796",
"0.63427174",
"0.6319057",
"0.62383205",
"0.6215924",
"0.6206373",
"0.6141135",
"0.6119665",
"0.6093669",
"0.6085884",
"0.6085157",
"0.6083917",
"0.60749465",
"0.60663307",
"0.60386413",
"0.600156... | 0.74278927 | 0 |
GET /test_suites/new GET /test_suites/new.json | def new
@test_suite = TestSuite.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @test_suite }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @test_suite = TestSuite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test_suite }\n end\n end",
"def create\n @test_suite = TestSuite.new(params[:test_suite])\n\n respond_to do |format|\n if @test_suite.save\n format.h... | [
"0.6997694",
"0.6991543",
"0.68222594",
"0.68136525",
"0.6809018",
"0.677885",
"0.677787",
"0.67206436",
"0.67137027",
"0.665657",
"0.6572995",
"0.65578413",
"0.65549487",
"0.6513213",
"0.6509294",
"0.6509294",
"0.64772874",
"0.6471136",
"0.6469058",
"0.64507097",
"0.6445442"... | 0.7865455 | 0 |
POST /test_suites POST /test_suites.json | def create
@test_suite = TestSuite.new(params[:test_suite])
respond_to do |format|
if @test_suite.save
format.html { redirect_to @test_suite, notice: 'Test suite was successfully created.' }
format.json { render json: @test_suite, status: :created, location: @test_suite }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @test_suite = TestSuite.new(test_suite_params)\n\n respond_to do |format|\n if @test_suite.save\n format.html { redirect_to @test_suite, notice: 'Test suite was successfully created.' }\n format.json { render :show, status: :created, location: @test_suite }\n else\n ... | [
"0.7096308",
"0.6967058",
"0.6523598",
"0.6320188",
"0.6234519",
"0.6133401",
"0.61276287",
"0.6062026",
"0.5996524",
"0.5969822",
"0.59578073",
"0.588298",
"0.5876363",
"0.58427393",
"0.5825716",
"0.5790882",
"0.5785391",
"0.57215536",
"0.571685",
"0.5716376",
"0.5688778",
... | 0.7056425 | 1 |
PUT /test_suites/1 PUT /test_suites/1.json | def update
@test_suite = TestSuite.find(params[:id])
respond_to do |format|
if @test_suite.update_attributes(params[:test_suite])
format.html { redirect_to @test_suite, notice: 'Test suite was successfully updated.' }
format.json { head :no_content }
else
format.html { rende... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @testsuite.update(testsuite_params)\n format.html { redirect_to @testsuite, notice: 'Testsuite was successfully updated.' }\n format.json { render :show, status: :ok, location: @testsuite }\n else\n format.html { render :edit }\n for... | [
"0.69552743",
"0.6828003",
"0.67865163",
"0.6758148",
"0.66596055",
"0.65655124",
"0.63800573",
"0.6289394",
"0.6152779",
"0.61485344",
"0.60898936",
"0.6041604",
"0.5929602",
"0.59279466",
"0.5898638",
"0.5891064",
"0.5890445",
"0.58609986",
"0.5839565",
"0.5831368",
"0.5793... | 0.7087594 | 0 |
DELETE /test_suites/1 DELETE /test_suites/1.json | def destroy
@test_suite = TestSuite.find(params[:id])
@test_suite.destroy
respond_to do |format|
format.html { redirect_to test_suites_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @testsuite.destroy\n respond_to do |format|\n format.html { redirect_to testsuites_url, notice: 'Testsuite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_suite.destroy\n respond_to do |format|\n format.html { redir... | [
"0.7463388",
"0.7450908",
"0.7425022",
"0.7218806",
"0.70049936",
"0.70049936",
"0.6989501",
"0.6988764",
"0.69378406",
"0.69378406",
"0.69358045",
"0.69153684",
"0.68908775",
"0.68725216",
"0.6868106",
"0.68638223",
"0.6809734",
"0.68038315",
"0.678919",
"0.67684346",
"0.672... | 0.77769333 | 0 |
returns an array of moved packages | def moved_packages
raise RuntimeError, "#{self.class} needs to overwrite moved_packages"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def old_stow_packages(pkg_name, version)\n old_versions = []\n # Iterate over directories that match name & delimiter\n Dir.glob(\"#{stow_path}/#{pkg_name}#{pkg_delim}*\") do |pkg_path|\n old_versions << File.basename(pkg_path)\n end\n unless blank?(old_versions)\n # Remove t... | [
"0.6401251",
"0.6380225",
"0.61969227",
"0.61969227",
"0.60115737",
"0.60085106",
"0.6004341",
"0.59140617",
"0.5827262",
"0.578119",
"0.577118",
"0.5768516",
"0.5743934",
"0.5743934",
"0.5685128",
"0.566619",
"0.56653416",
"0.56485325",
"0.5611497",
"0.56106037",
"0.5593413"... | 0.66300446 | 0 |
returns true if pkgname is an autoproj meta package | def is_metapackage?(package_name)
raise RuntimeError, "#{self.class} needs to overwrite is_metapackage?"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def package_enabled?(name)\n Autoproj.workspace.manifest.package_enabled?(name, false)\nend",
"def has_package?(name)\n packages.has_key?(name) || os_package_resolver.include?(name)\n end",
"def check_pkg_info\n return false if options['package_url'].nil? ||\n options['pa... | [
"0.6996032",
"0.6752778",
"0.6543276",
"0.64913464",
"0.648392",
"0.64228475",
"0.6400011",
"0.63917285",
"0.63600683",
"0.6316691",
"0.62206054",
"0.6178006",
"0.61660355",
"0.6116554",
"0.60781336",
"0.6073104",
"0.6058404",
"0.6032428",
"0.5990635",
"0.5982702",
"0.5980618... | 0.69085354 | 1 |
returns a PackageInfo from an autobuild package | def pkginfo_from_pkg(package)
raise RuntimeError, "#{self.class} needs to overwrite pkginfo_from_pkg"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_autobuild_package(name)\n find_package_definition(name)&.autobuild\n end",
"def set_package_info\n download_and_extract_package\n parse_package_description\n @package_hash = filter_into_package @package_desc\n @version_hash = filter_into_version @package_desc\n @author_h... | [
"0.6974867",
"0.6186185",
"0.61762625",
"0.61434776",
"0.60839415",
"0.5983987",
"0.59585327",
"0.5948931",
"0.5947118",
"0.5900597",
"0.58723295",
"0.5872231",
"0.5805028",
"0.5804485",
"0.57755363",
"0.5742375",
"0.5738531",
"0.5738173",
"0.5720814",
"0.570821",
"0.57020646... | 0.64490074 | 1 |
Sort by package set order can be used with any packages array of objects providing a name(), that is, works with both autobuild packages and PackageInfos returns a sorted array populated from elements of packages | def sort_by_package_sets(packages, pkg_set_order)
raise RuntimeError, "#{self.class} needs to overwrite sort_by_package_sets"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_obj\n [@name, @version, Gem::Platform.sort_priority(@new_platform)]\n end",
"def lookup(package_name)\n pkgs = @rpms[package_name]\n if pkgs\n pkgs.sort.reverse\n else\n nil\n end\n end",
"def install_order(arr)\n pair... | [
"0.6782119",
"0.6602605",
"0.65122336",
"0.6475713",
"0.64148784",
"0.6245281",
"0.6208737",
"0.61648846",
"0.6159998",
"0.60986495",
"0.6079145",
"0.60552835",
"0.6026997",
"0.6000804",
"0.5999885",
"0.59287906",
"0.59285957",
"0.5894571",
"0.58802915",
"0.5862084",
"0.58477... | 0.7360846 | 0 |
Send accumulated events into Sensu's socket, unless environment variable PROM_DEBUG is set. | def dispatch(event)
if ENV.key?('PROM_DEBUG')
log.debug("PROM_DEBUG set, not dispatching event to Sensu: #{event}")
return
end
# :nocov:
begin
s = TCPSocket.open(@sensu_address, @sensu_port)
s.puts(JSON.generate(event))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_event( data )\n\n\t\tuntil data.empty?\n\t\t\tbytes = self.socket.send( data, 0, self.multicast_address, self.port )\n\n\t\t\tself.log.debug \"Sent: %p\" % [ data[0, bytes] ]\n\t\t\tdata[ 0, bytes ] = ''\n\t\tend\n\tend",
"def send_all(event, data)\n\t\tEM.next_tick {\n\t\t\t@sockets.each do |s|\n\t\t\t... | [
"0.6201655",
"0.6187335",
"0.58082014",
"0.58043253",
"0.57672524",
"0.57657593",
"0.5738058",
"0.5669808",
"0.566178",
"0.5636381",
"0.55153537",
"0.547652",
"0.54764295",
"0.5443656",
"0.543746",
"0.54317653",
"0.53379047",
"0.53290755",
"0.53258747",
"0.53177416",
"0.52884... | 0.6672171 | 0 |
Read Sensu address and port from environment. | def read_env_address_and_port
@sensu_address = ENV['SENSU_SOCKET_ADDRESS'] \
if ENV.key?('SENSU_SOCKET_ADDRESS')
@sensu_port = ENV['SENSU_SOCKET_PORT'].to_i \
if ENV.key?('SENSU_SOCKET_PORT')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def port; config[:port]; end",
"def client_port\n host_settings['client_port']\nend",
"def myservices_environment_details_host\n ENV['ENV_DETAILS'].nil? ? 'esu2v871:9080' : ENV['ENV_DETAILS']\n end",
"def server_port ; @env['SERVER_PORT' ].to_i ; end",
"def raw_host_with_port; end",
"def port\n ... | [
"0.64324284",
"0.61466354",
"0.6043715",
"0.58404446",
"0.57912207",
"0.5730329",
"0.5716782",
"0.57036644",
"0.5683595",
"0.5673407",
"0.56447554",
"0.5629297",
"0.56161684",
"0.55245",
"0.5521598",
"0.5466633",
"0.5466052",
"0.5459002",
"0.5448339",
"0.5447246",
"0.54236025... | 0.8677897 | 0 |
GET /globus_tokens or /globus_tokens.json | def index
@globus_tokens = GlobusToken.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token\n @api.get(\"#{Paths::TOKENS}\")\n end",
"def fetchTokens\n self.class.request.get \"#{id}/tokens\" \n end",
"def get_token\n get(TOKEN_URL)\n end",
"def index \n @tokens = @user.tokens\n respond_to do |format|\n format.html # index.html.erb\n form... | [
"0.6974814",
"0.6847502",
"0.6754333",
"0.6610012",
"0.65099204",
"0.6381121",
"0.63664776",
"0.63149947",
"0.62482715",
"0.6238951",
"0.6189851",
"0.61524683",
"0.61365527",
"0.6085065",
"0.60632163",
"0.60580367",
"0.6039212",
"0.602846",
"0.6002313",
"0.5984759",
"0.589406... | 0.70435613 | 0 |
POST /globus_tokens or /globus_tokens.json | def create
@globus_token = GlobusToken.new(globus_token_params)
respond_to do |format|
if @globus_token.save
format.html { redirect_to globus_token_url(@globus_token), notice: "Globus token was successfully created." }
format.json { render :show, status: :created, location: @globus_token ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_token(token)\n puts(token.to_json)\n @api.post(\"#{Paths::TOKENS}\", :body => token)\n end",
"def globus_token_params\n params.require(:globus_token).permit(:access_token, :expires_in, :body)\n end",
"def token(request)\n end",
"def create\n @token = Token.new(params[:token])... | [
"0.6457726",
"0.6397135",
"0.61262566",
"0.6043799",
"0.5970899",
"0.59197044",
"0.58563757",
"0.5831155",
"0.5829455",
"0.5815487",
"0.5781872",
"0.5781479",
"0.5777564",
"0.5756895",
"0.5752412",
"0.5726105",
"0.5702234",
"0.5689025",
"0.5674404",
"0.5670639",
"0.5669772",
... | 0.704741 | 0 |
PATCH/PUT /globus_tokens/1 or /globus_tokens/1.json | def update
respond_to do |format|
if @globus_token.update(globus_token_params)
format.html { redirect_to globus_token_url(@globus_token), notice: "Globus token was successfully updated." }
format.json { render :show, status: :ok, location: @globus_token }
else
format.html { rende... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_globus_token\n @globus_token = GlobusToken.find(params[:id])\n end",
"def update_token(data, token)\n base_url = flutterwave_object.base_url \n response = put_request(\"#{base_url}/tokens/#{token}\", data.to_json)\n return response\n end",
"def update\n @token = @user... | [
"0.63651603",
"0.6165193",
"0.60930705",
"0.60487264",
"0.60411566",
"0.5932071",
"0.59099835",
"0.58823305",
"0.58146465",
"0.57176846",
"0.57176846",
"0.5706656",
"0.57002777",
"0.56871086",
"0.5608996",
"0.56061226",
"0.5539444",
"0.55339545",
"0.5511773",
"0.550958",
"0.5... | 0.7029462 | 0 |
DELETE /globus_tokens/1 or /globus_tokens/1.json | def destroy
@globus_token.destroy
respond_to do |format|
format.html { redirect_to globus_tokens_url, notice: "Globus token was successfully destroyed." }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(path, data = {})\n self.class.delete path, :body => data.merge(:u => access_token)\n end",
"def destroy\n @token = @user.tokens.find(params[:id])\n @user.tokens.delete(@token)\n @user.save\n\n respond_to do |format|\n format.html { redirect_to user_tokens_url }\n format.json ... | [
"0.650365",
"0.6490772",
"0.6458638",
"0.6444055",
"0.6345504",
"0.634459",
"0.6266924",
"0.6229879",
"0.6224773",
"0.622254",
"0.61804026",
"0.6173886",
"0.6163432",
"0.6146661",
"0.6139132",
"0.6138591",
"0.6114884",
"0.61093926",
"0.61044353",
"0.60984045",
"0.6088365",
... | 0.7025559 | 0 |
Returns a date within the specified Range. The Range can be Date or String objects. Example: min = Date.parse('19661115') max = Date.parse('19900101') Random.date(min..max) => a Date between 11/15/1996 and 1/1/1990 Random.date('19661115'..'19900101') => a Date between 11/15/1996 and 1/1/1990 | def date_between(range)
min_date = range.min.is_a?(Date) ? range.min : Date.parse(range.min)
max_date = range.max.is_a?(Date) ? range.max : Date.parse(range.max)
diff = (max_date - min_date).to_i
min_date + rand(diff)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_between (min, max)\n Predicate.new(:date_between, { min: min, max: max}) do |o|\n o >= min && o <= max\n end\n end",
"def get_start_date\n \n start_of_date_range = \"2005/01/01\" #YYYY/MM/DD\n end_of_date_range = \"2013/01/01\" #YYYY/MM/DD\n #array of all dates in range\n date_r... | [
"0.7558425",
"0.69964004",
"0.68260676",
"0.654374",
"0.654374",
"0.6537975",
"0.64115566",
"0.63960046",
"0.6286771",
"0.6280883",
"0.6237664",
"0.62217826",
"0.6199435",
"0.61981755",
"0.61960113",
"0.61845976",
"0.6180567",
"0.61477375",
"0.6092768",
"0.60652393",
"0.60336... | 0.83546555 | 0 |
create time stamped spreadsheet using base name connect to excel and open base workbook create instance of excel (xl) returns a nested array containing spreadsheet and script parameters | def xls_timestamp(s_s)
new_ss = (s_s.chomp(".xls")<<'_'<<Time.now.to_a.reverse[5..9].to_s<<(".xls"))
new_ss1 = new_ss.sub('driver','result')
xl = new_xls(s_s,1) #open base driver ss with new excel session
ws = xl[2] # worksheet
param = Array.new # contains no elements. just used as a place holder here
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xls_timestamp(g,s_s,type=nil,rs_name=nil)\r\n new_ss = (s_s.chomp(\".xls\")<<'_'<<g.t_stamp<<(\".xls\"))\r\n new_ss1 = new_ss.sub(/Tools\\\\.+\\\\/,\"result\\\\#{rs_name}\\\\\")\r\n if (type == 'ind') # driver was launched independently\r\n xl = g.new_xls(s_s,1) #open base driver ss with new excel sessio... | [
"0.72333217",
"0.659027",
"0.64731777",
"0.6371052",
"0.63653183",
"0.61595124",
"0.598233",
"0.595309",
"0.5830057",
"0.57880074",
"0.5725439",
"0.5711408",
"0.5710881",
"0.5648192",
"0.56302893",
"0.56298536",
"0.5623531",
"0.5619475",
"0.560483",
"0.5592175",
"0.5574443",
... | 0.7089995 | 1 |
Generates the line starting with coordinate [x,y]. It calls the block to find the next position in the line. It can be used to generate snake lines if necessary. | def get_line_coords(x, y)
line = [[x,y]]
loop do
next_x, next_y = yield x, y
@box[next_x] && @box[next_x][next_y] ? line << [next_x, next_y] : break
x, y = next_x, next_y
end
line
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_for_position(position); end",
"def line_for_position(position); end",
"def line_for_position(position); end",
"def line(x0, y0, x1, y1)\n # clean params\n x0, y0, x1, y1 = x0.to_i, y0.to_i, x1.to_i, y1.to_i\n y0, y1, x0, x1 = y1, y0, x1, x0 if y0>y1\n sx = (dx = x1-x0) < 0 ? -1 : 1 ; dx ... | [
"0.66679555",
"0.66679555",
"0.66679555",
"0.6343223",
"0.6305485",
"0.6238916",
"0.61446404",
"0.6104875",
"0.60880655",
"0.60718155",
"0.60113436",
"0.6008214",
"0.5941751",
"0.58728486",
"0.5846988",
"0.58463895",
"0.58305645",
"0.58121204",
"0.5811376",
"0.5809389",
"0.57... | 0.69364685 | 0 |
Replaces ? and with \w? and \w in each word so that it could be used as the regex to support wildcard letter matching. | def regexize_words(words)
words.each {|word|word.gsub!(/(\?|\*)/, '\w\1')}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def regexize_words(words)\n return '' if !words.is_a?(Array) && !words.is_a?(String)\n words = [words] if words.is_a?(String)\n words = words.reject{ |w| !w.is_a?(String) || w.empty? }\n return '' if words.empty?\n words = '(?:' + words.map{ |w| \"(?:\\\\b#{Regexp.escape(w.strip)}\\\\b)\" }.join('|') + ')'\nr... | [
"0.61842364",
"0.5702262",
"0.569581",
"0.5693622",
"0.5658185",
"0.56499785",
"0.5648537",
"0.5631904",
"0.5621399",
"0.5617135",
"0.55600446",
"0.55600446",
"0.55600446",
"0.5550716",
"0.55325",
"0.5494243",
"0.54898304",
"0.54491377",
"0.54424113",
"0.5403696",
"0.5402677"... | 0.74936295 | 0 |
Return the current indentation and folding state. | def get_state() [ indent_depth, folding_depth ] end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indentation\n \" \" * @indent_size * @indent_level\n end",
"def indentation_level\n spaces = (@source.size - @stripped_source.size)\n spaces == 0 ? 0 : spaces / 2\n end",
"def indentation; end",
"def indentation; end",
"def folding_open()\n self.folding_depth += 1\n fh.... | [
"0.6402327",
"0.63563186",
"0.63514775",
"0.63514775",
"0.6074035",
"0.60485125",
"0.60046595",
"0.5922211",
"0.58951724",
"0.588321",
"0.58592373",
"0.58267236",
"0.581454",
"0.581454",
"0.581454",
"0.581454",
"0.581454",
"0.5787228",
"0.5787228",
"0.5767474",
"0.57244825",
... | 0.83331215 | 0 |
Adjust the indentation depth. Returns the indent depth BEFORE it was adjusted. | def adj_indent(adjust = 1)
old, self.indent_depth = indent_depth, (indent_depth+adjust)
self.indent_str =
(indenting == true) ? (TAB * indent_depth) : EMPTY
old
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_depth\n if depth?\n self.update_attribute(:depth, level)\n end\n self\n end",
"def correct_indentation(node); end",
"def depth\n @cur_level - @base_level + 1\n end",
"def increment_indent\n\t\t\t@indent[-1] += 1\n\t\tend",
"def indent\n @__indent__ ||= 0\n ... | [
"0.6613887",
"0.6342347",
"0.63380563",
"0.63377494",
"0.6298908",
"0.6174548",
"0.6093325",
"0.6072794",
"0.6062438",
"0.60514194",
"0.6037487",
"0.595944",
"0.59318477",
"0.59120476",
"0.5905144",
"0.59051174",
"0.58327687",
"0.5808543",
"0.5755556",
"0.57297194",
"0.570172... | 0.6862533 | 0 |
Open a folding section. Returns the folding depth BEFORE folding_open(). | def folding_open()
self.folding_depth += 1
fh.puts FOLDING_OPEN if folding and not disabled
folding_depth - 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state() [ indent_depth, folding_depth ] end",
"def directive_open( line )\n # return line && line.include?( get_tag(:open) )\n if line && line.include?( get_tag(:open) ) then\n # find index pointing _after_ :open tag\n # index = line.index( get_tag(:open) ) + get_tag(:open... | [
"0.58478016",
"0.5291918",
"0.51431423",
"0.5132863",
"0.48570243",
"0.4733624",
"0.4700011",
"0.4696231",
"0.45631802",
"0.45561734",
"0.45274258",
"0.45105538",
"0.45083556",
"0.44875476",
"0.44813398",
"0.44432002",
"0.44333038",
"0.4421071",
"0.4408131",
"0.43927804",
"0.... | 0.8112801 | 0 |
this should be used when checking access to multilpe objects it will call `read?` on each object of the array if the operation used a scope to find records from an association, then `authorized_via_parent` could be true, in which case, the loop would be skipped. TODO: think of a way to override the authorized_via_paren... | def read_all?
return true if authorized_via_parent
# This is expensive, so try to avoid it
# TODO: look in to creating a cache for
# these look ups that's invalidated upon
# object save
accessible = object.map { |ea| read?(ea) }
accessible.all?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_nested\n @record = find_if_allowed(params[:id], :read)\n end",
"def child_acl\n [\n {\n 'privilege' => '{DAV:}read',\n 'principal' => owner,\n 'protected' => true\n },\n {\n 'privilege' => '{DAV:}write',\n 'pr... | [
"0.58500904",
"0.58041215",
"0.56830513",
"0.56222034",
"0.5562816",
"0.5537368",
"0.5445911",
"0.5401641",
"0.5393741",
"0.53171045",
"0.52759",
"0.52554834",
"0.525521",
"0.5254547",
"0.5254547",
"0.5254547",
"0.52515465",
"0.5247554",
"0.52192444",
"0.5219029",
"0.52159715... | 0.68372613 | 0 |
GET /rols/1 GET /rols/1.xml | def show
@rol = Rol.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @rol }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @rol = Rol.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rol }\n end\n end",
"def new\n @rol = Rol.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rol }\n end\n end",
"def... | [
"0.6118157",
"0.6118157",
"0.5941122",
"0.59244573",
"0.59233826",
"0.59158903",
"0.5838863",
"0.5810433",
"0.5808924",
"0.5762442",
"0.5751392",
"0.57127494",
"0.57078797",
"0.5707693",
"0.5700722",
"0.56819075",
"0.56763065",
"0.56648",
"0.56626946",
"0.5659165",
"0.5659165... | 0.71032786 | 1 |
GET /rols/new GET /rols/new.xml | def new
@rol = Rol.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @rol }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @rol = Rol.new(params[:rol])\n\n respond_to do |format|\n if @rol.save\n flash[:notice] = nil\n format.html { redirect_to(rols_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rol.err... | [
"0.72022414",
"0.7067177",
"0.68853265",
"0.6799671",
"0.67972404",
"0.6792667",
"0.67592645",
"0.67537063",
"0.6730882",
"0.6698384",
"0.6636429",
"0.6633694",
"0.6622037",
"0.6616588",
"0.6616588",
"0.6616588",
"0.6616588",
"0.6590247",
"0.6585547",
"0.65846443",
"0.6577787... | 0.79159343 | 1 |
POST /rols POST /rols.xml | def create
@rol = Rol.new(params[:rol])
respond_to do |format|
if @rol.save
format.html { redirect_to(@rol, :notice => 'Rol was successfully created.') }
format.xml { render :xml => @rol, :status => :created, :location => @rol }
else
format.html { render :action => "new" }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @rol = Rol.new(params[:rol])\n\n respond_to do |format|\n if @rol.save\n flash[:notice] = nil\n format.html { redirect_to(rols_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rol.err... | [
"0.6950628",
"0.6164979",
"0.59076256",
"0.5777335",
"0.5717998",
"0.57171905",
"0.5658761",
"0.5658761",
"0.5568336",
"0.55313003",
"0.5302578",
"0.5302578",
"0.52973926",
"0.5226925",
"0.51940113",
"0.5136111",
"0.51358914",
"0.5128255",
"0.51278913",
"0.51260924",
"0.50573... | 0.6684978 | 1 |
PUT /rols/1 PUT /rols/1.xml | def update
@rol = Rol.find(params[:id])
respond_to do |format|
if @rol.update_attributes(params[:rol])
format.html { redirect_to(@rol, :notice => 'Rol was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @rol = Rol.find(params[:id])\n\n respond_to do |format|\n if @rol.update_attributes(params[:rol])\n flash[:notice] = nil\n format.html { redirect_to(rols_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xm... | [
"0.71386456",
"0.62808794",
"0.62398434",
"0.62395734",
"0.5911937",
"0.58296406",
"0.5706345",
"0.5688722",
"0.56283903",
"0.56283903",
"0.5623921",
"0.55724114",
"0.5551198",
"0.55283445",
"0.5455258",
"0.54525435",
"0.54087836",
"0.5391634",
"0.5389028",
"0.5349875",
"0.53... | 0.68744946 | 1 |
DELETE /rols/1 DELETE /rols/1.xml | def destroy
@rol = Rol.find(params[:id])
@rol.destroy
respond_to do |format|
format.html { redirect_to(rols_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @rolid = params[:id]\n Role.destroy(@rolid)\n end",
"def destroy\n @rol.destroy\n respond_to do |format|\n format.html { redirect_to roles_url }\n format.json { head :no_content }\n end\n end",
"def test_set3_04c_delete_principal()\n user = \"test_user\"\n @test_a... | [
"0.64588046",
"0.64537984",
"0.63043654",
"0.6231372",
"0.61747974",
"0.6153388",
"0.6142095",
"0.61274886",
"0.60851115",
"0.607345",
"0.607345",
"0.6060952",
"0.60603064",
"0.60370386",
"0.60283357",
"0.60274565",
"0.6021817",
"0.6016675",
"0.60112804",
"0.6004829",
"0.6001... | 0.72054386 | 1 |
compress a file and move it to the backup folder | def backup_file folder,file
@manager ||= Conf::LocalFileManager.new
newp = File.join(Conf::directories.backup,@curr_source.name.to_s,folder)
file.zip! unless file.zip?
@manager.move_files [file],newp
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compress(src_path, archive_path)\n src_dir = File.dirname( File.expand_path( src_path ) )\n src_file = File.basename( src_path )\n archive_path = File.expand_path( archive_path )\n dest_dir = File.dirname( archive_path )\n\n puts \"src_dir: #{src_dir}\"\n puts \"src_path: #{src_path}\"\n p... | [
"0.7029616",
"0.6815202",
"0.6721034",
"0.6671892",
"0.6613445",
"0.657687",
"0.6575387",
"0.6447642",
"0.642551",
"0.6422216",
"0.63949215",
"0.63850206",
"0.6361033",
"0.6337166",
"0.6275988",
"0.625735",
"0.6233229",
"0.6220686",
"0.61998767",
"0.61751866",
"0.6136582",
... | 0.71339303 | 0 |
GET /entity/new GET /entity/new.json | def new
@entity = @klass.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @entity }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @entity = Entity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end",
"def new\n @breadcrumb = 'create'\n @entity_type = EntityType.new\n \n respond_to do |format|\n format.html # new.html.erb\n ... | [
"0.83444786",
"0.77972156",
"0.7673708",
"0.7581144",
"0.75669056",
"0.7471776",
"0.739064",
"0.73436695",
"0.72835374",
"0.7273284",
"0.71737635",
"0.71680695",
"0.71288955",
"0.7038358",
"0.7038358",
"0.7038358",
"0.70266515",
"0.7021943",
"0.7021473",
"0.70163125",
"0.6972... | 0.8057238 | 1 |
This helper timestamps asset files (css, js etc). Typically used in 'skin' files to precalculate the actual path. TEMP version: just attaches the $build number. ++ | def timestamp_asset(path)
return "#{path}?t=#$app_build"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def asset_timestamp(file_path)\n return nil if file_path =~ /\\?/ || (self.class.respond_to?(:asset_stamp) && !self.class.asset_stamp)\n public_path = self.class.public_folder if self.class.respond_to?(:public_folder)\n public_path ||= Padrino.root(\"public\") if Padrino.respond_to?(:root)\n ... | [
"0.6419433",
"0.6338564",
"0.6187573",
"0.6186875",
"0.608325",
"0.6001299",
"0.5933352",
"0.58739525",
"0.5865026",
"0.58244014",
"0.5805991",
"0.57985854",
"0.57624364",
"0.57467824",
"0.57219815",
"0.5720125",
"0.57045555",
"0.56023604",
"0.55988395",
"0.5573486",
"0.55500... | 0.7513147 | 0 |
desc: gets the given number of mails from the given mailbox and return it to ajax call. output: js | def mails
begin
@imap = WmailImapUtils.current_imap
if not @imap.blank?
@mailbox = params['mailbox']
@min = params['min'].to_i
@max = params['max'].to_i
@total = params['total'].to_i
@imap.select(@mailbox)
@mails = @imap.fetch(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @seqno = params[:id].to_i\n @total = params[:total].to_i\n\n begin\n @imap = WmailImapUtils.current_imap\n message = @imap.fetch(@seqno, ['RFC822']).first.attr['RFC822']\n @mail = Mail.new(message)\n # get the folder list\n mailbox_list\n rescue\n ... | [
"0.6657559",
"0.6314533",
"0.60601854",
"0.6057587",
"0.5850558",
"0.5818033",
"0.5816518",
"0.5758425",
"0.5694075",
"0.5679501",
"0.5672662",
"0.56647146",
"0.56630784",
"0.56569636",
"0.555139",
"0.55461514",
"0.55458695",
"0.55357844",
"0.5534469",
"0.5509628",
"0.5497184... | 0.67748797 | 0 |
Instantiates a new securityKubernetesPodEvidence and sets the default values. | def initialize()
super
@odata_type = "#microsoft.graph.security.kubernetesPodEvidence"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize()\n super\n @odata_type = \"#microsoft.graph.security.kubernetesSecretEvidence\"\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.security.amazonResourceEvidence\"\n end",
"def initialize()\n ... | [
"0.6451284",
"0.54269695",
"0.5245782",
"0.5226086",
"0.5197408",
"0.5062625",
"0.50069535",
"0.4933385",
"0.4895962",
"0.48238045",
"0.48238045",
"0.47835678",
"0.4750577",
"0.46938643",
"0.46332353",
"0.45909813",
"0.45536014",
"0.4543707",
"0.45156503",
"0.4483675",
"0.448... | 0.7090775 | 0 |
Sets the containers property value. The list of pod containers which are not init or ephemeral containers. | def containers=(value)
@containers = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ephemeral_containers=(value)\n @ephemeral_containers = value\n end",
"def init_containers=(value)\n @init_containers = value\n end",
"def containers\n @containers ||= Docker::Container.all(\n all: true, # include stopped containers\n ... | [
"0.70891976",
"0.6731775",
"0.65368944",
"0.6155096",
"0.600326",
"0.6000397",
"0.5925121",
"0.5860609",
"0.57814556",
"0.5621611",
"0.553374",
"0.540802",
"0.5395047",
"0.5392625",
"0.5353763",
"0.5271195",
"0.51799804",
"0.516874",
"0.5147814",
"0.5061929",
"0.5038068",
"... | 0.8103989 | 0 |
Gets the controller property value. The pod controller. | def controller
return @controller
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def controller=(value)\n @controller = value\n end",
"def controller=(value)\n @property_flush[:controller] = value\n end",
"def controller client\n client.env[CONTROLLER_NAME]\n end",
"def controller\n MSPhysics::Newton::CurvySlider.get_controller(@address)\n ... | [
"0.66547716",
"0.6534098",
"0.6431632",
"0.6352281",
"0.6352281",
"0.63509214",
"0.62173706",
"0.60733",
"0.60723096",
"0.60187113",
"0.60064083",
"0.5960757",
"0.58094335",
"0.5804069",
"0.572883",
"0.5721424",
"0.5711408",
"0.56776834",
"0.56776834",
"0.5660755",
"0.5642541... | 0.65726924 | 1 |
Sets the controller property value. The pod controller. | def controller=(value)
@controller = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def controller=(value)\n @property_flush[:controller] = value\n end",
"def controller=(value)\n MSPhysics::Newton::BallAndSocket.set_controller(@address, value)\n end",
"def controller=(value)\n MSPhysics::Newton::CurvySlider.set_controller(@address, value)\n end",
"def controller=(value)... | [
"0.78167844",
"0.70102537",
"0.68996704",
"0.68996704",
"0.67232865",
"0.67232865",
"0.6556888",
"0.64945674",
"0.6165112",
"0.5875794",
"0.5875363",
"0.5569134",
"0.55170256",
"0.54999125",
"0.5486526",
"0.5445268",
"0.5434853",
"0.54136515",
"0.53007466",
"0.524773",
"0.524... | 0.7886716 | 0 |
Gets the ephemeralContainers property value. The list of pod ephemeral containers. | def ephemeral_containers
return @ephemeral_containers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ephemeral_containers=(value)\n @ephemeral_containers = value\n end",
"def containers\n @containers ||= Docker::Container.all(\n all: true, # include stopped containers\n filters: { id: container_ids }.to_json\n ).map(&:json)\n end",
"def contai... | [
"0.76161",
"0.5884932",
"0.578187",
"0.5516923",
"0.54679585",
"0.538744",
"0.5291211",
"0.5060789",
"0.5046921",
"0.49621603",
"0.4917593",
"0.4904076",
"0.480965",
"0.47854877",
"0.471142",
"0.46931335",
"0.46918225",
"0.46907508",
"0.46596503",
"0.4643486",
"0.46421877",
... | 0.80097926 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.