query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
New Method Create Title Windows | def create_title_window
@title_window = Window_TitleList.new(TITLE_WINDOW_X, TITLE_WINDOW_Y)
@title_window.actor = @actor
@title_window.set_handler(:ok, method(:on_title_ok))
@title_window.set_handler(:cancel, method(:on_title_cancel))
@title_window.set_handler(:start, method(:toggle_help))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def title\n Window.functions[__method__] ||= AU3_Function.new(\"WinGetTitle\", 'SSPI')\n buffer = \" \" * AutoItX3::BUFFER_SIZE\n buffer.wide!\n Window.functions[__method__].call(@title.wide, @text.wide, buffer, AutoItX3::BUFFER_SIZE - 1)\n buffer.normal.strip\n end",
"def title()\r\n... | [
"0.7218257",
"0.7049194",
"0.7011489",
"0.6950394",
"0.69186395",
"0.6896664",
"0.6885524",
"0.6885524",
"0.6885524",
"0.68272954",
"0.67660725",
"0.67660725",
"0.676195",
"0.6711829",
"0.670729",
"0.6701646",
"0.6646917",
"0.66222876",
"0.66222876",
"0.66222876",
"0.6606778"... | 0.81415796 | 0 |
Override Create Help Window When Choosing Titles | def create_help_window
@help_window = Window_TitleHelp.new(HELP_WINDOW_X, HELP_WINDOW_Y)
@help_window.hide
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_help\n @help_window.set_item(title)\n end",
"def set_titles_controls\n @control_help_window.add_control(Vocab::CONFIRM, Input::Keys::A) \n @control_help_window.add_control(Vocab::BACK, Input::Keys::B)\n @control_help_window.add_control(Vocab::DESCRIPTION, Input::Keys::START)... | [
"0.75087875",
"0.7403926",
"0.74004",
"0.74004",
"0.73641056",
"0.73189527",
"0.7300256",
"0.7251228",
"0.7229809",
"0.7216532",
"0.7216532",
"0.69595546",
"0.690282",
"0.68806475",
"0.67874163",
"0.6740251",
"0.6740251",
"0.6704933",
"0.66785175",
"0.66571254",
"0.665593",
... | 0.7671097 | 0 |
New Method Title Window To Status | def title_to_status
@title_window.hide.deactivate.unselect
@help_window.hide
@status_window.activate
set_controls_help
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_title\n @status_window.deactivate\n @title_window.select_last\n @title_window.show.activate\n @title_window.refresh\n @help_window.show\n end",
"def title()\r\n @window_title\r\n end",
"def create_title_window\n @title_window = Window_TitleList.new(TITLE_WINDOW_X... | [
"0.7982474",
"0.7667182",
"0.75421",
"0.7515357",
"0.7487791",
"0.7204949",
"0.71735847",
"0.71735847",
"0.71735847",
"0.7067795",
"0.7067795",
"0.7067795",
"0.7052147",
"0.70425415",
"0.7007078",
"0.6997099",
"0.69234407",
"0.69167197",
"0.68990844",
"0.68688184",
"0.6868818... | 0.7819477 | 1 |
New Method Toggle Help Window | def toggle_help
@help_window.toggle_text
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_toggle_help\n @help_window.toggle_text\n end",
"def on_toggle_help\n @help_window.toggle_text\n end",
"def help\n self.helplink.click\n end",
"def question_help_click\n MenuControllerContracts.invariant(self)\n @alert_view = @help_view = Views::ConnectAllAlertView.new(@window... | [
"0.8667",
"0.8667",
"0.75596017",
"0.72972846",
"0.718835",
"0.718835",
"0.7159141",
"0.7152565",
"0.7152565",
"0.7152565",
"0.7152565",
"0.7152565",
"0.7152565",
"0.7152565",
"0.7146321",
"0.70657885",
"0.7019678",
"0.7008081",
"0.69927657",
"0.69888836",
"0.69694716",
"0.... | 0.8912086 | 0 |
New Method Set Controls For Status Window | def set_status_controls
@control_help_window.add_control(Vocab::MODIFY, Input::Keys::A)
@control_help_window.add_control(Vocab::BACK, Input::Keys::B)
@control_help_window.add_control(Vocab::CHANGE_ACTOR, Input::Keys::L, Input::Keys::R)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_status_controls\n @control_help_window.add_control(Vocab::EQUIP, Input::Keys::A) \n @control_help_window.add_control(Vocab::BACK, Input::Keys::B)\n @control_help_window.add_control(Vocab::OPTIMIZE, Input::Keys::X)\n @control_help_window.add_control(Vocab::CHANGE_ACTOR, Input:... | [
"0.72506464",
"0.72462183",
"0.72023225",
"0.7110677",
"0.66787565",
"0.66662586",
"0.66425943",
"0.66424143",
"0.65689284",
"0.6539716",
"0.6414421",
"0.6341856",
"0.6284774",
"0.62815326",
"0.62708473",
"0.6179443",
"0.61611956",
"0.6139278",
"0.6094099",
"0.6094099",
"0.60... | 0.74653655 | 0 |
New Method Set Controls For Titles Window | def set_titles_controls
@control_help_window.add_control(Vocab::CONFIRM, Input::Keys::A)
@control_help_window.add_control(Vocab::BACK, Input::Keys::B)
@control_help_window.add_control(Vocab::DESCRIPTION, Input::Keys::START)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_title\n @status_window.deactivate\n @title_window.select_last\n @title_window.show.activate\n @title_window.refresh\n @help_window.show\n end",
"def create_title_window\n @title_window = Window_TitleList.new(TITLE_WINDOW_X, TITLE_WINDOW_Y)\n @title_window.actor = @actor\n @tit... | [
"0.7457195",
"0.7382165",
"0.7072405",
"0.699762",
"0.699762",
"0.699762",
"0.69797444",
"0.68623066",
"0.6793858",
"0.67650306",
"0.66693217",
"0.6537949",
"0.6501703",
"0.64951557",
"0.6495072",
"0.64516634",
"0.63475376",
"0.63475376",
"0.634299",
"0.6320798",
"0.6313344",... | 0.78441256 | 0 |
Creates a new DeploymentMetadata instance for the given deployment_datetime. If the file doesn't exist, create it and set the defaults. If unable to create the file, log message and set the defaults. If the file does exist, load it from disk. | def initialize(container, deployment_datetime)
@file = PathUtils.join(container.container_dir, 'app-deployments', deployment_datetime, 'metadata.json')
empty = File.exists?(@file) && File.stat(@file).size == 0
container.logger.warn("#{@file} was found empty. Will attempt to write defaults") if ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_deployment_manifest\n cloud_properties = { \"instance_type\" => \"m1.small\", \"availability_zone\" => \"us-east-1e\" }\n cloud_properties[\"persistent_disk\"] = flags[:disk] if flags[:disk]\n cloud_properties[\"static_ips\"] = ip_addresses\n manifest = Bosh::Gen::Models::Dep... | [
"0.52536446",
"0.51796764",
"0.49358392",
"0.47455433",
"0.4689584",
"0.4685721",
"0.4654757",
"0.46204376",
"0.46178478",
"0.46144766",
"0.45939422",
"0.45823565",
"0.45611256",
"0.45469975",
"0.45378575",
"0.44878447",
"0.44676733",
"0.44480908",
"0.44470763",
"0.44392264",
... | 0.7673348 | 0 |
Gives the remaining area to pad for +len+ to be aligned by +width+. | def pad_length(len, width)
if len % width == 0
return 0
end
return (width - (len % width))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_width; padding * 2 + base_width; end",
"def calc_width; padding * 2 + base_width; end",
"def unpadded_width\n width = 0\n padding = self.get_padding\n width = self.bounds.width - (padding[:left] + padding[:right])\n return width\n end",
"def pad\n truncate.center(truncate.size + ... | [
"0.7270709",
"0.7270709",
"0.71964514",
"0.6986304",
"0.6979419",
"0.69197047",
"0.69127417",
"0.688367",
"0.68603146",
"0.6779801",
"0.66965395",
"0.6675304",
"0.66525406",
"0.66324955",
"0.66174823",
"0.65948176",
"0.6588212",
"0.6539657",
"0.64930415",
"0.64930415",
"0.644... | 0.8354117 | 0 |
Align +addr+ to +width+ bytes. | def align(addr, width)
return addr + pad_length(addr, width)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wrap(address, alignment = self::ALIGNMENT)\n __wrap__(address, self::SIZE, alignment)\n end",
"def put_aligned_data(arg)\n # arg.size must be aligned\n @data += [arg].pack(\"a#{arg.size}\")\n self\n end",
"def align(size)\n @pos = (@pos + size - 1) / size * size\n en... | [
"0.6301455",
"0.55309004",
"0.54948115",
"0.5407304",
"0.5329054",
"0.53002685",
"0.53002685",
"0.52841216",
"0.5280475",
"0.51012874",
"0.50573814",
"0.49184594",
"0.4884191",
"0.4847251",
"0.47856563",
"0.47856563",
"0.4777156",
"0.47674718",
"0.47654486",
"0.47443262",
"0.... | 0.8573706 | 0 |
Clamp +val+ to be within +min+ and +max+. | def clamp(val, min, max)
return min if val < min
return max if val > max
return val
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clamp(value, minimum_inclusive, maximum_inclusive)\n\n if minimum_inclusive > maximum_inclusive\n\n swap = minimum_inclusive\n\n minimum_inclusive = maximum_inclusive\n maximum_inclusive = swap\n end\n\n value < minimum_inclusive ? minimum_inclusive : value < max... | [
"0.7853275",
"0.7303349",
"0.7029086",
"0.6987046",
"0.695489",
"0.69212997",
"0.68407655",
"0.68184555",
"0.6675316",
"0.66390437",
"0.6621062",
"0.6494164",
"0.64924634",
"0.6392524",
"0.63617146",
"0.63209075",
"0.6314807",
"0.63133",
"0.6279332",
"0.6217999",
"0.6197976",... | 0.87100655 | 0 |
Convert +intext+ from +inform+ text encoding to +outform+ encoding. | def text_conv(outform, inform, intext)
return Iconv.iconv(outform, inform, intext).join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iconv() end",
"def encode(text); end",
"def encode(text); end",
"def encode(immune, input)\n return nil if input.nil?\n encoded_string = ''\n encoded_string.encode!(Encoding::UTF_8)\n input.encode(Encoding::UTF_8).chars do |c|\n encoded_string << encode_char... | [
"0.4939415",
"0.47967416",
"0.47967416",
"0.47942206",
"0.46705574",
"0.4658247",
"0.45965376",
"0.45143336",
"0.44602627",
"0.44231516",
"0.44116446",
"0.44084466",
"0.43901947",
"0.438745",
"0.43748426",
"0.43629396",
"0.43489236",
"0.43365207",
"0.4317049",
"0.43148348",
"... | 0.7166449 | 0 |
The Wii common key. | def commonKey()
return "\xEB\xE4\x2A\x22\x5E\x85\x93\xE4\x48\xD9\xC5\x45\x73\x81\xAA\xF7"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key\n raise 'Not implemented'\n end",
"def key\n raise 'Not implemented'\n end",
"def key\n \"#{@@PREFIX}#{@type}-#{@version.gsub(\".\",\"-\")}\"\n end",
"def key\n \"#{@@PREFIX}#{@name.gsub(\" \",\"-\")}\"\n end",
"def default_key \n Digest::SHA1.hexdigest(\"riaque... | [
"0.6802797",
"0.6802797",
"0.676823",
"0.66904545",
"0.6660577",
"0.6645059",
"0.6542415",
"0.6507652",
"0.6507073",
"0.64849234",
"0.6458304",
"0.644293",
"0.63983953",
"0.63901806",
"0.63854444",
"0.6372977",
"0.6372977",
"0.6353057",
"0.62981343",
"0.62981343",
"0.62793666... | 0.80404353 | 0 |
The Korean Wii common key. | def koreanKey() # Kekekekeke
return "\x63\xB8\x2B\xB4\xF4\x61\x4E\x2E\x13\xF2\xFE\xFB\xBA\x4C\x9B\x7E"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commonKey()\n\treturn \"\\xEB\\xE4\\x2A\\x22\\x5E\\x85\\x93\\xE4\\x48\\xD9\\xC5\\x45\\x73\\x81\\xAA\\xF7\"\nend",
"def get_key\n @key = Base64.decode64('MzRlZTc5ODMtNWVlNi00MTQ3LWFhODYtNDQzZWEwNjJhYmY3NzQ0OTNkNmEtMmExNS00M2ZlLWFhY2UtZTc4NTY2OTI3NTg1Cg==')\n end",
"def request_key(cntrl)\n check_... | [
"0.7530737",
"0.6254495",
"0.6111546",
"0.6032515",
"0.5876132",
"0.58527654",
"0.5843703",
"0.582731",
"0.5827093",
"0.5805038",
"0.5799594",
"0.57773185",
"0.575947",
"0.5751241",
"0.57369465",
"0.5725671",
"0.57214594",
"0.57102954",
"0.5689759",
"0.5686084",
"0.5642606",
... | 0.79608226 | 0 |
Decrypt a title key. | def decryptTitleKey(commonkey, tid, enckey)
iv = [ (tid >> 32) & 0xFFFFFFFF ].pack("N") + [ tid & 0xFFFFFFFF ].pack("N") + "\x00" * 8
return self.decryptData(commonkey, iv, enckey)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decrypt phrase, key\n decrypt = encrypt phrase, key\n return decrypt\nend",
"def decrypt\n self.class.decrypt(@encrypted_name, @id)\n end",
"def decrypt_message ciphertext\n key_pair.decrypt ciphertext\n end",
"def decrypt(cipherText, key)\n shiftText(cipherText, key * (- 1))\n ... | [
"0.6208153",
"0.60342216",
"0.5991022",
"0.5907854",
"0.5895304",
"0.5890466",
"0.58315474",
"0.5797715",
"0.57966715",
"0.5767671",
"0.57199305",
"0.5692612",
"0.56736773",
"0.5655104",
"0.55805796",
"0.55805796",
"0.55585814",
"0.55503476",
"0.5543805",
"0.5522495",
"0.5498... | 0.78682065 | 0 |
Create a SHA1 hash of +data+. | def createSHAHash(data)
return Digest::SHA1.digest(data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sha1(data)\n @connection.sha1(data)\n end",
"def sha1(data, c: true)\n if c && $linux && File.file?(PATH_SHA1)\n File.binwrite(\"util/#{HASH_INPUT_FN}\", data)\n code = shell(\"./util/sha1 ./util/#{HASH_INPUT_FN} ./util/#{HASH_OUTPUT_FN}\")\n return nil if !code\n hash = File.binre... | [
"0.8518891",
"0.7497034",
"0.7280378",
"0.7243936",
"0.69433624",
"0.69433624",
"0.68561316",
"0.6854137",
"0.67251164",
"0.6695477",
"0.66610193",
"0.6627332",
"0.6620378",
"0.6615889",
"0.6605178",
"0.6602192",
"0.66010904",
"0.6601075",
"0.65163016",
"0.6507606",
"0.646618... | 0.8430918 | 1 |
Create an MD5 hash of +data+. | def createMD5Hash(data)
return Digest::MD5.digest(data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def md5_hash(data)\n md5 = Digest::MD5.new\n md5 << data\n md5.hexdigest\n end",
"def build_hash data\n digest = OpenSSL::Digest::Digest.new('md5')\n OpenSSL::HMAC.hexdigest(digest, @project_secret, data)\n end",
"def to_md5(salt = \"\")\n hashsum(:md5, salt)\n end",
... | [
"0.89767843",
"0.71858",
"0.70585036",
"0.70083386",
"0.6805802",
"0.67872256",
"0.6783619",
"0.6759561",
"0.6748182",
"0.67035276",
"0.6686722",
"0.6669486",
"0.6656521",
"0.6647082",
"0.6615061",
"0.6610457",
"0.66005343",
"0.6579029",
"0.6569653",
"0.6565935",
"0.6539069",... | 0.8882028 | 1 |
Validate an MD5 hash. | def validateMD5Hash(data, hash)
newhash = self.createMD5Hash(data)
if newhash == hash
return true
else
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_image_md5sum\n result = true\n if upload_md5sum.present? && save_to_temp_file\n sum = File.open(upload_temp_file) do |f|\n Digest::MD5.hexdigest(f.read)\n end\n if sum == upload_md5sum\n result = true\n else\n errors.add(:image, :validate_image_md5_mismat... | [
"0.70543647",
"0.6816258",
"0.63778865",
"0.63415545",
"0.6295674",
"0.6194753",
"0.6156505",
"0.6068023",
"0.5964787",
"0.5944332",
"0.5935759",
"0.5910375",
"0.5894871",
"0.5890987",
"0.5881034",
"0.5858438",
"0.58345145",
"0.5828756",
"0.582807",
"0.5818547",
"0.5804796",
... | 0.79348 | 0 |
Wraps dump and writeFile. | def dumpFile(fname)
return writeFile(fname, self.dump())
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base_dump(file)\n begin\n File.open(file, 'w') do |file|\n yield(file)\n end\n end\n return true\n end",
"def write2(file = 'default', data, mode, size)\n dump_object(file)\n dump_object(data)\n dump_object(mode)\n dump_object(size)\n puts \"=====================... | [
"0.65259886",
"0.6456189",
"0.63099486",
"0.62468797",
"0.6226668",
"0.6118572",
"0.60620934",
"0.5996096",
"0.5945916",
"0.5931425",
"0.59201485",
"0.5880776",
"0.5877295",
"0.5876741",
"0.58721864",
"0.5851866",
"0.57895464",
"0.578402",
"0.5770275",
"0.5758295",
"0.5701272... | 0.6828007 | 0 |
def _dumpDir(dirname) Wraps _loadDir. | def loadDir(dirname)
old = Dir.getwd()
Dir.chdir(dirname)
ret = self._loadDir(dirname)
Dir.chdir(old)
return ret
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dump_directory\n @relative_location.end_with?('/') ? @relative_location + DUMP_DIRECTORY_NAME : @relative_location + '/' + DUMP_DIRECTORY_NAME\n end",
"def dump_directory\n \"--out='#{ @dump_path }'\"\n end",
"def dump_directory\n \"--out='#{ dump_path }'\"\n end",
"def d... | [
"0.6357531",
"0.6247115",
"0.6241988",
"0.62277025",
"0.5710858",
"0.5684173",
"0.54887116",
"0.53393656",
"0.5334635",
"0.5311789",
"0.53012586",
"0.53012586",
"0.53012586",
"0.52985007",
"0.52326125",
"0.5218465",
"0.52178735",
"0.52103764",
"0.52000093",
"0.5150896",
"0.51... | 0.6513894 | 0 |
GET /league_tables/1 GET /league_tables/1.xml | def show
@league_table = LeagueTable.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @league_table }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @leagueplayers = Leagueplayer.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @leagueplayers }\n end\n end",
"def show\n @league = League.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n f... | [
"0.6451098",
"0.63703674",
"0.63703674",
"0.63703674",
"0.63703674",
"0.6352201",
"0.63412976",
"0.6220617",
"0.6018882",
"0.5999589",
"0.59483916",
"0.5930342",
"0.58951145",
"0.5839134",
"0.5815406",
"0.57501346",
"0.5738683",
"0.5700189",
"0.5688944",
"0.5648927",
"0.56329... | 0.74260604 | 0 |
GET /league_tables/new GET /league_tables/new.xml | def new
@league_table = LeagueTable.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @league_table }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @league_table = LeagueTable.new(params[:league_table])\n\n respond_to do |format|\n if @league_table.save\n flash[:notice] = 'LeagueTable was successfully created.'\n format.html { redirect_to(@league_table) }\n format.xml { render :xml => @league_table, :status => :cr... | [
"0.7241225",
"0.70800316",
"0.70800316",
"0.68187946",
"0.6785994",
"0.6755716",
"0.6692516",
"0.6604269",
"0.6588799",
"0.6553818",
"0.6553818",
"0.6550964",
"0.65454745",
"0.6527757",
"0.65248597",
"0.64920974",
"0.64595383",
"0.64595383",
"0.64296705",
"0.63889533",
"0.636... | 0.7871366 | 0 |
POST /league_tables POST /league_tables.xml | def create
@league_table = LeagueTable.new(params[:league_table])
respond_to do |format|
if @league_table.save
flash[:notice] = 'LeagueTable was successfully created.'
format.html { redirect_to(@league_table) }
format.xml { render :xml => @league_table, :status => :created, :loca... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_table(payload)\n make_request(payload, 'post')\n [status, body]\n end",
"def new\n @league_table = LeagueTable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @league_table }\n end\n end",
"def create\n @web_table =... | [
"0.6079623",
"0.5907961",
"0.54107434",
"0.5343299",
"0.5330721",
"0.5310072",
"0.5306178",
"0.529068",
"0.5250692",
"0.5250344",
"0.52089465",
"0.5194067",
"0.515304",
"0.514038",
"0.5128012",
"0.5118266",
"0.5115671",
"0.5102289",
"0.50993943",
"0.50941205",
"0.50741446",
... | 0.6769517 | 0 |
PUT /league_tables/1 PUT /league_tables/1.xml | def update
@league_table = LeagueTable.find(params[:id])
respond_to do |format|
if @league_table.update_attributes(params[:league_table])
flash[:notice] = 'LeagueTable was successfully updated.'
format.html { redirect_to(@league_table) }
format.xml { head :ok }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @league_table = LeagueTable.find(params[:id])\n @league_table.destroy\n\n respond_to do |format|\n format.html { redirect_to(league_tables_url) }\n format.xml { head :ok }\n end\n end",
"def create\n @league_table = LeagueTable.new(params[:league_table])\n\n respond_to... | [
"0.57220364",
"0.57036227",
"0.567615",
"0.56425285",
"0.5585839",
"0.5405766",
"0.5401105",
"0.5369628",
"0.5364178",
"0.53434914",
"0.53130376",
"0.5296848",
"0.5259377",
"0.52561706",
"0.5240352",
"0.5221672",
"0.5212238",
"0.519636",
"0.5195961",
"0.51899546",
"0.51876545... | 0.6833095 | 0 |
DELETE /league_tables/1 DELETE /league_tables/1.xml | def destroy
@league_table = LeagueTable.find(params[:id])
@league_table.destroy
respond_to do |format|
format.html { redirect_to(league_tables_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @league = League.find(params[:id])\n @league.destroy\n\n respond_to do |format|\n format.html { redirect_to(leagues_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @league = League.find(params[:id])\n @league.destroy\n\n respond_to do |format|\n f... | [
"0.6287227",
"0.6287227",
"0.6280571",
"0.62142336",
"0.6169054",
"0.61204135",
"0.6115373",
"0.6107182",
"0.60840094",
"0.6062788",
"0.6046546",
"0.6017871",
"0.5998206",
"0.59914905",
"0.59687674",
"0.5951052",
"0.5926169",
"0.59260535",
"0.59059",
"0.5898321",
"0.58889234"... | 0.7144874 | 0 |
compute the order price to be paid | def compute_price
# set the initial state of an order
self.status = Order.possible_status[:wait_payment]
# use the visitor pattern to traverse the product and its upgrades
visitor = VisitorPrice.new
visitor.visit_product product
upgrades.each do |upgrade|
visito... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def price_for_order(order)\n price\n end",
"def total_price\n mrg = margin(pricing_policy)\n calculate(pricing_policy, mrg).round\n end",
"def for_order(product)\n regular_price(product)\n end",
"def payment_price\n\t\t\t\t\treturn self.price\n\t\t\t\tend",
"def price\n total_pr... | [
"0.83809066",
"0.77543306",
"0.76750356",
"0.7406325",
"0.73997563",
"0.73693043",
"0.7323799",
"0.7308147",
"0.72894084",
"0.7288207",
"0.72153187",
"0.7205732",
"0.71998507",
"0.7194203",
"0.7190225",
"0.7187791",
"0.7140506",
"0.7136966",
"0.713421",
"0.7121378",
"0.710852... | 0.7966675 | 1 |
Helper class method to lookup notes for the mixin notable type written by a given user. This method is NOT equivalent to Note.find_notes_for_user | def find_notes_by_user(user)
notable = ActiveRecord::Base.send(:class_name_of_active_record_descendant, self).to_s
Note.find(:all,
:conditions => ["user_id = ? and notable_type = ?", user.id, notable],
:order => "created_at DESC"
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_notes_for_notable(notable_str, notable_id)\n where(notable_type: notable_str, notable_id: notable_id)\n end",
"def load_noteable\n resource, id = request.path.split('/')[1, 2]\n @noteable = resource.singularize.classify.constantize.find(id)\n end",
"def load_notable\n res... | [
"0.6112454",
"0.61059386",
"0.5940672",
"0.5625281",
"0.55735195",
"0.5420942",
"0.5355449",
"0.5354145",
"0.5340143",
"0.52833474",
"0.5265634",
"0.5253207",
"0.5236409",
"0.51999056",
"0.5185547",
"0.51770777",
"0.5164131",
"0.5133173",
"0.51145893",
"0.50739324",
"0.505784... | 0.7647121 | 0 |
Ancestor classes in the Netzke class hierarchy up to (and excluding) +Netzke::Base+, including self; in comparison to Ruby's own Class.ancestors, the order is reversed. | def netzke_ancestors
if self == Netzke::Base
[]
else
superclass.netzke_ancestors + [self]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_ancestors(klass)\n klass.ancestors.select { |k| k.instance_of?(Class) } - [Object, BasicObject]\n end",
"def ancestors\n self.class.ancestors_of(self)\n end",
"def ancestors_of klass\n ancestors = []\n unexamined = [klass]\n seen = []\n loop do\n break if unex... | [
"0.74772376",
"0.7101577",
"0.70323515",
"0.69496506",
"0.6924547",
"0.6767807",
"0.67636216",
"0.67507654",
"0.6684564",
"0.66786104",
"0.65553886",
"0.654007",
"0.65213",
"0.64882505",
"0.64882505",
"0.64882505",
"0.64882505",
"0.63160515",
"0.6296172",
"0.6293609",
"0.6272... | 0.82789475 | 0 |
Public: Effectively makes the request url(String) A url String to make request req_type(String) The request type, should be get, post, put or delete key_level(Integer) The minimum key level required to make the request data(Hash) A Hash to send in request Returns a request result | def make_request(url, req_type, key_level, data = nil, sql = false)
check_key key_level
content_type = 'application/json'
if sql
content_type = 'application/sql'
end
headers = {
'Content-Type' => content_type,
'Authorization' => @api_key
}
@req = @reque... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _request(url, type, key)\n url = URI(url)\n type ||= :GET\n req_path = \"#{url.path}?#{url.query}\"\n\n if type == :GET\n req = Net::HTTP::Get.new(req_path)\n elsif type == :POST\n req = Net::HTTP::Post.new(req_path)\n end\n\n req.add_field('X-... | [
"0.7918791",
"0.6972477",
"0.68678236",
"0.66288906",
"0.65771776",
"0.65417224",
"0.63751376",
"0.63732195",
"0.6353059",
"0.62957275",
"0.62897104",
"0.6245744",
"0.6233446",
"0.618539",
"0.61832047",
"0.61502665",
"0.6120105",
"0.6114494",
"0.61032677",
"0.60984117",
"0.60... | 0.7990875 | 0 |
Public: Populates properties after request make | def populate_properties!
@status_code = @req.code
@headers = @req.header.to_hash.inspect
JSON.parse(@req.body, quirks_mode: true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_attributes\n setup_location_header\n # TODO: Should setup_content_length_header?\n setup_status_and_body\n end",
"def operational_values\n\t\treturn super.merge(\n\t\t\turi: self.uri,\n\t\t\thttp_method: self.http_method,\n\t\t\texpected_status: self.expected_sta... | [
"0.67989117",
"0.6203686",
"0.61909306",
"0.61909306",
"0.61376137",
"0.6083555",
"0.60704553",
"0.6054282",
"0.60402435",
"0.5987747",
"0.59863365",
"0.597973",
"0.59201",
"0.5900095",
"0.5846442",
"0.5825767",
"0.5785675",
"0.5780459",
"0.5779677",
"0.57651407",
"0.57624394... | 0.72841185 | 0 |
Request from an iPhone or iPod touch? (Mobile Safari user agent) | def iphone_user_agent?
request.env["HTTP_USER_AGENT"] && request.env["HTTP_USER_AGENT"][/(Mobile\/.+Safari)/]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_iphone_request?\n request.user_agent.downcase =~ /(mobile\\/.+safari)|(iphone)|(ipod)|(blackberry)|(symbian)|(series60)|(android)|(smartphone)|(wap)|(mobile)/\n end",
"def iphone_user_agent?\n request.env[\"HTTP_USER_AGENT\"] &&\n request.env[\"HTTP_USER_AGENT\" ][/(Mobile\\/.+Safari)/]\n end",... | [
"0.75509393",
"0.7535948",
"0.75236624",
"0.75236624",
"0.75236624",
"0.75041366",
"0.7493578",
"0.74671733",
"0.73676074",
"0.73013246",
"0.7249388",
"0.7185074",
"0.6875259",
"0.67941713",
"0.6783249",
"0.6658015",
"0.6639448",
"0.6629697",
"0.65598637",
"0.6514911",
"0.647... | 0.7616707 | 0 |
Are we ready to be attached to an instance? | def ready?
# TODO: Not sure if this is the only state we should be matching.
state == "Detached"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _ready?\n true\n end",
"def ready?\n true\n end",
"def ready?\n @ready == true\n end",
"def ready?\n end",
"def ec2_instance_ready?(instance)\n instance.exists? && instance.status.eql?(:running) && systems_ok(instance)\n end",
"def ready?\n @is_ready\n end",
... | [
"0.7452784",
"0.73837936",
"0.7373166",
"0.72822654",
"0.724845",
"0.72030437",
"0.719424",
"0.71664464",
"0.70645016",
"0.7061657",
"0.70471746",
"0.70471746",
"0.6950569",
"0.694484",
"0.6944376",
"0.69395566",
"0.69395566",
"0.69395566",
"0.69395566",
"0.69395566",
"0.6890... | 0.7435094 | 1 |
Mathematical representation of abs min = ((a + b absoulte(a b)) / 2) | def abs_min(x, y)
num = x - y
min_value = ((x + y - num.abs) / 2)
"The Abs Min of #{x} and #{y} is #{min_value}."
rescue StandardError
'Error: Provide number only!'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min(a,b)\n a < b ? a : b\n end",
"def min_of(a, b)\r\n return a <= b ? a : b\r\n end",
"def min(a,b)\n a >= b ? a : b\nend",
"def min(a,b)\n\tif !a.nil? and !b.nil?\n\t\treturn a if a <= b\n\t\treturn b\n\tend\t\n\t\n \treturn a if !a.nil? \n\n\treturn b if !b.nil?\nend",
"def min_2(x, y)\n ... | [
"0.7009603",
"0.6960389",
"0.6888999",
"0.67187893",
"0.6580813",
"0.65192413",
"0.6512644",
"0.64834815",
"0.64240617",
"0.6420063",
"0.6411798",
"0.6394879",
"0.63467115",
"0.63287616",
"0.6313636",
"0.62838054",
"0.62790364",
"0.6268018",
"0.62621087",
"0.62576383",
"0.624... | 0.69756484 | 1 |
=====ISSUE 8816 modified username uniqueness condition ===== | def check_username_uniqueness
if self.type == 'MultiSchoolAdmin'
h_user = self.higher_user
if h_user.present? and h_user.type == 'MultiSchoolAdmin' #higher user is client admin only when msg is created for the first time
user_detail = AdminUser.first(:joins=>[:school_group_user],
:conditio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def username_must_be_unique\n errors.add(:username, :taken) if username.present? && User.where(username: username).where.not(id: model.id).exists?\n end",
"def validate_username_is_unique(username)\n return false unless username != nil\n return !User.username_exists?(username)\n end",
"def all... | [
"0.7535464",
"0.70088",
"0.68099123",
"0.6772518",
"0.6772138",
"0.6761178",
"0.6481503",
"0.6445399",
"0.6436206",
"0.6360136",
"0.6312579",
"0.6275667",
"0.62567246",
"0.62492067",
"0.62492067",
"0.6243397",
"0.62293774",
"0.6219933",
"0.621492",
"0.61835545",
"0.61835545",... | 0.7138503 | 1 |
Shows all OnCore Records for a particular protocol | def history
respond_to do |format|
format.js {
@protocol_id = params[:protocol_id]
}
format.json {
@oncore_records = OncoreRecord.where(protocol_id: params[:protocol_id])
}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @protocol = Protocol.find(params[:id])\n @title = \"Protocols\"\n\n @s = Sampling.find(@protocol.sampling_id)\n @pt = Partner.find(@s.partner_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @protocol }\n end\n end",
"def index\n ... | [
"0.610626",
"0.58534545",
"0.584785",
"0.57157546",
"0.569937",
"0.56960607",
"0.56470793",
"0.5625314",
"0.5585003",
"0.5559493",
"0.5501871",
"0.5494711",
"0.5494711",
"0.5494711",
"0.5494711",
"0.5494711",
"0.54807603",
"0.54694146",
"0.54450315",
"0.5437888",
"0.5430762",... | 0.6209897 | 0 |
POST /aki_diagnoses POST /aki_diagnoses.json | def create
@aki_diagnosis = AkiDiagnosis.new(aki_diagnosis_params)
respond_to do |format|
if @aki_diagnosis.save
format.html { redirect_to @aki_diagnosis, notice: 'Diagnosis aki was successfully created.' }
format.json { render :show, status: :created, location: @aki_diagnosis }
els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aki_diagnosis_params\n params.require(:aki_diagnosis).permit(:patient_id, :creatinine_test_1_id, :creatinine_test_2_id, :stage, :reason, :increase_net, :increase_percentage)\n end",
"def create\n @diagcode = Diagcode.new(diagcode_params)\n\n respond_to do |format|\n if @diagcode.save\n ... | [
"0.6035396",
"0.5935166",
"0.58012676",
"0.5792979",
"0.5557096",
"0.5525847",
"0.5507189",
"0.53953975",
"0.5373726",
"0.52896017",
"0.523399",
"0.52231324",
"0.5218331",
"0.51587427",
"0.5151882",
"0.5097447",
"0.5094604",
"0.50620097",
"0.503677",
"0.50009423",
"0.49698833... | 0.63670707 | 0 |
PATCH/PUT /aki_diagnoses/1 PATCH/PUT /aki_diagnoses/1.json | def update
respond_to do |format|
if @aki_diagnosis.update(aki_diagnosis_params)
format.html { redirect_to @aki_diagnosis, notice: 'Diagnosis aki was successfully updated.' }
format.json { render :show, status: :ok, location: @aki_diagnosis }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @diagnosis = Diagnosis.find(params[:id])\n\n respond_to do |format|\n if @diagnosis.update_attributes(params[:diagnosis])\n format.html { redirect_to client_prof_inspections_path(@prof_inspection.client), notice: I18n.t(:record_updated) }\n format.json { head :ok }\n else... | [
"0.6149866",
"0.61367685",
"0.58766574",
"0.58647364",
"0.5854981",
"0.58525574",
"0.5841138",
"0.5810504",
"0.57594573",
"0.5734927",
"0.5730034",
"0.5696005",
"0.5692938",
"0.5676497",
"0.56587815",
"0.5656852",
"0.56536317",
"0.5643741",
"0.56404316",
"0.5639592",
"0.56307... | 0.64553136 | 0 |
DELETE /aki_diagnoses/1 DELETE /aki_diagnoses/1.json | def destroy
@aki_diagnosis.destroy
respond_to do |format|
format.html { redirect_to aki_diagnoses_url, notice: 'Diagnosis aki was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @diagnoz = Diagnoz.find(params[:id])\n @diagnoz.destroy\n\n respond_to do |format|\n format.html { redirect_to diagnozs_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def test_del\n header 'Content-Type', '... | [
"0.72031724",
"0.6936681",
"0.6812757",
"0.6762602",
"0.6684105",
"0.66283906",
"0.6577986",
"0.65526116",
"0.65128326",
"0.6494906",
"0.6492848",
"0.648834",
"0.648677",
"0.648677",
"0.648677",
"0.648677",
"0.64358366",
"0.64154327",
"0.640778",
"0.63766867",
"0.636347",
"... | 0.70232284 | 1 |
Starts the server. This method will not return; call it at the end of your server script. It will start all bots it knows about (i.e. bots added via add_bot before the server was started), and then listen for new instructions. | def start
EM.run do
@running = true
@bots.each do |key, bot|
begin
bot.start
rescue => e
log_error(e, "attempting to start bot #{bot.key}")
end
end
listen_for_instructions if queue
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start\n\t\tself.log.debug \"Starting.\"\n\t\tself.spawn_server\n\t\tself.read_hello\n\tend",
"def starting\n log(\"GlobalChat2 Server Running\")\n start_pong_loop\n end",
"def start\n @client.on :hello do\n puts \"Successfully connected, welcome '#{@client.self.name}' to the '#{@client.t... | [
"0.6876457",
"0.66206944",
"0.6618264",
"0.66096354",
"0.65219605",
"0.64619094",
"0.6450276",
"0.6337319",
"0.6336718",
"0.6305867",
"0.62911844",
"0.62634397",
"0.622364",
"0.6213438",
"0.6193505",
"0.6190148",
"0.61819977",
"0.61571705",
"0.6118437",
"0.6109788",
"0.609170... | 0.76011693 | 0 |
Starts the server in the background, via a Thread | def start_in_background
Thread.start { start }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start\n return if running?\n @running = true\n @thread = Thread.new {@server.start}\n end",
"def start\n @client.ping\n @state.set :run\n @thread ||= Thread.new{ work_loop }\n end",
"def start\n Thread.new do\n connect = false\n until con... | [
"0.8176372",
"0.7790582",
"0.76549095",
"0.7238335",
"0.72283083",
"0.7213775",
"0.7190397",
"0.7163835",
"0.7148324",
"0.7131787",
"0.70899796",
"0.70452744",
"0.6968665",
"0.6960278",
"0.6912109",
"0.6910548",
"0.690675",
"0.68855345",
"0.6875014",
"0.67820615",
"0.6757031"... | 0.8184581 | 0 |
Find a bot added to this server. Returns nil if no bot was found | def bot(key)
@bots[key]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bot\n @bot ||= Bot.new(ua)\n end",
"def bot_instance\n @bot_instance ||= BotInstance.find_by(bot_id: bot.id)\n end",
"def find_server(id: nil, name: nil)\n if id\n $bot.servers[id]\n elsif name\n $bot.servers.values.find{ |s| s.name.downcase.include?(name.downcase) } \n else\n nil\n... | [
"0.6330162",
"0.6305764",
"0.580883",
"0.57916814",
"0.568045",
"0.56239176",
"0.56187934",
"0.5585309",
"0.5504631",
"0.5376537",
"0.53606206",
"0.5323882",
"0.52377933",
"0.5137656",
"0.5089712",
"0.5043484",
"0.49918497",
"0.49683473",
"0.49680206",
"0.49530098",
"0.492240... | 0.6388562 | 0 |
Public Prints the events, as given in a hash | def print_events(events)
events.each do |name, description|
puts "Event: #{name}"
puts "Description: #{description} \n\n"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_events\n if @filtered_events.length.zero?\n puts 'List of events is empty'\n else\n (0..@filtered_events.length).each do |x|\n temp_event = @filtered_events[x]\n puts temp_event.trace\n end\n end\n end",
"def print_pod_events(pod)\n @output.puts \"POD EVENTS:... | [
"0.7329196",
"0.7054552",
"0.704815",
"0.69015515",
"0.6880788",
"0.67669153",
"0.66630995",
"0.6611564",
"0.66053194",
"0.65872246",
"0.6561582",
"0.6504947",
"0.64573157",
"0.6448476",
"0.64421016",
"0.6353915",
"0.6263802",
"0.62418497",
"0.6216855",
"0.61577237",
"0.61328... | 0.7991649 | 0 |
Public prints the events on a given date, else returns error code | def print_events_on_date(date)
return NO_EVENTS_IN_CALENDAR unless events?
return NO_EVENTS_AT_DATE unless events_at?(date)
events = @calendar_events[date]
puts "Your events on #{date}"
print_events(events)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_events_on_date(date)\n return nil unless events_at?(date)\n\n events = @calendar_events[date]\n puts 'You have following events on this date:'\n print_events(events)\n events\n end",
"def print_all_events\n return NO_EVENTS_IN_CALENDAR unless events?\n\n @calendar_events.each do |d... | [
"0.81838596",
"0.7119806",
"0.70167917",
"0.6895736",
"0.6835479",
"0.68239474",
"0.66460276",
"0.6630302",
"0.66135204",
"0.65164554",
"0.6472537",
"0.64109564",
"0.63559586",
"0.6345991",
"0.62835693",
"0.6272798",
"0.6272798",
"0.6251089",
"0.622746",
"0.62065214",
"0.6148... | 0.8193601 | 0 |
Public print the events of a certain month, else returns error string | def print_events_of_month(month)
return NO_EVENTS_IN_CALENDAR unless events?
puts "The events of #{MONTHS[month]}"
@calendar_events.each do |date, events_hash|
next if date.month != month
print_events(events_hash)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_calendar(year, month)\n week_day = Date.new(year, month, 1).cwday\n month_length = days_in_month(year, month)\n line = [\"Sun\\tMon\\tTues\\tWed\\tThurs\\tFri\\tSat\"]\n days = (1..month_length).to_a\n week_day.times { days.unshift(\"\\t\") }\n\n puts\n puts line\n days.each_slice... | [
"0.7052184",
"0.70218533",
"0.69378144",
"0.66548926",
"0.6466805",
"0.64223826",
"0.64223826",
"0.63937914",
"0.63884467",
"0.6326083",
"0.6311442",
"0.63089746",
"0.6264089",
"0.61897755",
"0.6137173",
"0.61003304",
"0.6069009",
"0.60434693",
"0.60307044",
"0.60181844",
"0.... | 0.81377536 | 0 |
Public returns true if calendar has events, false otherwise | def events?
!@calendar_events.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_calendar?\n \t\t!calendar.nil?\n \tend",
"def events_at?(date)\n !@calendar_events[date].empty?\n end",
"def empty?\n @events.empty?\n end",
"def event?\n @events_mutex.synchronize do\n !@events.empty?\n end\n end",
"def exist?\n !(@event.nil? || @event.... | [
"0.8393076",
"0.81513727",
"0.75863385",
"0.7418381",
"0.7148203",
"0.69883966",
"0.6979063",
"0.68826514",
"0.686194",
"0.68545395",
"0.68316466",
"0.68202955",
"0.68175906",
"0.68096447",
"0.67810696",
"0.6778355",
"0.6708912",
"0.66986233",
"0.66756606",
"0.6631399",
"0.66... | 0.9098121 | 0 |
Public returns true if there are events at given date, false otherwise | def events_at?(date)
!@calendar_events[date].empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def includes?(date)\n false\n end",
"def events?\n !@calendar_events.empty?\n end",
"def contains(date)\n if (date >= @start_date) && (date < @end_date)\n return true\n else\n date < @start_date || date >= @end_date\n return false\n end\n end",
"def ... | [
"0.75791365",
"0.7555389",
"0.7521478",
"0.74336094",
"0.741677",
"0.7345395",
"0.7323489",
"0.7323075",
"0.7292414",
"0.7277077",
"0.72246695",
"0.7210108",
"0.7062983",
"0.7033085",
"0.70201343",
"0.6964417",
"0.6948773",
"0.69317555",
"0.69050586",
"0.6892413",
"0.6816637"... | 0.8703914 | 0 |
Private returns true if a events with given name is in calendar, false otherwise | def event_name_exists?(date, event_name)
false if !events? || !events_at?(date)
@calendar_events[date].key?(event_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def events?\n !@calendar_events.empty?\n end",
"def has_calendar?\n \t\t!calendar.nil?\n \tend",
"def events_at?(date)\n !@calendar_events[date].empty?\n end",
"def event?(name)\n @events.keys.include?(name.to_sym)\n end",
"def has_event?(name)\n return self.events(true).include? nam... | [
"0.7291495",
"0.7179267",
"0.705499",
"0.69901186",
"0.6982901",
"0.694203",
"0.6448495",
"0.6294663",
"0.6135329",
"0.6118498",
"0.6111626",
"0.60167366",
"0.60080504",
"0.596312",
"0.59587896",
"0.59334975",
"0.5933325",
"0.5921879",
"0.5891436",
"0.5890515",
"0.5826124",
... | 0.74980897 | 0 |
GET /petition_reports GET /petition_reports.json | def index
@petition_reports = PetitionReport.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_petition_report\n @petition_report = PetitionReport.find(params[:id])\n end",
"def reports\n collection(\"reports\")\n end",
"def index\n @reports = Report.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n e... | [
"0.65825766",
"0.64901924",
"0.64802635",
"0.6454031",
"0.64473695",
"0.63990873",
"0.63963985",
"0.63676536",
"0.6348062",
"0.6288756",
"0.6267269",
"0.62650055",
"0.6249668",
"0.6238387",
"0.62174946",
"0.62164605",
"0.62106436",
"0.62105346",
"0.6202129",
"0.61957836",
"0.... | 0.78530717 | 0 |
POST /petition_reports POST /petition_reports.json | def create
@petition_report = PetitionReport.new(petition_report_params)
respond_to do |format|
if @petition_report.save
format.html { redirect_to @petition_report.petition, notice: 'Petition report was successfully created.' }
format.json { render :show, status: :created, location: @peti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @petition_reports = PetitionReport.all\n end",
"def petition_report_params\n params.require(:petition_report).permit(:title, :petition_id, :pr_committee_id, :decision_made, :report_date, :remark, :document)\n end",
"def create\n if !params[:reporter_name].nil? && !params[:pet_id].nil... | [
"0.7080256",
"0.69946796",
"0.6740113",
"0.6665395",
"0.6557934",
"0.6400697",
"0.64006776",
"0.6381835",
"0.6375324",
"0.63688135",
"0.63374734",
"0.62301475",
"0.6225077",
"0.62173575",
"0.62078506",
"0.61279595",
"0.61176187",
"0.61096174",
"0.6109147",
"0.6107552",
"0.609... | 0.74991494 | 0 |
PATCH/PUT /petition_reports/1 PATCH/PUT /petition_reports/1.json | def update
respond_to do |format|
if @petition_report.update(petition_report_params)
format.html { redirect_to @petition_report.petition, notice: 'Petition report was successfully updated.' }
format.json { render :show, status: :ok, location: @petition_report }
else
format.html {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @reports_part = ReportsPart.find(params[:id])\n\n if @reports_part.update(params[:reports_part])\n head :no_content\n else\n render json: @reports_part.errors, status: :unprocessable_entity\n end\n end",
"def update\n @custom_report = CustomReport.find(params[:id])\n\n i... | [
"0.66526306",
"0.66400015",
"0.656172",
"0.65593475",
"0.6528252",
"0.651717",
"0.64524114",
"0.64524114",
"0.6448119",
"0.64118445",
"0.6399474",
"0.6399474",
"0.63727254",
"0.6358264",
"0.63538367",
"0.63439506",
"0.63417804",
"0.633635",
"0.6332282",
"0.6324754",
"0.632349... | 0.7423353 | 0 |
DELETE /petition_reports/1 DELETE /petition_reports/1.json | def destroy
@petition_report.destroy
respond_to do |format|
format.html { redirect_to petition_reports_url, notice: 'Petition report was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @report.destroy!\n render json: {status: :ok}\n end",
"def destroy\n @pod_report.destroy\n respond_to do |format|\n format.html { redirect_to pod_reports_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|... | [
"0.75554526",
"0.7378818",
"0.7308003",
"0.7307481",
"0.7307481",
"0.7307481",
"0.7274989",
"0.72420806",
"0.721343",
"0.721343",
"0.721343",
"0.721343",
"0.71850806",
"0.7170959",
"0.71534264",
"0.71518546",
"0.7140973",
"0.7122607",
"0.71162635",
"0.7114735",
"0.71128815",
... | 0.7868264 | 0 |
input: String output: Integer of sum of ascii values of chars in String algorithm: initialize sum string to array iterate through array with each sum += char.ord return sum | def ascii_value(string)
sum = 0
string.chars.each do |char|
sum += char.ord
p char.ord.chr # Further Exploration
end
sum
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ascii_value(str)\n# characters = str.chars\n# sum = 0\n\n# characters.each do |char|\n# sum += char.ord # sum = sum + char.ord\n# end\n\n# sum\n\n return 0 if str == ''\n\n ords = str.chars.map {|c| c.ord }\n\n ords.reduce do |sum, c|\n sum + c\n end\nend",
"def ascii_value(str)\n sum = 0\n s... | [
"0.8572853",
"0.8487936",
"0.84211683",
"0.83954775",
"0.83833337",
"0.8347502",
"0.832602",
"0.832602",
"0.8316996",
"0.8256727",
"0.81229407",
"0.8062805",
"0.80426276",
"0.80187804",
"0.8012839",
"0.80120623",
"0.7962594",
"0.7891989",
"0.7854608",
"0.78112113",
"0.7690741... | 0.8489916 | 1 |
Truncate the file represented by path to length len in bytes, asynchronously. The operation will fail if the file does not exist or len is less than zero. | def truncate(path=nil,len=nil)
if path.class == String && len.class == Fixnum && block_given?
@j_del.java_method(:truncate, [Java::java.lang.String.java_class,Java::long.java_class,Java::IoVertxCore::Handler.java_class]).call(path,len,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
return s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def truncate(length) File.truncate(path, length) end",
"def truncate( len = 0 )\n _must_be_a_file # raises error\n _must_be_writable # raises error\n \n old_size = self.size\n padding = len > old_size ? \"\\0\" * (len - old_size) : \"\"\n \n self.write( self... | [
"0.74281836",
"0.6501736",
"0.62612206",
"0.62230545",
"0.592639",
"0.55199236",
"0.54910964",
"0.5216643",
"0.51664275",
"0.5129507",
"0.51035845",
"0.5061673",
"0.5048904",
"0.49448997",
"0.4925173",
"0.48732382",
"0.48442268",
"0.47867775",
"0.47366565",
"0.47134858",
"0.4... | 0.6599896 | 1 |
Change the permissions on the file represented by path to perms, asynchronously. The permission String takes the form rwxrx as specified <a href=" | def chmod(path=nil,perms=nil)
if path.class == String && perms.class == String && block_given?
@j_del.java_method(:chmod, [Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(path,perms,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chmod(mode) File.chmod(mode, path) end",
"def chmod mod, path\n add \"chmod #{mod} #{path}\", check_perms(mod, path)\n end",
"def update_permissions_on_storage\n if @options[:perms]\n response = system(\"chmod -R o+w #{File.join(@path, 'storage')}\")\n if response\n say_... | [
"0.63285863",
"0.62714213",
"0.61781317",
"0.6034236",
"0.5985592",
"0.5946613",
"0.5829708",
"0.58031464",
"0.58000165",
"0.5781999",
"0.5747796",
"0.57437474",
"0.5713904",
"0.571333",
"0.5684837",
"0.56752414",
"0.5643028",
"0.56272256",
"0.5613017",
"0.5527044",
"0.551531... | 0.6391462 | 0 |
Unlinks the link on the file system represented by the path link, asynchronously. | def unlink(link=nil)
if link.class == String && block_given?
@j_del.java_method(:unlink, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(link,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
return self
end
raise ArgumentError, "Invalid arguments w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_link(link)\n links.delete(link)\n end",
"def unlink\n self.class.unlink(@path)\n end",
"def unlink\n return if @unlinked\n begin\n File.unlink(@tmpfile.path)\n rescue Errno::ENOENT\n rescue Errno::EACCES\n # may not be able to unlink on Windows; just ignore\n r... | [
"0.6319216",
"0.62758833",
"0.6160672",
"0.61203337",
"0.6112987",
"0.6011272",
"0.6002885",
"0.6002264",
"0.59905726",
"0.5982234",
"0.5971979",
"0.5900465",
"0.5849454",
"0.57934326",
"0.5784248",
"0.57729256",
"0.57682246",
"0.5739378",
"0.5698999",
"0.5655024",
"0.5585505... | 0.67338276 | 0 |
Create the directory represented by path, asynchronously. The new directory will be created with permissions as specified by perms. The permission String takes the form rwxrx as specified in The operation will fail if the directory already exists. | def mkdir(path=nil,perms=nil)
if path.class == String && block_given? && perms == nil
@j_del.java_method(:mkdir, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(path,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
return self
elsif path.class == String ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mkdirs(path=nil,perms=nil)\n if path.class == String && block_given? && perms == nil\n @j_del.java_method(:mkdirs, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(path,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))\n return self\n elsif path.class... | [
"0.7032067",
"0.6589711",
"0.65725464",
"0.6440353",
"0.613402",
"0.6087606",
"0.60767305",
"0.60550064",
"0.6049779",
"0.60407794",
"0.59990793",
"0.5963442",
"0.5923551",
"0.5911223",
"0.5866297",
"0.5851646",
"0.5807985",
"0.58003074",
"0.57952785",
"0.5761357",
"0.5759290... | 0.71435124 | 0 |
Create the directory represented by path and any non existent parents, asynchronously. The new directory will be created with permissions as specified by perms. The permission String takes the form rwxrx as specified in The operation will fail if the directory already exists. | def mkdirs(path=nil,perms=nil)
if path.class == String && block_given? && perms == nil
@j_del.java_method(:mkdirs, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(path,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
return self
elsif path.class == Strin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mkdir(path=nil,perms=nil)\n if path.class == String && block_given? && perms == nil\n @j_del.java_method(:mkdir, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(path,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))\n return self\n elsif path.class =... | [
"0.718856",
"0.66925067",
"0.6495361",
"0.64890134",
"0.62076324",
"0.6096823",
"0.6081506",
"0.6068515",
"0.60670507",
"0.6060223",
"0.6058275",
"0.6016626",
"0.6014998",
"0.5991654",
"0.5984815",
"0.598199",
"0.5966718",
"0.5963517",
"0.5921951",
"0.5909312",
"0.5903977",
... | 0.72257066 | 0 |
Creates an empty file with the specified path and permissions perms, asynchronously. | def create_file(path=nil,perms=nil)
if path.class == String && block_given? && perms == nil
@j_del.java_method(:createFile, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(path,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
return self
elsif path.class... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def atomic_create_and_write_file(filename, perms = 0666)\n require 'tempfile'\n tmpfile = Tempfile.new(File.basename(filename), File.dirname(filename))\n tmpfile.binmode if tmpfile.respond_to?(:binmode)\n result = yield tmpfile\n tmpfile.close\n ATOMIC_WRITE_MUTEX.synchronize do\n ... | [
"0.63866687",
"0.6245432",
"0.62327486",
"0.61741394",
"0.5975821",
"0.59704226",
"0.59704226",
"0.5932062",
"0.58541507",
"0.5846917",
"0.5834747",
"0.5767565",
"0.57446194",
"0.57168245",
"0.5709928",
"0.5683251",
"0.563378",
"0.56156456",
"0.55954313",
"0.55771846",
"0.556... | 0.67691326 | 0 |
GET /transporter_payments GET /transporter_payments.json | def index
@transporter_payments = TransporterPayment.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def payments_json_response\n {\n key: 'payments',\n type: 'async',\n html: render_to_string(formats: ['html'], layout: false)\n }\n end",
"def payment(params)\n check_token\n\n Request.perform(:post, URI.parse(Urls::PAYMENTS_URL), headers_for_other, params.to_json)\n end",
"d... | [
"0.673928",
"0.64561814",
"0.6428601",
"0.6415779",
"0.6380556",
"0.6296583",
"0.6194623",
"0.61903256",
"0.61555403",
"0.60622203",
"0.60316676",
"0.5979177",
"0.5977114",
"0.5977114",
"0.5972338",
"0.59708065",
"0.5965024",
"0.59417653",
"0.59417653",
"0.59416234",
"0.59261... | 0.7302277 | 0 |
POST /transporter_payments POST /transporter_payments.json | def create
@transporter_payment = TransporterPayment.new(transporter_payment_params)
@payment_request = PaymentRequest.find(transporter_payment_params['payment_request_id'])
@payment_request.status = :closed
@transporter_payment.status = TransporterPayment.statuses[:open]
respond_to do |format|
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def payment(params)\n check_token\n\n Request.perform(:post, URI.parse(Urls::PAYMENTS_URL), headers_for_other, params.to_json)\n end",
"def transporter_payment_params\n params.require(:transporter_payment).permit(:payment_request_id, :cheque_no, :voucher_no, :bank_name, :paid_amount, :prepared_... | [
"0.70878416",
"0.66929",
"0.6602056",
"0.65764207",
"0.6567828",
"0.65208465",
"0.6414011",
"0.64040285",
"0.6383029",
"0.63639176",
"0.63639176",
"0.6321748",
"0.6275728",
"0.6184955",
"0.61841744",
"0.61605275",
"0.6144201",
"0.61316186",
"0.6129502",
"0.61268526",
"0.60922... | 0.6847171 | 1 |
PATCH/PUT /transporter_payments/1 PATCH/PUT /transporter_payments/1.json | def update
respond_to do |format|
if @transporter_payment.update(transporter_payment_params)
format.html { redirect_to @transporter_payment, notice: 'Transporter payment was successfully updated.' }
format.json { render :show, status: :ok, location: @transporter_payment }
else
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @transporter = Transporter.find(params[:id])\n\n respond_to do |format|\n if @transporter.update_attributes(params[:transporter])\n format.html { redirect_to @transporter, notice: 'Transporter was successfully updated.' }\n format.json { head :no_content }\n else\n ... | [
"0.62144166",
"0.6174084",
"0.61491746",
"0.6059737",
"0.60575014",
"0.6005365",
"0.59911764",
"0.5990772",
"0.5933628",
"0.590939",
"0.5886198",
"0.5863887",
"0.58587897",
"0.583484",
"0.58293205",
"0.5816843",
"0.5816843",
"0.5816843",
"0.5816843",
"0.5816843",
"0.5816843",... | 0.7020413 | 0 |
DELETE /transporter_payments/1 DELETE /transporter_payments/1.json | def destroy
@transporter_payment.destroy
respond_to do |format|
format.html { redirect_to transporter_payments_url, notice: 'Transporter payment was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def destroy\n @payment_txn.destroy\n respond_to do |format|\n format.html { redirect_to payment_txns_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @paymentt.destroy\n ... | [
"0.71083695",
"0.70724934",
"0.706407",
"0.7000962",
"0.69865626",
"0.69865626",
"0.69865626",
"0.69865626",
"0.69865626",
"0.69865626",
"0.69865626",
"0.6940303",
"0.6940303",
"0.6940303",
"0.6940303",
"0.6940303",
"0.6940303",
"0.6940303",
"0.6940303",
"0.6940303",
"0.68786... | 0.74690217 | 0 |
this code was taken from the prometheus_exporter project: it is licensed with an MIT license measures the queue time (= time between receiving the request in downstream load balancer and starting request in ruby process) | def measure_queue_time(env)
start_time = queue_start(env)
return unless start_time
queue_time = request_start.to_f - start_time.to_f
queue_time unless (queue_time < 0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def measure_queue_time(env)\n start_time = queue_start(env)\n\n return unless start_time\n\n queue_time = request_start.to_f - start_time.to_f\n queue_time unless queue_time.negative?\n end",
"def queue_time_ms\n # Controller logic\n if converter_results[:queue_time] && converter_resul... | [
"0.795545",
"0.71722555",
"0.70047295",
"0.68679357",
"0.67066646",
"0.6610415",
"0.648932",
"0.6488657",
"0.64266646",
"0.6296118",
"0.62901497",
"0.6267283",
"0.62389064",
"0.60957915",
"0.6087807",
"0.60509104",
"0.5986269",
"0.5935711",
"0.5920622",
"0.5896305",
"0.589414... | 0.7903901 | 1 |
get the content of the xqueuestart or xrequeststart header | def queue_start(env)
value = env['HTTP_X_REQUEST_START'] || env['HTTP_X_QUEUE_START']
unless value.nil? || value == ''
convert_header_to_ms(value.to_s)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def queue_start\n $HTTP_X_QUEUE_START = nil\n begin\n $HTTP_X_QUEUE_START = request.headers[\"HTTP_X_REQUEST_START\"] if request.headers[\"HTTP_X_REQUEST_START\"]\n end rescue nil\n end",
"def getHeader()\n header = \"\"\n\n appendStr(header, \"time\")\n appendStr(header, \"seqno\")\n $cmd_li... | [
"0.6591154",
"0.6372276",
"0.606047",
"0.5973762",
"0.58787364",
"0.5875643",
"0.58544356",
"0.5826225",
"0.5801932",
"0.5779645",
"0.57503605",
"0.56827337",
"0.5646493",
"0.5620273",
"0.5597522",
"0.5575035",
"0.5569865",
"0.5555226",
"0.55016744",
"0.55016744",
"0.55016744... | 0.6481789 | 1 |
Runs the appropriate tasks on all registered plugins based on the passed changes. | def run_on_changes(modified, added, removed)
types = {
MODIFICATION_TASKS => modified,
ADDITION_TASKS => added,
REMOVAL_TASKS => removed
}
::Guard::UI.clearable
_scoped_plugins do |plugin|
::Guard::UI.clear
types.each do |tasks, unmatched_paths|
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_on_changes(modified, added, removed)\n types = {\n MODIFICATION_TASKS => modified,\n ADDITION_TASKS => added,\n REMOVAL_TASKS => removed\n }\n\n UI.clearable!\n\n session.grouped_plugins.each_value do |plugins|\n _run_group_plugins(plugins) do |plugin|\n ... | [
"0.78267807",
"0.65556407",
"0.6476205",
"0.6426292",
"0.62691206",
"0.6153143",
"0.6132381",
"0.6118983",
"0.61102474",
"0.6110134",
"0.60833937",
"0.60649496",
"0.6042637",
"0.60353386",
"0.60324043",
"0.60314333",
"0.59862465",
"0.59783864",
"0.5964249",
"0.5942205",
"0.59... | 0.76717365 | 1 |
Run a Guard plugin task, but remove the Guard plugin when his work leads to a system failure. When the Group has `:halt_on_fail` disabled, we've to catch `:task_has_failed` here in order to avoid an uncaught throw error. | def _supervise(plugin, task, *args)
catch self.class.stopping_symbol_for(plugin) do
plugin.hook("#{ task }_begin", *args)
begin
result = plugin.send(task, *args)
rescue Interrupt
throw(:task_has_failed)
end
plugin.hook("#{ task }_end", result)
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _supervise(plugin, task, *args)\n catch self.class.stopping_symbol_for(plugin) do\n plugin.hook(\"#{task}_begin\", *args)\n result = UI.options.with_progname(plugin.class.name) do\n plugin.send(task, *args)\n rescue Interrupt\n throw(:task_has_failed)\n end\n ... | [
"0.66173434",
"0.66074955",
"0.6055789",
"0.5870966",
"0.56679165",
"0.5663296",
"0.5588113",
"0.5440322",
"0.54024893",
"0.5387958",
"0.53766066",
"0.5351692",
"0.5332864",
"0.52094185",
"0.51999366",
"0.5192937",
"0.51861304",
"0.5164621",
"0.5159965",
"0.51488525",
"0.5148... | 0.6941676 | 0 |
Loop through all groups and run the given task for each Guard plugin. If no scope is supplied, the global Guard scope is taken into account. If both a plugin and a group scope is given, then only the plugin scope is used. Stop the task run for the all Guard plugins within a group if one Guard throws `:task_has_failed`. | def _scoped_plugins(scopes = {})
fail "NO PLUGIN SCOPE" if scopes.nil?
if plugins = _current_plugins_scope(scopes)
plugins.each do |guard|
yield(guard)
end
else
_current_groups_scope(scopes).each do |group|
fail "Invalid group: #{group.inspect}" unless group... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(task, scope_hash = [])\n scopes, unknown = session.convert_scopes(scope_hash)\n\n if unknown.any?\n UI.info \"Unknown scopes: #{unknown.join(', ')}\"\n end\n\n Lumberjack.unit_of_work do\n grouped_plugins = session.grouped_plugins(scopes)\n grouped_plugins.each_valu... | [
"0.67552435",
"0.56122273",
"0.52619576",
"0.49087697",
"0.4837448",
"0.47053397",
"0.46954185",
"0.468315",
"0.46789584",
"0.4647591",
"0.46372503",
"0.46352407",
"0.45474485",
"0.45068565",
"0.44891936",
"0.44621685",
"0.4460998",
"0.44199815",
"0.44124892",
"0.44009614",
"... | 0.7069946 | 0 |
Returns the current plugins scope. Local plugins scope wins over global plugins scope. If no plugins scope is found, then NO plugins are returned. | def _current_plugins_scope(scope)
return nil unless (plugins = _find_non_empty_plugins_scope(scope))
Array(plugins).map { |plugin| _instantiate(:plugin, plugin) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _find_non_empty_plugins_scope(scope)\n fail \"NO PLUGIN SCOPE\" if scope.nil?\n _find_non_empty_scope(:plugin, scope)\n end",
"def current_scope\n if ss = method.staticscope\n return ss.module\n else\n home.current_scope\n end\n end",
"def plugins\n @plugins ||= Plugin... | [
"0.685249",
"0.6307115",
"0.6168254",
"0.6158539",
"0.61395246",
"0.60748184",
"0.604962",
"0.6027097",
"0.6021148",
"0.6020267",
"0.59925216",
"0.5964436",
"0.59548837",
"0.5947373",
"0.58032525",
"0.5797098",
"0.5776098",
"0.57558304",
"0.5699712",
"0.56762624",
"0.5659358"... | 0.7782153 | 0 |
Returns the current groups scope. Local groups scope wins over global groups scope. If no groups scope is found, then ALL groups are returned. | def _current_groups_scope(scope)
found = _find_non_empty_groups_scope(scope)
groups = Array(found).map { |group| _instantiate(:group, group) }
return groups if groups.any? { |g| g.name == :common }
([_instantiate(:group, :common)] + Array(found)).compact
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _find_non_empty_groups_scope(scope)\n _find_non_empty_scope(:group, scope, ::Guard.groups)\n end",
"def visible_groups\n @visible_groups ||= begin\n filter_visible_groups_for_user(self.current_groups)\n end\n end",
"def get_current_group\n sd = get_security_descriptor\n\n ... | [
"0.6747401",
"0.6320861",
"0.6312425",
"0.6172887",
"0.6159802",
"0.61179847",
"0.5973109",
"0.5964864",
"0.5963043",
"0.59495026",
"0.5947533",
"0.5941683",
"0.5905661",
"0.58088017",
"0.58088017",
"0.58088017",
"0.58088017",
"0.58088017",
"0.58088017",
"0.5799237",
"0.57816... | 0.80857056 | 0 |
Find the first non empty plugins scope | def _find_non_empty_plugins_scope(scope)
fail "NO PLUGIN SCOPE" if scope.nil?
_find_non_empty_scope(:plugin, scope)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _current_plugins_scope(scope)\n return nil unless (plugins = _find_non_empty_plugins_scope(scope))\n\n Array(plugins).map { |plugin| _instantiate(:plugin, plugin) }\n end",
"def _find_non_empty_scope(type, local_scope, *additional_possibilities)\n found = [\n local_scope[:\"#{type}s\... | [
"0.67446804",
"0.59208864",
"0.57379675",
"0.56762135",
"0.5525562",
"0.54169047",
"0.54144454",
"0.5389635",
"0.5354791",
"0.5332994",
"0.5296968",
"0.5286885",
"0.52688205",
"0.52568126",
"0.5227135",
"0.5225066",
"0.5217636",
"0.5214285",
"0.52045506",
"0.5171606",
"0.5155... | 0.7952452 | 0 |
Find the first non empty groups scope | def _find_non_empty_groups_scope(scope)
_find_non_empty_scope(:group, scope, ::Guard.groups)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _current_groups_scope(scope)\n found = _find_non_empty_groups_scope(scope)\n groups = Array(found).map { |group| _instantiate(:group, group) }\n return groups if groups.any? { |g| g.name == :common }\n ([_instantiate(:group, :common)] + Array(found)).compact\n end",
"def first\n fir... | [
"0.66242397",
"0.6325621",
"0.6075108",
"0.60333085",
"0.56512016",
"0.5527957",
"0.5520768",
"0.54618216",
"0.54261076",
"0.5359667",
"0.53405327",
"0.5339393",
"0.5329648",
"0.52794546",
"0.5247306",
"0.52389467",
"0.5214953",
"0.5207994",
"0.5207321",
"0.520443",
"0.520142... | 0.7445821 | 0 |
is_my_post? returns true if the userid parameter is the same as the current_user's user id so that only certain views or parameters are shown for that post only if it is yours or not yours | def is_my_post?(userid)
#if someone is logged in
if @current_user
#if the user id of the post is the user id of the person logged in => it is my post
if @current_user.id == userid
return true
# it isn't my post
else
return false
end
#It isn't my post because I'm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def only_current_user_posts\n\t\t\t@user = User.find( params[:user_id] )\n\t\t\tredirect_to(root_url) unless @user == current_user\n\t\tend",
"def can_be_viewed_by?(user)\n # you can always view your own tlog\n return true if user && user.id == self.id\n\n # skip if current user is blacklisted\n retu... | [
"0.67990476",
"0.6698506",
"0.6689646",
"0.6567904",
"0.6540188",
"0.6540188",
"0.6470375",
"0.64408046",
"0.64346486",
"0.63938534",
"0.63686335",
"0.62999946",
"0.62555885",
"0.62232167",
"0.61931556",
"0.61864567",
"0.6174192",
"0.61520326",
"0.6140524",
"0.612709",
"0.611... | 0.8269477 | 0 |
POST /hotdeals POST /hotdeals.json | def create
@hotdeal = current_user.hotdeals.build(hotdeal_params)
respond_to do |format|
if @hotdeal.save
format.html { redirect_to @hotdeal, notice: 'Hotdeal was successfully created.' }
format.json { render :show, status: :created, location: @hotdeal }
else
format.html { r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @hotsale = Hotsale.new(hotsale_params)\n\n respond_to do |format|\n if @hotsale.save\n format.html { redirect_to @hotsale, notice: 'Hotsale was successfully created.' }\n format.json { render :show, status: :created, location: @hotsale }\n else\n format.html { rend... | [
"0.5996497",
"0.5844797",
"0.58192146",
"0.5779278",
"0.577812",
"0.55925924",
"0.55692595",
"0.5505577",
"0.54550856",
"0.53971845",
"0.5387114",
"0.53757876",
"0.5371489",
"0.5361002",
"0.5305841",
"0.5305426",
"0.5292404",
"0.52778983",
"0.52767885",
"0.52759457",
"0.52696... | 0.6930486 | 0 |
PATCH/PUT /hotdeals/1 PATCH/PUT /hotdeals/1.json | def update
respond_to do |format|
if @hotdeal.update(hotdeal_params)
format.html { redirect_to @hotdeal, notice: 'Hotdeal was successfully updated.' }
format.json { render :show, status: :ok, location: @hotdeal }
else
format.html { render :edit }
format.json { render json... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n recipe.update(recipe_params)\n render json: recipe\n end",
"def update\n @flat_happening = FlatHappening.find(params[:id])\n\n if @flat_happening.update_attributes(params[:flat_happening])\n head :no_content\n else\n render json: @flat_happening.errors, status: :u... | [
"0.63228345",
"0.63151973",
"0.63048667",
"0.62981075",
"0.6262253",
"0.6252895",
"0.6218598",
"0.6188694",
"0.6187513",
"0.61723155",
"0.61611",
"0.6156698",
"0.6141195",
"0.6099761",
"0.6089849",
"0.6089066",
"0.60870284",
"0.6084838",
"0.60832125",
"0.6083197",
"0.6051838"... | 0.6411418 | 0 |
DELETE /hotdeals/1 DELETE /hotdeals/1.json | def destroy
@hotdeal.destroy
respond_to do |format|
format.html { redirect_to hotdeals_url, notice: 'Hotdeal was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @meal.destroy\n\n respond_to do |format|\n format.html { redirect_to meals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meal_dish.destroy\n respond_to do |format|\n format.html { redir... | [
"0.6972935",
"0.67854357",
"0.67685306",
"0.67676663",
"0.6758226",
"0.6705753",
"0.67044026",
"0.6693137",
"0.66875356",
"0.6668308",
"0.6663608",
"0.6663608",
"0.66594523",
"0.6645876",
"0.66403925",
"0.66258883",
"0.66238207",
"0.6621297",
"0.66064405",
"0.6603443",
"0.660... | 0.7039351 | 0 |
GET /tools_cards GET /tools_cards.json | def index
@tools_cards = ToolsCard.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cards(options = { :filter => :open })\n return @cards if @cards\n @cards = Client.get(\"/boards/#{id}/cards\").json_into(Card)\n end",
"def fetch_cards\n log 'fetch_cards'\n data = get(PRODUCTS_ENDPOINT, fields: { carteras: false,listaSolicitada: 'TODOS',indicadorSaldoPreTarj: fa... | [
"0.6976086",
"0.6972584",
"0.670816",
"0.65802276",
"0.6562558",
"0.6562558",
"0.65030545",
"0.6346565",
"0.63423425",
"0.6340359",
"0.6327448",
"0.629113",
"0.6287761",
"0.6259882",
"0.6259882",
"0.6259882",
"0.6259882",
"0.6259882",
"0.62497157",
"0.62252027",
"0.62191755",... | 0.7323502 | 0 |
PATCH/PUT /tools_cards/1 PATCH/PUT /tools_cards/1.json | def update
params[:content] = nil if params[:content].blank?
respond_to do |format|
if @tools_card.update(tools_card_params)
format.html {
redirect_to @tools_card
flash[:success] = 'Zaktualizowano poprawnie.'
}
format.json { render :show, status: :ok, location... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n # @card = Card.find(params[:id])\n # @card.update(card_params)\n # render json: @card\n end",
"def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to tarot_cards_path(@tarot), notice: 'Card was successfully updated.' }\n ... | [
"0.6634642",
"0.66342515",
"0.6548884",
"0.6523851",
"0.6523679",
"0.64543885",
"0.63927907",
"0.63916",
"0.63916",
"0.63916",
"0.6354942",
"0.63452643",
"0.6338504",
"0.6320512",
"0.6262175",
"0.62581336",
"0.62403774",
"0.6211762",
"0.6206614",
"0.62062687",
"0.6198673",
... | 0.6664429 | 0 |
Describe the given synonym by querying the given schema. | def describe_synonym(schema_name, synonym_name) #:nodoc:
raise NoMethodError, "Not implemented for this raw driver"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def synonyms #:nodoc:\n select_all(\"SELECT synonym_name, table_owner, table_name, db_link FROM all_synonyms where owner = SYS_CONTEXT('userenv', 'session_user')\").collect do |row|\n OracleEnhanced::SynonymDefinition.new(oracle_downcase(row[\"synonym_name\"]),\n oracle_downcase(ro... | [
"0.5713963",
"0.54908746",
"0.5429849",
"0.5412811",
"0.5411544",
"0.54044384",
"0.5394183",
"0.5338074",
"0.5328277",
"0.52989924",
"0.5296456",
"0.5274533",
"0.5255483",
"0.5236244",
"0.52166367",
"0.5195086",
"0.51837164",
"0.5163437",
"0.5138423",
"0.5117121",
"0.50853497... | 0.79663336 | 0 |
Check for creatures in the cell. Returns nil if none, the creature if any | def creature?(x,y)
ret = nil
if @player
ret = @player if @player.x == x && @player.y == y
end
if @creatures
@creatures.each do |c|
ret = c if (c.x == x && c.y == y)
end
end
return ret
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_creature?\r\n not @creatures.empty?\r\n end",
"def creature\n fetch('books.the_kingkiller_chronicle.creatures')\n end",
"def findCreature(being)\r\n\t\treturn @creatures.index(being)\r\n\tend",
"def creature_in_dir?(dir)\n px, py = @player.next_cell(dir)\n c = creature?(px,p... | [
"0.6773396",
"0.5957824",
"0.58746535",
"0.54984474",
"0.53421634",
"0.52092654",
"0.50837284",
"0.5069887",
"0.49959165",
"0.49490416",
"0.49319068",
"0.4908697",
"0.48860836",
"0.48736265",
"0.48602468",
"0.48521227",
"0.48437566",
"0.47967315",
"0.47935742",
"0.478172",
"0... | 0.61774796 | 1 |
Check for creatures in said dir from player. Returns nil if none, the creature if any | def creature_in_dir?(dir)
px, py = @player.next_cell(dir)
c = creature?(px,py)
if c then return c
else return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def creature?(x,y)\n ret = nil\n if @player\n ret = @player if @player.x == x && @player.y == y\n end\n if @creatures\n @creatures.each do |c|\n ret = c if (c.x == x && c.y == y)\n end\n end\n return ret\n end",
"def has_creature?\r\n not @creatures.empty?\r\n end",
... | [
"0.63197005",
"0.5853216",
"0.55555123",
"0.54900926",
"0.53998655",
"0.5392764",
"0.5369496",
"0.5214893",
"0.51980484",
"0.50845104",
"0.5060708",
"0.5051278",
"0.5037752",
"0.4910686",
"0.4893996",
"0.48689696",
"0.48681584",
"0.48536205",
"0.48401216",
"0.48283106",
"0.48... | 0.7014731 | 0 |
Populates a map with a set of n random creatures It returns an array of created creatures | def populate_map(map, n)
ret = Array.new
n.times do
begin
x, y = [rand(map.width), rand(map.height)]
end while(not empty?(x,y,map))
creat = CreatureGenerator.create_random(self, x, y)
ret << creat
end
return ret
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def populate_random(n)\n n.times do\n set(rand(0...@x_size), rand(0...@y_size), :alive)\n end\n end",
"def rand_population(n)\r\n\t\treturn Array.new(n) { Snek.new(@start_x,@start_y, Array.new(@nb_heuristic) { @random.rand(-5.0..5.0) }) }\r\n\tend",
"def create_random_world\n randomize_terrain\n... | [
"0.6715457",
"0.66164917",
"0.65023065",
"0.64945674",
"0.64252263",
"0.6205188",
"0.6166787",
"0.61578345",
"0.61264724",
"0.610319",
"0.6035586",
"0.60243565",
"0.6020403",
"0.6014409",
"0.5980732",
"0.59514856",
"0.5930615",
"0.591829",
"0.590701",
"0.5906289",
"0.587706",... | 0.8200362 | 0 |
Adds a new creature to the game, on the current map | def add_creature(name, x, y, sex=nil)
case rand(2)
when 0 then sex = :M
when 1 then sex = :F
end unless sex
creat = CreatureGenerator.create(self, name, x, y, sex)
@creatures << creat
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n creature = Creature.create(creature_params)\n if creature.save\n redirect_to creature_path(creature)\n end\n end",
"def add_monster\n coord = get_empty_coords()\n x_coord = coord[0]\n y_coord = coord[1]\n\n new_monster = Monster.new(x_coord, y_coord, @x_size, @y_size)\n ... | [
"0.6518485",
"0.63323855",
"0.6312577",
"0.6300323",
"0.6266832",
"0.62466025",
"0.6234303",
"0.6231262",
"0.62119746",
"0.617432",
"0.6144685",
"0.60801685",
"0.60801685",
"0.60801685",
"0.60774714",
"0.60774714",
"0.60774714",
"0.6041042",
"0.6028336",
"0.6016677",
"0.60166... | 0.7050626 | 0 |
Changes the current map | def change_map(i, j)
@world_map.current = [i,j]
@map = @world_map.current
if !@world_map.creatures
rep = CreatureRepartition.create_random(
@time,
CreatureGenerator.names,
20
)
@world_map.creatures = rep
else
@world_map.creatures.evolve!(@time... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_map!(key)\n @map.set(key, @store.last)\n end",
"def changes map_old, map_new\n\nend",
"def set_map\n # Sets locations on the map\n @map = [\n ['Enumerable Canyon', 'Duck Type Beach', 'Monkey Patch City'],\n ['Duck Type Beach', 'Enumerable Canyon', 'Matzburg'],\n ['Monkey Pat... | [
"0.6948113",
"0.6866379",
"0.68348265",
"0.67826074",
"0.67236483",
"0.6651446",
"0.6633563",
"0.6597307",
"0.6573768",
"0.6573768",
"0.6573768",
"0.6573768",
"0.6573768",
"0.6573768",
"0.64417815",
"0.6429707",
"0.6412167",
"0.6389226",
"0.63862216",
"0.63372815",
"0.6335725... | 0.68954927 | 1 |
Extracts the lines from a file and executes the State Machine for each of these lines | def parse_file(file_name)
state_machine = builder.build
File.foreach(file_name).with_index do |line, _line_num|
builder.reset
state_machine.line = clean_line(line)
state_machine.execute
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_file(file)\n\n\n File.readlines(file).each do |line|\n command = parse_command(line)\n end\n # File.readlines(file).each do |line|\n # command = parse_command(line)\n # apply_command(command)\n end",
"def extract_steps file\n in_cmd_block = false\n cmd... | [
"0.6406589",
"0.60597783",
"0.6034607",
"0.5954849",
"0.5954492",
"0.5897214",
"0.58968097",
"0.5853625",
"0.5796936",
"0.5769261",
"0.57500476",
"0.5731973",
"0.57172316",
"0.56811017",
"0.5667992",
"0.5667331",
"0.56410575",
"0.56405824",
"0.56271076",
"0.5571087",
"0.55504... | 0.7156131 | 0 |
indicate whether an aperture value is present | def aperture?
!aperture.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_value?(p0) end",
"def has_value?\n true\n end",
"def has_value?\n false\n end",
"def value?(value) true end",
"def has_value?(value); end",
"def value?(p0) end",
"def confirm_attribs?\n\n #begin\n \n width, height = Dimensions.dimensions(tmpfile.path) \... | [
"0.67832243",
"0.6564308",
"0.64717597",
"0.63902295",
"0.63239086",
"0.6293506",
"0.62829435",
"0.62652457",
"0.62316436",
"0.61639917",
"0.61639917",
"0.6163791",
"0.6159925",
"0.6151705",
"0.614808",
"0.61019576",
"0.60947406",
"0.60914123",
"0.60827595",
"0.60537064",
"0.... | 0.83603084 | 0 |
return the IPTCembedded caption | def caption
image_iptc["Caption"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def caption; end",
"def alt_text\n alt = ''\n\n if self.caption.present?\n alt << self.caption\n alt << ' - '\n end\n\n if self.description.present?\n alt << self.description\n end\n\n return alt\n end",
"def caption\n\t\ttitle || alt || ''\n\tend",
"def captioned_title\n ... | [
"0.6833783",
"0.6807571",
"0.6741656",
"0.67056954",
"0.65764385",
"0.657247",
"0.657247",
"0.63569325",
"0.62219816",
"0.61970323",
"0.6192315",
"0.6165078",
"0.61230165",
"0.61230165",
"0.6114231",
"0.6097579",
"0.6081575",
"0.60805625",
"0.6006646",
"0.5980964",
"0.5932963... | 0.8168166 | 0 |
return the focal length as in integer, measured in millimeters, or nil if not present | def focal_length
l = image_exif["FocalLength"]
return nil if l.blank?
(Rational(*(l.split('/').map( &:to_i )))).to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def focal_lengths_to_zoom str\n min_focal_length = get_min_f(str)\n max_focal_length = get_max_f(str)\n zoom = (max_focal_length / min_focal_length) if min_focal_length and max_focal_length\n #debugger if zoom <= 1\n return zoom || nil\n end",
"def abs_length()\n case @facing\n when :north,... | [
"0.69562715",
"0.6370493",
"0.6253848",
"0.6215162",
"0.6168899",
"0.5920567",
"0.5920305",
"0.57899886",
"0.5771336",
"0.57067055",
"0.5701422",
"0.5635503",
"0.5615929",
"0.5590534",
"0.5559",
"0.5547442",
"0.55298084",
"0.5506679",
"0.5502905",
"0.5489416",
"0.54889536",
... | 0.83655536 | 0 |
indicate whether a focal length value is present | def focal_length?
!focal_length.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def focal_length\n l = image_exif[\"FocalLength\"]\n return nil if l.blank?\n (Rational(*(l.split('/').map( &:to_i )))).to_i\n end",
"def valid?\n if @freq.nil?\n false\n elsif frequency_length < @duration\n false\n else\n true\n end\n end",
"def aperture?\... | [
"0.62403816",
"0.6192295",
"0.61324126",
"0.6123784",
"0.6067341",
"0.5917332",
"0.58522576",
"0.5849491",
"0.58456075",
"0.58158004",
"0.57699054",
"0.56965566",
"0.5690706",
"0.5651281",
"0.5642541",
"0.56411844",
"0.5640347",
"0.5631978",
"0.55826426",
"0.557374",
"0.55632... | 0.8287266 | 0 |
return the IPTC headline if present | def headline
image_iptc["Headline"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def heading\n render_citation(@document)\n end",
"def article_headline(article)\n unless article.headline.nil?\n if article.in_flash_section?\n headline = content_tag('span', \"Flash: #{article.headline}\", :class => 'red')\n elsif article.in_new_section?\n headline = content_tag('... | [
"0.64251775",
"0.63970745",
"0.6371412",
"0.63662976",
"0.6202928",
"0.618312",
"0.6177018",
"0.6138315",
"0.61071026",
"0.6097946",
"0.60726154",
"0.6050349",
"0.59376216",
"0.5921245",
"0.589698",
"0.58558464",
"0.5827449",
"0.58027214",
"0.5798758",
"0.5764753",
"0.5758979... | 0.79519355 | 0 |
return the IPTC release date, or default to today | def release_date
read_attribute(:release_date) || write_attribute(:release_date, default_release_date)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def release_date(version = Origen.app.version.prefixed)\n time = release_time(version)\n time ? time.to_date : nil\n end",
"def release_date\n release_dates.first[:date] rescue nil\n end",
"def release_date\n sanitize_release_date(document.search('h5[text()*=Release Date]').first.next... | [
"0.7631747",
"0.7216816",
"0.70819527",
"0.70012754",
"0.6965678",
"0.6952504",
"0.69283843",
"0.6848283",
"0.675077",
"0.6707296",
"0.6610574",
"0.6520086",
"0.646802",
"0.6462246",
"0.6345849",
"0.63285345",
"0.6221356",
"0.6195026",
"0.61409676",
"0.61222225",
"0.6078814",... | 0.7644886 | 0 |
indicate if a shutter speed value is present | def shutter_speed?
!shutter_speed.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def speed?\n @speed\n end",
"def speed?\n @speed\n end",
"def shutter_speed_range; end",
"def check_speed (mph)\nend",
"def not_safe?(speed)\n\tspeed > 60 || speed < 40 ? true: false\nend",
"def not_safe?(speed)\n\tspeed < 40 || speed > 60 ? true : false\nend",
"def not_safe?(speed)\n\tspeed < ... | [
"0.75139517",
"0.75139517",
"0.69192964",
"0.6904316",
"0.687638",
"0.68389064",
"0.68389064",
"0.68281883",
"0.6803263",
"0.6795363",
"0.67927164",
"0.6774307",
"0.67729205",
"0.67637026",
"0.6749897",
"0.6729999",
"0.6673023",
"0.65760624",
"0.6516067",
"0.6474001",
"0.6473... | 0.83846176 | 0 |
Intercept Rails typecasting and add error if given value cannot be parsed into a date. | def validate_date_attribute(date_type)
value = send("#{date_type}_before_type_cast")
self[date_type] = value.is_a?(Date) || value.is_a?(Time) ? value : Time.zone.parse(value)
if self[date_type].nil?
errors.add(date_type, I18n.t('error.invalid_date', key: date_type.capitalize))
end
rescue Argumen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_process_date( val )\n\t\t\treturn Date.parse( val )\n\t\trescue ArgumentError\n\t\t\treturn nil\n\t\tend",
"def coerce_date(value)\n case value\n when Date\n value\n when String\n Date.parse(value)\n else\n raise ArgumentError, \"expected: Date or String, got: \"... | [
"0.73750275",
"0.7181718",
"0.70178795",
"0.7015499",
"0.7015499",
"0.6772877",
"0.6678443",
"0.66343904",
"0.6626789",
"0.66121536",
"0.6611943",
"0.65809447",
"0.65588367",
"0.6519049",
"0.6470342",
"0.644793",
"0.6439546",
"0.64314926",
"0.64009625",
"0.63921595",
"0.63664... | 0.727765 | 1 |
Compare two commits When using auto_pagination, commits from all pages will be concatenated into the commits attribute of the first page's response. | def compare(repo, start, endd, options = {})
paginate "#{Repository.path repo}/compare/#{start}...#{endd}", options do |data, last_response|
data.commits.concat last_response.data.commits
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commit_compare(repo, left, right)\n if left == right\n 0\n elsif repo.descendant_of? left, right\n 1\n elsif repo.descendant_of? right, left\n -1\n else\n nil\n end\n end",
"def fetch_compare(older, newer)\n unless @compares[\"#{older}...#{newer}\"]\n compare_d... | [
"0.61961156",
"0.61267114",
"0.6109295",
"0.6049647",
"0.592826",
"0.5788081",
"0.5771302",
"0.5751422",
"0.56389755",
"0.5620556",
"0.56202847",
"0.5592003",
"0.55890006",
"0.5585616",
"0.5567462",
"0.5567312",
"0.55530584",
"0.5542776",
"0.5538929",
"0.5520882",
"0.55195117... | 0.71143854 | 0 |
Parses the given string representation of a date, throwing a meaningful exception (containing the date that failed to parse) in case of failure. | def parse_date(date)
date = DateTime.parse(date.to_s)
rescue ArgumentError
raise ArgumentError, "#{date} is not a valid date"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_date(string)\n begin\n Date.parse(string)\n rescue ArgumentError\n nil\n end\n end",
"def parse_date(string)\n Date.strptime(string.to_s, '%m/%d/%Y') rescue nil\n end",
"def parsed_date(date_string, default)\n Date.parse(date_string)\n rescue ArgumentError, TypeError #... | [
"0.81544435",
"0.7952198",
"0.7837946",
"0.76747197",
"0.76707363",
"0.7522841",
"0.7462961",
"0.7432745",
"0.7403081",
"0.73586726",
"0.73515326",
"0.7315828",
"0.7311684",
"0.72762436",
"0.7262861",
"0.72545624",
"0.7168561",
"0.7151103",
"0.71468645",
"0.7112718",
"0.70303... | 0.80692005 | 1 |
runs ant in a subprocess | def ant(options)
run_executable("#{get_ant_commandline(@project.full_path)} #{options.join(" ")}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(ant)\n end",
"def run_ant(ant)\n begin\n before_run(ant)\n rescue => e\n logger.error \"Error during run ant_started method: #{e} \\n #{e.backtrace}\"\n end\n begin\n out = run(ant)\n ant.output = out\n rescue => e\n logger.error \"Error duri... | [
"0.78976196",
"0.7530559",
"0.7356725",
"0.68497217",
"0.6614706",
"0.64772856",
"0.6248381",
"0.60017234",
"0.5982379",
"0.58840024",
"0.58168894",
"0.5810525",
"0.5758793",
"0.56237084",
"0.5609163",
"0.5599489",
"0.55826926",
"0.5582095",
"0.5579932",
"0.55666155",
"0.5565... | 0.76405734 | 1 |
returns a command line for running Ant from the specified prefix | def get_ant_commandline(prefix)
executable = find_executable("ant")
if !executable.nil?
ant_path = File.join(prefix, executable)
"#{ant_path}"
else
fail ExecutableNotFoundError, "ant"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exec_prefix() return @prefix end",
"def build_command_line(name, *args)\n executable = (ZTK::Locator.find('bin', name) rescue \"/usr/bin/env #{name}\")\n [executable, args].flatten.compact.join(' ')\n end",
"def ant(options)\n run_executable(\"#{get_ant_commandline(@project.full_path)} #{... | [
"0.63626635",
"0.6053042",
"0.5820385",
"0.57864285",
"0.57534534",
"0.57506424",
"0.56698066",
"0.56460553",
"0.5630048",
"0.5615822",
"0.55762213",
"0.5461998",
"0.51235324",
"0.50896287",
"0.506857",
"0.50555444",
"0.50473166",
"0.5019793",
"0.5007992",
"0.5007992",
"0.500... | 0.8597303 | 0 |
Triggers reconnects primary and readreplica. | def reconnect
@read_replica.reconnect
@primary.reconnect
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reconnect\n close_connection\n with_retries do\n open_connection\n end\n end",
"def reconnect!\n if active?\n disconnect\n end\n connect\n end",
"def reconnect\n end",
"def reconnect!\n end",
"def reconnect!\n @active = true\n ... | [
"0.6997659",
"0.69960624",
"0.69517803",
"0.6937283",
"0.6936472",
"0.6918528",
"0.6918528",
"0.6848309",
"0.6842892",
"0.6842892",
"0.67797524",
"0.6750205",
"0.6712477",
"0.6696912",
"0.6675398",
"0.6647266",
"0.65923876",
"0.65908474",
"0.6565586",
"0.65552115",
"0.6490826... | 0.8784694 | 0 |
GET /tombstone_timeholds GET /tombstone_timeholds.json | def index
@tombstone_timeholds = TombstoneTimehold.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_tombstone_timehold\n @tombstone_timehold = TombstoneTimehold.find(params[:id])\n end",
"def create\n @tombstone_timehold = TombstoneTimehold.new(tombstone_timehold_params)\n\n respond_to do |format|\n if @tombstone_timehold.save\n format.html { redirect_to @tombstone_timehold, n... | [
"0.63439345",
"0.6104759",
"0.5901032",
"0.5855743",
"0.584172",
"0.57810336",
"0.5762866",
"0.5746126",
"0.5707658",
"0.5688543",
"0.5599504",
"0.5567079",
"0.55497694",
"0.5538532",
"0.5530686",
"0.552894",
"0.5498735",
"0.5484243",
"0.54476386",
"0.5430507",
"0.5423185",
... | 0.7894472 | 0 |
POST /tombstone_timeholds POST /tombstone_timeholds.json | def create
@tombstone_timehold = TombstoneTimehold.new(tombstone_timehold_params)
respond_to do |format|
if @tombstone_timehold.save
format.html { redirect_to @tombstone_timehold, notice: 'Tombstone timehold was successfully created.' }
format.json { render :show, status: :created, locati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @tombstone_timeholds = TombstoneTimehold.all\n end",
"def tombstone_timehold_params\n params.require(:tombstone_timehold).permit(:tombstoneJSON, :permanent, :rating)\n end",
"def set_tombstone_timehold\n @tombstone_timehold = TombstoneTimehold.find(params[:id])\n end",
"def tombst... | [
"0.68802166",
"0.68408847",
"0.68062407",
"0.6044766",
"0.58729744",
"0.5740611",
"0.5602616",
"0.5428399",
"0.5363644",
"0.5345068",
"0.5328446",
"0.5262404",
"0.5207137",
"0.51974756",
"0.5185483",
"0.5146792",
"0.5137102",
"0.51170176",
"0.5113637",
"0.51120806",
"0.506371... | 0.7206395 | 0 |
PATCH/PUT /tombstone_timeholds/1 PATCH/PUT /tombstone_timeholds/1.json | def update
respond_to do |format|
if @tombstone_timehold.update(tombstone_timehold_params)
format.html { redirect_to @tombstone_timehold, notice: 'Tombstone timehold was successfully updated.' }
format.json { render :show, status: :ok, location: @tombstone_timehold }
else
format.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_tombstone_timehold\n @tombstone_timehold = TombstoneTimehold.find(params[:id])\n end",
"def tombstone_timehold_params\n params.require(:tombstone_timehold).permit(:tombstoneJSON, :permanent, :rating)\n end",
"def updateFromLOMAT\n respond_to do |format|\n if @tombstone_timehold.upda... | [
"0.65694964",
"0.6371033",
"0.61829895",
"0.5883732",
"0.5815935",
"0.57398057",
"0.5697473",
"0.5691656",
"0.5636652",
"0.5612064",
"0.5593638",
"0.5541649",
"0.55277836",
"0.5507569",
"0.5489711",
"0.54719543",
"0.5467917",
"0.54629165",
"0.54597425",
"0.5456668",
"0.544848... | 0.71557873 | 0 |
DELETE /tombstone_timeholds/1 DELETE /tombstone_timeholds/1.json | def destroy
@tombstone_timehold.destroy
respond_to do |format|
format.html { redirect_to tombstone_timeholds_url, notice: 'Tombstone timehold was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n check_admin\n @time_balance = TimeBalance.find(params[:id])\n @time_balance.destroy\n\n respond_to do |format|\n format.html { redirect_to time_balances_url }\n format.json { head :ok }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{ar... | [
"0.66367155",
"0.6432269",
"0.6389516",
"0.6378778",
"0.63535196",
"0.63466066",
"0.6342682",
"0.6339289",
"0.6305652",
"0.63018584",
"0.625712",
"0.6252628",
"0.62402034",
"0.6238732",
"0.62293625",
"0.6228833",
"0.6212066",
"0.6205584",
"0.6204035",
"0.62040323",
"0.6198960... | 0.7605714 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.