query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
054b7031d8597e12ff89c1224bc8a301
DELETE /request1s/1 DELETE /request1s/1.json
[ { "docid": "3f0ef499d3659b8bcfb80d1df24a2827", "score": "0.75786775", "text": "def destroy\n @request1.destroy\n respond_to do |format|\n format.html { redirect_to request1s_url, notice: 'Request1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "ti...
[ { "docid": "aab40e915a983b19a00c602b76a1ae9a", "score": "0.8063221", "text": "def delete\n RestClient.delete \"#{@uri}/api/requests/request/#{@data['requestId']||@data['id']}\"\n puts ' Deleted request: '.red + \"#{@data['requestId']||@data['id']}\".light_blue\n end", "title": "" }, ...
764b1bf2dce5de7ed35f3981670a35ad
Methods from students solutions
[ { "docid": "9b1033eb8ac10c1d7cfd8ca9c2b5d339", "score": "0.0", "text": "def count_occurrences(arr)\n answer = Hash.new(0)\n arr.each { |item| answer[item] += 1}\n answer.each {|key, value| puts \"#{key} => #{value}\" }\nend", "title": "" } ]
[ { "docid": "562f63d0d6997e0b09fd56c03b4f504a", "score": "0.68906176", "text": "def scientist; end", "title": "" }, { "docid": "b2bf34b4d9f079aafc5e624689e76050", "score": "0.67273355", "text": "def algorithms; end", "title": "" }, { "docid": "b2bf34b4d9f079aafc5e624689e76...
c3f3dd8e2d18c0f1edc668f8908d380e
Convert a radians unit to degrees. e.g 0.785398163397448.radians => 45.0
[ { "docid": "64b3af4b04c252812ef1ecc39ed59475", "score": "0.7014108", "text": "def radians\n self * 180 / Math::PI\n end", "title": "" } ]
[ { "docid": "1bded70772224ff54eda3c81049b4c1f", "score": "0.8312382", "text": "def to_degrees(radians)\n (radians * 180.0) / Math::PI\n end", "title": "" }, { "docid": "830d5024d6cfc57093141a4081e28da0", "score": "0.8123155", "text": "def to_degrees\n self / Math::PI.fdiv(1...
93ab86a91a130e72eb36d4d77a7a40d9
GET /galaxies GET /galaxies.json
[ { "docid": "b80a8cd9cac96672415fb13123730eb3", "score": "0.0", "text": "def index\n w_len = GameSettings.get \"WORLD_LENGTH\"\n wv_len = GameSettings.get \"WORLD_VIEW_LENGTH\"\n @pos = [0, 0]\n unless params[\"x\"].nil? || params[\"y\"].nil?\n @pos[0] = params[\"x\"].to_i\n @pos[1]...
[ { "docid": "28778e162cabb0ffbab52c5a6a078f7b", "score": "0.72708535", "text": "def index\n @q = Galaxy.search(params[:q])\n @q.sorts = 'id asc' if @q.sorts.empty?\n if params[:page] != \"false\"\n @galaxies = @q.result(distinct: true).page(params[:page])\n else\n @galaxies = @q.res...
2a41982df6fae24ad87b71c54f2521e6
GET /about_us_sections/1 or /about_us_sections/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "a04c9c624bbe80febba44c4099d21da5", "score": "0.6883701", "text": "def index\n @about_us_sections = AboutUsSection.all\n end", "title": "" }, { "docid": "26ee68cd709ed18194fbad6895c631e4", "score": "0.6880632", "text": "def index\n @sections = params[:path].nil? ? ...
5633c7a897dc80ec25e689db7d8392b5
Removes a relation at the given index
[ { "docid": "4e1acb1a5bfdadfaf044ef5f3e755909", "score": "0.6662819", "text": "def remove_at(index)\n items.at(index).destroy\n items.delete_at(index)\n end", "title": "" } ]
[ { "docid": "7d4ea7968c678e13bd49daa044076d38", "score": "0.70880485", "text": "def remove_relationship_from_index(index, id_or_key, id_or_value = nil, id = nil)\n if id\n remove_relationship_index_by_value(index, id, id_or_key, id_or_value)\n elsif id_or_value\n remove_re...
bb5290cf2a0252615ab404ad8714e382
Returns the winner or if its a Tie
[ { "docid": "9c938632112a1f4c81b600199cd2a44f", "score": "0.0", "text": "def evaluate_result\n winning_patterns_index.each do |pattern|\n self.winner = current_player if pattern.all? { |index| available_moves[index] == current_player.symbol }\n end\n end", "title": "" } ]
[ { "docid": "1d02290a84956f3194f7e53591459b07", "score": "0.78417456", "text": "def winner\n triplet = won?\n if !!triplet\n return @board[triplet[0]]\n end\n return nil\n end", "title": "" }, { "docid": "3517d992984dbc59e3f79effab3f84c9", "score": "0.78192675", "tex...
63074a26cdd34ec25dc52b2fd3f2a832
Get the full URL for email notifications
[ { "docid": "916d966251453f03c8aae09beebfe9c7", "score": "0.0", "text": "def document_url\n key = document.model_name.singular_route_key\n Rails.application.routes.url_helpers.send(key + '_url', document.id)\n end", "title": "" } ]
[ { "docid": "7960f2ac919201762f657816ed9b574b", "score": "0.7877183", "text": "def notification_url\n return @notification_url\n end", "title": "" }, { "docid": "ec499e0eaf0cca2fdf7cf79dae39609f", "score": "0.7192812", "text": "def notification_link(n)\n u...
13e121a093e02b5286f0aabcb7a67181
If the number of workers is not at the maximum, start some.
[ { "docid": "1657ac0ccec1279c31472511f14b39be", "score": "0.65584415", "text": "def adjust_workers\n\t\tself.sample_queue_status\n\n\t\treturn nil if self.throttled?\n\n\t\tif self.needs_a_worker?\n\t\t\tself.log.info \"Too few workers for (%s); spinning one up.\" % [ self.task_class.name ]\n\t\t\tpid = ...
[ { "docid": "dabdff58090fe7ebb0bb38cc5ade37a0", "score": "0.7166885", "text": "def workers(count); end", "title": "" }, { "docid": "45eec213df17411ef9fa016ba5672ade", "score": "0.69302565", "text": "def check_for_available_workers\n workers >= working_count\n end", "title": ""...
7e23c058427532dc2e57f75fc94d643e
GET /builds GET /builds.json
[ { "docid": "3bcf196adcfd0f3189903a7c34722d20", "score": "0.6774893", "text": "def index\n @builds = Build.all.order(issued: :desc).page(params[:page])\n end", "title": "" } ]
[ { "docid": "6454e5fb640af84d5c5e1a0e23c92e69", "score": "0.8380609", "text": "def builds\n return @client.get(\"#{@resource_uri}/builds\")\n end", "title": "" }, { "docid": "7c77788a199263b914296676e6d9fd2b", "score": "0.7978785", "text": "def index\n @builds = Build.all...
4c4ef49114238f975006acc5d5dc823f
Returns a new Collection object consisting of all the Model objects matching `attrs`.
[ { "docid": "016d5325ab1492d279ecdf5552e75fdf", "score": "0.6454567", "text": "def where(attrs={}, &block)\n block = lambda { |e| attrs.all? { |k,v| e.send(k) == v }} unless block_given?\n Collection.new(@parent, @klass, select(&block))\n end", "title": "" } ]
[ { "docid": "c0cc7802c1c14d723b051e9eddba4874", "score": "0.714602", "text": "def collection_attributes(*attrs)\n @collection_attributes ||= []\n if attrs.any?\n @collection_attributes.map!(&:to_sym).concat(attrs).uniq!\n @collection_attributes.each { |a| setup_collection(a) }\n ...
930ff41372c863d85afe64e9852b3a1b
PUT /courses/1 PUT /courses/1.json
[ { "docid": "b959187d5d7e99dd86136ee4709209b9", "score": "0.6730522", "text": "def update\n @course = Course.find(params[:id])\n #authorize! :update, @course\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'Course ...
[ { "docid": "925d2c4275264c061f601f9b579c6973", "score": "0.7416019", "text": "def update\n @course.update!(course_params)\n json_response(@course)\n end", "title": "" }, { "docid": "a4faeb37f0b5d04909ecebf3669fee24", "score": "0.7242076", "text": "def update\n @courses = Co...
4e44b501769b8ddb5cf162517c8fe767
Push new value for the existed session
[ { "docid": "681771357085a47334676d4380235415", "score": "0.0", "text": "def pushAll sid, settings, &block\n @app.session_service.import_all sid, settings, &block\n end", "title": "" } ]
[ { "docid": "b6bcbd3c955414c5e8e5f77a7620db6e", "score": "0.67801076", "text": "def update_session(key,val)\n session[key]=val\n session.update\n end", "title": "" }, { "docid": "b6bcbd3c955414c5e8e5f77a7620db6e", "score": "0.67801076", "text": "def update_session(key,val...
cec280df1d2ed5fdb9daf36be575046e
GET /node_histories GET /node_histories.json
[ { "docid": "c56898e769215a7eef7ebe5df23e32a5", "score": "0.7845508", "text": "def index\n @node_histories = NodeHistory.all\n end", "title": "" } ]
[ { "docid": "839c59063da1e77c7f9a270810306029", "score": "0.62618", "text": "def index\n @reading_histories = current_user.reading_histories.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reading_histories }\n end\n end", "title": "" ...
c466caa182054ea4e00a3c75b3a5a92d
Method to send text
[ { "docid": "6fad5e368520af4ea006f63c4fbef098", "score": "0.67491096", "text": "def send_text(text)\n cmd = \"input text #{text};\"\n @move == \"\" ? @move = cmd : @move = @move + cmd\n end", "title": "" } ]
[ { "docid": "aaaa3d1f479e2ad7ee24a8273e782933", "score": "0.8738527", "text": "def send_text data\n send data, :text\n end", "title": "" }, { "docid": "8cf1defd95e3691d4a70d9655a21216f", "score": "0.8031359", "text": "def send_text(text)\n puts \"↪ #{text}\"\n ...
22d3f448b253a461f6e15e3872f4a04e
Define API response structure
[ { "docid": "716e3fe5255734817b9c89d79fe364b1", "score": "0.62532306", "text": "def API_RESPONSE(status, body)\n JSON.generate({:status => status, :body => body});\nend", "title": "" } ]
[ { "docid": "37647cc0104b859dcb53b1256cb2781f", "score": "0.6932052", "text": "def build_response\n enrich_object(fawry_api_response)\n end", "title": "" }, { "docid": "2d1089fbfe562aa275ab4e5c536d084b", "score": "0.6690015", "text": "def api_response\n attrs.merge(@tag_i...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "c5b4285c3b3dee1e53dfd8ae6a2cbd40", "score": "0.0", "text": "def sign_params\n params.require(:sign).permit(:member_id, :measures_attributes => [:kindof, :value])\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...
bc2f2f746b8594a7bd7fbd1f965b81b3
Return the number of seconds the server has been running if it is. Returns +nil+ otherwise.
[ { "docid": "1a93cd8ab76225fdab6bdfbd9f1464eb", "score": "0.6217038", "text": "def uptime\n\t\treturn (Time.now - self.start_time)\n\tend", "title": "" } ]
[ { "docid": "f485ad9f593fe277f1cc93fdbfd3b608", "score": "0.66100407", "text": "def seconds_since_startup; end", "title": "" }, { "docid": "f485ad9f593fe277f1cc93fdbfd3b608", "score": "0.66100407", "text": "def seconds_since_startup; end", "title": "" }, { "docid": "42e825...
9e7279d2c5beb410074f778c4fd8d5e5
The minimum allowed imagemagick version === Returns The minimum imagemagick version
[ { "docid": "678a7b1df624d6e7b05386543debe1cf", "score": "0.8851184", "text": "def minimum_image_magick_version\n @@minimum_version ||= Gem::Version.create('6.6.3')\n end", "title": "" } ]
[ { "docid": "98cb07e6691f1707d356a84e5f93c289", "score": "0.7833048", "text": "def valid_version_installed?\n image_magick_version >= minimum_image_magick_version\n end", "title": "" }, { "docid": "b3cfbd8500eb199c23d8e6678982540b", "score": "0.766381", "text": "def image_magi...
d37fb72f70a87cdee2dfe72fd4a48d48
This challenge took me [] hours. =begin Pseudocode define a function is_fibonacci? that takes a value n set array fib to zero and one while the last value is less than n push the sum of the last two values on to fib return the boolean of the last value being equal to n =end Initial Solution
[ { "docid": "46a0013631971fc656cfd3fc86bcbf9e", "score": "0.857881", "text": "def is_fibonacci?(num)\n fib = [0,1]\n while fib[-1] < num\n fib.push(fib[-1] + fib[-2])\n end\n fib[-1] == num\nend", "title": "" } ]
[ { "docid": "e26881c66bd6454a5f456814caac357d", "score": "0.877299", "text": "def is_fibonacci?(num)\n array = [0, 1, 1]\n while array[-1] < num\n array.push(array[-1] + array[-2])\n end\n return ((array[-2] + array[-3]) == num)\nend", "title": "" }, { "docid": "010dd1620c4608a3fd57679...
a0541c54c51f0c957f560505d570174c
GET /platform_dashboard_metrics/1 GET /platform_dashboard_metrics/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "e40695856becd3996c18aeddaf3fd8ec", "score": "0.7487989", "text": "def index\n @api_v1_metrics_dashboards = Api::V1::MetricsDashboard.all\n end", "title": "" }, { "docid": "3209e677717d75d8051b6baa952f98d8", "score": "0.7349007", "text": "def set_platform_dashboard_met...
19d4cea5bf1f5b057e05aec715e16f1b
PATCH/PUT /rarities/1 PATCH/PUT /rarities/1.json
[ { "docid": "e6f45e8616e1fa3f042b9330f18022fc", "score": "0.6435254", "text": "def update\n respond_to do |format|\n if @rarity.update(rarity_params)\n format.html { redirect_to @rarity, notice: 'Rarity was successfully updated.' }\n format.json { render :show, status: :ok, location...
[ { "docid": "6667e1b6777b75c86db875c147b7b01b", "score": "0.6427816", "text": "def update\n @arrest = Arrest.find(params[:id])\n\n respond_to do |format|\n if @arrest.update_attributes(params[:arrest])\n format.html { redirect_to @arrest, notice: 'Arrest was successfully updated.' }\n ...
3f5f3bc57f88efee7a4c3b58517fdfb2
POST /list_product_recipes POST /list_product_recipes.json
[ { "docid": "89bc8deea8a0389e08cc59f5068b7f27", "score": "0.6431133", "text": "def create\n @list_product_recipe = ListProductRecipe.new(list_product_recipe_params)\n\n respond_to do |format|\n if @list_product_recipe.save\n format.html { redirect_to @list_product_recipe, notice: 'List ...
[ { "docid": "f9976986d8bfeae0ed90bcbfcce4c437", "score": "0.7263002", "text": "def list\n \n recipes = Recipe.all\n render :json => recipes.to_json\n\n end", "title": "" }, { "docid": "7829af1fadb230f238c96a6c2e6ac949", "score": "0.7219124", "text": "def index\n @list_pro...
7987f3d78e023d336808591271de92f4
GET /doc_files GET /doc_files.json
[ { "docid": "56bd1eb8ea081f31dffe6d4307c25267", "score": "0.6122025", "text": "def index\n @doc_files = DocFile.where(student_id: current_user.student.id).order('created_at DESC')\n end", "title": "" } ]
[ { "docid": "9402f6640a6d2f608ead66b011820eb7", "score": "0.7359232", "text": "def index\n \n @docfiles = Docfile.all\n end", "title": "" }, { "docid": "287cbcaa41bddc60f3a27d8243163d57", "score": "0.6950102", "text": "def files\n @files=get_endpoint('extra').keys\n end...
d53247244e54db3cbdcb3a807bdd7b4e
DELETE /mail_schedules/1 DELETE /mail_schedules/1.json
[ { "docid": "e80318096dba76e3e0af7f344bb18bd0", "score": "0.77179897", "text": "def destroy\n @mail_schedule.destroy\n respond_to do |format|\n format.html { redirect_to mail_schedules_url, notice: 'Mail schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n...
[ { "docid": "2f4cd7e16467f6091ded386ad6483a1f", "score": "0.7334693", "text": "def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2f4cd7e16467f6091...
90e334ba385bcbb128a9f694d6194346
Returns the code for clientside detection
[ { "docid": "5320f7cf2ba315457b23ab8b24cd53a5", "score": "0.62266463", "text": "def get_detection_html(user_agent)\n ua_info = fingerprint_user_agent(user_agent)\n os = ua_info[:os_name]\n client = ua_info[:ua_name]\n\n code = ERB.new(%Q|\n <%= js_base64 %>\n <%= js_os...
[ { "docid": "ab4e1be1b29050010b3bc8999e9ea511", "score": "0.61593384", "text": "def client_browser_version \n user_agent = (request.env['HTTP_USER_AGENT'] || \"\").downcase \n if user_agent =~ /msie 8/i \n \"MSIE8\" \n elsif user_agent =~ /msie 7/i \n \"MSIE7\" \n elsif user_agent =...
281b28c1c847c71bb0245a64399feef9
Scoring queries (methods). Allow id's will be sorted by the sum of the conditions they meet based on the queries below. Queries are: Range (integer range) Existence (boolean) Distance (geospatial) Score the id by one of it's attributes that operate in ranges. If the value is in the range add the weight passed in by the...
[ { "docid": "263500a6e4c3c07e0c2cb7b0687ee3c2", "score": "0.7162764", "text": "def add_range_scoring_query(hash_table, range, score = 1)\n min, max = range.min, range.max\n return if score <= 0 || min > max\n @max_score += score\n @scoring_query << \"((#{min} <= #{hash_table} and #{hash_table...
[ { "docid": "8bec19e7c8c983ba17acbcc932fdb00f", "score": "0.64786875", "text": "def score\n return @query unless @criteria.present? && @query_field.present? && @score_name.present?\n\n @query.select <<-SQL\n *,\n CASE WHEN #{@query_field} = '#{@criteria}'\n THEN\n ...
d89acc35e28d55a1833438bd74cb4ee7
Get segment security profile binding map API will return details of the segment security profile binding map. If the binding map does not exist, it will return 404.
[ { "docid": "da059ae036dd7587a6f3658068f1d366", "score": "0.68921125", "text": "def get_segment_security_profile_binding_0(tier_1_id, segment_id, segment_security_profile_binding_map_id, opts = {})\n data, _status_code, _headers = get_segment_security_profile_binding_0_with_http_info(tier_1_id, segm...
[ { "docid": "05d313b5ac2da32da462be2eb0b445b1", "score": "0.7014894", "text": "def get_segment_security_profile_binding(tier_1_id, segment_id, segment_security_profile_binding_map_id, opts = {})\n data, _status_code, _headers = get_segment_security_profile_binding_with_http_info(tier_1_id, segment_i...
626279c15680f795926078550fe6090d
Read a 'asset.Deployment' resource.
[ { "docid": "9ca0fc26e2772bc793ed280928e66bf2", "score": "0.47543696", "text": "def get_asset_deployment_by_moid(moid, opts = {})\n data, _status_code, _headers = get_asset_deployment_by_moid_with_http_info(moid, opts)\n data\n end", "title": "" } ]
[ { "docid": "3812019fd7e854a5222b58bf80fa8639", "score": "0.5922184", "text": "def read_namespaced_deployment(name, namespace, opts = {})\n data, _status_code, _headers = read_namespaced_deployment_with_http_info(name, namespace, opts)\n return data\n end", "title": "" }, { "doci...
c413450675c4798e461b70f5df78f56a
Returns a list of available formatter names
[ { "docid": "8e64b3a9b738eb9630e6d27b5af1052c", "score": "0.82078904", "text": "def all\n formatters.map(&:name)\n end", "title": "" } ]
[ { "docid": "d3ad6fb3d81f76d54f98c8f0d58fb938", "score": "0.7675027", "text": "def available_formatters\n @formatters ||= {'default' => default_formatter}\n return @formatters\n end", "title": "" }, { "docid": "7d14033b1cf9d9e434e0a82a1d0ca98f", "score": "0.76682824", ...
188beabde5109d9814663bfabfc2c3f3
Call once when guard starts
[ { "docid": "ec721c20078d27c59c4c747038f2f09a", "score": "0.0", "text": "def start\n UI.info \"Guard::JRuby::RSpec is running, with RSpec!\"\n run_all if @options[:all_on_start]\n end", "title": "" } ]
[ { "docid": "6f4c3b4a9b7aa55befb5359e84143db8", "score": "0.6879808", "text": "def run_once; end", "title": "" }, { "docid": "da1cce6f0ebe5576d02fa5810c91c479", "score": "0.6829886", "text": "def run_once\n @run_once\n end", "title": "" }, { "docid": "da1cce6f0ebe5...
8d1311dba2609d97e5a97384d77b80bc
This API method looks at all the Built URLs submitted to a given Service in the last 7 days and finds domains that have never passed our link checker. This is a great way to clean your list of URLs used for submissions. Parameters: id: ID of the Service
[ { "docid": "8a6584195a8af2ef2e16b552b8da4663", "score": "0.4990921", "text": "def get_failed_domains(id)\n if id.nil?\n raise LinkemperorVendorException.new('id should not be empty')\n end\n exec_get(\"#{@base_path}/api/v2/vendors/services/#{id}/failed_domains.json?api_key=#{@api_key}\")\n...
[ { "docid": "91f8ab2bb6f49e33bc2b93e14d604c89", "score": "0.507915", "text": "def get_campaign_sites(id)\n if id.nil?\n raise LinkemperorCustomerException.new('id should not be empty')\n end\n exec_get(\"#{@base_path}/api/v2/customers/campaigns/#{id}/sites.json?api_key=#{@api_key}\")\n end...
43e5ac0279b0032e224bcb56e8634fac
create a method that takes in an array of strings and replaces the 3rd charecter in each string with a $ Ke$sha style.
[ { "docid": "91c55bd910525369da0ea97a7721179c", "score": "0.6023776", "text": "def kesha_maker(array)\n kesha_array = []\n i = 0\n array.each do |name|\n kesha_array.push(name[2] = \"$\")\n end\nend", "title": "" } ]
[ { "docid": "08f0c2c2a80acc0671eb284c6e1c8c30", "score": "0.7183738", "text": "def kesha_maker(arr)\n arr.each { |str| str[2] = \"$\" }\nend", "title": "" }, { "docid": "4df3955a3dd0881d4119ec7ff062237e", "score": "0.6988228", "text": "def kesha_maker(any_array)\n any_array.each d...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "29a0cba79452a0913564f27c274f1c82", "score": "0.0", "text": "def set_configuration\n @cluster_template = ClusterTemplate.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...
50df3ed38c65438e1920b0197e352fd0
prettyprints a hash, assuming no nesting
[ { "docid": "a20d0b0e323d0a4bdd5ec39bf0d5c0ba", "score": "0.6803425", "text": "def pp_hash(hash)\n str = \"{\\n \"\n str << hash.map { |k, v| \"'#{k}' => '#{v}'\" }.join(\",\\n \")\n str << \"\\n}\\n\"\nend", "title": "" } ]
[ { "docid": "1a6f70f52bc6e121a0fc5cc740389da7", "score": "0.7247691", "text": "def prettify hash\n text = []\n hash.keys.each do |k|\n next if k == :name # element name\n text.push k + ' => ' + hash[k].inspect\n end\n return '{ ' + text.sort.join(', ') + ' }'\n end", "title": ...
2538bdd4d0ea3cfce42df07384a1d104
Determines whether or not to make a record Returns true if we're in the test environment and the behaviour is not :strict
[ { "docid": "77224abf7f9ddc72ecc2700679a8501e", "score": "0.630919", "text": "def should_make_record?(options = {})\r\n ::LinguaFranca.recording? && options[:resolve] != false\r\n end", "title": "" } ]
[ { "docid": "e974b3af7b1664022d00d589a64f32c8", "score": "0.64956075", "text": "def record?\n type.record?\n end", "title": "" }, { "docid": "9c4a3d191bccb5138eb58be82a8c048f", "score": "0.6447053", "text": "def build_record?\n # We want to create a build record by defaul...
df11496180f1b42449b70bb835ce2eca
Added by Jan Lelis
[ { "docid": "6e7c40ef8fababf4c7b1224844865eb2", "score": "0.0", "text": "def methods_to_try(obj)\n ret = obj.methods.map(&:intern)\n blacklist = obj.is_a?(Module) ? CLASS_METHOD_BLACKLIST : INSTANCE_METHOD_BLACKLIST\n klass = obj.is_a?(Module) ? obj : obj.class\n\n klass.ancestors.eac...
[ { "docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1", "score": "0.7434758", "text": "def private; end", "title": "" }, { "docid": "0b8b7b9666e4ed32bfd448198778e4e9", "score": "0.6585108", "text": "def probers; end", "title": "" }, { "docid": "65ffca17e416f77c52ce148aeafbd826", ...
bfbcddcc918ef40f76e5014276919dbc
Preview this email at
[ { "docid": "8b0d69ad4c9cae0ef508b04fc58ce740", "score": "0.0", "text": "def employeer_notification\n NotificationMailer.employeer_notification\n end", "title": "" } ]
[ { "docid": "947d18f31928dcf9761bdcbda7f18565", "score": "0.71475905", "text": "def preview\n @email = Email.find(params[:id])\n render :text => @email.body\n end", "title": "" }, { "docid": "f9cb02c07e98bbf5e69bcea1540cfe24", "score": "0.71186084", "text": "def preview\n @e...
2d6232c50a2994dc7ab91e2efbdfd132
appends log as web console
[ { "docid": "d52763e646e44fb21a5e3d4f8b30314b", "score": "0.6212693", "text": "def log_to_console\n template = case\n when @responder.html_response?\n Template.console_template_for_html_response\n when @responder.javascript_response?\n Template.console_template_for_ja...
[ { "docid": "2e8be4d51a12481eaf35209734861956", "score": "0.702734", "text": "def embedLinkToConsoleLog(log_path)\n link_path = log_path.sub('output/', '')\n log_link = sprintf(\"<a href='%s'>%s</a>\", link_path, log_path)\n embed(log_link, 'text/plain', \"JS console messages\")\nend", "title": ""...
83abcb88271ae61d90bd8b3fa702ee34
Return previous stored value. Returns [timestamp, value] It returns first different previous value.
[ { "docid": "0f0b2e69630e679eb9718c441ee4f5eb", "score": "0.60733753", "text": "def previous(key)\n @engine.previous key.to_s\n end", "title": "" } ]
[ { "docid": "636a7eeea8acab02ac4dd14c7b48b1fd", "score": "0.7461111", "text": "def previous_value; end", "title": "" }, { "docid": "636a7eeea8acab02ac4dd14c7b48b1fd", "score": "0.7461111", "text": "def previous_value; end", "title": "" }, { "docid": "ac54ee1c0ece3f86b156ac...
82005d506d3ad929a307080cd260783b
Internal: LCG. Returns a lazy evaluating enumerable.
[ { "docid": "4f32645d8224b5be7bc6c1f0ca62f44b", "score": "0.0", "text": "def cycle(seed, range, prime)\n nb = seed\n range.times.lazy.map do\n nb = (nb + prime) % range\n nb\n end\n end", "title": "" } ]
[ { "docid": "4bee6a760b9161eb4d4e1e1438a260dc", "score": "0.66359276", "text": "def lazy_map(&blk)\n Enumerator.new do |yielder|\n self.each do |e|\n yielder << blk[e]\n end\n end\n end", "title": "" }, { "docid": "325785091478ad0070691df16db2133f", "sc...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "8480b0ac02e04d05d5afe13ab0a967aa", "score": "0.0", "text": "def worship_params\n params.require(:worship).permit(:name, :weekday, :schedule)\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...
c02233ec4225d1b45505bbffd0537be3
GET /test_approvals GET /test_approvals.json
[ { "docid": "4eb5f10460b0af0821bed5b744a0167d", "score": "0.7098227", "text": "def index\n @test_approvals = TestApproval.all\n end", "title": "" } ]
[ { "docid": "2d0072e9725816d73f7a23ee9d5e485e", "score": "0.6528395", "text": "def index\n @approvals = RequestSearch.search_approvals_for @user,\n :q=>@q,\n :show=>@filter_name,\n :sort_by=> hf_sort_by,\n :sort_order=> hf_sort_order,\n :page=>@page,\n ...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "36aa580800be6b7aff4f4d376a9b7ee1", "score": "0.0", "text": "def update!(**args)\n @description = args[:description] if args.key?(:description)\n @expression = args[:expression] if args.key?(:expression)\n @location = args[:location] if args.key?(:location)\n ...
[ { "docid": "150fa2bdc1fc43d28ac45e2278a1f797", "score": "0.7012263", "text": "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "t...
bcbe554a02f36911de00b03b688ff2ab
Wraps display methods into a single method to slim code
[ { "docid": "f6d0cd503bd0664700ba93911b028e77", "score": "0.0", "text": "def display_to_user(string)\n puts score_display(@score, @difficulty)\n random_cursor(@height, @width)\n round_typer(string, @difficulty)\n string_flasher(string, @difficulty, @height, @width, @score)\n end", "title...
[ { "docid": "67882794cfc35ba6fd94eb7a567a1524", "score": "0.75489724", "text": "def display\n # Don't no why i thought i would need that. or if i need this.\n end", "title": "" }, { "docid": "9194cd11711b519604736ccac1fa25b8", "score": "0.74765074", "text": "def display_method(met...
95471eff982e43b42178b228aceb947e
Gets the states that specify whether we will allow compression on responses to HTTP 1.0 requests. Default will be "false", i.e. disallowing compression on HTTP 1.0 responses.
[ { "docid": "0af8d5a70a382bc91dcf4b210088bde7", "score": "0.6456643", "text": "def compression_allow_http_10_state\n super\n end", "title": "" } ]
[ { "docid": "a593215b3b8810df57fabf8cfd9f9781", "score": "0.70061886", "text": "def compression_enabled?\n state.compress\n end", "title": "" }, { "docid": "d53897b476ef06e490b926f70aa8b6c2", "score": "0.6900082", "text": "def compression_enabled?\n return @compressio...
3efe4cca2dce07ec65a6c2f18a30f3ea
This method should take the name provided by user, downcase it, flip the names and then turn all the characters into a array
[ { "docid": "2d5e32682d72d17e99ea08fcb27c8518", "score": "0.73000085", "text": "def array_preperation(input_name)\n downcase_name = input_name.downcase\n name_split = downcase_name.split(' ')\n name_flip = name_split.insert(0, name_split.delete_at(1)).join(' ')\n name_array = name_fli...
[ { "docid": "16042ff0142814c4042ad70aaddf3645", "score": "0.81590354", "text": "def name_processing (input_name)\n reverse_name = input_name.split(' ').reverse.join(' ') # <== reverse and break into characters.\n characters_array = reverse_name.chars\nend", "title": "" }, { "docid": "0357...
e7d5bd7adb9bbf635f36994dc1404207
Writes the deck into a file
[ { "docid": "41a3daf438d9d61d9d75c9eaef9d7509", "score": "0.6737603", "text": "def save(fname)\n\t\tfilename = fname\n\t\tputs \"Saving #{filename}\"\n\t\tdeckFile = File.new(\"#{filename}.txt\", \"w\")\n\t\tdeckFile.puts(self.to_s)\n\tend", "title": "" } ]
[ { "docid": "f3f8e304e96bb9c29f6d94cb4406c835", "score": "0.71140546", "text": "def generate_cards_file\n @suits.each do |suit|\n count = 1\n @values.each do |value|\n File.open(filename, 'w+').each do |line|\n puts \"#{value}, #{suit}, #{count}\"\n line.puts \"#{val...
1b1213f96dbbbda79cb2d71005e2ab6e
GET /jobs GET /jobs.xml
[ { "docid": "39aa803eb3064da0d2e56a5e11c9bd7c", "score": "0.60557306", "text": "def index\n\t\t@page = 'browse'\n if params[:search].blank?\n\t\t case params[:type]\n\t\t\t\twhen \"featured\"\n\t\t\t\t\t@jobs = Job.featured\n when \"latest\"\n @jobs = Job.recently_submited(9)\n\t\t\t\...
[ { "docid": "435ea356f719fa7e962da1bda44937c8", "score": "0.7318354", "text": "def jobs\n doc = Nokogiri::XML open(@url)\n\n doc.search('//job').map { |node|\n Job.new(attributes_from(node))\n }\n end", "title": "" }, { "docid": "f57447a55e3cb12a9c0e549f08442930", ...
afcf6637d23d991ad4cced14e5e7af35
protected and private methods
[ { "docid": "1ed5b58fd37cf404155be9a7f9e82fa2", "score": "0.0", "text": "def <<(arg)\n case arg\n when Term then @terms << arg\n when Generator, Word, Integer, Rational then @terms << Term.new(arg)\n when String then splitter(arg).each{ |t| @terms << Term.new(t) }\n else\n raise Inval...
[ { "docid": "6a6ed5368f43a25fb9264e65117fa7d1", "score": "0.72764325", "text": "def internal; end", "title": "" }, { "docid": "3660c5f35373aec34a5a7b0869a4a8bd", "score": "0.71423906", "text": "def implementation; end", "title": "" }, { "docid": "3660c5f35373aec34a5a7b0869...
c8ea5b3bc4a8a431750b8f1e7a593f32
Reads from a connection, yielding chunks of data as it goes, until the connection closes. Once the connection closes, it returns.
[ { "docid": "3a7e3c8e03ee1f199c950a60c5495215", "score": "0.6678836", "text": "def chunked_read(io, timeout)\n begin\n loop do\n list = IO.select([io], [], [], @read_timeout)\n if (list.nil? || list.empty?)\n # IO.select tells us we timed out by giving us nil,\n ...
[ { "docid": "e078018858007f5a6e233be495d7df8f", "score": "0.6852542", "text": "def read_loop\n unless(reading?)\n @reading = true\n while(reading?)\n res = defer do\n Kernel.select([socket], nil, nil, nil)\n socket{|s| s.readpartial(1024)}\n end\...
1e197c15ab4077a7293fffa47978b8d8
if block not given then an enumerator is returned. What does that mean?
[ { "docid": "4fc8a874b692cab126b48bee187a1531", "score": "0.0", "text": "def my_map\r\n \tresult = Array.new\r\n \tif (self.is_a? Array) && block_given?\r\n \t self.length.times { |i| result << yield(self[i]) }\r\n \tend\r\n \tresult\r\n end", "title": "" } ]
[ { "docid": "a642bf4bab65b5af1df0d302c8b326ea", "score": "0.7398502", "text": "def each\n block_given? ? enumerator.each { |a| yield a } : enumerator\n end", "title": "" }, { "docid": "a642bf4bab65b5af1df0d302c8b326ea", "score": "0.7398502", "text": "def each\n block_give...
1bca8b7bbe0d1c127a74080fb61b4719
options :fetch_base_url a prefix prepended to all urls :throttle_bucket_size :max_fetches_per_second
[ { "docid": "9af914d3d0d5dc17254c31dd3079733c", "score": "0.6025489", "text": "def setup_fetcher(options={})\n @fetch_base_url = options[:fetch_base_url] || \"\"\n\n @fetch_count=0\n\n\n @record_directory=options[:record_directory]\n @playback_directory=options[:playback_directory]\n\...
[ { "docid": "49b151a185ddd4537cee95a86b5cc295", "score": "0.64135563", "text": "def default_fetch_size\n 100\n end", "title": "" }, { "docid": "fcd0d7a77e2a62c4a15e8162b47095d7", "score": "0.6288649", "text": "def fetch(params)\n Resque.logger.info \"Requestable.fet...
1c5a03c674b1064f8d7c0280c20340c0
drop down display shows artifactversion and appends the classifier and packaging if available
[ { "docid": "69a7f23f5c43bec553e42e3b0a605976", "score": "0.0", "text": "def option_value\r\n ret = \"#{a}-#{v}\"\r\n ret << \"-#{c}\" unless c.empty?\r\n ret << \".#{p}\" unless p.empty?\r\n ret\r\n end", "title": "" } ]
[ { "docid": "d1e141a4e8b09c9bf59eb4a004fc89dc", "score": "0.6152078", "text": "def description\n value = super\n if value.blank? and self.package_branch.version_tracker.present?\n self.package_branch.version_tracker.description\n else\n value\n end\n end", "title": "" }, { ...
a28e478681ac9d29c5dd796aa824781d
PATCH/PUT /users/1 PATCH/PUT /users/1.json
[ { "docid": "72bed3b054fe9d08070acde4f4bf7001", "score": "0.0", "text": "def update \n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'Successfully updated profile.' }\n format.json { render :show, status: :ok, location: @user }\n...
[ { "docid": "23a904e6ddd4b6b07c4b53353e78cf93", "score": "0.7225568", "text": "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "title": "" }, { "docid": "4781fa7337315133553edb54194e6202", "score": "0.7129473", "text": "def update\n render json: ...
95abee756c825edfd741d6f2affd27ea
Fetches memory utilization of host group. calculates raw available memory. Raises an error if and only if all hosts fail to report stats.
[ { "docid": "2c047da2fdbb20a1fd741944c47564d8", "score": "0.82541895", "text": "def fetch_host_group_utilization\n # Reject all non-normal state hosts.\n # Maintenance hosts report all stats so we need to filter them\n logger.debug(\"Fetching Memory utilization for Host Group #{host_...
[ { "docid": "fd386c0795a1e4401cfa5078111cd317", "score": "0.7192166", "text": "def memory(_)\n query = @client.percent_query_free(\n 'node_memory_MemTotal',\n 'node_memory_MemAvailable'\n )\n prepare_metrics('memory', @client.query(query))\n end", ...
bd3a7dfddc30bc69012064ac1ec450c4
Given a hash with numeric values, return the key for the smallest value
[ { "docid": "5bbbee885ae8d8d5f77b9b16c977a0fe", "score": "0.0", "text": "def key_for_min_value(name_hash)\n#name_hash.each do |key , value|\nif name_hash == {}\n return nil\nelse name_hash1 = name_hash.sort_by{|k, v| v}\n\n hash2=name_hash1[0]\n hash2 [0]\n end\nend", "title": "" } ]
[ { "docid": "187165074e32a7573ee53a9cabb44ed4", "score": "0.88816375", "text": "def key_for_min_value(hash)\n lowest_key=nil \n lowest_value= Float::INFINITY\n hash.each do |name,number|\n if number < lowest_value\n lowest_value=number\n lowest_key= name\n end \n end\n lowest_key\nen...
3e40682299c3022e7c73b5c37c988071
generation_number 1 is parent, 2 is grandparent and so on default is 3 for great grandparent
[ { "docid": "b6a4a9cd8ee1c24502d8e3aafdbf72d4", "score": "0.0", "text": "def ancestor_options(generation_number = 3)\n ensure_ancestor(generation_number) { |ancestor_context| context_hash(ancestor_context)[:options] || {} }\n end", "title": "" } ]
[ { "docid": "d263367c573494848f1a64a48679b6e1", "score": "0.71837527", "text": "def default_childs_number\n @@default_childs_number ||= 1\n end", "title": "" }, { "docid": "2c69fcd475b9ca4652e5527cead01914", "score": "0.67571026", "text": "def parentage\n get_parents unless @al...
f7e4d1463e26dbf7dae8028b6a5ca0ad
List all versions of the specified secret. The full secret identifier and attributes are provided in the response. No values are returned for the secrets. This operations requires the secrets/list permission.
[ { "docid": "2a8d10832ab947b197a1fbc4c1dbfaf0", "score": "0.6472265", "text": "def get_secret_versions_with_http_info(secret_name, api_version, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SecretsApi.get_secret_versions ...'\n end\n # ...
[ { "docid": "e8dd7da26c48907112dfacc3e58c586c", "score": "0.75574094", "text": "def get_secret_versions(secret_name, api_version, opts = {})\n data, _status_code, _headers = get_secret_versions_with_http_info(secret_name, api_version, opts)\n data\n end", "title": "" }, { "docid"...
1db4510a16531b5026ea00d7fd8fe056
Get VirtualBox's version string by capturing the output of 'VBoxManage v'. Returns empty string if unable to determine version.
[ { "docid": "ef214d406d5bbc16bed8ed5739f12da1", "score": "0.7659046", "text": "def get_virtualbox_version\n begin\n if windows?\n ver = `\"%ProgramFiles%\\\\Oracle\\\\VirtualBox\\\\VBoxManage\" -v 2>NULL`\n else\n ver = `VBoxManage -v 2>/dev/null`\n end\n ...
[ { "docid": "00cc2ee5502b1c778a6e4452971d4041", "score": "0.80965096", "text": "def virtualbox_version()\n vboxmanage = Vagrant::Util::Which.which(\"VBoxManage\") || Vagrant::Util::Which.which(\"VBoxManage.exe\")\n if vboxmanage != nil\n s = Vagrant::Util::Subprocess.execute(vboxmanage, '--v...
0d71c6bf63fff3fcfdcd0197ef747a86
It just checks to see if there is a current user
[ { "docid": "fa154aae4499b257fbe7aeb26a28ee79", "score": "0.0", "text": "def set_current_user\n if session[:user_id] \n @current_user = User.find(session[:user_id])\n end \n end", "title": "" } ]
[ { "docid": "4a853da9f3882e07313b4d159e462cff", "score": "0.84491175", "text": "def check_if_current_user\r\n User.current_user && User.current_user != self\r\n end", "title": "" }, { "docid": "7cc5eaf3327287f3274358ba30ebc817", "score": "0.8312305", "text": "def user_is_current\n...
f204eaf7af95187feee0d7960396127b
see however unescaped HTML markup like in "Welcome to Android!" is stripped when retrieved with getString() (
[ { "docid": "178d5ce07fc21fea5cdd51d43d232467", "score": "0.0", "text": "def format_value(value)\n value = value.dup\n\n # convert placeholders (e.g. %@ -> %s)\n value = convert_placeholders_from_twine_to_android(value)\n\n # capture xliff tags and replace them with a placehol...
[ { "docid": "1d1af439f0f745643280ecfe158828dc", "score": "0.6896944", "text": "def unescapeHTML(string)\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "fef1b6fc31c05db1ad3b2b0ecae8417e", "score": "0.6727493", "text": "def innocent(html)\n\t\th...
6854ef9d1b9d32553b74cdd743c054cf
The vertices method is used to get an array of all of the vertices that bound the face.
[ { "docid": "b7888952108b786935851783291e7b11", "score": "0.7233158", "text": "def vertices\n end", "title": "" } ]
[ { "docid": "bde71dd0f2d3f9b2011c070e2ccfaff2", "score": "0.80351335", "text": "def vertices\n @vertices\n end", "title": "" }, { "docid": "f1ccad80e886cd21596a57e694e704fd", "score": "0.800006", "text": "def vertices()\n return @vertices\n end", "title": "" }, { ...
aa93f5618d3c6dc4b0d648cc209a523a
GET /borrow_histories GET /borrow_histories.json
[ { "docid": "1180a4dd06faea7d76a74ded991007b5", "score": "0.7953485", "text": "def index\n @borrow_histories = BorrowHistory.all\n end", "title": "" } ]
[ { "docid": "d2f48adfd7276f1093a988d006f90b5a", "score": "0.68407923", "text": "def index\n @bhistories = Bhistory.all\n end", "title": "" }, { "docid": "1eebd7ddc5f642abb0b92b577621a307", "score": "0.6825843", "text": "def index\n @settlement_histories = Settlement::History.al...
d1518eec90e4ebf4c6b7b317ba330c6f
GET /psicologos or /psicologos.json
[ { "docid": "70c69e4cdbd87e67b69372c7705db2a3", "score": "0.65530473", "text": "def index\n @psicologos = Psicologo.all\n \n end", "title": "" } ]
[ { "docid": "4112047181774d87cd1f27345fe2075b", "score": "0.7109477", "text": "def index\n @logos = current_company.logos.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @logos }\n end\n end", "title": "" }, { "docid": "8f65b5d...
c56d5fea78ff00c49e3ca6a3ef6c6768
update board state param: qualified Move object
[ { "docid": "2185d44029525362aec955d6c572a310", "score": "0.75802886", "text": "def set_state(move)\n\t\n\t# update board state\n\t$board[move.x][move.y] = move.player\n\t\n\t# print board for debugging\n\tprint_state\n\t\nend", "title": "" } ]
[ { "docid": "bc6ec7dfc0843a6bb2bba463b81068ac", "score": "0.7013257", "text": "def apply_move!(position)\n board_will_change!\n\n x, y = position\n board[x, y] = current_player\n self.current_player = next_player\n\n save\n end", "title": "" }, { "docid": "e3cd0d9fabc3b2881bba...
c2d1813295e71b7890ac67de5fb43a84
Converts the tuple to string form.
[ { "docid": "0113b8700826d283708af36136fd4bcc", "score": "0.75743276", "text": "def to_s\n \"#<#<#{self.class.name}> #{to_tuple_space_form.to_s}>\"\n end", "title": "" } ]
[ { "docid": "7db02f0954dd6d4174c7332cd6838b49", "score": "0.76518077", "text": "def prettify_tuple(tuple)\n \"#{tuple.first} (#{tuple.last})\"\n end", "title": "" }, { "docid": "a3263b932376ad3d1ecba1ecd9e6db2c", "score": "0.7513398", "text": "def to_s\r\n\r\n str = \"\...
aa5151495171e3c49658aa0e4fbc9901
Instance methods begin here.
[ { "docid": "af14c4e0dfa8509d1509c3f8d7b17310", "score": "0.0", "text": "def line_items\n @line_items ||= self.send(self.class.line_items_table_name)\n end", "title": "" } ]
[ { "docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1", "score": "0.7936323", "text": "def private; end", "title": "" }, { "docid": "d88825898c6b9898e549cc4320aeaf0a", "score": "0.7523931", "text": "def initialize\n \n end", "title": "" }, { "docid": "18250542a2b1999be90...
3059c1751e2ff586a8ec5c7c4d20e568
config:remove KEY1 [KEY2 ...] remove a config var $ heroku config:add A=one Removing A and restarting myapp... done, v123 $ heroku config:add A B Adding A and restarting myapp... done, v123 Adding B and restarting myapp... done, v124
[ { "docid": "c80d8380fb829268bc24a60eef83f904", "score": "0.7804285", "text": "def remove\n if args.empty?\n error(\"Usage: heroku config:remove KEY1 [KEY2 ...]\")\n end\n\n args.each do |key|\n action(\"Removing #{key} and restarting #{app}\") do\n api.delete_config_var(app, ke...
[ { "docid": "cb5aac06aa25d9f62a83b8e8f8285ddf", "score": "0.7925518", "text": "def remove\n raise CommandFailed, \"Usage: heroku config:remove KEY1 [KEY2 ...]\" if args.empty?\n\n args.each do |key|\n display \"Removing #{key} and restarting app...\", false\n heroku.remove_config_...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "8cd75d1284f40e1b6aefe6df5c489393", "score": "0.0", "text": "def set_question\n @question = Question.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...
48c0447ad39babb17648d5d26e68bce5
POST /dockyards POST /dockyards.json
[ { "docid": "773c178e2d71b8f768d3c45c26eda036", "score": "0.6687189", "text": "def create\n @dockyard = Dockyard.new(params[:dockyard])\n\n respond_to do |format|\n if @dockyard.save\n format.html { redirect_to @dockyard, notice: 'Dockyard was successfully created.' }\n format.js...
[ { "docid": "978c66a18ff7c895435273fd33b6eca7", "score": "0.6546522", "text": "def create\n @dock = Dock.new(dock_params)\n\n respond_to do |format|\n if @dock.save\n format.html do\n redirect_to @dock, notice:\n 'Dock was successfully created.'\n end\n f...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "c32e94f5712ef6644867323639795ee1", "score": "0.0", "text": "def survey_params\n permitted_params = params.permit(:closed, :title, questions: [], options: {})\n\n {\n title: params[:title],\n closed: params[:closed] == 'on',\n user_id: current_user.id,\n ...
[ { "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...
29a53cbd12db4479b4b56bb169dfe43b
this is a breadth first search
[ { "docid": "f34f9a119d25685fac5e297969cae855", "score": "0.0", "text": "def nodes_by_level (depth, node = self.node)\n if depth == 0\n return [node]\n elsif !node.nodes.empty?\n nodes = []\n node.nodes.each {|n| nodes = nodes + nodes_by_level(depth-1, n)}\n return nodes\n el...
[ { "docid": "2e60dfa05a5492f442e4bd6b913fedd9", "score": "0.778134", "text": "def use_breadth_first(item, graph, logic_function = ->(x){graph[x].empty?} , returned = \"steps\" )\r\n search_queue = []\r\n steps = {}\r\n search_queue = search_queue.concat(graph[item])\r\n searched = []\r\n #...
369a171e2bf5dcd6f9181422e2984032
Determines the active cost for this product
[ { "docid": "d08ad78ec1794f6adb3d4ba321a87779", "score": "0.8166626", "text": "def active_cost\n if self.cost_history.length > 0\n i = self.cost_history.find_index { |f| (f.active == true)}\n if i.nil?\n activate_cost(self.cost_history.last)\n i = self.cost_history.find_index {...
[ { "docid": "ce4b5af0dac4e959364a1067090b1cef", "score": "0.7316787", "text": "def active_factor\n self.cost / 10000.0\n end", "title": "" }, { "docid": "5a34c27ce049b40a60c96ce2b11abb68", "score": "0.6861682", "text": "def active_for_sale_price product, sale_price\n product...
7058d28bd25ee4638c688986cb8f3b67
This method returns the cyphertext character for the plaintext character supplied IF a mapping exists for this pairing. If not, the return value will be '\0', so you need to check on this before you go blindly using it.
[ { "docid": "4dfd495a429f3e40364a7a38be2f9ab0", "score": "0.6851687", "text": "def cypher_char_for_plain(plain_char)\n if (idx = @legend_map.index(plain_char.downcase))\n cc = (idx + LC_A).chr\n (plain_char.ord < LC_A) ? (cc.upcase if cc) : cc\n end\n end", "title": "" } ]
[ { "docid": "c1060ccac123e752ace4eafcaa736b74", "score": "0.73814046", "text": "def plain_char_for_cypher(cypher_char)\n pc = @legend_map[cypher_char.downcase.ord - LC_A]\n (cypher_char.ord < LC_A) ? (pc.upcase if pc) : pc\n end", "title": "" }, { "docid": "e8ea51a52853dc6cb41afa399744...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "71840d25cfc134e3864ad5e7f684cad1", "score": "0.0", "text": "def health14_params\n params.require(:health14).permit(:Year, :Budget_for_ICDS_Bihar, :Funds_Released_by_GOI, :Expenditure, :Fund_Released_as_Percentage_of_Budget, :Expenditure_as_Percentage_of_Fund_Released)\n end", "ti...
[ { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.7121987", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "b32229655ba2c32ebe754084ef912a1a", "score": "0.70541996", "text": "def expected_permitted_parameter_names; end", "title": "...
33fcdf1ca128ad596c1c00ba4b67f4a6
GET /rock_parties GET /rock_parties.json
[ { "docid": "86d4e6286360bc626c870391f1d8f501", "score": "0.7839419", "text": "def index\n @rock_parties = RockParty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rock_parties }\n end\n end", "title": "" } ]
[ { "docid": "d1d9159e573f6b50757d0ddeb158621e", "score": "0.6920499", "text": "def index\n @parties = Party.all.order(:name)\n respond_with(@parties) do |format|\n format.to_json { @parties.to_json(:include => :guests) }\n format.html\n end\n end", "title": "" }, { "docid"...
c984e56c892fe2f0b14bcbc3ea8e196a
Set a given property in context. name: the property name as a string or symbol. value: the property value as an object.
[ { "docid": "7122537c349c7f54351540df7a570155", "score": "0.86937004", "text": "def set_property(name, value)\n begin\n eval(\"#{name} = #{value.inspect}\", @context_binding)\n rescue Exception\n error \"Error setting property '#{name} = #{value.inspect}': #{$!}\"\n end\n ...
[ { "docid": "6b5353f9d969f166b86ad1721746fe8d", "score": "0.7963629", "text": "def set(name, value)\n name = name.to_sym\n if @properties.include?(name)\n @properties[name].set_value(value)\n else\n add_property(name, value)\n end\n return value\n ...
ed8621e0a6ae8ffbae8903bdebc8b8a0
AGGREGATE & ASSOCIATION CARYN SAYS: you over complicated this one a lil bit! most expensive didn't need you to do any averaging!
[ { "docid": "27f813c810e38b30276df19cd714e657", "score": "0.0", "text": "def average_price\n self.menu_item.reduce(0){ |sum, price| sum + (menu_item.price/self.menu_item.count) }\n end", "title": "" } ]
[ { "docid": "8cbdbabfdd92d440ead03946a9886bd7", "score": "0.6371964", "text": "def run_aggregation\n GRADES.each_with_index do |grade, idx|\n classifier[grade].each_pair do |metric, values|\n all_values = values\n all_values += classifier[GRADES[idx + 1]][met...
e5439012a3f593226b8d0fd7c82e3e7f
Uses the mechanize web +agent+ to fetch the page holding the most recent bank transactions and returns it. This overrides (implements) +fetch_transactions_page+ in BaseScraper
[ { "docid": "e81321c75bddcb2b18925acf5282304e", "score": "0.78112733", "text": "def fetch_transactions_page(agent)\n login(agent)\n \n statement_links = (agent.current_page/\"#ctl00_MainPageContent_MyAccountsCtrl_tbl a\")\n if statement_links.blank?\n puts \"Wait a bit, and try again lat...
[ { "docid": "a565ea68357659bd1c26a5803b46ffa2", "score": "0.74101204", "text": "def fetch_transactions_page(agent)\n raise \"You must override fetch_transactions_page in your subclass of BaseScraper \" +\n \"or just subclass Scraper instead and override scrape_statement\"\n end", "...
b34189cec666f75008c275db0e689651
Search Solr for objects of a given type, for a given query.
[ { "docid": "5f5abcc918f2e41ba06b675313f15bf2", "score": "0.0", "text": "def search\n { \"rows\" => objects, \"start\" => results[\"response\"][\"start\"],\n \"total\" => results[\"response\"][\"numFound\"] }\n end", "title": "" } ]
[ { "docid": "b2e1bde34d4ef20c8525c7a592b491cd", "score": "0.786597", "text": "def direct_solr_query(type, query)\n # NOTE: in production, I believe we use 'fq' for filtering on the\n # Chef Object type (in addition to filtering based on org). We\n # don't have an easy way to access ...
2dd21b14c930335dcb783b36e5671216
choppe ce que l'utilisateur tape comme nom de dossier
[ { "docid": "c7d499e6a74047e826577112ed7ada59", "score": "0.0", "text": "def get_folder_name\n return folder_name = ARGV.first\nend", "title": "" } ]
[ { "docid": "5ac5b6498952cbc5e47d4143d2a2141b", "score": "0.63389266", "text": "def supprimerUtilisateur(nom)\n\t\t# construire le path et vérifier que le fichier existe bien\n\t\tpath = PATH_UTILISATEURS + nom.downcase()+EXTENSION\n\t\tif(!File.exist?(path))\n\t\t\traise(\"le fichier sérialisé de l'util...
09178bdafd2b9af3763584d56434818e
equal_by_dim? ::= GraphObj x GraphObj > Bool
[ { "docid": "c2b6c66cff1a244713062f722b3f8a97", "score": "0.8251717", "text": "def equal_by_dim?(g1, g2)\n check_pre((\n (graph_obj?(g1)) and\n (graph_obj?(g2))\n ))\n\n return (\n (shape1d?(g1) and shape1d?(g2)) or\n (shape2d?(g1) and shape2d?(g2))\n )\nend", "title": "" } ]
[ { "docid": "e5fff2cb6f1196092226ea21fad49c1c", "score": "0.8580733", "text": "def equal_by_dim?(graph_obj1, graph_obj2)\n check_pre((graph_obj?(graph_obj1) and graph_obj?(graph_obj2)))\n (one_dim?(graph_obj1) and one_dim?(graph_obj1)) or (two_dim?(graph_obj1) and two_dim?(graph_obj2))\nend", "titl...
47d2e97627d951b7307599fddcdb7d28
def json_request? request.format.json? end In Rails 4.2 and above
[ { "docid": "8007b6632cbe79134fb599e964bff758", "score": "0.0", "text": "def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end", "title": "" } ]
[ { "docid": "6ec40fcbff362de0b58b91dfc60f9cc1", "score": "0.94158417", "text": "def json_request?\n request.format.json?\n end", "title": "" }, { "docid": "6ec40fcbff362de0b58b91dfc60f9cc1", "score": "0.94158417", "text": "def json_request?\n request.format.json?\n end", "...
4a815f635f627645250758de130836f9
DELETE /links/1 DELETE /links/1.json
[ { "docid": "b2d27aceb5bcba9b9846e40dc1a7408c", "score": "0.74529564", "text": "def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to links_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "e0ca548a9fe183223d1415ac4a41ad19", "score": "0.7488634", "text": "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e0ca548a9fe183223d1415ac4...
76eb522c51735eca52bbfef7e8820324
value is a HealthVault::WCData::Types::CultureSpecificString255nw
[ { "docid": "a0e84b84a69541d1bf92c71bbb96a281", "score": "0.0", "text": "def remove_company_name(value)\n @children['company-name'][:value].delete(value)\n end", "title": "" } ]
[ { "docid": "0ff4b4b6ae62863319e5eab7ebe11bda", "score": "0.6159005", "text": "def localize(value)\r\n value.kind_of?(String) ? value : @template.t(\".#{value.to_s}\")\r\n end", "title": "" }, { "docid": "23e277e379691a0d5a8133ceec969653", "score": "0.5932857", "text": "def lo...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "7cc54e2b9b345785a649f45aea1b1267", "score": "0.0", "text": "def set_section\n @section = Section.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60320485", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6013371", "text": "de...
b1aef1c5b593c0b2cb7127627525a5d7
Open a page for writing and yield to the block given before calling +close_page+. +options+ is passed through to +open_page+.
[ { "docid": "df6f3d1d6392a60aaacd9f1302baea80", "score": "0.74566317", "text": "def page(options={}, &block)\n cur_page = open_page(options)\n yield(cur_page)\n close_page\n end", "title": "" } ]
[ { "docid": "376516c83719e186628a526d912d1f82", "score": "0.63965297", "text": "def new_page(options={})\n close_page\n open_page(options)\n end", "title": "" }, { "docid": "59cbb880fb4fc474859c2a32408272ac", "score": "0.5774639", "text": "def page!\n save_and_open_pag...
ddca555c6464e25becc299e732c633c4
Returns an Enumerable containing files that have been added. File path starts at git base directory
[ { "docid": "fe90b4a7584b5ec5e9e3392eb620d4e1", "score": "0.0", "text": "def added; end", "title": "" } ]
[ { "docid": "6a993b0298bf936549aacf9027b5336b", "score": "0.8295007", "text": "def added_files\n @repository.chdir do\n @added ||= @repository.status.added.to_a.map(&:first)\n end\n end", "title": "" }, { "docid": "95298acfe200eff6db3a74bca182cadf", "score": "0.8088549...
80c7ccd8b5695a4c752913da6fba51b6
Set up our CouchDB design document
[ { "docid": "c3f76b7cd5f9ae8a855d4fa9dffbf2bd", "score": "0.74418646", "text": "def create_design_document(couchdb=nil)\n couchdb ||= Chef::CouchDB.new\n couchdb.create_design_document(\"users\", DESIGN_DOCUMENT)\n end", "title": "" } ]
[ { "docid": "4a845cd70257c28332ce81f34ba64b90", "score": "0.70284605", "text": "def construct_view()\n design_docs = [\"couchdb_views/content_views.json\"]\n design_docs.each { |design_doc|\n #Read the file\n content = File.read(Pathname.new(File.dirname(__FILE__) + \"/../../\" + design_d...
0b903334990c640a3b0ab790b98deec5
Removes element from queue and returns that element
[ { "docid": "6a80d022e7b7a8da3414574c1e332a57", "score": "0.0", "text": "def dequeue\n # Refill outbox by popping each element from inbox and pushing onto outbox\n if @outbox.empty?\n\n while @inbox.length > 0 do\n @outbox.push(@inbox.pop)\n end\n end\n\n return @outbox.pop\n...
[ { "docid": "41c52b6e4c635d52fde889d17c9b69a8", "score": "0.8406533", "text": "def dequeue\n element = @queue.shift\n delete(element)\n element\n end", "title": "" }, { "docid": "668ae4b3ff94184c8f4564c91356c839", "score": "0.8252301", "text":...
f331c5d5b68ed179d641d296d01e4aed
returns a clause suitable to select a subset of the feature list
[ { "docid": "cc2824232377f1b71c1c163a4e77cc9b", "score": "0.0", "text": "def permitted_features( to_modify = true, check_var = :id )\n p = to_modify ? permission4_groups.permission_to_modify : permission4_groups.permission_to_access?\n if p.empty? then\n return nil # none\n else\n retu...
[ { "docid": "eab6d4ef662902de98197641d2429473", "score": "0.73390794", "text": "def get_feature_subset\n org_features = get_features\n subset = org_features.sample(org_features.size/2)\n \n subset\n end", "title": "" }, { "docid": "6ecb6a339846eb9e563e471b78c602d8", ...
da208a02c5e6caf6b7f1aa13e12a08c2
Returns distance to another user in kilometers
[ { "docid": "251e2703c6b6cc86d250c57240ab13fe", "score": "0.71429545", "text": "def distance_to(user_or_review)\n return FAR_AWAY if [self.lat, self.lng, user_or_review.lat, user_or_review.lng].any?{|v| v.blank? }\n a = Geokit::LatLng.new(self.lat, self.lng)\n b = Geokit::LatLng.new(user_or_revi...
[ { "docid": "2f98792f97105d71a1d94129caebbe7f", "score": "0.757279", "text": "def kilometers\n self.distance\n end", "title": "" }, { "docid": "6c5b2881967b7e41c8d1873f20aeed6d", "score": "0.74728674", "text": "def estimated_distance\n user_location = @instance_options[:use...
c9bb294b894c3a2ba8a0307b21619c86
DELETE /stores/1 DELETE /stores/1.xml
[ { "docid": "46244ad876fe514ec6069268079ceb71", "score": "0.7566201", "text": "def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to(stores_url) }\n format.xml { head :ok }\n end\n end", "title": "" } ]
[ { "docid": "b36a26bc40f145c3a39811243dfaa4df", "score": "0.7547538", "text": "def destroy\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to(stores_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "7e7c2a45f98206a09645b9c2ac50...
c1d5d74fb43f18bc9b9716a0b09d9251
adds integers in an array and returns sum
[ { "docid": "28de6f793257df07c6bf1a985deaa15c", "score": "0.0", "text": "def sum_array(integers)\n integers.inject {|sum, num| sum + num}\n \nend", "title": "" } ]
[ { "docid": "30a212ec66e26f24302d95d5e67831a2", "score": "0.8356973", "text": "def sum_array(integer_array)\n return integer_array.reduce(:+)\nend", "title": "" }, { "docid": "7a3cc485bd41f867ef580f93efd899f0", "score": "0.8343727", "text": "def sum(arr_of_int)\n arr_of_int.reduce(:...
ab115c8599563acd5cc3af779087e0f9
The response format is different for v3 and v4. In v3, it is a camel case like `totalItems` and `items`, but in v4, it is snake case like total_affected_items. offset_request will fill this gap. This function is used if there are `affected_items` or `items` in the response.
[ { "docid": "34a0c45a961b13a9580427338e7d2c15", "score": "0.6756055", "text": "def offset_request(method, path, options = {})\n items = []\n data = send(method, path, options)\n total_items = api_version == 3 ? data.totalItems : data.total_affected_items\n\n return data.items ...
[ { "docid": "b8cdc10fc3fa41ecb57e58fdb97cd819", "score": "0.57731706", "text": "def limit_response\n if params[:offset].present?\n @offset = params[:offset].to_i\n end\n if params[:limit].present?\n @limit = params[:limit].to_i\n end\n @offset ||= OFFSET\n @limit ||= LIMIT\n ...
1664b6d61a15605982552e410fdac53c
Return the max Y value for all nodes in the set
[ { "docid": "bfcf55a68f394a356995805c351287ff", "score": "0.77889967", "text": "def max_y\n @max_y ||= @tsp_data.map{|_,v| v[:y]}.max\n end", "title": "" } ]
[ { "docid": "8f5c75cae234d795506f6c9747c5e3c1", "score": "0.7967288", "text": "def yMax\n yMax = 0\n children.each do |child|\n yMax = child.y if (child.y > yMax)\n end\n return yMax\n end", "title": "" }, { "docid": "912ec9cd02a1bb21d4d59bb646c46f87", "score": "0.766461...
7b815eaca26aef5dd478733ad8f03f3b
convert the sippet of Phrase (key) into an actual
[ { "docid": "1fd9dbc9e03647bb9b5bc4aca9609542", "score": "0.0", "text": "def convert(snippet, phrase)\n #Randomly sort words and shuffle sort_by {rand}\n rand_words = WORDS.sort_by {rand}\n #generate class names using the craft names , and replace the with \"/###/\"\n class_names = craft_names(rand_w...
[ { "docid": "afef454703d793c7f606d34b641805c4", "score": "0.63793415", "text": "def extract_key(keypair)\n keypair[/\"([^\"]*)\"/].gsub(\"\\\"\", \"\")\nend", "title": "" }, { "docid": "aa750ce93379e33af4ad06542cc34fb2", "score": "0.6210096", "text": "def translate_key(key)\n key\...
dec36c5557f539791e7caecdde6af3a1
TODO: Account linking. Example, if a user has signed in via twitter using the
[ { "docid": "85534439146d2c51b9964a2e549f38cc", "score": "0.0", "text": "def create\n omniauth = request.env['omniauth.auth']\n authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])\n if authentication\n flash[:notice] = \"Signed in successfully\"\n...
[ { "docid": "b798e130c0ede0b1d2dba423d9751176", "score": "0.6724589", "text": "def twitter_login?\n\t\tself.uid ? true : false\n\tend", "title": "" }, { "docid": "1638f8f3fbf748916ce56b77cb693eb9", "score": "0.665354", "text": "def link_twitter\n\n end", "title": "" }, { ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "913467371005b843eaf3c395be9cb098", "score": "0.0", "text": "def skill_category_params\n params.require(:skill_category).permit(:skill_category_name, :sort_order)\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...