query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
f93b3f016e1e7fd2181168cf54c762ab
Returns true if the given token matches the digest.
[ { "docid": "ff1a606e9b8436463cf8fd31711dbd10", "score": "0.0", "text": "def authenticated?(remember_token)\n\t\treturn false if remember_digest.nil?\n\t\tBCrypt::Password.new(remember_digest).is_password?(remember_token)\n\tend", "title": "" } ]
[ { "docid": "8ddd0f11de4f651615620fb44c9e44e9", "score": "0.820131", "text": "def matches_token?(digest, token)\n if digest.present?\n BCrypt::Password.new(digest).is_password?(token)\n else\n false\n end\n rescue BCrypt::Errors::InvalidHash\n false\n end", "ti...
9e54154639931f99aea5340766f8ea31
Gets the enrolledByUser property value. The User Principal Name (UPN) of the user that enrolled the device.
[ { "docid": "52f3cc538b573b172f89433ecfb6cc59", "score": "0.7553606", "text": "def enrolled_by_user\n return @enrolled_by_user\n end", "title": "" } ]
[ { "docid": "4690ba8bff7b96e2a7712ef920b8702e", "score": "0.71317", "text": "def enrolled_by_user=(value)\n @enrolled_by_user = value\n end", "title": "" }, { "docid": "07d0393381bd1a746b19fd0ac4cd82b2", "score": "0.6008216", "text": "def invited_user_display...
6407fe347aa9c58105e67b758eb005d2
Creates a dump representation
[ { "docid": "2a69cb9ae7aff786f043c3f95524d0f1", "score": "0.7387245", "text": "def createDumpRep\n strRep = String.new\n #strRep << @name << @@fieldSep << (isRoot? ? @name : @parent.name)\n strRep << @name.to_s << @@fieldSep << (isRoot? ? @name.to_s : @parent.name.to_s)\n #strRep << @...
[ { "docid": "05d1cf9f7bc5ff8b33269555b493af24", "score": "0.76947695", "text": "def dump\r\n #TODO\r\n end", "title": "" }, { "docid": "408783ae683b9bf3e9b51a589a1d9848", "score": "0.7433932", "text": "def dump\n \n end", "title": "" }, { "docid": "a652...
50348ddb5247b227da26eea63a89be13
Add +records+ to this association. Since +<<+ flattens its argument list and inserts each record, +push+ and +concat+ behave identically. source://activerecord//lib/active_record/associations/collection_association.rb119
[ { "docid": "7a3848ed29101ceecb0a668ab8bb7793", "score": "0.6468715", "text": "def concat(*records); end", "title": "" } ]
[ { "docid": "5475cedf149e96a0777be4eaa400f86c", "score": "0.79145575", "text": "def <<(*records)\n proxy_association.concat(records) && self\n end", "title": "" }, { "docid": "5475cedf149e96a0777be4eaa400f86c", "score": "0.79145575", "text": "def <<(*records)\n prox...
ced3a6b38894b8aa959366828aa7a5e5
get the boolean value of current_user (NOT the object)
[ { "docid": "502628fb1c31f8ea20e3ae1733fab392", "score": "0.0", "text": "def logged_in?\n !!current_user\n end", "title": "" } ]
[ { "docid": "bdd3c60420e92beb209d19f4aee5afc8", "score": "0.80471563", "text": "def user_is_current\n @user_is_current || 'Y'\n end", "title": "" }, { "docid": "68dc4156e2fba80e23eea9f493f46e85", "score": "0.7614299", "text": "def is_user?\n user ? true : false\n end", "ti...
3f4dee2863a0fa00fef12cbae57180bb
calculates default_start/end and range_start/end_time
[ { "docid": "e8c13ee56602b869a1c30a898111f671", "score": "0.70467633", "text": "def calculate_default_times_time_slots\n if params[:date]\n\t #sometimes from the tooltip, sometimes week start date\n @default_start_date = Date.parse(params[:date])\n elsif @time_slot.start\n @default_start...
[ { "docid": "b395d2f34a6fa30590ab63e779eb46ea", "score": "0.7270111", "text": "def set_default_times\n return if use_start_and_end_times\n self.start = start.beginning_of_day\n self.end = self.end.end_of_day\n self.timeline_start = timeline_start.beginning_of_day\n self.timeline_end = time...
d4be0f5262f09bd8412d16118d03818d
authentication method used by API, returns Session Key
[ { "docid": "ab66f607ec53ea36269dee90a08099ae", "score": "0.0", "text": "def auth(username,password)\n user = User.first(:username => username)\n\n if user and user.auth_type == \"Local\"\n usern = User.authenticate(username,password)\n\n if usern\n # TODO : This needs an e...
[ { "docid": "19301e7c8de7d18b5a9d633781029032", "score": "0.75811154", "text": "def get_session_key\n\t\tres = RestClient.get 'https://secure.techfortesco.com/groceryapi_b1/restservice.aspx', {:params => {:command => 'LOGIN', :email => 'bwhtmn@gmail.com', :password => 'stokfridge', :developerkey => 'OULd...
f832e1b8474c3dbe148d6c154cc0efb7
Baseline implementation for the list_environments REST call
[ { "docid": "722a996ca4a54a1771d5e8ee4032cec2", "score": "0.7022372", "text": "def list_environments request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_envir...
[ { "docid": "77c2a6023780a3125c73a8793df46845", "score": "0.7383668", "text": "def environments\n _get(\"/system/environments\") { |json| json }\n end", "title": "" }, { "docid": "edbefb4b21652f139ab78c884d60b188", "score": "0.724739", "text": "def environments\n ...
f04547933c9929cc82424e630fb6fda5
Disable Item index : item number
[ { "docid": "028713c2cfd19fd996b485ff44ab9aae", "score": "0.81756073", "text": "def disable_item(index)\n draw_item(index, disabled_color)\n end", "title": "" } ]
[ { "docid": "95ce34b06bb52e508430bd6f74e837a7", "score": "0.8235588", "text": "def disable_item(index)\n draw_item(index, normal_color)\n end", "title": "" }, { "docid": "ff24fcac36c73b39efb4e3a78b9b1830", "score": "0.72202796", "text": "def disable_at(index)\n toggle_at(inde...
1c89b9375182d84e82508a3c612731a7
DELETE /matchups/1 DELETE /matchups/1.json
[ { "docid": "1af07d7a6a9bdfcf2232fe933a7d0185", "score": "0.781945", "text": "def destroy\n @matchup.destroy\n respond_to do |format|\n format.html { redirect_to matchups_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "2b6f9009580d549a023b9e0bc4f59cc1", "score": "0.782671", "text": "def destroy\n @matchup = Matchup.find(params[:id])\n @matchup.destroy\n\n respond_to do |format|\n format.html { redirect_to matchups_url }\n format.json { head :no_content }\n end\n end", "title": ""...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "b00467a9e55b794468913338581c4eb5", "score": "0.0", "text": "def position_params\n params.require(:position).permit(:distinct, :sale, :exercise, :expiration, :maturity, :number, :unit, :ym_expiration)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74954116", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6956924", "text": "def strong_params\n params.require(:request).permit(param_whit...
f90a19cc79bf3bbc02cd786cca86249b
Query local models based on last_updated timestamp
[ { "docid": "d9bdc8f9d55ee94d86c9a57140e7f891", "score": "0.0", "text": "def find_models\n raise_must_override\n end", "title": "" } ]
[ { "docid": "24c1c43e17cb22511016100c507be23e", "score": "0.6726538", "text": "def last_updated\n self.dig_for_datetime(\"lastUpdateOn\")\n end", "title": "" }, { "docid": "1411702140b4d85c5e16943adb54b4dd", "score": "0.65984106", "text": "def latest_stored_update\n active_...
a0aa87e4786e9d12ac59b6fa01c36bcb
PUT /surf_alarms/1 PUT /surf_alarms/1.xml
[ { "docid": "650e03c22b1b0657d2f9a4aed439201e", "score": "0.5999534", "text": "def update\n @surf_alarm = SurfAlarm.find(params[:id])\n if @surf_alarm.nil? || !check_owner(@surf_alarm.device)\n flash[:warning] = \"Unable to edit this alarm. Are you the owner?\"\n redirect_to root_path\n ...
[ { "docid": "f07e5660e77372d5c0aae0e00c3a6d10", "score": "0.6340809", "text": "def update\n @vnf = Vnf.find(params[:vnf_id])\n @alarm = @vnf.alarms.find(params[:id])\n if @alarm.update(alarm_params)\n \trender json: @alarm\n else\n \trender json: {status: 'ERROR', data: @alarm.errors}\n...
a28abed5611e571e923859544ca03ced
set last to now and write log entry call this for heartbeat when heartbeat OK call this for reverse when ping from outside
[ { "docid": "3844ec497aaa1038e55bad77fe037299", "score": "0.0", "text": "def refreshed!(state = 'OK', error = nil)\n refresh_mod(state)\n # do not record error when last log is NTF and state is unchanged\n e = (error.kind_of?(Net::HTTPResponse) ? error.message : error)\n # log all test cycles...
[ { "docid": "fc3f0844abc5dd0d6717d4087029a461", "score": "0.71191394", "text": "def heartbeat_received\n @last_update = DateTime.now\n end", "title": "" }, { "docid": "2ef38832245d57bfa24576fd84ebd97c", "score": "0.68108773", "text": "def beat\n @last_heartbeat_at = Time....
a2b03cff4421bbee24bad51a07f291e7
Returns the total amount received by addresses with +account+ in transactions with at least +minconf+ confirmations.
[ { "docid": "2a2bb1888fdd7ab943f275436916516d", "score": "0.684635", "text": "def getreceivedbyaccount(account, minconf = 1)\n coind.getreceivedbyaccount account, minconf\n end", "title": "" } ]
[ { "docid": "39ef9ea95cf95a70b735845cce0d5283", "score": "0.6345713", "text": "def getreceivedbyaccount(account, minconf = 1, includeemepty = false)\n request :getreceivedbyaccount, minconf, includeemepty\n end", "title": "" }, { "docid": "e735aacd0792d2b9e32f8f982e0f1898", "score": "...
15d90861d3bcd8db55495f0024ba1742
The name to use for the server side prepared statement. Note that this statement might not actually be prepared.
[ { "docid": "fc60012c25ca0eee6bfcff042cbff6d9", "score": "0.5871032", "text": "def name\n \"sequel_pgap_#{cache_id}\"\n end", "title": "" } ]
[ { "docid": "dc6da183123304f37c74547fc75e193d", "score": "0.7796374", "text": "def prepared_statement_name(sql)\n key = \"#{object_id}-#{sql}\"\n \"pg_metal_#{Digest::MD5.hexdigest(key)}\"\n end", "title": "" }, { "docid": "c66908fd68ebe5dd353f381bdf0ed5cd", "score": "0.70914674", ...
556668aad9b524cb6dad60659f95d54a
GET /prescription_medicines/1 GET /prescription_medicines/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "5ddf7558e89db165e4abb91703239a5e", "score": "0.73608965", "text": "def index\n @prescription_medicines = PrescriptionMedicine.where(prescription_id: params[:prescription_id])\n end", "title": "" }, { "docid": "7776ed8703318c81e338c0c4660c4868", "score": "0.62895536", ...
5fa59a0a5cb7b4872eb17c61347cbffd
This method is invoked whenever a method invocation takes place against a Universe object but an existing explicit method cannot be found to meet the call. ==== Parameters name:: The name of the method invoked. arguments:: A collection of the arguments passed to the method call. block:: Any block associated with the me...
[ { "docid": "ce5602437c967b50ae46cf0e055886cf", "score": "0.0", "text": "def method_missing(name, *arguments, &block)\n if @values.include?(name.to_s)\n get_property(name.to_s)\n elsif name.to_s[-1, 1] == \"=\"\n property = name.to_s\n property = property[...
[ { "docid": "ea5b8663066e344405c48f0aa00c1fa7", "score": "0.6748999", "text": "def method_missing name, *args, &block\n @block.call.send(name, *args, &block)\n end", "title": "" }, { "docid": "23b9b8183a697391192cc893017cffd8", "score": "0.63284206", "text": "def method_mi...
343943b8a472ae8de725b854d5f17756
Parses a minOccurs or maxOccurs value.
[ { "docid": "21073af4d71cd5b274def14e08afa630", "score": "0.5717251", "text": "def parse_occurs(value)\n if value == 'unbounded'\n value\n else\n Integer(value || 1)\n end\n end", "title": "" } ]
[ { "docid": "3090c35b4be1c53c7c681b5e894e748c", "score": "0.6045622", "text": "def fix_occurs\n if ! instance_variable_defined?(:@minOccurs)\n @minOccurs = 1\n else\n if @minOccurs !~ /^[1-9]\\d?$/ && @minOccurs != '0'\n raise \"bad minOccurs value: #{@minOccurs}\"\n ...
41be4d35fc49f963eeb3012263db1fea
PATCH/PUT /wholesales/1 PATCH/PUT /wholesales/1.json
[ { "docid": "b247dbf011c7f9f1444346351ae8c2f4", "score": "0.68810713", "text": "def update\n respond_to do |format|\n if @wholesale.update(wholesale_params)\n format.html { redirect_to @wholesale, notice: 'Wholesale was successfully updated.' }\n format.json { render :show, status: ...
[ { "docid": "7cc0349fece0298bb40dab4a1afb33a8", "score": "0.64945763", "text": "def update\n @sales_rep = SalesRep.find(params[:id])\n\n if @sales_rep.update(sales_rep_params)\n head :no_content\n else\n render json: @sales_rep.errors, status: :unprocessable_entity\n end\n end", ...
a8158313d95c8e33e3c635db6116e67f
POST /interviews POST /interviews.json
[ { "docid": "33c55fadf0e44afcadcdfe6bf3055ac1", "score": "0.0", "text": "def create\n @interview = Interview.new(interview_params)\n params[:interview][:participant_ids].each do |participant_id|\n unless participant_id.empty?\n participant = Participant.find(participant_id)\n @inte...
[ { "docid": "4a268e76956d43869244551816eb05b1", "score": "0.69765884", "text": "def create\n @interview = Interview.new(interview_params)\n\n respond_to do |format|\n if @interview.save\n format.html { redirect_to interviews_url, notice: 'Interview was successfully created.' }\n ...
0a8c6560cf0ccf6dc8cc6e2522a342f9
assign rooms method assigns speakers to a room
[ { "docid": "af2b1b0fa523804f24f161b56057f692", "score": "0.67730695", "text": "def assign_rooms(speakers)\n #create empty array\n room_assignments = []\n #iterate over speakers & provide room assignment with #each_with_index\n speakers.each_with_index { |speaker, index| room_assignments << \"Hello, ...
[ { "docid": "eb1a24a40e13ff778128edf1383e1a1c", "score": "0.7216543", "text": "def assign_rooms(speakers)\n speakers.each_with_index { |item, index| p \"#{item} is assigned to room #{index + 1}.\" }\nend", "title": "" }, { "docid": "2a33f50d13d732f8bccc5e4ec1e8aee0", "score": "0.70972484...
ea64ae93dfb703f32273b13459af1a24
Main entry point. Performs an HTTP request.
[ { "docid": "df63a4dd6d12acd8cf9e95b581064cc4", "score": "0.0", "text": "def process\n unless @connection_proxy\n # Try to use a user defined connection proxy. The options are:\n # - RightScale::CloudApi::ConnectionProxy::NetHttpPersistentProxy\n connection_proxy_class ...
[ { "docid": "261b2f7f377ee76ccc8dfd7ec1069eaf", "score": "0.8008133", "text": "def run\n resp = nil\n http = Net::HTTP.new(URI(@_url).host, URI(@_url).port)\n http.use_ssl = (URI(@_url).scheme == \"https\")\n http.start do |conn|\n resp = conn.request(_req)\n ...
187a0e001e79fd54579410570c4e3ba9
Postgres and Ruby follow ISO standards for Monday being the start of the week Postgres' `date_trunc` function follows that convention. Here we test that our MySQL port does the same.
[ { "docid": "04e1b0499ef9373baf382fc5619f7693", "score": "0.77432054", "text": "def test_date_trunc_returns_monday_for_week_start\n return unless adapter.present?\n time = Date.parse('2018-09-29').beginning_of_day\n\n result = perform_query('week', time)\n assert_time_effectively_equal(result...
[ { "docid": "118eb3f87daac0d54182db4fab946a6e", "score": "0.5920425", "text": "def days_to_week_start(start_day = T.unsafe(nil)); end", "title": "" }, { "docid": "118eb3f87daac0d54182db4fab946a6e", "score": "0.5920425", "text": "def days_to_week_start(start_day = T.unsafe(nil)); end",...
461f3c23bc301df6f1c8bcb321f1dc92
Responds with a 401 (:unauthorized) HTTP status code.
[ { "docid": "6c072daf389130cfbaf6b93b2322969e", "score": "0.0", "text": "def deny_access\n respond_to do |format|\n format.html {\n flash[:alert] = 'You are not authorized to perform this action'\n\n redirect_to root_path\n }\n\n format.json {\n # Some schools of th...
[ { "docid": "338dc1131407ea6ffd309804ad2ae181", "score": "0.8165066", "text": "def unauthorised\n render_error 401, :unauthorized\n end", "title": "" }, { "docid": "8f9d9385a4b2ad6bbc9d1dd3b690b274", "score": "0.80821115", "text": "def unauthorized\n custom!(Rack::Response.ne...
acb47038cfbb63806638fbbb7a47e513
POST /manifestations POST /manifestations.xml
[ { "docid": "20c0d60f8da7d4e9aeab55f2f0bfa4ab", "score": "0.0", "text": "def create\n producer_name = params[:name]\n producer_type = params[:entity_type]\n\n @manifestation = Manifestation.new(params[:manifestation])\n @producer = producer_type._as_class.find_or_create_by_name(producer_name)...
[ { "docid": "7a9c32b56ecb5859b0090b1ae232dc34", "score": "0.6998167", "text": "def create\n @manifestation = Manifestation.new(params[:manifestation])\n\n respond_to do |format|\n if @manifestation.save\n flash[:notice] = 'Manifestation enregistrée avec succès.'\n format.html { r...
b211fd9c8360ee1cd662068b89b79e60
DELETE /blog2s/1 or /blog2s/1.json
[ { "docid": "9f9f3c69d68ce385ab348f2eecf58e22", "score": "0.76400506", "text": "def destroy\n @blog2.destroy\n respond_to do |format|\n format.html { redirect_to blog2s_url, notice: \"Blog2 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "...
[ { "docid": "da9fda591b6694f40c6a707241f1f7da", "score": "0.71627367", "text": "def destroy\n @blog.destroy\n respond_to do |format|\n format.html { redirect_to blogs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "da9fda591b6694f40c6a7072...
c220744a6d17b1421149a8ab756183a6
calculate_line_with_highest_frequency() determines which line of text has the highest number of occurrence of a single word
[ { "docid": "64907a4dc45bf5a1e882be864d0f1786", "score": "0.8249023", "text": "def calculate_line_with_highest_frequency()\n cnt = 0\n line = 0\n words = []\n self.highest_count_across_lines\n self.highest_count_words_across_lines = []\n\n self.analyzers.each do |analyzer|\n analyz...
[ { "docid": "ac31df658b1511467f335e0ad19d7df5", "score": "0.8204106", "text": "def calculate_line_with_highest_frequency()\n @highest_count_across_lines = @analyzers.map { |element| element.highest_wf_count }.max\n @highest_count_words_across_lines = @analyzers.select { |element| element.highest_wf...
1b8bb1f6e9da33d5424da52576309d46
Return an array of configurable keys that are not found in the user's config
[ { "docid": "2526da16f33c7b0babbffaef17d14485", "score": "0.8011011", "text": "def missing_configurables\n return [] unless @configurables\n configurable_keys = @configurables.map { |k, v| v.map { |i| i[:key].to_s } }.flatten\n configurable_keys.reject { |k| Config.keys.include? k }\...
[ { "docid": "2504dfac443a83fbcfad73915415520f", "score": "0.6873205", "text": "def config_keys\n config.keys\n end", "title": "" }, { "docid": "2504dfac443a83fbcfad73915415520f", "score": "0.6873205", "text": "def config_keys\n config.keys\n end", "title": "" }, ...
d06cdcd922de0e9b7349500df3f484bd
Handles normal, thin, and intersentence spaces.
[ { "docid": "0dde4817b7860607d53a2775d0e92d3f", "score": "0.53914654", "text": "def spaces(doc)\n doc.xpath('//thinspace').each do |node|\n node.name = 'span'\n node['class'] = 'thinspace'\n # &#8201; replaces &thinsp;, which stopped working for some reason.\n ...
[ { "docid": "5d269326caa5f276ca72d7263d639792", "score": "0.65925187", "text": "def process_spaces(doc)\n doc.gsub!(/\\\\,/, xmlelement('thinspace'))\n # Match an end of sentence character, while also recognizing\n # things like (Or otherwise.) and ``Yes, indeed!'' as being the...
d8747d9632af9407f426a5e100fe78c7
ContainerCondition is polymorphic child of ContainerNode & ContainerGroup.
[ { "docid": "44329c19811cadfb5c2d73c1ee7fbb03", "score": "0.52654576", "text": "def initialize_container_conditions_collection(relation)\n query = ContainerCondition.where(\n :container_entity_type => relation.model.base_class.name,\n :container_entity_id => relation, # nested SELECT. TODO...
[ { "docid": "f001691be3ef01e33c9d652d0de3d920", "score": "0.60819596", "text": "def add_container_conditions(manager, association)\n parent_collection = @collections[association]\n\n relation = manager.public_send(association)\n query = ContainerCondition.where(\n :container_entity_type => ...
3da57ec6d3ffb3271c509bb668041874
search only device (not service)
[ { "docid": "f2db23d825cb73b054b64c97936da092", "score": "0.6375661", "text": "def search(st = \"ssdp:all\", delay = 10)\n message = <<-MESSAGE\nM-SEARCH * HTTP/1.1\\r\nHOST: #{@@host}:#{@@port}\\r\nMAN: \"ssdp:discover\"\\r\nMX: #{delay}\\r\nST: #{st}\\r\nUSER-AGENT: #{RbConfig::CONFIG[\"host_os\...
[ { "docid": "622675d0ec2b8a188a93f68fb648e7ea", "score": "0.7986866", "text": "def get_all_devices\n @devices.search(\"device\")\n end", "title": "" }, { "docid": "919518bca56db4c5052174e2415e152c", "score": "0.7206466", "text": "def get_devices_for_search\n options ={}\n ...
4288851f7d26c375a49630d58009dd05
Test simple parsing into words.
[ { "docid": "b4442337966396c01fa8bc41d9107947", "score": "0.0", "text": "def test_that_abstract_is_abstract_dammit\r\n assert_raises(NoMethodError) do\r\n AbstractWordSpec(\"fred\", :freddy, [])\r\n end\r\n end", "title": "" } ]
[ { "docid": "a0484a57c85a47f0386b0b90afcfdc7b", "score": "0.7245915", "text": "def test_parse_word\r\n test_string = '1 2 //Now we add them!' + \"\\n\" + '(Now add!) + (Now print!) .'\r\n source = XfOOrth::StringSource.new(test_string)\r\n parser = XfOOrth::Parser.new(source)\r\n\r\n assert_e...
3c5de3d0b71488e056059361276fcca9
we want to tag the github repos with the next available tag
[ { "docid": "ea36bac3be8d4d8241428b8153c2590e", "score": "0.6581387", "text": "def perform_tagging(repo_info)\n repos = self.deployment_profile.repos\n process_github_repos(repo_info, repos)\n end", "title": "" } ]
[ { "docid": "5f7f489ee92a46c1653b383bb661c0e2", "score": "0.7014911", "text": "def github_fetch_tags; end", "title": "" }, { "docid": "0baf936a775b5a6b6b524d23ca48c255", "score": "0.68226725", "text": "def git_deploy_tag\n new_tag = \"#{git_api_tag_name}.v#{(git_versions.shift ||...
0e8d9f94568cbb636c9153ae39e04897
Obtain or set the default state Passing a state name sets the default state
[ { "docid": "1210767d00784b95aa4a8c37650d2b59", "score": "0.782435", "text": "def default_state(new_default = nil)\n if new_default\n @default_state = new_default.to_sym\n else\n defined?(@default_state) ? @default_state : DEFAULT_STATE\n end\n end", "title...
[ { "docid": "c971b7cc83e502ae8f3af88f499c8c48", "score": "0.7508583", "text": "def default_state=(state)\n @default_state = state\n end", "title": "" }, { "docid": "b18d15c3d2cfc00cae9ce8de10d32ed1", "score": "0.73959434", "text": "def default_state=(state)\n raise Ar...
631931fe9495c0af9d0ded78ada38a9a
Returns the friendly id, or if none is available, the numeric id.
[ { "docid": "361f24fa3156d697245e5b89615c0ec1", "score": "0.0", "text": "def to_param\n slug ? slug.name : id\n end", "title": "" } ]
[ { "docid": "99987ff01ecd82d9014d2c6cb8e3cf6b", "score": "0.70219016", "text": "def custom_id\n if self[:custom_id].present?\n self[:custom_id]\n elsif slug? && friendly_id\n friendly_id\n elsif self.user && self.user.login\n normalize_friendly_id(FriendlyId::SlugString.new(self.u...
6c094d112c6a86432f800a4568c78788
Extract any potential tags, specified in brackets after the URL
[ { "docid": "1f64e8c4629982c7e7011d31e2b837cc", "score": "0.586441", "text": "def tags\n match = /(.*?)[\\s\\u00A0]+\\[(?<tags>.*)\\]/.match(@node.inner_text)\n (match ? match[:tags] : '').split(' ')\n end", "title": "" } ]
[ { "docid": "d6d881c60a8d024494b39ddc43744253", "score": "0.71394837", "text": "def find_tags(url)\n\t\t\tputs \"Search and return tags within the url payload: #{url}\" if @verbose\n\t\t\ttag_list = []\n doc = open_page(url)\n doc.text.each_line do |line|\n my_line = line.downcase\n ...
1e16f338c1f3f809860fc75833348704
Extracts the value from a PostgreSQL column default definition.
[ { "docid": "7209a16a8fff745d22b641a3d0887603", "score": "0.0", "text": "def default_value(default)\n # This is a performance optimization for Ruby 1.9.2 in development.\n # If the value is nil, we return nil straight away without checking\n # the regular expressions. If we check eac...
[ { "docid": "bef4cabfb3d76d64c3e08b4bff38bc7d", "score": "0.7631543", "text": "def default\n def_val = @data.fetch(:dflt_value)\n\n if def_val && (match = def_val.match(/\\A'(.*)'\\Z/))\n return match[1]\n end\n\n return nil if @data.fetch(:dflt_value).to_s.empty?\n def_val\n end", ...
695c9c433ed1ca604c0a8986831dc50e
GET /step_counts GET /step_counts.json
[ { "docid": "4e08cf3cd7d155f0620c1feb0268a53f", "score": "0.75344634", "text": "def index\n @step_counts = StepCount.all\n end", "title": "" } ]
[ { "docid": "c754c76b93b63ff8b6403beba0ae9258", "score": "0.707266", "text": "def step_counts\n return Array.new\n end", "title": "" }, { "docid": "d13b9d730c008b5ef1fca39051c453a2", "score": "0.6744795", "text": "def steps\n\t\tsum = 0\n\t\trender json: Step.group_by_mont...
a87d27568f5c9867607cff6b553e3adf
Wait for an email to match the provided filter conditions such as subject contains keyword. Generic waitFor method that will wait until an inbox meets given conditions or return immediately if already met
[ { "docid": "bace7ec2dd554ae88c37e99c6cb550c6", "score": "0.0", "text": "def wait_for_with_http_info(wait_for_conditions, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: WaitForControllerApi.wait_for ...'\n end\n # verify the required par...
[ { "docid": "7a323e4ded2dfb8b4f629d8476226cfe", "score": "0.64824075", "text": "def email_received?(subject)\n logger.info 'Waiting for an email to appear'\n verify_block { cell_element(:xpath => \"//td[contains(.,\\\"#{subject}\\\")][not(contains(.,\\\"Undeliverable\\\"))]\").when_visible Util...
723defe43f35118fcc40e9a0cc8460e0
After uploading a the profile picture has to be reloaded. Reloading: 1. loginContainer with users picture as profile link 2. picture container of the profile
[ { "docid": "c057e77f394562953dd3a71464110983", "score": "0.716771", "text": "def reload_pictures\n @user = current_user\n @profile = current_user.profile\n respond_to do |format|\n format.js do\n render :update do |page|\n page.replace 'loginContainer', :partial => 'users/u...
[ { "docid": "9d0cc5ad7b90d1e20dfad72360ea3ac8", "score": "0.6766609", "text": "def uploadProfilePicture\n if @current_user.update(profilePicture)\n Rails.logger.info \"****************#{@current_user.photo.url}****\"\n render json: @current_user , status: 200\n else\n render json: { ...
c5fb7edd496fea0facd5deb5cc14bce6
POST /converstation_requests POST /converstation_requests.json
[ { "docid": "255b3cdff92c9a53cc794d65dbd1b470", "score": "0.7179953", "text": "def create\n @converstation_request = ConverstationRequest.new(converstation_request_params)\n\n respond_to do |format|\n if @converstation_request.save\n format.html { redirect_to @converstation_request, not...
[ { "docid": "9c663aefed2d72d109c14879e8a223e8", "score": "0.630148", "text": "def converstation_request_params\n params.require(:converstation_request).permit(:requester_id, :exptert_id)\n end", "title": "" }, { "docid": "4747d9ba1bf11a73af695397aa3b88d4", "score": "0.6227904", ...
56c86b0cf9f2f85605bb4f72fba194b7
POST /letter_grades POST /letter_grades.json
[ { "docid": "f4bde3020123b092b31007581e7f557d", "score": "0.75388163", "text": "def create\n @letter_grade = LetterGrade.new(letter_grade_params)\n\n respond_to do |format|\n if @letter_grade.save\n format.html { redirect_to @letter_grade, notice: 'Letter grade was successfully created....
[ { "docid": "1e799f8be856a79d5765731e17c9d668", "score": "0.69217545", "text": "def create\n @grade = Grade.new(params[:grade])\n\n respond_to do |format|\n if @grade.save\n format.html { redirect_to @grade, :notice => 'Grade was successfully created.' }\n format.json { render :j...
a6aab1f3b68650434d31e3411041befb
GET /questionform_questions/1 GET /questionform_questions/1.xml
[ { "docid": "91331b08c603c11aab143219ccdb5f9d", "score": "0.7196742", "text": "def show\n @questionform_question = QuestionformQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @questionform_question }\n end\n end", ...
[ { "docid": "82fc080dea262a79e0a7089773f9a8e2", "score": "0.7210753", "text": "def questions\n self.class.get(\"/2.2/questions\", @options)\n end", "title": "" }, { "docid": "5cdece4b84976e0bbe9ac7fb89b9ec30", "score": "0.71803", "text": "def index\n @questions = @page.question...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "3f11f6324f3a8b43245080490a0ca8ef", "score": "0.0", "text": "def male4x100mt_params\n params.require(:male4x100mt).permit(:place, :achievement, :rail, :number, :athlete, :an, :club, :region, :country, :male4x100mts_id)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7498391", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6958937", "text": "def strong_params\n params.require(:request).permit(param_white...
649dd214333f033b516a2255f459985d
PATCH/PUT /products/1 PATCH/PUT /products/1.json
[ { "docid": "e1f4de67a5c6ff94b96abf6223bcef93", "score": "0.0", "text": "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: ...
[ { "docid": "306087ac201b8c728342c4a66d77b684", "score": "0.72476965", "text": "def update\n uri = \"#{API_BASE_URL}/products/#{params[:id]}\"\n payload = params.to_json\n rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n begin\n rest_resource.put payload , :content_typ...
d26fcadbf721a1ddb5001b5c547d7918
before_action :set_mine, only: [:index] GET /roles GET /roles.json
[ { "docid": "ebdd684587564df69f3c4aebdc5f0870", "score": "0.0", "text": "def index\n @miners = Miner.where(mine_id: current_mine.id)\n respond_to do |format|\n format.html\n format.json { render json: @miners.as_json(:include => [:tunnel]) }\n end\n end", "title": "" } ]
[ { "docid": "bbca6ea7d0c11f16aee8fa5bfc77cf6e", "score": "0.7340948", "text": "def index\n @core_roles = Core::Role.find_mine(params).paginate(page: params[:page])\n end", "title": "" }, { "docid": "fd6d98644a771196d9eeee6e36f133d8", "score": "0.69526863", "text": "def roles\n ...
09b291a8c9cd5e20d9a5c1c1ffab810e
proxy to read timeline in model
[ { "docid": "1eb1518d79a202b7938c2266f801c357", "score": "0.5366627", "text": "def read(from=3.years.ago, to=Time.now, user_id, filter)\n read_timeline(from, to, user_id, filter)\n end", "title": "" } ]
[ { "docid": "d7eacc3fe4a5e2e3fbfdbd11d3988629", "score": "0.7267178", "text": "def parse_timeline\n\nend", "title": "" }, { "docid": "8b372c8c86320b48fa6a217712ed4da3", "score": "0.6957105", "text": "def timeline\n request('timeline')\n end", "title": "" }, { "...
b5992fcd97d5624a0fd633430b084c9e
For all responses in this controller, return the CORS access control headers.
[ { "docid": "f79d6c72c208d7defe067e18558f9d6c", "score": "0.0", "text": "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\nend", "title": "" } ]
[ { "docid": "057f2386db924cfecb4f334d9575db4d", "score": "0.76442415", "text": "def cors_set_access_control_headers\n headers[CORS_HEADER_ALLOW_ORIGIN] = request.headers[CORS_HTTP_ORIGIN]\n CORS_FIXED_HEADERS.each do |k, v|\n headers[k] = v\n end\n end", "title": "" }, { "docid...
9fc17d879ceae1d26d07b958904704ac
Returns the total sum of grains on the chessboard
[ { "docid": "ca2240b644314110b6ea24cbdf94e40c", "score": "0.0", "text": "def total\n sum = 0\n 64.times do |counter|\n sum += (2**counter)\n end\n sum\n end", "title": "" } ]
[ { "docid": "13bdfb984adec4eb088159467258a246", "score": "0.8036306", "text": "def total\n # Each square has 1 << (n-1) grains of rice, one more than all squares\n # before it combined. The total number of grains on a chess board can\n # thus be calculated by subtracting one from the number of g...
1c84390d2a400055ab70977217256997
PATCH/PUT /people/1 PATCH/PUT /people/1.json
[ { "docid": "270972041babd5012bcf8adb63162b45", "score": "0.0", "text": "def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: t('helpers.modifications_done') }\n format.json { render :show, status: :ok, location: @stu...
[ { "docid": "fe34f93da0751ad55cc5052cfdd2366c", "score": "0.72376037", "text": "def update\n render json: Person.update(params[\"id\"], params[\"person\"])\n end", "title": "" }, { "docid": "6ae6b17460ba8c07daf1a237b1b63696", "score": "0.6948003", "text": "def update\n \n ...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "b82987f63111c0171b4379e121145db2", "score": "0.0", "text": "def foothold_params\r\n params.require(:foothold).permit(:name, :local, :responsible, :geolocation, :observation, :affiliate_id, :work_id)\r\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7943618", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.69572574", "text": "def permitted_params\n params.permit!\n end", "title"...
dcff2737b6f37992a277c1bae5eb398d
PUT /skill_categories/1 PUT /skill_categories/1.xml
[ { "docid": "6848e7eddd032189740107203067b9e3", "score": "0.6967245", "text": "def update\n @skill_category = SkillCategory.find(params[:id])\n\n respond_to do |format|\n if @skill_category.update_attributes(params[:skill_category])\n format.html { redirect_to(@skill_category, :notice =...
[ { "docid": "8a02e9e92a49bf9c519daee360ffcb8c", "score": "0.6842635", "text": "def update\n @skill_category = SkillCategory.find(params[:id])\n\n respond_to do |format|\n if @skill_category.update_attributes(params[:skill_category])\n format.html { redirect_to @skill_category, notice: '...
c7ee38ce6cf9a6fa625d5bef958f88de
call to find out if the transaction has succeeded.
[ { "docid": "8e1b14601c02796fbaf941625e669d6e", "score": "0.0", "text": "def succeeded?\n authorized? || paid?\n end", "title": "" } ]
[ { "docid": "0c1cb20b476fc12c5db179fb72b7a479", "score": "0.8260239", "text": "def transaction_succeeded?\n transaction_status == 'TRANSACTION_SUCCEEDED'\n end", "title": "" }, { "docid": "9c3d118340a8b3a3eec6867c9a64716d", "score": "0.80265176", "text": "def transaction_successfu...
24f7a220316ecb631f1ee5ab49ae3c0c
Returns ngram letter by letter
[ { "docid": "4e90d5174952ef21670441d1bb73845a", "score": "0.76541823", "text": "def create_letter_n_gram(sentence, n_gram)\n letters = sentence.delete(' ')\n letters.chars.each_cons(n_gram).with_object([]) do |letter, array|\n array << letter\n end\nend", "title": "" } ]
[ { "docid": "4381ff5c36b0c7f915c1b07cc72cd070", "score": "0.70916295", "text": "def ngram(str, n)\n str.chars.each_cons(n).to_a.map &:join\n end", "title": "" }, { "docid": "80547b8e11f5b1dc839890f85a891ad7", "score": "0.6781977", "text": "def ngrams(n, string)\n string.split('...
669b721258ef5aeaaba027acc4f62ada
Returns the current JWT User if it exists
[ { "docid": "1633b6e1327529db4d92fe1e052179df", "score": "0.80253625", "text": "def current_jwt_user\n @jwt_user ||= session[:jwt_user] ? JwtUser.where(id: session[:jwt_user]).first : nil\n end", "title": "" } ]
[ { "docid": "f5514a444cd5074cb9fd939cfc7d168e", "score": "0.84150195", "text": "def current_user\n return nil if authorization_header.blank? || jwt_token.blank?\n\n data = JWT.decode(jwt_token, jwt_secret_key, true, algorithm: \"HS256\", verify_jti: true)[0]\n\n User.find_by(id: data[\"sub\"])\n...
4dfbd73f4ac4c16710c4d30c2ecf28c3
Returns all the necessary attributes with it's original names that must be passed with Sale transaction.
[ { "docid": "38c2e24802a160a9815decf3853243cf", "score": "0.58074296", "text": "def params_for_sale(order)\n attributes_for_request.merge(order.attributes_for_request)\n end", "title": "" } ]
[ { "docid": "ec03c32a18b0ad92145f3a2f4e8b7182", "score": "0.65653306", "text": "def sensitive_attributes\n %w(price quantity handling_price out_of_stock pre_order)\n end", "title": "" }, { "docid": "add7871ace4c1d48036b3fc2b406ba90", "score": "0.62154627", "text": "def attributes\...
82155171e0838749605019fd07566e25
Help method that counts the number of visits a person has during the last given number of months
[ { "docid": "e485572a25ce17871f62445b6a99bde1", "score": "0.7695934", "text": "def countInterval(person, nbrOfMonths)\n @count = 0;\n @date = Date.today - 30*nbrOfMonths\n person.visits.each do |visit|\n if visit.date > @date\n @count = @count+1\n end\n end\n return @count...
[ { "docid": "6d531220428056d12da329bee981e14a", "score": "0.6872406", "text": "def referrals_this_month_count\n referrals.where(\"created_at >= ?\", Time.now.beginning_of_month).count\n end", "title": "" }, { "docid": "0b9c25721858a8aa5500e4051b5811f2", "score": "0.67736804", "tex...
5918dff56e4d2247d61671612faed41b
PUT /foros/1 PUT /foros/1.xml
[ { "docid": "c2b43611232e1f983a71d13150b1f62d", "score": "0.0", "text": "def update\n @foro = Foro.find(params[:id])\n expire_fragment Time.now.to_date.to_s\n \n respond_to do |format|\n if @foro.update_attributes(params[:foro])\n flash[:notice] = 'Foro se ha actualizado con exito...
[ { "docid": "38979984bdedacd95706689e25f09f9e", "score": "0.65534204", "text": "def put(document, method='')\n @resource[method].put(document.to_s, :content_type => 'text/xml')\n end", "title": "" }, { "docid": "23b5f5e4dacfb330cb1e0ffd4590ef63", "score": "0.6379051", "text": ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "7ad224d63d72278dae0b40a18d68ad05", "score": "0.0", "text": "def dsqu_params\n params.require(:dsqu).permit(:user_name, :body, :issue_id)\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...
c7a881bfab30265c53a05b1b9e1180f7
generate a report for selected currency report should show: basic statistics: mean, median, average also You can generate a simple chart(use can use some js library) this method should be available only for currencies which exist in the database
[ { "docid": "061c60595496ac6cb79443b1869429d8", "score": "0.68327045", "text": "def report\n currency = Currency.where(code: params[:money_id])\n unless currency.empty?\n @currency_hash = currency.raport_hash\n @chart_prices = currency.prices_hash\n @exchange = params[:exchange]\n ...
[ { "docid": "b7f3d5c8bcf9d6825938c072937c2907", "score": "0.7840791", "text": "def report\n @symbol = params[:id]\n @currencies = Currency.where(code: @symbol).order(exchange_id: :asc)\n\n @buy_average = @currencies.average(:buy_price).round(4)\n @sell_average = @currencies.average(:sell_pric...
2d814c58baf29cd65b1279db9ef1101b
Returns the header portion of the raw http response.
[ { "docid": "c1532d1c5e0b61e8dcf7647c6ac114bd", "score": "0.669677", "text": "def raw_header include_headers=true\n headers = \"#{@raw.split(\"\\r\\n\\r\\n\", 2)[0]}\\r\\n\"\n\n case include_headers\n when nil, false\n nil\n\n when Array, String\n includes = [*include_he...
[ { "docid": "952325b40c60af90da1d5b885b48663e", "score": "0.79286945", "text": "def header\n return nil if response_header.nil? && @header.nil?\n @header ||= Response::Header.new(response_header.split(\"\\r\\n\\r\\n\").last)\n end", "title": "" }, { "docid": "d44ec597ebcc9d...
458dc488fc6cb19acb61de58bcbc5ab3
connect GET requests to attach of Pod
[ { "docid": "b04f0c0c6f961defe3ce5312506c1cf3", "score": "0.48391792", "text": "def connect_get_namespaced_pod_attach(name, namespace, opts = {})\n data, _status_code, _headers = connect_get_namespaced_pod_attach_with_http_info(name, namespace, opts)\n return data\n end", "title": "" }...
[ { "docid": "40bf520ef4a0eca6497c09b83e5cf4a1", "score": "0.642857", "text": "def connect_get_namespaced_pod_attach_with_http_info(name, namespace, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CoreV1Api.connect_get_namespaced_pod_attach ...\"\n...
2f6abfcc73e563fa3740374e4cd3058a
GET /my_wallets/1 GET /my_wallets/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "e681a22094131a80724049e63dfa1a3d", "score": "0.7621785", "text": "def show\n @wallet = Wallet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wallet }\n end\n end", "title": "" }, { "docid": "7bcaa2b6793...
58feac574e1389b1fd29736f8a9de2b2
Perform an HTTP request
[ { "docid": "a27d1ac1640edd1d476ba0c3f674ede4", "score": "0.0", "text": "def request(method, path, params = {}, options = {})\n\n raise AirbrakeError.new('API Token cannot be nil') if @auth_token.nil?\n raise AirbrakeError.new('Account cannot be nil') if @account.nil?\n\n response = connec...
[ { "docid": "e4e961ad065b33c3e715b929f44dab3a", "score": "0.7807713", "text": "def do_request()\n uri = URI.parse(API_BASE_URL + build_request_path())\n response = Net::HTTP.get_response(uri)\n response.body\n end", "title": "" }, { "docid": "2ba260502f9375d41a6d0c0323e7506f...
e8c0b7fe3cde870b8f9a42e7419de020
Do the sync. Options: :full = true means clear the cached content files first, :dryRun means don't do the actual copies and deletes, but just show what they would be. N Without this, there won't be a single method that can be called to do the sync operations (optionally doing a dry run)
[ { "docid": "87b27233b1931d1a6f080d895846b1cd", "score": "0.7811997", "text": "def doSync(options = {})\n #N Without this, the content files will be cleared regardless of whether :full options is specified\n if options[:full]\n #N Without this, the content files won't be cleared when the...
[ { "docid": "63ae6356abefe22026178441b43e92c9", "score": "0.7001521", "text": "def sync\n run 'sync', :quiet => true\n end", "title": "" }, { "docid": "43a85075c6d7d4bdbac7aea5067296a7", "score": "0.6518536", "text": "def sync\n local_directories.each do |local_dire...
3e00951ac66e8a30748cc8d1d67448d2
Used for create_pool_spare Finds spare disks Node_list should be array [node1, node2] Returns false if any call was unsucessful Return [[disk_names of spares], [spare disk on node2, spare disk on node1]]
[ { "docid": "0363170171ecb8422161ac6e4891d2ae", "score": "0.6450519", "text": "def invoke_NAElem_disknames(api_hash, request, node_list)\r\n\r\n\t \t\tif api_hash[:svm].empty?\r\n\t\t response = invoke_api(request)\r\n\t\t else\r\n\t\t response = invoke_api(request, api_hash[:svm])\r\n...
[ { "docid": "8d47b2f1389d02ba79428b216a64978e", "score": "0.6431832", "text": "def usable_spare?\n if @spare_validation_errors.nil?\n @spare_validation_errors = []\n \n # The order of checks is important -- if the node isn't even reachable by SSH,\n # don't run any of the...
b8d780a4c36fecadb90f33ffc461221e
Returns players for the new chess game
[ { "docid": "ffede6b2f6553ae6a7a65d65382d72ba", "score": "0.6676058", "text": "def set_players\n print \"Enter name of Player 1 (white): \"\n player1 = create_player(gets.chomp, 1)\n assign_pieces(player1)\n\n print \"Enter name of Player 2 (black): \"\n player2 = create_player(gets.chomp,...
[ { "docid": "52b78cb5a79bae4e89a6d8c04fe9e83d", "score": "0.71084446", "text": "def players\n @players.select(&:playing)\n end", "title": "" }, { "docid": "c0964ff99736e6410fb54e80018c69b4", "score": "0.697152", "text": "def players\n @players ||= []\n end", "t...
4b1f1381ba0a20f17bcbda7610c88ff5
How would you reverse a given word without using any convenience methods (i.e. reverse in Ruby).
[ { "docid": "be518c2687eda8eb521015a54e315452", "score": "0.0", "text": "def find_highest(array)\n highest = nil;\n for num in array do\n if highest\n if num > highest\n highest = num\n end\n else\n highest = num\n end\n end\n ...
[ { "docid": "1809cf3fc06fe8254bf0e21bae302db1", "score": "0.87588966", "text": "def reverse_word(word)\n return word.reverse\n end", "title": "" }, { "docid": "0899bb5670614ced8d96f5bd65b31600", "score": "0.8428901", "text": "def reverse_string word\n\t\treturn word.revers...
3d77e027391334fb219fecf72d577098
returns the path relative to the root_path for the application
[ { "docid": "a37df5ce441879416af9517f614d8c6e", "score": "0.0", "text": "def relative_path(p = path)\n anchor = p.ftype == \"directory\" ? @root_path : \"public\"\n p.relative_path_from(Pathname.new(anchor).realpath)\n end", "title": "" } ]
[ { "docid": "02a44d3314a52fcc13acd23d930e9bb3", "score": "0.82989365", "text": "def app_path\n \"#{root}/app\"\n end", "title": "" }, { "docid": "02a44d3314a52fcc13acd23d930e9bb3", "score": "0.82989365", "text": "def app_path\n \"#{root}/app\"\n end", "title": "" }, { ...
04223a08eb350374425b7fb0258b24a7
A little helper to add the cdw_flag_prefix to a given list of flags If prefix is nil or blank then just pass the flag list unchanged.
[ { "docid": "d897f2930a614a14366a059b1649fb41", "score": "0.76587737", "text": "def prefixed_flag_list(flag_list, prefix)\n if prefix.present?\n flag_list.map do |flag|\n \"#{prefix}_#{flag}\"\n end\n else\n flag_list\n end\n end", "title": "" } ]
[ { "docid": "f910d28164e865d1d5994032c1028ed1", "score": "0.56330514", "text": "def add_flags(*flag_args)\n @pattern = nil\n @flags = (@flags + flag_args).uniq\n\n self\n end", "title": "" }, { "docid": "fb5090b33db4d3abefedeca3c76ebe06", "score": "0.5603843", "tex...
c9c3ca8417b49e605759d569caae093f
array The Array element The element to add Examples append([6,2], "banana") => [6, 2, "banana"] append([600, "banana", 5.432], 900) => [600, "banana", 5.432, 900] Returns the new Array
[ { "docid": "c4814d6f9af974909e3beac7980070a3", "score": "0.6775135", "text": "def append(array, element)\n if !array.is_a?(Array)\n return nil\n else \n return array + [element]\n end\nend", "title": "" } ]
[ { "docid": "512da72c3ceeae157a54272f2e3a160e", "score": "0.77105147", "text": "def add_to_array(array, element)\n array << element\nend", "title": "" }, { "docid": "4d1982c989fe902abfb0457a0aa3066e", "score": "0.7621105", "text": "def add_to_array(array, item)\n\tarray << item\n\tre...
a82e835d092c071281e33bfcd138a822
Defines a protofeed. See "Following users" for the full implementation.
[ { "docid": "ad90b1d90e72e9c4449df03baee600b2", "score": "0.0", "text": "def feed\n # escape the id to avoid security holes\n Micropost.where(\"user_id = ?\", id)\n end", "title": "" } ]
[ { "docid": "e0c43769723b95cd41d57ce59eb2fbd7", "score": "0.596254", "text": "def feed\n FeedItem.from_users_followed_by(self)\n end", "title": "" }, { "docid": "48b6d1c7bdcc8f8087783d34728bcdd7", "score": "0.5871191", "text": "def feed_to\n @feed_to_users ||= [self] | self...
792849b42cf657179f6e0c404377e18d
Private method available to package controller methods : used for strongly checking paramaters to various actions to City model Params: permitted city db id & Package db id for city model command :: command line string to be executed by the system outhandler :: +Proc+ object that takes a pipe object as first and only p...
[ { "docid": "26304c5bc4189f96ba7417412c455b76", "score": "0.52325976", "text": "def city_params\n params.permit(:city_db_id, :package_db_id )\n end", "title": "" } ]
[ { "docid": "2de92747417d90e81f5e9752c7b4822d", "score": "0.57606244", "text": "def execute\r\n $LOG.debug \"PpmToGdlApp::execute\"\r\n\r\n if(@user_choices[:customer])\r\n @controller.customer = @user_choices[:customer]\r\n end\r\n \r\n if(@user_choices[:verbose])\r\n ...
1de85166595154c95c5af2f706d902c9
We are going to connect this user object with a facebook id. But only ever one account.
[ { "docid": "d1b14d5986278b9c85040e980a78e391", "score": "0.7152669", "text": "def link_fb_connect(fb_user_id)\n unless fb_user_id.nil?\n # link fb user id\n self.fb_user_id = fb_user_id\n save(false)\n end\n end", "title": "" } ]
[ { "docid": "1f5d3b6d1fee5be5ef3a188c5c38e637", "score": "0.7445132", "text": "def link_fb_connect(fb_user_id)\n unless fb_user_id.nil?\n # check for existing account\n existing_fb_user = User.find_by_fb_user_id(fb_user_id)\n # unlink the existing account\n unless existing_fb_user....
d09fefbdf37933a0ea9709f8dafa1867
given an array of student names, like ['Bob', 'Dave', 'Clive'] give every possible pairing in this case: [['Bob', 'Clive'], ['Bob', 'Dave'], ['Clive', 'Dave']] make sure you don't have the same pairing twice,
[ { "docid": "c832910240f0c5aa4ea9809870cb3409", "score": "0.78380364", "text": "def every_possible_pairing_of_students(array)\nend", "title": "" } ]
[ { "docid": "3eb9ded98e11e21b72ae0bd1277fdc83", "score": "0.81791586", "text": "def every_possible_pairing_of_students(array)\n array.combination(2).to_a.uniq\nend", "title": "" }, { "docid": "b700fbcd98923be3c22157efd9077bfa", "score": "0.7935578", "text": "def every_possible_pairin...
6c832f49c12f9c1604ecff34e601a5c5
Expire an account. This is for cron jobs and manually expiring of accounts.
[ { "docid": "c87c586334fb0454bfa0f45b57471bf4", "score": "0.5970836", "text": "def expire!(at = Time.now.utc)\n self.expired_at = at\n save(validate: false)\n end", "title": "" } ]
[ { "docid": "a18f4f86ee6ea2e8984cb7e2580edd96", "score": "0.69206476", "text": "def expire!\n Freemium.mailer.deliver_expiration_notice(self)\n # downgrade to a free plan\n self.expire_on = Date.today\n self.subscription_plan = Freemium.expired_plan if Freemium.expired_plan\n sel...
7f2c43c29655431687525ff6dbc425bc
Look for a usersupplied config path by manually parsing the option. Note that we can't use Mixlib::CLI for this. To ensure that ChefApply::CLI initializes with correct option defaults, we need to have configuration loaded before initializing it.
[ { "docid": "fe92fbff82c65031cffde282ba65a502", "score": "0.71584266", "text": "def custom_config_path\n argv.each_with_index do |arg, index|\n if arg == \"--config-path\" || arg == \"-c\"\n next_arg = argv[index + 1]\n raise ConfigPathNotProvided.new if next_arg.nil?\n ...
[ { "docid": "9947449f726dc72e3beeb4ca7f56399d", "score": "0.66615707", "text": "def optional_config_file\n if ::File.exists?(@options.to_s)\n @options = @global.load_ruby_config(::File.expand_path(@options))\n end\n end", "title": "" }, { "docid": "4fe1cef4314f3839...
caa00818b5e43bfb0d57a7299ccdd92e
NOTE: Override in model to provide a custom id
[ { "docid": "8213d908b95d2eb889a41f82fef793ae", "score": "0.0", "text": "def urn_id\n :id\n end", "title": "" } ]
[ { "docid": "f05f3c65d69b18401e92ae78dca6ef70", "score": "0.7808146", "text": "def id # {{{\n @data[:id] || super\n end", "title": "" }, { "docid": "a6adafbeed3fc2bbd68f40346babc898", "score": "0.77797383", "text": "def get_id() @id end", "title": "" }, { "doci...
351f2b0b64023ed778287f919cbc318c
GET /pages GET /pages.json
[ { "docid": "9ed84f0f6f78f6e1f9550fbc2457bda4", "score": "0.0", "text": "def index\n return check_logged_in unless current_user\n @pages = current_user.pages\n end", "title": "" } ]
[ { "docid": "64e61b39be3e009082a46bd86ef7f8cc", "score": "0.80336875", "text": "def index\n @pages = Page.page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "title": "" }, { "docid": "0e06be4547a...
eebc6bbbd53ad62e1628b8a0e17745ac
TODO: The database should store both names, the plain name and the formatted name
[ { "docid": "b83691b8762ab3b5bfc55338a4ba21c2", "score": "0.0", "text": "def stripped_name\n name.gsub(%r{</?i>}, '')\n end", "title": "" } ]
[ { "docid": "7ed9aa18e7dfd8af7fa0d28048e64938", "score": "0.69848174", "text": "def name_format\n self.name.gsub!(/[^0-9a-z\\-_ ]/i, '_') unless self.name.nil?\n self.name.gsub!(/\\s+/, '-') unless self.name.nil?\n self.name = self.name.downcase unless self.name.nil?\n end", "title": "" }...
4a81f95348b086a9f7ff2698c838ec11
======================= TEST warnIfNotOnArm64 =======================
[ { "docid": "66da6eb7f0478c355efb200034031500", "score": "0.7602235", "text": "def test_warnIfNotOnArm64_whenSysctlReturnsNot1_printsNothing\n # Arrange\n SysctlChecker.set_call_sysctl_arm64_return_value(23)\n Environment.set_ruby_platform(\"something\")\n\n # Act\n Rea...
[ { "docid": "79161fe6929dc00dda802480a136086e", "score": "0.6631288", "text": "def build_arch\n \"x64\"\nend", "title": "" }, { "docid": "288562316e88ef45e417cf1ea59a2cb6", "score": "0.66297376", "text": "def is_64bit?\n java.lang.System.getProperty('os.arch').include?('64')\n en...
09dd8bfbb6fa452ed28d0c521170910e
DELETE /interfaces/1 DELETE /interfaces/1.json
[ { "docid": "66f8edfc9f25b231b54af550c29f8273", "score": "0.7751809", "text": "def destroy\n @interface = Interface.find(params[:id])\n @interface.destroy\n\n respond_to do |format|\n format.html { redirect_to interfaces_url }\n format.json { head :no_content }\n end\n end", "t...
[ { "docid": "c29a33a280d5b62b60a5977bb8c853e0", "score": "0.71715987", "text": "def destroy\n @interface = SWUI::Interface.find(params[:id])\n @interface.destroy\n\n respond_to do |format|\n format.html { redirect_to(interfaces_url) }\n format.xml { head :ok }\n end\n end", "t...
a4d1745da907e002ae161910e7b03119
End Last Update Translate Object
[ { "docid": "5230daa4888da58695d98db1f808b9b4", "score": "0.0", "text": "def delete_data(name)\n tomdata = YAML::Store.new(\"data.yml\")\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# Open data.yml\n tomdata.transaction {tomdata.delete(name.to_sym)}\t\t\t\t\t\t\t\t\t\t\t\t# Delete name\n tomdata.transaction {tomdata....
[ { "docid": "4e02ca5d61891fbb9316ab43da86fa46", "score": "0.63810265", "text": "def lang_finished(_lang_result)\n end", "title": "" }, { "docid": "c3232138ccb6c1f166e472d18580c21f", "score": "0.63043875", "text": "def last_update_translate(name)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\...
995fcbe4456b81ec815abf2fc44388e5
GET /websites GET /websites.xml
[ { "docid": "8602cbdb34aec0514be5c2bb1e8c4b01", "score": "0.721302", "text": "def index\n @websites = Website.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @websites }\n end\n end", "title": "" } ]
[ { "docid": "52e99481863e12915642b7f66ded01fc", "score": "0.71633923", "text": "def websites\n query = {\n :module => 'WebsiteFeed',\n :output => 'xml'\n }.merge(@auth)\n result = self.do_get(query)\n result = [result] if result.is_a?(Hash)\n result\n end", "title": "" }, ...
fab283656adb5aaf715cd9059eb0b5f9
Inspect this instance attributes
[ { "docid": "a157a20be11c953054c36cec014192c0", "score": "0.0", "text": "def inspect\n \"#<#{self.class.name} decorators=#{decorators.inspect}>\"\n end", "title": "" } ]
[ { "docid": "d7a9b9c1478619076c17a1b1d5bd70d7", "score": "0.7728902", "text": "def attributes\r\n @@attributes\r\n end", "title": "" }, { "docid": "90b2703ce9ccb96f3826f6494b8a6922", "score": "0.76919484", "text": "def attributes()\n #This is a stub, used fo...
1fab9f8cf7611a3d7e9728099128268a
GET /flashcards/1 GET /flashcards/1.json
[ { "docid": "24bd6debca2c1b978f3ed004f1b31258", "score": "0.78846776", "text": "def show\n @flashcard = Flashcard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flashcard }\n end\n end", "title": "" } ]
[ { "docid": "da98e6489b1616656583fc22290b024e", "score": "0.7889599", "text": "def index\n @flashcards = Flashcard.all\n render json: @flashcards\n end", "title": "" }, { "docid": "da98e6489b1616656583fc22290b024e", "score": "0.7889599", "text": "def index\n @flashcards = Fl...
c511e254c73f849c81aa2b29ea3bae94
15. Accomplish the same thing by only using IDs (hint: there's an association method for this...)
[ { "docid": "6072352452dd285ac78a129c338fdc1a", "score": "0.0", "text": "def replace_post_authors_2 \n # method: destroy all linked user_posts, then create new ones\n Post.first.user_posts # display to pre-test\n Post.first.user_posts.destroy_all\n user_id_collection = [User.second.id, User.fifth.id...
[ { "docid": "1f9181404b780a4927a10d482bb2fdc9", "score": "0.69211704", "text": "def id(*) end", "title": "" }, { "docid": "1f9181404b780a4927a10d482bb2fdc9", "score": "0.69211704", "text": "def id(*) end", "title": "" }, { "docid": "a0685276d7ddb198a39f2cf63d5b1267", "...
699aa9812e92fa284c901fe5fa946696
Return true if there are pending changes to domain that require a restart
[ { "docid": "0ae448184ed5058a906f9cedc8e14c27", "score": "0.7382011", "text": "def pending_configuration_changes?\n return true if context.restart_required?\n return false if self.context_only\n (context.exec('_get-restart-required', [], :terse => true, :echo => false) =~ /^tru...
[ { "docid": "26ee3d8d596103be96b02dbd5e37e3c6", "score": "0.72056216", "text": "def restart_pending?\n @restart ||= false\n end", "title": "" }, { "docid": "c6db1d58c2b6f979bd76fd7b31f140ba", "score": "0.6756694", "text": "def must_restart?\n return @restart\n end", "t...
b3bd4142acce4b2588c28fd885de4e72
The path used after sign up.
[ { "docid": "0dc5bba171bbbf4db3d302b9d13b87c4", "score": "0.0", "text": "def after_sign_up_path_for(resource)\n redirect_to root_path\n end", "title": "" } ]
[ { "docid": "ebac96bfd33057ace5ac8761861fe875", "score": "0.74486095", "text": "def path\n root? ? boot_path : user_path\n end", "title": "" }, { "docid": "ebac96bfd33057ace5ac8761861fe875", "score": "0.74486095", "text": "def path\n root? ? boot_path : user_path\n end...
313eaa30c683c047d7def2998e5ce305
Public returns true if calendar has events, false otherwise
[ { "docid": "7f94c4ea8e9e3dacc82a6c17d25cbb0a", "score": "0.9098121", "text": "def events?\n !@calendar_events.empty?\n end", "title": "" } ]
[ { "docid": "78812756a497f79dafac9b1e4102d8b3", "score": "0.8393076", "text": "def has_calendar?\n \t\t!calendar.nil?\n \tend", "title": "" }, { "docid": "e00656a8e3f270b080dea5ab4e864b0e", "score": "0.81513727", "text": "def events_at?(date)\n !@calendar_events[date].empty?\n e...
06f0fa645e3393780596ba48d9271447
def self.save_new_draft(current_user, drafted_hash, temp_id = nil) if temp_id.nil? temp_id = randstr() drafted_hash[:temp_id] = temp_id drafted_hash = Marshal.dump(drafted_hash) Draft.create( :creator => current_user, :temp_id => temp_id, :model_type => "Story", :drafted_hash => drafted_hash ) else drafted_hash[:temp_i...
[ { "docid": "8f7326e9739cfda79e3c64bf63e190bf", "score": "0.8127385", "text": "def save_draft(user, _temp_id)\n temp_id = _temp_id.blank? ? randstr : _temp_id\n \n draft = Draft.find_or_initialize_by_temp_id(temp_id)\n\n return temp_id if draft.update_attributes(\n :creator => user,\n...
[ { "docid": "97f4bc41b6ae8a2202ba3b90b01271a1", "score": "0.6908843", "text": "def save_from_draft!\n load_from_draft\n save!\n end", "title": "" }, { "docid": "33cd562414ebdf45bc4b717c02d5fd3c", "score": "0.6839168", "text": "def save_from_draft\n load_from_...
22c63535dcb6221fc563d2c92850b761
Assumes delta will contain only one document modifying op
[ { "docid": "c5d19d9ece481a8313786cf05624e92e", "score": "0.63278323", "text": "def apply_delta(delta, toolbar_only = false)\n index = 0\n delta['ops'].each_with_index do |op, i|\n if op['value']\n if !op['attributes'].empty?\n click_button_from_toolbar(op['attributes'].keys[0]...
[ { "docid": "db3376ab6fa020ad1b6ab26e6562e956", "score": "0.6523256", "text": "def update(delta)\n end", "title": "" }, { "docid": "3417643d8c5f655e220b1494a91e2fc3", "score": "0.6473491", "text": "def update(delta)\n #\n end", "title": "" }, { "docid": "8125057e876d1...
0119406fb4474957456474101e60a578
Sets or gets the default view order for this document type. When setting, +attribute+ should be the property name.
[ { "docid": "f1ae065ff7137a296065458c4fd94b36", "score": "0.79926574", "text": "def default_order(attribute=nil)\n if attribute\n property = properties[attribute.to_sym]\n \n write_inheritable_attribute(:default_order, property ? property.as : attribute)\n reset...
[ { "docid": "032238c92432f92efec6b88e5bdec766", "score": "0.6984594", "text": "def set_order_attribute\n key = \"#{model.content_key}_order_attribute\"\n preferred_order = preference(key)\n\n @order_attribute = if params[:order].present?\n set_preference(key, params[:order])...
8508b66d3134982c3347a2ca4dbe463c
Write data in a remote file. Folders in the path will be automatically created as needed.
[ { "docid": "f8b573217005d055219cc3174b6a7aaa", "score": "0.0", "text": "def write(path, data, delay = true, deferrable = EM::DefaultDeferrable.new)\n retries = 0\n \n if delay\n @queue.push(:path => path, :data => data, :deferrable => deferrable)\n else\n deferrable.timeo...
[ { "docid": "e3b79770d68e4c04dcdd48cf33fb91d8", "score": "0.74352956", "text": "def write_file(remote_file, data)\n raise ConnectionClosed.new('Connection is closed.') unless @ssh\n sftp.file.open(remote_file, 'w') do |f|\n f.write data\n end\n end", "title": "" }, { ...
91a2c7f5b0a8138e985f868067b2b2a5
Returns an array with the names of the subclasses of +self+ as strings. Integer.subclasses => ["Bignum", "Fixnum"]
[ { "docid": "da8fd0dbfbd3c7460a82360fd0b0d6fb", "score": "0.81734604", "text": "def subclasses\n Object.subclasses_of(self).map { |o| o.to_s }\n end", "title": "" } ]
[ { "docid": "5f8a53bcba94495c9e79083a9ff63ee3", "score": "0.7414801", "text": "def subclasses_all\n ret = []\n each_subclass {|c| ret.push c}\n ret\n end", "title": "" }, { "docid": "e2e71994e099dc4e4c099cb28d95fdba", "score": "0.72212756", "text": "def subcl...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "cfc3531ebfb879e017e4e874a48feb0e", "score": "0.0", "text": "def order_params\n params.require(:order).permit(:todays_date, :date_first_available, :phone, :email, :origin_first_name, :origin_last_name, :origin_street, :origin_city, :origin_state, :origin_zip, :origin_cell_phone, :destina...
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7493595", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6954758", "text": "def strong_params\n params.require(:request).permit(param_white...
2074e1385d76aaf3e1908fc53704f288
Converts to a hash object.
[ { "docid": "ff22b2cf5f864dc8ca67c79fe8138dac", "score": "0.0", "text": "def to_h\n raise NotImplementedError, '`#to_h` method must be implemented'\n end", "title": "" } ]
[ { "docid": "ed81e99b1fb9dd0bdfbee8bf918e513d", "score": "0.8483871", "text": "def to_hash() end", "title": "" }, { "docid": "721f270e23858e628b56e855a4fd9967", "score": "0.78847164", "text": "def hash\n to_a.hash\n end", "title": "" }, { "docid": "394b85e42986f180...
7b88c00e7820d2d9cb2a2ce1ab8645fb
delete cache tag names
[ { "docid": "ace391b2d2c8cd3ad30adddd5849750d", "score": "0.8355232", "text": "def delete_tags_name_cache\n Rails.cache.delete_matched(\"/submissions/tag_name/#{self.id}-*\")\n end", "title": "" } ]
[ { "docid": "f94a041aae025b474cecc00367925386", "score": "0.72566146", "text": "def delete_tags(name); end", "title": "" }, { "docid": "9a0c161288d9d51ad760a91bf92c3051", "score": "0.70754373", "text": "def delete_tag(name); end", "title": "" }, { "docid": "107f46663d25cc8...
544cf89167c42b921c6b69a2e7d5a81e
Sets foreground color of given control. ==== Description Color is in format Color ==== Syntax display ctrlSetForegroundColor color ==== Parameters +display+ Control +color+ Array ==== Returns Nothing ==== Multiplayer ==== See Also Official Wiki: ==== Examples ====== Example 1: _control ctrlSetForegroundColor [1, 0, 0, ...
[ { "docid": "8dcde70929748f1824b73b43e9e72b85", "score": "0.7580423", "text": "def ctrlSetForegroundColor _obj, _args\n \"_obj ctrlSetForegroundColor _args;\" \n end", "title": "" } ]
[ { "docid": "454109e25ffb5dd207926ad923a844f9", "score": "0.65137136", "text": "def set_colors(fg, bg)\n cp = RubyText::Color.pair(fg, bg)\n @cwin.color_set(cp)\n end", "title": "" }, { "docid": "5010938fa10e19736803dbc17f7fe6ee", "score": "0.6363145", "text": "def foreground=(...