query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
23bfde240da9f077b5f6c002dfbcbe5b
method for if the game is a draw if the board is full and won is false then return true
[ { "docid": "b928070b3551508b9e531f78e838ee95", "score": "0.0", "text": "def draw?\n if full? && !won?\n return true \n else \n return false \n end \n end", "title": "" } ]
[ { "docid": "53dbbd30652404836d710ca341cd1540", "score": "0.9225921", "text": "def draw?\r\n board.full? && !won? \r\n end", "title": "" }, { "docid": "0d6cca871cc0176f832f6ed4723021cc", "score": "0.92091525", "text": "def draw?\n @board.full? && !won?\n end", "title": "" ...
50000d66c382b75d1d9a7fab6022a2e0
reduce 239 omitted source://parser3.1.2.1/lib/parser/ruby31.rb:5317
[ { "docid": "4c0a078fb3cce8502c158456ef028d13", "score": "0.0", "text": "def _reduce_240(val, _values, result); end", "title": "" } ]
[ { "docid": "3d6c1b4c3f379e324dc4c13c8cedb53b", "score": "0.8015098", "text": "def _reduce_285(val, _values, result)\n result = lexer.line\n \n result\nend", "title": "" }, { "docid": "950f3540561ab576d64bc62717f9f4d6", "score": "0.79803914", ...
d700a9537e1eeeba786cbad8866c731b
Debian's 'popcon' (Popularity Contest) normally reports the sshmenu package as 'installed but not used' since the panel applet does not access /usr/bin/sshmenu. This routine updates the atime on that file each time the applet starts. This functionality is completely nonessential and can be safely disabled in the unlike...
[ { "docid": "9f909fe15489b2147487f16fabf60118", "score": "0.5369889", "text": "def appease_popcon # :nodoc:\n begin\n open('/usr/bin/sshmenu') { |f| f.readline }\n rescue Exception\n end\n end", "title": "" } ]
[ { "docid": "ded8c963e222ba3c7bd7f7d94c48ed2b", "score": "0.7316651", "text": "def appease_popcon # :nodoc:\n # update access time on a file the Debian popcon is looking at :-)\n begin\n open('/usr/bin/sshmenu-gnome') { |f| f.readline }\n rescue Exception\n end\n super\n ...
eda0a2f496cfd9d1916e468146d0ec05
Easy 3, Question 1 Searching 101 Write a program that solicits 6 numbers from the user, then prints a message that describes whether or not the 6th number appears amongst the first 5 numbers.
[ { "docid": "604fd38fab40bed207d77ce319b52582", "score": "0.0", "text": "def get_number(identifier)\n print \"==> Enter the #{identifier} number: \"\n gets.chomp.to_i\nend", "title": "" } ]
[ { "docid": "5b4ccb7d63b58573df60d07345a8d5c1", "score": "0.70601606", "text": "def last_include\n result = []\n\n puts \"Enter your first number\"\n first = gets.chomp\n result << first\n\n puts \"Enter your second number\"\n second = gets.chomp\n result << second\n\n puts \"Enter your third num...
488ecf33d5d23fe47a9eb8603143bd8e
Returns parent of node i.
[ { "docid": "c7ed8503c02794419509c714be4fade8", "score": "0.81620824", "text": "def parent(i)\n @data[parent_index(i)]\n end", "title": "" } ]
[ { "docid": "86f62b56dd78591b36503d8aa66718c2", "score": "0.79100955", "text": "def parent_at(i)\n @parents.keys.sort.collect {|p| [p] * @parents[p].length }.flatten[i]\n end", "title": "" }, { "docid": "0205424fd35542983d85e3ef00e7a14a", "score": "0.7424977", "text": "def par...
8ac0971a3db7277a96462c868ee1146c
... thru LoadJson class's process_json
[ { "docid": "cc713078b71e44d408d74f9ece9168dc", "score": "0.0", "text": "def json_template_content\n[ {\n\t\t\"id\": 1,\n\t\t\"name\": \"Default\",\n\t\t\"template\": \"{timeMessage} {firstName} {lastName}. Room number {roomNumber} is now available for your use at {company} in {city}. If you require any...
[ { "docid": "47b9e957398d9827d38ecab51a571e88", "score": "0.7646687", "text": "def load_json; end", "title": "" }, { "docid": "ed4e80851c6b0e0638de61fd79717635", "score": "0.69415504", "text": "def load_json(filename); end", "title": "" }, { "docid": "c64127c6f3122533cc28f...
f2a7b74b030d7f539e30e23a132bdb50
Measures distance between `from` and `to` in units of this class.
[ { "docid": "d0099b156d40ed15b8cbbf402b05b275", "score": "0.6992564", "text": "def measure(from, to)\n from, to = from.to_time, to.to_time unless from.class == to.class\n from <= to ? _measure(from, to) : -_measure(to, from)\n end", "title": "" } ]
[ { "docid": "bd7bfd50e5dd365af1818bd77fc72c2a", "score": "0.7092607", "text": "def distance(from, to)\n latitude_distance = to[0]-from[0]\n longitude_distance = to[1]-from[1]\n\n latitude_distance = latitude_distance/180 * Math::PI\n longitude_distance = longitude_distance/180 * Math:...
79744f77a6080411e8fe20fbba9e772d
Click on the left button to open a different URL in the same window (Only works online). Click on the right button to open a URL in a new browser window.
[ { "docid": "9dd8ed8d7dcf1347109bdb513be2dd91", "score": "0.0", "text": "def setup\n \n size 640, 360\n \nend", "title": "" } ]
[ { "docid": "af9704939d2541384910358c5bbfa583", "score": "0.6985975", "text": "def open_in_browser\n puts url\n `#{open} #{url}`\n end", "title": "" }, { "docid": "44036e2af226c782c3532964643e5a82", "score": "0.6706067", "text": "def show_other_sites\n frm.link(:text=>\"Show...
ffc6f00cf38b0bd782a891471708702c
GET /jobs GET /jobs.json
[ { "docid": "9e86ba321348e109b70d7fd330deced1", "score": "0.72929126", "text": "def index\n @jobs = Job.by_user(current_user).page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end", "title": "" } ]
[ { "docid": "e0d30cb0880ae58f5dd30199afee732c", "score": "0.8199955", "text": "def get_jobs()\n u = self.build_uri(\"/jobs\")\n response = @client.get(u, nil, ACCEPT_RDF)\n return response\n end", "title": "" }, { "docid": "8a0695bb744593e3a36970adb8e0a14d", "score": "0....
58420cdeaa58e5a11a3b77d43fca37eb
Run command via SSH on remote host
[ { "docid": "1816e79297264b53cdf61b82751b5562", "score": "0.7586965", "text": "def ssh(cmd='')\n sh \"ssh #{$config['host']} -p #{$config['port']} '#{cmd}'\"\nend", "title": "" } ]
[ { "docid": "6e998c8803041c8c384945df8b61a0e5", "score": "0.80995756", "text": "def ssh(command)\n session{|ssh| ssh.exec!(command) }\n end", "title": "" }, { "docid": "a7eeb4da68c322ab9401b73ff7c70db1", "score": "0.79923177", "text": "def ssh_run(cmd)\n system(\"ssh username@hos...
a80ad1722c900616f2d8162927f11038
Invokes 'lists.update_member' API method
[ { "docid": "8a907a37505fed972d4b9566ea8eb3ca", "score": "0.86561304", "text": "def update_member(params)\n connection.call_method('lists.update_member', params.merge(id_params))\n end", "title": "" } ]
[ { "docid": "811d96e067cc02db076a1c104a96a192", "score": "0.81081825", "text": "def update_member(address, member_address, params)\n put(\"lists/#{address}/members/#{member_address}\", params)\n end", "title": "" }, { "docid": "2a89be3bec19d2f2c34f525595c9077b", "score": "0.80...
16f01e8cba3a2552504ae48ae2ea4218
This refers to the method pokemons as it requires the hash from the pokemons method. get_health gets the total health of the pokemons in the team
[ { "docid": "e12bacf2867718fc6db6779a6439616f", "score": "0.7283462", "text": "def get_health( result )\n total_health = 0\n for pokemons in result\n total_health += result['health']\n end\n return total_health\n end", "title": "" } ]
[ { "docid": "c989ae123c30781ca692bacf72660dbc", "score": "0.6792668", "text": "def getHealth()\n return @hp\n end", "title": "" }, { "docid": "503f50caf9e1d600de93d05e12e24b53", "score": "0.64819217", "text": "def health\n @@health[((info.stats.health.to_f / info.stats.max_h...
fff7278c47cafebcf57a1a44908de646
DELETE /clocks/1 DELETE /clocks/1.json
[ { "docid": "4e9888b905d18af8b3d54cf4f8c06102", "score": "0.6783203", "text": "def destroy\n @clock.destroy\n redirect_to index\n end", "title": "" } ]
[ { "docid": "2c19e4e452f6a7b0f94f2a15bc6fa569", "score": "0.7216867", "text": "def destroy\n @clock = current_user.clocks.find(params[:id])\n @clock.destroy\n\n respond_to do |format|\n format.html { redirect_to(clocks_url) }\n format.xml { head :ok }\n end\n end", "title": ""...
89814fc791244ea70719d3d1c1c2fe61
Time complexity: o(n) Space complexity: o(n)
[ { "docid": "46e25b84daf9b35456bd20dc07e72ab1", "score": "0.0", "text": "def bunny(n)\n # raise NotImplementedError, \"Method not implemented\"\n if n == 0\n return 0\n else\n return 2 + bunny(n-1)\n end\nend", "title": "" } ]
[ { "docid": "94b952c4eec254dafeaf15d164f67032", "score": "0.6495397", "text": "def slow_solution(m, a)\n n = a.size\n return 1 if n == 1\n distinct = 0\n n.times do |back|\n (back..n - 1).each do |front|\n if a[back..front] == a[back..front].uniq\n distinct += 1\n else\n br...
821b6252347ce319a39a3eb4cc5ba693
return the revision's author
[ { "docid": "0881e7fd6938036262cac9ca6900a9bf", "score": "0.7343937", "text": "def author\n props[ AUTHOR_PROP_NAME ] if props\n end", "title": "" } ]
[ { "docid": "1bd447a663791ce5bfcfef03ee657952", "score": "0.8212866", "text": "def author\n file.version.author.name\n end", "title": "" }, { "docid": "1c205b62f2fa8a8df30fb59f82360938", "score": "0.819597", "text": "def cmd_author\n puts(property(Svn::Core::PROP_REVISI...
e1c3a7f46786f63cef25898369b6c9a6
DELETE /patients/1 DELETE /patients/1.json
[ { "docid": "47810dba72d33d6dd1b9daa076f8451f", "score": "0.0", "text": "def destroy\n @patient.destroy\n render :close_all\n end", "title": "" } ]
[ { "docid": "69ee65ce08a33ff3453bff2d73b8b5cc", "score": "0.7944864", "text": "def destroy\n @patient.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c77f2ae848e9dc4375e05fe68defe689", "score": "0.7820231", "t...
e9aac3e956e574131a3816b3dd44ff40
Set a given key to a value
[ { "docid": "61bf486027fc1ed3e718285660e258ac", "score": "0.8138443", "text": "def set(key, value)\n\t\t@dict[key] = value\n\t\treturn \"OK\"\n\tend", "title": "" } ]
[ { "docid": "d49a7256948ce963ae8fb80c71a6966e", "score": "0.85112244", "text": "def set(key, value); end", "title": "" }, { "docid": "d49a7256948ce963ae8fb80c71a6966e", "score": "0.85112244", "text": "def set(key, value); end", "title": "" }, { "docid": "d49a7256948ce963ae...
92594d55e1588eee6873787104a368fb
PATCH/PUT /footer_pages/1 PATCH/PUT /footer_pages/1.json
[ { "docid": "a65ccb1ba026ee686fe8caaa86277402", "score": "0.73383594", "text": "def update\n respond_to do |format|\n if @o_single.update(footer_page_params)\n format.html { redirect_to admin_footer_pages_url, notice: t(\"general.successfully_updated\") }\n format.json { head :no_co...
[ { "docid": "bfa5e75e267ff4bd559a6b12ad76f432", "score": "0.68337953", "text": "def update\n @footer = Footer.find(params[:id])\n\n respond_to do |format|\n if @footer.update_attributes(params[:footer])\n format.html { redirect_to @footer, notice: 'Footer was successfully updated.' }\n ...
02cf627cd4bd0628526c31421ba4d734
Adds callbacks for a behavior. Selects the callback manager for the behavior and forwards to its on method.
[ { "docid": "a69972638045a7438f1b4baaeddc7699", "score": "0.6811379", "text": "def on(behavior, *args, &block)\n (@behaviors[behavior] ||= @callbacks_factory.new).on(*args, &block)\n self\n end", "title": "" } ]
[ { "docid": "3259a63a5b83e54a4d30c79a81e5294c", "score": "0.62250334", "text": "def callback(&block)\n @callbacks << block\n end", "title": "" }, { "docid": "559eb8b8b2169ea17563f1187fa634b1", "score": "0.6091058", "text": "def add_callback(type, options, &block); end", "t...
34f5743be81e49ee6f60c211847a5d97
This is a special seed indicates that we don't want to advance the seed for the first roll. In Gachacurrent_seed_mode!, we advance the seed once to simulate the actual states of the game. That is, the game will advance the seed before rolling. This is all good, but this also means that we do not know the very first see...
[ { "docid": "f36615ce681c0ed1d21cb7d0f31a1302", "score": "0.6714471", "text": "def next_seed\n @next_seed ||= request.params['next_seed'].to_i\n end", "title": "" } ]
[ { "docid": "8211d9c96505ca9f77d894648e49fca1", "score": "0.6977712", "text": "def gacha_seed\n @gacha_seed ||=\n if next_seed.nonzero?\n next_seed\n else\n seed\n end\n end", "title": "" }, { "docid": "74921ae0e5d8f7be1da5fef477e7a...
778c08a0813cdda5e75180a9d4ccb3fb
Calculate the current load factor
[ { "docid": "e755895ef01e34b6a61a578576ff3c44", "score": "0.793124", "text": "def load_factor\n @count / size.to_f\n end", "title": "" } ]
[ { "docid": "9c74b18e19f0e9f810d7911b820049f3", "score": "0.8232974", "text": "def load_factor\n @load_count /= @size\n end", "title": "" }, { "docid": "ad5887bc03a34663506d376a909d0d0c", "score": "0.8096541", "text": "def load_factor\n @counter.to_f / @size.to_f\n end", "t...
ac105904be9d3aca378fd5af84174064
Returns the text for an NSDictionary assignment from a hash
[ { "docid": "7e4b1c87352c9288c8413d99017c409d", "score": "0.61966294", "text": "def NSDictionaryForHash(hash)\n# \"@{\\n\" + hash.collect { |key, value| %Q( @\"#{key}\": @\"#{value}\") }.join(\",\\n\") + \"}\"\n \"(\\n\" + hash.collect { |key, value| %Q( \"#{value}\") }.join(\",\\n\")\nend", ...
[ { "docid": "4afd6918974f995ddbe26a32f7ca97bf", "score": "0.695627", "text": "def print_hash(text, hash)\n\tprint \"\\\"#{text}\\\" =>\"\n\tprint \"\\n\\t#{hash}\"\nend", "title": "" }, { "docid": "bde090c14d8c7d296401e9f8ce876419", "score": "0.6524041", "text": "def connect_hash_to_s...
87a52cf788b0365108281ce4b521d310
GET /product_style_types/1 GET /product_style_types/1.xml
[ { "docid": "9d726bbb7a8e05000a194edce9c81920", "score": "0.74918693", "text": "def show\n @product_style_type = ProductStyleType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_style_type }\n end\n end", "title": ...
[ { "docid": "6a4ef3652d9433298ba26528af649e81", "score": "0.71854395", "text": "def index\n @product_style_types = ProductStyleType.find_all_by_company_id(current_user.company_id)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_style_types }...
8d3f354b528d0a5a9a8ea51dfe5f7eef
This method is call to inspect an instance + class It call all other inspection methods
[ { "docid": "d4f27e9eab63ee16fcb92bec0b38307e", "score": "0.7471925", "text": "def inspect_instance object_to_inspect, object_to_inspect_class\n inspect_hierarchy object_to_inspect, object_to_inspect_class\n\n puts \"Class methods\"\n inspect_public_methods object_to_inspect_class\n inspect_p...
[ { "docid": "fa5eab49296145d1494946789847da17", "score": "0.72044337", "text": "def inspect\n raise_error # expect no instances\n end", "title": "" }, { "docid": "9c5071d2612f4c31ec92f41238778d8f", "score": "0.6827348", "text": "def inspect\n\t\tself.dissect\n\te...
160c5ec6d53e4710dfae9c56c9622ad9
PUT /friends/1 PUT /friends/1.xml
[ { "docid": "908035e1fe15f02a7efaa5418501fef8", "score": "0.55919766", "text": "def update\n @friend = Friend.find(params[:id],:conditions=>{:created_by=>current_user.id})\n\n respond_to do |format|\n if @friend.update_attributes(params[:friend])\n format.html { redirect_to(groups_path,...
[ { "docid": "7dd001e07ab24f0215a695ce131549f9", "score": "0.65248823", "text": "def update\n @friend = Friend.find(params[:id])\n @friend.update_attributes(params[:friend])\n respond_with(@friend)\n end", "title": "" }, { "docid": "6f38134f9793e550e69e191618f60480", "score": "0....
aa53f69a67eed72aa751958b114a7345
Array of hashes for forms, defined in subclassed filters
[ { "docid": "ec9a4905593197387cb0b6c54eede0ec", "score": "0.0", "text": "def get_config_fields\n []\n end", "title": "" } ]
[ { "docid": "279bdfc8e2e2039e5c62954dbdc40893", "score": "0.72858477", "text": "def form\n ret = {}\n @elems.map do |x|\n name = x['name']\n id = x['id']\n next if (name.nil? && id.nil?)\n value = x['value']\n type = x['type']\n ret[name] = value\n...
e4e0fc2a8f029b3168c129c92ac954e4
callseq: time.gmtime => time time.utc => time Converts time to UTC (GMT), modifying the receiver. t = Time.now => Wed Apr 09 08:56:03 CDT 2003 t.gmt? => false t.gmtime => Wed Apr 09 13:56:03 UTC 2003 t.gmt? => true t = Time.now => Wed Apr 09 08:56:04 CDT 2003 t.utc? => false t.utc => Wed Apr 09 13:56:04 UTC 2003 t.utc?...
[ { "docid": "a38a381fd5b85aa657f5c07d18cd18c9", "score": "0.6035434", "text": "def utc\n unless @_utc then\n @_utc = true\n @vals = LIBC.new.c_gmtime(@tv_sec)\n end\n return self # .to_i # TOTAL FUCKING HACK\n end", "title": "" } ]
[ { "docid": "dd2ea6dd99eb8ea47d643e1fc8973746", "score": "0.71871877", "text": "def local_to_gm(time)\n TimeZone.new(session[:time_zone]).local_to_utc(time)\n end", "title": "" }, { "docid": "cf2c18fec64abbcf4f47b07e65d8aa37", "score": "0.67897266", "text": "def getutc() end", ...
7e5f5fb81045ee530a5aba5e28dc262f
modifies this object to be of Kelvin converts the temperature to be Kelvin modifies degrees and scale
[ { "docid": "4081a77878591bbe8a9161ba2d21de36", "score": "0.79992765", "text": "def getKelvin(t)\r\n if t.scale =~ /K/\r\n @degrees = t.degrees\r\n elsif t.scale =~ /C/\r\n @degrees = t.degrees + 273.15\r\n else\r\n @degrees = ((t.degrees - 32) * (5/9)) + 273.15\r\n ...
[ { "docid": "09c19630a9f118b289f8929e46c8532c", "score": "0.84405196", "text": "def toKelvin()\n case @myScale\n when 'F', 'f'\n newDeg = ((@myDegree - 32) * (5.0 / 9.0)) + 273.15\n return Temperature.new(newDeg, 'K')\n when 'C', 'c'\n ...
96c1e6de3e19a9356a1d577e9305f27b
PATCH/PUT /db_infos/1 PATCH/PUT /db_infos/1.json
[ { "docid": "364cd95f07f5d5a74898ac2807b60743", "score": "0.6977015", "text": "def update\n respond_to do |format|\n if @db_info.update(db_info_params)\n format.html { redirect_to @db_info}\n format.json { render :show, status: :ok, location: @db_info }\n else\n format.h...
[ { "docid": "073cfb58882c9546e560777ccdc33038", "score": "0.656112", "text": "def update\n begin\n @resource = Database.find(params[:id])\n @resource.update_attributes!(params[:database])\n render :response => :PUT\n rescue Exception => e\n @error = process_exception(e)\n r...
4fd9d6bb0f27fcb1fb2ea7e166c3af52
For the given parent, find all the immediate children. If recurse is true, go down one more level to find the children of those children.
[ { "docid": "2c8c4843f6b7a6468e16ff466d3810d0", "score": "0.7304927", "text": "def get_children_maybe_recurse(parent_id, recurse = true)\n result = []\n query = <<-QUERY\n SELECT name, id FROM categories\n WHERE parent_id = :parent_id ORDER BY name\n QUERY\n cursor = @co...
[ { "docid": "4ccaeaba7394c59f1a66f239af10d37b", "score": "0.6343596", "text": "def parent(_recurse = false)\n max_recursion = @app.config[:max_traversal_recursion] || 99\n parent_helper(path, max_recursion)\n end", "title": "" }, { "docid": "8d8223844a8daae6f57669ad94...
84fe8e13dab5c2a33d4e41dfca75f428
FETCH Information of authentication
[ { "docid": "b6e930f217f5bd86e5731ab78fad69c8", "score": "0.0", "text": "def services_web_application_name_authentication_get_with_http_info(authorization, web_application_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AuthenticationApi.ser...
[ { "docid": "d55afee9b88b537da52db0d5b9f299da", "score": "0.75794125", "text": "def authentication_data\n [@username, @password]\n end", "title": "" }, { "docid": "a249dae2250c185673666f4c2935f7b8", "score": "0.73988026", "text": "def authentication_information()\n ...
93240a894b792b7dd6fb2b0013a46a3e
confirm the bucket exists by extracting the region from the response headers
[ { "docid": "6479c26e577951183a94da9319e416f9", "score": "0.69964874", "text": "def bucket_exists?(input_q, output_q)\n t = Thread.new do\n until input_q.empty?\n while bucket = input_q.shift\n region = http_request(:get, \"https://#{bucket}.s3.amazonaws.com/\").he...
[ { "docid": "1af64276dba7aa4a8d85b0246829e43d", "score": "0.72472227", "text": "def bucket_created?(s3_client, bucket_name)\r\n response = s3_client.create_bucket(bucket: bucket_name)\r\n if response.location == '/' + bucket_name\r\n return true\r\n else\r\n return false\r\n end\r\nrescue Stand...
651d720007e4d5225e4e8cd7282c28f8
Delegated to the current namespace if any
[ { "docid": "adadb51e5289a8bc82d96e84ff890ee1", "score": "0.0", "text": "def method_missing(name, *args, &block)\n if @current_namespace and @current_namespace.respond_to?(name)\n obj = @current_namespace.send(name, *args, &block)\n obj.__dsl_execute(&block)\n else...
[ { "docid": "9dc8df231acc84a5146334b0b9915d22", "score": "0.73158133", "text": "def namespace!\n nil.tap { self.namespace = self }\n end", "title": "" }, { "docid": "dc254a62b7ded2ff7a3b2a372fbcf50a", "score": "0.70813185", "text": "def current_namespace\n @current_namespace\...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "dc97845b8c16ca28072814c9081a7029", "score": "0.0", "text": "def set_account\n @account = Account.find(params[:account_id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "d...
63d54396447dd4a283ea6bf2db6edda2
def avg_evaluation if evaluations.present? evaluations.sum(:evaluation).to_f / evaluations.count end end
[ { "docid": "582f8f4cdf524a37a312fb26722cc686", "score": "0.0", "text": "def avg_rates_in_percent\n Rate.where(\"rateable_id=\"+id.to_s+ \" and dimension='allgemein'\").sum(:stars) / Rate.where(\"rateable_id=\"+id.to_s+ \" and dimension='allgemein'\").count * 100 / 5\n \n #rates.sum(:stars)...
[ { "docid": "3225de4f6f384b949cb13991257af20c", "score": "0.8165913", "text": "def evaluations_average\n evaluations = self.evaluations\n evals = evaluations.pluck(:eval)\n average = (evals.sum.to_f / evals.size).round(1)\n end", "title": "" }, { "docid": "48f8cd50dcdeae5782f91bca81...
b0fb90287257d0eb116e5d0dcd9aba48
POST /carts POST /carts.json
[ { "docid": "0accb9496fe7c846dcd8d781171c0c4c", "score": "0.0", "text": "def create\n if current_user.admin == false\n @product = Product.find params[:product_id]\n @cart = Cart.new(cart_params)\n @cart.user_id = current_user.id\n @cart.quantity = 1\n\n @existing_cart = Cart.find_by(pro...
[ { "docid": "2ed05351f8959b1c59c31fd25ed18632", "score": "0.7692144", "text": "def create\n response, status = BeyondApi::Request.post(@session,\n \"/carts\")\n\n handle_response(response, status)\n end", "title": "" }, { "docid": "...
711ff67493a4c4aefbaa1c1245caf18a
here lies bullshit: in the function below product is not a function, but a mashie of the product.json object here lies (con'td): this is a holdover from consildation (check the wiki)
[ { "docid": "4583415033a72c7ba5cb11db3b3c25bb", "score": "0.0", "text": "def product_firm_stats(product_presenter)\n\n\n if product_presenter.recently_starred_by_users.present?\n recents = @product.recently_starred_by_users.map do |starrer|\n link_to starrer.full_name, user_profile_path(st...
[ { "docid": "ee37b08e3bd07b7cd33f380d89dc558c", "score": "0.7379758", "text": "def a_fake_product\n @a_fake_product = {\n \"data\": {\n \"id\": 174,\n \"name\": \"1L Le Parfait Jar\",\n \"type\": \"physical\",\n \"sku\": \"\",\n \"description\": \"...
94700c957574554f20dff9bbba2868a3
Uses ActionController::Routing::Routes to generate the correct route for a given set of options. == Example route_for(:controller => 'registrations', :action => 'edit', :id => 1) => '/registrations/1;edit'
[ { "docid": "a0873534b5e66e86452f01f4fa3a113b", "score": "0.77581966", "text": "def route_for(options)\n ensure_that_routes_are_loaded\n ActionController::Routing::Routes.generate(options)\n end", "title": "" } ]
[ { "docid": "ff8d14975d77f28d37aa8cd9ed464f06", "score": "0.73607236", "text": "def url_for(options)\n ActionController::Routing::Routes.reload if ActionController::Routing::Routes.empty?\n ActionController::Routing::Routes.generate(options, {})\n end", "title": "" }, { "docid": ...
45b47a593b462afddcbef1ef7935dcf0
Make getting value from underlying hash thread safe.
[ { "docid": "417450ffb32cf3664a11e6db1eedf823", "score": "0.55709654", "text": "def [](key)\n if RUBY_ENGINE == 'opal'\n @hash[key]\n else\n @mutex.synchronize { @hash[key] }\n end\n end", "title": "" } ]
[ { "docid": "e7f7bad3cc1802837ef48988d7fde9e8", "score": "0.66535085", "text": "def getHashValue\n\treturn @hashValue\n end", "title": "" }, { "docid": "38ac1a67f636da6ece1ed18bb0d920f3", "score": "0.6459995", "text": "def get(key)\n sync.synchronize(:SH) { hash[key] }\n end"...
25ac59fd09d8ed7b3c399403f2e22102
List Tier0s Paginated list of all Tier0s
[ { "docid": "58fd89440c4e71a2e96ecd191364f861", "score": "0.0", "text": "def list_tier0s_0_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.list_tier0s_0 ...'\n end\n ...
[ { "docid": "7e69434cd2ef62a7dd1ebdd32eee877d", "score": "0.6398158", "text": "def index\n @item_tiers = ItemTier.all\n end", "title": "" }, { "docid": "feef38166d65f390d2db635d918700e8", "score": "0.62785643", "text": "def index\n @tuiters = Tuiter.all\n end", "title": ""...
f349ce8c5e71f09a7089e8b5c9ba33c6
Run the next function (if any)
[ { "docid": "c5e554ae34fd8a29f7dd22f5e9cc2114", "score": "0.716971", "text": "def next\n if @lambdas.size > 0\n @lambdas.shift.call(lambda { self.next })\n else\n @running = false\n end\n end", "title": "" } ]
[ { "docid": "51cbc664905c5759f5e6775045d2aad7", "score": "0.7371093", "text": "def next() end", "title": "" }, { "docid": "51cbc664905c5759f5e6775045d2aad7", "score": "0.7371093", "text": "def next() end", "title": "" }, { "docid": "d1f83d159b425bfc5239dc520da21ea7", "...
2c4ddbb9571ea1abd2113f4681ccaf0a
Parsing relative date like next friday or next month
[ { "docid": "c0727dc45940d4b09728001fa73551e7", "score": "0.67182964", "text": "def interpret_relative_date date\n \t\tall_durations = EXISTING_PATTERNS[:weekdays] + EXISTING_PATTERNS[:months] + EXISTING_PATTERNS[:durations]\n\t \trelative_date = /(?<tense>#{EXISTING_PATTERNS[:relative_tense]}) (?<type>#...
[ { "docid": "1d0e7550f6346689035c581e413f1e38", "score": "0.68461674", "text": "def date_parser(date)\n date = Chronic.parse(\"#{date.downcase}\")\n while date.wday < 6\n date = date += 1 # makes start date the next saturday from the input date\n end\n return date\nend", "title": "" }, { ...
d754c5c324dd6304b6619be903bad71f
For certain objects you can get extra data by giving option `include_data`. For example with clips you can add `include_data: "list,via"`.
[ { "docid": "ecc0c50c1625b770bbff2a29da0e942c", "score": "0.0", "text": "def [](resource_id, options = {})\n response = client.get(\"#{base_uri}/#{resource_id}\", options)\n if response.success?\n object_class.new(response.body, client)\n else\n raise Kippt::APIError.new(\"Resource cou...
[ { "docid": "0fba6fb0b67e4490eff1cdad45edb3c6", "score": "0.6221584", "text": "def data_objects(*args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n options[:images] = 1\n options[:sounds] = 1\n options[:text] = 1\n options[:details] = 1\n request('data_objects', *[args, options]....
4fcc9a32c279eefbffe8ce4fba71a958
GET /packages GET /packages.json
[ { "docid": "52ccce4564586bdefeb9d3ea5f37dd29", "score": "0.0", "text": "def index\n @packages = Package.where('active = ?', true)\n @boxberry = Package.all.reject { |p| p.tracking_code.nil? }\n @profiles = Profile.all\n @batches = Batch.all\n @sent = Batch.where('batch_status.status = ?',...
[ { "docid": "edf5c2348ba95692ad84e20246ff899e", "score": "0.797593", "text": "def get_packages\n\n user = User.find(decode_token)\n\n packages = user.packages\n\n render json: packages\n end", "title": "" }, { "docid": "2dc5bcaa110af6d79e14eb0f43f90f4b", "score": "0.75430185", ...
dd10da3a27f7611c99b70fcef04745c3
Retrieves all available entity types.
[ { "docid": "ed517b4f979be24bd295d6195d768147", "score": "0.82866675", "text": "def get_entity_types\n get_types(Occi::Core::Entity.kind)\n end", "title": "" } ]
[ { "docid": "e605d53ccb596339dd7bfcd00c5254a1", "score": "0.82484925", "text": "def get_entity_types\n Occi::Log.debug(\"Getting entity types ...\")\n @model.kinds.collect { |kind| kind.term }\n end", "title": "" }, { "docid": "d1913a26115116a11d71932db73e4159", "...
3f52973818698070d105a2c20fdb77a5
Serializes information the current object
[ { "docid": "1b80ce517c9bd9bcff52999e3096a26b", "score": "0.0", "text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"name\", @name)\n writer.write_collection_of_object...
[ { "docid": "0795eac2a3b746fc7fea6373714e1986", "score": "0.7951372", "text": "def serialize\n end", "title": "" }, { "docid": "762bca0e2db3ff19d91cc4521bb1e1d9", "score": "0.7645999", "text": "def serialize(object) end", "title": "" }, { "docid": "a126e681346630c4ec3...
8df31cc370bb10d0e0770f266aa596f3
Read and parse the averaged_statistics hash from the JSON file
[ { "docid": "18ff1362dafc6c79de1346009730ce1f", "score": "0.84324604", "text": "def read_statistics\n file = File.read(file_path)\n @averaged_statistics = JSON.parse(file)\n end", "title": "" } ]
[ { "docid": "e5d7df071870b4c085e3350d9f8d8ad2", "score": "0.63132405", "text": "def load_stats()\n loads = {}\n begin\n loadavg = File.open(@config.loadavg_file)\n loads = loadavg.readline.split(' ')[0 ... 3].map{|str| Integer(Float(str) * 100)}\n ensure\n loadavg.clos...
5664b2732c9c88686cbde211dca2fe4f
cache some usually immutable properties for later fast use; do not cache things that can change at any time
[ { "docid": "c640c73bc3f0a8b1f03195cfe13e8fe4", "score": "0.0", "text": "def update_from_api_object(is_hash)\n m = is_hash[\"metadata\"]\n props[:uid] = m[\"uid\"]\n props[:selfLink] = m[\"selfLink\"]\n props[:created] = m[\"creationTimestamp\"] # already [Time]\n\n s = is_hash[\...
[ { "docid": "e9fb137b01d4c7b487f6999c6fd5174c", "score": "0.70754975", "text": "def cache_attributes\n # variables which depend on phi\n unless @phi.nil?\n @u = create_u\n @n = create_n\n end\n end", "title": "" }, { "docid": "b3b27236b81f10c9baba40737f900288",...
1914fe74135ea89e7f1fffd3400c5aa6
All of the currently open graphs that are tied to the filesystem or a url or address.
[ { "docid": "53ecb6acff5aaabd204e1688953d49cd", "score": "0.7592581", "text": "def open_graphs\n @open_graphs = {} unless defined? @open_graphs\n @open_graphs\n end", "title": "" } ]
[ { "docid": "8ca715457b12cd7e98fdd7e788cb6f5f", "score": "0.655588", "text": "def graphs\n @graphs ||= begin\n graphs = []\n graphs << {data: data, format: RDF::Format.for(data_file.to_s).to_sym} if data_file\n graphs + graphData.map do |g|\n {\n data: RDF::U...
31286d02aa3b0f3399e04b2a2647713c
Exercise 34 Movies 3
[ { "docid": "375117dd02d85efe8cc2c5adf72cd6bf", "score": "0.0", "text": "def is_movie_available_3(name, time)\n movie_timings = {\n \"Thor\" => [100, 400, 600, 1200, 1400, 1830],\n \"Captain America\" => [400, 845, 1115, 1430, 1940, 2130, 2300],\n \"Hulk\" => [ 1200, 1500, 1830, 2200],\n \"I...
[ { "docid": "1d7e1b2562a6ff259d4abdb272abd37b", "score": "0.5985899", "text": "def movie; end", "title": "" }, { "docid": "c4e60ad30c8a991c7d1fa4aefbab3252", "score": "0.5925857", "text": "def print_movies(films)\n # some iteration magic and puts out the movies in a nice list\n film...
ba98ad32e4d0e87722f8602db1ca1430
[Rugged::Diff] a rugged diff object Not fully tested
[ { "docid": "084d15de2754a990f99027876b1090fd", "score": "0.0", "text": "def apply_diff(diff)\n diff.deltas.each do |d|\n case d.status\n when :deleted\n remove_file(d.new_file[:path])\n File.delete(File.join(path, path))\n when :added, :mod...
[ { "docid": "9c91d2c9618cee228f4dee079db0818d", "score": "0.70584047", "text": "def diff2; end", "title": "" }, { "docid": "ecf4c75c47701d64fddd6c286d489be3", "score": "0.68392044", "text": "def diff1; end", "title": "" }, { "docid": "225efd0e9b1ad21398d12886cbdd6d69", ...
3bbfe1ac6a4f0c796908686a5b901f4e
Resets the number of checks used to zero
[ { "docid": "0aaa9ef735548f9b3fd111d908a6d77e", "score": "0.85307336", "text": "def reset_checks\n @@check_no = 1\n end", "title": "" } ]
[ { "docid": "d21345a3d1bc4a20d8e390091cce6f6a", "score": "0.9018508", "text": "def reset_checks\n @num_of_checks_used = 0\n end", "title": "" }, { "docid": "1e75091f4363bab71772db51acec9143", "score": "0.8972941", "text": "def reset_checks\n @count = 0\n end", "tit...
00825b6e51dee5865601e85dfe788fc0
To support moving the default zoom point while following something
[ { "docid": "929d9bbbe2c4edc150f27683a1ff501a", "score": "0.0", "text": "def follow_x\n @last_follow[0]\n end", "title": "" } ]
[ { "docid": "508be175d6f02518446045c3bbfe7641", "score": "0.6973853", "text": "def zoom\n end", "title": "" }, { "docid": "a6d2d5522850208cddf7b936b23b96cf", "score": "0.6862786", "text": "def update_zoom\n @effectus_old_zoom_x = @picture.zoom_x\n @effectus_old_zoom_y = @pictur...
cce48c18fe784f4e8daca6bd3bc02833
queries for the +Host+ instance associated with the given +SyncProcess+.
[ { "docid": "99d919a37b111df325c6c7694beaf750", "score": "0.6695691", "text": "def host_for(sync)\n HostRepository.find(sync.host_id)\n end", "title": "" } ]
[ { "docid": "be929b4ff1605190ea81bb3f5ca681d3", "score": "0.6041144", "text": "def find(host)\n @results.find {|r| r.host == host}\n end", "title": "" }, { "docid": "c42bd7f8f21977a47c9a49f380ed0c8e", "score": "0.6003407", "text": "def get_host_result(host)\n host =...
e54c6808d2faacc1fe6f56a144080a75
POST /leavemanagements POST /leavemanagements.json
[ { "docid": "d060ff7b86bc1ec3c81c4eae95bc206b", "score": "0.0", "text": "def create\r\n apply_leave_type_id = params[:leavemanagement][:leave_type]\r\n leave_balance_instance = Leavebalance.find_by_user_id_and_leave_type_id(current_user.id,apply_leave_type_id)\r\n apply_leave_type_instance = Le...
[ { "docid": "0711dbcd712092a39a31105736dc23b8", "score": "0.64328194", "text": "def create_allele(a)\n allele_data = request(\n :url => \"alleles.json\",\n :method => \"post\",\n :payload => { :allele => a }.to_json\n )\n allele = JSON.parse(allele_data)[\"allele\"]\n return allele\nend...
ffb878e3cad5c48c924f4569936efbb8
GET /tasks GET /tasks.json
[ { "docid": "523c013fe2bce36d748d1350f3138161", "score": "0.0", "text": "def index\n @tasks = Task.all(:conditions => ['sprint_id IS NULL AND backlogged = ?', false])\n @sprints = Sprint.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @...
[ { "docid": "b98d6e0f037b424760a46e9092d2ff7c", "score": "0.79923254", "text": "def my_tasks(params = {})\n get('my/tasks', params)\n end", "title": "" }, { "docid": "88cbd84bae17a5c5274ceb1f679ab64f", "score": "0.78909755", "text": "def get(params = {})\n response = cl...
cfc5bf7fe0c03646f7e535485a47bc34
Generate a security_group resource definition for AWS infrastructure.
[ { "docid": "038f312331957fff8f521d492193341e", "score": "0.79409003", "text": "def vpc_security_group_resource\n group_name = \"#{@configuration_id}-vpc-security-group\"\n tags_block = tags_partial(@configuration_tags)\n <<-SECURITY_GROUP\n resource \"aws_security_group\" \"security_group_vp...
[ { "docid": "b1d99189f62c5d484fa95c21a3d3f533", "score": "0.75463015", "text": "def create_security_group\n\t\t\t## EC2 create_security_group\n\t\t\tec2.create_security_group('sumo', 'Sumo')\n\t\t\t## EC2 authorize_security_group\n\t\t\tec2.authorize_security_group_IP_ingress(\"sumo\", 22, 22,'tcp','0.0....
34c349551174750387335df82535f10d
Download a file into a string. Returns the file's data and character set in an array. TODO: add option to fail silently or throw and exception on a 404 ++
[ { "docid": "dc9095817d265d56958d4de82d286971", "score": "0.0", "text": "def read_remote_file(uri) # :nodoc:\n if @redirect_count.nil?\n @redirect_count = 0\n else\n @redirect_count += 1\n end\n\n unless circular_reference_check(uri.to_s)\n @redirect_count = nil\n...
[ { "docid": "cc30e38bac49a44052bd55cf7bf5f5a0", "score": "0.6728603", "text": "def download_file(options)\n get(\"string/download\", options)\n end", "title": "" }, { "docid": "01331d0d1088657b16160f64bc79d53a", "score": "0.6641473", "text": "def file_to_string(path)\n file =...
a9ce86ba9759b5d899688a5dfb5ed650
Returns the compiled content from a given representation and a given snapshot. This is a convenience method that makes fetching compiled content easier.
[ { "docid": "148237c4538f8b3d42b5bacf95e03617", "score": "0.61871105", "text": "def compiled_content(params={})\n # Get rep\n rep_name = params.fetch(:rep, :default)\n rep = self.reps.find { |r| r.name == rep_name }\n if rep.nil?\n raise Nanoc::Errors::Generic,\n \"No ...
[ { "docid": "d3c92eef1be90995de858c76a7a88b96", "score": "0.6292235", "text": "def compiled_content(params = {})\n rep_for_params!(params).compiled_content(params)\n end", "title": "" }, { "docid": "3e120fcc3f91759cdd5612d007d95709", "score": "0.55507064", "text": "def content...
99ac6f97133a0f7b866f4a3c38a660fd
given a sorted array of words, it displays the top :limit words in the console as an histogram
[ { "docid": "0d7a87df0f4f8cbf4b8d5d69bb729538", "score": "0.8289554", "text": "def histogram(words, limit)\n puts \"[ Histogram: Top #{limit} words ]\"\n \n # loops to get the lenght of the longest word for left padding\n # UnicodeUtils adds some complexity but ensures that the chars are disp...
[ { "docid": "c76c2cb327a9982818c33f38296ce190", "score": "0.7740409", "text": "def display(words, limit)\n puts \"[ Top #{limit} words ]\"\n for i in 0...limit\n puts \"#{words[i][:word]} (#{words[i][:count]})\"\n end\n end", "title": "" }, { "docid": "2d17b5db654b11fa088379560...
57a08b7d16341fee1000cff3f8c60e96
create a canvas item without creating a TkcItem object
[ { "docid": "223fab1bb54e451ea2f8eebaad53e086", "score": "0.0", "text": "def create(type, *args)\n type.create(self, *args)\n end", "title": "" } ]
[ { "docid": "3c839a197c22ea1904e63ac0d703e864", "score": "0.6210001", "text": "def set_canvas_item\n @canvas_item = CanvasItem.find(params[:id])\n end", "title": "" }, { "docid": "5773e5e2476ce7c2400c337f42c12e1e", "score": "0.6138558", "text": "def create_item(index)\n ite...
9c8daf3817444fc7590a96907a2c52ee
Removes the channel from the server.
[ { "docid": "dca3791ffab7fa087d58738fb012e07f", "score": "0.7273978", "text": "def remove_channel(channel_name)\r\n @channels.delete(channel_name.downcase)\r\n end", "title": "" } ]
[ { "docid": "8f921ef27cde25665c1788b2cd519652", "score": "0.74175566", "text": "def remove_channel( channel )\n @channel_map.delete channel.local_id\n end", "title": "" }, { "docid": "8c664bde65e9d4ed5abb78fce63c9241", "score": "0.7130574", "text": "def delete_channel(...
2ed53dfd81fdc52a1c5426ba7fccb186
Chef uses platform, aliased for conveneince
[ { "docid": "3713fc3f2af8709ff2b1417af2656dc2", "score": "0.0", "text": "def pack_clouds_dot_rb_and_expected_directories\n %w(lib plugins).each do |dir|\n if File.directory?(d = cloud.clouds_dot_rb_dir/dir)\n dputs(\"Adding local path: #{d}\")\n FileUtils.cp_r d, clo...
[ { "docid": "32d28cce86357f9e1f1b767587e67fc6", "score": "0.7303316", "text": "def host_os; end", "title": "" }, { "docid": "32d28cce86357f9e1f1b767587e67fc6", "score": "0.7303316", "text": "def host_os; end", "title": "" }, { "docid": "4fcdc58478af83e36d5fd6ee9ab29049", ...
6c94afb3341845c015b8e53575b5165d
GuardDuty supports only one detector resource per AWS account per region (as of February 2018).
[ { "docid": "164ab2885d02b8612abb6378a8956410", "score": "0.500126", "text": "def get_detectors(aws)\n\n next_token = \"start\"\n max_results = 1\n detector_ids = []\n\n while next_token != '' && next_token != nil\n if next_token == \"start\"\n resp = aws.guard_duty.list_detectors({ max_re...
[ { "docid": "5ae95374b9476619c1f236225508a7e4", "score": "0.54442614", "text": "def region\n if ENV.include?('REGION')\n ENV['REGION']\n else\n 'us-west-2'\n end\nend", "title": "" }, { "docid": "17b1d9491c940c7245509e198e0cee74", "score": "0.5362399", "text": "def region\n ...
80a5317d2989ad50c50853def6e44a3e
Is the author present?
[ { "docid": "999da7974095c73a13dd567109f30ff7", "score": "0.8335221", "text": "def author?\n !author.nil? && !author.empty?\n end", "title": "" } ]
[ { "docid": "3e1a9b36ae2a6e07713dfb5eab318cf6", "score": "0.81692773", "text": "def has_author?(author)\n ret = false\n @authors.each{ |auth| ret = true if auth == author }\n ret\n end", "title": "" }, { "docid": "bbd26ff2a2afab4db95104ad66ce679a", "score": "0.7856355", ...
22239948ea960f5e5b3605b5c44ef65b
returns if this registration is inactive
[ { "docid": "94d8c5b7a49b7404b19b881f89d95770", "score": "0.8464808", "text": "def inactive?\n self.registration_type == 'inactive'\n end", "title": "" } ]
[ { "docid": "d763a13146912ee5b32e4b651f610650", "score": "0.8082889", "text": "def inactive?\n not active?\n end", "title": "" }, { "docid": "cb545aa96508b68c5da242bc07a73c75", "score": "0.8043665", "text": "def inactive?\n status == 'inactive'\n end", "title":...
6f2a07007756a9fc3775a3e8b47ab602
Empty to allow navigation to that url
[ { "docid": "0e6fcc7c5328292277854e2d2fddea56", "score": "0.0", "text": "def about\n \n end", "title": "" } ]
[ { "docid": "dcb9c3bf0cf869020b69b14a684f538b", "score": "0.66504264", "text": "def redirects_to_page\n nil\n end", "title": "" }, { "docid": "2de4b0e1bb8212c3911d7729c5cc2b83", "score": "0.65660113", "text": "def redirect_url\n nil\n end", "title": "" }, { "do...
ad4a60620ee6680ef75e1c9581c22593
list simply returns a list of all jobs in the job table
[ { "docid": "c8dbe0a929fcd5be1cc0f9126519662c", "score": "0.7458838", "text": "def list options = {}, &block\n options.to_options!\n Bj.transaction(options) do\n options.delete :rails_env\n table.job.all(options)\n end\n end", "title": "" } ]
[ { "docid": "7ea204df75750b8e39e56e00a6ee16f3", "score": "0.77407527", "text": "def all_jobs\n\n find_jobs()\n end", "title": "" }, { "docid": "69e78bc7262864b0558626664a199d25", "score": "0.76807797", "text": "def index\n @jobs = Job.all\n end", "title": "" }, ...
10b6eee01cb02bd97633f3af1a183f92
Closes the current connection.
[ { "docid": "7ec26698b5a76a140a1e24f0f97c3429", "score": "0.0", "text": "def disconnect!\n @adapter.disconnect! if connected?\n end", "title": "" } ]
[ { "docid": "776ee5a7c18e2a60ef65c97d5e542a5e", "score": "0.7836872", "text": "def close_connection\n @connection.finish if connected?\n end", "title": "" }, { "docid": "d5321599981db72bd7a7daad7fc8a78d", "score": "0.78153914", "text": "def close\n @connection.close\n ...
1bc5c05a7ce1a6d5cac304176b9714fe
===== START Gomisa ======
[ { "docid": "cff1eb63b93ebe8845a8ccce74d95263", "score": "0.0", "text": "def accumulated_amounts\n @accumulated_amounts ||= adjustments.where.not(reason: 'Order').sum(:amount)\n end", "title": "" } ]
[ { "docid": "399a618fd04286682bd3721f0e44cffc", "score": "0.728647", "text": "def start\n # TODO\n end", "title": "" }, { "docid": "6c02f1cabf0a12e8795afbae111e3db9", "score": "0.72534174", "text": "def start\n\t\tend", "title": "" }, { "docid": "6c02f1cabf0a12e879...
0362f64d103f0b89a1e25a1becdf27ea
Command that checks for whether or not a process specified by an option exists. An exit code is returned accord to the LSB Init Script Actions. TODO: provide better error messages based on LSB.
[ { "docid": "afb9e9ad2b655c22cab6f69c6a4ae720", "score": "0.0", "text": "def status\n @commands_and_opts.unshift COMMANDS[:status]\n include_multiple_commands?\n self\n end", "title": "" } ]
[ { "docid": "f39ee0801e3069df71c7531d7a471138", "score": "0.643749", "text": "def check(exec, name, url, install=nil)\n return unless `which #{exec}`.empty?\n \n puts \"#{name} not found. (#{url})\"\n puts \"\\nInstall via:\\n#{install}\" if install\n\n exit(1)\nend", "title": "" }, { "d...
d2ab71789c4173b0f348090990dfa81a
Creates a Switch instance and tests a connection. Checks as well if the switch is virtual fabric enabled since that defines the way it will be queried further.
[ { "docid": "4d4e30ee830b7581eb1337b564284191", "score": "0.0", "text": "def initialize(*params)\n super(*params)\n @configuration={}\n vf\n end", "title": "" } ]
[ { "docid": "ebc0d34b625ee4e5e88f6bfbc9a760f0", "score": "0.593318", "text": "def switch_supported?(switch)\n true\n end", "title": "" }, { "docid": "0343df2386a405fb27fb868c4ee686af", "score": "0.5842652", "text": "def is_switch?\n return (self.type == Host::TYPE_SWITC...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "6bb2ac1098ef23720106f26b82488659", "score": "0.0", "text": "def customermaster_params\n params.require(:customermaster).permit(:customername, :customeraddress, :customerfax, :customerphone, :customeremail, :customertin, :customercst,:companyname,:username,:year)\n end", "title": ...
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.69802505", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6781974", "text": "def strong_params\n params.requ...
077878f3f0d58aec6da4fb3506da985c
Parse bounce messages from Verizon
[ { "docid": "5a096d3e05565f7c794d264261688bcc", "score": "0.61386985", "text": "def scan(mhead, mbody)\n match = -1\n while true\n # Check the value of \"From\" header\n # :'subject' => %r/Undeliverable Message/,\n break unless mhead['received'].any? { |a| a.inclu...
[ { "docid": "38ad417caaa9aa6b8287b6cc6be6a3c6", "score": "0.6772485", "text": "def parse(&block) \n address=nil\n mesage=nil\n bounces=0\n @bounce_io.each do |line|\n break if line =~ /^--- Below this line is a copy of the message\\./\n if line =~ /^<(\\S+)>:/\n ...
e0d8130d55cbf623f6d618419b96c797
Env values from hash.
[ { "docid": "7d82f322dba125b1b6ad59d38c2c62fd", "score": "0.68016416", "text": "def env_values\n @parse[@env] || @parse[@env.to_s] || {}\n end", "title": "" } ]
[ { "docid": "f08589ed2143ff7ef6b5e135aa9b031d", "score": "0.6286791", "text": "def set_from_env\n ENV_TO_KEY.each do |env_key, key|\n next unless (value = ENV[env_key])\n\n type, key = key if key.is_a? Array\n\n value =\n case type\n when :int then value.to_i\n...
0e0ceac78ea875f56a2115e835a20644
A function to return the transmission node identifier loss factor value for a given date
[ { "docid": "228272e1d2997576f4622984dee5c09b", "score": "0.0", "text": "def tni_values(start = Time.now, finish = Time.now)\n if @tni.nil?\n raise 'No TNI set, ensure that you have set the value either via the '\\\n 'update_from_msats! function or manually'\n end\n rai...
[ { "docid": "83bfa0270734a8c27af086384d18200a", "score": "0.50137925", "text": "def input_of_loss\n if node.demand\n node.demand - node.inputs.reject(&:loss?).map(&:external_value).compact.sum\n else\n 0.0\n end\n end", "title": "" }, { "docid": "62...
64ee4c04f5bcf008ed63f1a9f10aafd3
POST /instituciones POST /instituciones.json
[ { "docid": "16c3545d34d759e820951058aceebf53", "score": "0.7188672", "text": "def create\n @institucion = Institucion.new(institucion_params)\n\n respond_to do |format|\n if @institucion.save\n format.html { redirect_to @institucion, notice: 'Institucion was successfully created.' }\n ...
[ { "docid": "91974a016322ec76a81ba74d0ea5811b", "score": "0.74293303", "text": "def create\n @instalacion = Instalacion.new(params[:instalacion])\n\n respond_to do |format|\n if @instalacion.save\n format.html { redirect_to @instalacion, notice: 'Instalacion was successfully created.' }...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "4a2505d0925274856d7ff5749def3929", "score": "0.0", "text": "def inquiry_params\n params.require(:inquiry).permit(:answer, :remark)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.69792545", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6781151", "text": "def strong_params\n params.requ...
67bf63ba9dd64e133ea3befc153f1a9a
get max id of the tweets
[ { "docid": "e31a5d8b918f37ef8d35f7ec60de08c2", "score": "0.8846436", "text": "def get_max_id(tweets)\n\t\tids = []\n\t\ttweets.each{|tweet|\n\t\t\tids.push(tweet['id'])\n\t\t}\n\t\treturn ids.max\n\tend", "title": "" } ]
[ { "docid": "e96c413ce4adb0c8f0528afa4ff1bfa5", "score": "0.790282", "text": "def set_new_max_tweet_id(tweets)\n new_max_id = tweets.map(&:id).max || 0 # zero in case no new records returned\n query.max_tweet_id = [query.max_tweet_id, new_max_id].max\n query.save\n end", "title": "" }, ...
50502a705ec41168d8a43d85ae23372a
Liked solution, not necessarily a top one or best practice
[ { "docid": "6a7efc1092c5a16edfa763981e25f4ef", "score": "0.0", "text": "def format_duration(seconds)\n *init, last = [3600 * 24 * 365, 3600 * 24, 3600, 60, 1]\n .collect {|x| div, seconds = seconds.divmod(x); div}\n .reverse\n .zip([\" second\", \" minute\",...
[ { "docid": "bc658f9936671408e02baa884ac86390", "score": "0.61847883", "text": "def anchored; end", "title": "" }, { "docid": "b6b2bcc0062aeb115edab7b10cbe6930", "score": "0.61206025", "text": "def desired; end", "title": "" }, { "docid": "acf5ce6a07b808bf365c956951b27d19"...
bc8ce05542f1ad35358698ff3f904f74
Takes an Array or String as `emails` and appends `email_to_add` (String) to it
[ { "docid": "69576932e5de7a0b181b9d82e9cd0aa9", "score": "0.88981885", "text": "def add_to_email_list(emails = \"\", email_to_add = \"\")\n if emails.class == String\n emails << \", #{email_to_add}\"\n elsif emails.class == Array\n emails << email_to_add\n end\n emails\n end", ...
[ { "docid": "55a6f11112d338a7795769cebd7825a4", "score": "0.7877527", "text": "def add_email(e)\n emails << e\n end", "title": "" }, { "docid": "5d0e4d8d5e699996307d6b6e2403f9e0", "score": "0.75255793", "text": "def add_email_addresses!(list_of_email_addresses)\n email_ad...
f50c3e4c33a537025b9f3cfe24119bd7
DELETE /translate_tasks/1 DELETE /translate_tasks/1.json
[ { "docid": "4ccbdd56f8599f916e3a4e6585d5202e", "score": "0.7605091", "text": "def destroy\n @translate_task.destroy\n respond_to do |format|\n format.html { redirect_to translate_tasks_url, notice: 'Translate task was successfully destroyed.' }\n format.json { head :no_content }\n end...
[ { "docid": "b5cc662b21476b17211126958a507826", "score": "0.7127955", "text": "def destroy\n @tasks_translation = TasksTranslation.find(params[:id])\n @tasks_translation.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_tasks_translations_url) }\n format.xml { head ...
92dcccdbe8c59a323958510eebde92aa
Get the count of IFD entries (Read and convert 2 bytes)
[ { "docid": "bfd87358e42f632bee95a21226cd6729", "score": "0.6426387", "text": "def expected_entries?\n expected_size = @io.read(2)\n expected_entries = expected_size.convert(@packspec, 3).first\n vputs \"Expected %d IFD entries\" % expected_entries\n return expected_entries\n end",...
[ { "docid": "0e4dedf9e2335db5bf747bb2980e1e96", "score": "0.69995356", "text": "def count_entries(io)\n read_eocds(io)\n @size\n end", "title": "" }, { "docid": "86c8ec92dcdcea9adcb16d5a257cfc8a", "score": "0.65530324", "text": "def record_count\n @record_count ||=...
9a0261fb07879e8aee2f8203d2c1fe33
Evaluate oneline Ruby statements embedded in a template.
[ { "docid": "5e94da0c5e093abe84ad91f0419a83a1", "score": "0.0", "text": "def gsub_yield line, t, dtype, line_number=nil, filename=nil\n match = line.match YIELD_REGEX\n while !match.nil?\n\n statement = match[0][4...-2]\n result = self.send :eval, statement, binding, filename...
[ { "docid": "caf4bb03fe048733af84c4cb0aeb1187", "score": "0.68898606", "text": "def evaluate_erb; end", "title": "" }, { "docid": "b765a4e50a320960c22200bf8f9490a9", "score": "0.6819774", "text": "def evaluate_template(template_name,bind)\n template_dir = File.expand_path('./scripts'...
4a01d213697a28aab329504c049d5cf5
Test 2: New blog education and family group
[ { "docid": "2810c240d44f8cecce8d8e9bda29408e", "score": "0.7061601", "text": "def test02_BlogEducationFamily\n\t\tloginGroup\n\t\t\n\t\tsleep 5\n\n\t\t$blog_group.fire_event(\"onclick\")\n\t\t$group_name.set(\"Education/Family Group #{random}\")\n\t\t$group_nickname.set(\"Nickname #{random}\")\n\t\t$gro...
[ { "docid": "f1d6107e30e0df871dda6556d7e186e8", "score": "0.67277586", "text": "def test03_BlogEducation_TC_24398\n\t\tloginGroup\n\t\t\n\t\tsleep 5\n\n\t\t$blog_group.fire_event(\"onclick\")\n\t\t$group_name.set(\"Education Group #{random}\")\n\t\t$group_nickname.set(\"Nickname #{random}\")\n\t\t$group_...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "bdc1895f717394ff3c8698a5cc5cf493", "score": "0.0", "text": "def conversation_user_params\n params.require(:conversation_user).permit(:conversation_id, :user_id, :is_admin, :is_muted)\n end", "title": "" } ]
[ { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.7122899", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "b32229655ba2c32ebe754084ef912a1a", "score": "0.7054107", "text": "def expected_permitted_parameter_names; end", "title": ""...
2071243ad22c256bfe5082956d6ba0cf
True is the diagnoser is stopped.
[ { "docid": "26aaa14e78a3d97b73e8fa2e261b1ee7", "score": "0.6941168", "text": "def stopped?\n @stopped\n end", "title": "" } ]
[ { "docid": "0a2b584d99272a0687306c6e6c167b0f", "score": "0.72426885", "text": "def stopped?\n\t\tself.stop_flag\n\tend", "title": "" }, { "docid": "86a41899437cc71fc89c524e8647c08d", "score": "0.7242315", "text": "def stopped?\n self.stop_flag\n end", "title": "" }, { ...
0d03e81f87553258f17e52320003d34a
Validates target folder for moving nodes.
[ { "docid": "19c5ebee1cb470519dbf86559b8fa9cd", "score": "0.72931457", "text": "def validate_target_folder!(target_folder)\n return unless target_folder\n\n raise Error, \"You're not allowed to move to an HTTPS folder.\" if target_folder.https?\n\n return if target_folder.editable_by?(context)\n...
[ { "docid": "5984f576fe7d6afd8494937ff4d9500e", "score": "0.6174525", "text": "def check_directories\n if File.exist?(source_dir)\n @source_dir = source_dir\n else\n raise DirectoryNotExist, \"Directory not exist\" \n end\n if File.exist?(destination_dir)\n @destination_dir ...
f260b0743e3635ff851ba1fb8f391b00
GET /users/1 GET /users/1.json
[ { "docid": "91a44fe02533867f1294eb8f6ac571a7", "score": "0.0", "text": "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\nend", "title": "" } ]
[ { "docid": "4152fb6556ae83f7cdd6c362f17ad9bf", "score": "0.81046426", "text": "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n ...
4c1474b088e2e56a0358799f73076674
Creates a new instance of an explosivve based on the given XML data
[ { "docid": "3b1e5adb0a42a5b08d6e1207ea8120a9", "score": "0.0", "text": "def initialize(weapon_name, weapon_data)\n super weapon_data\n\n @id = weapon_name\n @shots = weapon_data['thrown'].to_i\n end", "title": "" } ]
[ { "docid": "bb6851b78b418ad548d059af7d496457", "score": "0.601795", "text": "def from_xml(data)\n xml = XML::Node.from(data)\n raise 'invalid XML' unless xml.name == ox_tag\n \n returning new do |ox|\n (ox_attrs + ox_elems).each {|e| ox.send(e.setter,e.from_xml(xml))}\n ...
f96b4053ef4cef8d625b365225f7d91a
word is 1 or more letters, no more than 20 one or more spaces all sentences terminated by a point read from first letter through to, including, the points output: words separated by single space, last word terminated by single point odd words copied in reverse, even words kept the same bonus: read/print characters one ...
[ { "docid": "b3c9282a9396e8bbd068fb71155a32b5", "score": "0.6616207", "text": "def oddify(string)\n words = string.split(/[ .]+/)\n\n words.map.with_index do |word, idx|\n idx.odd? ? word.reverse : word\n end.join(' ') << '.'\nend", "title": "" } ]
[ { "docid": "20c3b9ba7ce3d6fd86a33c92413e32b7", "score": "0.75413036", "text": "def alternate_words(sentence)\n words = []\n words_edit = []\n alternate_words = []\n words = sentence.split\n i = 0\n words.each {|z|\n if z.include? \"-\"\n extra_words = z.split(\"--\") if z.include? \"--\"\n...
311536b988db35e9c835ec7947226e97
DELETE /reservations/1 DELETE /reservations/1.json
[ { "docid": "4e73c4a0184cb0bd7f6b254273f84684", "score": "0.0", "text": "def destroy\n @reservation = Reservation.find(params[:id])\n @reservation.destroy\n flash[:notice] = 'Reservation was successfully cancelled.'\n Notifier.cancellation_email(current_user).deliver\n respond_to do |forma...
[ { "docid": "5b44006ec627fc74171f7b8cc5f8a557", "score": "0.775116", "text": "def destroy\n @reservation = restaurant.reservations.find(params[:id])\n @reservation.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n ...
7893db9a905d130cce251c1b769f149e
Returns the filename for the image for this item
[ { "docid": "5b17b7d83301e207a3660b8a5fa27a94", "score": "0.0", "text": "def filename(extension)\n \"#{id}_#{gender}.#{extension}\"\n end", "title": "" } ]
[ { "docid": "d3929eb5f6437a4958d0256be7ecaf0a", "score": "0.80485606", "text": "def image_filename\n if @ammo\n return @ammo.image_filename\n end\n return @blueprint.image_filename\n end", "title": "" }, { "docid": "8039465393da853bd2717dcd11bcbc7a", "score": "0.7993897", ...
0062719d614b374ee5fcf04620b77a56
Return a Hash of fields to add to the current event derived from the given +object+.
[ { "docid": "e8fc2e625107016d8709aa3e5b62672c", "score": "0.66469556", "text": "def fields_from_object( object )\n\t\tcase object\n\t\twhen ::Exception\n\t\t\treturn self.fields_from_exception( object )\n\t\telse\n\t\t\tif object.respond_to?( :to_h )\n\t\t\t\treturn object.to_h\n\t\t\telse\n\t\t\t\traise...
[ { "docid": "c9535d13c738277c75dae20cfda0dfeb", "score": "0.67739326", "text": "def object_fields\n EventField\n end", "title": "" }, { "docid": "75cfafaaa0cbb4dee4cc829f2f0365dc", "score": "0.63728786", "text": "def add( object=nil, **fields )\n\t\tself.log.debug \"Adding...
403d82d9b30a62fef55ee9f45d30de13
GET /sketch_histories GET /sketch_histories.json
[ { "docid": "c1f3bae40c1a90def05e1e81bfe71aae", "score": "0.7776381", "text": "def index\n @sketch_histories = SketchHistory.all\n end", "title": "" } ]
[ { "docid": "9a6be4f06edf5579a1bfa5e6d060804b", "score": "0.666937", "text": "def index\n @histories = History.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @histories }\n end\n end", "title": "" }, { "docid": "02f87d7b7de277cb6...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "b2e6b2ce9c051efe9fe338874d784582", "score": "0.0", "text": "def set_item\n @item = Item.find(params[:id])\nend", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "d...
44d148d760b4b55f07b5848c123ff92b
== count Returns number of appearances for a given stat
[ { "docid": "4b288629aadac0b46e9a7033a9a7f05c", "score": "0.76427597", "text": "def count stat_type, stat_name\n send(stat_type)[stat_name].size\n end", "title": "" } ]
[ { "docid": "cb2d1bc9a961afbcf53a3612cc0a37fc", "score": "0.77398944", "text": "def count(stat, count, opts={})\n send_stats stat, count, :c, opts\n end", "title": "" }, { "docid": "4b1d4551dc00c39c9b41fea03176a7a5", "score": "0.76292557", "text": "def count\n @stats.length\n...
f3990017e89615adf573a2a01b775c78
PATCH/PUT /farmer_products/1 PATCH/PUT /farmer_products/1.json
[ { "docid": "3530e51f9a541a8a627f72741916d02b", "score": "0.6820793", "text": "def update\n respond_to do |format|\n if @farmer_product.update(farmer_product_params)\n format.html { redirect_to @farmer_product, notice: 'Farmer product was successfully updated.' }\n format.json { ren...
[ { "docid": "fa2eeaa45445dd76141374dc13ffab6d", "score": "0.7113834", "text": "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", "title": "" }, { ...
ef01b460212dec84a4b2f28d18c02e87
method UI4 Connect2 BSTR conn_str [IN]
[ { "docid": "b29e3775f32287f075bb3e5c146d2a95", "score": "0.8856225", "text": "def Connect2(conn_str)\n _invoke(18, [conn_str], [VT_BSTR])\n end", "title": "" } ]
[ { "docid": "22b6169019ba786e4bcf9dc44d2db921", "score": "0.88672197", "text": "def Connect2(conn_str)\n @ole._invoke(18, [conn_str], [VT_BSTR])\n end", "title": "" }, { "docid": "472c8ef865afc3312d8de151dee4d60a", "score": "0.6438797", "text": "def connect\n puts_log \"con...
066675d4dedb4f6f6bebce652b9d552f
Execute the Choreo using the specified InputSet as parameters, wait for the Choreo to complete and return a ResultSet containing the execution results.
[ { "docid": "a7e7140a85c9061c763d894507b15a0b", "score": "0.0", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetCompanyByEINResultSet.new(resp)\n return results\n end", "title": "" } ]
[ { "docid": "c4ca32683e8ce75eb6a187d63df8fa77", "score": "0.76639634", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = DoneResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "6f7a7d9be674ad4cf17d6743eb1f7836", "scor...