query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
The id of the bot. | def id
@data['id'].to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bot_user_id\n client.self.id\n end",
"def get_bot_user_id\n 1.freeze\n end",
"def id\n messaging['id']\n end",
"def id\n @message[:id]\n end",
"def donatebotguildid\n @obj['donatebotguildid']\n end",
"def id\n @id ||= scgi.session_id\n end",
"def get_id()... | [
"0.7492875",
"0.7145004",
"0.6828351",
"0.6792761",
"0.6678971",
"0.65631723",
"0.65608335",
"0.6524176",
"0.6521626",
"0.6521626",
"0.6504083",
"0.64784026",
"0.64784026",
"0.6464876",
"0.6464876",
"0.64591974",
"0.64591974",
"0.63385713",
"0.62957203",
"0.62950563",
"0.6286... | 0.0 | -1 |
The discriminator of the bot. | def discriminator
@data['discriminator']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discriminator\r\n return @user.discriminator\r\n end",
"def discriminator\n @data['discriminator'].delete('#')\n end",
"def d; @discriminator ? @discriminator.to_s[0,1] : '' end",
"def descriminator\n @obj['descriminator']\n end",
"def extract_discriminator(discriminator_and_types)\n ... | [
"0.792077",
"0.7888174",
"0.7474891",
"0.6995865",
"0.59833866",
"0.5831507",
"0.579853",
"0.5794578",
"0.5755134",
"0.5741649",
"0.5736101",
"0.5722506",
"0.5645422",
"0.5583732",
"0.5534609",
"0.5474745",
"0.5472927",
"0.52522326",
"0.5232574",
"0.50704634",
"0.5063841",
... | 0.8391878 | 0 |
The username of the bot. | def username
@data['username']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def username\n client.username if client\n end",
"def get_username\n @user_name ||= self.user.username\n end",
"def getUsername\n return @username\n end",
"def user_username\n if self.user != nil\n self.user.username\n end\n end",
"def username\n @us... | [
"0.8062878",
"0.77238953",
"0.7705438",
"0.7645001",
"0.7644177",
"0.75474536",
"0.7521821",
"0.75037754",
"0.750192",
"0.7477516",
"0.74286824",
"0.7373298",
"0.7366918",
"0.7363728",
"0.7349514",
"0.7322868",
"0.7321995",
"0.72742796",
"0.7273546",
"0.7234146",
"0.7230658",... | 0.65558755 | 94 |
Returns the bot's distinct, which is the Username and Discriminator. | def distinct
"#{username}\##{tag}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distinct\n \"#{@username}##{@discriminator}\"\n end",
"def distinct\n \"#{username}##{discriminator}\"\n end",
"def discriminator\r\n return @user.discriminator\r\n end",
"def discriminator\n @data['discriminator'].delete('#')\n end",
"def discriminator\n @data['discriminator... | [
"0.83361715",
"0.8331599",
"0.64713067",
"0.616235",
"0.6129791",
"0.58788",
"0.5749183",
"0.5722001",
"0.5635688",
"0.5559469",
"0.54806525",
"0.53527886",
"0.5283341",
"0.52264374",
"0.520877",
"0.5198146",
"0.5155019",
"0.51457155",
"0.5143911",
"0.5088014",
"0.50316375",
... | 0.5745914 | 7 |
The date when the bot was approved. | def date
Date.parse(@data['date'])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def approved_at\n closed_at if approved?\n end",
"def approval_date\n return nil unless %w[published embargoed].include?(pub_state)\n\n found_approval_date = nil\n resources.reverse_each do |res|\n res.curation_activities.each do |ca|\n next unless %w[published embargoed].inclu... | [
"0.7431418",
"0.67651254",
"0.6738638",
"0.6703081",
"0.6690571",
"0.665731",
"0.6644867",
"0.6624031",
"0.65815973",
"0.65512896",
"0.64955986",
"0.6479636",
"0.6479636",
"0.64525974",
"0.64104897",
"0.6403211",
"0.63814116",
"0.6368753",
"0.63676906",
"0.6351112",
"0.633226... | 0.0 | -1 |
The time when the bot was approved. This is compatiable with embed.timestamp, unlike date | def time
Time.parse(@data['date'])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time\n Time.parse(inner_author.date.to_s)\n end",
"def timestamp\n Time.parse(message.date.to_s).utc\n end",
"def timestamp\n _timestamp.as_time\n end",
"def timestamp\n github_updated_at.iso8601\n end",
"def say_time\n self.checkin_at.strftime(\"%l:%M %P\")\n end",
"def t... | [
"0.7061055",
"0.68999535",
"0.68606323",
"0.684544",
"0.6833263",
"0.678588",
"0.67586523",
"0.67112166",
"0.6627215",
"0.6623597",
"0.6620146",
"0.6596121",
"0.6550347",
"0.65205324",
"0.65113264",
"0.6504577",
"0.6490907",
"0.64430386",
"0.6441213",
"0.64401907",
"0.6430989... | 0.0 | -1 |
The support server invite code of the bot. | def support
@data['support']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invitee_string\n\t\n\tend",
"def guest_invite_code\n load\n @active_token_value\n end",
"def generate_invite_code\n self.invite_code = generate_token\n end",
"def invite_code\n\t\tres = {}\n\t\tuser = User.find_by_token(params[:token])\n\t\tif user\n\t\t\tres[:status] = \"0\"\n\t\t\tres... | [
"0.70289755",
"0.6589387",
"0.64403707",
"0.64236724",
"0.6257247",
"0.6091467",
"0.5895447",
"0.58351964",
"0.5833478",
"0.58174616",
"0.5806298",
"0.5789601",
"0.5763035",
"0.5735736",
"0.57155544",
"0.570927",
"0.5692362",
"0.5624558",
"0.56243086",
"0.56204176",
"0.560502... | 0.0 | -1 |
The bot's support server link, ready for clicking. | def support_link
"https://discord.gg/#{support}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def support\n \"https://discord.gg/#{@obj['support']}\"\n end",
"def tweet_link_for_new_free_episode_vland\n \t\t# TODO\n \tend",
"def test_link\n authenticated_client.link test_link_full_name\nend",
"def embed_link\n self.embed = detect_host\n end",
"def teletext_go_link _n\n send_cmd(\"... | [
"0.6924805",
"0.62200886",
"0.6217274",
"0.61601883",
"0.61130905",
"0.6088556",
"0.6065126",
"0.6062528",
"0.5938377",
"0.5877408",
"0.5833486",
"0.5826734",
"0.58211267",
"0.58144015",
"0.58131474",
"0.58131474",
"0.5785588",
"0.5765381",
"0.57633525",
"0.57588863",
"0.5739... | 0.75558776 | 0 |
Get the bot's server count | def server_count
@data['server_count'].to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def servercount\n url = \"https://discordbots.org/api/bots/#{@id}\"\n JSON.parse(RestClient.get(url))['server_count'].to_i\n end",
"def server_count\n @obj['server_count'].to_i\n end",
"def server_count(id = '__default__')\n @server_counts[id]\n end",
"def retrieve_message_count_from_serve... | [
"0.908258",
"0.8266927",
"0.76488924",
"0.7361496",
"0.7334884",
"0.7198089",
"0.7123566",
"0.7101061",
"0.69384176",
"0.68176055",
"0.6805507",
"0.6719739",
"0.67035675",
"0.6692165",
"0.66787505",
"0.65874773",
"0.64932334",
"0.6431402",
"0.64234215",
"0.64152336",
"0.64152... | 0.7773474 | 2 |
Get the bot's "This Bot Powers the following Servers" | def guilds
@data['guilds']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server\n arrayCommand( \"show server\", DictArray, RESPONSE_SERVER_INFO_FOLLOWS )\n end",
"def server\n arrayCommand( \"show server\", DictArray, RESPONSE_SERVER_INFO_FOLLOWS )\n end",
"def server\n @bot.server\n end",
"def server\n @server.to_s\n end",
"def clients\n ... | [
"0.6520951",
"0.6520951",
"0.59782106",
"0.58310574",
"0.58147246",
"0.58089465",
"0.5722382",
"0.5719981",
"0.5719981",
"0.5595996",
"0.558428",
"0.5579514",
"0.5548687",
"0.55124855",
"0.5482306",
"0.54569274",
"0.5419816",
"0.5409217",
"0.53537244",
"0.5331346",
"0.5315326... | 0.52010936 | 33 |
Get the bot's shards. | def shards
@data['shards']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shards\n @obj['shards']\n end",
"def shards\n Hashie::Mash.new(response['_shards'])\n end",
"def shards\n Hashie::Mash.new(response['_shards'])\n end",
"def all_shards\n case shard_value\n when Shard, DefaultShard\n [shard_value]\n when ::... | [
"0.8217194",
"0.7636061",
"0.75837016",
"0.72921723",
"0.72638476",
"0.6634725",
"0.61717486",
"0.614341",
"0.5923394",
"0.5802427",
"0.58010197",
"0.5696092",
"0.5678534",
"0.56735784",
"0.5631479",
"0.5533843",
"0.55261713",
"0.54390854",
"0.5424304",
"0.5418835",
"0.540447... | 0.79024786 | 1 |
The amount of upvotes the bot has this month. | def monthlypoints
@data['monthlyPoints'].to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upvote_count\n self.get_upvotes.size\n end",
"def upvote_count\n self.up_retweet_count\n end",
"def total_up_votes\r\n self.song_up_votes.size\r\n end",
"def total_upvotes\n\t\tself.get_upvotes.sum(:vote_weight)\n\tend",
"def get_vote_tally\n return self.get_upvotes.size - self.get_downv... | [
"0.73536116",
"0.7339466",
"0.7316408",
"0.7242384",
"0.72250605",
"0.7219775",
"0.7192758",
"0.71809727",
"0.71809727",
"0.71774685",
"0.715408",
"0.7129033",
"0.7124525",
"0.7048111",
"0.69715255",
"0.688405",
"0.68121606",
"0.68118423",
"0.6773395",
"0.6713233",
"0.670272"... | 0.0 | -1 |
The amount of upvotes the bot has. | def points
@data['points'].to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upvote_count\n self.get_upvotes.size\n end",
"def total_upvotes\n\t\tself.get_upvotes.sum(:vote_weight)\n\tend",
"def total_up_votes\r\n self.song_up_votes.size\r\n end",
"def upvote_count\n self.up_retweet_count\n end",
"def votes_count\n upvotes + downvotes\n end",
"def total_up_vot... | [
"0.8598242",
"0.83213997",
"0.8246882",
"0.812431",
"0.8032341",
"0.80245626",
"0.79914135",
"0.79908335",
"0.7965877",
"0.79222864",
"0.78697103",
"0.78697103",
"0.78281194",
"0.7807789",
"0.78060967",
"0.7703279",
"0.7659153",
"0.76122034",
"0.76122034",
"0.760602",
"0.7606... | 0.0 | -1 |
The certified status of the bot. | def certified?
@data['certifiedBot']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status\n self.agent.status\n end",
"def health_status\n data.health_status\n end",
"def status\n data.status\n end",
"def status\n response = perform('status')\n DeathByCaptcha::ServerStatus.new(response)\n end",
"def status\n data[:status]\n end",
"de... | [
"0.68890375",
"0.6869434",
"0.68270963",
"0.68166333",
"0.6814354",
"0.6811638",
"0.6811638",
"0.6811638",
"0.6811638",
"0.67663926",
"0.6729659",
"0.6723688",
"0.67192614",
"0.6714498",
"0.67140186",
"0.67140186",
"0.67140186",
"0.67140186",
"0.67140186",
"0.67140186",
"0.67... | 0.6190728 | 88 |
The owners of the bot. First one in the array is the main owner. | def owners
@data['owners']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def owners\n @obj['owners']\n end",
"def owners\n return @owners\n end",
"def getOwners\r\n\t\t\t\t\treturn @owners\r\n\t\t\t\tend",
"def owners\n self.authors.collect(&:user)\n end",
"def owners_contents\n files = applicable_owners_files\n\n return [] if files.n... | [
"0.76817626",
"0.7569022",
"0.731857",
"0.72670746",
"0.7031643",
"0.6948006",
"0.68823403",
"0.68192714",
"0.6811413",
"0.6744997",
"0.66637933",
"0.6620721",
"0.65967983",
"0.647632",
"0.6427005",
"0.6375692",
"0.63692874",
"0.6320543",
"0.6292029",
"0.6254872",
"0.62253636... | 0.717446 | 4 |
The tags of the bot. | def tags
@data['tags']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags\n get.tagGuids\n end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags\n response[\"tags\"]\n end",
"def tags\... | [
"0.79410475",
"0.78739595",
"0.78739595",
"0.78739595",
"0.78739595",
"0.78739595",
"0.784895",
"0.7786277",
"0.77347594",
"0.77261347",
"0.76007974",
"0.76007974",
"0.76007974",
"0.74247366",
"0.73973405",
"0.7377139",
"0.7364117",
"0.7361104",
"0.7352626",
"0.7338126",
"0.7... | 0.73129493 | 21 |
Get the bot's donate bot guild ID. | def donatebotguildid
@data['donatebotguildid']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def donatebotguildid\n @obj['donatebotguildid']\n end",
"def bot_user_id\n client.self.id\n end",
"def guild\r\n\t\t@usr_guild\r\n\tend",
"def discord_user\n BOT.user(discord_id)\n end",
"def current_guild\n if current_user\n @current_guild || find_current_guild\n end\n ... | [
"0.83063895",
"0.6128993",
"0.5899501",
"0.5829782",
"0.5714224",
"0.5710114",
"0.57034165",
"0.56550294",
"0.56550294",
"0.5542489",
"0.5422646",
"0.5416258",
"0.53718626",
"0.53368485",
"0.53005284",
"0.5251587",
"0.52233505",
"0.5206274",
"0.5191637",
"0.51447517",
"0.5124... | 0.7555851 | 1 |
Our worker name is the same as our client's | def worker_name
@client.worker_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def worker_key; worker_options && worker_options[:worker_key]; end",
"def worker_id\n self.class.worker_id\n end",
"def exchange_name\n \"#{worker_class_name}_#{job_method}\".downcase\n end",
"def worker\n read_attribute(:worker) || extract_worker || ''\n end",
"def worker\n\n @service... | [
"0.7214953",
"0.70967156",
"0.7082547",
"0.7047857",
"0.70476234",
"0.67581546",
"0.667293",
"0.65492094",
"0.64991015",
"0.64582914",
"0.6394024",
"0.6335231",
"0.6279768",
"0.62619525",
"0.6255025",
"0.6243311",
"0.615589",
"0.6108004",
"0.6103945",
"0.6089862",
"0.6083239"... | 0.8813172 | 0 |
Put the described job in this queue Options include: => priority (int) => tags (array of strings) => delay (int) | def put(klass, data, opts = {})
opts = job_options(klass, data, opts)
@client.call('put', worker_name, @name,
(opts[:jid] || Qless.generate_jid),
klass.is_a?(String) ? klass : klass.name,
JSON.generate(data),
opts.fetch(:delay, 0),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def queue_job(priority = nil, delay = default_delay)\n args = { }\n args[:wait] = delay if delay\n args[:priority] = priority if priority\n\n enqueue(args)\n end",
"def enqueue_at(job, timestamp)\n delay = timestamp.to_i - Time.current.to_i\n sqs.send_message(\n queue_url: get_que... | [
"0.6963091",
"0.656216",
"0.63347334",
"0.6330738",
"0.6280935",
"0.6275841",
"0.6259999",
"0.62302583",
"0.62223196",
"0.6214794",
"0.6190475",
"0.6177025",
"0.612236",
"0.60895187",
"0.60471666",
"0.5993814",
"0.59936476",
"0.59919524",
"0.5977544",
"0.5967775",
"0.5913785"... | 0.55413705 | 51 |
Make a recurring job in this queue Options include: => priority (int) => tags (array of strings) => retries (int) => offset (int) | def recur(klass, data, interval, opts = {})
opts = job_options(klass, data, opts)
@client.call(
'recur',
@name,
(opts[:jid] || Qless.generate_jid),
klass.is_a?(String) ? klass : klass.name,
JSON.generate(data),
'interval', interval, opts.fetch(:offset, 0),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def submit( klass, data, opts)\n data[:root_job] = true\n if @opts[:recur] then \n recur_time = @opts[:recur].to_i\n LOGGER.info \"submitting #{klass} job, every #{recur_time} seconds\" \n # add timestamp : submit_time \n @queue.recur( klass, data, recur_time )\n ... | [
"0.63942724",
"0.6380475",
"0.6264787",
"0.62458044",
"0.6230382",
"0.6206869",
"0.6082449",
"0.6021458",
"0.5998694",
"0.5942665",
"0.58789146",
"0.5870381",
"0.5846314",
"0.5785005",
"0.5768553",
"0.5767896",
"0.5759324",
"0.57369775",
"0.5731845",
"0.5731845",
"0.57279736"... | 0.5838259 | 13 |
Pop a work item off the queue | def pop(count = nil)
jids = JSON.parse(@client.call('pop', @name, worker_name, (count || 1)))
jobs = jids.map { |j| Job.new(@client, j) }
count.nil? ? jobs[0] : jobs
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop()\n @queue.shift\n end",
"def pop\n @lock.synchronize do\n @queue.pop\n end\n end",
"def pop()\n res = @pop_queue.shift()\n return res\n end",
"def dequeue; @queue.pop end",
"def pop()\n @size -= 1 \n @queue.shift\n end",
"def ... | [
"0.84809005",
"0.8308377",
"0.8283583",
"0.82711065",
"0.8093752",
"0.80897945",
"0.7937604",
"0.7909447",
"0.7781513",
"0.77698165",
"0.77624184",
"0.7739737",
"0.7726155",
"0.7696372",
"0.76072466",
"0.7597269",
"0.7580222",
"0.7545315",
"0.7538629",
"0.7527435",
"0.7515408... | 0.0 | -1 |
Peek at a work item | def peek(count = nil)
jids = JSON.parse(@client.call('peek', @name, (count || 1)))
jobs = jids.map { |j| Job.new(@client, j) }
count.nil? ? jobs[0] : jobs
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def peek()\n @queue.first\n end",
"def peek\n item = pop\n push(item)\n item\n end",
"def peek\n\t\t@queue.first\n\tend",
"def peek\n raise QueueUnderflow if empty?\n @info[0]\n end",
"def peek_item(key)\n leaf = find_key(key)\n return nil unless leaf\n leaf.peek_item\n ... | [
"0.6863418",
"0.6792025",
"0.6774338",
"0.66725725",
"0.66642904",
"0.6650124",
"0.6650124",
"0.6587897",
"0.6587897",
"0.65386117",
"0.645385",
"0.643278",
"0.63838625",
"0.63814753",
"0.6330936",
"0.63211864",
"0.63159037",
"0.6296214",
"0.62462574",
"0.6234798",
"0.6215560... | 0.0 | -1 |
How many items in the queue? | def length
(@client.redis.multi do
%w[ locks work scheduled depends ].each do |suffix|
@client.redis.zcard("ql:q:#{@name}-#{suffix}")
end
end).inject(0, :+)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def queue_count()\n @queue.length\n end",
"def count\n\t\t@queue.length\n\tend",
"def length\n @queue.length\n end",
"def size\n\n @queue.size\n end",
"def length\n @queue.length\n end",
"def queue_count\n @queues.length\n end",
"def size\n @queue.size\n end",
... | [
"0.8697317",
"0.8576166",
"0.8398099",
"0.8388158",
"0.8376883",
"0.83763623",
"0.8347757",
"0.8336542",
"0.8327527",
"0.82330906",
"0.82101643",
"0.8198702",
"0.8109573",
"0.7954994",
"0.79519343",
"0.7933486",
"0.7894917",
"0.78716093",
"0.78693813",
"0.7869101",
"0.7813625... | 0.0 | -1 |
Supposed to indicate inplace progress while iterating over array | def progress(array)
array.each_with_index {|e,i|
printf ANSI.left(50) + "Starting item #{i +1} ..."
yield(e)
}
print "\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_resistant_for_each_element(array)\n copy =Array.new(array)\n i=0\n while i<copy.length\n copy[i]=array[i]\n i +=1\n end\n copy\nend",
"def each(arr)\n # set index value, beginning with the first element at 0\n i = 0\n # while the current index value still exists in the array, run the blo... | [
"0.6660551",
"0.6413138",
"0.5901344",
"0.58210987",
"0.58013785",
"0.5773164",
"0.5766356",
"0.57397646",
"0.5709344",
"0.567642",
"0.56609327",
"0.5639308",
"0.55939126",
"0.5588356",
"0.5585354",
"0.5583895",
"0.55675113",
"0.55669737",
"0.5546904",
"0.55364543",
"0.553624... | 0.6067281 | 2 |
Table cell formatting methods | def render_column(record, column)
# check for an override helper
if column_override? column
# we only pass the record as the argument. we previously also passed the formatted_value,
# but mike perham pointed out that prohibited the usage of overrides to improve on the
# performa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ansi_formatting(cell, col, row); end",
"def format_table!\n table.rows.each do |row|\n row.cells.each_with_index do |cell, i|\n set_cell_format_option!(cell, i)\n format_cell!(cell)\n end\n end\n\n true\n end",
"def output\n # If there are neither head... | [
"0.77675885",
"0.76549137",
"0.7381117",
"0.72931874",
"0.7050127",
"0.6987",
"0.6876773",
"0.67983645",
"0.6795178",
"0.6795178",
"0.67340446",
"0.67337173",
"0.6707809",
"0.6679379",
"0.6679379",
"0.6661883",
"0.66221654",
"0.6610619",
"0.6592059",
"0.6515826",
"0.6495567",... | 0.0 | -1 |
There are two basic ways to clean a column's value: h() and sanitize(). The latter is useful when the column contains valid html data, and you want to just disable any scripting. People can always use field overrides to clean data one way or the other, but having this override lets people decide which way it should hap... | def clean_column_value(v)
h(v)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before_validation\n\t\tself.class.columns.each do |c|\n\t\t\tif self[c.name] and [:string, :text].include?(c.class)\n\t\t\t\tself[c.name] = RailsSanitize.full_sanitizer.sanitize(self[c.name]) \n\t\t\tend\n\t\tend\t\t\n\tend",
"def sanitize\n # ui_enabled only for the belongs_to, has_many and many_to... | [
"0.69864655",
"0.6748851",
"0.6740762",
"0.6677431",
"0.65485466",
"0.64983064",
"0.64685947",
"0.6337568",
"0.62752724",
"0.6251896",
"0.6237868",
"0.6237868",
"0.6217972",
"0.61867297",
"0.61059034",
"0.6061962",
"0.606185",
"0.6055412",
"0.60427874",
"0.6036102",
"0.598608... | 0.63682055 | 7 |
Currencies can only be created (added), no update or delete is possible | def create_method
:http_put
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def currency_should_be_in_supported\n self.errors.add(:currency, 'exchange rate can not be found and is not supported') if self.currency.present? && !Currency.exists?(:iso_code => self.currency)\n end",
"def currencies\n raise NotImplementedError\n end",
"def create?\n @current_user.pe... | [
"0.66688645",
"0.66096276",
"0.6552772",
"0.64573544",
"0.6442208",
"0.6442208",
"0.628354",
"0.62708753",
"0.6267978",
"0.62511057",
"0.61944675",
"0.618802",
"0.61686003",
"0.61386085",
"0.6058988",
"0.6053636",
"0.60399973",
"0.60302234",
"0.6021394",
"0.60137475",
"0.5998... | 0.0 | -1 |
Post an image with OCR Post an image and apply OCR on it to obtain found metadata. | def ocr_post(file, opts = {})
ocr_post_with_http_info(file, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_ocr_post_with_http_info(image_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ImageOcrApi.image_ocr_post ...'\n end\n # verify the required parameter 'image_file' is set\n if @api_client.config.client_side_validation && image_f... | [
"0.70446455",
"0.688707",
"0.68286383",
"0.6568034",
"0.65672284",
"0.6468922",
"0.63702047",
"0.63039446",
"0.62237984",
"0.60770863",
"0.60248137",
"0.5985974",
"0.59636545",
"0.5951802",
"0.5951431",
"0.5920967",
"0.5877516",
"0.5854009",
"0.5803683",
"0.5787143",
"0.57406... | 0.6513393 | 5 |
Post an image with OCR Post an image and apply OCR on it to obtain found metadata. | def ocr_post_with_http_info(file, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: OCRApi.ocr_post ...'
end
# verify the required parameter 'file' is set
if @api_client.config.client_side_validation && file.nil?
fail ArgumentError, "Missing... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_ocr_post_with_http_info(image_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ImageOcrApi.image_ocr_post ...'\n end\n # verify the required parameter 'image_file' is set\n if @api_client.config.client_side_validation && image_f... | [
"0.7042894",
"0.68861556",
"0.68268114",
"0.65674317",
"0.656596",
"0.6513663",
"0.64678246",
"0.6367641",
"0.63029635",
"0.6222123",
"0.60756576",
"0.60224533",
"0.59855366",
"0.5961546",
"0.59515995",
"0.595084",
"0.58760655",
"0.58520705",
"0.58030313",
"0.5786029",
"0.574... | 0.592063 | 16 |
Post an image with OCR Post an image and apply OCR on it to obtain found metadata. | def users_id_user_ocr_post(id_user, file, opts = {})
users_id_user_ocr_post_with_http_info(id_user, file, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_ocr_post_with_http_info(image_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ImageOcrApi.image_ocr_post ...'\n end\n # verify the required parameter 'image_file' is set\n if @api_client.config.client_side_validation && image_f... | [
"0.7043396",
"0.68848026",
"0.68276954",
"0.65665084",
"0.6565643",
"0.65140647",
"0.64686507",
"0.63690895",
"0.63028365",
"0.6223075",
"0.6075612",
"0.60239935",
"0.5984751",
"0.596284",
"0.5950588",
"0.5949103",
"0.5921299",
"0.5875906",
"0.58540905",
"0.58036345",
"0.5786... | 0.0 | -1 |
Post an image with OCR Post an image and apply OCR on it to obtain found metadata. | def users_id_user_ocr_post_with_http_info(id_user, file, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: OCRApi.users_id_user_ocr_post ...'
end
# verify the required parameter 'id_user' is set
if @api_client.config.client_side_validation && id_use... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_ocr_post_with_http_info(image_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ImageOcrApi.image_ocr_post ...'\n end\n # verify the required parameter 'image_file' is set\n if @api_client.config.client_side_validation && image_f... | [
"0.7042894",
"0.68861556",
"0.68268114",
"0.65674317",
"0.656596",
"0.6513663",
"0.64678246",
"0.6367641",
"0.63029635",
"0.6222123",
"0.60756576",
"0.60224533",
"0.59855366",
"0.5961546",
"0.59515995",
"0.595084",
"0.592063",
"0.58760655",
"0.58520705",
"0.58030313",
"0.5786... | 0.0 | -1 |
Versions from MoxieCode (latest to 3.5.9) | def moxiecode_versions
versions = {}
page = Nokogiri::HTML(Typhoeus.get('https://github.com/tinymce/tinymce/releases').body)
page.css('span.tag-name').each do |node|
version = node.text.strip
if version =~ /\A[0-9\.]+\z/
versions[version] = "http://download.moxiecode.com/tinymce/ti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def target_version; end",
"def major_version; end",
"def minor_version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def versio... | [
"0.62627256",
"0.62441915",
"0.608816",
"0.6069544",
"0.6069544",
"0.6069544",
"0.6069544",
"0.6069544",
"0.6069544",
"0.6069544",
"0.6069544",
"0.6069544",
"0.6069544",
"0.6069544",
"0.6069544",
"0.6069544",
"0.6069544",
"0.6069544",
"0.6069544",
"0.6069544",
"0.6069544",
... | 0.7000504 | 0 |
Versions from GitHub (< 3.5.9) | def github_versions
versions = {}
page = Nokogiri::HTML(Typhoeus.get('https://github.com/tinymce/tinymce/downloads').body)
page.css('h4 a').each do |node|
version = node.text.strip[/\Atinymce_([0-9.]+).zip\z/, 1]
if version
versions[version] = "https://github.com/downloads/tinymce/... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def version\n '1.5.1.2' # Version number <major>.<minor>.<patch>.<monthly commit>\n end",
"def moxiecode_versions\n versions = {}\n page = Nokogiri::HTML(Typhoeus.get('https://github.com/tinymce/tinymce/releases').body)\n\n page.css('span.tag-name').each do |node|\n version = node.text.... | [
"0.6615923",
"0.6277431",
"0.6196335",
"0.61823964",
"0.6167347",
"0.61660326",
"0.6147548",
"0.6112843",
"0.6090786",
"0.6073516",
"0.6047246",
"0.6031123",
"0.60091865",
"0.5980138",
"0.5959381",
"0.5956372",
"0.59473723",
"0.5933922",
"0.5932188",
"0.592936",
"0.59069806",... | 0.718187 | 0 |
USE THE ones above if possible, it makes the output more uniform and easier to read/parse Stuff funnels to here, which propogates up to the client class | def output(msg, options={})
self.client_class.otm_output("[#{self.class.to_s}]#{msg}",options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def formatted_client_display_info\n output_info = []\n output_info << \"Name: #{@name}\"\n output_info << \"Age: #{@age}\"\n output_info << \"Children: #{@number_of_children}\"\n output_info << \"Pets: #{self.number_of_pets}\"\n @pets.each { |k, pet| output_info << \" #{pet.name} i... | [
"0.62147236",
"0.59337837",
"0.57533574",
"0.57029104",
"0.565431",
"0.565431",
"0.5651787",
"0.5619195",
"0.5501951",
"0.550193",
"0.54972136",
"0.54972136",
"0.5424921",
"0.5393026",
"0.5388294",
"0.5384478",
"0.53770906",
"0.53770906",
"0.53676426",
"0.5357385",
"0.5338374... | 0.5118755 | 82 |
Client classes call this method | def execute
self.started
self.execute_internal
self.finished
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client; end",
"def client; end",
"def client\n end",
"def clientserver\n end",
"def call\n\n\tend",
"def call\n\n\tend",
"def call\n raise \"Must subclass and implement call\"\n end",
"def call\n # implement in subclasses\n end",
"def client_access\n super\n end",
... | [
"0.74042475",
"0.74042475",
"0.72496766",
"0.6813089",
"0.6707499",
"0.6707499",
"0.6685936",
"0.6653083",
"0.65759194",
"0.64803547",
"0.64803547",
"0.64803547",
"0.64803547",
"0.64803547",
"0.64803547",
"0.64803547",
"0.64803547",
"0.64803547",
"0.64803547",
"0.64803547",
"... | 0.0 | -1 |
Commands should override this if they use temp files that need to be cleaned up The cleanup_temp_files_and_tables command reflects on all commands to find and delete things referenced in here | def temp_file_symbols
[]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup\n File.delete(temp_file_path)\n end",
"def clean_up\n FileUtils.rm_rf @temp_root\n end",
"def cleanup()\n @definition.temporary_files.each do |file|\n if File.exists?(file) && File.writable?(file)\n File.delete(file)\n end\n end\n if @environment.verbose\n put... | [
"0.76265687",
"0.7301537",
"0.72296184",
"0.71657526",
"0.7021612",
"0.7006452",
"0.68882227",
"0.6833775",
"0.6820984",
"0.6801503",
"0.6769087",
"0.67392224",
"0.6666032",
"0.66120154",
"0.65864336",
"0.6563931",
"0.6540539",
"0.6523131",
"0.64986235",
"0.64895165",
"0.6483... | 0.0 | -1 |
define accessor methods for our instance variables | def initialize(state_territory=5, ilf_factor=6)
@state_territory, @ilf_factor = state_territory, ilf_factor # internal instance variablesj
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getters; end",
"def accessors\n self.class.accessors\n end",
"def attr_reader(*)\n end",
"def instance_variables() end",
"def accessor\n @@accessor ||= nil\n @@accessor\n end",
"def instance_variables; end",
"def create_getters\n instance_variables.each do |v|\n ... | [
"0.7899338",
"0.73353696",
"0.7299499",
"0.7283082",
"0.7244661",
"0.7047644",
"0.69753426",
"0.6938228",
"0.6903868",
"0.6821089",
"0.68001497",
"0.6770021",
"0.67337966",
"0.6707227",
"0.6707227",
"0.6707227",
"0.6707227",
"0.6707227",
"0.6707227",
"0.6707227",
"0.6651274",... | 0.0 | -1 |
make svn tag for new release version | def svn_make_tag()
result = false
Dir.chdir(PATH_ROOT) do
cmd_svn_copy = "svn copy svn://192.168.1.5/penguin/trunk svn://192.168.1.5/penguin/tags/#{@pkgtag} -m \"make tag for release version #{@pkgtag}.\""
result = call_system_command(cmd_svn_copy)
puts "make tag failed, and return #{result}."... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tag_release(tag)\n unless this_version == extract_version\n puts \"Committing buildfile with version number #{extract_version}\"\n Perforce.p4 'edit', Rake.application.rakefile.to_s\n Perforce.commit message\n end\n puts \"Tagging release #{tag}\"\n Perforce.p4 'tag', '... | [
"0.73810744",
"0.7306071",
"0.7212479",
"0.71123743",
"0.705366",
"0.6880854",
"0.67567474",
"0.674701",
"0.67290497",
"0.66257274",
"0.6482455",
"0.6460406",
"0.6458589",
"0.6424459",
"0.64160454",
"0.64012945",
"0.63372344",
"0.63154924",
"0.62751746",
"0.62362826",
"0.6181... | 0.7494871 | 0 |
make git tag for new release version | def git_make_tag()
result = false
Dir.chdir(PATH_ROOT) do
cmd_git_tag = "git tag -a #{@pkgtag} -m \"make tag for release version #{@pkgtag}.\""
result = call_system_command(cmd_git_tag)
puts "make tag failed, and return #{result}." unless result
end
return result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tag_release(version)\n system \"git tag v#{version}\"\n system \"git push origin v#{version}\"\n end",
"def tag_release(tag)\n unless this_version == extract_version\n puts \"Committing buildfile with version number #{extract_version}\"\n Perforce.p4 'edit', Rake.application.rakefil... | [
"0.83804256",
"0.77183396",
"0.76917696",
"0.76479834",
"0.7643971",
"0.762629",
"0.760114",
"0.75263476",
"0.71540743",
"0.6803022",
"0.67795646",
"0.67297083",
"0.6717412",
"0.6710155",
"0.6692578",
"0.6685974",
"0.6658442",
"0.6647478",
"0.65689224",
"0.6543107",
"0.653398... | 0.74054396 | 8 |
generate source code from ruby script | def generate
puts "current path should be: " + PATH_SCRIPT + "/core"
result = false
Dir.chdir(PATH_SCRIPT+"/core") do
result = call_system_command(CMD_BUILD_GENERATE)
puts "generating source code failed, and return #{result}." unless result
end
Dir.chdir(PATH_SCRIPT+"/is") do
resul... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_source\n b = binding\n @generated_code = ERB.new(@artifact.code).result(b)\n end",
"def script; end",
"def script; end",
"def compile_script_string\n @sources.string\n end",
"def source(filename); end",
"def interpret(source)\n c = compile(source)\n ci = cifrom(c)\n ci.run\nend... | [
"0.7545766",
"0.68911374",
"0.68911374",
"0.6816872",
"0.6673537",
"0.6660818",
"0.6647424",
"0.6575757",
"0.6505119",
"0.6497128",
"0.6492651",
"0.64650035",
"0.64170974",
"0.6414344",
"0.6349477",
"0.63394153",
"0.6337125",
"0.6322221",
"0.631715",
"0.6314517",
"0.6253912",... | 0.0 | -1 |
run cmake to generate Makefile | def run_cmake()
result = false
Dir.chdir(PATH_BUILD) do
result = call_system_command(CMD_BUILD_CMAKE)
puts "penguin cmake failed, and return #{result}." unless result
end
return result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build\n cd_and_sh( pkg_dir, build_commands )\n end",
"def build_files_command\n \"middleman build\"\n end",
"def compilation_with_makefile\n # Build the program\n depend_msg = `make depend 2>&1`\n build_msg = `make 2>&1`\n \n @log_file.puts \"\\nConstruction des dépendances :\\n\... | [
"0.63850814",
"0.63154924",
"0.61458063",
"0.61077374",
"0.6081137",
"0.6077997",
"0.6049884",
"0.6045607",
"0.6022029",
"0.5989138",
"0.59891176",
"0.59344876",
"0.5830801",
"0.5813254",
"0.5792461",
"0.57865196",
"0.5775243",
"0.574503",
"0.57401294",
"0.5725353",
"0.570785... | 0.54245704 | 39 |
run make program to generate exetable file | def run_make()
result = false
Dir.chdir(PATH_BUILD) do
result = call_system_command(CMD_BUILD_MAKE)
puts "penguin make failed, and return #{result}." unless result
end
return result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def makefile_generator\n printf(\"%-10s %s\\n\",\"makefile:\", \"generating..\")\n IO.popen(\"xps -nw\", \"w+\") do |pipe|\n pipe.puts \"xload xmp system.xmp\"\n pipe.puts \"save make\"\n pipe.puts \"exit\"\n pipe.close_write\n output = pipe.readlines\n output.delete_if { |x| x !~... | [
"0.605133",
"0.57570344",
"0.5662107",
"0.56537515",
"0.56445897",
"0.5623538",
"0.5504151",
"0.5457477",
"0.5445967",
"0.5395663",
"0.5372715",
"0.5326006",
"0.53149116",
"0.5288395",
"0.52655244",
"0.5265334",
"0.5251384",
"0.52349764",
"0.51863074",
"0.5176794",
"0.5160808... | 0.0 | -1 |
diagonals = [] column = 1 element = 0 loop do diagonal = [] loop do inner_column_counter = column inner_element_counter = element diagonal << grid[inner_column_counter][inner_element_counter] if diagonal.empty? unless inner_element_counter == 0 diagonal << grid[inner_column_counter + 1][inner_element_counter 1] inner_c... | def add_piece(column, symbol) #todo: extract position finding ?
position = grid[column].inject { |memo, space| memo > space.to_i ? memo : space }
available_index = grid[column].index(position)
grid[column][available_index] = symbol
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_diagonal_up(row,col)\n array_diagonals =[]\n 0.upto(5).each do |num|\n if ( row - num < 0 || col + num > 6)\n break\n end\n\n array_diagonals << [row-num, col+num] \n end\n array_diagonals.map{|coordinates| @grid[coordinates[1]][coordinates[0]]}\n end",
"def diagonals\n... | [
"0.7775712",
"0.73774517",
"0.7364526",
"0.7301381",
"0.71119964",
"0.7002612",
"0.6995047",
"0.69829273",
"0.69791204",
"0.6954035",
"0.6929785",
"0.690199",
"0.68625754",
"0.6828905",
"0.6771762",
"0.6743712",
"0.6725238",
"0.66811055",
"0.6680767",
"0.667944",
"0.66468227"... | 0.0 | -1 |
Creates a connection to redis | def redis(r_pool = nil, &block)
r_pool ||= defined?(redis_pool) ? redis_pool : r_pool
if r_pool
r_pool.with(&block)
else
Sidekiq.redis(&block)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect\n @redis ||= create\n end",
"def redis\n parms =\n {\n :host => @host,\n :port => @port,\n :db => @database\n }\n\n $_redis_connection ||= Redis.new(parms)\n end",
"def generate_redis_connection!\n redis_options ? Redis.ne... | [
"0.8591651",
"0.8263129",
"0.7999092",
"0.77221453",
"0.7686249",
"0.76691395",
"0.7648173",
"0.7612802",
"0.7553954",
"0.75030524",
"0.7502405",
"0.73684484",
"0.72687393",
"0.72407204",
"0.720404",
"0.7198779",
"0.7198779",
"0.7198779",
"0.7192749",
"0.71900153",
"0.7169956... | 0.63580066 | 69 |
Get users full name, for display purposes | def full_name
self.user_fname.capitalize + " " + self.user_lname.capitalize
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_name\n if user_data\n \"#{user_data['first_name']&.downcase&.capitalize} #{user_data['last_name']&.downcase&.capitalize}\"\n end\n end",
"def full_name\n name = `finger $USER 2> /dev/null | grep Login | colrm 1 46`.chomp\n name.empty? ? \"John Doe\" : na... | [
"0.87141585",
"0.8509198",
"0.8479577",
"0.8461775",
"0.8389541",
"0.8386491",
"0.8375583",
"0.83304006",
"0.83232546",
"0.831478",
"0.8296759",
"0.8266589",
"0.82476276",
"0.822301",
"0.822301",
"0.822301",
"0.8199219",
"0.8178793",
"0.8178793",
"0.8170586",
"0.81682944",
... | 0.831922 | 9 |
Increment User login count | def increment_login
current_count = self.sign_in_count
self.sign_in_count = current_count + 1
self.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def increment_count\n session[:count] += 1\n @count = session[:count]\n end",
"def total_users()\n\t\t@@total_users += 1\n\t\tputs \"Total users : #@@total_users\"\n\tend",
"def initialize\n @@count_user += 1\n end",
"def increment_password_reset_page_access_counter\n sorcery_adapter.in... | [
"0.7185455",
"0.6974441",
"0.68010974",
"0.6778331",
"0.6761459",
"0.6677878",
"0.6669725",
"0.66386366",
"0.65955085",
"0.6591572",
"0.65114236",
"0.64859766",
"0.6469335",
"0.64529765",
"0.64153355",
"0.6354876",
"0.62702894",
"0.62170213",
"0.61911494",
"0.6161986",
"0.611... | 0.80106956 | 0 |
Selection of categories the current user can view in the tree navigation | def permitted_categories
@current_folder = DocumentFolder.new
@permitted_categories = upload_permitted_categories
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list\r\n\t\t@current_area = 'categories'\r\n\t\t@current_menu = 'products'\r\n\r\n\t\tif params[:select]\r\n\t\t\tif params[:delete]\r\n\t\t\t\t# you MUST manually move child nodes in an acts_as_tree up before calling\r\n\t\t\t\t# the destroy! method. Otherwise Rails will automatically go and delete all\r\n\t\... | [
"0.6851861",
"0.68355775",
"0.6714066",
"0.6585149",
"0.6538206",
"0.6522353",
"0.647996",
"0.6479893",
"0.64217144",
"0.6396552",
"0.6382879",
"0.6359014",
"0.62874955",
"0.62778693",
"0.62033385",
"0.61365855",
"0.6119414",
"0.61191773",
"0.6110272",
"0.6104451",
"0.6072867... | 0.591606 | 35 |
A hash that uniquely identifies the test. If anything changes about the test (name, type, values, whatever) the hash changes and the test restarts from scratch. This is to prevent people from modifying tests while they run, which would give them bad results. | def hash
raw = [name, type, values.join('/')].join(' ')
Digest::MD5.hexdigest(raw)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [device, duration, execution_rule, location, result_id, retries, status, test_name, test_public_id, test_type].hash\n end",
"def ensure_hash_id\n self.hash_id ||= unique_random_string_of_length(75 + Random.rand(26))\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def... | [
"0.66391516",
"0.63129264",
"0.62934285",
"0.62934285",
"0.62934285",
"0.62934285",
"0.62934285",
"0.62934285",
"0.62934285",
"0.6281677",
"0.6252918",
"0.6231024",
"0.61914504",
"0.61598724",
"0.61308",
"0.5995035",
"0.59667844",
"0.5930467",
"0.5924469",
"0.58769894",
"0.58... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def new_link_params
params.require(:link).permit(:original)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_weight
@weight = Weight.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163754",
"0.6045816",
"0.5944853",
"0.59169096",
"0.58892167",
"0.58342934",
"0.5776148",
"0.57057375",
"0.57057375",
"0.56534296",
"0.56209534",
"0.54244673",
"0.54101455",
"0.54101455",
"0.54101455",
"0.53951085",
"0.5378493",
"0.53563684",
"0.53399915",
"0.5338049",
"0... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def weight_params
params.require(:weight).permit(:date, :time, :value, :unit, :kitten_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
this above line is just so we can write this out faster.. the above methods will use the find_post method, so this just helps it happen faster | def index
@posts = Post.all.order("created_at DESC")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_posts(doc, t)\n doc.search('post').each do |post|\n post_url = post['url']\n small_image_url = post.search('photo-url[@max-width=\"400\"]').first\n if small_image_url\n small_image_url = small_image_url.content\n max_image_url = post.search('photo-url[@max-width... | [
"0.6614308",
"0.63333625",
"0.6318777",
"0.6313547",
"0.6278745",
"0.6267675",
"0.62569743",
"0.61626905",
"0.61556274",
"0.6151941",
"0.6120385",
"0.61076945",
"0.61035144",
"0.6084569",
"0.6029598",
"0.60107917",
"0.5949007",
"0.5931088",
"0.58721924",
"0.5866373",
"0.58521... | 0.0 | -1 |
this is the main execution entry point for backupEBS_stripe.rb | def execute_backup_stripe(options={})
@disk.sync
# Ensure filesystem is frozen and uses retry
raise "FATAL: unable to freeze lvm filesystem!" unless @disk.freeze
create_opts = {
:lineage => options[:lineage],
:prefix_override => options[:lineage], #Make sure we use the volume_nic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_stripe(server)\n options = { \"EBS_MOUNT_POINT\" => \"text:/mnt/mysql\", \n \"EBS_STRIPE_COUNT\" => \"text:#{@stripe_count}\", \n \"EBS_VOLUME_SIZE\" => \"text:1\", \n \"DBAPPLICATION_USER\" => \"text:someuser\", \n \"DB_MYSQLDUMP_BUCKET\" => \"ig... | [
"0.65693045",
"0.6435294",
"0.63122964",
"0.62802184",
"0.62314534",
"0.6218103",
"0.5984167",
"0.587021",
"0.5815626",
"0.5736511",
"0.5648879",
"0.56454396",
"0.5642275",
"0.55786043",
"0.5544408",
"0.5540319",
"0.545227",
"0.5451259",
"0.54137903",
"0.5357728",
"0.5348001"... | 0.7108549 | 0 |
creates an ebs stripe from scratch | def create_ebs_stripe(nickname, new_volume_size_in_gb, options = {})
self.execute_terminate_volumes if options[:force]
devices = @disk.generate_physical_device_names(options[:stripe])
each_volume_size = (new_volume_size_in_gb / options[:stripe].to_f).ceil
devices.each do |d|
vol = self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_stripe(server)\n options = { \"EBS_MOUNT_POINT\" => \"text:/mnt/mysql\", \n \"EBS_STRIPE_COUNT\" => \"text:#{@stripe_count}\", \n \"EBS_VOLUME_SIZE\" => \"text:1\", \n \"DBAPPLICATION_USER\" => \"text:someuser\", \n \"DB_MYSQLDUMP_BUCKET\" => \"ig... | [
"0.62871754",
"0.6195486",
"0.57787514",
"0.5729213",
"0.5713461",
"0.5683139",
"0.56690466",
"0.55162346",
"0.5496129",
"0.54532427",
"0.5419798",
"0.53639984",
"0.5357744",
"0.53558534",
"0.53524953",
"0.5326179",
"0.5296797",
"0.5294718",
"0.52915394",
"0.5279271",
"0.5257... | 0.67532164 | 0 |
this is the main execution entry point for restoreEBS_stripe.rb | def execute_restore_stripe(options={})
new_vol_name = "#{options[:lineage]}-#{ENV['EC2_INSTANCE_ID']}"
json_result = self.find_latest_ebs_backup(options[:lineage], options[:from_master], options[:timestamp])
if json_result.nil?
STDERR.puts "No existing snapshot found for the specified nickna... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute_backup_stripe(options={})\n @disk.sync\n\n# Ensure filesystem is frozen and uses retry\n raise \"FATAL: unable to freeze lvm filesystem!\" unless @disk.freeze\n\n create_opts = {\n :lineage => options[:lineage],\n :prefix_override => options[:lineage], #Make sure we use... | [
"0.67334485",
"0.60254025",
"0.5858325",
"0.58121705",
"0.5799266",
"0.57987696",
"0.5738887",
"0.56718594",
"0.5667771",
"0.5647373",
"0.5591335",
"0.5581901",
"0.5574891",
"0.5568679",
"0.55400056",
"0.55333924",
"0.5476714",
"0.53952044",
"0.5394107",
"0.53734225",
"0.5362... | 0.70894825 | 0 |
detaches and deletes an ebs volume by device name (eg. /dev/sdj) | def terminate_device(dev, keep_volume=true)
vol_info = detach_volume(dev)
wait_for_detachment(dev)
delete_volume(vol_info['aws_id']) unless vol_info.nil? || keep_volume
#depricating this rescue block -> see wait_for_detachment
rescue Exception => e
display_exception(e, "terminate_devi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def terminate_volume\n device = get_device_mount_point(self.MountPoint)\n STDERR.puts \"EBS device detected: #{device}...umounting it...\"\n umount_dir(self.MountPoint)\n #detache the mounted volume\n STDERR.puts \"Detaching current EBS volume:\"\n detached_vol=detach_volume(device)\n... | [
"0.74402183",
"0.7382925",
"0.69691515",
"0.66015077",
"0.6526764",
"0.6526527",
"0.6505786",
"0.64867806",
"0.6482002",
"0.647243",
"0.64626384",
"0.63437116",
"0.6319882",
"0.6308546",
"0.6290217",
"0.6276373",
"0.6253235",
"0.6226336",
"0.61758894",
"0.6101493",
"0.6084223... | 0.70384747 | 2 |
Options: suffix, description, tag, max_snapshots, prefix_override (if we want to use a prefix different than the volume name) | def create_snapshot(device, options = {})
# TODO - add in new param commit=explicit once the API is availible
params = {:device => device,
:suffix => options[:suffix],
:description => options[:description],
:tag => options[:tag],
:max_snaps => options[:max_snaps],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def option_definitions\n [\n { :short => 'v', :long => 'volume_store', :argument => :optional,\n :desc => 'specifify the ZFS root of the new iSCSI volume. Defaults to \"store/volumes\".'\n },\n { :short => 'n', :long => 'name', :argument => :optional,\n :desc => 'the nam... | [
"0.5549338",
"0.54717207",
"0.546016",
"0.54438686",
"0.5434042",
"0.5373833",
"0.5321772",
"0.5246649",
"0.52301294",
"0.5214581",
"0.5209563",
"0.5204918",
"0.5164329",
"0.51575637",
"0.5135169",
"0.51116073",
"0.51067746",
"0.509431",
"0.5090451",
"0.5063596",
"0.5055288",... | 0.0 | -1 |
Options: devices, suffix, description, tag, max_snapshots, prefix_override (if we want to use a prefix different than the volume name) | def create_ebs_backup(options = {})
params = options.merge( { :commit => "explicit", :api_version => 1.0 } )
STDERR.puts "Performing RightScale API call to create a new snapshot"
json=nil
SystemTimer.timeout_after(@api_snap_timeout) do
body = RestClient.post @api_url+"/create_ebs_backup.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snapshot_devices(devices, prefix, limit = 0, name = \"#{instance_id}\")\n log \"Snapshot limit set to #{limit} (0 means never purge)\"\n ts = DateTime.now.strftime(\"%Y-%m-%d-%H-%M\").to_s\n name = \"#{prefix} \" + name\n volumes = {}\n devices.each do |device|\n volumes[device] = find_volu... | [
"0.59216034",
"0.57878584",
"0.5687851",
"0.55016327",
"0.5450435",
"0.54348654",
"0.52941334",
"0.5292966",
"0.5221045",
"0.5173695",
"0.5142509",
"0.51386386",
"0.51373804",
"0.51063216",
"0.5101975",
"0.5032558",
"0.5021115",
"0.5011926",
"0.50054246",
"0.50047463",
"0.497... | 0.0 | -1 |
Set EBS snapshot commit state: commit_state=[committed|uncommitted] | def update_snapshot(aws_id,commit_state)
params = {:aws_id => aws_id, :commit_state => commit_state, :api_version => 1.0 }
json=nil
SystemTimer.timeout_after(@api_snap_timeout) do
body = RestClient.put @api_url+"/update_ebs_snapshot.js",params
puts "UPDATED SNAP: #{aws_id}"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_stage_commit\n @stage_commit = StageCommit.find(params[:id])\n end",
"def set_commit\n @commit = Commit.find_by_sha(params[:sha])\n end",
"def set_versioning_state(state)\n raise Error::Constraint.new(\"Can only set a different version state on PWC documents, or unsaved new documents\"... | [
"0.56749034",
"0.53865254",
"0.5226118",
"0.5092154",
"0.5023563",
"0.49376148",
"0.492903",
"0.4922484",
"0.4920091",
"0.4896585",
"0.4896409",
"0.48611125",
"0.4820641",
"0.4813275",
"0.4791914",
"0.47846296",
"0.4736003",
"0.47229472",
"0.47176355",
"0.469737",
"0.4687285"... | 0.5839908 | 0 |
Creates a volume of a given size, in the zone the current machine exists | def create_volume(options={})
raise "Volume nickname required" unless options[:nickname]
params = {:nickname => options[:nickname],:size => options[:size], :api_version => 1.0}
params[:description] = options[:description] if options[:description]
#STDERR.puts "HERE IS THE URL: #{@api_url}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(size)\n disk_id = uuid\n sh \"zfs create -o reservation=1024 -o quota=1024 #{base}/#{disk_id}\"\n disk_id\n end",
"def create_volume(size_or_snapshot_id, options = {})\n options = {:device => '/dev/sdh'}.merge(options)\n if size_or_snapshot_id.is_a?(Numeric)\n ... | [
"0.78046715",
"0.7452656",
"0.73496",
"0.7240974",
"0.7132571",
"0.7109873",
"0.70260096",
"0.7025153",
"0.6977844",
"0.697593",
"0.6934374",
"0.6934374",
"0.69182956",
"0.69056445",
"0.6857586",
"0.6853",
"0.6850448",
"0.68077",
"0.6796762",
"0.6733335",
"0.6687409",
"0.65... | 0.6308157 | 25 |
this will attempt to display any restclient related information about the exception and simply inspect the exception if none is available. optional display name will print any custom information. | def display_exception(e, display_name=nil)
STDERR.puts "CAUGHT EXCEPTION in: #{display_name}"
STDERR.puts e.inspect
if e.respond_to?(:response)
STDERR.puts e.response
if e.response.respond_to?(:body)
STDERR.puts "RESPONSE BODY: #{e.response.body}"
end
end
en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_detailed_exceptions?; end",
"def formatted_exception\n @exception && \"#{@exception.class.name}: #{@exception.message}\"\n end",
"def exception_details(e, msg); end",
"def humanize_exception(e)\n case e\n when SystemExit\n raise # make sure exit passes through.\n when Net::... | [
"0.71416485",
"0.65971947",
"0.6593374",
"0.6442042",
"0.64286923",
"0.6307704",
"0.62513167",
"0.62513167",
"0.6245177",
"0.61981577",
"0.6159509",
"0.61200887",
"0.611725",
"0.6058352",
"0.60579246",
"0.60431707",
"0.6011861",
"0.59884816",
"0.5978126",
"0.59516436",
"0.595... | 0.80207187 | 0 |
Deletes a volume given its aws_id. the wait parameter, specifies if we need to keep on attempting to deleting it in case it's still 'inuse' | def delete_volume(vol_id,wait=true)
params = {:aws_id => vol_id,:api_version => 1.0}
success=false
20.times do |i|
begin
STDERR.puts "Making RightScale API call to delete EBS volume"
#STDERR.puts "HERE IS THE URL: #{@api_url}/delete_ebs_volume.js (PARAMS: #{requestify(para... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_volume(volume_id)\n data = false\n conn = @ec2_main.environment.volume_connection\n if conn != nil\n if @ec2_main.settings.openstack\n response = conn.delete_volume(volume_id)\n if response.status == 202\n data = response.body\n else\n data = {}\n ... | [
"0.7078069",
"0.6940662",
"0.6797152",
"0.6723026",
"0.66397333",
"0.6616613",
"0.6616229",
"0.6505471",
"0.6483216",
"0.641119",
"0.6176149",
"0.61572033",
"0.61413777",
"0.6050688",
"0.59458584",
"0.5915184",
"0.5869254",
"0.5855311",
"0.58243114",
"0.5806305",
"0.5786952",... | 0.73450196 | 0 |
last_snapshot is a hash that contains aws_id and nickname | def restore_from_snap(last_snapshot, options = {})
options[:device] = "/dev/sdk" unless options[:device]
options[:vol_nickname] = last_snapshot["nickname"] unless options[:vol_nickname]
# 5 - Unmount and detach the current EBS volume (forcing to detach the device we're gonna need later for attc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_snapshot_at(volume)\n snapshots = snapshots_by_volume_id(volume.id)\n snapshots.any? ? snapshots.first[:aws_started_at] : nil\n end",
"def current_snapshot\n `zfs list -r -H -t snapshot -o name -S creation #{@dataset}/share | head -1`.chomp\n end",
"def snapshot\n if snapshot... | [
"0.6814763",
"0.629441",
"0.62925375",
"0.6235334",
"0.6215689",
"0.6168173",
"0.61662686",
"0.60406184",
"0.60388964",
"0.5934737",
"0.58809704",
"0.5878492",
"0.5872603",
"0.5832442",
"0.579754",
"0.57610774",
"0.5709018",
"0.57020295",
"0.5697134",
"0.56939745",
"0.5691902... | 0.5392059 | 43 |
Terminate (unmount, detach and delete) the current EBS volume | def terminate_volume
device = get_device_mount_point(self.MountPoint)
STDERR.puts "EBS device detected: #{device}...umounting it..."
umount_dir(self.MountPoint)
#detache the mounted volume
STDERR.puts "Detaching current EBS volume:"
detached_vol=detach_volume(device)
STDERR.put... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def terminate_device(dev, keep_volume=true)\n vol_info = detach_volume(dev) \n wait_for_detachment(dev)\n delete_volume(vol_info['aws_id']) unless vol_info.nil? || keep_volume\n #depricating this rescue block -> see wait_for_detachment\n rescue Exception => e\n display_exception(e, \"te... | [
"0.7803134",
"0.69132537",
"0.6893091",
"0.6866086",
"0.67759836",
"0.67498356",
"0.6722117",
"0.67213535",
"0.6528595",
"0.64719766",
"0.64163285",
"0.6250999",
"0.6204053",
"0.61102307",
"0.6105709",
"0.60952747",
"0.6053237",
"0.6050835",
"0.6020377",
"0.60049534",
"0.5929... | 0.8643515 | 0 |
Get the device from a mount point | def get_device_mount_point( incoming_path )
mount_lines = `mount`
raise EBSRemoteExecException.new(nil,$?,mount_lines) if $? != 0
path = File.ftype(incoming_path) != 'directory'? File.dirname(incoming_path) : incoming_path
device=nil
longest = ""
mount_lines.each_line {|line|
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_of_mount(m)\n fs = self.filesystem_data\n unless Pathname.new(m).mountpoint?\n Chef::Log.warn(\n \"fb_helpers: #{m} is not a mount point - I can't determine its \" +\n 'device.',\n )\n return nil\n end\n unless fs && fs['by_pair']\n Chef:... | [
"0.8226888",
"0.8198502",
"0.71224666",
"0.69519943",
"0.68275225",
"0.67160517",
"0.6681542",
"0.6666729",
"0.66405594",
"0.66405594",
"0.6513038",
"0.6469715",
"0.64053315",
"0.6326954",
"0.62997156",
"0.62822086",
"0.62822086",
"0.6279854",
"0.6278997",
"0.6250339",
"0.620... | 0.78339255 | 2 |
Umount the device pertaining to that directory tree... If exact path is specified, only the exact path is attempted to be unmounted otherwise this function goes down the tree until it finds the mount point (i.e., the passed path can be a non mounted path..but the function will unmount the filesystem the path belongs to... | def umount_dir( path , exact_path=true)
cur_path = path.strip
success=false
while cur_path != "/"
res = `umount #{cur_path} 2>&1`
if $? == 0
STDERR.puts "#{cur_path} successfully unmounted"
success=true
break
end
break if exact_path
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unmount_command(path)\n \"udisksctl unmount --block-device #{path}\"\nend",
"def unmount\n if !is_mounted?\n warning('dev, sys, and proc are already unmounted')\n else\n announcing 'Unmounting dev, sys, and proc' do\n dirs = %w[ dev sys proc ]\n dirs.each{|dir| cmd(... | [
"0.6756101",
"0.65107137",
"0.6367809",
"0.6276596",
"0.62115204",
"0.6090288",
"0.585966",
"0.5847523",
"0.5663848",
"0.5661958",
"0.5599339",
"0.5579206",
"0.557234",
"0.54935193",
"0.5454478",
"0.54098856",
"0.53933775",
"0.53736144",
"0.53692335",
"0.5368648",
"0.5331063"... | 0.77378875 | 0 |
Return a handle to an opened (and exclusively locked file). | def get_locked_file( lockfile, timeout = 60 )
cfg_file = File.open(lockfile,"r+")
success = false
timeout.times {
if cfg_file.flock(File::LOCK_EX | File::LOCK_NB )
success=true
break
end
STDERR.puts "Lockfile is locked...retrying..."
sleep 1
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_and_lock_file(filename, read_only)\n if read_only\n begin\n file = File.new(filename, **RD_ACCESS)\n begin\n file.flock(File::LOCK_SH)\n return file\n rescue\n file.close\n raise\n end\n rescue Errno::ENOENT\n return nil\n... | [
"0.7315699",
"0.6752321",
"0.67001766",
"0.6699329",
"0.6643104",
"0.66406024",
"0.65425307",
"0.64576715",
"0.6446914",
"0.6382004",
"0.63324654",
"0.6270311",
"0.62404186",
"0.62088287",
"0.6140506",
"0.60775757",
"0.6069913",
"0.6058006",
"0.60500616",
"0.60285103",
"0.601... | 0.6304962 | 11 |
Unmounts and detaches the EBS device options[:device] optional == Force detachment of this particular device, even if it doesn't match the device corresponding to the mount point | def umount_and_detach_device(options={})
detached_vol=nil
device = get_device_mount_point(self.MountPoint)
if(options[:device])
STDERR.puts "WARNING! the previously mounted device (#{device}) is different from the device we're asking to detach (#{options[:device]})"
device = options[:d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detach\n begin\n run_baby_run 'hdiutil', ['detach', '-force', self.dev_node], :err => '/dev/null'\n rescue Exception => ex\n debug \"The disk image at #{@dev_node} could not be detached: #{ex}\"\n end\n end",
"def unmount_device( dev )\n sudo <<-SH\n if mount | gre... | [
"0.69334716",
"0.68677247",
"0.6726827",
"0.6696188",
"0.6594218",
"0.65642834",
"0.65560913",
"0.6484939",
"0.6436866",
"0.6341737",
"0.62663996",
"0.62055576",
"0.620377",
"0.61956966",
"0.6171475",
"0.615666",
"0.61460334",
"0.6138525",
"0.61112636",
"0.6088157",
"0.604552... | 0.8533016 | 0 |
Convert the given parameters to a request string. The parameters may be a string, +nil+, or a Hash. | def requestify(parameters, prefix=nil)
if Hash === parameters
return nil if parameters.empty?
parameters.map { |k,v| requestify(v, name_with_prefix(prefix, k)) }.join("&")
elsif Array === parameters
parameters.map { |v| requestify(v, name_with_prefix(prefix, "")) }.join("&")
el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def requestify(parameters, prefix=nil)\n if Hash === parameters\n return nil if parameters.empty?\n parameters.map { |k,v| requestify(v, name_with_prefix(prefix, k)) }.join(\"&\")\n elsif Array === parameters\n parameters.map { |v| requestify(v, name_with_prefix(prefix, \"\")) }.join... | [
"0.73592496",
"0.6762248",
"0.67043006",
"0.66249245",
"0.6558161",
"0.6485187",
"0.64668685",
"0.6456102",
"0.6438434",
"0.63955307",
"0.63747644",
"0.63747644",
"0.6361938",
"0.63501483",
"0.6341382",
"0.6323566",
"0.6312262",
"0.63103837",
"0.63052976",
"0.62672365",
"0.62... | 0.73365355 | 1 |
Page 1 of customer screen | def approval
@minimal_ui = true
render :approval
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_page(page = 1)\n add_actions \"GoToPage(#{page})\"\n end",
"def set_page\n end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
... | [
"0.70136285",
"0.68766475",
"0.6866167",
"0.6866167",
"0.6866167",
"0.6866167",
"0.6866167",
"0.6866167",
"0.6866167",
"0.6866167",
"0.6866167",
"0.6866167",
"0.6866167",
"0.6866167",
"0.6856178",
"0.6674866",
"0.66547996",
"0.6560852",
"0.65520877",
"0.6526161",
"0.6526161",... | 0.0 | -1 |
Page 2 of customer screen Customer has pressed yes or no, and is presented with signature capture | def approval_confirm
@minimal_ui = true
case params[:decision]
when 'approve'
render :confirm_approve
when 'disapprove'
render :confirm_disapprove
else
raise
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verifyInformationScreen()\n clickOnMoreTab()\n clickOnInformation()\n verifyMeeting()\n end",
"def captureScreen(filename=nil, hidePatientDetails=false)\n screenCaptureBtn = Element.new(\"Capture Screen Button\", \":Form.captureScreenButton_QPushButton\")\n screenCaptureBtn.click\n snooze ... | [
"0.5880147",
"0.56448996",
"0.54301786",
"0.5288909",
"0.5288679",
"0.5263162",
"0.52313274",
"0.52300656",
"0.5213038",
"0.51885855",
"0.51885855",
"0.5187259",
"0.51650345",
"0.5158979",
"0.5143842",
"0.5143842",
"0.5134967",
"0.5101061",
"0.50921816",
"0.5084581",
"0.50666... | 0.0 | -1 |
Customer has submitted form to finalize approval/disapproval | def update
@ticket.approved_at = Time.now
if @ticket.update(ticket_params)
# Add customer feedback to Notes
if @ticket.approval_feedback.present?
@ticket.notes.create(
note_type: :from_customer,
note: @ticket.approval_feedback
)
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def waiver_submitted\n requested_decision\n end",
"def save_submit(confirmed)\n unless confirmed\n self.errors.add(:confirm, 'box must be checked in order to submit.')\n return false\n end\n\n if self.submitting? and self.submit_stage?\n self.status = :awaiting_payment\n self.sub... | [
"0.6879861",
"0.6756383",
"0.65915143",
"0.6379954",
"0.637004",
"0.6314952",
"0.6310968",
"0.6277201",
"0.62604356",
"0.62158823",
"0.6214578",
"0.617455",
"0.61455005",
"0.6115424",
"0.6105458",
"0.60970837",
"0.6067957",
"0.6060439",
"0.6060439",
"0.6054289",
"0.6015389",
... | 0.5626661 | 100 |
Sanitizing user data to checking cleaning and filtering inputs from the user. | def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_in, keys: [:name, :password, :images])
devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :email, :password, :password_confirmation, :isHost, :isCandidate, :images])
devise_parameter_sanitizer.permit(:account_upda... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize_data\n sanitize_name\n sanitize_city\n sanitize_zip_code\n sanitize_address\n end",
"def sanitize_data\n sanitize_name\n sanitize_city\n sanitize_zip_code\n sanitize_address\n end",
"def sanitize_data\n sanitize_permalink\n sanitize_name\n ... | [
"0.82271254",
"0.82271254",
"0.76361805",
"0.75590664",
"0.7548282",
"0.7432355",
"0.7387317",
"0.7193091",
"0.71457464",
"0.7144339",
"0.7078841",
"0.70271504",
"0.7016051",
"0.7002784",
"0.6993487",
"0.697018",
"0.694114",
"0.6888044",
"0.68744594",
"0.6809825",
"0.67701364... | 0.0 | -1 |
GET /manage/users/1 GET /manage/users/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def manage_users\n \t@users = User.all\n\n \trespond_to do |format|\n format.json {\n render :json => @users.as_json(:only => [:id, :username, :firstname, :lastname, :email], :methods => [:avatar_url])\n }\n format.html {\n render 'manage_users'\n }\n end\n end",
"def inde... | [
"0.7670458",
"0.74276567",
"0.71615565",
"0.69319713",
"0.690065",
"0.6858474",
"0.6836323",
"0.6826438",
"0.68180496",
"0.6802067",
"0.67702687",
"0.6750606",
"0.6676564",
"0.66606194",
"0.66525656",
"0.6650502",
"0.664049",
"0.6633423",
"0.66225946",
"0.6620677",
"0.6620066... | 0.0 | -1 |
POST /manage/user POST /manage/user.json | def create
@platform = Platform.new(platform_params)
respond_to do |format|
if @platform.save
format.html { redirect_to manage_platforms_path, notice: 'platform was successfully created.' }
format.json { render action: 'show', status: :created, location: @user }
else
format.h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @manage_user = Manage::User.new(manage_user_params)\n\n respond_to do |format|\n if @manage_user.save\n format.html { redirect_to @manage_user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @manage_user }\n else\n ... | [
"0.7598009",
"0.7138888",
"0.71274406",
"0.7051898",
"0.6974489",
"0.6968118",
"0.6949148",
"0.6949148",
"0.69449425",
"0.69443655",
"0.69352895",
"0.69246626",
"0.6914786",
"0.6909508",
"0.6909508",
"0.6909508",
"0.69085497",
"0.6907851",
"0.6902729",
"0.68983",
"0.6878655",... | 0.0 | -1 |
PATCH/PUT /manage/users/1 PATCH/PUT /manage/users/1.json | def update
@platform.update(platform_params)
if @platform.save
redirect_to manage_platforms_path
else
render 'new'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end",
"def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end",
"de... | [
"0.6957387",
"0.6873828",
"0.68384576",
"0.67527163",
"0.6687646",
"0.6676892",
"0.66502225",
"0.66475874",
"0.6646537",
"0.6642102",
"0.66374445",
"0.6624057",
"0.66159207",
"0.66028106",
"0.658931",
"0.65737265",
"0.6563454",
"0.6560568",
"0.65439063",
"0.65228575",
"0.6505... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_platform
@platform = Platform.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_address
@address = Address.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163754",
"0.6045816",
"0.5944853",
"0.59169096",
"0.58892167",
"0.58342934",
"0.5776148",
"0.57057375",
"0.57057375",
"0.56534296",
"0.56209534",
"0.54244673",
"0.54101455",
"0.54101455",
"0.54101455",
"0.53951085",
"0.5378493",
"0.53563684",
"0.53399915",
"0.5338049",
"0... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def address_params
params.require(:address).permit(:street1, :street2, :city, :state, :zipcode, :family_id, :student_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_rol
@rol = Rol.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.61642385",
"0.60448",
"0.5945487",
"0.5915654",
"0.58890367",
"0.58330417",
"0.5776098",
"0.5703048",
"0.5703048",
"0.5654613",
"0.5620029",
"0.5423114",
"0.540998",
"0.540998",
"0.540998",
"0.5393666",
"0.53783023",
"0.53568405",
"0.53391176",
"0.5339061",
"0.53310865",
... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def rol_params
params.require(:rol).permit(:name, :description)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
Patch: add options to arguments and use additional condition if option[:user] Returns the total number of hours spent on this issue and its descendants Example: spent_hours => 0.0 spent_hours => 50.2 | def total_spent_hours(options = {})
conditions = options[:user] ? "#{TimeEntry.table_name}.user_id = #{options[:user].id}" : "1=1"
@total_spent_hours ||= self_and_descendants.sum("#{TimeEntry.table_name}.hours",
:joins => "LEFT JOIN #{TimeEntry.table_name} ON #{TimeEntry.table_name}.issue_id =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spent_hours_for_issue_and_user\n return @spent_hours_for_issue_and_user if defined?(@spent_hours_for_issue_and_user)\n\n @spent_hours_for_issue_and_user = nil\n\n return @spent_hours_for_issue_and_user if issue_id.blank? || user_id.blank?\n\n @spent_hours_for_issue_and_user ... | [
"0.6405401",
"0.632339",
"0.5689145",
"0.5591043",
"0.5583184",
"0.551683",
"0.5485585",
"0.5478095",
"0.54197437",
"0.5395826",
"0.53691286",
"0.53653663",
"0.5352822",
"0.5308221",
"0.52607954",
"0.52475315",
"0.52058566",
"0.5183348",
"0.51505786",
"0.5138219",
"0.5122618"... | 0.7498656 | 0 |
GET /competition_interaction_observations GET /competition_interaction_observations.json | def index
@competition_interaction_observations = CompetitionInteractionObservation.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @competition_interaction_observations }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @competition_interaction_observation = CompetitionInteractionObservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competition_interaction_observation }\n end\n end",
"def new\n @competition_interaction_observation =... | [
"0.6931963",
"0.62894654",
"0.6205277",
"0.61255145",
"0.6015854",
"0.5958318",
"0.5879764",
"0.575502",
"0.5717941",
"0.5714492",
"0.5711418",
"0.5683186",
"0.56599957",
"0.56546205",
"0.56443506",
"0.5640214",
"0.55752367",
"0.55623114",
"0.5546815",
"0.55418366",
"0.553886... | 0.7688963 | 0 |
GET /competition_interaction_observations/1 GET /competition_interaction_observations/1.json | def show
@competition_interaction_observation = CompetitionInteractionObservation.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @competition_interaction_observation }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @competition_interaction_observations = CompetitionInteractionObservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @competition_interaction_observations }\n end\n end",
"def new\n @competition_interaction_observation = Competiti... | [
"0.762981",
"0.66092765",
"0.6358198",
"0.5980724",
"0.5962239",
"0.5958866",
"0.59242815",
"0.5914587",
"0.5914266",
"0.5908176",
"0.57595384",
"0.57351726",
"0.56863016",
"0.5666782",
"0.56198543",
"0.56187683",
"0.55666405",
"0.55498224",
"0.5517804",
"0.5514203",
"0.54618... | 0.7262675 | 1 |
GET /competition_interaction_observations/new GET /competition_interaction_observations/new.json | def new
@competition_interaction_observation = CompetitionInteractionObservation.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @competition_interaction_observation }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @interaction_log = InteractionLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interaction_log }\n end\n end",
"def new\n @observation = Observation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json... | [
"0.70133495",
"0.70085686",
"0.70085686",
"0.6888366",
"0.6653842",
"0.6653842",
"0.6653842",
"0.6632206",
"0.6510119",
"0.6499254",
"0.6498506",
"0.64114285",
"0.6352437",
"0.6334704",
"0.6326901",
"0.6296555",
"0.62952393",
"0.62785894",
"0.62696445",
"0.626823",
"0.6247929... | 0.7967428 | 0 |
POST /competition_interaction_observations POST /competition_interaction_observations.json | def create
@competition_interaction_observation = CompetitionInteractionObservation.new(params[:competition_interaction_observation])
@competition_interaction_observation.user_id = current_user.id
@competition_interaction_observation.project_id = current_user.project_id
respond_to do |format|
if @compet... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @competition_interaction_observations = CompetitionInteractionObservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @competition_interaction_observations }\n end\n end",
"def new\n @competition_interaction_observation = Competiti... | [
"0.6749504",
"0.62734157",
"0.6245524",
"0.61036074",
"0.60554934",
"0.5934409",
"0.5835551",
"0.57936466",
"0.5743893",
"0.57362217",
"0.570137",
"0.5665902",
"0.56516236",
"0.5605876",
"0.556893",
"0.55110705",
"0.5493549",
"0.5450054",
"0.5380758",
"0.5362767",
"0.5358131"... | 0.68146396 | 0 |
PUT /competition_interaction_observations/1 PUT /competition_interaction_observations/1.json | def update
@competition_interaction_observation = CompetitionInteractionObservation.find(params[:id])
respond_to do |format|
if @competition_interaction_observation.update_attributes(params[:competition_interaction_observation])
format.html { redirect_to @competition_interaction_observation, noti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @observation = Observation.find(params[:id])\n\n respond_to do |format|\n if @observation.update_attributes(observation_params)\n format.html { redirect_to coral_path(@observation.coral), flash: {success: 'Observation was successfully updated.' } }\n format.json { head :no_con... | [
"0.63024795",
"0.6295468",
"0.6252693",
"0.62361073",
"0.6227617",
"0.6158807",
"0.6127764",
"0.61077356",
"0.60904604",
"0.6070457",
"0.6036361",
"0.60351837",
"0.60303366",
"0.59690416",
"0.5891851",
"0.5877195",
"0.5870325",
"0.5859077",
"0.5802791",
"0.57161",
"0.5715375"... | 0.7327771 | 0 |
DELETE /competition_interaction_observations/1 DELETE /competition_interaction_observations/1.json | def destroy
@competition_interaction_observation = CompetitionInteractionObservation.find(params[:id])
@competition_interaction_observation.destroy
respond_to do |format|
format.html { redirect_to competition_interaction_observations_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @interaction = Interaction.find(params[:id])\n @interaction.destroy\n\n respond_to do |format|\n format.html { redirect_to interactions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @observations.destroy\n respond_to do |format|\n format.htm... | [
"0.70507014",
"0.7050441",
"0.7013999",
"0.69409513",
"0.6856612",
"0.67834365",
"0.6780879",
"0.67691857",
"0.6753311",
"0.6715108",
"0.67034084",
"0.6694667",
"0.66798234",
"0.66793406",
"0.6677014",
"0.66659874",
"0.6652992",
"0.6652992",
"0.6649643",
"0.6632365",
"0.66301... | 0.7895142 | 0 |
Name: Timbre Freeman Assignment: Right Triangle Date: 09/30/2019 Class: CIS 282 Description: Make right triangles using or numbers and have the user set the size of the triangle | def value_at x
return (x * (-$triangle_r_slop)) + $triangle_height
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_triangle(height)\nend",
"def triangle(size, quadrant=4)\n case quadrant\n when 1\n for i in 0..size do\n puts \"*\" * (size - i) + \" \" * (i)\n end\n when 2\n for i in 0..size do\n puts \" \" * (i) + \"*\" * (size - i)\n end\n when 3\n for i in 0..size do\n puts \"*\"... | [
"0.72406745",
"0.7103695",
"0.7098952",
"0.70385396",
"0.6913143",
"0.68804765",
"0.6847998",
"0.68111396",
"0.67422503",
"0.67339796",
"0.6698342",
"0.6697083",
"0.66820824",
"0.66620356",
"0.6645654",
"0.66142154",
"0.65990907",
"0.65964305",
"0.65819544",
"0.65761805",
"0.... | 0.0 | -1 |
Notice that n^2 79n + 1601 = (n 40)^2 + (n 40) + 41, which is of the same form as n^2 + n + 41, the formula first introduced. We just have to find the largest k so that b is less than 1000. (xk)^2 + (xk) + 41 = x^2 2xk + k^2 + x k + 41 = x^2 (2k 1)x + k^2 k + 41. b = k^2 k + 41, b < 1000 k = 31 Our formula is n^2 61n +... | def solution
971 * (-61)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solve( n = 100 )\n max = 0\n 1.upto( n - 1 ) do |a|\n 1.upto( n - 1 ) do |b|\n m = (a**b).sum_digits\n max = m if m > max\n end\n end\n \n max\n end",
"def top_k_frequent_b(nums, k)\n nums\n .inject(Hash.new(0)) { |h, n| h[n] += 1; h }\n .sort_by { |_, v| -v }\n... | [
"0.68845147",
"0.6783667",
"0.6466464",
"0.6437455",
"0.638754",
"0.6354683",
"0.633365",
"0.6324298",
"0.6313724",
"0.6304586",
"0.62980676",
"0.6276359",
"0.6274125",
"0.6204235",
"0.62006867",
"0.6186536",
"0.61759233",
"0.61759233",
"0.61726624",
"0.61725277",
"0.6172436"... | 0.0 | -1 |
Builds the enum from string | def build_from_hash(value)
constantValues = SchemaFieldMode.constants.select { |c| SchemaFieldMode::const_get(c) == value }
raise "Invalid ENUM value #{value} for class #SchemaFieldMode" if constantValues.empty?
value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_from_hash(value)\n constantValues = ExchangeStatus.constants.select { |c| ExchangeStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ExchangeStatus\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = NewOrResale.... | [
"0.66046983",
"0.6548398",
"0.65373033",
"0.6528928",
"0.64598405",
"0.6446511",
"0.64443517",
"0.6443306",
"0.6406087",
"0.6405894",
"0.6379518",
"0.6374375",
"0.6367104",
"0.6359485",
"0.63550735",
"0.6346857",
"0.63404876",
"0.6319777",
"0.63088304",
"0.6306753",
"0.630464... | 0.59543365 | 73 |
Update info password password info correctly Update info new password | def change_password
author = current_author
if author.valid_password?(author_password_params[:current_password])
if author.change_password(author_password_params)
sign_in(author, bypass: true)
flash[:success] = 'Has been udates...'
else
flash[:danger] = author.display_error_message
end
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_with_password(params, *options); end",
"def edit_password; end",
"def update_password(newpwd)\n self.password = Utils.sha1(newpwd + 'ad2012spot' + email)\n end",
"def password=(new_password); end",
"def update\n @user = current_user\n @user_locations = @user.user_locations\n \n o... | [
"0.7538674",
"0.73465675",
"0.73361236",
"0.7314241",
"0.7261104",
"0.7226908",
"0.71720636",
"0.713186",
"0.7096859",
"0.7020446",
"0.7007062",
"0.6978522",
"0.6978522",
"0.6976982",
"0.6976764",
"0.6976764",
"0.6976764",
"0.6976764",
"0.6976764",
"0.6976764",
"0.6976764",
... | 0.0 | -1 |
only used by tests to avoid sleeping | def publish_with_confirm(message)
channel = @exchange.channel
channel.confirm_select unless channel.using_publisher_confirmations?
publish(message)
@exchange.wait_for_confirms
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pre_sleep; end",
"def sleepy_run; end",
"def waiting; end",
"def waiting; end",
"def wait; end",
"def wait; end",
"def wait; end",
"def sleep\n sleep_after(0)\n end",
"def delay; end",
"def delay; end",
"def delay; end",
"def wakeup; end",
"def let_mes_catch_up\n sleep 1\n end",... | [
"0.76825666",
"0.7607479",
"0.6986092",
"0.6986092",
"0.6953869",
"0.6953869",
"0.6953869",
"0.68842435",
"0.66957587",
"0.66957587",
"0.66957587",
"0.66432065",
"0.65994895",
"0.6591532",
"0.65439695",
"0.65439695",
"0.65439695",
"0.6492555",
"0.6492555",
"0.6492555",
"0.649... | 0.0 | -1 |
Function accesses the sccount over IMAP and Checks for new messages New Messages once read get marked as READ and so won't be read the next time | def imapsync
@imap = Net::IMAP.new( @config[:host], @config[:port], @config[:ssl] )
if @imap.login( @config[:username], @config[:password] )
puts "Connected"
else
raise("Connection Failed")
end
@imap.select('INBOX') #Select INBOX from the gmail account to look for new messages
project=""
attrs={... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_messages_via_imap\n\timap = Net::IMAP.new(server,port,usessl)\n\timap.login(mailid,password)\n\timap.select(folder)\n\tsince = included.blank? ? \"1-Jan-2000\" : included.yesterday.to_date.strftime(\"%e-%b-%Y\")\n\timap.uid_search([\"SINCE\",since]).each do |msg_id|\n\t\tnext unless mailmessages.find_by_u... | [
"0.6857301",
"0.6648341",
"0.6478106",
"0.62444586",
"0.62103707",
"0.6208983",
"0.6053053",
"0.60366637",
"0.59147644",
"0.5909061",
"0.5902083",
"0.5886626",
"0.58675426",
"0.58329344",
"0.5789951",
"0.57830495",
"0.57746685",
"0.5760247",
"0.574233",
"0.5738419",
"0.572885... | 0.60848135 | 6 |
def check_for_locked_groups(group) group.each do |plate| gents = plate.definition.entities if gents.count < 4 gents.each do |e| if e.class == Sketchup::Group || e.class == Sketchup::ComponentInstance if e.locked? e.explode return end end end end end end | def sort_plates2(plates)
plates each do |pl|
p pl
bnds = pl.bounds.diagonal.to_f.round(4)
#(idea) create a hash of objects and thier diagonal and compact it.
#check definition instances against each other for diagonal
#make differences unique and update the de... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def freeze_groups_and_components\n if not @selection.empty?\n begin\n @model.start_operation \"Freeze groups and components\"\n puts \"Freezing selection...\" if @debug\n @selection.each { |e| \n if e.is_a? Sketchup::Group or e.is_a? Sketchup::ComponentInstan... | [
"0.6439842",
"0.631289",
"0.5908133",
"0.5889318",
"0.5785572",
"0.5780535",
"0.5741972",
"0.5708595",
"0.5690304",
"0.5626576",
"0.56245923",
"0.56245923",
"0.557792",
"0.55459505",
"0.55456334",
"0.55397683",
"0.5516298",
"0.5516298",
"0.5516298",
"0.5491521",
"0.5471049",
... | 0.0 | -1 |
def label_plates(plates) labels = [] | def label_plate(plate, group)
labels = []
mod_title = @model.title
container = group.entities.add_group
plname = plate.definition.name
var = mod_title + '-' + plname
text = container.entities.add_3d_text(var, TextAlignLeft, '1CamBam_Stick_7', false, false, 0.675, 0.0, -... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def labels\n [label()]\n end",
"def labels; end",
"def labels\n inject_block(:name, :label)\n end",
"def new_labels\n found_labels.map{ |label| LABEL_MAP[label] }\n end",
"def labels\n @nodes.map(&:label)\n end",
"def parafilm_plates\n show do \n title \"Label and Para... | [
"0.7114279",
"0.68921983",
"0.65703374",
"0.64698905",
"0.6462808",
"0.6454814",
"0.6412203",
"0.63619864",
"0.6337574",
"0.63200545",
"0.6313473",
"0.6279544",
"0.6261717",
"0.6253378",
"0.62180567",
"0.6217638",
"0.62150866",
"0.61643445",
"0.61421615",
"0.61421615",
"0.614... | 0.7530564 | 0 |
verifica se uma unidade especificamente corresponde a metricas de velocidade | def unit?(unit)
@units.include?(unit)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def metric_ton? = unit == 'metric-ton'",
"def vegetaria\n\t\tcerdo = Alimento.new(\"Cerdo\", 21.5, 0.0, 6.3, 7.6, 11.0)\n\t\tcordero = Alimento.new(\"Cordero\",18.0,0.0,3.1,50.0,164.0)\n\t\tvaca = Alimento.new(\"Carne de vaca\", 21.1,0.0,3.1,50.0,164.0)\n\t\tcamarones = Alimento.new(\"Camarones\",17.6,1.5,0.6,18... | [
"0.5953493",
"0.594504",
"0.57824713",
"0.577879",
"0.5745044",
"0.5726829",
"0.5499606",
"0.548937",
"0.5344685",
"0.5328384",
"0.5298262",
"0.5257136",
"0.52438194",
"0.52366304",
"0.52296937",
"0.52285236",
"0.5140622",
"0.512893",
"0.5113538",
"0.5096208",
"0.5067368",
... | 0.0 | -1 |
para nao precisar escrever metodos repetidos, vamos responder a algumas chamadas sem metodos magicamente atraves desse metodo | def method_missing(method, *argments)
# defimos o valor e metricas da conversao
metrics = method.to_s.split '_to_'
value = argments.first
# se as metricas de origin forem iguais retornamos o valor
return value if metrics[0] == metrics[1]
# primeiro convertemos a unidade para o valor base
v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cargar_comandos_jugadas_repetir_otro_sorteo(ticket, sorteo_origen , sorteo_destino)\n #Buscar todos los comandos de todas las jugadaslots de ese ticket con ese sorteo de origen.\n @array_jugadas_de_ese_sorteo_en_ese_ticket = Jugadalot.where(:ticket_id => ticket, :sorteot => Sorteot.where(:si... | [
"0.5870564",
"0.5800459",
"0.56781167",
"0.5665729",
"0.5664677",
"0.56107724",
"0.55905724",
"0.5553861",
"0.5553861",
"0.5553861",
"0.55503386",
"0.552104",
"0.5480487",
"0.5470989",
"0.5469752",
"0.5464218",
"0.54609877",
"0.5457819",
"0.54576534",
"0.53995115",
"0.5398128... | 0.0 | -1 |
substimos este metodo para que o ruby nao bloqueie a chamada de metodos nao existes atraves do metodo .method | def respond_to_missing?(_name, _include_private = false)
'nil'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def methods() end",
"def method\r\nend",
"def method\n\t\t#... | [
"0.7361804",
"0.7361804",
"0.7361804",
"0.7361804",
"0.7361804",
"0.7361804",
"0.7361804",
"0.7361804",
"0.7361804",
"0.7361804",
"0.7361804",
"0.7361804",
"0.6936515",
"0.6839394",
"0.6791799",
"0.66964793",
"0.66964793",
"0.666669",
"0.6656645",
"0.6522976",
"0.64822215",
... | 0.0 | -1 |
apresenta os valores da classe em formato string | def debug
"origin: #{@unit_origin} | value: #{@value} | destiny: #{@unit_destiny}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert(data)\n return \"cls #{data.id}, #{data.value}\" if data.is_a? ClassicPattern\n return \"clv #{data.id}, #{data.year}, #{data.make}, #{data.series}, #{data.name}\" if data.is_a? ClassicVehicle\n return \"ci #{data.category.code} #{data.updated_value}\" if data.is_a? ClassicItem\n return \"c... | [
"0.64551413",
"0.63519317",
"0.62356186",
"0.6173693",
"0.6173693",
"0.6173693",
"0.6173693",
"0.6173693",
"0.6173693",
"0.6173693",
"0.6173693",
"0.61063385",
"0.61063385",
"0.60676616",
"0.6001996",
"0.59874076",
"0.5978205",
"0.5936086",
"0.59042305",
"0.5880833",
"0.58712... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.