query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
15c6a11abe76773a84f620499bebd88e
Moves `entity` in position from which it can attack `enemy`.
[ { "docid": "1c5f1e8cf7826eefdb64856d040c8f45", "score": "0.51188564", "text": "def go_on_offensive(act, entity, session, enemy)\n to = find_place_near enemy, entity, session\n wanted_attack = entity.interactions[best_attack(entity, session)]\n is_end = offensive_stop_solver en...
[ { "docid": "5dff50a6e7d240eb4d7a2d14a73f0627", "score": "0.63361764", "text": "def move(entity, direction)\n entity.move(direction) if entity\n end", "title": "" }, { "docid": "fe74438632843c054c57b5c749bdfde4", "score": "0.63073844", "text": "def move_entity entity; end", ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "6d8f670a17a284aab349018ae12524ef", "score": "0.0", "text": "def inspectionitem_params\n params.require(:inspectionitem).permit(:number, :name, :amountofmone, :subsidy, :remarks, :hospitalflg, :deleteflg)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whit...
b6cb46fda799daf144b5068fa036a1ec
invokes method/function function with 2 parameters.
[ { "docid": "1e96d92843acf1b7c17e97593594b325", "score": "0.0", "text": "def say_hello name1 = \"plain\", name2 = \"Jane\", name3\n unless (name1 == \"plain\" && name2 == \"Jane\")\n puts \"hello #{name1}, #{name2}, and #{name3}\"\n end\n if (name1 == \"plain\" && name2 == \"Jane\")\n puts \"hel...
[ { "docid": "ddec2670365616b980b12ff718299d06", "score": "0.73227316", "text": "def invoke(*args); end", "title": "" }, { "docid": "ddec2670365616b980b12ff718299d06", "score": "0.73227316", "text": "def invoke(*args); end", "title": "" }, { "docid": "08f38dee44f8b0521ef550...
73cafa3dfcd90ca4e465186591f353df
the e will return an exit code
[ { "docid": "87b5731ee0935cd2c53f53a2248557f9", "score": "0.0", "text": "def jq_command(input_json, jq_expression)\n IO.popen(['jq', jq_expression, '-e'], 'r+', {:err=>[:child, :out]}) do |pipe|\n pipe << input_json\n pipe.close_write\n pipe.readlines.join\n end\n end", "title":...
[ { "docid": "9585aa714e1f38e8abf9d048a41dd543", "score": "0.8085202", "text": "def exit_code; end", "title": "" }, { "docid": "9585aa714e1f38e8abf9d048a41dd543", "score": "0.8085202", "text": "def exit_code; end", "title": "" }, { "docid": "072bf5c68c868173e32e4886634e0f9d...
9fa1b2998a00e76185fd97e6d9b62346
Retrieves a P4DepotFile object, given a depot or local file and a revision specifier. Returns nil if the file isn't found or was deleted (at the given revision).
[ { "docid": "5825f4cdc5736bb49024e12391acd3d4", "score": "0.66416115", "text": "def find_file(user_id, password, depot_or_client_file, revision = 'head')\n revision ||= 'head' # Handles explicit nils\n run_authenticated(user_id, password) do\n p4_fstat_results = @@p4.run_fstat(\"#{depot_or_cli...
[ { "docid": "84d04d5356022f2223a77f9c272e3438", "score": "0.64865136", "text": "def get_file(file, revision)\n raise NotImplementedError.new(\"get_file() must be implemented by subclasses of AbstractLocalRepository.\")\n end", "title": "" }, { "docid": "a45b682d52d9b2efaa5f47a...
5439fdb8fad830d9e1f81d574e4a1d62
DELETE /carrier_clients/1 DELETE /carrier_clients/1.json
[ { "docid": "0f44d3cad4c021c14d7f0748bdf3d887", "score": "0.78057235", "text": "def destroy\n @carrier_client.destroy\n respond_to do |format|\n format.html { redirect_to carrier_clients_url, notice: 'Carrier client was successfully destroyed.' }\n format.json { head :no_content }\n en...
[ { "docid": "7ac9616f9a7353d9bd6e82f364aa4943", "score": "0.7871975", "text": "def delete_mobile_carrier(args = {}) \n delete(\"/mobile.json/#{args[:carrierId]}\", args)\nend", "title": "" }, { "docid": "7ac9616f9a7353d9bd6e82f364aa4943", "score": "0.7871975", "text": "def delete_mobi...
32a9f7994b37db8bb93f87e19f8e9686
DELETE /lenders/1 DELETE /lenders/1.json
[ { "docid": "b89d720f4d032ff3a3cc011a6371db3c", "score": "0.0", "text": "def destroy\n respond_with(@lender)\n end", "title": "" } ]
[ { "docid": "6d71312a7a1d7948db84ffcccdc79336", "score": "0.7387639", "text": "def destroy\n @lender = Lender.find(params[:id])\n @lender.destroy\n\n respond_to do |format|\n format.html { redirect_to lenders_url }\n format.json { head :ok }\n end\n end", "title": "" }, { ...
64106d680188235c6b84530e654cf32f
Sensor status table entry
[ { "docid": "75238ca5c8dab857dd6aef352327046b", "score": "0.6959374", "text": "def sen_status(row,column); det.table(:index, 10)[row][column]; end", "title": "" } ]
[ { "docid": "b86bc6eb9a04ba506df932ae6babe6a9", "score": "0.71337426", "text": "def status(row,param); det.table(:index, 9)[row][param]; end", "title": "" }, { "docid": "32323b7ac84108419579112567c3de2e", "score": "0.70471406", "text": "def get_sensor_statuses\n response = ...
cb4ffdad32f3b6547cd15e06891b96eb
THE METHOD ALL PERMUTATIONS
[ { "docid": "0f947bf47634011d930383ec839a550f", "score": "0.0", "text": "def permutations(arrays, i)\n if i == arrays.length then return [[]] end\n\n res_next = permutations(arrays, i + 1)\n res = []\n arrays[i].each do |x|\n res_next.each do |y|\n res << ([x] + y)\n end\n end\n retur...
[ { "docid": "e33ec662f14cdf703163f6c5ebd7ad9b", "score": "0.58584106", "text": "def permute!() options.permute!(self) end", "title": "" }, { "docid": "b3d42c25be0b1e51d0dc65f856b6cf69", "score": "0.5849599", "text": "def permut(lensmb, itrav, n, iopt)\n (1..n).to_a.each do |i|\n ...
8e87cdf56af604b933da24cc39d351f5
Initializes a new SearchResults object
[ { "docid": "df432755dc1ed62fdc30cf9ded5f3449", "score": "0.0", "text": "def initialize(attrs={})\n @attrs = attrs\n @collection = Array(@attrs[:statuses]).map do |tweet|\n Twitter::Tweet.new(tweet)\n end\n end", "title": "" } ]
[ { "docid": "66778e9cc99edf13514e39981c1d16d6", "score": "0.85734266", "text": "def initialize(search_results)\n @search_results = search_results\n end", "title": "" }, { "docid": "f4aa4ecf8ef6ad6b132d7584581d1d28", "score": "0.7493319", "text": "def initialize(search_data)\n ...
4d1cb43c7a17e5a7c3c5d27fc439024c
=begin :type steps: Integer :rtype: String =end
[ { "docid": "2e349ebc5b9949be948f3556e6594255", "score": "0.0", "text": "def back(steps)\n steps.times do\n break if @back_history.empty?\n url = @back_history.pop\n @forward_history.push(url)\n end\n @current = if @back_history.tail\n @back_history.tail.obj\n ...
[ { "docid": "c63549593b8d3daafa2f14eb1558a0e9", "score": "0.7086839", "text": "def steps_walked\n \"You have walked \" + @steps_walked.to_s + \" steps\"\n end", "title": "" }, { "docid": "a73edc786c86f38dbc6ebb315d93b4c2", "score": "0.6971779", "text": "def steps(steps)\n @...
8e3cabe254ce14cca491346a94b41648
Returns HOPS request success message
[ { "docid": "d0bb5bd037b2ab1f8d8d49e6180415a8", "score": "0.67801046", "text": "def hops_success_message\n $tracer.trace(__method__)\n\treturn ToolTag.new(section.id(create_ats_regex_string(\"submit_success\")), __method__, self)\n end", "title": "" } ]
[ { "docid": "99cc7e3d7d98c12cfa68b9370bea1a29", "score": "0.6808659", "text": "def success\n [200, { 'Content-Type' => 'text/plain'}, ['OK']]\n end", "title": "" }, { "docid": "17cec83382948461ba2c4583f569ff99", "score": "0.658404", "text": "def status\n head :ok\n end", "...
c49cd7145571e2add0d482434b4b3151
PUT /storehouses/1 PUT /storehouses/1.json
[ { "docid": "14e56ae0f5591f9ad1ec7284f7d78307", "score": "0.7046152", "text": "def update\n @storehouse = Storehouse.find(params[:id])\n\n respond_to do |format|\n if @storehouse.update_attributes(params[:storehouse])\n format.html { redirect_to storehouses_url, notice: 'Storehouse was ...
[ { "docid": "76cfb1365a493dd3cd19696b997b94bf", "score": "0.69510764", "text": "def update\n @store_house = StoreHouse.find(params[:id])\n\n respond_to do |format|\n if @store_house.update_attributes(params[:store_house])\n format.html { redirect_to store_houses_url, notice: 'Store hous...
713078d5c6d15850d77f171b528abe94
CHALLENGE: Your task is to write a function which returns the sum of following series upto nth term(parameter). Series: 1 + 1/4 + 1/7 + 1/10 + 1/13 + 1/16 +... Rules: You need to round the answer to 2 decimal places and return it as String. If the given value is 0 then it should return 0.00 You will only be given Natur...
[ { "docid": "5491ad47218644eb2410ee05bff6e201", "score": "0.7750996", "text": "def series_sum(n)\n denominator = 1\n total = 0\n n.times do\n total += (1 / denominator)\n denominator += 3.0\n end\n \"#{format(\"%.2f\",total)}\"\nend", "title": "" } ]
[ { "docid": "d30421d7698a4be55406f38efdcf5cf2", "score": "0.79671735", "text": "def series_sum(n)\n return \"0.00\" if n == 0\n answer = (1..n).to_a.map.with_index { |num, index| ( 1 / (1 + (3 * index.to_f))) }.inject(:+).round(2).to_s\n answer.length == 3 ? answer + \"0\" : answer\nend", "title":...
106f40973ef0a598e029f9bfacbf1525
PART 3 Helpers help for displaying the path arrays neater
[ { "docid": "7092e935ffafee7641fce146999f21ca", "score": "0.71266097", "text": "def dispath(path)\n\t\tprint \"[ \"\n\t\tpath.each { |z|\n\t\t\tprint z[0], \" \"\n\t\t}\n\t\tprint \"]\\n\"\n\tend", "title": "" } ]
[ { "docid": "3becb4a270c71112c942c395e74f9ca3", "score": "0.7206449", "text": "def print_paths\n paths(find_all_paths).map do |path|\n path.join(\", \")\n p path\n end\n end", "title": "" }, { "docid": "baa047640e93b21f347de37aa8c2a38d", "score": "0.71001226", "text":...
506e5de3c93022cedca646508846418a
returns the extension of image_src without the preceeding '.'
[ { "docid": "7c1d3e7ecd571fd8370b31d75e99e59b", "score": "0.88904715", "text": "def extname\n File.extname(image_src).delete('.') unless image_src.nil?\n end", "title": "" } ]
[ { "docid": "dbe46fa4e00a3c62852bebe31e083fe6", "score": "0.79423714", "text": "def extname\n return nil unless src\n\n File.extname url.path\n end", "title": "" }, { "docid": "53967f70672ec3021a8bc7dc1c229f3d", "score": "0.7607499", "text": "def ext_of(filename)\n filenam...
c3e8796c19a3c3f8869041db0ff19f93
Set an environment value. +key+ is translated to an unfriendly environment name as in Configlet[] above.
[ { "docid": "d595f012dfcc7bfeeb5fd4b408541d17", "score": "0.7939281", "text": "def []= key, value\n ENV[envify(key)] = value\n end", "title": "" } ]
[ { "docid": "7239e24d94deb1528a11c28a8cf95155", "score": "0.79578525", "text": "def setenv(key, value)\n @setenv ||= {}\n @setenv[key] = value\n end", "title": "" }, { "docid": "f42e7d74fc17b9f4f278e5259bf2f4be", "score": "0.78337353", "text": "def env(key, value)\n...
4deb0bb663b53bd419346fe3617c12bb
GET /device_categories/1 GET /device_categories/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "4ee7bda9df0b5c0cc8c1a04a4254f8d5", "score": "0.74584526", "text": "def index\n @devices = Device.where(:category_id => @current_user.category.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @devices }\n end\n end", "title": "...
2cceb9844e6954e63e5a97b20be7a4fc
Pull stats for an Album for a given Month and Year
[ { "docid": "ac2d9b98c46bc32c2d20e9c26efe598a", "score": "0.72860956", "text": "def stats( options =nil )\n json = web_method_call( \n { \n :method => 'smugmug.albums.getStats',\n :album_id => album_id,\n :month => Date.today.month,\n :year => Date.today.year\...
[ { "docid": "8c9a2ff5f494d74a87b1ad447836a0eb", "score": "0.7492984", "text": "def stats( options =nil )\n today = Date.today\n params = {\n :month => today.month,\n :year => today.year,\n }\n params.merge! options if options\n json = request 'albums.getStats', params, :AlbumID =...
8c7460cd4a8dde3f0bf2bb182744455c
These create and unset the fields required for remembering users between browser closes
[ { "docid": "e7e87c58dcfeaca65cc86d657a7e02cd", "score": "0.0", "text": "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "title": "" } ]
[ { "docid": "380889bc42b384abf9421d713cda3bd8", "score": "0.652659", "text": "def forget\n update_attribute(:remember_hash, nil)\n end", "title": "" }, { "docid": "99c6ad2dd87d267a5422f37316488ab3", "score": "0.63953704", "text": "def forget\n update_attribute(:remember_diges...
a4a02b09cc47b25d34f7f209e8de2b9e
return app with appname
[ { "docid": "c5c1171f900e8954a0d9f167b1718f38", "score": "0.6941775", "text": "def app(id_or_name_or_package_id)\n all_available_apps.find do |app|\n [app.name, app.id, app.package_id].include?(id_or_name_or_package_id)\n end\n end", "title": "" } ]
[ { "docid": "f4b4a791e11acf8fa566a6316965fd33", "score": "0.7902913", "text": "def app_with_name name\n AX::Application.new name\n end", "title": "" }, { "docid": "147450f9c87a430e32ae9131dc8053dc", "score": "0.7886404", "text": "def appname\n fetch(:appname) || script_name\n ...
3f96db8fbed3607702f84f0728fd195a
% nlink : () > Fixnum
[ { "docid": "5b800c1149cd486fd3fe53cec3451731", "score": "0.73424864", "text": "def nlink() end", "title": "" } ]
[ { "docid": "be085170e1f8fbbf98a477b9942fb9c6", "score": "0.6174578", "text": "def number_node(n, num)\n n.branch_length = num\n # n.cumulative_branch_length == nil ? n.cumulative_branch_length = num : n.cumulative_branch_length = (n.cumulative_branch_length + num)\n end", "title": "" }, ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "1b765b19a5f16a56be40c95ddd3b5fb6", "score": "0.0", "text": "def admin_person_params\n params[:person]\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...
5ee6c56ab5d9f632d6a09a620137257b
DELETE /trips/1 DELETE /trips/1.json
[ { "docid": "aa45325474b7ba83bdf46a4327d20c79", "score": "0.6732516", "text": "def destroy\n @trip = Trip.find(params[:trip])\n if current_user.trips.include?(@trip)\n @trip.destroy\n render json: {message: \"usunięto tripa\"}\n else\n @trip.errors.add(:permissions, 'brak uprawnie...
[ { "docid": "d9807b47a2c7914868d33da05163973f", "score": "0.74131525", "text": "def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to find_trips_url }\n format.json { head :no_content }\n end\n end", "title": "" },...
be6da26c4686a7ce9741c5a12fe2f48e
Returns a boolean indicating the value has a position attribute.
[ { "docid": "3af8a5c0fb5e223f0817097431a02e8f", "score": "0.7488394", "text": "def positionable?(value)\n value.respond_to?(:position) &&\n value.position.is_a?(Vedeu::Geometries::Position)\n end", "title": "" } ]
[ { "docid": "a6f9f2c7cbba983579fc6f6cb327f659", "score": "0.75462836", "text": "def position?\n position.is_a?(Vedeu::Geometries::Position)\n end", "title": "" }, { "docid": "f1c7c5aa0e70edfc2ba3b946f6d54b86", "score": "0.74710065", "text": "def position?\n @position[...
544d28a5ffc880dcd7d34fd6b206c5bf
Get an authentication token for interacting with Secret Server. These are only good for about 10 minutes so just get a new one each time. Will raise an error if there is an issue with the authentication.
[ { "docid": "fac0efa6e67cc830a8fc0e2efb22aefb", "score": "0.7119862", "text": "def get_token\n response = @@client.call(:authenticate, message: { username: @@username, password: @@password, organization: '', domain: @@domain })\n .hash[:envelope][:body][:authenticate_response][:authe...
[ { "docid": "2f8e50f9a0d07c980dc93783a916ee6d", "score": "0.7285137", "text": "def new_auth_token()\n query = { action: 'authToken', apikey: @apikey, secretkey: @secretkey }\n res = HTTParty.get(@endpoint, query: query)\n parse_response(res).fetch(\"authToken\")\n end", "title": "" }, {...
ac3fe515d4ca84783fd58e85e105fb82
Special quick sort. It's crucial that the input is shuffled, it reduce my run time from 1994ms to 56ms. Example: k = 3, nums = [5, 4, 1, 1, 4, 3, 5, 7] three way partition, v = 5 [5, 4, 1, 1, 4, 3, 5, 7] | | | lt i gt 45, swap(gt,i), then gt [4, 1, 1, 4, 3, 5, 5, 7] | | | lt gt i i > gt, break, return [5, 6] this is th...
[ { "docid": "7fb07b6a39b5cd180d726344178a7a18", "score": "0.0", "text": "def find_kth_largest(nums, k)\n nums.shuffle!\n helper(nums, 0, nums.length-1, k)\nend", "title": "" } ]
[ { "docid": "38ba8116a8604e3cee578f6f321e5261", "score": "0.7830619", "text": "def partial_quick_sort(arr, i, j, k)\n if i < j\n index_pivot = rand(i..j)\n pivot = arr[index_pivot]\n arr.delete_at(index_pivot)\n left, right = arr[i..j].partition { |e| e.size > pivot.size }\n arr[i..j] = l...
bb9d8d4048391febca662241da63453a
DELETE /transaction_groups/1 DELETE /transaction_groups/1.xml
[ { "docid": "c7e7c8309f8d5a9615c338ee56efc054", "score": "0.7666315", "text": "def destroy\n @transaction_group = TransactionGroup.find(params[:id])\n @transaction_group.destroy\n\n respond_to do |format|\n format.html { redirect_to(transaction_groups_url) }\n format.xml { head :ok }\...
[ { "docid": "2cd6dbd3d8dfc6a97f28e5aa64b7226f", "score": "0.71761096", "text": "def test_set3_04b_delete_group()\n group = \"test_group\"\n user = \"test_user\"\n \n @test_acl.create_principal(user)\n @test_acl.create_group(group, [\"ALL\"], [user])\n \n query = \"doc(\\\"#{@col_path...
fca1867728554742f6b9c3a4e283457d
Return true if any posts in this pool have a generated JPEG version.
[ { "docid": "5c6a130a6bb5322333250b59326103e7", "score": "0.7388561", "text": "def has_jpeg_zip?(_options = {})\n pool_posts.each do |pool_post|\n post = pool_post.post\n return true if post.has_jpeg?\n end\n false\n end", "title": "" } ]
[ { "docid": "39ffedf5d33b67dc812fc5c5b0e850ee", "score": "0.64920366", "text": "def images?\n images.any?\n end", "title": "" }, { "docid": "137f494a16ef6bea53df5b3af5f4a259", "score": "0.6428982", "text": "def has_image?\r\n !images.empty?\r\n end", "title": "" }, { ...
33853528c48cd9326de1d1fce56d961e
Returns true if this is a Yahoo! login.
[ { "docid": "90a54c0cf759eb643d0d8e6a30c051a8", "score": "0.7318535", "text": "def yahoo?\n provider_name == 'Yahoo!'\n end", "title": "" } ]
[ { "docid": "9f7c172f20a2cf3d308d0aac33943d44", "score": "0.66018075", "text": "def twitter_user?\n return true if is_logged_in? && (session[:request_token] && session[:request_token_secret] && session[:twitter_id])\n end", "title": "" }, { "docid": "b798e130c0ede0b1d2dba423d9751176", ...
2ec8eca1a9bae0550fc53d77da70cbd7
Generate some lorem ipsum text to use in tweets and fake users names. This method caches the word list so it's not generated each time. Random sequences of words can be generated like this: words.shuffle.take(2).join(' ') => 'magna sed' Returns an Array of Strings.
[ { "docid": "b87cb1e90511736ea028dd47f7c06c48", "score": "0.6191289", "text": "def words\n @words ||= %q{\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque\n faucibus tellus eu magna venenatis eu scelerisque sapien ultrices. Morbi\n viverra, arcu vel lobortis susci...
[ { "docid": "e29d6ae13d98481765ef0028296e7d58", "score": "0.7344249", "text": "def getWords()\n out = ''\n num_of_words = rand(3)\n (0..num_of_words).each do\n out += @words.sample.strip + ' '\n end\n return out\n end", "title": "" }, { "docid"...
8fdc7d8bd17e956d6a09715b0018d072
Belongs to relationships manually set via object gets until DM 10. is implemented
[ { "docid": "5383cfbb6fb1bce3c81ed5d13b376214", "score": "0.0", "text": "def created_by; User.get(self.created_by_id); end", "title": "" } ]
[ { "docid": "b28d7fca085505837d9c18877a9dd8f5", "score": "0.7062554", "text": "def model_relationships; end", "title": "" }, { "docid": "c229df37684da68ba5756d2237cb4b06", "score": "0.68754727", "text": "def setup_associations; end", "title": "" }, { "docid": "d32d40da3b89...
f5ef959af1bfb070f00651c88556e463
GET /sans GET /sans.json
[ { "docid": "b77c08cda67682fd6f4927150b31028b", "score": "0.0", "text": "def index\n @san = San.first\n end", "title": "" } ]
[ { "docid": "f2a99b07b1a3c1906d7d5b8003e77e59", "score": "0.5992174", "text": "def show\n @su = Sus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @su }\n end\n end", "title": "" }, { "docid": "8c76b36a3a7f9a4a2f151d...
7088f142ab301a64dadd569ab9f7a686
def Method: on_delete Removes a privilege for the given tool/privilege/object set. If the privilege is successfully removed, an object will be sent with a `status` property of "OK" and a `list` property containing the new assignee list (just as if a `GET` request were made for a specific "tool/privilege"). A `Permissio...
[ { "docid": "d9985e432e24e23a899cabed93ceb839", "score": "0.78297836", "text": "def on_delete(path)\n return unless self.user_is_administrator?\n handler = PermissionRequestHandler.from_path(path)\n unless handler.nil?\n if handler.handle_delete\n response = I3::SharedObjec...
[ { "docid": "abccebae158e1a0ff89b908f2c482264", "score": "0.71754324", "text": "def handle_delete\n perm = I3::Permission.find(:first, :conditions => [\n \"tool = ? AND privilege = ? AND group_dn = ?\",\n self.tool, self.privilege, self.identifier\n ])\n perm.destroy unless p...
95078a2b851076bd2e768cdecf547fff
repaint only one row since content of that row has changed. No recreate of pad is done.
[ { "docid": "1bd29f56c993200091447e8f10c648dd", "score": "0.57286775", "text": "def fire_row_changed ix\n return if ix >= @list.length\n clear_row @pad, ix\n # allow documents to reparse that line\n fire_handler :ROW_CHANGED, ix\n _arr = _getarray\n render @pad, ix, _arr[ix]...
[ { "docid": "80cc97baef0965e93804276d767ca71b", "score": "0.6568613", "text": "def repaint\n r,c = rowcol\n $log.debug(\"widget repaint : r:#{r} c:#{c} col:#{@color_pair}\" )\n value = getvalue_for_paint\n len = self.width || value.length\n acolor = @color_pair \n @graphic.printstring r...
18227537e7f1ea966e1952f8c06bf354
Make a new selection including current selection and their ancestors. Returns a Selection instance.
[ { "docid": "5a2fe442025eaf4988e79654c3af7a07", "score": "0.6229494", "text": "def add_ancestors\n new_selection = selected_node_ids.reduce(Set.new) do |s, id|\n s | with_ancestors(id)\n end\n\n self.class.new(\n nodes_by_id: nodes_by_id,\n selected_node_ids: new_selection\n )\...
[ { "docid": "c862b0cdcac873cc9ed316a073ee6065", "score": "0.5260089", "text": "def new_selection\n Monty::Core::RuleSelection.new(:rule => self)\n end", "title": "" }, { "docid": "82a95f762b1add231d20cdf4d3184426", "score": "0.50875014", "text": "def expand_selection(idx)\...
ecef5bee28a33cd19d4079301cf7a36c
Snippet 12 Recursion Fibonacci 3
[ { "docid": "f15961a41fad762a05ac8a5cfe736557", "score": "0.0", "text": "def fibonacci3(num)\n array = [0,1]\n def inner(num,array)\n array += [array[-1] + array[-2]]\n if array[-1] < num\n array = inner(num,array)\n end\n return array\n end\n array = in...
[ { "docid": "a2a549d75bd6cfd4f0657c521bfbde11", "score": "0.81247205", "text": "def nthFibonacci(n)\r\n if n == 1\r\n return 1\r\n\r\n elsif n == 2\r\n return 1\r\n\r\n else n > 2\r\n n = nthFibonacci(n-1) + nthFibonacci(n-2)\r\n end\r\nend", "title": "" }, { "docid": "7165b198f0...
e941411b8ed7e63cbedb7a379714a016
The `other` target matches if at least one of the subtargets matches it.
[ { "docid": "34b1239175c52c1728d5e7b5ed0fa122", "score": "0.6388317", "text": "def match?(other)\n @children.any? { |child| child.match?(other) || other.match?(child) }\n end", "title": "" } ]
[ { "docid": "ac026032e01b9e2ecae3dd9ea45f667a", "score": "0.6368844", "text": "def match?(target)\n super(target)\n end", "title": "" }, { "docid": "db5ebdde08d508148316eadbc2b7c7ee", "score": "0.6185397", "text": "def same_target?(other)\n\t\tother.selector == @selector\n...
a7420d4ce64fce6aca10cb5ae2eda97a
TODO: Temporary method to apply correct validation rules when creating v2 move
[ { "docid": "6d4512d2c62432e3342fe1e8d512cf22", "score": "0.0", "text": "def v2?\n version == 2\n end", "title": "" } ]
[ { "docid": "bc4378b5d41878fc8e13a1d6684f9df8", "score": "0.71779025", "text": "def validate_move(move) \n move_from_file = @data[\"moves\"][move]\n move_from_file ? valid = true : valid = false\n end", "title": "" }, { "docid": "86a20d6eeaeae9abee56437a3e3e9a8f...
a4f7ae3283936e83e41920ee8a49db1b
Checks equality by comparing each attribute.
[ { "docid": "28eb9fffaf0f69c2645085ae0177b20f", "score": "0.0", "text": "def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n adwords_grouping == o.adwords_grouping &&\n adwords_label1 == o.adwords_label1 &&\n adwords_label2 == o.adwords_label2 &&\n ...
[ { "docid": "569a6e70e3c41ee6dd68d73238c5128c", "score": "0.7291717", "text": "def ==(other)\n attributes == other.attributes\n end", "title": "" }, { "docid": "ce5eeaf80566e4180cb68653bb351220", "score": "0.7188103", "text": "def ==(other) # :nodoc:\n @attrs == other.att...
714fcacdd4f4a1678958b9d60c62a11c
I worked on this challenge [by myself]. 2. Review the simple assert statement
[ { "docid": "ca0df44d8b905e0fd44c1e24ba84312c", "score": "0.0", "text": "def assert\n raise \"Assertion failed!\" unless yield\nend", "title": "" } ]
[ { "docid": "0e27ed76988a692adb5cdf7709fe4144", "score": "0.7217738", "text": "def test_case_7\n assert false\n end", "title": "" }, { "docid": "3fcc75a227c5cd0de58359677e7bc992", "score": "0.72084135", "text": "def test_case_6\n assert false\n end", "title": "" }, {...
a75081b96d8c67fa1e20bb203e87ab4f
Hook into the rails error rendering page to send this exception to CrashLog before rails handlers take over.
[ { "docid": "b0116494f28017a64754a6c9cc3aaa4f", "score": "0.7890366", "text": "def render_exception_with_crash_log(env, exception)\n controller = env['action_controller.instance']\n\n env['crash_log.error_id'] = CrashLog.notify(exception) #,\n ...
[ { "docid": "9ee4002055e1ca294960dc9f7d829221", "score": "0.7755456", "text": "def render_exception_with_crash_log(env, exception)\n begin\n controller = env['action_controller.instance']\n CrashLog.notify_or_ignore(exception, crash_log_context(controller, env))\n\n ...
7e292edab522ad9def389704608fbc6d
Returns the distance to `key` in unit, or MM if size of unit is given
[ { "docid": "0675a07dfbc60360e925a500baa7cf40", "score": "0.71575654", "text": "def distance_to(key)\n p1 = {\n x: (row_offset.to_f*unit_width)+((width(as: :mm))/2),\n y: (row.number.to_f*unit_height)-((height(as: :mm))/2)+(height(as: :mm))\n }\n\n p2 = {\n x: (key.row...
[ { "docid": "47d17ed790d2b63183f90686c0e4ca94", "score": "0.6353107", "text": "def get_unit(key)\n round_to(super, @nearest)\n end", "title": "" }, { "docid": "ebd9c3dc3bc5f6746703f172d05d2678", "score": "0.62713134", "text": "def get_distance_unit\n\t\t@kilometers\n\tend", "t...
81cb2747695aa93cc49431028902900a
The str parameter will be composed of + and = symbols wih several letters between them (ie ++d+===+c++==a) and for the string to be true each letter must be surrounded by a + symbol.
[ { "docid": "b13f0215d3b23cdbe60873a3186bae4f", "score": "0.7609378", "text": "def SimpleSymbols(str)\n\n #1. surround the string by ='s\n #2. begin looping\n #3. look for letters\n #4. check if letters surround by a + on both sides\n #5. return false if they aren't\n #6. end loop\n #7. return tru...
[ { "docid": "3c5a8ab7a0fb79661d8a296d75e01c8e", "score": "0.7062428", "text": "def SimpleSymbols(str)\n if str =~ /[a-zA-Z]/ && str != \"\"\n \ti = 1\n \twhile i < str.length\n \t if str[i-1] != \"+\" || str[i + 1] != \"+\"\n \t \treturn false\n else\n \t \treturn true \n \t end\n \t i ...
27c757f39ef382ae5ccc1f4f9497578a
p pair_product([4, 2, 5, 8], 16) true p pair_product([8, 1, 9, 3], 8) true p pair_product([3, 4], 12) true p pair_product([3, 4, 6, 2, 5], 12) true p pair_product([4, 2, 5, 7], 16) false p pair_product([8, 4, 9, 3], 8) false p pair_product([3], 12) false
[ { "docid": "f6261e26ff12776e511cdcae91959927", "score": "0.0", "text": "def rampant_repeats(str, hash)\n n_str = ''\n str.each_char do |char|\n if hash.has_key?(char) \n n_str += char * hash[char]\n else\n n_str += char\n end\n end\n n_str\nend", ...
[ { "docid": "b4fa91faf0bfbd81ff777cef4050cddd", "score": "0.86494833", "text": "def pair_product(nums, product)\n nums.combination(2) {|pair| return true if pair[0] * pair[1] == product}\n return false\nend", "title": "" }, { "docid": "1ea5f4856a4d0bf4e5b92eadca7a27e3", "score": "0....
546ed7edade1842a6a43b64417f0aef4
First page of the collection ?
[ { "docid": "37fddff4bc707ca80950ddf3da8ab5b8", "score": "0.69774336", "text": "def first_page?\n current_page == 1\n end", "title": "" } ]
[ { "docid": "5efa22535599ad15fb483ce43649a79a", "score": "0.8489538", "text": "def first_page\n previous_page? ? updated_collection(from: from, page: { number: 1 }) : self\n end", "title": "" }, { "docid": "e1155c740467c7e69de83c58ea3bf88c", "score": "0.8121368", "text": "def ...
889deceb1a98984fc59c04ae3793dec6
Copy model like: 'monster' or 'admin/monster'
[ { "docid": "3f12de8a2cae34431d091534a8ecfdae", "score": "0.59915835", "text": "def copy_model(relative_model_path)\n model_path = File.expand_path(\"../../dummy_activerecord/app/models/#{relative_model_path}.rb\", __FILE__)\n if (path_ary = relative_model_path.split('/')) && path_ary.size > 1\n ...
[ { "docid": "30965416138e8bf4eb4812ccd4776c6b", "score": "0.59526944", "text": "def copy(src, dest)\n # Define list of attributes excluded from the copy\n excluded_attrs = %w[\n lock_version created_at updated_at id pub_reference_number conference_id\n linkedto_type linkedto_id parent_id ...
a228914b95b92d417f24cadbfa04526d
Will mark a page as updated curl X POST curl X POST
[ { "docid": "2856bd29db1105eb5e23b287abddd1a2", "score": "0.5411956", "text": "def publish\n @page.publish\n respond_with(@page, location: published_api_pages_url)\n end", "title": "" } ]
[ { "docid": "08bcab35cff7d5b5cced08aeb45e22ed", "score": "0.5761821", "text": "def test_update_page\n file = Configuration.TEST_PAGE\n file2 = Configuration.OTHER_TEST_PAGE\n \n # This test depends on a succesfull login\n if test_correct_login\n token = make_login Configuration.USER, ...
9d9c992bc81d27d0f31134cf6518990e
sumDigits 10 Returns 1 sumDigits 99 Returns 18 sumDigits 32 Returns 5 Let's assume that all numbers in the input will be integer values.
[ { "docid": "5beb3d8641ea2c2783dc2da42bd82876", "score": "0.7064899", "text": "def sumDigits(number)\n number.to_s.chars.map(&:to_i).reduce { |accum, n| accum.abs + n.abs }\nend", "title": "" } ]
[ { "docid": "c63b38ed8a7c252caa202c9db687ca28", "score": "0.7871349", "text": "def digit_sum(num, digits)\n if digits == 1\n num\n else\n num % 10 + digit_sum(num / 10, digits - 1)\n end\nend", "title": "" }, { "docid": "406ed41ffd9ccbd36e3e9cd09f6495e3", "score": "0.78142273", ...
6e8a50785a704bdf0f6849101fcc20e0
Returns a description of how to use this plugin
[ { "docid": "cded39d0c8fb69e9416f302d2fc1702d", "score": "0.0", "text": "def usage\n [\n \"#{at_nick} mahlzeit - #{nick} fragt wer zu Mittag fahren will\",\n \"#{at_nick} stats - #{nick} sendet dir deine Statistik\",\n \"#{at_nick} ich - #{nick} fuegt dich zur Liste hinzu\",\n ]\n e...
[ { "docid": "8b983ca82d1d73ef235245989c33209f", "score": "0.73201376", "text": "def description\n \"Derelict::Plugin::Manager for #{instance.description}\"\n end", "title": "" }, { "docid": "5ec7e42fbc76891a68a5b81af05c864f", "score": "0.72512347", "text": "def get_help\n ...
a61cd785182bba9bbc11aad847f3d08d
GET /personal_histories/1 GET /personal_histories/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "e2042af2ae0d368a9599288e0fc74b56", "score": "0.7507129", "text": "def index\n @personal_histories = PersonalHistory.all\n end", "title": "" }, { "docid": "d320ff5ed7bc3e289517669037e5a63e", "score": "0.7311776", "text": "def index\n @personal_histories = @patient.p...
7b414ec72665545c2242fee29ca50c2c
GET /albums GET /albums.xml
[ { "docid": "d905217751e5e1a3b750e77997793431", "score": "0.0", "text": "def index\n\n\t\tif signed_in?\n\t\t\t@albums = Album.all(:order => 'created_at DESC')\n\t\telse\n\t\t\tredirect_to root_path\n\t\tend\n\tend", "title": "" } ]
[ { "docid": "6d694206211b3e653a872a98df8d32e1", "score": "0.7585608", "text": "def index\n @albums = @page.albums.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @albums }\n end\n end", "title": "" }, { "docid": "a6a13dcf...
09646e54d18b1c84c782106ea4ced0b1
Begins sequence to repackage this box.
[ { "docid": "8324c00866f7e362be32fb89eb2af80f", "score": "0.679017", "text": "def repackage(options=nil)\n env.actions.run(:box_repackage, { \"box\" => self, \"validate\" => false }.merge(options || {}))\n end", "title": "" } ]
[ { "docid": "259c5c99e472a1ba1ed084c0243ddbd8", "score": "0.6096453", "text": "def repackage(path)\n @logger.debug(\"Repackaging box '#{@name}' to: #{path}\")\n\n path.open(Util::Platform.tar_file_options) do |f|\n Archive::Tar::Minitar::Output.open(f) do |output|\n # Store the ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "6b758d7652f2f3b166ac2567e626c843", "score": "0.0", "text": "def bought_movie_params\n params.require(:bought_movie).permit(:id, :title, :poster_url)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74939764", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6955084", "text": "def strong_params\n params.require(:request).permit(param_whit...
b8aca0ecc85d6210ada1c236cbf1305e
Permet de debiter un compte bancaire et de crediter son compte PMQ
[ { "docid": "2cb610430b9257c6bd09ddc6222c5a3b", "score": "0.0", "text": "def debitBankAccount\n\n end", "title": "" } ]
[ { "docid": "9b9c93911c91ee45a80eeb6f5aafb761", "score": "0.6004225", "text": "def paiementDeCommandes(paiement)\n # Premierement appliquer a une commande du meme montant\n self.commandes.each do |c|\n if c.due == paiement.montant\n c.withPaiement(paiement)\n return\n end\n ...
fcbb0410999d2605bc0fe43b1c0b1621
Using ruby sort methods
[ { "docid": "b02944c82609ee04e62376d8630f6274", "score": "0.0", "text": "def permutation?(str1, str2)\n\treturn str1.chars.sort == str2.chars.sort\nend", "title": "" } ]
[ { "docid": "b0b212c1d5230a9b8d9562c050ef7d4f", "score": "0.8224531", "text": "def sort!\n # no op\n end", "title": "" }, { "docid": "df8ebbc1c591323cd85c50328186462e", "score": "0.81710476", "text": "def sort_array", "title": "" }, { "docid": "2363161df98d...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "b55bb0bcca931a39440a4c6a998be283", "score": "0.0", "text": "def set_order\n @order = Order.find(params[: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...
9f1615d619a5d6e08511b2eef227d1be
GET /user_modifieds/1 GET /user_modifieds/1.json
[ { "docid": "68477cb7f12b430f01c071992383fefe", "score": "0.0", "text": "def show\n render 'show', layout: 'homeEmpresa'\n end", "title": "" } ]
[ { "docid": "c00a57b834144c8e4e8e83925239cc4a", "score": "0.66325146", "text": "def set_user_modified\n @user_modified = UserModified.find(params[:id])\n end", "title": "" }, { "docid": "62e484e379fc2f12f33c6ce6fc4fffa4", "score": "0.6623882", "text": "def update\n respond_...
dcd1478742307ff1a22a58090f6b6d53
Problem Write a method that takes a nonempty string argument returns the middle character or characters of the argument If the argument has odd length, return exactly one character. If the argument has Examples / Test Cases center_of('I love ruby') == 'e' center_of('Launch School') == ' ' center_of('Launch') == 'un' ce...
[ { "docid": "14ed0bfdef32de5f685cccf2fe23d720", "score": "0.8252746", "text": "def center_of(string)\n center_index = string.size / 2\n if string.size.odd?\n string[center_index]\n else\n string[center_index -1, 2]\n end\nend", "title": "" } ]
[ { "docid": "58c922cfe213a6929ead445e8e7570ca", "score": "0.8594276", "text": "def center_of(string)\n middle_char = ''\n if string.length.odd?\n middle_char = string[string.length / 2] \n elsif string.length.even?\n middle_char = string[(string.length / 2) - 1, 2] \n end\n middle_char\nend", ...
4f41cb45795308e2b51e5517223219bf
Public: Creates a new board and saves it to the database. If any exceptions are thrown the database is cleaned up before returning. player The Player that wants to start the game. rawBoard A board represented by a 2D array, whose contents are ships. Returns the Integer game id.
[ { "docid": "0e65282d1372ba8c87a07336519f7ed3", "score": "0.6850465", "text": "def start(player, rawBoard)\n raise ArgumentError, \"Incorrect state #{self.state}\" unless self.state.nil?\n my_board = boards.create!(player_id: player.id)\n begin\n my_board.add_locations rawBoard\n # The...
[ { "docid": "e4eac0abf19b0d3f13d0b417bedcfc71", "score": "0.6523764", "text": "def create\n # boardレコードの新規作成\n if find_board_by_user().nil?\n user = User.find_by(id: session[:user_id])\n Board.create!(my_hash: generate_hash(), user_id: user.id, draw_data: 'None')\n logger.debug(\"Cre...
53bf81cf286cf9a88c0a84932b1dd96c
quick check to see if a single file is still in the study's bucket can use cached list of bucket files, or check bucket directly
[ { "docid": "557da566bedb31fec7109325c64d6b7f", "score": "0.0", "text": "def verify_remote_file(remotes:, file_location:)\n remotes.any? ? remotes.detect {|remote| remote.name == file_location} : ApplicationController.firecloud_client.execute_gcloud_method(:get_workspace_file, 0, self.bucket_id, file_...
[ { "docid": "13c1791c50aa523b45610d0363ae4b5c", "score": "0.6968688", "text": "def file_exists?(bucket_name:, key:)\n !!get_bucket!(bucket_name).file(key)\n end", "title": "" }, { "docid": "da3e4e0aa2ad504c86cf042f54a17b5b", "score": "0.6772949", "text": "def checkFile(bucket,...
e753407fd9d85e32018e160cd8f9e138
DELETE /labtech_timeslips/1 DELETE /labtech_timeslips/1.json
[ { "docid": "2aeda59a1e6b5054a7b3281c10061649", "score": "0.7556057", "text": "def destroy\n @labtech_timeslip.destroy\n respond_to do |format|\n format.html { redirect_to labtech_timeslips_url, notice: 'Labtech timeslip was successfully destroyed.' }\n format.json { head :no_content }\n ...
[ { "docid": "2354381e4a2e24991aa26d78a7b8a711", "score": "0.6866529", "text": "def destroy\n @treq = Treq.find(params[:id])\n @treq.destroy\n\n respond_to do |format|\n format.html { redirect_to treqs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { ...
28944a6f143f1660dd4a4932d061ccdf
destroys the session by getting rid of the user id
[ { "docid": "f732c496b375d92389263ae1c4849cd6", "score": "0.0", "text": "def destroy\n if current_user\n session.delete(:user_id)\n flash[:success] = 'See ya!'\n end\n redirect_to signup_path\n end", "title": "" } ]
[ { "docid": "50d1fcc19616a985324a3dd4d0b0aaef", "score": "0.8803827", "text": "def destroy\n @session[:user_id] = nil\n @current_user = nil\n end", "title": "" }, { "docid": "592ac58e6f3b1b042e8da6b8fd933b77", "score": "0.87433887", "text": "def destroy_session(user)\n s...
3bae4458516c3f454da7288d02e6ef41
public tests against the pr number passed by parameter
[ { "docid": "a609f095bd7ab25788bb949869ad63b2", "score": "0.616696", "text": "def triggered_by_pr_number?\n return false if @pr_number.nil?\n\n # Note that the test will only run if it pass the checks on unreviewed_new_pr\n pr_on_number = @client.pull_request(@repo, @pr_number)\n puts \"Got t...
[ { "docid": "8fb7c7ce1637d2d4e32fb6a96b7ba1d2", "score": "0.6394215", "text": "def valid_products_number()\n \n end", "title": "" }, { "docid": "ee07cdc2f9567acb65682f1c69c1fad2", "score": "0.62265575", "text": "def test_primo\n assert(Primos.primo?(11), \"11 es numero primo\")...
74e3d41c7e4c44c6b12e225b1424c8ea
(5b) Return an array of bays for an array of items and the distance apart from furthest bays
[ { "docid": "445f5f9765bb791594c4742df2194a5c", "score": "0.77097", "text": "def find_multiple_bays_and_distance(hash,item_array)\n\n #Step 1 - get the list of bays for the items\n bays = find_multiple_bays(hash,item_array)\n \n #Step 2 - work out distance between furthest bays\n \n #Start by getti...
[ { "docid": "3818ba8c91b897f524369bcbf77fd94a", "score": "0.74528205", "text": "def calc_bays_apart(sorted_bays)\n all_bays = [:a10, :a9, :a8, :a7, :a6,:a5, :a4, :a3, :a2, :a1, :c1, :c2, :c3, :c4, :c5, :c6, :c7, :c8, :c9, :c10, :b1, :b2, :b3, :b4, :b5, :b6, :b7, :b8, :b9, :b10]\n bays_distance\n all_b...
98fe97e038368362a5528de756212420
full_name method is defined below with three parameters first_name, last_name and title
[ { "docid": "5e722be6111ceb2bad4cb927b3376ff3", "score": "0.0", "text": "def full_name(first_name, last_name, title)\n\n # variable name is set to nil\n name = nil\n\n # if all three parameters are given then name is reset to be title(space)first_name(space)last_name\n if title && first_name && last_...
[ { "docid": "0ae32bdc05ab3e324385b4c2ba59a329", "score": "0.8786929", "text": "def full_name\n lcl_title = title.blank? ? \"\" : title + \" \"\n lcl_middle = middle_name.blank? ? \"\" : middle_name + \" \"\n lcl_title + first_name + \" \" + lcl_middle + last_name\n end", "title": "" }, ...
43f192ba6ce3f89dc8f582a204e15025
POST /project_pieces POST /project_pieces.json
[ { "docid": "21d10ad27c72f3d9dc85a79ace6d2363", "score": "0.7137639", "text": "def create\n @project_piece = ProjectPiece.new(project_piece_params)\n\n respond_to do |format|\n if @project_piece.save\n format.html { redirect_to @project_piece, notice: 'Project piece was successfully cre...
[ { "docid": "8ca2ef47b83f69abd5d772a554d4ccdb", "score": "0.6549414", "text": "def project_piece_params\n params[:project_piece]\n end", "title": "" }, { "docid": "f96f0d8ab710dde5117464b6ba8bfcab", "score": "0.65200084", "text": "def create\n @piece = Piece.new(piece_param...
b3035a4075748c4fe0186c461051e7d2
NOTE must be return lambda
[ { "docid": "c51678f974639268ec08c5341567fa23", "score": "0.0", "text": "def no_signin_redirect_logic\n raise NotImplementedError\n end", "title": "" } ]
[ { "docid": "0190890ecf2172d2578493635fa8653c", "score": "0.83235407", "text": "def lambda; end", "title": "" }, { "docid": "c81ff9025626df992c418b988a457e2d", "score": "0.78491", "text": "def lambda?; end", "title": "" }, { "docid": "c81ff9025626df992c418b988a457e2d", ...
a29f6707fe6696722c1af49bbf3f5b3f
This method actually makes the HTTP calls out to the server
[ { "docid": "98b0c231d2605da52d92d6cc294f463e", "score": "0.0", "text": "def cfreq(method,server,path,headers = {},data = nil,attempts = 0,&block) # :nodoc:\n start = Time.now\n hdrhash = headerprep(headers)\n path = URI.escape(path)\n start_http(server,path,hdrhash)\n request = ...
[ { "docid": "149bf02c351fcd6d05728d84ea94e455", "score": "0.76853913", "text": "def execute()\n uri = self.uri()\n http = Net::HTTP.new( uri.host, uri.port )\n if use_ssl\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n response = http.re...
b55060069876494a649560da7ed6a596
Wszystkie dane w postaci hasha
[ { "docid": "37aeec8b25fe82401501fcb5f32c6540", "score": "0.0", "text": "def to_hash\n Presenter.new(self).data\n end", "title": "" } ]
[ { "docid": "0dbe2a68299399de67be9d62005975d7", "score": "0.7104405", "text": "def hash;0;end", "title": "" }, { "docid": "b78a8c3fbbda0dc6b3ed59f810316f24", "score": "0.70777684", "text": "def hash(*) end", "title": "" }, { "docid": "15ab111544bfee6d598c82c6a202f376", ...
3d3259280292555c3c6ed527595bcb13
Public: Return package distribution from rpm file. Examples distribution() => "Fedora Project" Returns package distribution as String.
[ { "docid": "9ecd86bd5f77ca91aa093da6912b3526", "score": "0.62760144", "text": "def distribution\n @distribution ||= read_tag('DISTRIBUTION')\n end", "title": "" } ]
[ { "docid": "58438964a9a2644f4cab545877cff0ee", "score": "0.6850605", "text": "def distribution\n\t\t\t\t@@distribution ||= if os_release.key?(:NAME)\n\t\t\t\t\tos_release[:NAME]\n\t\t\t\telse\n\t\t\t\t\tv = lsb_release\n\n\t\t\t\t\tif v.key?(:DISTRIB_DESCRIPTION)\n\t\t\t\t\t\tv[:DISTRIB_DESCRIPTION]\n\t...
a0c5211dfdd032bf59395f79ad884599
Add all Elm modules imported in the target file as dependencies, then recursively do the same for each of those dependent modules.
[ { "docid": "b7d034bda24ac5cf1420fcc3e0a0c62c", "score": "0.7067785", "text": "def add_elm_dependencies(filename, load_path, context)\n File.read(filename).each_line.flat_map do |line|\n # e.g. `import Quiz.QuestionStore exposing (..)`\n match = line.match(/^import\\s+([^\\s]+)/)...
[ { "docid": "4dc1b801e54d9990f65fc3e7b336c293", "score": "0.6939476", "text": "def add_elm_dependencies(filepath, context)\n # Turn e.g. ~/NoRedInk/app/assets/javascripts/Quiz/QuestionStoreAPI.js.elm\n # into just ~/NoRedInk/app/assets/javascripts/\n dirname = context.pathname.to_s.gsub Regexp.n...
7d86b6044bed3e320902361f8bb9af1a
Server hash requirements The keys `[:deployer][:from]` and `[:deployer][:to]` must be set in your `server` hash in order for `Deployer` to work.
[ { "docid": "472e74ea11c3b5214206077b17efd9fc", "score": "0.4658474", "text": "def initialize(server)\n @server = server\n end", "title": "" } ]
[ { "docid": "5fa9de103e3b08e581cbd666eb3fd620", "score": "0.6039202", "text": "def can?()\n d = server[:deployer]\n \n if d.has_key?(:from) and d.has_key?(:to)\n return true\n else\n return false\n end\n end", "title": "" }, { "docid":...
00c550927c3ee56247a2786a84b629da
Runs the callback passing it the changes if there are any.
[ { "docid": "852679902188c2ac12d8fc8158c42016", "score": "0.58935255", "text": "def on_change(directories, options = {})\n changes = @directory_record.fetch_changes(directories, options.merge(\n :relative_paths => @use_relative_paths\n ))\n unless changes.values.all? { |paths| paths...
[ { "docid": "94f44f9e4c7ab2371645997c1bbc7b1b", "score": "0.7387909", "text": "def mark_changed\n @callback.call\n end", "title": "" }, { "docid": "86a41a6fb4da15188c8baea0282c0ab0", "score": "0.6885077", "text": "def on_change(&block)\n @change_callback = block\n end"...
095e85e42e3db5cf704f84f0c5f49cd4
Add Shipments to a Batch.
[ { "docid": "10d475b63db27885cbe16f2faf27a4a0", "score": "0.7545903", "text": "def add_shipments(id, params = {})\n @client.make_request(:post, \"batches/#{id}/add_shipments\", MODEL_CLASS, params)\n end", "title": "" } ]
[ { "docid": "71ad7b47e0773fc14b28151c7b88e4ad", "score": "0.64972234", "text": "def shipments(body)\n post(\"/shipments\", body: body.to_json)\n end", "title": "" }, { "docid": "06020f806cd46bad8be02f36fa7dfc09", "score": "0.64347196", "text": "def add_shipments\n\n req...
f1e66ce192ac0e112cb54c2ba78b4c6b
[POST] Add permission set assignment
[ { "docid": "80d7435ff45c53a51f2530c1c2427d89", "score": "0.72816783", "text": "def create_permission_set_assignment(id:, **args)\n params = parameters(args) do\n required_params :user_id\n optional_params :user_id\n end\n request(:post, \"permissionSets/#{id}/assig...
[ { "docid": "d888381e08347a910599da5c8e5c23db", "score": "0.6863392", "text": "def create_user_permission_set_assignment(id:, **args)\n params = parameters(args) do\n required_params :permission_set_id\n optional_params :permission_set_id\n end\n request(:post, \"us...
c17b626df4f6ecae32faf5b0f6663334
Add an OUTPUT clause to fetch the updated timestamp when updating the row.
[ { "docid": "db21a15d0e39b888705478571f8ac3fb", "score": "0.0", "text": "def _update_without_checking(columns)\n ds = _update_dataset\n lc = model.lock_column\n rows = ds.clone(ds.send(:default_server_opts, :sql=>ds.output(nil, [Sequel[:inserted][lc]]).update_sql(columns))).all...
[ { "docid": "d926e139487473958f0b201e227ea96f", "score": "0.58728224", "text": "def updating_all_timestamp_sql\n update_col = timestamp_attributes_for_update_in_model.first\n\n \", #{update_col} = ?\" if update_col\n end", "title": "" }, { "docid": "d96af815275840a6dfb1d18824d430...
37624cddede1d312f3caf2cdc1f91dcb
DELETE /stage_residencies/1 DELETE /stage_residencies/1.json
[ { "docid": "34d4b6d5c701c336a53a62e264742594", "score": "0.79183173", "text": "def destroy\n @stage_residency = StageResidency.find(params[:id])\n @stage_residency.destroy\n\n respond_to do |format|\n format.html { redirect_to stage_residencies_url }\n format.json { head :no_content }...
[ { "docid": "98b27b2f769f4499c266a3ecc9474642", "score": "0.7442708", "text": "def destroy\n @stage_residency_time = StageResidencyTime.find(params[:id])\n @stage_residency_time.destroy\n\n respond_to do |format|\n format.html { redirect_to stage_residency_times_url }\n format.json { h...
0710dd00219370e7410fed408e8ddb63
Returns definition string for this class's equality assignment operator
[ { "docid": "06146466f343ade7778ffb144020c995", "score": "0.0", "text": "def get_definition(codeClass, cfg)\n eqString = String.new\n seperator = \"\"\n longArrayFound = false\n varArray = Array.new\n codeClass.getAllVarsFor(varArray)\n\n eqString << \"/**\\n* Defines the variables in a...
[ { "docid": "4a57e6f522a2817b106d6466544d4392", "score": "0.62112695", "text": "def to_s\n \"#{@lhs} -> #{rhs_str}\"\n end", "title": "" }, { "docid": "e28a802a7e4e4f2242f57ac7f575a652", "score": "0.6186989", "text": "def get_declaration(cls, bld, funItem)\n eqString = St...
ec8ea20e520373fdfdf73f925d966da9
standard error codes include: 'invalid_request', 'invalid_client', 'invalid_token', 'invalid_grant', 'unsupported_grant_type', 'invalid_scope'
[ { "docid": "5e677dc35a5cb6feac442c230e18c8dd", "score": "0.0", "text": "def initialize(response)\n response.error = self\n @response = response\n message_opts = {}\n\n if response.parsed.is_a?(Hash)\n @code = response.parsed['error']\n @description = response.parsed['er...
[ { "docid": "53e3dc5f131d2ad96ca6182bd9ccae0c", "score": "0.7394105", "text": "def specific_oauth_error(resp, error_code, context); end", "title": "" }, { "docid": "fd3ebb59555eebbd2f4b6199d174ff5c", "score": "0.7250561", "text": "def client_error_status_code\n 16\n end", "tit...
005de39adecaa31260896d9cf7878056
GET /guest_groups/1 GET /guest_groups/1.json
[ { "docid": "c46802dfccf0c37281fdc634f8cf85c1", "score": "0.7661675", "text": "def show\n @guest_group = GuestGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guest_group }\n end\n end", "title": "" } ]
[ { "docid": "c449413110964807364c22a01ac02ab9", "score": "0.75442773", "text": "def retrieve_groups()\n start.uri('/api/group')\n .get()\n .go()\n end", "title": "" }, { "docid": "40158a306d172d148ad8c9b38846e2eb", "score": "0.7537704", "text": "def retrieve_...
44a826f97d3db94fa4cc424c30180564
A TypeLib::Filter consists of a check procedure, a conversion procedure, and a TypeLib::FilterList which may be empty. Checks return boolean which indicates whether or not the conversion will be attempted.
[ { "docid": "0182af6da3b33fe4f938b41e67387368", "score": "0.5526203", "text": "def initialize(check, convert, filters=FilterList.new)\n @check_proc = check \n @convert_proc = convert\n @filters = filters\n end", "title": "" } ]
[ { "docid": "d53a4ab79b455759ea8ddd8f01325d71", "score": "0.6363245", "text": "def valid?(*args)\n raise \"not implemented. implement #valid? in your filter class.\"\n end", "title": "" }, { "docid": "55172d721297cbd9339b860286a9d697", "score": "0.611059", "text": "def fil...
e19a7522a175c0101a0066b0a62c7a0e
Created by on 20090811. Copyright (c) 2009. All rights reserved. =begin It can be seen that the number, 125874, and its double, 251748, contain exactly the same digits, but in a different order. Find the smallest positive integer, x, such that 2x, 3x, 4x, 5x, and 6x, contain the same digits. =end
[ { "docid": "b587024866e0464d06f572ec830a2d63", "score": "0.0", "text": "def permutation?(left, right)\n return false if left.size != right.size\n \n left.size.times do |i|\n return false if right.index(left[i,1]).nil?\n end\n true\nend", "title": "" } ]
[ { "docid": "49840c82034191fc0acc9e64983d4ca1", "score": "0.7121784", "text": "def smallest_digit_amount(number)\n smallest = number.digits.sort.first\n number.digits.count { |n| n == smallest }\nend", "title": "" }, { "docid": "b5b5396aae1ce76ec81ec357e7dcadcb", "score": "0.70273656", ...
cf8d232735ef9b3e34f29afc5e0d88be
5 Use enumerables to iterate 1 Less preferred
[ { "docid": "1ebe0a9339bc358f720301a3d13831de", "score": "0.0", "text": "def repeat_hi(num)\n i = 0\n while i < num\n puts \"hi\"\n i += 1\n end\nend", "title": "" } ]
[ { "docid": "538d72b03ff3f6a1766c77c6ea174ad3", "score": "0.5902296", "text": "def test_0655_each_with_index\n @@log.debug \"test_0655_each_with_index starts\" if @@log.debug?\n assert_respond_to(@list, :each_with_index, \"test_0655_each_with_index_respond\")\n # Type check\n enum = @list.eac...
84996df73dacd148670cab26abb47715
write_file writes out a serialized representation of graph to a file.
[ { "docid": "a9511a602afd3a5c73b8266e46905093", "score": "0.0", "text": "def write_file(filename)\n File.open(filename, 'w') { |file| file.write(write_to) }\n end", "title": "" } ]
[ { "docid": "2f1302e6c0dc2ff929ad7a8eb5ad8cb6", "score": "0.8153515", "text": "def write_graph_file(graph, file_path)\n delete_graph_file(file_path)\n File.open(file_path, \"wb\") do |file|\n file << Marshal::dump(graph)\n end\n end", "title": "" }, { "docid": "436e039db86b10f4...
3fcd7f0dd519030c4ce3de183ec0a77d
Reads from the provided IO an instance of the implementing class
[ { "docid": "40cfee84c906a6cb7f49fa1d52390f6b", "score": "0.8094564", "text": "def read(io)\n raise NotImplementedError, \"implement in including class\"\n end", "title": "" } ]
[ { "docid": "e4bb2ce2b791d8c224f374d9816c1ac8", "score": "0.76821125", "text": "def read(io)\n @record_class.read(io)\n end", "title": "" }, { "docid": "1cae96136a15670699fe1bfe96dec915", "score": "0.7555442", "text": "def from_io(io); end", "title": "" }, { "docid...
0a5c73dcd5c33bfc4e3f7d9ca642463f
This function gets called if the filter functions deny access.
[ { "docid": "4dde483e0d0bfa4e22613733acd4c3d0", "score": "0.0", "text": "def permission_denied\n render :partial => \"shared/permission_denied\",\n :layout => \"comatose_admin\",\n :status => :forbidden\n end", "title": "" } ]
[ { "docid": "93880e9b00e074f195a89699e5747c71", "score": "0.7291602", "text": "def access_denied\n end", "title": "" }, { "docid": "9f726b88e63a79a867736689bb238c3a", "score": "0.72307634", "text": "def access_forbidden\n false\n end", "title": "" }, { "docid": "9...
30d86c084e527b271abe50891d197235
PATCH/PUT /benutzers/1 PATCH/PUT /benutzers/1.json
[ { "docid": "dcd972b2db32d2e8d56810dac91d668f", "score": "0.6328353", "text": "def update\n doc = Nokogiri::XML(request.body.read)\n bNode = doc.xpath('elwak/benutzer')\n\n @benutzer = Benutzer.find(params[:id])\n \n #Sicherstellen, dass Benutzer synchronisiert wird auch wenn nur Objekt-Zu...
[ { "docid": "30da94e41d8ee5f186582dfb86d28f27", "score": "0.6443179", "text": "def restobooking\n @buchung = Buchung.find(params[:id])\n @buchung.status='B' \n \n respond_to do |format|\n if @buchung.update_attributes(params[:buchung])\n format.html { redirect_to @buchung, notice...
7e24e2aaeb396faa43ede861fa90a0ef
DELETE /car_types/1 DELETE /car_types/1.json
[ { "docid": "5f82102c0b15559b343c095f155032ca", "score": "0.7363107", "text": "def destroy\n @car_type = CarType.find(params[:id])\n @car_type.destroy\n\n respond_to do |format|\n format.html { redirect_to car_types_url }\n format.json { head :no_content }\n format.js { redirect_t...
[ { "docid": "289ec46c48c3d445903a2d2a44ea72e3", "score": "0.7434727", "text": "def destroy\n @cars = Car.where(car_type_id: @car_type.id)\n @cars.each do |car|\n car.destroy\n end\n @car_type.destroy\n respond_to do |format|\n format.html { redirect_to car_types_url, notice: 'Car...
00d2c80cd1e84bf071600c2f169e13bc
Input request input from user to add a new student
[ { "docid": "e111bb0f0636811ada2273b2625cbf01", "score": "0.0", "text": "def create_directory\n puts \"Input a new student? 'YES' or 'NO'\".center(@width)\n user_input = STDIN.gets.chop.upcase\n if user_input == \"YES\"\n return true\n elsif user_input == \"NO\"\n return false\n else\n erro...
[ { "docid": "2a0cb1a0099bd2ad393466edb2c720df", "score": "0.83894217", "text": "def add_student\n name = get_entry(\"Enter name: \")\n mat_nr = get_entry(\"Enter matriculation number: \").to_i\n\n s = Person::Student.new(name, mat_nr)\n Menu.data_handler.add_person(s)\n puts \"St...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "c2f35248ecbfe195bbddfbe2696b3090", "score": "0.0", "text": "def set_questionnaires_student\n @questionnaires_student = QuestionnairesStudent.find(params[: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...
eb77d83c9ac6cf79a60fee7539aa107b
BOOL IsActive True if this group is active
[ { "docid": "05214bf57eec4df0fac6f681fee9f8d6", "score": "0.0", "text": "def IsActive()\r\n ret = _getproperty(1610743812, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "title": "" } ]
[ { "docid": "d5ada5ab499a13ce0497e07437c4d500", "score": "0.7499976", "text": "def active?\n @active.value\n end", "title": "" }, { "docid": "fe9a9e9ee87a81aca20ac6fd2d7d97ef", "score": "0.73927236", "text": "def active?\n @_active_status ||= ( attributes.include?('acti...
83a39a535355c0ccb49e7be20e6ccc22
Set simulation friction model.
[ { "docid": "dbf274828220305bb2154ba894666e8b", "score": "0.8323509", "text": "def set_friction_model(model)\n model = model.zero? ? 0 : 1\n Sketchup.active_model.set_attribute('MSPhysics', 'Friction Model', model)\n sim = MSPhysics::Simulation.instance\n sim.world.set_frictio...
[ { "docid": "20004fa232222910eeba78ce0ec5bae0", "score": "0.8286581", "text": "def friction_model=(model)\n model = model.zero? ? 0 : 1\n Sketchup.active_model.set_attribute('MSPhysics', 'Friction Model', model)\n sim = MSPhysics::Simulation.instance\n sim.world.friction_model...
03ad18f6225ed453967894873d38ace2
GET /classes_timetables/1 GET /classes_timetables/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "3ba1f3356ba1b9af6a42ebd62e204f5b", "score": "0.7638355", "text": "def index\n @classes_timetables = ClassesTimetable.all\n end", "title": "" }, { "docid": "3e8562bd81944d887e103300d4563bd1", "score": "0.70606476", "text": "def index\n @class_times = ClassTime.all\n...
b722f63cbe006a4405303d4fccf9b2e0
return number of teams
[ { "docid": "c4ef7bf17016c0dba80194ac2d913f81", "score": "0.8593199", "text": "def count_teams\n return self.teams.count;\n end", "title": "" } ]
[ { "docid": "9ced274a9de44c980124aa9357e52fb2", "score": "0.89435357", "text": "def count_of_teams\n Team.count\n end", "title": "" }, { "docid": "23551d9e24e9c8822ec6d0667b8e5209", "score": "0.8642359", "text": "def count_of_teams\n game_teams.uniq(&:team_id).size\n end", ...
84f50530495633f9ffa60a5316b558fa
1. DRIVER TESTS GO BELOW THIS LINE
[ { "docid": "e4050c00a704170b9ca4c325a62eeb07", "score": "0.0", "text": "def assert expected, actual, message\n\tdisplay message\n\tdisplay actual == expected || display_error(expected, actual)\nend", "title": "" } ]
[ { "docid": "16a6d5e8eabd975007f205c109c50890", "score": "0.7193564", "text": "def testing; end", "title": "" }, { "docid": "8fbc98d9068bd9c82033a031286f0a1e", "score": "0.70860887", "text": "def tests; end", "title": "" }, { "docid": "8fbc98d9068bd9c82033a031286f0a1e", ...
5e8a6449b87077b5d1d89148a0858bed
DELETE /samples/1 DELETE /samples/1.xml
[ { "docid": "378afcd4639c09e1fa406144e7de2018", "score": "0.7176464", "text": "def destroy\n @sample = Sample.find(params[:id])\n @sample.destroy\n\n respond_to do |format|\n format.html { redirect_to(samples_url) }\n format.xml { head :ok }\n end\n end", "title": "" } ]
[ { "docid": "62d2c30430a0e50a5e75b7b9956058b2", "score": "0.7205171", "text": "def destroy\n @sample.destroy\n\n respond_to do |format|\n format.html { redirect_to(samples_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "2c108da8ef930d93e606a4591f...
fbbed7b608bd8c0b9fa7cd06807ea5ce
METS XML file group section Single file group entry collecting files
[ { "docid": "81618f16988d4236f59f5d6cfde2228c", "score": "0.73801565", "text": "def filegroup_section(file_group)\n file_data = file_group.files.map do |file|\n file_section(file_group, file)\n end\n %Q(<mets:fileGrp USE=\"#{file_group.name}\">#{file_data.join(\"\")}</mets:fileGrp>)...
[ { "docid": "54ebf152c95521e0cc6056edc9d1eaf0", "score": "0.70576465", "text": "def filegroup_sections\n file_group_data = @file_groups.map do |file_group|\n filegroup_section(file_group)\n end\n %Q(<mets:fileSec ID=\"fileSec1\">#{file_group_data.join(\"\")}</mets:fileSec>)\n end...
ec1a311dedf3bd6e3007afed5ef1e7f3
Helper function for linkUnit
[ { "docid": "f375e70adc263f20ef147aac3b5269bf", "score": "0.0", "text": "def linkDescendants(id, child, childMap, done)\n childMap[child].each { |child2|\n if !done.include?([id, child2])\n #puts \"linkDescendants: id=#{id} child2=#{child2}\"\n UnitHier.create(\n :ancestor_unit => id...
[ { "docid": "234e3446a9cca013dea70dcbfb26120a", "score": "0.64408785", "text": "def link_support; end", "title": "" }, { "docid": "234e3446a9cca013dea70dcbfb26120a", "score": "0.64408785", "text": "def link_support; end", "title": "" }, { "docid": "234e3446a9cca013dea70dcb...
cb623c02c52039d54ab2bded276f9504
Method used to feed INSTREAM command to ClamdAV daemon Usage: clamd = Clamd::Client.new clamd.instream('/home/soundar/documents/doc.pdf') file
[ { "docid": "d6b841d39b01639288ca889797f306dc", "score": "0.6962053", "text": "def instream(path)\n exec(COMMAND[:instream], path)\n end", "title": "" } ]
[ { "docid": "ec35a93a4ee55d8f9913d5ec4d329804", "score": "0.58981013", "text": "def get_input_stream(entry, &aProc); end", "title": "" }, { "docid": "9d33ce1f4d5bc411fca6b0a35eee3d25", "score": "0.5897326", "text": "def set_input_stream\n @input_stream = InputStream.find(params[:...