query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
context_get_fgcolor: retrieves the current foreground color. This returns an integer, not an object
def context_get_fgcolor() return $gimp_iface.gimp_context_get_foreground()[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fg(c)\n return self unless ANSI_COLORS[c]\n return colorize(ANSI_COLORS[c])\n end", "def color\n @color || $def_fg_color\n end", "def context_get_bgcolor()\n return $gimp_iface.gimp_context_get_background()[0]\nend", "def foreground(fgcolor)\n fgcolor.split(/\\s+/).collect { |fg| names_t...
[ "0.7346399", "0.6942602", "0.69361687", "0.69330835", "0.6913224", "0.66612613", "0.6584758", "0.62667686", "0.6253607", "0.62124634", "0.61855555", "0.61113816", "0.60780895", "0.6024602", "0.5978909", "0.5978909", "0.58511955", "0.58346057", "0.582379", "0.5733057", "0.5702...
0.82968277
0
context_set_bgcolor: sets the background color to rgb. This does not change the color of existing images, but new images will be initialized with a layer filled with the background color
def _context_set_bgcolor!(rgb) $gimp_iface.gimp_context_set_background(rgb) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_background\n\t\tcolor = self.colour_scheme.background\t\n\t\t@canvas.new_image(@canvas_width, @canvas_height) { self.background_color = color }\n\tend", "def change_bg_color(color)\n @bg_color = color\n self.bitmap.fill_rect(self.bitmap.rect,color)\n end", "def setBackground(r,g,b,a)\n super...
[ "0.69413316", "0.69022894", "0.68575335", "0.6821368", "0.6630635", "0.6433094", "0.6346172", "0.6333049", "0.623851", "0.6236334", "0.6205428", "0.6161943", "0.61124456", "0.6087063", "0.6041322", "0.5976113", "0.59546477", "0.59286004", "0.58972466", "0.58885115", "0.588851...
0.77112925
0
context_set_fgcolor: sets the foreground color to rgb. This is the color that is used to fill selections and draw with gimp tools
def _context_set_fgcolor!(rgb) $gimp_iface.gimp_context_set_foreground(rgb) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _context_set_bgcolor!(rgb)\n $gimp_iface.gimp_context_set_background(rgb)\nend", "def context_get_fgcolor()\n return $gimp_iface.gimp_context_get_foreground()[0]\nend", "def set_colors(fg, bg)\n cp = RubyText::Color.pair(fg, bg)\n @cwin.color_set(cp)\n end", "def foreground=(value)\n @for...
[ "0.72037005", "0.7117945", "0.682541", "0.65912384", "0.6522317", "0.6444266", "0.6436844", "0.64007425", "0.63941514", "0.63784206", "0.62146825", "0.6078303", "0.60298216", "0.59687364", "0.59157544", "0.5911042", "0.5833632", "0.5833632", "0.5776536", "0.5725411", "0.57195...
0.84491634
0
context_get_brush: Returns the current brush as a string
def context_get_brush() return $gimp_iface.gimp_context_get_brush()[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _context_set_brush!(brush_name)\n $gimp_iface.gimp_context_set_brush(brush_name)\nend", "def markerBrush _args\n \"markerBrush _args;\" \n end", "def current_branch\n hg('branch').to_s.strip\n end", "def context_list_brushes(pattern = nil)\n if pattern == nil\n return $gimp_iface.gim...
[ "0.61980766", "0.55831283", "0.5544273", "0.55354285", "0.5531942", "0.5514982", "0.54537123", "0.5436998", "0.5348929", "0.52988863", "0.5191989", "0.5162451", "0.5141147", "0.5139729", "0.5136548", "0.51061976", "0.5049303", "0.50474876", "0.5031778", "0.5029652", "0.499903...
0.7975319
0
context_set_brush: Takes a brush name and sets the brush accordingly
def _context_set_brush!(brush_name) $gimp_iface.gimp_context_set_brush(brush_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setMarkerBrush _obj, _args\n \"_obj setMarkerBrush _args;\" \n end", "def set_brush_holder\n @brush_holder = BrushHolder.find(params[:id])\n end", "def setMarkerBrushLocal _obj, _args\n \"_obj setMarkerBrushLocal _args;\" \n end", "def setBrushSize(size)\n puts(\"Brush size...
[ "0.66233206", "0.6411085", "0.61420393", "0.5755998", "0.57285947", "0.53350013", "0.5073856", "0.49332157", "0.48792353", "0.48563275", "0.47966868", "0.47849363", "0.47437993", "0.47134793", "0.45473495", "0.454404", "0.45254093", "0.45074755", "0.44992483", "0.44978228", "...
0.81278855
0
contextlistcolors: returns an array of color names. If given a string, the array only contains the names that contain that string.
def context_list_colors(pattern = nil) if pattern == nil return $gimp_iface.ggimp_rgb_list()[1] elsif pattern.is_a? String names = $gimp_iface.ggimp_rgb_list()[1] names.select!{|element| element.include?(pattern)} return names else raise ArgumentError, "context_list_color_names only accepts a string as an argument" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def colorNames\n colors = [\"red\", \"orange\", \"yellow\", \"green\", \"mint\", \"navy\", \"light blue\", \"lavender\", \"plum\", \"pink\"]; \n return colors;\n end", "def colors\n keys = []\n COLORS.each_key do | key |\n keys << key\n end\n keys\n end", "def colors\n ...
[ "0.69695807", "0.62754905", "0.62739664", "0.61538494", "0.60605234", "0.5847429", "0.5790094", "0.5787053", "0.5745596", "0.570813", "0.56230557", "0.55329263", "0.5522375", "0.5511621", "0.54972005", "0.5470148", "0.5445049", "0.54142094", "0.5388828", "0.5348647", "0.53333...
0.8192782
0
contextlistbrushes: returns an array of brush names. If given a string, the array only contains the names that contain that string.
def context_list_brushes(pattern = nil) if pattern == nil return $gimp_iface.gimp_brushes_get_list("")[1] elsif pattern.is_a? String return $gimp_iface.gimp_brushes_get_list(pattern)[1] else raise ArgumentError, "context_list_brushes only accepts a string as an argument" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def context_list_colors(pattern = nil)\n if pattern == nil\n return $gimp_iface.ggimp_rgb_list()[1]\n elsif pattern.is_a? String\n names = $gimp_iface.ggimp_rgb_list()[1]\n names.select!{|element| element.include?(pattern)}\n return names\n else\n raise ArgumentError, \"context_list_color_names o...
[ "0.59051013", "0.49843502", "0.49527097", "0.48982787", "0.48217726", "0.47377667", "0.471358", "0.47100002", "0.46386588", "0.4580997", "0.45541644", "0.45173135", "0.4503447", "0.44865084", "0.44663262", "0.44300905", "0.44162086", "0.43835965", "0.4378289", "0.43639383", "...
0.7297061
0
This might want to be included in a Color subclass instead of being a normal method
def color_name_to_rgb(name) return $gimp_iface.ggimp_rgb_parse(name)[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def color(color); end", "def color_methods; end", "def r; self.color.r end", "def color; end", "def color; end", "def color; end", "def rgb_color; end", "def colorized?; end", "def colors; end", "def rgb\n raise NotImplementedError, 'Overwrite the method in a subclass'\n end", "def ...
[ "0.75766903", "0.7499583", "0.74536204", "0.73777556", "0.73777556", "0.73777556", "0.72055334", "0.71997905", "0.713372", "0.7105647", "0.6982597", "0.6835049", "0.6835049", "0.67792726", "0.6764322", "0.66683996", "0.6649232", "0.66434807", "0.6635852", "0.6630204", "0.6627...
0.0
-1
assumes sha1 missing size checks
def pkcs1 m, length # RFC 3447 / 9.2. hash = Digest::SHA1.digest m.map(&:chr).join # RFC 3447 / page 43 digest_info = [0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14].map(&:chr).join to_pad = digest_info + hash to_pad = to_pad.bytes [0, 1] + [0xff] * (length - to_pad.length - 3) + [0] + to_pad end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sha1; end", "def sha1; end", "def sha1?; @sha1; end", "def sha1=(_); end", "def short_sha1(length=7)\n sha1[0, length]\n end", "def short_sha1(length=7)\n sha1[0, length]\n end", "def invalid_sha?(sha)\n sha.size != 40\n end", "def sha1\n @sha1 ||= digest(path, :sha1)\n en...
[ "0.7676289", "0.7676289", "0.74500436", "0.7223365", "0.7059129", "0.7059129", "0.7011747", "0.6944613", "0.67889655", "0.67879575", "0.6760845", "0.6663173", "0.6662913", "0.6655506", "0.6651407", "0.6619044", "0.6598691", "0.6537724", "0.6508755", "0.6500629", "0.6485158", ...
0.0
-1
RFC 3447 / 8.2.1. i assume SHA1 as the hash function used
def rsa_sign arr # RFC 3447 / 9.2. hash = Digest::SHA1.digest arr.map(&:chr).join # RFC 3447 / page 43 digest_info = [0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14].map(&:chr).join # i don't do the padding, openssl does that for me # i'll reimplement RSA later on signature = HOST_KEY.private_encrypt(digest_info + hash) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sha1; end", "def sha1; end", "def sha1=(_); end", "def hex_sha1(s)\n binb2hex(core_sha1(str2binb(s), s.length * $chrsz))\n end", "def sha1?; @sha1; end", "def digest( str )\n Digest::SHA1.hexdigest( str )\n end", "def hex_sha1(s)\n return binb2hex(core_sha1(str2binb(s), s.lengt...
[ "0.795052", "0.795052", "0.7582409", "0.739406", "0.734597", "0.7316757", "0.7301439", "0.7285193", "0.7230592", "0.72276086", "0.71780634", "0.7103556", "0.7069997", "0.7040778", "0.7030737", "0.70275545", "0.7019483", "0.7001822", "0.6991911", "0.69772255", "0.69772255", ...
0.0
-1
byte array > byte array
def SHA256 arr Digest::SHA256.digest(arr.map(&:chr).join).bytes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_bytes; end", "def to_bytes; end", "def bytes(*args); data(1, *args); end", "def byte_arr_to_string arr\n arr.pack(\"c*\")\nend", "def bytes\n map { |e| e.bytes }.reduce(:+)\n end", "def data_as_bytes\n raise \"subclass responsibility\"\n end", "def data_as_bytes\n data = []...
[ "0.7410019", "0.7410019", "0.7179154", "0.7130532", "0.7036203", "0.6964688", "0.6940595", "0.693249", "0.6807546", "0.6786933", "0.6786637", "0.6755145", "0.67078334", "0.66804165", "0.6674625", "0.6661821", "0.6655342", "0.6614858", "0.66146576", "0.65629864", "0.65432554",...
0.58854866
72
returns an infinite byte stream to xor against arguments are arrays
def AES256_ctr key, iv cipher = OpenSSL::Cipher::AES.new(256, :ECB) cipher.encrypt cipher.padding = 0 cipher.key = key[..31].map(&:chr).join counter = iv[..15] f = Fiber.new do loop do enc = cipher.update(counter.map(&:chr).join) enc.bytes.each {|b| Fiber.yield b} counter.increment end end Enumerator.produce {f.resume} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xor(bytes1, bytes2)\n bytes1.zip(bytes2).map { |b1, b2| b1 ^ b2 }\nend", "def crack_xor\n key_size = (2..40).to_a\n data = Tools.get_data6\n binding.pry\n \n end", "def xor_a\n end", "def xor_b\n end", "def xor_c\n end", "def xor(input)\n key = 128\n output = input....
[ "0.6570551", "0.6509047", "0.64560455", "0.6447533", "0.6433701", "0.6433153", "0.6394889", "0.63559705", "0.63147974", "0.6279441", "0.6270745", "0.62522525", "0.6231662", "0.6217414", "0.62136376", "0.61891884", "0.6142458", "0.613171", "0.6099784", "0.60927254", "0.6067247...
0.0
-1
byte array > byte array RFC 2104
def HMAC_SHA2_256 key, msg # skipping the key hashing step, as we can assume that it's small enough blockSize = 512 / 8 key = key.ljust blockSize, 0 o_padded = key.xor ([0x5c] * blockSize).each i_padded = key.xor ([0x36] * blockSize).each o = SHA256(o_padded + SHA256(i_padded + msg)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_bytes; end", "def to_bytes; end", "def encode_to_array\n components = []\n components << [self.class.id, @channel, @payload.bytesize].pack(PACK_CHAR_UINT16_UINT32)\n components << self.class.encoded_payload(@payload)\n components << FINAL_OCTET\n components\n end"...
[ "0.6551525", "0.6551525", "0.65276164", "0.65038466", "0.6476908", "0.6394346", "0.6358875", "0.63072485", "0.63044786", "0.6251373", "0.6187515", "0.61515623", "0.6135854", "0.61159796", "0.60198617", "0.5997552", "0.59442997", "0.5931232", "0.5930717", "0.5905622", "0.58838...
0.0
-1
Public: Underline a string (make it a title). string The String to underline. Examples StringHelper.underline('1234') => "" Returns the String underline.
def underline(string) '-' * string.size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def underline(str)\n str += \"\\n\" + \"-\"*str.length\n end", "def underline(str)\n \"<u>#{str.to_s}</u>\"\n end", "def underline_message(message)\n Format(:underline, message)\n end", "def underline\n surround_with_ansi(ANSI_UNDERLINE)\n end", "def underline(underl...
[ "0.7776272", "0.761674", "0.68934166", "0.6820372", "0.6599249", "0.63962066", "0.63962066", "0.6216913", "0.6161652", "0.6155356", "0.54567057", "0.5362469", "0.535676", "0.53393173", "0.5245526", "0.52365553", "0.5236024", "0.5236024", "0.5236024", "0.5236024", "0.5236024",...
0.77408844
1
Public: Check if a string represents a numeric value. string The String to check. Returns Boolean.
def numeric?(string) Float(string) != nil rescue false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_numeric?(s)\n # input -> s: a string\n # output -> true if the string is a number value, false otherwise\n begin\n if Float(s)\n return true\n end\n rescue\n return false\n end\n end", "def is_number?(string)\n true if Float(string) rescue fal...
[ "0.88149136", "0.8456672", "0.84565103", "0.8404366", "0.8355209", "0.8316461", "0.8316461", "0.83077365", "0.82840705", "0.82694274", "0.8236443", "0.82239604", "0.8200847", "0.8199362", "0.81501245", "0.8148475", "0.8132889", "0.8052711", "0.80506104", "0.79326266", "0.7895...
0.836634
4
Checks if the physattr is hidden
def is_hidden? Skill.where(name: self.name).first.hidden end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hidden?\n not visible\n end", "def hidden?()\n not visible?()\n end", "def hidden?\n false\n end", "def hidden?\n false\n end", "def hidden?\n false\n end", "def is_hidden?\n\t\tself.hidden\n\tend", "def hidden?\n qattrs[:hidden] ==...
[ "0.7418712", "0.7338028", "0.7306835", "0.72635907", "0.72635907", "0.7178902", "0.7159782", "0.7098006", "0.7090842", "0.70641327", "0.7064094", "0.70607716", "0.70607716", "0.7032798", "0.70238507", "0.69995856", "0.69824296", "0.6973189", "0.6926678", "0.68714976", "0.6871...
0.5999902
64
Default this to text/xml for now....
def content_type "text/xml" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xml; end", "def xml?; end", "def xml?; end", "def content text\n @xml << text.to_s\n nil\n end", "def render_xml(text, options={})\n render({:text => \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n#{text}\"}.merge(options))\n end", "def xml!; @xml = true; end", "def xml\n\t\thead...
[ "0.72100955", "0.6977978", "0.6977978", "0.652412", "0.651708", "0.64425474", "0.6409921", "0.6361884", "0.631413", "0.630975", "0.63049006", "0.62018555", "0.60868883", "0.60678756", "0.6060276", "0.60105604", "0.59240925", "0.58743465", "0.58397794", "0.57994705", "0.579947...
0.6924334
3
Returns HTML ready to be used in the email body, HTML is generated by parsing the email.html template and applying realease_notes.md content
def parsed_body(opts) file = File.open(File.dirname(__FILE__) + "/email.html", "r") content = file.read markdown = Yolo::Tools::Ios::ReleaseNotes.html content = content.gsub("YOLO.TITLE",opts[:title]) content = content.gsub("YOLO.CONTENT",markdown) if opts[:ota_password] and opts[:ota_password].length > 0 content = content.gsub("YOLO.PASSWORD","<h3>Password</h3><hr><p>#{opts[:ota_password]}</p>") else content = content.gsub("YOLO.PASSWORD","") end content = content.gsub("YOLO.LINK",opts[:ota_url]) content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_html_email(html, triggered_by_user_test)\n if triggered_by_user_test\n test_notice = create_test_notice_html()\n end\n <<-EOF\n<html>\n <head>\n <title>AppOptics Alert</title>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n </head>\n <body style=...
[ "0.7019986", "0.6804039", "0.6741336", "0.6708741", "0.6657069", "0.66140777", "0.6596342", "0.65372205", "0.6511521", "0.6376375", "0.6371209", "0.6284104", "0.6240819", "0.6227364", "0.6212095", "0.61974335", "0.6196765", "0.61920637", "0.6187838", "0.6176927", "0.6169199",...
0.686195
1
tagging (only shows up when tags available)
def tagging_tag(tagging) if tagging.tag_list.present? content_tag :div, class: "row" do content_tag :div, class: "article-tagging my-xs-20" do (content_tag :span, "標籤:") + (tagging.tag_list.map {|t| link_to t, tag_path(t), class: "btn btn-default ml-xs-10"}.inject(&:+)) # look up "join" method end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tags; end", "def tags; end", "def tags; end", "def tags; end", "def tags; end", "def _tagging\n t_tagging[:tag_id].in(self.tags) unless self.tags.length == 0\n end", "def tagged?; end", "def tagging_tags\n filtered_tags(:tagtype_x => [11, :Collection, :List])\n end", "def complete_tags\...
[ "0.77934104", "0.77934104", "0.77934104", "0.77934104", "0.77934104", "0.770114", "0.75382245", "0.74043655", "0.73565453", "0.72566646", "0.72566646", "0.72316647", "0.7219375", "0.71820253", "0.7165607", "0.7120683", "0.7071158", "0.70288146", "0.7021813", "0.6999372", "0.6...
0.66332537
54
GET /syndromes GET /syndromes.json
def index @syndromes = Syndrome.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @division_syns = DivisionSyn.all\n\n render json: @division_syns\n end", "def create\n @syndrome = Syndrome.new(syndrome_params)\n\n respond_to do |format|\n if @syndrome.save\n format.html { redirect_to @syndrome, notice: 'Syndrome was successfully created.' }\n forma...
[ "0.61419743", "0.6117845", "0.59873486", "0.5809191", "0.5761091", "0.56547326", "0.56007016", "0.550228", "0.5498117", "0.54955137", "0.54951334", "0.5492723", "0.54742706", "0.5458776", "0.5454497", "0.5419186", "0.5365704", "0.5357591", "0.53476876", "0.53193563", "0.53070...
0.6881174
0
GET /syndromes/1 GET /syndromes/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @syndromes = Syndrome.all\n end", "def set_syndrome\n @syndrome = Syndrome.find(params[:id])\n end", "def create\n @syndrome = Syndrome.new(syndrome_params)\n\n respond_to do |format|\n if @syndrome.save\n format.html { redirect_to @syndrome, notice: 'Syndrome was succ...
[ "0.6833539", "0.62292284", "0.62258893", "0.61689544", "0.5827616", "0.5798495", "0.5562", "0.55599284", "0.5556239", "0.555247", "0.5533186", "0.55324256", "0.55324256", "0.55324256", "0.5519313", "0.5498832", "0.54689854", "0.54041046", "0.5384065", "0.53797096", "0.536672"...
0.0
-1
POST /syndromes POST /syndromes.json
def create @syndrome = Syndrome.new(syndrome_params) respond_to do |format| if @syndrome.save format.html { redirect_to @syndrome, notice: 'Syndrome was successfully created.' } format.json { render :show, status: :created, location: @syndrome } else format.html { render :new } format.json { render json: @syndrome.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def syndrome_params\n params.require(:syndrome).permit(:name, :description, :position)\n end", "def synonymprotein_params\n params.require(:synonymprotein).permit(:synonymname)\n end", "def set_syndrome\n @syndrome = Syndrome.find(params[:id])\n end", "def update\n respond_to do |f...
[ "0.656634", "0.60592175", "0.605054", "0.5982213", "0.5965555", "0.58764756", "0.5839133", "0.5611199", "0.5542197", "0.549306", "0.5409444", "0.5406993", "0.5356894", "0.5338517", "0.53040856", "0.5303876", "0.5290515", "0.5289807", "0.52886647", "0.52757597", "0.5252225", ...
0.7169076
0
PATCH/PUT /syndromes/1 PATCH/PUT /syndromes/1.json
def update respond_to do |format| if @syndrome.update(syndrome_params) format.html { redirect_to @syndrome, notice: 'Syndrome was successfully updated.' } format.json { render :show, status: :ok, location: @syndrome } else format.html { render :edit } format.json { render json: @syndrome.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @synonymprotein.update(synonymprotein_params)\n format.html { redirect_to @synonymprotein, notice: 'Synonymprotein was successfully updated.' }\n format.json { render :show, status: :ok, location: @synonymprotein }\n else\n format.html { re...
[ "0.6044321", "0.5980634", "0.59310615", "0.58973354", "0.58475137", "0.5774499", "0.57632846", "0.57520026", "0.57478845", "0.5709029", "0.568328", "0.56721574", "0.56721574", "0.5634188", "0.56287706", "0.5614691", "0.5603879", "0.560066", "0.55834323", "0.5576043", "0.55749...
0.68181163
0
DELETE /syndromes/1 DELETE /syndromes/1.json
def destroy @syndrome.destroy respond_to do |format| format.html { redirect_to syndromes_url, notice: 'Syndrome was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @syndic.destroy\n respond_to do |format|\n format.html { redirect_to syndics_url, notice: \"Syndic was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @synonymprotein.destroy\n respond_to do |format|\n format.html { redirect...
[ "0.667361", "0.6666594", "0.6501036", "0.64855397", "0.6410822", "0.6407785", "0.6386162", "0.6375737", "0.6356847", "0.6356513", "0.6336847", "0.6324983", "0.63224137", "0.63047963", "0.6302607", "0.6291801", "0.62760407", "0.6269153", "0.6264207", "0.626374", "0.6256768", ...
0.7042794
0
Use callbacks to share common setup or constraints between actions.
def set_syndrome @syndrome = Syndrome.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def syndrome_params params.require(:syndrome).permit(:name, :description, :position) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
ok, that args is actually pointless, we can just do it like this
def puts_two_again(arg1, arg2) puts "arg1: #{arg1}, arg2: #{arg2}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def args(*) end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args;...
[ "0.79374117", "0.76918584", "0.76918584", "0.76918584", "0.76918584", "0.76918584", "0.76918584", "0.76918584", "0.76918584", "0.76918584", "0.76918584", "0.76918584", "0.76918584", "0.76918584", "0.76918584", "0.76918584", "0.76918584", "0.76918584", "0.76918584", "0.76918584"...
0.0
-1
this one takes one arguement
def puts_one(arg1) puts "arg1: #{arg1}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def args(*) end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args;...
[ "0.692886", "0.68909895", "0.68909895", "0.68909895", "0.68909895", "0.68909895", "0.68909895", "0.68909895", "0.68909895", "0.68909895", "0.68909895", "0.68909895", "0.68909895", "0.68909895", "0.68909895", "0.68909895", "0.68909895", "0.68909895", "0.68909895", "0.68909895", ...
0.0
-1
this one takes no arguements
def puts_none() puts "I got nothing." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probers=(_arg0); end", "def standalone=(_arg0); end", "def args(*) end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def...
[ "0.6930524", "0.69165355", "0.6791324", "0.6773252", "0.6773252", "0.6773252", "0.6773252", "0.6773252", "0.6773252", "0.6773252", "0.6773252", "0.6773252", "0.6773252", "0.6773252", "0.6773252", "0.6773252", "0.6773252", "0.6773252", "0.6773252", "0.6773252", "0.6773252", ...
0.0
-1
Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Src: I'll have to look into optimizations for this one
def multi_array_median(*arrays) combined = arrays.reduce(:concat).sort combined[combined.length / 2] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def median_sorted_arrays_dc(arr1, arr2)\n size = arr1.size\n return -1 if size <= 0\n return (arr1.first+arr2.first)/2 if size == 1\n return ([arr1.first, arr2.first].max + [arr1[1], arr2[1]].min)/2 if size == 2\n pos_med1 = arr1.size/2\n pos_med2 = arr2.size/2\n # If both are equal even though we form a ne...
[ "0.83698124", "0.81998295", "0.8184044", "0.8148729", "0.69370794", "0.69354993", "0.6915888", "0.68452996", "0.6818649", "0.681785", "0.6765613", "0.6761636", "0.67542034", "0.6745006", "0.6740559", "0.6739193", "0.6730339", "0.67049545", "0.669997", "0.66981435", "0.6697116...
0.7313573
4
Return `true` if a resource was not saved yet
def new? id.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_saved?\n resource.save unless resource.validation_attempted?\n resource.saved?\n end", "def saved?\n !new? && !@content\n end", "def saved?\n res = uri.nil?\n !res\n end", "def previously_existed?\n true\n end", "def set_yet?\n !!@reso...
[ "0.79856724", "0.7720153", "0.7577292", "0.73096603", "0.72937363", "0.7253907", "0.7228985", "0.7175113", "0.71051455", "0.70759547", "0.7072321", "0.7069846", "0.7060783", "0.7060019", "0.70591754", "0.70591754", "0.70591754", "0.7041911", "0.69808424", "0.69708073", "0.696...
0.0
-1
Return `true` if a resource is not `new?`
def persisted? !new? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new?\n !exists?\n end", "def new?\n defined?(@new) ? @new : (@new = false)\n end", "def new?\n defined?(@new) ? @new : (@new = false)\n end", "def new?\n @is_new\n end", "def new?\n !!@new\n end", "def new?\n !!@new\n end", "def resource?\...
[ "0.78086364", "0.7575181", "0.7575181", "0.74594814", "0.74278754", "0.74278754", "0.73117465", "0.7305351", "0.7305234", "0.7296279", "0.72960484", "0.72960484", "0.7286046", "0.72336954", "0.7172941", "0.7151889", "0.7145354", "0.71153754", "0.7101874", "0.7071991", "0.7057...
0.0
-1
Return whether the object has been destroyed
def destroyed? @destroyed == true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroyed?\n @destroyed == true\n end", "def destroyed?\n @destroyed\n end", "def destroyed?\n @destroyed\n end", "def destroyed?\n @destroyed\n end", "def destroyed?\n !!@destroyed\n end", "def destroyed?\n !!destroyed\n end", "de...
[ "0.8661089", "0.8644168", "0.8644168", "0.8644168", "0.8640321", "0.86078024", "0.8572548", "0.8566166", "0.8566166", "0.8566166", "0.8566166", "0.84974337", "0.7910018", "0.7479804", "0.7394459", "0.73555744", "0.7239645", "0.7239645", "0.7232382", "0.7103759", "0.7088497", ...
0.86232984
8
Destroy an existing resource
def destroy_existing(id, params={}) request(params.merge(:_method => :delete, :_path => build_request_path(params.merge(primary_key => id)))) do |parsed_data, response| new(parse(parsed_data[:data]).merge(:_destroyed => true)) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy_resource(resource)\n resource.destroy\n resource\n end", "def destroy_resource object\n object.destroy\n end", "def destroy\n destroy_resource(resource)\n head :no_content\n end", "def destroy\n destroyer = ensure_destroyer\n destroyer.destroy(@resource).success?\n en...
[ "0.85614765", "0.83236015", "0.8292858", "0.8229077", "0.8185887", "0.80896413", "0.8079926", "0.80237466", "0.79857814", "0.795946", "0.79514825", "0.79514825", "0.79514825", "0.7919955", "0.788436", "0.78483105", "0.78188163", "0.7815574", "0.7815574", "0.7815574", "0.78155...
0.0
-1
Computes the outputs based on the inputs and previous state
def tick 2.times.each do sub_components.each(&:tick) sub_components.each(&:tock) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(inputs, outputs)\n eval(inputs)\n backpropagate(outputs)\n calculate_error(outputs)\n end", "def evaluate\n @output_value = Math.tanh(@input_value - @bias)\n #p \"output value #{@output_value}\"\n @forward_nodes.each do |node, weight|\n #p \"weight #{weight} old ...
[ "0.6296793", "0.6294282", "0.623522", "0.609978", "0.60850793", "0.5925469", "0.5862122", "0.58526295", "0.5842642", "0.58360034", "0.574824", "0.569011", "0.5656981", "0.56289864", "0.5625252", "0.56249505", "0.56169045", "0.55655867", "0.5533506", "0.5529095", "0.54761755",...
0.0
-1
Initializes a Twitch client. client_id [String] The client ID. Used as the ClientID header in a request. access_token [String] An access token. Used as the Authorization header in a request. Any "Bearer " prefix will be stripped. with_raw [Boolean] Whether to include raw HTTP response Intended for testing/checking API results
def initialize(client_id: nil, access_token: nil, with_raw: false) if client_id.nil? && access_token.nil? raise "An identifier token (client ID or bearer token) is required" elsif !!client_id && !!access_token warn(%{WARNING: It is recommended that only one identifier token is specified. Unpredictable behavior may follow.}) end headers = { "User-Agent": "twitch-api ruby client #{Twitch::VERSION}" } unless client_id.nil? headers["Client-ID"] = client_id end unless access_token.nil? access_token = access_token.gsub(/^Bearer /, "") headers["Authorization"] = "Bearer #{access_token}" end @conn = Faraday.new(API_ENDPOINT, { headers: headers }) do |faraday| faraday.request :json faraday.response :json faraday.adapter Faraday.default_adapter end @with_raw = with_raw end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(options = {})\n client_id = options[:client_id]\n\n @oauth2_client = TwitchOAuth2::Client.new(\n client_id: client_id, **options.slice(:client_secret, :redirect_uri, :scopes)\n )\n\n @token_type = options.fetch(:token_type, :application)\n\n @tokens = @oauth2_client.c...
[ "0.7119859", "0.6726576", "0.6346222", "0.6262825", "0.6262037", "0.6226952", "0.622132", "0.60878927", "0.60878927", "0.6076046", "0.60646445", "0.60483915", "0.6046482", "0.6039473", "0.6015484", "0.60124874", "0.6011871", "0.5992625", "0.59925216", "0.59692603", "0.593184"...
0.84234625
0
hack to generate yajl_version.h without using cmake
def generate_yajl_version build_path = File.expand_path("../ext/libyajl2", __FILE__) vendor_path = File.expand_path("../ext/libyajl2/vendor/yajl", __FILE__) yajl_major = yajl_minor = yajl_micro = nil File.open("#{vendor_path}/CMakeLists.txt").each do |line| if (m = line.match(/YAJL_MAJOR (\d+)/)) yajl_major = m[1] end if (m = line.match(/YAJL_MINOR (\d+)/)) yajl_minor = m[1] end if (m = line.match(/YAJL_MICRO (\d+)/)) yajl_micro = m[1] end end File.open("#{build_path}/api/yajl_version.h", "w+") do |out| # FIXME: relative path File.open("#{vendor_path}/src/api/yajl_version.h.cmake").each do |line| line.gsub!(/\$\{YAJL_MAJOR\}/, yajl_major) line.gsub!(/\$\{YAJL_MINOR\}/, yajl_minor) line.gsub!(/\$\{YAJL_MICRO\}/, yajl_micro) out.write(line) end end FileUtils.cp "#{build_path}/api/yajl_version.h", "#{build_path}/yajl/yajl_version.h" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_version_header(app_name, pkgname, dir = \"src\")\n version = PKGConfig.modversion(pkgname).split(/\\./)\n (0..2).each do |v|\n version[v] = \"0\" unless version[v]\n end\n filename = \"rb#{app_name.downcase}version.h\"\n\n puts \"creating #{filename}\"\n\n add_distcleanfile(filename)\n\n FileUti...
[ "0.607159", "0.56491", "0.5541313", "0.53789246", "0.5327139", "0.5255877", "0.5255877", "0.5255877", "0.52176255", "0.52176255", "0.52176255", "0.52176255", "0.52155167", "0.5198248", "0.51929784", "0.5165983", "0.51187086", "0.51185787", "0.5116837", "0.5098749", "0.5098749...
0.89106363
0
Copied/pasted/adapted from puppetlabs_spec_helper's lib/puppetlabs_spec_helper/rake_tasks.rb
def fixtures(host, category) begin fixtures = YAML.load_file(".fixtures.yml")["fixtures"] rescue Errno::ENOENT return {} end if not fixtures abort("malformed fixtures.yml") end result = {} if fixtures.include? category and fixtures[category] != nil fixtures[category].each do |fixture, opts| if opts.instance_of?(String) source = opts target = "#{host['distmoduledir']}/#{fixture}" real_source = eval('"'+source+'"') result[real_source] = target elsif opts.instance_of?(Hash) target = "#{host['distmoduledir']}/#{fixture}" real_source = eval('"'+opts["repo"]+'"') result[real_source] = { "target" => target, "ref" => opts["ref"], "scm" => opts["scm"] } end end end return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rake_tasks(&block); end", "def rake_tasks(&block); end", "def define_tasks!\n\n define_test_tasks! if has_tests?\n define_rspec_tasks! if has_specs?\n\n namespace(@task_namespace) do\n desc \"Updates the filelist in the gemspec file\"\n task(:manifest) { manifest_task }\n\n ...
[ "0.75969243", "0.75969243", "0.72945106", "0.7291641", "0.7223362", "0.7075083", "0.70284677", "0.68751985", "0.6829137", "0.68237686", "0.6822566", "0.6819488", "0.6792991", "0.67732215", "0.6745635", "0.6741048", "0.67355126", "0.66731876", "0.66634905", "0.66278875", "0.66...
0.0
-1
def revision(scm, target, ref)
def revision(host, scm, target, ref) args = [] case scm when 'hg' args.push('update', 'clean', '-r', ref) when 'git' args.push('reset', '--hard', ref) else fail "Unfortunately #{scm} is not supported yet" end on host, "cd #{target} && #{scm} #{args.flatten.join ' '}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_revision\n end", "def ref\n reference(@id, @revision)\n end", "def get_revision(rev = 'HEAD')\n unless @resource.value(:source)\n status = at_path { git_with_identity('status') }\n is_it_new = status =~ %r{Initial commit|No commits yet}\n if is_it_new\n status ...
[ "0.7230082", "0.72139263", "0.69580775", "0.6917695", "0.6915714", "0.68644476", "0.6816542", "0.67362523", "0.6699058", "0.66314906", "0.6587015", "0.65758854", "0.64748067", "0.6471422", "0.6403111", "0.6387499", "0.63868743", "0.63727075", "0.63588274", "0.6343399", "0.629...
0.8321204
0
A Receipt is considered editable even when the status is deleted. The reason for that is because if there was something wrong with the Expense Claim that was not discovered until after it was approved, then it can be deleted from Xero, edited here and then resubmitted again with minimum amount of work needed.
def editable? (status == STATUS_NOT_SUBMITTED || status == STATUS_DELETED) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_receipt_state\n\t\tunless account_movement.nil? || account_movement.receipt.nil?\n\t\t\terrors.add(\"Recibo confirmado\", \"Los pagos de un recibo confirmado no pueden ser modificados.\") unless account_movement.receipt.editable?\n\t\tend\n\tend", "def editable?\n (self.entry_ts.to_date == Date.toda...
[ "0.6356451", "0.5944015", "0.59429604", "0.59206223", "0.59204054", "0.591077", "0.5811107", "0.5808448", "0.5806186", "0.5763809", "0.57299495", "0.56966436", "0.56752115", "0.5652189", "0.5633896", "0.5601607", "0.55788404", "0.5544041", "0.5518178", "0.550741", "0.55018026...
0.59331185
3
define regular methods here
def initialize @provider = AmqpSource end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def methods() end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def custom; end", "def custom; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end...
[ "0.82294893", "0.7993455", "0.7993455", "0.7993455", "0.7993455", "0.767023", "0.767023", "0.7415533", "0.7415533", "0.7415533", "0.7415533", "0.7415533", "0.7415533", "0.7415533", "0.7415533", "0.7415533", "0.7415533", "0.7415533", "0.7415533", "0.7258611", "0.7258611", "0...
0.0
-1
Additional method for TestAdapter to allow easy queue inspection with JobQueue.adapter.queue('foo')
def queue(queue = 'default') get_queue(queue) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def queue_job; end", "def mock_queue(queue_name)\n data[queue_name]\n end", "def mock_queue!(queue_name)\n mock_queue(queue_name) or raise NotFound.new\n end", "def queue( name )\n Qup::Adapter::Kestrel::Queue.new( @addr, name )\n end", "def queue(queue, klass, **opt...
[ "0.74436754", "0.73498684", "0.7149486", "0.6999552", "0.6965126", "0.6910257", "0.69025743", "0.69025743", "0.68443596", "0.6798437", "0.67608315", "0.67347974", "0.67347974", "0.6711454", "0.67095786", "0.6693022", "0.66871697", "0.6686356", "0.66680217", "0.6608542", "0.65...
0.7147574
3
Override current_resouce to the current order for authorization.
def current_resource @current_resource ||= BroOrder.find_by(guid: params[:guid]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_order\n @current_order ||= Order.find_by(id: user_id)\n end", "def current_order\n @current_order ||= load_order_from_session unless @current_order == false\n end", "def current_resource\n @current_resource ||= KwkOrder.find_by(guid: params[:guid])\n end", "def current_orders\n @cu...
[ "0.6241206", "0.6219094", "0.6215107", "0.59539175", "0.5824193", "0.5820312", "0.58148664", "0.5811597", "0.57556367", "0.5738723", "0.5738723", "0.5711391", "0.56935304", "0.5681626", "0.56672984", "0.5638636", "0.56313795", "0.5567969", "0.5542376", "0.5526105", "0.5509438...
0.6118802
3
setters and getters for world foreign key
def world_name=(name) self.world = World.find_or_create_by(name: name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stores_foreign_key?; true; end", "def foreign_key\n meta(foreign_key: true)\n end", "def stores_foreign_key?; false; end", "def stores_foreign_key?; false; end", "def foreign_key\n association.foreign_key \n end", "def foreign_key\n self.name + \"_id\"\n end", "def using_key...
[ "0.7319596", "0.70148623", "0.6951776", "0.6951776", "0.6680756", "0.6590722", "0.6469656", "0.6399574", "0.6371084", "0.633225", "0.6325647", "0.63089234", "0.62374896", "0.62374896", "0.6200924", "0.61363125", "0.60799956", "0.60461015", "0.60461015", "0.6024619", "0.599272...
0.0
-1
setters and getters for user foreign key
def user_name=(name) self.user = User.find_or_create_by(name: name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_id=(new_id)\n if allow_editing?\n @user_id = ForeignKey.new(id: new_id, class_name: User)\n @user_name = user.name\n end\n end", "def user_id\n self.user.id\n end", "def user_id\n self.title_and_name\n end", "def user\n User.find(self[:user_id])\n end", "def user\n ...
[ "0.72426915", "0.69237536", "0.6887277", "0.6855067", "0.6830635", "0.6801619", "0.6801619", "0.6801619", "0.6801619", "0.6801619", "0.6801619", "0.6801619", "0.6801619", "0.6801619", "0.6801619", "0.6743075", "0.6726641", "0.6701809", "0.6619238", "0.6619238", "0.6619238", ...
0.0
-1
Returns the intervals precision. Mixed precisions are currently not supported; in that case, the start date's precision takes precedence.
def precision min.precision || max.precision end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision\n self['precision']\n end", "def precision\n @precision = self.class::MAX_PRECISION unless @precision\n return @precision\n end", "def precision\n @precision ||= cells.map(&:to_f).map { |n| n.round(3) }.map { |n| n.to_s.split(\".\").last.gsub(/0+$/, \"\").length }.max\n end"...
[ "0.6552927", "0.64642155", "0.6390553", "0.62247926", "0.61783713", "0.6112884", "0.6036813", "0.60146314", "0.6004275", "0.5877995", "0.58046436", "0.57315046", "0.57246745", "0.5688037", "0.5683462", "0.5671486", "0.562912", "0.55948746", "0.55886495", "0.5549376", "0.55493...
0.6828826
0
Returns true if the precisions of start and end date are not the same.
def mixed_precision? min.precision != max.precision end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_start_and_end_dates?\n return false unless start.present? && self.end.present?\n start <= self.end\n end", "def cover?(other)\n return false unless other.is_a?(Date)\n\n other = other.day_precision\n\n case\n when unknown_start?\n max.day_precision! == other\n whe...
[ "0.72415555", "0.72097874", "0.7136664", "0.68430495", "0.68407065", "0.6772591", "0.6712651", "0.66333264", "0.65966237", "0.6589843", "0.6576496", "0.6552405", "0.6498005", "0.6468503", "0.64682806", "0.6449605", "0.64308965", "0.64213395", "0.6388777", "0.6361986", "0.6331...
0.5757493
79
This method always returns false for Range compatibility. EDTF intervals always include the last date.
def exclude_end? false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_end_date\n self.end_date - self.start_date > 0 ? true : false\n end", "def correct?\n starts_at < ends_at && starts_at.to_date == ends_at.to_date\n end", "def exclude_end?\n @ranges.size == 1 ? @ranges[0].exclude_end? : nil\n end", "def valid_start_and_end_dates?\n return false u...
[ "0.6826846", "0.68126994", "0.6682911", "0.66601926", "0.66404355", "0.6564398", "0.6509268", "0.6475329", "0.6443535", "0.64317834", "0.64152664", "0.6412874", "0.63919675", "0.6391525", "0.63859105", "0.63032305", "0.62968814", "0.6291337", "0.62858886", "0.626494", "0.6259...
0.5890706
76
TODO how to handle +/ Infinity for Dates? TODO we can't delegate to Ruby range for mixed precision intervals Returns the Interval as a Range.
def to_range case when open?, unknown? nil else Range.new(unknown_start? ? Date.new : @from, max) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_range\n Range.new(self.start, self.end)\n end", "def unbounded\n ::Unbounded::Range.new(self.min, self.max, exclude_end?)\n end", "def to_a\n get_range('-inf', '+inf', include_boundaries: true)\n end", "def to_range\n min .. max\n end", "def to_range\n start_date...
[ "0.6671649", "0.6599144", "0.6597801", "0.6468024", "0.64024574", "0.6245468", "0.6215531", "0.61930454", "0.6171799", "0.61442727", "0.6117625", "0.60772216", "0.6051633", "0.60105985", "0.6000623", "0.59989506", "0.59437037", "0.59286714", "0.58351845", "0.5833981", "0.5825...
0.6807673
0
Returns true if other is an element of the Interval, false otherwise. Comparision is done according to the Interval's min/max date and precision.
def include?(other) cover?(other) && precision == other.precision end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cover?(other)\n return false unless other.is_a?(Date)\n\n other = other.day_precision\n\n case\n when unknown_start?\n max.day_precision! == other\n when unknown_end?\n min.day_precision! == other\n when open_end?\n min.day_precision! <= other\n else\n ...
[ "0.77499694", "0.7744611", "0.76978505", "0.7147485", "0.70140666", "0.6868986", "0.67598075", "0.6632069", "0.6616678", "0.6601479", "0.65801495", "0.6495526", "0.6428735", "0.64255106", "0.64043224", "0.63713986", "0.6345631", "0.633576", "0.63173443", "0.62924457", "0.6278...
0.64916754
12
Returns true if other is an element of the Interval, false otherwise. In contrast to include? and member? this method does not take into account the date's precision.
def cover?(other) return false unless other.is_a?(Date) other = other.day_precision case when unknown_start? max.day_precision! == other when unknown_end? min.day_precision! == other when open_end? min.day_precision! <= other else min.day_precision! <= other && other <= max.day_precision! end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ==(other)\n (other.is_a? Interval) && (@start == other.start && @end == other.end)\n end", "def include?(other_period)\n inside?(other_period.starts_at) && inside?(other_period.ends_at)\n end", "def overlaps?(other)\n \t((start_date - other.end_date) * (other.start_date - end_date)) >= 0\n \ten...
[ "0.7302837", "0.69987863", "0.67549866", "0.67513996", "0.6725566", "0.66782063", "0.6575283", "0.6541723", "0.65208596", "0.64751375", "0.64416236", "0.63693357", "0.63570666", "0.6341641", "0.62857884", "0.6276853", "0.6181933", "0.6176552", "0.6151782", "0.614197", "0.6127...
0.6979866
2
callseq: interval.first > Date or nil interval.first(n) > Array Returns the first date in the interval, or the first n dates.
def first(n = 1) if n > 1 (ds = Array(min)).empty? ? ds : ds.concat(ds[0].next(n - 1)) else min end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first_date\n events.order(:date).first.date.to_date rescue nil\n end", "def first_occurrence_on_or_after(date)\n raise NotImplementedError\n end", "def min\n dates.first\n end", "def first(*n) end", "def first(*args)\n find_first_or_last(:first, *args)\n end", "def first\n...
[ "0.63344866", "0.6168862", "0.5958597", "0.59546506", "0.5951028", "0.5939679", "0.58875775", "0.58778036", "0.5875005", "0.5864412", "0.58169186", "0.5789508", "0.5772541", "0.57531565", "0.5743028", "0.5708742", "0.5708482", "0.5685088", "0.56689173", "0.56489146", "0.55888...
0.5797969
11
callseq: interval.last > Date or nil interval.last(n) > Array Returns the last date in the interval, or the last n dates.
def last(n = 1) if n > 1 (ds = Array(max)).empty? ? ds : ds.concat(ds[0].prev(n - 1)) else max end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last(*n) end", "def last(n = nil)\n if n\n self[-n..-1]\n else\n self[-1]\n end\n end", "def last(*args)\n find_first_or_last(:last, *args)\n end", "def last(*args)\n all.send(:last, *args)\n end", "def last(*args)\n find(:last, *args)\n end",...
[ "0.67980504", "0.65723825", "0.65369636", "0.64085746", "0.6367736", "0.6367736", "0.6355523", "0.6320057", "0.6226933", "0.6207914", "0.61871874", "0.6175754", "0.61752117", "0.6169291", "0.6168634", "0.61500865", "0.6137273", "0.61318827", "0.61221385", "0.61212575", "0.612...
0.65094006
3
Returns the Interval as an EDTF string.
def edtf [ from.send(from.respond_to?(:edtf) ? :edtf : :to_s), to.send(to.respond_to?(:edtf) ? :edtf : :to_s) ] * '/' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tir_f\n format_f(self.tir)\n end", "def toString\n sprintf('%6.2f', @value) + \" \" + @unit\n end", "def to_s\n @value.to_f.to_s\n end", "def to_s ; format ; end", "def to_s\n [\"#<Timeloop period=#{period}\",\n max < Float::INFINITY ? \", max=#{max}\" : \"\",\n \">\"].join\n...
[ "0.6234685", "0.61635303", "0.610204", "0.606274", "0.60272425", "0.6010317", "0.5987284", "0.5946015", "0.5942576", "0.5886726", "0.58804196", "0.5876405", "0.5868276", "0.5859085", "0.5859085", "0.58400834", "0.58214617", "0.5807573", "0.57885754", "0.5781998", "0.578085", ...
0.0
-1
creates persistent session for given user
def remember(user) user.remember cookies.permanent.signed[:user_id] = user.id cookies.permanent[:remember_token] = user.remember_token end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_session_for(user)\n UserSession.create(user)\n end", "def create_session\n @user = User.new(nickname: User.temp_user_name)\n @user.save\n session[:user_id] = @user.id\n @user\n end", "def new_user_session(user)\n session = new_session\n session.login!(user)\n return session\n ...
[ "0.81041664", "0.7942089", "0.7805226", "0.77348983", "0.765083", "0.7588374", "0.75141686", "0.7512605", "0.7475589", "0.7440537", "0.7440537", "0.7344929", "0.7251861", "0.72108424", "0.7203846", "0.7164451", "0.7147566", "0.711701", "0.71148765", "0.7099773", "0.70872307",...
0.0
-1
returns current loggedin user (if any)
def current_user @current_user = temporary_session? ? temporary_user : remembered_user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_logged_in_user\n if logged_in?\n user = User.find(session[:current_user_id])\n if user\n return user\n else\n return nil\n end\n end\n \n #default return nil\n nil\n end", "def getLoggedInUser\n if session[:user_id]\n return User.find(session[:use...
[ "0.85378116", "0.8533479", "0.8528703", "0.8504354", "0.8497467", "0.84962934", "0.84654593", "0.8452448", "0.8442996", "0.8440423", "0.84145063", "0.8402872", "0.8398498", "0.8389775", "0.8387313", "0.8366064", "0.83572143", "0.83554316", "0.83554316", "0.83504933", "0.83504...
0.0
-1
true/ false user is logged in
def logged_in? !current_user.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_is_logged_in()\n user = get_user()\n if user != nil\n true\n else\n false\n end\n end", "def logged_in?\n @logged_in ? true : false\n end", "def logged_in?\n @logged_in == true\n end", "def logged_in?\n @logged_in == true\n end", "def logged_in?()\n if...
[ "0.8855731", "0.8685554", "0.86697656", "0.86697656", "0.8665673", "0.86593056", "0.8654078", "0.8639121", "0.8636279", "0.8622163", "0.86220586", "0.8599811", "0.85873973", "0.8578747", "0.8578747", "0.85547245", "0.854973", "0.8540216", "0.8540216", "0.8540216", "0.8540216"...
0.0
-1
redirects to stored location or default
def redirect_back_or(default) redirect_to(session[:forwarding_url] || default) session.delete(:forwarding_url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redirect_to_stored_location_or(default)\n redirect_to(session[:forward_url] || default)\n session.delete(:forward_url)\n end", "def redirect_to_stored(default='/')\n return_to = session[:return_to] || default\n session[:return_to] = nil\n redirect return_to\n end", "def redirect_ba...
[ "0.809772", "0.8053922", "0.77915525", "0.7788125", "0.7561743", "0.75439", "0.7450235", "0.74379057", "0.74101406", "0.7312566", "0.7272844", "0.7264558", "0.72588974", "0.7244659", "0.72379357", "0.7237905", "0.72314495", "0.7227404", "0.7223874", "0.7214233", "0.7202999", ...
0.7098507
98
returns user_id/ or nil
def temporary_session? session[:user_id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_id\n unless @user_id.nil? || @user_id == 0\n @user_id\n else\n read_attribute(:user_id) # TODO: Might need to cache result\n end\n end", "def user_id\n self.user.id unless user.nil?\n end", "def user_id\n return nil unless success?\n\n @user_id\n end", "def...
[ "0.84042346", "0.83615744", "0.8283566", "0.82630193", "0.8099813", "0.8027429", "0.8005031", "0.8005031", "0.8005031", "0.8005031", "0.8005031", "0.8005031", "0.79956925", "0.7982825", "0.7980895", "0.79615223", "0.79567003", "0.79311407", "0.7925186", "0.79176104", "0.78953...
0.0
-1
returns user based on permanent session cookies
def remembered_user#(user_id) user = User.find_by_id(cookies.signed[:user_id]) if user && user.authenticated?(:remember, cookies[:remember_token]) log_in user return user end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cookied_user\n cookies[:auth] and User.find_by_auth_token(cookies[:auth])\n end", "def current_user\n # find a user by id based on the stored :user_id cookie\n User.find_by_id(session[:user_id])\n end", "def get_user_from_session\r\n return User.find(session[:user_id]) if session[:user_id]\r\ne...
[ "0.79544765", "0.764715", "0.7608881", "0.7574507", "0.7559167", "0.7539138", "0.75350547", "0.7530476", "0.7515576", "0.74733514", "0.74686813", "0.7416135", "0.7379336", "0.7378661", "0.7346001", "0.7346001", "0.73415256", "0.73374075", "0.7321593", "0.73120236", "0.7306595...
0.0
-1
GET /availability_products GET /availability_products.json
def index @availability_products = AvailabilityProduct.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available\n @products = Product.where.not(inventory_count: 0)\n json_response(@products)\n end", "def index\n limit = params[:limit]&.to_i || 10\n page = params[:page]&.to_i || 0\n if params[:available] == \"1\"\n @products = Product.paginate(page, limit).available\n else\n ...
[ "0.7711631", "0.7450315", "0.73196596", "0.68163335", "0.6724529", "0.66865385", "0.6612116", "0.65708023", "0.65629584", "0.6531176", "0.6524272", "0.65159017", "0.6507209", "0.64764553", "0.6461579", "0.6419418", "0.6414017", "0.64119", "0.6383029", "0.63594824", "0.6330268...
0.760284
1
GET /availability_products/1 GET /availability_products/1.json
def show @accessories = @availability_product.accessories.order("created_at ASC").paginate(:page => params[:page], :per_page => 9) @cameras = @availability_product.cameras.order("created_at ASC").paginate(:page => params[:page], :per_page => 9) @lensas = @availability_product.lensas.order("created_at ASC").paginate(:page => params[:page], :per_page => 9) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @availability_products = AvailabilityProduct.all\n end", "def available\n @products = Product.where.not(inventory_count: 0)\n json_response(@products)\n end", "def index\n limit = params[:limit]&.to_i || 10\n page = params[:page]&.to_i || 0\n if params[:available] == \...
[ "0.74479944", "0.73081756", "0.72781324", "0.7073272", "0.7060082", "0.6904925", "0.68826896", "0.68689483", "0.67799497", "0.6720815", "0.6701322", "0.6668789", "0.6647533", "0.66358507", "0.66000247", "0.6592173", "0.6584175", "0.6576891", "0.6572918", "0.65121067", "0.6493...
0.63380986
34
POST /availability_products POST /availability_products.json
def create @availability_product = AvailabilityProduct.new(availability_product_params) respond_to do |format| if @availability_product.save format.html { redirect_to @availability_product, notice: 'Availability product was successfully created.' } format.json { render :show, status: :created, location: @availability_product } else format.html { render :new } format.json { render json: @availability_product.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def availability_product_params\n params.require(:availability_product).permit(:name)\n end", "def index\n @availability_products = AvailabilityProduct.all\n end", "def create\n if params[:products]\n params[:products].each do |product|\n @product = Product.new(name: product[:name],\...
[ "0.6918476", "0.6472128", "0.6329468", "0.6292604", "0.6284863", "0.6228448", "0.6216361", "0.62088215", "0.6200017", "0.61845714", "0.61789376", "0.6147109", "0.6144949", "0.61317223", "0.6118531", "0.60875213", "0.6084217", "0.605357", "0.6046187", "0.60458016", "0.6043235"...
0.74523354
0
PATCH/PUT /availability_products/1 PATCH/PUT /availability_products/1.json
def update respond_to do |format| if @availability_product.update(availability_product_params) format.html { redirect_to @availability_product, notice: 'Availability product was successfully updated.' } format.json { render :show, status: :ok, location: @availability_product } else format.html { render :edit } format.json { render json: @availability_product.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n begin\n @api_v1_product.update!(api_v1_product_params)\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end", "def update\n if @product.update(product_params)\n render json: @product, status: :ok#, location: @colle...
[ "0.7196018", "0.69728374", "0.689465", "0.6746116", "0.6716206", "0.6709353", "0.6709279", "0.6705631", "0.66779226", "0.66370094", "0.6625007", "0.6588894", "0.65620744", "0.65620744", "0.6561498", "0.6557892", "0.6527632", "0.6521966", "0.64918685", "0.6450863", "0.6444042"...
0.7322962
0
DELETE /availability_products/1 DELETE /availability_products/1.json
def destroy @availability_product.destroy respond_to do |format| format.html { redirect_to availability_products_url, notice: 'Availability product was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @product.destroy\n\n render json: @product, status: :ok#, location: @collection\n end", "def delete_product(name)\n delete(\"/apiproducts/#{name}\")\n end", "def destroy\n begin\n @api_v1_product.destroy!\n head :no_content\n rescue => ex\n json_response({e...
[ "0.72155315", "0.71297914", "0.710702", "0.7095869", "0.7094918", "0.7064186", "0.7033315", "0.7018584", "0.69936174", "0.69714177", "0.69658566", "0.69491524", "0.69387835", "0.69240564", "0.690999", "0.6898615", "0.68963456", "0.6893211", "0.6885956", "0.6884188", "0.687826...
0.7531934
0
Use callbacks to share common setup or constraints between actions.
def set_availability_product @availability_product = AvailabilityProduct.friendly.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def availability_product_params params.require(:availability_product).permit(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Helper methods used to assist through the template building => similar to the functions used in Rails::Generators::AppBase Method required when processing the gemfile
def gemfile_requirement(name) @original_gemfile ||= IO.read('Gemfile') req = @original_gemfile[/gem\s+['"]#{name}['"]\s*(,[><~= \t\d\.\w'"]*)?.*$/, 1] req && req.tr("'", %(")).strip.sub(/^,\s*"/, ', "') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_from_templates\r\n %w{package.json _config.yml}.each do |file|\r\n template file\r\n end\r\n end", "def apply_rails_new_template\n assert_generator_use_postgresql\n skip_libraries_installation\n\n apply_template 'LICENSE'\n apply_template 'README.md'\n apply_template 'gitignore', '....
[ "0.70179504", "0.67612237", "0.67544407", "0.6639642", "0.65970767", "0.6446824", "0.64013726", "0.6371176", "0.6362017", "0.63538295", "0.63208544", "0.63165605", "0.62692034", "0.6253167", "0.62327856", "0.62133837", "0.6210422", "0.62089837", "0.62018234", "0.62018234", "0...
0.0
-1
Determine which gem will be used for the projects CSS framework
def template_engine_gem_str(css_framework = '') case css_framework.to_s when 'semantic' 'semantic_ui' else 'bootstrap' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gems_for_testing_framework(testing_framework)\n testing_framework == :rspec ? '' : %Q{gem \"#{testing_framework}\", :group => :test} \n end", "def stylesheet\n @stylesheet ||= Dir.glob(root+'/**/parts.*css').first\n end", "def target_frameworks\n if netcore?\n tfw = @proj_xml_n...
[ "0.5801476", "0.5783976", "0.5718329", "0.56976354", "0.56976354", "0.56976354", "0.56912494", "0.5659007", "0.56516767", "0.5620703", "0.5543281", "0.55301464", "0.55301464", "0.55301464", "0.55301464", "0.55301464", "0.55301464", "0.55103683", "0.54837906", "0.5422308", "0....
0.74732846
0
Add a gem to the Gemfile
def gem_to_gemfile(gem) gem_str = <<~GEM #{gem.comment ? "# #{gem.comment}" : ''} #{(gem.commented_out ? '#' : '')}gem '#{gem.name}'#{gem_version_str(gem)}#{gem_options(gem)} GEM gem_str.strip end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gem(name, requirement = nil)\n gems << Gem.new(name, requirement)\n end", "def add_gemfile\n copy_file 'static/dry/Gemfile.default', \"#{name}/Gemfile\"\n say 'Add Gemfile', :green\n end", "def gem(name, *reqs)\n @dependencies << Gem::Dependency.new(name, reqs)\n end", ...
[ "0.7209957", "0.7183405", "0.67059696", "0.67059696", "0.65652823", "0.65378886", "0.65094405", "0.6487968", "0.6486245", "0.6472643", "0.6436112", "0.6394159", "0.6323169", "0.6317796", "0.63075083", "0.6249739", "0.6232772", "0.6221473", "0.62034845", "0.62024826", "0.61900...
0.0
-1
If the gem requires a specific version, determine it
def gem_version_str(gem) return '' unless gem.version # "#{gem.version ? ", '#{gem.version}'" : ''}" ", '#{gem.version}'" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def version_required(gem_def)\n return Gem::Dependency.instance_methods.map(&:to_sym).include?(:requirement) ? gem_def.requirement : gem_def.version_requirements\nend", "def gem_version_more?(name, version)\n Gem.loaded_specs[name].version >= Gem::Version.new(version)\n end", "def version_specified_ge...
[ "0.77554524", "0.76980346", "0.76972544", "0.7496754", "0.7459695", "0.7408123", "0.7408123", "0.7408123", "0.7408123", "0.7408123", "0.7408123", "0.73400265", "0.7304826", "0.7304826", "0.7276781", "0.72616047", "0.717571", "0.7159915", "0.71543235", "0.7144789", "0.71398294...
0.0
-1
If the requested gem requires additional options (ie: require: false) return this
def gem_options(gem) return '' unless gem.options.any? options_str = gem.options.map { |k, v| "#{k}: #{v.inspect}" }.join(', ') ", #{options_str}" unless options_str.blank? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def require!\n super do\n gem @gem_name, @version if @version\n end\n end", "def disabled?\n super || !gemfile.exist?\n end", "def required(gem_name, gem_install_name = nil)\n Required::required gem_name, gem_install_name\nend", "def custom_gem(name, options = Hash.new)\n local_path...
[ "0.6645214", "0.6431551", "0.63915014", "0.63156474", "0.62942594", "0.62696654", "0.62361085", "0.62329763", "0.62329763", "0.62329763", "0.62329763", "0.62329763", "0.62329763", "0.62329763", "0.62329763", "0.62329763", "0.6148358", "0.6086342", "0.6011555", "0.59961396", "...
0.0
-1
Make a directory in the applications directory path
def mk_appdir(dir) path = Rails.root.join(dir) FileUtils.mkdir(path) unless File.directory?(path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_app_directories\n @shell.call \"mkdir -p #{self.directories.join(\" \")}\"\n end", "def make_directory(path)\n mkdir(path)\n chown(path, user)\n path\n end", "def make_dir(path)\n FileUtils.mkdir_p( path )# unless File.exists?(path)\n end", "def make_dir_for_path(path)\...
[ "0.762671", "0.7165527", "0.7157186", "0.7153562", "0.71301025", "0.7121114", "0.7038211", "0.69959074", "0.68819857", "0.6864578", "0.6857136", "0.68466306", "0.6843986", "0.6774119", "0.6727233", "0.6706691", "0.67018026", "0.6681632", "0.6656103", "0.6647229", "0.6645504",...
0.74310064
1
If you want all lines of the string to be indented a specific amount
def indent_all_lines(str, spaces = 2) return '' if str.nil? || str.blank? str.strip.split(/\n/).map { |line| optimize_indentation(line, spaces.to_i) }.join('') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def indent_for(line); end", "def indent(str, amount=2)\n i = (\" \"*amount)\n (i + str.gsub(/\\n/, \"\\n#{i}\")).rstrip\n end", "def indent(string, amt)\n string.gsub /\\n *([^\\n]+)/m, \"\\n#{' ' * amt}\\\\1\"\n end", "def indent(str, count = 2)\n str = require_string! st...
[ "0.77238977", "0.7602694", "0.75793684", "0.756106", "0.74707", "0.74628", "0.7175614", "0.7165967", "0.71657765", "0.71310896", "0.71310896", "0.71276176", "0.7124178", "0.7118115", "0.70990145", "0.706853", "0.706853", "0.70585597", "0.6992529", "0.6992529", "0.6992529", ...
0.7347949
6
Used to add additional assets to be considered when compiling your assets
def add_to_assets(asset_str) append_to_file('config/initializers/assets.rb', "Rails.application.config.assets.precompile += %w( #{asset_str} )\n") unless asset_str.blank? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precompile_assets; end", "def precompile_assets=(_arg0); end", "def add_assets(paths)\n copy_assets(paths)\n characterize_assets\n create_or_update_assets\n end", "def extra_asset_links\n lines = []\n if item.attributes.has_key?(:css)\n for stylesheet in item.attributes[:css]\n ...
[ "0.7377304", "0.72177356", "0.7204855", "0.71728927", "0.7171373", "0.714031", "0.714031", "0.714031", "0.69778085", "0.6976124", "0.6918127", "0.69025934", "0.69012356", "0.6818183", "0.68151057", "0.6813914", "0.67877734", "0.6784348", "0.6774915", "0.6630029", "0.66153955"...
0.7250944
1
Add a specific line to the config/routes.rb file
def add_to_routes(route_str = '') inject_into_file('config/routes.rb', optimize_indentation("#{route_str.strip}\n", 2), after: "\s# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html\n") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_routes m\n file_to_update = 'config/routes.rb'\n line_to_add = \"map.resources :casein_#{controller_file_name}\"\n insert_sentinel = 'CaseinAddRoutes::mapper map'\n gsub_add_once m, file_to_update, \" \" + line_to_add, insert_sentinel\n logger.route line_to_add\n end", "de...
[ "0.74240524", "0.6807506", "0.66621584", "0.6560786", "0.6524357", "0.6517764", "0.64951235", "0.64284015", "0.6424449", "0.6383891", "0.63717604", "0.63510203", "0.63503414", "0.63451463", "0.62634265", "0.62113035", "0.620693", "0.61696994", "0.61264646", "0.60574025", "0.6...
0.7298145
1
Used to create highlights when running `kowl h` (usage summary displayed by the binstub) Highlight the specific string
def highlight(str = '') return '' if str.blank? str = str.split('=') str.count > 1 ? "\e[32m#{str[0]}=\e[33m#{str[1]}\e[0m" : "\e[32m#{str[0]}\e[0m" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def highlights; end", "def highlights; end", "def highlights; end", "def highlighter_prefix=(_arg0); end", "def highlighter_prefix; end", "def highlighter_prefix; end", "def highlighter=(_arg0); end", "def highlight(text,relations,places)\n highlight = String.new(text)\n relations.each do |relation...
[ "0.70313466", "0.70313466", "0.70313466", "0.69726485", "0.6970006", "0.6970006", "0.6834523", "0.67985183", "0.67622113", "0.67622113", "0.669139", "0.6682478", "0.6682478", "0.65246737", "0.65224403", "0.6496896", "0.6410336", "0.6401165", "0.6374932", "0.6358086", "0.63084...
0.6204986
22
Highlight the default values for specified flag
def dh(str = '') return '' if str.blank? str = str.split(': ') str.count > 1 ? "\e[36m#{str[0]}: \e[31m#{str[1]}\e[0m" : "\e[34m#{str[0]}\e[0m" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_flags\n flags.select &:default\n end", "def flag_color(flag)\n if flag.name == \"important\" # important\n \"bl_bookmarks__item--flag__important ion-record\"\n elsif flag.name == \"very important\" # very important\n \"bl_bookmarks__item--flag__very-important ion-record\"\...
[ "0.6422909", "0.6186971", "0.6046564", "0.5976", "0.5908239", "0.5669702", "0.5654317", "0.5652902", "0.56326693", "0.56317955", "0.5616121", "0.5602403", "0.55953825", "0.557259", "0.5559409", "0.552648", "0.5511145", "0.55029476", "0.5502667", "0.5475839", "0.5444285", "0...
0.0
-1
Used to create and return the .env file database configuration for the specific environment
def dotfile_databases(database, env) return '' if database == 'sqlite3' db = { username: "DB_USER=appUser123\n", password: "DB_PASSWORD=App($)Password\n", sid: '', host: '' } case database when 'oracle' db = { username: "DB_USER=system\n", password: "DB_PASSWORD=oracle\n", sid: "DB_SID=xe\n" } when 'sqlserver' db[:username] = "DB_USER=SA\n" db[:password] = "DB_PASSWORD=yourStrong(!)Password\n" end db[:host] = "DB_HOST=localhost\n" unless env == 'docker' "#{db[:username]}#{db[:password]}#{db[:host]}#{db[:sid]}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db_file\n env_config['db_file'] || raise('environment problem:environment information not loaded')\n end", "def read_config\n db_config = YAML.load_file('config/database.yml.production')\n set :db_user, db_config[rails_env][\"username\"]\n set :db_password, db_config[rails_env][\"password\"] \n s...
[ "0.75751454", "0.71477467", "0.71477467", "0.6964805", "0.6949988", "0.68352944", "0.678837", "0.6621911", "0.66208017", "0.64604884", "0.64507", "0.6421874", "0.64140874", "0.64098334", "0.64098334", "0.64098334", "0.64098334", "0.6398488", "0.63963884", "0.63963884", "0.638...
0.7089949
3
Provide a user friendly representation
def to_s '#<Twilio.Conversations.V1.ConfigurationList>' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_display\n raise NotImplementedError\n end", "def to_s; description end", "def to_s\n super\n end", "def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end", "def to_s\n super\n end", "def to_s\n \"#{@nam...
[ "0.70447654", "0.7025946", "0.70086724", "0.7008141", "0.69449997", "0.691802", "0.6843895", "0.6797355", "0.6655898", "0.6622141", "0.66182053", "0.66182053", "0.66182053", "0.66182053", "0.66182053", "0.66182053", "0.66182053", "0.66182053", "0.6610882", "0.6610882", "0.658...
0.0
-1
Provide a user friendly representation
def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Conversations.V1.ConfigurationContext #{context}>" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_display\n raise NotImplementedError\n end", "def to_s; description end", "def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end", "def to_s\n super\n end", "def to_s\n super\n end", "def to_s\n \"#{@nam...
[ "0.70430577", "0.7025487", "0.7008232", "0.7007793", "0.69441473", "0.6917163", "0.68431", "0.6797009", "0.6655106", "0.66227216", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.660979", "0.660979", "0.6585346", "0...
0.0
-1
Provide a detailed, user friendly representation
def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Conversations.V1.ConfigurationContext #{context}>" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def details; end", "def to_s; description end", "def get_detail\n return self.inspect\n end", "def to_display\n raise NotImplementedError\n end", "def formatted_info\n \"#{self.name} - #{self.description}\"\n end", "def toString\n #Not sure if we want this or just use the getters for mor...
[ "0.68170065", "0.68142146", "0.6758589", "0.6718451", "0.66697186", "0.6655344", "0.6632312", "0.66273594", "0.6550127", "0.65188134", "0.6497969", "0.6480078", "0.6477721", "0.6472211", "0.64502096", "0.64502096", "0.64502096", "0.64502096", "0.64502096", "0.64502096", "0.64...
0.0
-1
Build an instance of ConfigurationInstance
def get_instance(payload) ConfigurationInstance.new(@version, payload) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instantiate_configuration(options={}) #:nodoc:\n Capistrano::Configuration.new(options)\n end", "def configuration\n @configuration ||= configuration_type.new\n end", "def initialize\n @configuration = Configuration.new\n end", "def build(&block)\n # provide access to '...
[ "0.672848", "0.66624016", "0.6656234", "0.643264", "0.6399296", "0.63736844", "0.63736844", "0.6367376", "0.63276356", "0.6311111", "0.6302225", "0.6302225", "0.6297931", "0.62911105", "0.62911105", "0.62911105", "0.62911105", "0.62911105", "0.62911105", "0.62911105", "0.6291...
0.6783076
0
Provide a user friendly representation
def to_s '<Twilio.Conversations.V1.ConfigurationPage>' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_display\n raise NotImplementedError\n end", "def to_s; description end", "def to_s\n super\n end", "def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end", "def to_s\n super\n end", "def to_s\n \"#{@nam...
[ "0.70447654", "0.7025946", "0.70086724", "0.7008141", "0.69449997", "0.691802", "0.6843895", "0.6797355", "0.6655898", "0.6622141", "0.66182053", "0.66182053", "0.66182053", "0.66182053", "0.66182053", "0.66182053", "0.66182053", "0.66182053", "0.6610882", "0.6610882", "0.658...
0.0
-1
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
def context unless @instance_context @instance_context = ConfigurationContext.new(@version ) end @instance_context end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def context\n unless @instance_context\n @instance_context = ApplicationContext.new(@version , @params['account_sid'], @params['sid'])\n end\n @instance_context\n end", "def context\n ...
[ "0.68387127", "0.6803425", "0.6797454", "0.6772821", "0.67694455", "0.67694455", "0.6732738", "0.6683487", "0.66793", "0.66790885", "0.6678002", "0.66416395", "0.6627958", "0.66104096", "0.66007036", "0.65932024", "0.65719074", "0.65685713", "0.6557029", "0.65504694", "0.6547...
0.656113
18
Provide a user friendly representation
def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Conversations.V1.ConfigurationInstance #{values}>" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_display\n raise NotImplementedError\n end", "def to_s; description end", "def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end", "def to_s\n super\n end", "def to_s\n super\n end", "def to_s\n \"#{@nam...
[ "0.70430577", "0.7025487", "0.7008232", "0.7007793", "0.69441473", "0.6917163", "0.68431", "0.6797009", "0.6655106", "0.66227216", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.660979", "0.660979", "0.6585346", "0...
0.0
-1
Provide a detailed, user friendly representation
def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Conversations.V1.ConfigurationInstance #{values}>" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def details; end", "def to_s; description end", "def get_detail\n return self.inspect\n end", "def to_display\n raise NotImplementedError\n end", "def formatted_info\n \"#{self.name} - #{self.description}\"\n end", "def toString\n #Not sure if we want this or just use the getters for mor...
[ "0.68170065", "0.68142146", "0.6758589", "0.6718451", "0.66697186", "0.6655344", "0.6632312", "0.66273594", "0.6550127", "0.65188134", "0.6497969", "0.6480078", "0.6477721", "0.6472211", "0.64502096", "0.64502096", "0.64502096", "0.64502096", "0.64502096", "0.64502096", "0.64...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def image_params params.require(:project_image).permit(:screenshot, :project_id, :unique_token) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6981537", "0.67835593", "0.6748275", "0.67436063", "0.6736311", "0.65937173", "0.6503359", "0.6498499", "0.6482832", "0.6478776", "0.645703", "0.6439998", "0.63802195", "0.6377008", "0.6366287", "0.632018", "0.63016284", "0.63011277", "0.62932974", "0.62919617", "0.6290564...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_first_baseman_stat @first_baseman_stat = FirstBasemanStat.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a trusted parameter "white list" through.
def first_baseman_stat_params params.require(:first_baseman_stat).permit(:position_name, :shorthand, :sport_id, :position_id, :sport_name, :event, :games_started, :games_played, :win, :loss, :wins, :losses, :plate_appearances, :at_bats, :hits, :runs_scored, :runs_batted_in, :walks, :strike_outs, :stolen_bases, :doubles, :triples, :home_runs, :score, :opponent_score, :user_id, :stat_id, :sport_id, :position_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
Reads a single byte from the pipe.
def getbyte char = getc char ? char.getbyte(0) : nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getbyte\n read(1)\n end", "def read_byte\n buf = read_all(1)\n return Bytes.get_string_byte(buf, 0)\n end", "def readbyte\n getbyte || raise(EOFError)\n end", "def getbyte\n read(1).ord\n end", "def read_byte\n read('C', 1)\n end", "def read_by...
[ "0.77859414", "0.7745722", "0.7700225", "0.75909054", "0.7552271", "0.74231297", "0.7261125", "0.7206362", "0.7189144", "0.7021475", "0.69872725", "0.6914632", "0.68667674", "0.6799037", "0.67268455", "0.6679358", "0.665139", "0.66294235", "0.660685", "0.65898794", "0.6583254...
0.6313997
30
Reads a single character from the pipe.
def getc return @read_buffer.slice!(0) if @read_buffer && !@read_buffer.empty? @read_buffer ||= +'' Polyphony.backend_read(self, @read_buffer, 8192, false, -1) return @read_buffer.slice!(0) if !@read_buffer.empty? nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readchar\n getc || raise(EOFError)\n end", "def read_byte\n read('C', 1)\n end", "def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\"\n begin\n input << STDIN.read_nonblock(3)\n rescue Standa...
[ "0.76599306", "0.74723554", "0.7373208", "0.73564684", "0.7319815", "0.7319815", "0.7319815", "0.7319815", "0.7250056", "0.7250056", "0.7250056", "0.7235716", "0.72354627", "0.71929145", "0.71705866", "0.71625173", "0.70387477", "0.69764125", "0.69060206", "0.6903406", "0.688...
0.0
-1
Reads from the pipe.
def read(len = nil, buf = nil, buffer_pos = 0) return Polyphony.backend_read(self, buf, len, true, buffer_pos) if buf @read_buffer ||= +'' result = Polyphony.backend_read(self, @read_buffer, len, true, -1) return nil unless result already_read = @read_buffer @read_buffer = +'' already_read end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(*args)\n sync\n io.read *args\n end", "def read\n @handle.read\n end", "def read\n return if @read_flag\n\n process_reading\n end", "def shell_read(length = nil)\n if length.nil?\n rv = rstream.get\n else\n rv = rstream.read(length)\n end\n retur...
[ "0.72086924", "0.7187916", "0.71058846", "0.7086703", "0.7077615", "0.70185566", "0.700214", "0.69456565", "0.6814137", "0.68033916", "0.6787313", "0.6758005", "0.6689138", "0.66554356", "0.6643333", "0.6617766", "0.659195", "0.6582097", "0.6581534", "0.6571048", "0.6552094",...
0.5921749
90
Reads from the pipe.
def readpartial(len, buf = +'', buffer_pos = 0, raise_on_eof = true) result = Polyphony.backend_read(self, buf, len, false, buffer_pos) raise EOFError if !result && raise_on_eof result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(*args)\n sync\n io.read *args\n end", "def read\n @handle.read\n end", "def read\n return if @read_flag\n\n process_reading\n end", "def shell_read(length = nil)\n if length.nil?\n rv = rstream.get\n else\n rv = rstream.read(length)\n end\n retur...
[ "0.72086924", "0.7187916", "0.71058846", "0.7086703", "0.7077615", "0.70185566", "0.700214", "0.69456565", "0.6814137", "0.68033916", "0.6787313", "0.6758005", "0.6689138", "0.66554356", "0.6643333", "0.6617766", "0.659195", "0.6582097", "0.6581534", "0.6571048", "0.6552094",...
0.0
-1
Writes to the pipe.
def write(buf, *args) Polyphony.backend_write(self, buf, *args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_pipe(input)\n written = @pipe.write(input)\n @pipe.flush\n\n if written != input.length # rubocop:disable Style/GuardClause\n msg = \"Only wrote #{written} out of #{input.length} expected bytes to PowerShell pipe\"\n raise Errno::EPIPE.new, msg\n end\n end", "def sh...
[ "0.71435106", "0.69128627", "0.69128627", "0.68805027", "0.6700958", "0.6525963", "0.6524989", "0.65169924", "0.6514245", "0.6513196", "0.6513196", "0.6472097", "0.64622104", "0.6407786", "0.64072704", "0.6406832", "0.6406832", "0.6406832", "0.6406832", "0.63598424", "0.63598...
0.6072355
37
Writes to the pipe.
def <<(buf) Polyphony.backend_write(self, buf) self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_pipe(input)\n written = @pipe.write(input)\n @pipe.flush\n\n if written != input.length # rubocop:disable Style/GuardClause\n msg = \"Only wrote #{written} out of #{input.length} expected bytes to PowerShell pipe\"\n raise Errno::EPIPE.new, msg\n end\n end", "def sh...
[ "0.7143897", "0.6910266", "0.6910266", "0.6877188", "0.66990054", "0.6524685", "0.6524225", "0.65143454", "0.6513033", "0.65119785", "0.65119785", "0.6469712", "0.6460922", "0.6408532", "0.64054483", "0.640441", "0.640441", "0.640441", "0.640441", "0.63587666", "0.63587666", ...
0.0
-1
Writes a line with line feed to the pipe.
def puts(*args) if args.empty? write LINEFEED return end idx = 0 while idx < args.size arg = args[idx] args[idx] = arg = arg.to_s unless arg.is_a?(String) if arg =~ LINEFEED_RE idx += 1 else args.insert(idx + 1, LINEFEED) idx += 2 end end write(*args) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line_feed\n write_raw \"\\n\"\n end", "def write_line data\n _data[:out].puts data\n _data[:out].flush\n end", "def putline(line)\n @socket.puts(line.chomp)\n end", "def write(line)\n begin\n @sock.puts line\n rescue\n end\n puts \">> #{line}\"\n end", ...
[ "0.7411366", "0.72201765", "0.68373525", "0.6804227", "0.66175056", "0.66020316", "0.6593629", "0.6549847", "0.65201336", "0.6438959", "0.63316953", "0.62997234", "0.628438", "0.6271037", "0.61744744", "0.6134378", "0.61178654", "0.61083484", "0.6078873", "0.5939412", "0.5826...
0.0
-1
def readbyte end def readchar end def readline(sep = $/, limit = nil, chomp: nil) end def readlines(sep = $/, limit = nil, chomp: nil) end
def write_nonblock(string, _options = {}) write(string) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read() end", "def readchar() end", "def readchar() end", "def readchar() end", "def read_byte; end", "def readline\n end", "def readchar\n end", "def read; end", "def read; end", "def read; end", "def read; end", "def read; end", "def read; end", "def read; end", "def read cha...
[ "0.73357", "0.72734344", "0.72734344", "0.72734344", "0.70016277", "0.69181913", "0.68951607", "0.6892259", "0.6892259", "0.6892259", "0.6892259", "0.6892259", "0.6892259", "0.6892259", "0.6805932", "0.6778989", "0.6756082", "0.6752847", "0.67195666", "0.66845185", "0.6677803...
0.0
-1
Runs a read loop.
def read_loop(maxlen = 8192, &block) Polyphony.backend_read_loop(self, maxlen, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_loop\n loop do\n msg = connection.read_msg\n msg.received_at = Time.now\n handle(msg)\n end\n rescue StandardError => e\n self << [:raise_error, e]\n end", "def read_loop\n loop do\n begin\n should_bail = synchronize do...
[ "0.76309735", "0.75791323", "0.7382309", "0.71994543", "0.7107027", "0.70232934", "0.69116163", "0.6820503", "0.68150806", "0.6780663", "0.6777606", "0.6720959", "0.6704854", "0.66279614", "0.65968657", "0.65968657", "0.6536133", "0.65192527", "0.6489128", "0.63981324", "0.63...
0.73402953
4
Waits for pipe to become readable.
def wait_readable(timeout = nil) if timeout move_on_after(timeout) do Polyphony.backend_wait_io(self, false) self end else Polyphony.backend_wait_io(self, false) self end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_readable(io)\n wait io do |monitor|\n monitor.wait_readable\n end\n end", "def wait_readable(io)\n wait_for_io io, @readers\n end", "def wait_readable\n ::IO.select([@io], [], [])\n true\n rescue IOError\n false\n end", "def wait...
[ "0.7701357", "0.75098085", "0.7406789", "0.7372095", "0.7165727", "0.6778609", "0.67585456", "0.66534966", "0.6579845", "0.644817", "0.6432459", "0.6431126", "0.6200218", "0.6163383", "0.61552364", "0.60915303", "0.60728115", "0.6064045", "0.6020764", "0.5953828", "0.59264684...
0.678638
5