query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
6843365fba5f2f026b6e61cea8ff6427
Factory Method for the Host Pool
[ { "docid": "df79e92e4bc9c1bbc4b62adae6038ab3", "score": "0.6305865", "text": "def factory(element_xml)\n OpenNebula::Host.new(element_xml,@client)\n end", "title": "" } ]
[ { "docid": "f244ccb8b8550ac63d4556bb8a3464bc", "score": "0.7298368", "text": "def pool\n @pool ||= Beaneater.new(\"#{@host}:#{@port}\")\n end", "title": "" }, { "docid": "471cc75573dc5ae66fc0f72436e4603a", "score": "0.7116237", "text": "def initialize(provider, p_template = nil)\...
fd05a56a0d9e38c1c8a3f83c98ccb796
Read status of a transport node Read status of a transport node
[ { "docid": "2c6767261d24ec36381de936594cba6c", "score": "0.5941211", "text": "def get_transport_node_status_with_http_info(node_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TroubleshootingAndMonitoringApi.get_transport_node_status ...\"\n ...
[ { "docid": "23cdb8d6e5e8d91ad6054ab1cccef4ed", "score": "0.6698793", "text": "def status\n read ? 'readed' : 'unreaded'\n end", "title": "" }, { "docid": "c3cc228b5c09b1f9217433bddbc97630", "score": "0.6500745", "text": "def read?\n (status == READ)\n end", "title": "" ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "a663e7c80889b84310fc2e25b82be228", "score": "0.0", "text": "def information_params\n params.permit(:data_type, :name)\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...
f726e7f7e906306beadeff1a3b86983d
Returns human readable attribute name
[ { "docid": "0bbe7f171c4b92d4e73ad07995f3add3", "score": "0.7844307", "text": "def human_attribute_name(attribute_key_name) #:nodoc:\n attribute_key_name.humanize\n end", "title": "" } ]
[ { "docid": "cdb5884e6a2971e950f27e5b047c4296", "score": "0.87279713", "text": "def name\n attribute_name.humanize\n end", "title": "" }, { "docid": "cdb5884e6a2971e950f27e5b047c4296", "score": "0.87279713", "text": "def name\n attribute_name.humanize\n end", "title": "" ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "7fb73cc3d21533047903e68e0f2920da", "score": "0.0", "text": "def set_w_transaction\n @w_transaction = WTransaction.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163163", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045976", "text": "def action_hook;...
40001d914d1d856088beee503bc7ddde
I worked on this challenge with Abe & Fatma. I spent 1 hour on this challenge. 4. Reflection =begin Were you successful in breaking the problem down into small steps? Yes, we broke the problem down into the core pieces of identifying whether new elements needed to be added, adding those, and then returning them. Once y...
[ { "docid": "779778e4668f978e0b6811aea9083bbf", "score": "0.0", "text": "def pad!(array, min_size, value = nil)\n while array.length < min_size\n array.push(value)\n end\n return array\nend", "title": "" } ]
[ { "docid": "82785ef397f59bb366895a90814ca529", "score": "0.533916", "text": "def basic_12 (array_process)\n array_process.shift\n array_process.push(0)\nend", "title": "" }, { "docid": "a697868ea8b2d624980e428f28dd3136", "score": "0.53353035", "text": "def array_1(array1)\n array1...
bbcd434615f59edab9fca1397a1b54c5
GET /applications/1 GET /applications/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "9a01a8dc2ffdcf22c5eebb10f4508832", "score": "0.7972404", "text": "def retrieve_applications()\n start.uri('/api/application')\n .get()\n .go()\n end", "title": "" }, { "docid": "577f3e7e098b0f1d572897563503246c", "score": "0.7953715", "text": "...
7505a36ba35cd699b4fc2418719fa942
This releases semaphore unconditionally
[ { "docid": "1968942f8814cf24eb9994d25d2a81cf", "score": "0.7733995", "text": "def release_semaphore\n # NOTE: There is a chance we remove the lock created by another worker after our own expired.\n # This is OK since the lock is cooperative and not necessary (real locking is done through contentio...
[ { "docid": "8345680e6d7de36e45a4de9ef0ac522a", "score": "0.8668626", "text": "def release\n semaphore_state\n try_release\n end", "title": "" }, { "docid": "14e232fee9c26db8dee31656f54f3394", "score": "0.7109113", "text": "def do_if_can_acquire_semaphore\n if try_acqu...
78324c018f42cd66edd2837f3de2fbdd
action to update a user's password. only allowed if user signed in via a password reset key, or can confirm their own credentials
[ { "docid": "b15e9438de123ead104ebdfda5acfd2a", "score": "0.7818334", "text": "def update_password(user = {}, current_password = nil)\n @user = session.user\n \n # make sure user changing password knows existing one or logged in via a reset key\n raise Merb::ControllerExceptions::Forbid...
[ { "docid": "a5d0e139f8bf3a0de8ca0e269709a321", "score": "0.8557203", "text": "def password_update\n\t\t# Update the user password attributes\t\n\t\t@user.update(user_params)\n\t\t# After updating the password redirect to the manager user page\n\t\tredirect_to manage_user_admin_index_path\n\tend", "t...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "8254ec44eee03dfe1c9cb48920354244", "score": "0.0", "text": "def set_task\n @task = Task.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60322535", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6012846", "text": "de...
86b93b3a22fb85185f93c1605ce97319
GET /commentaries GET /commentaries.json
[ { "docid": "4e64e34921c468a950f2fe2f9ff56f41", "score": "0.0", "text": "def index\n @stocks = Stocks.all\n end", "title": "" } ]
[ { "docid": "2aabead403ef97ff2d63273e2a3cb363", "score": "0.69143087", "text": "def index\n @commentaries = Commentary.all\n end", "title": "" }, { "docid": "98a239d098f2b1de9281a1a22f6806a1", "score": "0.681851", "text": "def index\n @commentable = find_commentable\n @comme...
414e4fee726732e8797e8c6f963083ca
DELETE /contacts/1 DELETE /contacts/1.xml
[ { "docid": "4f72b9b10a0b0b13123737b429903f9d", "score": "0.0", "text": "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n respond_with(@contact)\n end", "title": "" } ]
[ { "docid": "db31580cc47cc5b92920ab8f13760712", "score": "0.7274086", "text": "def destroy # DELETE /contacts/:id\n @contact = Contact.find(params[:id])\n @contact.destroy\n end", "title": "" }, { "docid": "126ae804bd53d8fdd62697fec51c7e7f", "score": "0.72086775", "text":...
ccf4283921a003f22b9dd6c1b8ee4aa9
See "Following users" for the full implementation.
[ { "docid": "748f89c622f815c98a20a79b4556f42b", "score": "0.0", "text": "def feed\r\n Post.where(\"user_id = ?\", id)\r\n end", "title": "" } ]
[ { "docid": "58d7d0cc03d3bdc8dc859173ccf5afb5", "score": "0.76385987", "text": "def user_following\n show_user_follow(:user_following)\n end", "title": "" }, { "docid": "03ba01b49cf2cc0c3d25e6140f1ca669", "score": "0.7586985", "text": "def followers\n \n end", "title": "" ...
d947537fdcfb42cdc2841e80f12233e7
True if two docstrings have the same tags, regardless of any other differences.
[ { "docid": "33eb336ecb6c058ec079b6b5c2faed81", "score": "0.7910413", "text": "def compare_docstring_tags(d1, d2); end", "title": "" } ]
[ { "docid": "cfffec05fb02946451e94833cc4dfd7b", "score": "0.69611895", "text": "def documents_equal?(a, b)\n normalize_document(a) == normalize_document(b)\n end", "title": "" }, { "docid": "ae52ffa574abe85105e3f6595160ba04", "score": "0.6688094", "text": "def tags_match?(othe...
5caa189d9418631c6dcef08d305b9dd1
POST /pdks POST /pdks.json
[ { "docid": "0c9dfa9a9b39130572b7d50cb03faa62", "score": "0.64108676", "text": "def create\n @pdk = Pdk.new(pdk_params)\n\n respond_to do |format|\n if @pdk.save\n format.html { redirect_to @pdk, notice: 'Pdk was successfully created.' }\n format.json { render action: 'show', sta...
[ { "docid": "a61d141e0f3bab35bbc26404196b2557", "score": "0.61443454", "text": "def index\n @pdks = Pdk.all\n end", "title": "" }, { "docid": "eeb04755cddd99e693227715f521481b", "score": "0.57300615", "text": "def pdk_params\n params.require(:pdk).permit(:name, { :layer_ids =...
42cb9e79f7a314fda757e745770de990
Provide a detailed, user friendly representation source://twilioruby//lib/twilioruby/rest/serverless/v1/service/environment/variable.rb249
[ { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.0", "text": "def inspect; end", "title": "" } ]
[ { "docid": "671c5d7a6fffa471ac421094ec569ebb", "score": "0.6236912", "text": "def core_environment_variables\n core_client.environment_variables\n end", "title": "" }, { "docid": "687234555e81dfdc5be4abe82190c6d0", "score": "0.6194682", "text": "def env_vars\n ...
87d84f6cece89ff1c68932e7353883c1
disegna le barre di caricamento della skill per i turni
[ { "docid": "bf338306d8ccf5b0bca09b295debc64b", "score": "0.0", "text": "def draw_skill_turn_delay(x, y, length, skill)\n bar_len = length / skill.turn_delay - 3\n left = @actor.turn_skills[skill.id] || 0\n charged = skill.turn_delay - left\n\n draw_skill_loading_bars x, y, bar_len, H87_Delay...
[ { "docid": "f92943f6e338bcd52765d6307fd4429b", "score": "0.6835903", "text": "def pick_skill; end", "title": "" }, { "docid": "a8ff565a4433fe4dbb65388d768723fb", "score": "0.66423124", "text": "def turn_skills\n @turn_skills ||= {}\n end", "title": "" }, { "docid": "a...
69372b105032a5fd4e4e12b5d05c7b97
Returns a link that opens a modal confirmation to delete window. === Example:
[ { "docid": "a2ba89e75396074380482b97c751d02f", "score": "0.6857949", "text": "def link_to_confirm_dialog(link_string = \"\", message = \"\", url = \"\", html_options = {})\n link_to(link_string, url,\n html_options.merge(\n \"data-alchemy-confirm-delete\" => {\n t...
[ { "docid": "3594c7099e05d8f742f13d5dbf0fb094", "score": "0.7297586", "text": "def delete_link(name,*args)\n button_to \"Delete details for (#{h(name)})\", :method => :delete\n end", "title": "" }, { "docid": "dcbd821374d1d38cb17700e345fef656", "score": "0.7196299", "text": "d...
48d650138462b9f4c04eab6635fbf2f9
DELETE /prenoms/1 DELETE /prenoms/1.json
[ { "docid": "20ef3c240b0a0cc4fa00dadb70db05e2", "score": "0.7274579", "text": "def destroy\n @prenom.destroy\n respond_to do |format|\n format.html { redirect_to prenoms_url, notice: 'Prenom was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "...
[ { "docid": "506393cb5b1185455c36cd0efef16d79", "score": "0.6978998", "text": "def destroy\n @prestamo = Prestamo.find(params[:id])\n @prestamo.destroy\n\n respond_to do |format|\n format.html { redirect_to prestamos_url }\n format.json { head :no_content }\n end\n end", "title...
1e758e46030114b2a7067fbd8e13348c
list of friends methods end
[ { "docid": "6b142c81f466210c89616f35db7e04fe", "score": "0.0", "text": "def new\n\t\t@parent = parent_user\n\t\t@child = Child.new\n\tend", "title": "" } ]
[ { "docid": "4d1dc623b8f8257c7223c200ef9c3e33", "score": "0.7945552", "text": "def friends\n\tend", "title": "" }, { "docid": "eb21453d5ab865876932b018ba45948f", "score": "0.7822429", "text": "def all_friends\n \n end", "title": "" }, { "docid": "85520a893c805c08ce5dd10...
719a2026024660cfbf466e985d80cc9d
Write MOF to File via INTO DUMPFILE
[ { "docid": "d2f82250df9d2f1c1e31630e43b16b9a", "score": "0.6596039", "text": "def write_mof_file(dbc, bin, dest)\n payload = bin.unpack(\"H*\")[0]\n begin\n dbc.query(\"SELECT 0x#{payload} INTO DUMPFILE '#{dest}'\")\n puts \"Appears things were a success\".light_green + \"!\".white\n return t...
[ { "docid": "10f3af035898fb676a753583f7cd8bb3", "score": "0.6355536", "text": "def dumpToFile(file)\n open(file,\"w\"){|strm|\n Marshal::dump(self, strm) ;\n }\n end", "title": "" }, { "docid": "3419609bbc96fe934dcbfc881742539c", "score": "0.6307919", "text": "def ...
f71aa588805f2f1bbd26ad6e5a75c0e5
Returns the children of this term as a tree. Will include the current term as the 'root' of the tree.
[ { "docid": "091b72718b31317a207ee6b483305e5c", "score": "0.56411684", "text": "def child_tree\n child_check\n child_tree = self.clone\n child_tree.removeFromParent!\n child_tree\n end", "title": "" } ]
[ { "docid": "a4c114806664a52c30139146da2b4154", "score": "0.7477105", "text": "def tree\n return [self] if @children.empty?\n\n @children.each_with_object([self]) do |child, tree|\n tree.concat(child.tree)\n end\n end", "title": "" }, { "docid": "e13fd0dab5057ed574821...
c3a94b97615b0e7efe649738f87c68d6
catalog_category.currentStore Set/Get current store view Return: int Arguments: mixed storeView Store view ID or code.
[ { "docid": "118e52910b426f197db9a22ac54f2735", "score": "0.61581767", "text": "def current_store(connection, *args)\n commit(connection, \"currentStore\", *args)\n end", "title": "" } ]
[ { "docid": "cf4107635c3266d5fd0ebff43d5321bf", "score": "0.61725056", "text": "def current_store(*args)\n commit(\"currentStore\", *args)\n end", "title": "" }, { "docid": "cf4107635c3266d5fd0ebff43d5321bf", "score": "0.61725056", "text": "def current_store(*args)\n ...
26d8e7ab6f2fa84b8a8746a377fa3d7a
DBus loop is run in a separate thread; both are blocking loops
[ { "docid": "d02f6d705439cf6da845d248db5992df", "score": "0.0", "text": "def start\n Thread.new { @main.run }\n Gtk.main\n end", "title": "" } ]
[ { "docid": "bb10c77cdedbf16026ec8859140f9466", "score": "0.7813734", "text": "def run_loop\n loop = DBus::Main.new\n loop << @object.bus\n loop.run\n end", "title": "" }, { "docid": "0c2888d5ec255906833d97c0619ba81a", "score": "0.70438266", "text": "def run\n ...
c92f8590e6c5e5959f562be15d63d6c4
Creates provider based on host template and unassign all nic IP
[ { "docid": "27567ef9e9bcf4a26eb066f1a8c38afe", "score": "0.6384988", "text": "def unassign\n provider = ElasticDriver.provider(@provider, @host)\n\n return if provider.nil?\n\n @vm.each_nic_all do |nic|\n next if nic[:vn_mad] != DRIVER\n\n next if hot_attach? &...
[ { "docid": "471cc75573dc5ae66fc0f72436e4603a", "score": "0.62640744", "text": "def initialize(provider, p_template = nil)\n super(p_template)\n\n @pool = OpenNebula::HostPool.new(@client)\n @type = 'host'\n @provider = provider\n end", "titl...
8a6b1cd8789c340faba92dfc02489297
passing parameters to a block
[ { "docid": "dd56cc4bdd09a6621f50743174cda360", "score": "0.0", "text": "def give(&block)\n block.call('money','jewelry')\nend", "title": "" } ]
[ { "docid": "d2e6d841503a5f22776bf8f9b83ae1f9", "score": "0.8182181", "text": "def block_arg; end", "title": "" }, { "docid": "faf7f2997230cf4beccaa7233080ea9d", "score": "0.80866957", "text": "def pass_block (&block)\n\tblock.call\nend", "title": "" }, { "docid": "cbe6aea...
4189d0371a4e5dc416ebd4508b8d351c
intersect double dispatch for Lines
[ { "docid": "841ceb142480a70f0714943fa83f0aa2", "score": "0.76461244", "text": "def intersectLine l\n l.intersectLineSegment(self) \n end", "title": "" } ]
[ { "docid": "1ec6a94dd43ddf516beadec41a52af8d", "score": "0.77688557", "text": "def intersectWithSegmentAsLineResult seg # seg is e1, self is e2 (a line) - receive dynamic dispatch\n seg # the segment e1 is on the line e2 because they coincide\n end", "title": "" }, { "docid": "4390aecc...
3194a68bf0b6746e69f55dbb616102bb
The block which defines the ability using cancan. Example ability do |ability, user| if user ability.can :show, Whatever end end
[ { "docid": "1b969954a73aabd39d59129f935204d7", "score": "0.60485744", "text": "def ability\n @config[:ability]\n end", "title": "" } ]
[ { "docid": "819b8a4dee47122f37066c618f232f5a", "score": "0.7102099", "text": "def can(user_urn, capability)\n user = CanDo::User.find(:id => user_urn)\n has_permission = user && user.can(capability)\n if block_given?\n if has_permission\n return yield\n end\n if @@cannot_bl...
a70bf678b262f0149a6f0a164107f10f
give 4 cards to each player, one card at a time you hand out the cards
[ { "docid": "4cfc488e49dd31cc0e72d6a873f6e44e", "score": "0.0", "text": "def game_value(cards)\n sum = 0\n cards.each do |card|\n sum += card.game_value\n end\n sum\nend", "title": "" } ]
[ { "docid": "28714ac18deacaa2e588faec1bd5695e", "score": "0.8168209", "text": "def deal_hand\n 3.times do \n @players.each do |player|\n player.hand.draw_card\n end\n end\n end", "title": "" }, { "docid": "0cfa8f82a7c6103929a9c...
7b1a2d74bf8fd513d4f9e1088068c274
Report a message and check if we should be killed. Will kill if `should_kill?` is true. Should only be called by a worker.
[ { "docid": "00bd168ce626a3093a9b154a4d95a511", "score": "0.0", "text": "def tick(*messages)\n update_status(*messages, status: STATUS_WORKING)\n\n kill! if should_kill?\n end", "title": "" } ]
[ { "docid": "9741597cee8dae624a942aa0369bb540", "score": "0.6385362", "text": "def should_kill?\n Resque::Plugins::Status::Hash.should_kill?(self.job_id)\n end", "title": "" }, { "docid": "26fcb0e1e28d0b5815d6fdd91d888fe1", "score": "0.6302454", "text": "def should_kill?\n ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "49a1610fac633a8f606b755e6a83b6b2", "score": "0.0", "text": "def set_point\n @point = Point.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.603186", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6015241", "text": "def ...
d25bcd5a00b5bf3bb0c838374caa51d1
before_action :validate_user!, only: [:update, :destroy]
[ { "docid": "f967807064a768062e004ef515204de2", "score": "0.0", "text": "def index\n \t@activities = Activitie.where(user_id: current_user.id)\n respond_to do |format|\n format.html\n format.csv { send_data @activities.to_csv }\n #format.xls { send_data @activities.to_csv(col_sep: \"\\...
[ { "docid": "bd46924e94cd0c3a9c1e13f2b9df5003", "score": "0.6958084", "text": "def before_validate\n end", "title": "" }, { "docid": "fe629da8716f8eaae6f7c4204d01305a", "score": "0.6750431", "text": "def validate\n before_validate\n end", "title": "" }, { "docid": "...
6a57d55b891dded8f4851539e4b81220
REturns true, if only some attributes are not blank for the given ActiveRecord object.
[ { "docid": "29c1dc0118a02ba23c9adc28a13e915a", "score": "0.5939131", "text": "def only_some_attributes_filled?(ar)\n ar.attributes_filled < AppConfig['contact_info.complete_percentage'].to_f\n end", "title": "" } ]
[ { "docid": "cfe95679b26bcbe21348c3b932b9fec2", "score": "0.7559214", "text": "def blank?\n attributes.values.all?(&:blank?)\n end", "title": "" }, { "docid": "cfe95679b26bcbe21348c3b932b9fec2", "score": "0.7559214", "text": "def blank?\n attributes.values.all?(&:blank?)\...
4a1d69b121aee1e34598c22253dc0ea9
PUT /organization_files/1 PUT /organization_files/1.json
[ { "docid": "f1da7699eba2ad6513e098c567e36614", "score": "0.7501963", "text": "def update\n @organization_file = OrganizationFile.find(params[:id])\n\n respond_to do |format|\n if @organization_file.update_attributes(params[:organization_file])\n format.html { redirect_to @organization_...
[ { "docid": "26cef57ca9a24e229d238a28fbd3159c", "score": "0.65062064", "text": "def create\n @organization_file = OrganizationFile.new(params[:organization_file])\n\n respond_to do |format|\n if @organization_file.save\n format.html { redirect_to @organization_file, notice: 'Organizatio...
2b1d7065daa21b7d01b08d28bd4d3c5d
Adds a RequiredDocument to the list documents required from the client
[ { "docid": "1244abea9e50ad1f7833c74820c59c46", "score": "0.8141823", "text": "def with_required_document(required_document)\n Validation.assert_is_a(RequiredDocument, required_document, 'required_document')\n @required_documents.push(required_document)\n self\n ...
[ { "docid": "32e304c504988d226e4daca54bf6356b", "score": "0.61314356", "text": "def add_require(req)\n #TODO: Implement config of requires allowed\n raise Exception.new(\"Is not a require valid!\") unless req =~ /\\S+/ \n @requires << req\n @requires.uniq!\n end", "title": "" ...
bd79895dbb7567fd4fb82868efe54f1b
Handle record paging Params: start > Starting record count > Number of records to fetch
[ { "docid": "c7f97e73aba12af620e786bc469bb979", "score": "0.8385862", "text": "def pageRecords\n start = params.has_key?(:start) ? params[:start] : 0\n count = params.has_key?(:count) ? params[:count] : 1000\n\n @records = @records.offset(start).limit(count)\n end", "title": "" } ]
[ { "docid": "a199cc0b116936dfce4dfee87f663e60", "score": "0.7176515", "text": "def paginate_records (records, current_page, rows_per_page)\n\t\tif records.length > rows_per_page\n\t\t\tstart = (current_page - 1) * rows_per_page\n\t\t\t\n\t\t\t# Show the last full page if the start position will cause rec...
766893d521c65c4ec965b0f21db3fafb
Yields a block, checking for any errors in a request. If no errors are detected, decodes JSON and returns the result.
[ { "docid": "d76301c35c6e5aa953614520093d87e8", "score": "0.6219005", "text": "def error_check\n response = begin\n yield\n rescue RestClient::Exception => e\n e.response\n end\n\n data = parse_response(response)\n if data.is_a?(Hash) && data[\"error\"...
[ { "docid": "9a9919a3c1a6c21360bd7a27e8408021", "score": "0.65783554", "text": "def api_request(&block)\n response_body = begin\n response = block.call\n response.body\n rescue RestClient::Exception => e\n puts \"I have #{e.inspect} with #{e.http_code}\"\n if e.http_code == 307\...
38a87b01947f5f25e053acce716cb275
first message sent by client to server
[ { "docid": "55c7cf84deac8788c843182f222bd7bd", "score": "0.69105935", "text": "def send_first_message\n res = connection.get('about') do |req|\n req.headers['Authorization'] = \"SCRAM handshakeToken=#{@handshake_token},data=#{Base64.urlsafe_encode64(first_message).tr('=','')}\"\n ...
[ { "docid": "61655e6580dd47461d2e936a30be2fed", "score": "0.75341606", "text": "def next_message\n socket = (defined? @current_client) ? @current_client : @socket\n socket.recvfrom(MAX_MESSAGE_LENGTH).first\n end", "title": "" }, { "docid": "5e7eefb8154121dec98fe5dca9faca6f", ...
4357f2f430d493bacb326262754d929f
Question 5: a method called back_around Given a string, move the last character to the beginning. "cat".back_around => "tca" "hello".back_around => "ohell"
[ { "docid": "3c7359a2b9e354845efd09345c97b0d9", "score": "0.7238568", "text": "def back_around(string)\n\ta = string.split('')\t\n\tb = a.pop\n\ta.unshift(b)\n\treturn a\nend", "title": "" } ]
[ { "docid": "0cf32b8fb8eed5b2a348d73935c75edb", "score": "0.7321089", "text": "def reverse_inplace(s)\n return s if s.length <=1\n return s[-1] + reverse_inplace(s[1..-2]) + s[0]\nend", "title": "" }, { "docid": "63f7f7a257fa5ceaacfe68b1fc9e6dad", "score": "0.7313763", "text": "def ...
7617303a2209b9dac9a043f3b3667906
PUT /users_teams/1 PUT /users_teams/1.xml
[ { "docid": "3c7b7b53bd1ff577d1b10f2832815f80", "score": "0.68996584", "text": "def update\n @users_team = UsersTeam.find(params[:id])\n\n respond_to do |format|\n if @users_team.update_attributes(params[:users_team])\n format.html { redirect_to(@users_team, :notice => 'Users team was s...
[ { "docid": "ac24ddd9c596f06f7fbf5b97e6449118", "score": "0.70416766", "text": "def update\n @teams_user = TeamsUser.find(params[:id])\n\n respond_to do |format|\n if @teams_user.update_attributes(params[:teams_user])\n flash[:notice] = 'TeamsUser was successfully updated.'\n for...
f6d1002cd157bd1c448164659f343bf0
User can't leave more than 1 review per reservation
[ { "docid": "fd06852ac9a16f70bc2f48a952cfacae", "score": "0.7430063", "text": "def duplicate_review\n @reservation = Reservation.find_by(id: params[:reservation_id])\n return unless @reservation.reviews.any?\n\n redirect_to @reservation\n flash[:danger] = 'You already left a review for this b...
[ { "docid": "c7cd451741ea75503e6dc7c86423c6df", "score": "0.75076073", "text": "def resNotPassed\n if self.reservation\n if self.reservation.checkout.future?\n errors.add(:review, \"cannot post a review before reservation has completed\")\n end\n end\n\n\n end", "title": "" ...
ebdaff7779e89f1f2df439840656a008
Initialize an adapter with the given access token. access_token A String describing an access token. Returns an Adapters::Facebook instance.
[ { "docid": "29768daea39559478811481c4d1bd45b", "score": "0.8040359", "text": "def adapter access_token\n Services::Facebook::Adapter.new facebook_id, access_token\n end", "title": "" } ]
[ { "docid": "e0bda488ff74d803e94a7cdc72ac09b7", "score": "0.65260303", "text": "def initialize(token, secret = nil)\n @api = Koala::Facebook::API.new(token)\n end", "title": "" }, { "docid": "d0ff5693d72c38bc993690304446fad9", "score": "0.6397175", "text": "def initialize(acce...
8d2f51db040bfbe8320da42eff6dc04d
POST /erp_integrations POST /erp_integrations.json
[ { "docid": "ddf3572ab6f9961c09f7c532848755fc", "score": "0.68727326", "text": "def create\n @erp_integration = ErpPriceIntegration.new(erp_price_integration_params)\n\n respond_to do |format|\n if @erp_integration.save\n format.html { redirect_to admin_erp_price_integrations_pa...
[ { "docid": "f0b600e11f41387dca3d109a4ce87d76", "score": "0.6589367", "text": "def create\n @integration = @service.integrations.new(integration_params)\n\n respond_to do |format|\n if @integration.save\n format.html { redirect_to team_integration_path(@integration.team, @integration), ...
6d05a3565428f2d0b035db2c407f8e11
PATCH/PUT /company_products/1 PATCH/PUT /company_products/1.json
[ { "docid": "247f9991d1dc5776e2cf98b6eb4a6596", "score": "0.69523233", "text": "def update\n respond_to do |format|\n if @company_product.update(company_product_params)\n format.html { redirect_to @company_product, notice: 'Company product was successfully updated.' }\n format.json ...
[ { "docid": "1c35f89f4e93251128bbf53c08021b3d", "score": "0.7100993", "text": "def update\n @company_id = company_params[:company_id]\n @reponse = HTTParty.put(\"https://rails-api-ipo.herokuapp.com/api/v1/companies/#{@company_id}.json\",\n :body => {:company_name => company_params[:company_name]...
3c7a82c362d623864b734aa1e6a7d1f1
parse an address to a hash
[ { "docid": "696975f6b2b3ea38d42bb53ed96e3444", "score": "0.6158119", "text": "def parse_address(address)\n address = TMail::Address.parse(address) if address.is_a?(String)\n {:name=>address.name, :email_address=>address.address}\n end", "title": "" } ]
[ { "docid": "24ddd5df21ed8ab30469ebca892c5d6c", "score": "0.7135637", "text": "def hash160_from_address(address)\n return nil unless valid_address?(address)\n decode_base58(address)[2...42]\n end", "title": "" }, { "docid": "ab90df1930cbba99d6e2aff7c9fe8fe5", "score": "0.6677454",...
e9b181eb40e7a3640225d106aae28a4a
DELETE /todo_items/1 DELETE /todo_items/1.json
[ { "docid": "2e26a5aa9611f764c52777241359d317", "score": "0.7437477", "text": "def destroy\n @todo_item.destroy\n respond_to do |format|\n format.html { redirect_to todo_list_todo_items_url, notice: 'Todo item was successfully destroyed.' }\n format.json { head :no_content }\n end\n ...
[ { "docid": "0eb7098bf7967039f3eabf6f3c383542", "score": "0.80168873", "text": "def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end", "title": "" }, { "docid": "dea69e74ac397a41d292f5ca3c1b865e", "score": "0.7708253", "text": "def destroy\n Todo.find(params[:id]).de...
af97ebee162247846feb67f8bac178df
=begin def sum_array(array) array.inject(0,:+) end =end
[ { "docid": "37ac54a334eebef9650337cc3eb3140d", "score": "0.0", "text": "def sum_array(array)\nsum = 0\n array.collect do |i|\n sum += i\n end\n sum\nend", "title": "" } ]
[ { "docid": "0657293d2759559fccacc63bde46bbba", "score": "0.90359956", "text": "def sum arr\n array.inject(0,:+)\nend", "title": "" }, { "docid": "d49f6466411755da01f8d9d6611b2150", "score": "0.8909129", "text": "def sum_array(array)\r\n array.inject(0, :+)\r\nend", "title": "" ...
45383ce3ae4019b9f0fca994a7515bd5
Initializes an AccessToken by making a request to the token endpoint
[ { "docid": "f2fba490bee6f77f2e42c1657d98beb2", "score": "0.0", "text": "def get_token(params, access_token_opts = {})\n params[:scope] ||= 'snsapi_base'\n params = params.merge(:parse => :json)\n access_token_opts = access_token_opts.merge({:header_format => \"OAuth2 %s\", :param_name => ...
[ { "docid": "5855168556a8a7e102f2b8e9eee8465f", "score": "0.7758646", "text": "def init_access_token(params)\n @access_token = request_token.get_access_token(params)\n end", "title": "" }, { "docid": "bc1f2e4324279d2f68d633c2e861b67b", "score": "0.7740812", "text": "def init\n...
003a90c2787bdf136dcc178ef9e2452a
Read member Use this endpoint to read the attributes of a specific member.
[ { "docid": "73185097315aa3edd01f2746372b3b08", "score": "0.64360267", "text": "def read_member_with_http_info(member_guid, user_guid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MembersApi.read_member ...'\n end\n # verify the requir...
[ { "docid": "31a54e3f20f952ad0f79be7f7aad673d", "score": "0.6477521", "text": "def read_member(member_guid, user_guid, opts = {})\n data, _status_code, _headers = read_member_with_http_info(member_guid, user_guid, opts)\n data\n end", "title": "" }, { "docid": "9b01b0e977d6777ab2...
8a563b55947585765b50848077de211c
GET /sitio_entregas/new GET /sitio_entregas/new.json
[ { "docid": "4bc02e21a8f3057a0679f113ed70574f", "score": "0.8073723", "text": "def new\n @sitio_entrega = SitioEntrega.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sitio_entrega }\n end\n end", "title": "" } ]
[ { "docid": "b5b36df65ee2b8ae6bba9d3072489de3", "score": "0.7530848", "text": "def new\n @sitio = Sitio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sitio }\n end\n end", "title": "" }, { "docid": "eaea787b4a0417aa47e16f40ae2c96...
4d9e888ccb6dda5d5b6d261145f5b709
JWT Web Token This is called from a client who wish to authenticate and get a JSON Web Token back
[ { "docid": "75cca6fcb0c23b71ac6b9f43d073a31b", "score": "0.0", "text": "def api_auth\n # output the APIkey from the header\n # puts request.headers[\"X-APIkey\"];\n creator = Creator.find_by(email: params[:email].downcase)\n if creator && creator.authenticate(params[:password])\n #respo...
[ { "docid": "ce28a213b9c23415e8a71224ed8b5d47", "score": "0.82172227", "text": "def jwt_token\n # Sign our claims with our private key. The authorization server will \n # contact our jwks_uri endpoint to get our public key to decode the JWT.\n\n JWT.encode(jwt_claims, Application.private_key, '...
63a95222a1be21b7a781e722c9438d7a
Update a &39;hyperflex.SysConfigPolicy&39; resource.
[ { "docid": "4fbd39af61b1e40eabfe7a0168b483ae", "score": "0.62034214", "text": "def update_hyperflex_sys_config_policy_with_http_info(moid, hyperflex_sys_config_policy, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: HyperflexApi.update_hyperflex_s...
[ { "docid": "68767620fd70567310b3e2307de907ea", "score": "0.7296247", "text": "def update_hyperflex_sys_config_policy(moid, hyperflex_sys_config_policy, opts = {})\n data, _status_code, _headers = update_hyperflex_sys_config_policy_with_http_info(moid, hyperflex_sys_config_policy, opts)\n data\...
af8621987d671b664fe677f40e74d9e1
and then print them
[ { "docid": "1102ed3437bbcefcfa3eadd726156b3e", "score": "0.0", "text": "def print_header\n puts \"The students of Villians Academy\"\n puts \"______________\"\nend", "title": "" } ]
[ { "docid": "e029a934fce4acfecce383e1160de36a", "score": "0.6997372", "text": "def print\n print_paths\n puts\n print_files\n end", "title": "" }, { "docid": "103104a938f156dfff7e9e77d3967abd", "score": "0.6868088", "text": "def show\n \n puts \"\"\n ...
93eae2fa1cf1a322abad1716d5e5062d
Get horizontal line and shift to the right
[ { "docid": "455ba3c2b1b5fd37c6b55086c939705b", "score": "0.7334129", "text": "def shifted_horizontal_line y\n line = { x: grid.width + 1, y: y, w: grid.width, h: 0 }\n line.transform_values { |v| v * grid.cell_size }\n end", "title": "" } ]
[ { "docid": "fe15cd4ca005bc2ff237df14de9d2e27", "score": "0.74579763", "text": "def shifted_vertical_line x\n vertical_line(x + grid.width + 1)\n end", "title": "" }, { "docid": "f5e468d8a9b178a3729d28b60205eec2", "score": "0.68304324", "text": "def draw_line; draw_horizontal_line...
05719e2fdde51059172c6a054e10bafc
Sets the quantity (upper limit of array) of tuples to retrieve This is because some users prefer not to specify a zero based index when asking for n browsers
[ { "docid": "6a9787665e46a3d1f820c18a9810cd58", "score": "0.0", "text": "def calculate_quantity(quantity)\r\n if (quantity.nil? or quantity == 0) then\r\n quantity = -1\r\n else\r\n quantity -= 1\r\n end\r\n end", "title": "" } ]
[ { "docid": "f2c11474102302477fa343d34892f11f", "score": "0.6137341", "text": "def return_quantity_selection\n\n iterations = self.quantity_available\n\n quantity_options = []\n\n iterations.times do |number|\n quantity_options << number + 1\n end\n\n return quantity_options\n end", ...
394dd62b4446c5bbeb561002b0ec887d
POST /reviewers POST /reviewers.xml
[ { "docid": "eb8c0f5b9b3567712ef39d4ccf95cb33", "score": "0.59584516", "text": "def create\n @reviewer = Reviewer.new(params[:reviewer])\n\n respond_to do |format|\n if @reviewer.save\n format.html { redirect_to(@reviewer, :notice => 'Reviewer was successfully created.') }\n form...
[ { "docid": "47819007654ce36bbfa9aad42c079297", "score": "0.6212805", "text": "def create \n @refrigerator = Refrigerator.find(params[:refrigerator_id])\n @review = Review.create(create_update_params)\n @refrigerator.reviews << @review\n\n if @review.save!\n\n flash...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "03dd08ff78f2a65b02f560c16cd84d5f", "score": "0.0", "text": "def dispensed_med_params\n params.require(:dispensed_med).permit(:disdate, :patientsid, :inventoryid, :quantity, dispensed_med_attributes: [:quantity])\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...
fcc6eb527a4de55dca755326b6a81ece
GET /food_promises/1 GET /food_promises/1.json
[ { "docid": "5734812368a2de72a800fc3b9be011b5", "score": "0.7130028", "text": "def show\n @food_promise = FoodPromise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food_promise }\n end\n end", "title": "" } ]
[ { "docid": "92718fb128c49bba4dbc60be382a040d", "score": "0.65881145", "text": "def new\n @food_promise = FoodPromise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @food_promise }\n end\n end", "title": "" }, { "docid": "fee26d1f5...
8600f8f60a507202903a58325cfffeaa
Create a new element name:: Queue name url:: Action URL method:: Action URL method reservation_sid:: TaskRouter Reservation SID post_work_activity_sid:: TaskRouter Activity SID keyword_args:: additional attributes source://twilioruby//lib/twilioruby/twiml/voice_response.rb1596
[ { "docid": "49d865f7986577de215aba8d29164e9a", "score": "0.659472", "text": "def queue(name, url: T.unsafe(nil), method: T.unsafe(nil), reservation_sid: T.unsafe(nil), post_work_activity_sid: T.unsafe(nil), **keyword_args); end", "title": "" } ]
[ { "docid": "bb81dfb12fbee720301457786bc5d6d8", "score": "0.64420235", "text": "def queue(name, url: nil, method: nil, reservation_sid: nil, post_work_activity_sid: nil, **keyword_args)\n append(Queue.new(name, url: url, method: method, reservation_sid: reservation_sid, post_work_activity_sid: pos...
9b30936ec6e75ec0cc133e4a3da7f686
Check if biography has an allowed number of words. Used as validation.
[ { "docid": "815b4bb650facec0627001859e0a1fed", "score": "0.7612684", "text": "def biography_limit\n if self.biography.present?\n errors.add(:biography, 'is limited to 150 words.') if self.biography.split.length > 350\n end\n end", "title": "" } ]
[ { "docid": "43d2752da4b398708cc4699264323b12", "score": "0.72229874", "text": "def validate_word_count(form_data, word_target)\n # Initialize empty array\n words = []\n\n # Iterate over each form field\n form_data.each do |field|\n\n # Push the field's content into word array\n words << field[...
8fc4c09059cb6305d0366f806e4245b8
Return a Hash of things that influence the prices displayed in your shop. By default, the only thing that influences prices that is the current order's +tax_zone+ (to facilitate differing prices depending on VAT rate for digital products in Europe, see and If your prices depend on something else, overwrite this method ...
[ { "docid": "1e52318338780769fd64d0da3d86dab1", "score": "0.72135293", "text": "def current_price_options\n {\n tax_zone: current_tax_zone\n }\n end", "title": "" } ]
[ { "docid": "c9d8da0bf8cf122268c467c879195a08", "score": "0.6410507", "text": "def option_prices\n self.options\n @option_prices = {}\n @options.each do |option|\n price = 0\n option.each do |item|\n price += to_cents(@items[item])\n end\n @option_prices[option] = pric...
2b5ff8318b20b53417aeda5b46f9fd2c
Use Javascript to set element attribute value from :id
[ { "docid": "065a60ae897264eab02c0cc5b4692e18", "score": "0.67121357", "text": "def set_attribute(selector, attr, val)\n Driver.execute_script_driver(\"document.querySelectorAll('#{selector}')[0].setAttribute('#{attr}', '#{val}')\")\n end", "title": "" } ]
[ { "docid": "cfc62c9a8a751db435dad5136be55e78", "score": "0.6956431", "text": "def id=(value); end", "title": "" }, { "docid": "17513024e1d318aef0915568bb75ce2a", "score": "0.6914777", "text": "def id= (v)\n add_attribute('id', v)\n end", "title": "" }, { "docid": ...
f2f6d8b5930b2e427ef4c401986a577c
Perform hamming radius nearest neighbor search.
[ { "docid": "8545f2065570778a7ba5e46d74b6f3c7", "score": "0.5432648", "text": "def search_radius(q, radius: 1.0)\n # Initialize some variables.\n n_queries = q.shape[0]\n candidates = Array.new(n_queries) { [] }\n # Binarize queries.\n bin_q = hash_function(q)\n # Find k-nea...
[ { "docid": "fc879e8cc4375499339cb996d60c8efc", "score": "0.63719136", "text": "def find_neighbors\n @neighbors.clear\n XY_AROUND.each do |coord_change|\n stone = goban.stone_at?(@i+coord_change[0], @j+coord_change[1])\n @neighbors.push(stone) if stone != BORDER\n end\n end", "tit...
1bb0929050859598c60a976b71196145
DELETE /mantencionaves/1 DELETE /mantencionaves/1.json
[ { "docid": "4c1b58fa23ebfdc14cf82d7c12cae2f4", "score": "0.6923025", "text": "def destroy\n @mantencionafe.destroy\n respond_to do |format|\n format.html { redirect_to mantencionaves_url, notice: 'Mantencionave was successfully destroyed.' }\n format.json { head :no_content }\n end\n ...
[ { "docid": "5aedc6b4d9ecb69f354222c26f46e892", "score": "0.6892788", "text": "def destroy\n @mast.destroy\n respond_to do |format|\n format.html { redirect_to masts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7452c4d15daf08108aaa5a1b7...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "704812b7823bc595ffc19c11714b0cf3", "score": "0.0", "text": "def super_secret_information_params\n params.require(:super_secret_information).permit(:bank_details, :embarrassing_facts)\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...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "f64b63a6b560fce7a73550569563f826", "score": "0.0", "text": "def update!(**args)\n @audit_configs = args[:audit_configs] if args.key?(:audit_configs)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version ...
[ { "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...
36244665fb1c28caa8d8c4667937bb7e
========================================================================== method Sketchup::Layersadd_layer (alias: add)
[ { "docid": "97de5ad6f697da7e958e29c6d01a0f12", "score": "0.63874316", "text": "def test_add_layer\n skip('Added in 2021.0') if Sketchup.version.to_f < 21.0\n original_method = Sketchup::Layers.instance_method(:add)\n aliased_method = Sketchup::Layers.instance_method(:add_layer)\n assert_equa...
[ { "docid": "31837c4bce26cf1b29fb6228e3347842", "score": "0.8560219", "text": "def _add_layer(layer)\n\t\t\t@layers << layer\n\t\tend", "title": "" }, { "docid": "31837c4bce26cf1b29fb6228e3347842", "score": "0.8560219", "text": "def _add_layer(layer)\n\t\t\t@layers << layer\n\t\tend",...
d74632587ac43e00c6280ad35bccca01
close any persistent connection to the update server
[ { "docid": "edc983e5b47d8610c172a145ff4f6f5f", "score": "0.0", "text": "def close\n end", "title": "" } ]
[ { "docid": "d2ca1523c3462bcaf3ed119a6484647c", "score": "0.7350964", "text": "def close\n @update_manager.stop\n TD::Api.client_destroy(@td_client)\n end", "title": "" }, { "docid": "ea38e3f61668dd4826df3f96b6bb96ad", "score": "0.7196864", "text": "def close!\n close_conn...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "796157aa753a15fb9d2792667d9ab9f1", "score": "0.0", "text": "def set_listing\n @listing = Listing.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...
ea4c0182e92eb79db173b72e13483f34
DELETE /resultlists/1 DELETE /resultlists/1.json
[ { "docid": "d071a2dd2415cd810cc32dadf9581df9", "score": "0.7682735", "text": "def destroy\n @resultlist.destroy\n respond_to do |format|\n format.html { redirect_to resultlists_url, notice: 'Resultlist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", ...
[ { "docid": "2ab3e4da9bb821380da70904a2dcbdd5", "score": "0.7670875", "text": "def destroy\n @result_list.destroy\n respond_to do |format|\n format.html { redirect_to result_lists_url, notice: 'Result list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "03410b4a75c4a560b7c37c496653e2d6", "score": "0.0", "text": "def update!(**args)\n @code = args[:code] if args.key?(:code)\n @details = args[:details] if args.key?(:details)\n @message = args[:message] if args.key?(:message)\n end", "title": "" } ]
[ { "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...
1b64a76c02074ca51929674c9ca4728c
This serves as the registration method
[ { "docid": "e59f9653fc8948f1e75af770eb794a45", "score": "0.0", "text": "def create\n @admin = Admin.new(admin_params)\n @admin.organization = @organization\n if @admin.save\n redirect_to new_session_path, notice: 'Admin account created!'\n else\n render 'new'\n end\n end", ...
[ { "docid": "a39b2e915db1f59b38f93e3d13b72a1d", "score": "0.87541723", "text": "def register\n \n end", "title": "" }, { "docid": "706ce5b01190c0b1a7ec0680575e4aa3", "score": "0.8650655", "text": "def register; end", "title": "" }, { "docid": "23d67defd4fbcf6a4404ec0c286...
8dbda1b3daf7c5a01ecc700b47247b7c
section is excluded unless referenced or allocated (Solaris)
[ { "docid": "436c4eb0c200181026305a4226684ca2", "score": "0.0", "text": "def exclude\n return @exclude unless @exclude.nil?\n @exclude = (value & 134217728) != 0\n @exclude\n end", "title": "" } ]
[ { "docid": "905242edad9dbb5ce9020f464f37ea32", "score": "0.63945293", "text": "def section(name, opts = T.unsafe(nil)); end", "title": "" }, { "docid": "2617637240ea5ccc703b4cacbf8e571e", "score": "0.6068537", "text": "def remove_section(section)\n return unless @include.key?(sect...
21a31392932832696f3cd00e84e2228d
Returns a hash of the attribute changes between the saved record and the data entries
[ { "docid": "c16331cafb6c5a67941ad98e60e82d89", "score": "0.6454835", "text": "def forge_diff(**forge_options)\n diff = {}\n forge_attrs = forge_attributes(**forge_options)\n record_attrs = slice(*forge_attrs.keys)\n\n record_attrs.each do |key, value|\n diff[key] = [value, for...
[ { "docid": "e3e0719a70c734def780049d0ea511cd", "score": "0.7906122", "text": "def changes\n array = changed.map { |attr| [attr, attribute_change(attr)] }\n ActiveSupport::HashWithIndifferentAccess[array]\n end", "title": "" }, { "docid": "d3e6800e99ee04317dd223bbb5165178", "score"...
8b548ac6536cdc7474f948e9e0008208
GET /pilots/1 GET /pilots/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "83c9341eb2ed92e7f82a6ba237217ea8", "score": "0.7332458", "text": "def index\n @pilots = current_user.company.pilots\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pilots }\n end\n end", "title": "" }, { "docid": "109f05...
f59adc97b1c2f7c7b51bbd167c4cc08c
creates a hash of punt statistics
[ { "docid": "69788f084679a3f58b96f8ad2ed9f7b4", "score": "0.6566554", "text": "def punts_hash(stats_xml)\n {\n number: stats_xml[:number].to_i,\n average: stats_xml[:avg].to_f,\n net_average: stats_xml[:net_avg].to_f,\n blocked: stats_xml[:blk].to_i\n }\n...
[ { "docid": "78e0fa25227cb54fedee25c3c91a686e", "score": "0.6894373", "text": "def hash\n shasum.hash\n end", "title": "" }, { "docid": "78e0fa25227cb54fedee25c3c91a686e", "score": "0.6894373", "text": "def hash\n shasum.hash\n end", "title": "" }, { "docid...
ec67ee393b11f28b22bb8c30366e07e3
Is there a next page?
[ { "docid": "6609345e91a58d372822d5abd636b2d9", "score": "0.8348434", "text": "def has_next?\n return self.current_page != self.total_pages && self.total_pages > 1\n end", "title": "" } ]
[ { "docid": "28b48f22574c25a2879203c9c5466151", "score": "0.8789962", "text": "def has_next_page\n @agent.page.links.find { |l| l.text == \"Next →\" } == nil ? false : true\n end", "title": "" }, { "docid": "afb9aa8ea377a51f1ab31f1e340136e6", "score": "0.8618665", "text": "def nex...
2a036483a95fe77be82ca6b3b7feb2b7
This method expects there to be a logger with a wait_for method in the context, else it will raise an exception. This method is only useful for test/quickstart/examples environments. engine.wait_for(:alpha) will make the current thread block until a workitem is delivered to the participant named 'alpha' engine.wait_for...
[ { "docid": "1a69adba9b73fc36e011d12686c0f776", "score": "0.6580727", "text": "def wait_for (*items)\n\n logger = @context['s_logger']\n\n raise(\n \"can't wait_for, there is no logger that responds to that call\"\n ) unless logger.respond_to?(:wait_for)\n\n logger.wait_for(ite...
[ { "docid": "e54192a8c484e9c8c20a213b5fbcf52e", "score": "0.61493295", "text": "def wait_for(options={}, &block)\n Wait.new(Cloudpassage::wait_options.merge(options)).until do\n instance_eval &block\n end\n end", "title": "" }, { "docid": "09222bfaa6752984c113cc3b259c8488"...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.0", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.603186", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6015241", "text": "def ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "cbd67b0095b91294711cd953de7355e7", "score": "0.0", "text": "def set_manufacturer\n @manufacturer = DisManufacturer.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163163", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045976", "text": "def action_hook;...
1e26bc711f1a3a8cd7ccbf9e6add2658
Get the binary string of the entire packet.
[ { "docid": "9d40469632b7244108560edf6ffc1030", "score": "0.0", "text": "def to_s\n\t\t\t@headers[0].to_s\n\t\tend", "title": "" } ]
[ { "docid": "733d854bf982757a8b997a9efada4ff3", "score": "0.7461814", "text": "def to_str\n bytes\n end", "title": "" }, { "docid": "6d8975bd77c6a201149c140c7f92f15c", "score": "0.73650765", "text": "def to_s\r\n packet = build_packet\r\n @packet_size = packet.length...
ff35b1abd3dc95ef249e6bb6e44dcf0d
Method on class User token gets added to Users database.
[ { "docid": "1bc115a292d6f24cdf65bf3c7b1b78b0", "score": "0.0", "text": "def create_remember_token\n self.remember_token = User.encrypt(User.new_remember_token)\n end", "title": "" } ]
[ { "docid": "a2a25e5fdd3f1c4d169001b192314d37", "score": "0.74245584", "text": "def add(name, token)\n\t\t\tUser.new name, token\n\t\t\tBini::Config.save\n\t\tend", "title": "" }, { "docid": "2995bb8f238428e32152d7b72ae71810", "score": "0.70544755", "text": "def register\n self.tok...
17b876886a749501464c0802d3bc1031
Restore stdout, if it was previously redirected; return the text that was redirected, or nil if it wasn't redirected
[ { "docid": "8416b0760b2d5a971369f00a53d2a6c8", "score": "0.77064735", "text": "def restore_stdout\n content = nil\n if @saved_stdout\n @saved_stdout.flush\n content = $stdout.string\n $stdout = @saved_stdout\n @saved_stdout = nil\n end\n content\n end", "title": "" ...
[ { "docid": "fab44fae880f55fdff27d1cae4970241", "score": "0.70034194", "text": "def last_stdout\n return nil unless @alt_stdout\n @alt_stdout.rewind\n @alt_stdout.read\n end", "title": "" }, { "docid": "55f6d07b45e30388b6f45b8a8605e791", "score": "0.6785809", "text":...
2114ae803fd8552bd3162d241a69be9b
Used in html table controls Returns a Hash of names by Procs The Proc returns a field value of a model passed as 2nd arg
[ { "docid": "7d448fc7f9f4d9e5e0aa7e6e67935fd1", "score": "0.54995054", "text": "def hash_field_name_by_proc_call_method(field_names)\n hash_yield_value(field_names) {|name| proc_call_method name }\n end", "title": "" } ]
[ { "docid": "2bac02fe10a705a3758765ca547c635a", "score": "0.6692661", "text": "def table_values(**opt)\n model_field_values(**opt)\n end", "title": "" }, { "docid": "446069cef0424dabeb3f24eb93b25f47", "score": "0.6302153", "text": "def get_display_instance_field(model) \n mode...
89662bc68fb92993dbff1059b0586aab
Unset variables used by bundler
[ { "docid": "942a7f809211dd3afb1e9a67da9cbb15", "score": "0.8079556", "text": "def unset_bundler_env_vars\n empty_env = with_environment { with_unbundled_env { ENV.to_h } }\n aruba_env = aruba.environment.to_h\n (aruba_env.keys - empty_env.keys).each do |key|\n delete_enviro...
[ { "docid": "bd3eb42c4004e58b76a3a1407cc48049", "score": "0.8100139", "text": "def unset_bundler_env_vars\n %w[RUBYOPT BUNDLE_PATH BUNDLE_BIN_PATH BUNDLE_GEMFILE].each do |key|\n set_environment_variable(key, nil)\n end\n end", "title": "" }, { "docid": "8d87dbd56f...
50f9f185a7e0a4b735aeced6110bd841
Calculates hash code according to all attributes.
[ { "docid": "687677c535931a8b65304e4574afc88f", "score": "0.0", "text": "def hash\n [self_uri, alternate_links, name, width, height, alternative_text, alternative_text_title, hidden, x, y, z_order_position, fill_format, effect_format, three_d_format, line_format, hyperlink_click, hyperlink_mouse_ove...
[ { "docid": "d63333ed15c27e3f7526f0c6f8099546", "score": "0.7118691", "text": "def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end", "title": "" }, { "docid": "23cdf6a080837fbe407633be0799ea0e", "score": "0.70400536", "text": "def hash() end", "title": ...
e571cd4aafdd026e428ff50b1b8f2a32
Returns the database host name, defaulting to localhost. If PERCONA_DB_HOST is passed its value will be used instead
[ { "docid": "036166d5aea11440a43979315b15dac5", "score": "0.82808244", "text": "def host\n ENV['PERCONA_DB_HOST'] || connection_data[:host] || 'localhost'\n end", "title": "" } ]
[ { "docid": "5b0c96460110158cf058c1b52886287f", "score": "0.8232998", "text": "def host\n ENV.fetch('PERCONA_DB_HOST', connection_data[:host]) || 'localhost'\n end", "title": "" }, { "docid": "755a8158615196f85ace7f33e495931d", "score": "0.7405983", "text": "def database_host\...
eb15a91def1a5b1a9fee9c8b6518983d
The percent_change method computes the percent change over the given number of periods.
[ { "docid": "1d8b7608f18ca4c7a3388dc613246c14", "score": "0.75824547", "text": "def percent_change periods=1\n must_be_numeric!\n\n prev = nil\n arr = @data.each_with_index.map do |cur, i|\n if i < periods ||\n include_with_nan?(Daru::MISSING_VALUES, cu...
[ { "docid": "7787611a756d0a74676f2c091f9cf37d", "score": "0.6837132", "text": "def percentage_change\n return_sum / @money * 100\n end", "title": "" }, { "docid": "3c535035499be0980d397ee277dd7873", "score": "0.65683836", "text": "def percentage_change\n return unless starting_...
62093a3dbdf44bde33339fddb13c117f
convert top level key in a hash to symbol
[ { "docid": "83f396025f1a821b19d82d54cb7ad5d0", "score": "0.0", "text": "def symbolize_keys(hash)\n hash.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}\n end", "title": "" } ]
[ { "docid": "43412bba7a72e0ca0462a27345731040", "score": "0.7352016", "text": "def rh_key_to_symbol(level = 1)\n data.rh_key_to_symbol level\n end", "title": "" }, { "docid": "96c2f31e71f288551342d83aad1cc2bd", "score": "0.70038205", "text": "def _hash_key_symbol(s, recursing=...
11b3d573f06654144d17d5afc5f50aeb
POST /signup return authenticated token upon signup
[ { "docid": "b6e32f4f450b01346ad19ddcaeb0b238", "score": "0.0", "text": "def create\n if (user_params[:password] != user_params[:password_confirmation])\n return json_response({ message: Message.passwords_do_not_match }, :bad_request)\n end\n\n user = User.create!(user_params)\n auth_tok...
[ { "docid": "f885078b41bab82ac333de9e9672dcba", "score": "0.76387614", "text": "def perform_sso_signup\n body = {user: sign_up_params}\n response = HTTParty.post('http://localhost:3000/users', body: body).parsed_response\n session[:jwt_token] = response['token']\n end", "title": "" }, {...
dad525a158f30c285a45493583d41fad
Second method generates list with number of factors for each number up to n and identifies first string of 4 consecutive numbers with 4 distinct factors.
[ { "docid": "59fd2dfe83b8c44a3d22cef9b9ff2e46", "score": "0.0", "text": "def findConsecutiveNumbersWithConsecutivePrimesUpToN(n)\n\n#First we run the above method for list of primes.\nprimes = primesUnderX(n)\n\n#The array with the list of factors will be called \"composites.\"\ncomposites = []\n\n#First...
[ { "docid": "fc3a6059c6e969945d8979675445f184", "score": "0.7618041", "text": "def generate_factors(n)\n return [] if n == 1\n factor = (2..n).find {|x| n % x == 0} \n [factor] + generate_factors(n / factor) \n end", "title": "" }, { "docid": "206ee21c17ddc0f0ead6ee400...
a3eee8c6f1391a33c7c8db76f166ebb6
The method should return a new str where streaks of consecutive characters are compressed. For example "aaabbc" is compressed to "3a2bc".
[ { "docid": "05e1db264bc8192bd24e2c90423bffc0", "score": "0.7365514", "text": "def compress_str(str)\n new_str = \"\"\n # aaabbc\n base = 1\n ch = str[0]\n\n (1..str.length).each do |i|\n if str[i] == ch\n base += 1\n else \n if base > 1\n temp =...
[ { "docid": "1ecdb02a761fb331cca4f4a97b4f1f97", "score": "0.84427184", "text": "def compress_string(s)\n compressed = s[0]\n repeating_char = s[0]\n streak = 0\n \n s.each_char do |c|\n if c == repeating_char\n streak += 1\n else\n compressed << streak.to_s\n repeating_char = c\...
4d7fb7158c0953e1064a13ec625dce9e
gets online note from the following tag ... Returns:: String
[ { "docid": "817fed1b6c8fede7bc5e603d8ed66c42", "score": "0.69684756", "text": "def online_note\n return @online_note if @online_note\n \n xpath = \"/OnlineNote\"\n @online_note = @node.find_first(@descriptor_root_path + xpath).content \n end", "title": "" } ]
[ { "docid": "baaed71a5efa0fb80eb7cd3051bcc61d", "score": "0.69009775", "text": "def note_tag(text); end", "title": "" }, { "docid": "e6eca7b561146854f0e051dc78beaf58", "score": "0.67088765", "text": "def note_content\n note_text_fld[1]\n end", "title": "" }, { "docid":...
626efc9e7fc6bf7d3b22c67bd141ee0b
This is the main method for finding objects on a web page. This method is used internally by Watir and should not be used externally. It cannot be marked as private because of the way mixins and inheritance work in watir how symbol the way we look for the object. Supported values are :name :id :index :value etc what st...
[ { "docid": "1f847e8b18c4ada95481f26df89efcec", "score": "0.67948747", "text": "def getObject(how, what, types, value=nil)\n container = ole_inner_elements \n how = :value if how == :caption\n log \"getting object - how is #{how} what is #{what} types = #{types} value = #...
[ { "docid": "c3e4c256c7acfa8018349c4fe7d18bfa", "score": "0.67212087", "text": "def getObjectAtIndex(doc , index , types , value=nil)\n\n #puts\" getting object #{types.to_s} at index( #{index}\"\n\n o = nil\n objectIndex = 1\n doc.all.each do | thisObject |\n begi...
b351106ac365857c183b46a9100d6d02
Redirect to root path unless a user is admin. Returns nothing.
[ { "docid": "925068a4d3c416d9ba1fd03ee78a4f8e", "score": "0.0", "text": "def admin_required\n redirect_to(\"/\") unless admin?\n end", "title": "" } ]
[ { "docid": "c233e605724e6bda95249842818add4b", "score": "0.82804066", "text": "def admin_user\n redirect_to(root_path) unless is_admin?\n end", "title": "" }, { "docid": "93d7ced4ce18f5495226a43dcc9d28a1", "score": "0.8161536", "text": "def admin_user\n redirect_to root_...
782dcd16d28865c524a4fce0857f49ff
not my approach. used description in solutions thread.
[ { "docid": "432deb0142c3fdf3941e2120f1cc0c0f", "score": "0.0", "text": "def shortest_distance\n m = {}\n\n @bots.each do |bot|\n d = _taxi_distance([0,0,0], bot.coordinate)\n m[[0, d - bot.signal_radius].max] = 1\n m[d + bot.signal_radius] = -1\n end\n\n count = 0\n result ...
[ { "docid": "b6b2bcc0062aeb115edab7b10cbe6930", "score": "0.6514502", "text": "def desired; end", "title": "" }, { "docid": "33e1db3c06643dd523dcc31fccf3a005", "score": "0.6231386", "text": "def used; end", "title": "" }, { "docid": "33e1db3c06643dd523dcc31fccf3a005", ...
d7ff81d742f02d38e87536f579c691e4
Check for Recipe inside the new article (Conversion). If possible then convert the recipe Functions for conversion
[ { "docid": "5a8a9981b38ebb685b00bc7887a015d7", "score": "0.0", "text": "def ingredient_has_number_before_slash(ingredient)\n # solve for\n # 1 1/2 pounds (680 grams) fresh mushrooms\n\n # ingreedy may already solve for this\n end", "title": "" } ]
[ { "docid": "5d4f2c49ba41f0afb946836d65447f02", "score": "0.61256015", "text": "def to_recipe(external_recipe)\n raise NotImplementedError\n end", "title": "" }, { "docid": "e1f4212d106eacbd702089ba152e2fde", "score": "0.5309336", "text": "def to_recipe(external_recipe)\n retur...
26392360525a8dfe5ee19702cb7b2874
GET /events GET /events.json
[ { "docid": "07f255cd279847dc683dab57f7c628dc", "score": "0.7186438", "text": "def index\n @events = Event.chronological.paginate(:page => params[:page]).per_page(10)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "titl...
[ { "docid": "483079b80dfb97ee802273ad3849fa6b", "score": "0.795317", "text": "def events\n @page = 'events'\n respond_to do |format|\n format.html {\n @events = Event.find(:all)\n }\n format.json {}\n end\n end", "title": "" }, { "docid": "a85255d083e155277c720...
2bc82b19445af8ab2a2491732f0950f1
Load plugin by path
[ { "docid": "d780a5a26b2e0338819e975ae9e8df3e", "score": "0.6966188", "text": "def load(path)\n path = path.sub(%r{/main$}, '')\n files = [File.join(@dir, path, 'main.rb'), File.join(@dir, \"#{path}.rb\")].select {|file| File.file?(file) }\n if files.size == 2\n Olelo.logger...
[ { "docid": "1092fc1d50f7c50a10e18e8ba76d006b", "score": "0.7979655", "text": "def load_plugin(name,path)\n\t\tfile = File.join(path,\"#{name.to_s.snakecase}.rb\")\n\t\tswdebug \">>Loading #{name} from #{file}\"\n\t\tload file\n\t\tself.singleton_class.send(:include, name.to_s.constantize)\n end", "...
bb6fc06d29ef06f9bb06ca4538ca4bd0
GET /slides/new GET /slides/new.json
[ { "docid": "a48a8f5abcada6a4a53dfcb675407427", "score": "0.80188257", "text": "def new\n @slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end", "title": "" } ]
[ { "docid": "d8f5186b059c9520106aa9ffc4af36e5", "score": "0.80409646", "text": "def new\n @page_slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page_slide }\n end\n end", "title": "" }, { "docid": "5ee7028e07bd5c90cb3...