query_id stringlengths 32 32 | query stringlengths 7 6.75k | positive_passages listlengths 1 1 | negative_passages listlengths 88 101 |
|---|---|---|---|
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "9b31f053bab044dd9e056734bd14ef72",
"score": "0.0",
"text": "def set_todo\n @todo = User.find_by_id(session[:user_id]).todos.find_by_slug(params[:slug])\n @recur = @todo.recur\n\n if @recur.nil?\n @recur = Recur.new\n end\n\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... |
8c85df02be5bf20995470235f6366d55 | This validates that the keys are valid. If they are, it sets the value of that key's corresponding method to the given value. If a key ends with a '?', it's validated as a File method. | [
{
"docid": "9c30604ba3eff195873975485cc7757b",
"score": "0.60190284",
"text": "def validate_and_set_options(options)\n options.each do |key, value|\n key = key.to_s.downcase\n\n if key[-1].chr == '?'\n sym = key.to_sym\n\n unless File.respond_to?(sym)\n raise Argument... | [
{
"docid": "3b1723eb2f42a5c157eaaa6bcb0070d2",
"score": "0.5882534",
"text": "def set(key, value)\n method_name = \"validate_#{key}\"\n send(method_name.to_sym, value) if respond_to?(method_name.to_sym)\n @data[key.to_s] = value\n end",
"title": ""
},
{
"docid": "3b1723eb2f... |
1adcef409df12faea7874cd8c3813f35 | Is lat/long more than 10% outside of location extents? | [
{
"docid": "886934f366265c9f10ebd307585b4d6f",
"score": "0.7007302",
"text": "def lat_long_dubious?\n lat && location && !location.lat_long_close?(lat, long)\n end",
"title": ""
}
] | [
{
"docid": "4b2a073d4f52a828f6fbabcc40a66d53",
"score": "0.730981",
"text": "def inBounds lat, lon\n lat <= max_latitude && lat >= min_latitude && lon <= max_longitude && lon >= min_longitude\n end",
"title": ""
},
{
"docid": "8fdead8dee958dbb4363aa5be35362d2",
"score": "0.71574",
... |
4a70c503757c5ab6b4d3b8af0f069a5f | =begin check if email is to big Channel::Driver::IMAP.too_large?(message_meta, count, count_all) returns true|false =end | [
{
"docid": "aa8f329cabd78829408e8a8fe9f47f87",
"score": "0.7993408",
"text": "def too_large?(message_meta)\n max_message_size = 10.0 #Setting.get('postmaster_max_size').to_f\n real_message_size = message_meta.attr['RFC822.SIZE'].to_f / 1024 / 1024\n if real_message_size > max_message_size\n ... | [
{
"docid": "f4d8b026771bf36f060a447d01024703",
"score": "0.7156472",
"text": "def isLongMessage(size)\n size > MessageSize_Threshold ;\n end",
"title": ""
},
{
"docid": "5778cc4bf4f156f317969054abe953cd",
"score": "0.65932506",
"text": "def large?\n size.to_i > MEGAB... |
01a672ed9aa0826e98296c556be5ed8f | lancer une recherche de user puis follow le 1er user qu'elle trouve | [
{
"docid": "88c3956e5178e99792026050ec0d6ee4",
"score": "0.6722051",
"text": "def follow_townhall(sheet,client)\n index = 1\n\n while sheet[index,1] != \"\" #parcours la feuille\n\n premier_result = client.user_search(sheet[index,1])[0] #search et recupere le 1er user trouvé\n puts \"on reche... | [
{
"docid": "81fb6ce43442d63f707b038babbfc5aa",
"score": "0.75215393",
"text": "def follow_user\n\tsearch_twitter.each do |i|\n\t\tclient.follow(i)\n\t\tj +=0\n\tend\nend",
"title": ""
},
{
"docid": "92eead212b26e9bf9d0054752ea8b65f",
"score": "0.7341568",
"text": "def following_users... |
7d12e74fcec233298450a24c5e05e09a | in order for servicenow ticket to be created, subject text must begin with the following | [
{
"docid": "4784ad2933072ef1e4d87d71789a30cd",
"score": "0.61404437",
"text": "def service_now_subject_matcher\n \"#{t('sufia.product_name')}: Help Request\"\n end",
"title": ""
}
] | [
{
"docid": "dc0e2948b8652d7848b464a5ec15a020",
"score": "0.67009985",
"text": "def subject(string)\n self << \"SUBJECT\" << string\n end",
"title": ""
},
{
"docid": "4d8058de5ee50494a343c536b1883767",
"score": "0.66722333",
"text": "def build_subject(uid, subject)\n return... |
e561e11bcf379ef5dc139c210017366b | Only allow a list of trusted parameters through. | [
{
"docid": "116f4c91b338a2820a2bdb4c52934b05",
"score": "0.0",
"text": "def solideo_depense_params\n params.require(:solideo_depense).permit(:date, :ouvrages, :reserve, :fonctionnement, :innovation)\n end",
"title": ""
}
] | [
{
"docid": "c1f317213d917a1e3cfa584197f82e6c",
"score": "0.69497335",
"text": "def allowed_params\n ALLOWED_PARAMS\n end",
"title": ""
},
{
"docid": "e662f0574b56baff056c6fc4d8aa1f47",
"score": "0.6812623",
"text": "def strong_params\n params.require(:listing_member).permi... |
71131440fa022910858cae318399ebb3 | This action handles file uploads. I'd prefer to have direct amazon s3 uploads that happen independently. Right now, we switched from AJAX post to normal HTML post. This ties up our servers and isn't very scalable. We got ajax post workign w/ remotipart but it just seems hacky. | [
{
"docid": "a922daf3222e716230e99b2f71705eaa",
"score": "0.0",
"text": "def create\n assert_valid_params!\n # consider slicing params[:event] to only have valid keys\n Event.create_from_api!(params[:event])\n respond_to do |format|\n format.html { redirect_to :back }\n format.json... | [
{
"docid": "2443e3fe5f8fd9561e6c63de95a271e3",
"score": "0.68735343",
"text": "def aws_uploads\n render json: {\n policy: aws_s3_upload_policy_document,\n signature: aws_s3_upload_signature,\n key: params[:doc][:directory] + \"/\" + params[:doc][:filename],\n ... |
33d5e6afbbc7ea52ca952496c36700a7 | =begin Author : QaAutomationTeam | [
{
"docid": "58ef30ef9cf02085d2e43f8e3362a5d3",
"score": "0.0",
"text": "def fetchActivityDetails(whoId)\n return checkRecordCreated(\"Task\", \"SELECT id ,Markets_Interested__c,Country_Code__c,Locale__c,Market__c, Subject , CreatedDate,Status , Owner.Name,Lead_Source__c , Lead_Source_Detail__c,Locati... | [
{
"docid": "614f52abb7d52c648d5797491b6af74e",
"score": "0.5866762",
"text": "def mambo_no_5; end",
"title": ""
},
{
"docid": "65ffca17e416f77c52ce148aeafbd826",
"score": "0.58339024",
"text": "def schubert; end",
"title": ""
},
{
"docid": "57657de131abcef72e4b43ff2ebdbe2... |
e48eb3ce7fd1a12761623bd8f3a409c9 | This defines the behaivor of the intialized state. By default this simply transitions to the finished state. | [
{
"docid": "b401e8e46c2cb280e892bec50258ffb5",
"score": "0.77136284",
"text": "def state_initialized!\n transition_to_state(:finished)\n end",
"title": ""
}
] | [
{
"docid": "08b33ac271ed955d1b78b0a8b3800e80",
"score": "0.7105666",
"text": "def initial_state\n :pending\n end",
"title": ""
},
{
"docid": "867f9e55543df7a15d432415211f9c56",
"score": "0.6975832",
"text": "def initial_state\n {}\n end",
"title": ""
},
{
... |
bb13188ce5a905860b3dfd27d6959d8c | Create a ZIP file. Provided data should be a Hash with the filenames as keys and the file contents as values. | [
{
"docid": "667e2ec2e79254a37faab30e9d55a978",
"score": "0.60348433",
"text": "def zip(data)\n Zip::OutputStream.write_buffer{ |zip|\n data.each{ |name, content|\n zip.put_next_entry(name)\n zip.write(content)\n }\n }.string\nend",
"title": ""
}
] | [
{
"docid": "d0448accd05771ff5c2833014f5c2ff2",
"score": "0.65257025",
"text": "def zip(data)\n zipfile = \"rubyzip-#{rand 32768}\" \n Zip::ZipOutputStream::open(zipfile) do |io|\n count = 0\n data.each do |d, n|\n io.put_next_entry((\"#{n}\" or \"#{count += 1}.txt\"))\n io.... |
58912a7ffa284e4c3e7a17295394d3f9 | If two or more arguments were provided, then an exception is raised. This tests two arguments. EDGE CASE | [
{
"docid": "d4c6b5140fbbded600284f5c9a4eae6e",
"score": "0.69568914",
"text": "def test_two_args\n assert_raises \"Enter a seed and only a seed\" do\n arr = [\"0\",\"1\"]\n args_checker = ArgsChecker::new(arr)\n args_checker.check_args\n end\n end",
"title": ""
}
] | [
{
"docid": "438642a1f2c97d981a3300ad8930f435",
"score": "0.7148138",
"text": "def test_raises_error_when_two_args\n\t\tassert_raises \"Enter a single seed number\" do\n\t\t\targs = [1, 2]\n\t\t\tchecker = ArgsChecker::new\n\t\t\tchecker.check_args args\n\t\tend\n\tend",
"title": ""
},
{
"doc... |
bd3137d343561f2998854ec494ba9f21 | Write to project names to file cache, close DB connection Read each project name from cache `git clone` each project name call the specified script and pass in the directory of the `git clone` project along with a file the project can write docs to. | [
{
"docid": "eaa7f206c207caff36fb081b86e62d0e",
"score": "0.6770977",
"text": "def enqueue\n each_name_for_language do |full_name|\n fetcher = GithubFetcher.new(full_name)\n fetcher.clone_exec do |dir|\n Tempfile.open('output.json-docs') do |output_file|\n run_script(... | [
{
"docid": "a70ca2a1ec21515af1ecae638c979796",
"score": "0.63346285",
"text": "def create_indexing_files\n puts \"\"\"\nPlease paste the Holberton project webpage.\n(Make sure to include advanced tasks and the\ncopyright notice at the bottom of the page)\"\"\"\n\n File.open(\".projectText\", \"w\") do... |
e6a18b09427513a2c3bc356e0a406dcd | reduce 4 omitted reduce 5 omitted | [
{
"docid": "d03ba3e819afa6a229959ccd7603ed1c",
"score": "0.0",
"text": "def _reduce_6(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend",
"title": ""
}
] | [
{
"docid": "deaf219cc6f62c09bc892f1429c0a469",
"score": "0.6743939",
"text": "def _reduce_555(val, _values, result)\n result = nil\n \n result\nend",
"title": ""
},
{
"docid": "4a284296788ba625eeb1e1f152a2c293",
"score": "0.6566756",
"text": "de... |
b7d63c776102fb035efb941870274186 | It's assumed the shift is for an hour, 0059 | [
{
"docid": "42c1c97d1d6c89c5473f1d7369175841",
"score": "0.0",
"text": "def total_minutes_asleep\n minutes_asleep = 0\n @asleep_times.each_with_index do |time, i|\n minutes_asleep += @awake_times[i] - @asleep_times[i]\n end\n minutes_asleep\n end",
"title": ""
}
] | [
{
"docid": "b07c46d0e56ce6c1274588fc8f79b44f",
"score": "0.6944428",
"text": "def adjusted(hour)\n (hour + (24 - WORK_START)) % 24\n end",
"title": ""
},
{
"docid": "c8434456afa3696cbf830d53e871a419",
"score": "0.6738004",
"text": "def hours; Integer.new(to_h[:hr] * (to_h[:si] ? ... |
0457efecc1378ca4cd1c44c2cd098286 | POST /material_categories POST /material_categories.json | [
{
"docid": "55cb5f62ce335562cad20087ab6d518e",
"score": "0.72227913",
"text": "def create\n @material_category = MaterialCategory.new(material_category_params)\n\n respond_to do |format|\n if @material_category.save\n format.html { redirect_to @material_category, notice: '板料种类创建成功!' }\... | [
{
"docid": "86ef02c4f8639826ea7290369a5641fd",
"score": "0.7517924",
"text": "def create\n @material_category = MaterialCategory.new(material_category_params)\n\n respond_to do |format|\n if @material_category.save\n format.html { redirect_to @material_category, notice: 'Material categ... |
669e3f5005a336d816322cad8a8c6a29 | This method for prevent user to access Signup & Login Page without logout | [
{
"docid": "087d0a75fa2ec04ab791f08ffeb4b9a9",
"score": "0.0",
"text": "def save_login_state\n if session[:user_id]\n redirect_to welcome_index_path\n return false\n else\n return true\n end\n end",
"title": ""
}
] | [
{
"docid": "d1f026dfe42c14d2d751eece4242eff7",
"score": "0.8091978",
"text": "def prevent_login_signup\n end",
"title": ""
},
{
"docid": "18928528bb7753105837f25d7102e173",
"score": "0.7920116",
"text": "def prevent_login_signup\n if session[:user_id]\n redirect_to home_path... |
09c7e7afc12e22d5a4513a512bd57380 | parses POST response and pulls out for access_token | [
{
"docid": "871b3f1bd3663696adde9e3dc9808957",
"score": "0.0",
"text": "def refresh!\n\t response = request_token_from_google\n\t data = JSON.parse(response.body)\n\t update_attributes(\n\t access_token: data['access_token'],\n\t expires_at: Time.now + (data['expires_in'].to_i).seconds)\n\t end",
... | [
{
"docid": "9babbde1337f890a57114dfd8af26b5c",
"score": "0.74030274",
"text": "def get_access_token(body)\n body.split('&')[0].split('=')[1]\n end",
"title": ""
},
{
"docid": "160ffce9cff34321d66e62c1196c3104",
"score": "0.7349964",
"text": "def parse_auth_response(response)\n ... |
d54597eb181cc190e8b00edddb42302f | Sets the directories property value. Contains the collection of directories and all of their objects. | [
{
"docid": "907623eb64f4f9d0c8576c48b3341a2a",
"score": "0.87403417",
"text": "def directories=(value)\n @directories = value\n end",
"title": ""
}
] | [
{
"docid": "da88765d5d9200cd23a30a714128477e",
"score": "0.7198665",
"text": "def directories\n @directories ||= []\n end",
"title": ""
},
{
"docid": "da88765d5d9200cd23a30a714128477e",
"score": "0.7198665",
"text": "def directories\n @directories ||= []\n end... |
c657de4b70d266e9a3a784b999ea9e60 | Never trust parameters from the scary internet, only allow the white list through. | [
{
"docid": "614a854e5f162ba5ce9e093d63fd4b0b",
"score": "0.0",
"text": "def share_params\n params.require(:share).permit(:code, :company, :exchange)\n end",
"title": ""
}
] | [
{
"docid": "3663f9efd3f3bbf73f4830949ab0522b",
"score": "0.7496716",
"text": "def whitelisted_params\n super\n end",
"title": ""
},
{
"docid": "13a61145b00345517e33319a34f7d385",
"score": "0.6956598",
"text": "def strong_params\n params.require(:request).permit(param_white... |
e3a95bb5562dd7ffaa51a22976e5f46c | if num_rubies == 0, print out emptyhanded message | [
{
"docid": "6ab5b18a9a9f10a0c09865ff3af91fe3",
"score": "0.0",
"text": "def test_leaving_message_empty\n\tassert_output(\"Going home empty-handed.\\n\") {@g.leaving_message(0)}\n end",
"title": ""
}
] | [
{
"docid": "ee0c7ec253a09fbec7572b6a73a2d45a",
"score": "0.73287135",
"text": "def result(final_rubies)\n if final_rubies >= 10\n puts 'Going home victorious!'\n elsif final_rubies.zero?\n puts 'Going home empty-handed.'\n elsif final_rubies < 0\n puts 'The number of rubies shoul... |
1dfb61092666cfb66f121c4ffb0352b3 | Zhengyang Zhou load input string to the maze | [
{
"docid": "efab95f5d6a07352800f7d719f41c65d",
"score": "0.71023464",
"text": "def load_input(maze)\n puts \"Enter the input string\"\n print PROMPT\n input = $stdin.gets.chomp.downcase\n maze.load(input) if(validate_string(input))\n puts \"Here is the graph of the maze\" if(maze.valid ==... | [
{
"docid": "4fca193e1244168d8bff94733e88d29f",
"score": "0.7462609",
"text": "def load(maze_string)\n count = 0;\n row = 0;\n column = 0;\n if maze_string.length != @rows*@columns\n puts \"Did not enter a string of valid length\"\n return\n end\n # while loop that goes throug... |
e89389e626a5aeb5158b1a7409ae543a | PATCH/PUT /recipes/1 PATCH/PUT /recipes/1.json | [
{
"docid": "e2dc79e764faeb168969a19b19a7f8a2",
"score": "0.6594152",
"text": "def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html... | [
{
"docid": "1121b8fe100de7b7e220b09a42a9377b",
"score": "0.75118256",
"text": "def update\n @recipe = Recipe.find(params[:id])\n @recipe.update(recipe_params)\n render json: @recipe\n end",
"title": ""
},
{
"docid": "9049f8c4fc85ec90aa5727e4655a9bc3",
"score": "0.6978558",
... |
5592ea9e5935ce7471d8d60b8bb167c8 | Inicializacion de una instancia de la clase Lista a partir de una Question pregunta). | [
{
"docid": "295699b4edaf7152534f0504cc7275d8",
"score": "0.63818073",
"text": "def initialize (o)\n\t\traise TypeError, \"Se esperaba que se pasara una pregunta como parámetro\" unless o.instance_of? (Question)\n\t\t@head = Node.new(o, nil,nil)\n\t\t@tail = @head\n\tend",
"title": ""
}
] | [
{
"docid": "59985ea921757ccb1567166f44e1f822",
"score": "0.77082753",
"text": "def initialize \n @Questions_list = []\n end",
"title": ""
},
{
"docid": "0dd1cca02b11eb25bd9a61eda9e2fa8f",
"score": "0.6909401",
"text": "def initQuestionClass\n\t\t@questionList = Fileq.new\n\... |
adcfb8460e78e10b4a130a439acfd591 | Get Port Discovery Profile Binding Map API will get Port Discovery Profile Binding Map | [
{
"docid": "b2d5be6a20d49b56e7f8655807734a2f",
"score": "0.56237084",
"text": "def get_port_discovery_binding_0(tier_1_id, segment_id, port_id, port_discovery_profile_binding_map_id, opts = {})\n data, _status_code, _headers = get_port_discovery_binding_0_with_http_info(tier_1_id, segment_id, port_... | [
{
"docid": "f5e24402463f0be91f88ca5c32a9dba7",
"score": "0.66350484",
"text": "def on_get_port_maps\n # return deep copied map\n phy_port_key = '[dpid, port_no] -> Port'\n port_key = '[Node.node_id, Port.port_id] -> [dpid, port_no]'\n {\n phy_port... |
54fb92eda0342c69094dac1cfbbd5ddf | DELETE /tecnicos/1 DELETE /tecnicos/1.json | [
{
"docid": "fece307ba7e748be34b17fee06d8bb31",
"score": "0.7326717",
"text": "def destroy\n @tecnico = Tecnico.find(params[:id])\n @tecnico.destroy\n\n respond_to do |format|\n format.html { redirect_to tecnicos_url }\n format.json { head :no_content }\n end\n end",
"title": "... | [
{
"docid": "306294870432fb719975adb599c58b6d",
"score": "0.7168405",
"text": "def destroy\n @nota_tecnica.destroy\n respond_to do |format|\n format.html { redirect_to nota_tecnicas_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "689d5a07a... |
b68f2526770e6c8d24dac6af2f573f57 | The name of the account in all locales is `LocalSystem`. `.\LocalSystem` or `ComputerName\LocalSystem' can also be used. This account is not recognized by the security subsystem, so you cannot specify its name in a call to the `LookupAccountName` function. | [
{
"docid": "71dcac77eb2091dd1f06304c4d45a786",
"score": "0.57347167",
"text": "def localsystem?(name)\n [\"LocalSystem\", \".\\\\LocalSystem\", \"#{Puppet::Util::Windows::ADSI.computer_name}\\\\LocalSystem\"].any?{ |s| s.casecmp(name) == 0 }\n end",
"title": ""
}
] | [
{
"docid": "10a075b22fefa2871bc57dfbdb3a2195",
"score": "0.694823",
"text": "def default_system_account?(name)\n user_sid = Puppet::Util::Windows::SID.name_to_sid(name)\n [Puppet::Util::Windows::SID::LocalSystem, Puppet::Util::Windows::SID::NtLocal, Puppet::Util::Windows::SID::NtNetwork].include?(... |
7fb7b17c601ac9bb21ca131791b05e7a | gesendete nachrichten an topic senden (publish) | [
{
"docid": "6ddf959975198d1a15623d0bd8284176",
"score": "0.6518958",
"text": "def new_message(data)\n @topic.publish(data.to_json, :key => \"chat_for_users_#{chat_id}\")\n end",
"title": ""
}
] | [
{
"docid": "e7a4aced8b0c9a54d0423504cfdea4e9",
"score": "0.78138006",
"text": "def publish( message )\n @topic.publish( message )\n end",
"title": ""
},
{
"docid": "5574294d0fdc14396aaf4557d8efae07",
"score": "0.7710287",
"text": "def publish(topic, message)\n unless @topi... |
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "4b897a9d714e934ad9ba892081c93032",
"score": "0.0",
"text": "def set_ideapost\n @ideapost = Ideapost.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... |
c657de4b70d266e9a3a784b999ea9e60 | Never trust parameters from the scary internet, only allow the white list through. | [
{
"docid": "65955a0865cd66c54c08796ba5e94454",
"score": "0.0",
"text": "def prospecto_usuario_params\n params.require(:prospecto_usuario).permit(:Prospecto_id, :Usuario_id, :estatus)\n end",
"title": ""
}
] | [
{
"docid": "3663f9efd3f3bbf73f4830949ab0522b",
"score": "0.7497917",
"text": "def whitelisted_params\n super\n end",
"title": ""
},
{
"docid": "13a61145b00345517e33319a34f7d385",
"score": "0.69572496",
"text": "def strong_params\n params.require(:request).permit(param_whit... |
6c606d0cfa0d93e0398e782aaed64468 | Delete email Will delete a email an authorized user if no user ID passed. | [
{
"docid": "57b927b935f46aa46ea045645c6ab8f7",
"score": "0.8214245",
"text": "def delete_email(id, user_id = nil)\n url = user_id.to_i.zero? ? \"/user/emails/#{id}\" : \"/users/#{user_id}/emails/#{id}\"\n delete(url)\n end",
"title": ""
}
] | [
{
"docid": "85b52d8a9f7fdd53c60040ae3f2b3b07",
"score": "0.86087644",
"text": "def delete_email\n\t\tcheck_delete_email_params\n\t\tEmail.delete(params[:email_id])\n\t\tredirect_to user_path(id: params[:user_id])\n\tend",
"title": ""
},
{
"docid": "e9948d704e9ff6dcb931a040abe24463",
"sco... |
c657de4b70d266e9a3a784b999ea9e60 | Never trust parameters from the scary internet, only allow the white list through. | [
{
"docid": "5562ee0e4e72c6859354604afa12b649",
"score": "0.0",
"text": "def user_params\n params.require(:user).permit(:name, :nickname, :email, :mobile_phone, :password,:password_confirmation, :portrait)\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... |
80ce0bb3b4ac4107d5733c28c892ca35 | Decodes an RFC2047 word to a UTF8 string. Uses our iconv to deal with common encoding problems | [
{
"docid": "93b33b6690a4f21ae6989d9f4fcf4bab",
"score": "0.72717357",
"text": "def decode_word(text)\n return text unless text =~ /=\\?([^?]+)\\?(.)\\?([^?]*)\\?=/\n \n charset, method, encoded_string = $1, $2, $3\n \n # Strip out the RFC2231 language specification... | [
{
"docid": "5d3cb11a6b8b96c345e620883e4a6778",
"score": "0.6905614",
"text": "def decode_rfc2047 target_charset, from\n return unless is_rfc2047_encoded? from\n\n from = force_to_ascii from # strip any naughty characters---you should be rfc2047-encoding those!\n from = from.gsub RFC2047_WORDSEQ... |
110242a07048277261f3998348621c3a | I just added this to see if it would fix video ordering routing issue. | [
{
"docid": "7f614043f401da31afea3be3754b026b",
"score": "0.0",
"text": "def update\n #note that '@brand' is omitted here because it is defined by the before filter\n if @video.update_attributes(video_params)\n flash[:success] = \"Videos updated\"\n redirect_to edit_brand_path(curre... | [
{
"docid": "967fc11b4a06516314c8dafb36d105d5",
"score": "0.61634976",
"text": "def index\n @traditional_route_videos = TraditionalRouteVideo.all\n end",
"title": ""
},
{
"docid": "ac836d5dcc19dc0aad8e251170c54d33",
"score": "0.603562",
"text": "def videos_test\n end",
"tit... |
d8633d607bc85ee0eded8d50c2d8ed5c | creates encoded params to use in uri query | [
{
"docid": "8790f8ff14b29956af6a845431c872a4",
"score": "0.0",
"text": "def encode\n attribute = self.query\n eval <<-end_eval\n unless self.query.nil?\n self.encoded_query = URI.encode_www_form_component(self.query)\n end\n end_eval\n end",
"title": ""
}
] | [
{
"docid": "640f062d2b809a04bd3f372e438ce063",
"score": "0.86984944",
"text": "def encode_uri_query_params(params); end",
"title": ""
},
{
"docid": "640f062d2b809a04bd3f372e438ce063",
"score": "0.86984944",
"text": "def encode_uri_query_params(params); end",
"title": ""
},
{
... |
d22d92666a0aa19ce23f8ac81f254519 | PATCH/PUT /preloveds/1 PATCH/PUT /preloveds/1.json | [
{
"docid": "bc6b9bba4d4cafb7fbe7d38c709591b8",
"score": "0.6721728",
"text": "def update\n respond_to do |format|\n if @preloved.update(preloved_params)\n format.html { redirect_to @preloved, notice: 'Preloved was successfully updated.' }\n format.json { render :show, status: :ok, ... | [
{
"docid": "5fd5f00640bdb0c785bcac4689a46f3c",
"score": "0.6398927",
"text": "def patch(data, options={})\n raise NotImplementedError, \"We only patchs to singular resources.\" if count > 1\n first.patch(data, options)\n end",
"title": ""
},
{
"docid": "d5eaea298e64625a71a15a970... |
e2441a5f1a54044f5e916729de4b83ae | remove an instance variable by symbolic name | [
{
"docid": "46de1868435b24ae6c002d07060f48dc",
"score": "0.755449",
"text": "def ivar_remove(name)\n if ivar_defined?(name)\n remove_instance_variable(\"@#{name}\")\n end\n end",
"title": ""
}
] | [
{
"docid": "f5523cb5cb8093f262ad00493b6f0a83",
"score": "0.80617553",
"text": "def remove!(name)\n remove_instance_variable to_ivar(name)\n end",
"title": ""
},
{
"docid": "46c40dcd9560a55c3b077f73c476875e",
"score": "0.800776",
"text": "def remove_class_variable(sym) end... |
7e9aa2466d8d45e3a0753decde059753 | ~ def test_fail ~ assert(false) ~ end ~ def test_error ~ 1 / 0; ~ end | [
{
"docid": "c64be6e557d1852bd3c239ef5b7463b8",
"score": "0.0",
"text": "def test_under10\n#\tc = Primes.new(10)\n#\tpn = [2,3,5,7]\n#\tassert_equal(pn,c.primes)\n\n\tassert_underN(10,[2,3,5,7])\nend",
"title": ""
}
] | [
{
"docid": "a102a044268643faadbe28fa645fa27c",
"score": "0.78774846",
"text": "def test_FAIL()\n return 1\n end",
"title": ""
},
{
"docid": "3fcc75a227c5cd0de58359677e7bc992",
"score": "0.7575698",
"text": "def test_case_6\n assert false\n end",
"title": ""
},
{
"... |
877bdea9eb71f59265d9eec4cb5f0fcf | Specifies host(s) that VCR should stop ignoring. | [
{
"docid": "a1154cbb3ad99a06095108e684b76be3",
"score": "0.62906283",
"text": "def unignore_host(*hosts); end",
"title": ""
}
] | [
{
"docid": "e793a58e55072f4dabbaaefe6c6d13a8",
"score": "0.69208467",
"text": "def ignore_host(*hosts); end",
"title": ""
},
{
"docid": "14af087545e563fa89b073740332dd40",
"score": "0.68069685",
"text": "def ignore_hosts(*hosts)\n VCR.request_ignorer.ignore_hosts(*hosts)\n en... |
3c75426d45ae746abca9e73ee4703c36 | check each word against each keyword | [
{
"docid": "06054bf048eefccdd74c4bb5cf1641a2",
"score": "0.6234332",
"text": "def check_key_words(word, key_words, is_subject = false)\n temp_points = 0\n key_words.each do |key|\n\n if key.word.downcase.eql? word.downcase\n is_subject ? temp_points += key.point *... | [
{
"docid": "1116ed906ad3ae391e6b34b0bd1a6a28",
"score": "0.70240945",
"text": "def check_for_keyword(keyword)\n items_to_check = { job_description: job_description, skills: skills, job_title: job_title }\n items_to_check.each do |key,value|\n condition = case key\n when :skills\n... |
121d7a5f75b121dd9f3e5d0e28c6dce2 | Method 2: Using the count method on the array Using the count method to determine which values in the values array have a count of 1 This returns a new array containing all elements of the values array which are true for the given block | [
{
"docid": "a8ed43d04370c9c878dd8eb4d8c50d2c",
"score": "0.5977292",
"text": "def non_duplicated_values(values)\n values.select { |value| values.count(value) == 1 }\nend",
"title": ""
}
] | [
{
"docid": "c69d606380a7b9c006c17f9306adce84",
"score": "0.6614276",
"text": "def array_42(arr)\n arr.map{|x| x== 42}.count{|x| x == true} == 1 ? true : false\nend",
"title": ""
},
{
"docid": "d0f1539a550258d2006f9454ccbdf8e7",
"score": "0.64260626",
"text": "def non_duplicated_va... |
1a5ec7ba3931843153d2bed4b673e3bb | To display output immediately on windows using git bash | [
{
"docid": "c8360b493f131c4d5fbcfd22efd349e7",
"score": "0.0",
"text": "def bubble_sort!(arr)\n sorted = false\n limit = arr.size - 1\n\n until sorted\n sorted = true\n arr.each_index do |idx|\n break if idx == limit\n if arr[idx] > arr[idx + 1]\n arr[idx], arr[idx + 1] = arr[i... | [
{
"docid": "27a92ef1a5dc0ae065d12edd75dc7840",
"score": "0.6221435",
"text": "def prompt_git_branch\n if !is_git?\n return \"\"\n end\n stat = `git status`\n \"[#{stat.split(\"\\n\")[0].split(\" \")[-1]}]\".yellow\nend",
"title": ""
},
{
"docid": "11d6527086ab119eae27dcc1759669bb",
... |
ef5a3d5793836a2927bdbb5d67661383 | Pair two words to one another with or without context, and returns an array of the pair IDs that were created. If words don't exist in database, they will be added. Special characters will be stripped away, and trailing nonword characters on word2 will increment appropriate columns in the database, to allow for calcula... | [
{
"docid": "a648dd295c82c496b6302bdc5453650e",
"score": "0.8302301",
"text": "def pair_words(word1, word2, options = { context: [] })\n\n # Loop through all nouns in context array (if any)\n # and add a normal pair by default as well\n i = -1\n\n # First word shouldn't have a trailing specia... | [
{
"docid": "445c78980dc023a1c943100738e1e19b",
"score": "0.70986605",
"text": "def tripair_words(word1, word2, word3, options = { context: [] })\n\n # First word shouldn't have a trailing special char (remember, it's the PAIR that has a suffix, not each word!)\n word1 = word1.gsub(/([^a-zA-Z'\\/\\... |
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "6bddcbdde7662f1869f426fa0be85f99",
"score": "0.0",
"text": "def set_player\n @player = Player.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;... |
cfcf7189ea4cdf2d9395b3d6ad0fa273 | Helper to extract data from the body of the response | [
{
"docid": "77f921d3dea17d21c84a6127680a34f9",
"score": "0.8417494",
"text": "def extract_data\n begin\n JSON.parse(@body)['data']\n rescue => err\n @error = err\n raise ResponseError, \"Attempt to parse response body failed.\", caller\n end\n end",
"title": ""... | [
{
"docid": "b2f826422dfded92d0508afbd867b0b1",
"score": "0.7529126",
"text": "def body(response)\n JSON.parse(response[:body])\n end",
"title": ""
},
{
"docid": "3891d472269ba809ab63ed484720a6ea",
"score": "0.748395",
"text": "def data\n @raw_response.body\n end",... |
4fc46a57e65b99ced60b2a77006427b9 | Add a nested Prototype which should be instantiated when this Prototype is instantiated. name = Name used for reference param = Hash of parameter bindings | [
{
"docid": "cf7075d7d4f46cf5473d3075eac536e9",
"score": "0.6538632",
"text": "def addPrototype(name, param)\n if @incPrototypes.has_key? name\n raise \"Prototype already has a prototype '\" + name + \"'.\"\n end\n @incPrototypes[name] = param\n end",
"title": ""
}
] | [
{
"docid": "25747aa4df72d5bed4b07359445521e4",
"score": "0.6755533",
"text": "def addPrototype(name, params = nil)\n debug \"Use prototype #{name}.\"\n p = OmfEc::Prototype[name]\n if p.nil?\n error \"Unknown prototype '#{name}'\"\n return\n end\n p.instantiate(sel... |
e561e11bcf379ef5dc139c210017366b | Only allow a list of trusted parameters through. | [
{
"docid": "c26c02c2cd62b75502d83771df60e199",
"score": "0.0",
"text": "def transaction_order_params\n params.require(:transaction_order).permit(:transaction_item_id, :user_id, :delivery_name, :delivery_address, :delivery_phone, :delivery_postcode, :delivery_state, :amount)\n end",
"title": ... | [
{
"docid": "c1f317213d917a1e3cfa584197f82e6c",
"score": "0.69497335",
"text": "def allowed_params\n ALLOWED_PARAMS\n end",
"title": ""
},
{
"docid": "e662f0574b56baff056c6fc4d8aa1f47",
"score": "0.6812623",
"text": "def strong_params\n params.require(:listing_member).permi... |
5d8d8de9d95c8ec469db728bc80aa76b | Returns a hash of attributes for given element name | [
{
"docid": "fbdfcd9f33409e28be71288c7214ec6b",
"score": "0.64610237",
"text": "def attributes_for_element_name(element)\n if self.has_cells? && (cell_definition = cell_definitions.detect { |c| c['elements'].include?(element) })\n cell = self.cells.find_by_name(cell_definition['name'])\n ... | [
{
"docid": "70ccb46a8ee837f2bc6ea971d73900e0",
"score": "0.7778844",
"text": "def attributes_hash(element)\n schema[element.to_sym]\n end",
"title": ""
},
{
"docid": "5dcde13e9ccba5a62fee5bc03f157702",
"score": "0.75269365",
"text": "def get_attributes(element)\n att... |
7997d76cde84895352ca85f32045f7f3 | postgres won't let you do an order_by when also doing a distinct let's just use the inmemory option in this case | [
{
"docid": "0500e7fd8900e945b61c2275f9e51c12",
"score": "0.0",
"text": "def is_randumb_postges_case?(relation, ranking_column=nil)\n if relation.respond_to?(:uniq_value) && relation.uniq_value && connection.adapter_name =~ /(postgres|postgis)/i\n if ranking_column\n raise Exce... | [
{
"docid": "013f266751e997553e183b292c1b319d",
"score": "0.6504491",
"text": "def supports_ordered_distinct_on?\n false\n end",
"title": ""
},
{
"docid": "adbf767f5714d3903dd688e1ebf711e8",
"score": "0.6323142",
"text": "def distinct; end",
"title": ""
},
{
"d... |
d28cbb374c6547b11e2e7c446d8c1719 | Sets the owner attributes on the given record source://activerecord//lib/active_record/associations/foreign_association.rb22 | [
{
"docid": "3ee8498edcdd7dd0f2e1d7c15fe220a6",
"score": "0.80277324",
"text": "def set_owner_attributes(record); end",
"title": ""
}
] | [
{
"docid": "beda72913cfaf6cda5e47365e2d3de01",
"score": "0.83349556",
"text": "def set_owner_attributes(record)\n return if options[:through]\n\n primary_key_attribute_names = Array(reflection.join_primary_key)\n foreign_key_attribute_names = Array(reflection.join_foreign_key)\n\n ... |
bf8d6de00c4705f24fa52b4d707fdb0c | Method to connect to the server. This will take the host and port the user entered, and and create the socket, and then send the user to the authenticate method, which will allow the user to send the username/password | [
{
"docid": "bcd710e870356f4696ff82cfcf27b04f",
"score": "0.66124815",
"text": "def connect(host, port, window, root)\r\n\t# create the socket\r\n\tsocket = TCPSocket.new(host, port)\r\n\t\r\n\t# get the message that the server sent us\r\n\tmessage = socket.gets\r\n\t\r\n\t# split the message and check t... | [
{
"docid": "475309a93dfbedd06323fbb7a6d4f437",
"score": "0.75432247",
"text": "def connect(options)\n @options = options\n @host = options[:host] || DEF_HOST\n @port = options[:port] || DEF_PORT\n\n @log.debug \"Connecting to #{@host}:#{@port}\"\n\n @socket = TCPSocket.new(@host,... |
0c98560520eb940673beb4517e2811a2 | Welcome message and options | [
{
"docid": "5b860bd6e5c2736f26eb5a3265f2e129",
"score": "0.0",
"text": "def message_options_start()\n puts \"\\n\"\n puts \"********************** Welcome to your personal App **********************\" \n puts \"\\n\"\n puts \"Please type 1 to: veiw all apartments addressses.\" \n puts \"Please typ... | [
{
"docid": "913faa729ae1d97989ca98c2990df177",
"score": "0.77307713",
"text": "def give_welcome_msg\n puts \"Welcome to parcel system\"\n puts \"------------------------\"\n end",
"title": ""
},
{
"docid": "b0cf54345c6efaa7f94d52b6bd05add5",
"score": "0.76550424",
... |
9e642f86b14afacbe7105cd4df04f470 | PATCH/PUT /services/1 PATCH/PUT /services/1.json | [
{
"docid": "4d30102832adbf614f0ad00210457f1e",
"score": "0.6037978",
"text": "def update\n respond_to do |format|\n @service.assign_attributes(service_params.merge({\n current_request: request\n }))\n\n if @service.authenticate and @service.save\n format.html { redirect_t... | [
{
"docid": "91b26f66b99fa584365143950ea0dc9d",
"score": "0.665279",
"text": "def update\n service.update(service_params)\n\n respond_with(service)\n end",
"title": ""
},
{
"docid": "22d2aea65105429407062bd5cb49e693",
"score": "0.6637126",
"text": "def update\n if @service.u... |
f512342f711e42c8736c708551293544 | GET /ranks/1 GET /ranks/1.xml | [
{
"docid": "8ade47e1e51f4e895eb8b10b7a5cd255",
"score": "0.7374831",
"text": "def show\n @rank = Rank.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rank }\n end\n end",
"title": ""
}
] | [
{
"docid": "63dbb85580ec2de24693ccbfe1d57186",
"score": "0.7493582",
"text": "def index\n @ranks = Rank.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ranks }\n end\n end",
"title": ""
},
{
"docid": "48e5fbada1b49dd1c3aaf575d... |
d1f89e11e24cb6efb95c3f415407196f | Returns a hash where the key is which area to edit (content/note) and the value is the new text | [
{
"docid": "7e78354081dc5481e807512d8cc542aa",
"score": "0.0",
"text": "def update_date(new_date)\n new_date_tag = \"!(#{new_date.to_date.to_s})\"\n\n if content.match(DATE_MARKER)\n { content: content.sub(DATE_MARKER, new_date_tag) }\n elsif note.match(DATE_MARKER)\n { note: note.sub... | [
{
"docid": "becda4f8510f2c02a83737cf10dcd02e",
"score": "0.6191461",
"text": "def text_edits; end",
"title": ""
},
{
"docid": "0cb572d31d1851b8145bfc48f42d79a7",
"score": "0.6175556",
"text": "def edit(note_id, new_content)\n if note_list[note_id]\n note_list[note_id].eac... |
e50b57fbdc5c3f93f5b1a793c176515c | This is a little different because it filters based on status.code | [
{
"docid": "a8eaab1b39025d0fff1db8ceea4a982d",
"score": "0.53489816",
"text": "def those_with_status(*targets)\n self.joins(:status).where(\"code in (?)\", targets)\n end",
"title": ""
}
] | [
{
"docid": "720b9a970daf7ad1284162a5d01b9086",
"score": "0.6140655",
"text": "def get_status_filter_check(status)\n params[:statuses] ? params[:statuses].keys.include?(status) : true\n end",
"title": ""
},
{
"docid": "9f904f5176d20b926cc3a1bb6fb13bce",
"score": "0.6128059",
"text... |
860611f5b7b100361c0096c76b50bb75 | Example For cell1 = "A1" and cell2 = "C3", the output should be chessBoardCellColor(cell1, cell2) = true. For cell1 = "A1" and cell2 = "H3", the output should be chessBoardCellColor(cell1, cell2) = false. | [
{
"docid": "a56bb931b93a51b3aa205a8423befc98",
"score": "0.86055917",
"text": "def chessBoardCellColor(cell1, cell2)\n\n def color(cell)\n letter = cell[0]\n number = cell[1].to_i\n if (([\"A\", \"C\", \"E\", \"G\"].include? letter) && (number % 2 != 0)) || (([\"B\", \"D\", \"F\", \"H\"].inclu... | [
{
"docid": "ed18ce93f12c85fe9ca347db894d5ff4",
"score": "0.7967586",
"text": "def chessBoardCellColor(cell1, cell2)\n alpha = (\"A\"..\"H\").to_a\n h = {}\n \n count = 1\n alpha.each do |letter|\n h[letter] = count\n count += 1\n end\n \n if checkCell(h, cell1) == c... |
4ca2dd3e4dc578e20f06e945cf6aa379 | Sets the edgeBlockAccessToAboutFlags property value. Indicates whether or not to prevent access to about flags on Edge browser. | [
{
"docid": "3bacbc0119443c8a629203a006e6edae",
"score": "0.6562158",
"text": "def edge_block_access_to_about_flags=(value)\n @edge_block_access_to_about_flags = value\n end",
"title": ""
}
] | [
{
"docid": "ea8268e4c59d509ba48d8f52295f5581",
"score": "0.6384541",
"text": "def edge_block_access_to_about_flags\n return @edge_block_access_to_about_flags\n end",
"title": ""
},
{
"docid": "4828493f65f088f00bd30d30c4e1fdbd",
"score": "0.54102683",
"text":... |
1ccbda7f9c403b2833764e02bf66ee6a | Returns up to 100 recent public needs created by the given user, ordered by descending date of creation. | [
{
"docid": "c8ee70a5e372329f4a31db11dbfd840f",
"score": "0.0",
"text": "def needs_from_user(id)\n needs_generic_data(request(\"needs/user/#{id}.xml\", :auth => true))\n end",
"title": ""
}
] | [
{
"docid": "40c641caef57f1e5051dc325a894aa23",
"score": "0.614675",
"text": "def created_by_user(user_id, source_id, number_to_return = :all, starting_index = 0)\n # ids = PublicEarth::Db::Place.many.created_by_user(user_id, source_id, number_to_return == :all && 250 || number_to_return, starti... |
fc40aa56694ba3d83998fdace4be11d8 | Retrieve all Pickup objects | [
{
"docid": "25b54beafec5b86155ed3912e7fef3a4",
"score": "0.76063555",
"text": "def all(params = {})\n @client.make_request(:get, 'pickups', MODEL_CLASS, params)\n end",
"title": ""
}
] | [
{
"docid": "0104e92c46931a1a3c02d2119185299f",
"score": "0.73172015",
"text": "def index\n @pick_ups = PickUp.all\n end",
"title": ""
},
{
"docid": "9efa183645cc7e5569b5c7335d461e44",
"score": "0.6877111",
"text": "def index \n @pickups = Pickup.for_admin\n end",
"title":... |
455051172e996e449275a5edf0e45227 | Get a list of your preconfigured products Get a list of your preconfigured products. The products returned are entirely specific to your recipe. | [
{
"docid": "4423fdf3aaafc8a738965abedb44b853",
"score": "0.64620245",
"text": "def get_preconfiguredproducts(country_code, version, source, opts = {})\n data, status_code, headers = get_preconfiguredproducts_with_http_info(country_code, version, source, opts)\n return data\n end",
"titl... | [
{
"docid": "ed973e202107e96425eae1c8dd9c70d8",
"score": "0.74504185",
"text": "def get_products\n # /api/products returns XML with the IDs of each individual product\n xml_products = @resources_res['products'].get.body\n xml_products_doc = Nokogiri::XML xml_products\n products_nodes ... |
82ac3f767b25d49b568943a0af140e67 | Executes the compiler for each job in the queue | [
{
"docid": "9b4ca2b2f736bc80a932f6e7b2efc588",
"score": "0.0",
"text": "def run(list = nil, options = {})\n fail \"Error: the tester #{Origen.tester} is not an J750 tester,exiting...\" unless is_j750?\n msg = \"Error: application #{Origen.app.name} is running on Windows, \"\n msg +=... | [
{
"docid": "e7acd80db95fab628eaa981190e9b216",
"score": "0.6732731",
"text": "def process\n get_array_info\n get_server_info\n get_template_info\n get_executable_info\n jobs = generate_jobs(@servers, @arrays, @server_template, @executable)\n return(jobs)\n end",
"tit... |
ffd927f25848e9b9c95c298ce3102b42 | Raid scheduling function for raid commands | [
{
"docid": "3fdf0b5e668d92c45e8816e447d5e12c",
"score": "0.57209647",
"text": "def schedule_raids(array)\n array.each do |key, value1|\n value1['raids'].each do |value2|\n unless Time.parse(value2['0']).past?\n new_cron(\n value2['0'], key, value2['key'],\n \"**#{value2... | [
{
"docid": "0ab20c498cf178ae45aed35e82005c5b",
"score": "0.57602435",
"text": "def schedule(uri); end",
"title": ""
},
{
"docid": "0d289ef7eccec48cc921d42f9f59646e",
"score": "0.569132",
"text": "def schedule_rr(data)\n time, done, queue, running = 0, [], [], nil\n \n # Reset need... |
6aad011eabc9939b71258c5d97830682 | Add a mushroom to the world at X_COORD, Y_COORD | [
{
"docid": "d4990d63f6e938c17532bd6451aeff6f",
"score": "0.8051077",
"text": "def add_mushroom_coordinate(x_coord, y_coord)\n new_mushroom = Mushroom.new(x_coord, y_coord)\n @all_mushrooms.push(new_mushroom)\n end",
"title": ""
}
] | [
{
"docid": "3822ddd42b9fe6a6803777d7b18c1dfa",
"score": "0.7900628",
"text": "def add_mushroom\n coord = get_empty_coords()\n x_coord = coord[0]\n y_coord = coord[1]\n\n new_mushroom = Mushroom.new(x_coord, y_coord)\n @all_mushrooms.push(new_mushroom)\n end",
"title": ""
},
{
... |
5cc1a64353a2cb7bc0f9ab1c18415d84 | Sets the page public and sweeps the page cache | [
{
"docid": "bf5a065c91715213a7abf7d719a9fb22",
"score": "0.5747352",
"text": "def publish\n load_node\n @node.public = true\n @node.save\n flash[:notice] = t(\"page_published\", :name => @node.name)\n redirect_back_or_to_default(resources_path)\n end",
"title"... | [
{
"docid": "bad01aa044f7af89cec259fd13d3a44a",
"score": "0.6911112",
"text": "def cache_rendered_page\n response.headers['Cache-Control'] = 'public, max-age=300'\n end",
"title": ""
},
{
"docid": "eb67aa71411b4d0c452c01c5a3f286ac",
"score": "0.66157454",
"text": "def cache_pu... |
f8f794aa15f5114b17e84ba8d8616569 | Override in subclass as security precaution. | [
{
"docid": "547c936670d9fd97729b2e99eb3ab78b",
"score": "0.0",
"text": "def _require_business_support\n raise \"Implement in subclasses.\"\n end",
"title": ""
}
] | [
{
"docid": "2290804b238fc95bfd6b38f87c6d2895",
"score": "0.75177443",
"text": "def override; end",
"title": ""
},
{
"docid": "090f8aeefc03990ee7a067c230c12a5d",
"score": "0.7065869",
"text": "def security; end",
"title": ""
},
{
"docid": "162b63d96fba382f4ac1d354527bb10c"... |
e561e11bcf379ef5dc139c210017366b | Only allow a list of trusted parameters through. | [
{
"docid": "8f1178a9abae686fcc0f08ecd8c0d156",
"score": "0.0",
"text": "def sensor_params\n params.require(:sensor).permit(:model, :serial, :environmental_condition_id, :floor_id ,:arduino_id)\n end",
"title": ""
}
] | [
{
"docid": "3663f9efd3f3bbf73f4830949ab0522b",
"score": "0.74768823",
"text": "def whitelisted_params\n super\n end",
"title": ""
},
{
"docid": "36956168ba2889cff7bf17d9f1db41b8",
"score": "0.71700543",
"text": "def set_param_whitelist(*param_list)\n self.param_whitelist... |
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "6288d40148e7ec5c9c19e424fdd3b1f6",
"score": "0.0",
"text": "def set_industria\n @industria = Industria.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;... |
cf79e7eb6ef2e59d9716511212b799ed | Tell devise to disallow login if the user is archived. | [
{
"docid": "cb183c781a3a9073e08c6b6228e75782",
"score": "0.6914077",
"text": "def active_for_authentication?\n super && archived_at.nil?\n end",
"title": ""
}
] | [
{
"docid": "c5b70cc7b13a8238e6bc48d1d3e8352b",
"score": "0.6967904",
"text": "def active_for_authentication?\n super && archived_at.nil?\nend",
"title": ""
},
{
"docid": "93f78f01ede63e8076ccde547b91c340",
"score": "0.6800428",
"text": "def restrict_access\n redirect_to auth_path... |
a2099a77c85e91272ae2f9e35b937953 | Only allow a trusted parameter "white list" through. | [
{
"docid": "3a4161aa03e674c987dd2b127a0e8673",
"score": "0.0",
"text": "def received_mail_params\n params.require(:received_mail).permit(:sender, :recipient, :cc, :distribution_list, :subject, :message_body, :attachment, :sent_date, :read, :urgent)\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"... |
3fa2926688e5680459b37129228d645d | POST /articles POST /articles.json | [
{
"docid": "9bff196b676c486b47d33f88cc6069dd",
"score": "0.65233344",
"text": "def create\n @article = current_user.articles.new(article_params)\n\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: I18n.t('.article-created') || 'Article was succ... | [
{
"docid": "f3e19b5a4a6058d3ce32e0419f26aee4",
"score": "0.77539223",
"text": "def create\n uri = URI.parse('http://0.0.0.0:3000/articles.json')\n @article = Article.new(params[:article])\n @response = Net::HTTP.post_form(uri, {\"auth_token\" => session[:api_token], \"article\" => @article.to_j... |
a475dc90ae7640a7bd20503086c577f9 | def labels= labels labels.should! :be_a, Array | [
{
"docid": "52ab3a2b8284e2c48f471eac28b31858",
"score": "0.0",
"text": "def value= value\n\t\t@value = value\n\t\trefresh\n\tend",
"title": ""
}
] | [
{
"docid": "b6556c6cefff33e99f55d7395c12c3bd",
"score": "0.6746754",
"text": "def check_labels(expected_labels, labels, check_exact_labels = true)\n return if expected_labels.empty? && labels.empty?\n\n expected_labels.each do |expected_key, expected_value|\n assert labels.key?(expected_key),... |
099a10ec74fe403c075e664e6adc7a3c | Gets the amount and probability value and splitting it into different variables | [
{
"docid": "78b9afb90cdb8436ad66b4ec9009905d",
"score": "0.6968566",
"text": "def getitemvalues(amount_array, probability_array)\n\n temp = self.getitemprobability\n\n amount = temp[0].to_i\n probability = temp[1].to_f\n\n #appends the amount and probability to thier respecti... | [
{
"docid": "dba3870d8f21d2d02c3c2044af51e032",
"score": "0.662349",
"text": "def getprob()\n\t\tprobability = []\n\t\t'''Returns a probability list of all items in its argument'''\n\t\t@@occur.each{|i| probability << (i*1.0/@@outcome.size).round(4)}\n\n\t\treturn probability\n\tend",
"title": ""
}... |
3dab0d742e3c5ee8d75673632dbf975d | Process a line (transaction) from the input file. Extract transaction data and insert it into the datastore. The following data is extracted: date balance amount description | [
{
"docid": "ea4e488f1b09b4e69525be11349c53e0",
"score": "0.77661985",
"text": "def process_line(line)\r\n\r\n if begins_with_date(line)\r\n data = line.split(config.data_delimiter)\r\n\r\n begin\r\n date = Date.parse(data[0].strip)\r\n amount = data[1].stri... | [
{
"docid": "737704d19bedb8e2d95aeaee711a5bb4",
"score": "0.7014544",
"text": "def ingest\n\n #Symbol,Quantity,Price,ActionNameUS,TradeDate,SettledDate,Interest,Amount,Commission,Fees,CUSIP,Description,TradeNumber,RecordType\n #Cash,0.0000,0.0,Credit Interest,3/31/2017,,0.00,0.26,0.0000,0.0000,... |
8e9243a5d335e1e49e47951d031777ea | Convert start/end dates in hash to a range of Dates | [
{
"docid": "018eb5629b7fa11b941b5444d25ce073",
"score": "0.8302863",
"text": "def dates_to_range(hash)\n today = Date.today\n start_date = Date.parse(hash.fetch('start_date', today.prev_month.localtime.to_date.to_s))\n end_date = Date.parse(hash.fetch('end_date', today.localtime.to_... | [
{
"docid": "56d6547b52458421a583f03d6dba42d9",
"score": "0.84949684",
"text": "def dates_to_range(hash, start, stop)\n today = Date.today\n start_date = Date.parse(hash.fetch(start, today.prev_month.localtime.to_date.to_s))\n end_date = Date.parse(hash.fetch(stop, today.localtime.to... |
3d29b1fcf11ef5f658cc7799ffe01022 | DELETE /schedules/1 DELETE /schedules/1.json | [
{
"docid": "fd17a79a1ee129ae214c5367b2e7338c",
"score": "0.77036554",
"text": "def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url, notice: 'Schedule ha sido eliminado.' }\n format.json { head :no_content }\n end\n end",
"title": ""
... | [
{
"docid": "104cdcab4f71db3b2d0f57176fa7858c",
"score": "0.7996677",
"text": "def destroy\n @schedule = Schedule.find(params[:id])\n @schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to schedules_url }\n format.json { head :ok }\n end\n end",
"title": ""
... |
1747a8b87446890a1885fb273ce39338 | def handle_request Get the logger. | [
{
"docid": "f5afb2a1363dea6c1ed9c84133015f32",
"score": "0.0",
"text": "def logger\n if @logger.nil?\n @logger = Cabin::Channel.get\n end\n return @logger\n end",
"title": ""
}
] | [
{
"docid": "5dc1e2caf368d741f7a67ceedd842e42",
"score": "0.7919904",
"text": "def log_request; end",
"title": ""
},
{
"docid": "e32741bb1b6049443677a61ecc02a649",
"score": "0.76758665",
"text": "def logger\n request.logger\n end",
"title": ""
},
{
"docid": "e32741... |
5d961456344ba04f9720494b63f90b33 | arr = [1,2,3,4,5,12] p sort(arr, 34) | [
{
"docid": "e89762e9333cdca89fc8a17a5f0663aa",
"score": "0.0",
"text": "def fib(number)\n #need an empty array to put numbers into\n array = []\n #for the numbers leading up to the given number\n for i in 0..number-1\n if i == 0\n array.push(0)\n elsif i == 1\n array.push(1)\n els... | [
{
"docid": "670a394641ed9b9a560c5113fd9ef6a7",
"score": "0.740913",
"text": "def sort_array_asc(nums)\n nums.sort\nend",
"title": ""
},
{
"docid": "df8ebbc1c591323cd85c50328186462e",
"score": "0.72406185",
"text": "def sort_array",
"title": ""
},
{
"docid": "1d737a715068... |
4a0f8dd60666d85706302bb67712952d | use for get all devices | [
{
"docid": "ae13d951434ab36cec673ec8b5aa6472",
"score": "0.6646134",
"text": "def set_devices\n @devices = Device.order(:token)\n end",
"title": ""
}
] | [
{
"docid": "622675d0ec2b8a188a93f68fb648e7ea",
"score": "0.87950605",
"text": "def get_all_devices\n @devices.search(\"device\")\n end",
"title": ""
},
{
"docid": "405b59a4e872a02cae2381933e55e1d6",
"score": "0.8207703",
"text": "def get_devices\n WIDEQ.get_list(post('device... |
5e73806f6ddcee98a5fcac9197197144 | changes wrap of cell | [
{
"docid": "09524da00df76196b4a85733456a228a",
"score": "0.73320323",
"text": "def change_text_wrap(wrap = false)\n validate_worksheet\n self.style_index = workbook.modify_text_wrap(self.style_index, wrap)\n end",
"title": ""
}
] | [
{
"docid": "d1d2bc28c53b00f14d38f612edd664f2",
"score": "0.7240063",
"text": "def change_text_wrap(wrap=false)\n validate_worksheet\n validate_text_wrap(wrap)\n @style_index = modify_text_wrap(@workbook,@style_index,wrap)\n end",
"title": ""
},
{
"docid": "9841c0cbb0c18d90d... |
f6a169f3353df1f5fefe5009d9a8163e | GET /strength_activities GET /strength_activities.json | [
{
"docid": "81b940be11fe9b45f073728da6646933",
"score": "0.66964054",
"text": "def index\n @strength_activities = StrengthActivity.desc(:created_at).where(user: params[:id] )\n end",
"title": ""
}
] | [
{
"docid": "8ff627243773bb6b8d55de0b49faae70",
"score": "0.68828785",
"text": "def set_strength_activity\n @strength_activity = current_user.activities.find_by(id: params[:id])\n end",
"title": ""
},
{
"docid": "14d9cfe86a7f471f1163774b53fced7d",
"score": "0.6698516",
"text":... |
3361757ac5a7d5fbf0791c8da21cffdf | The call_seq or the param_seq with method name, if there is no call_seq. Use this for displaying a method's argument lists. | [
{
"docid": "19a33a4f2525806abe6bb292431999e0",
"score": "0.78492826",
"text": "def arglists\n if @call_seq then\n @call_seq\n elsif @params then\n \"#{name}#{param_seq}\"\n end\n end",
"title": ""
}
] | [
{
"docid": "c90727ce0820c657c21e05545ea05bb1",
"score": "0.67508477",
"text": "def param_seq\n if @call_seq then\n params = @call_seq.split(\"\\n\").last\n params = params.sub(/[^( ]+/, '')\n params = params.sub(/(\\|[^|]+\\|)\\s*\\.\\.\\.\\s*(end|\\})/, '\\1 \\2')\n elsif @params t... |
3d9c1e3c2578479d948971829c9e5cad | Affect the zoom property | [
{
"docid": "398e914968db9c83e5f05347fa5feee4",
"score": "0.6597855",
"text": "def zoom=(value)\n super(@pokemon&.bank == 0 ? 2 * value : value)\n end",
"title": ""
}
] | [
{
"docid": "3b3edd0fe78c8cd6bbcf22e5c042e323",
"score": "0.85505635",
"text": "def update_zoom\n if self.zoom_x < 2\n self.zoom_x += 0.05\n self.zoom_y += 0.05\n end\n end",
"title": ""
},
{
"docid": "90191040efbdc63ca48bb7da9461e779",
"score": "0.83683795",
"text": ... |
6ceeafec68c98d23f304eec133d2e56f | reads the input "LMLMMLMLMLRR" sequence returns: final position of the rover or error message | [
{
"docid": "db1b3707757928c55e89015a0e8b7571",
"score": "0.0",
"text": "def explore(instructions)\n instructions = instructions.upcase\n instructions.each_char { |instruction|\n case instruction\n when /(L|R)/\n self.sequence << @move.rotate(instruction)\n when 'M'\n ... | [
{
"docid": "5b7bd243de724308172b559653b66c8c",
"score": "0.5770994",
"text": "def read_mrp\n $MRP_FILE = $PRJ_NAME + \"_map.mrp\"\n f = open($MRP_FILE,\"r\")\n while line = f.gets\n if /ERROR/ =~ line\n /LOC=(.*)\\)/ =~ line # pick up Slice name\n $ERROR_SLICE << $1\n end\... |
8d14bf8674730ffc422e1e7049046351 | Description: Takes in a trophy id and adds it the gamers trophies array Author: Adam Ghanem | [
{
"docid": "79ddedcea7ff61f011994a996e33d79a",
"score": "0.6045029",
"text": "def receive_trophy(trohpy_id)\n trophy = Trophy.find(trophy_id)\n \n if trophy == nil\n return false\n end\n \n if self.trophies.include? trophy\n return false\n else\n self.trophies << trop... | [
{
"docid": "68cb25ae411824c38fa027114c356528",
"score": "0.6842876",
"text": "def award(trophy)\n @trophies << trophy \n end",
"title": ""
},
{
"docid": "dd67d0eb0002dc764403a18672ee93ef",
"score": "0.6636362",
"text": "def add_troop(troop_id)\n $game_troop.add_troop(troop_id)... |
cfa44b79a54551cc2e7772e7bb62184a | GET /ladies/1 GET /ladies/1.json | [
{
"docid": "a81945373733e4951b987de6ea99f9a1",
"score": "0.0",
"text": "def show\n end",
"title": ""
}
] | [
{
"docid": "716a3eaa96cf995034701475e096d345",
"score": "0.7272765",
"text": "def index\n @ladies = Lady.all\n end",
"title": ""
},
{
"docid": "d1fc258af7cd215f945643008877f787",
"score": "0.7255155",
"text": "def index\n @ladders = Ladder.all\n\n render json: @ladders\n e... |
151a9287ff2b0f4ef7ba828fee6f6a21 | Rolls back the transaction (and turns on autocommitting). Must be done if the transaction block raises an exception or returns false. | [
{
"docid": "9e9de2c839b5576d04bb6adde8f12fc6",
"score": "0.73045903",
"text": "def rollback_db_transaction\n execute(\"ROLLBACK\")\n end",
"title": ""
}
] | [
{
"docid": "9ae1baf44a4b2b8a71f6541399675c9d",
"score": "0.7293254",
"text": "def exec_rollback_db_transaction\n @connection.rollback\n @connection.autocommit = true\n end",
"title": ""
},
{
"docid": "01075e3552b07558c6a52f3e68a1d99e",
"score": "0.72763824",
"text": "def... |
7b7ad159b1d2c84791699635012836f3 | List all public organizations for a user. = Examples github = Github.new github.orgs.list user: 'username' List public and private organizations for the authenticated user. github = Github.new oauth_token: '..' github.orgs.list | [
{
"docid": "e8987e74044a2cabe6a3a86a6d037cba",
"score": "0.7799357",
"text": "def list(*args)\n params = args.extract_options!\n normalize! params\n\n response = if (user_name = params.delete(\"user\"))\n get_request(\"/users/#{user_name}/orgs\", params)\n else\n # For ... | [
{
"docid": "d74c41c2425450ff5e0ad8d016fe1047",
"score": "0.8410417",
"text": "def find_all_organizations\n get_url(\"https://api.github.com/users/#{current_user.username}/orgs\")\n end",
"title": ""
},
{
"docid": "24a4ff6407e652cf50013c004dc7c1ba",
"score": "0.7914591",
"text": "... |
e05a4ba30464dc17209aa1e1a61fc82f | DELETE /tire_manufacturers/1 DELETE /tire_manufacturers/1.json | [
{
"docid": "f375012924887e8e23b3e52477fd311f",
"score": "0.78788626",
"text": "def destroy\n @tire_manufacturer = TireManufacturer.find(params[:id])\n @tire_manufacturer.destroy\n\n respond_to do |format|\n format.html { redirect_to tire_manufacturers_url }\n format.json { head :no_co... | [
{
"docid": "7bec955d21bf74c73330201e4b9d6858",
"score": "0.7422064",
"text": "def destroy\n @manufacturer = Manufacturer.find(params[:id])\n @manufacturer.destroy\n\n respond_to do |format|\n format.html { redirect_to manufacturers_url }\n format.json { head :no_content }\n end\n ... |
e4cbb76e55289b58d7f3299e71bd2f09 | TODO: This is a display and a request. Move to two functions. | [
{
"docid": "aa8adf4328323ce660d1124162e76629",
"score": "0.0",
"text": "def meal_action\n puts Paint[\"Write an action followed by the index of the meal you wish to change:\", SYSCOLOR, :bold]\n table = [\n {Action: \"cook\", Description: \"Change the item to \\\"Awaiting Cooking\\\"\"},\n {Acti... | [
{
"docid": "933f093d70379d323471b635c413e248",
"score": "0.68973315",
"text": "def display(response)\nend",
"title": ""
},
{
"docid": "8e33a3db8688908e329571ceb4d4e842",
"score": "0.66793483",
"text": "def display\n \n end",
"title": ""
},
{
"docid": "8e33a3db... |
8ed00556d4122e3eccfd9b5389522ebd | PUT /users/1 PUT /users/1.json | [
{
"docid": "91a61e8ef8060c484fdbe622e4bcbd08",
"score": "0.0",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.j... | [
{
"docid": "b5edb8a9b2cad14c7874c5f42c5809e9",
"score": "0.7438286",
"text": "def test_put_user\n json_data = '{\"name\":\"test\", \"last_name\":\"test\", \"document\" : \"098\"}'\n put '/users/4', json_data\n assert_equal 204, last_response.status, 'Código de respuesta incorrecto'\n end",
... |
c05d03811d3101d9c5766d7ddc3c7729 | DELETE /apostadores/1 DELETE /apostadores/1.json | [
{
"docid": "b407afbba6d37a1e656eb559d3f78b4b",
"score": "0.7211663",
"text": "def destroy\n @apostador.destroy\n respond_to do |format|\n format.html { redirect_to apostadores_url, notice: 'Apostador was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
... | [
{
"docid": "6aacef0a41b0cab169d450bf06d67c78",
"score": "0.75193536",
"text": "def destroy\n @apuestum = Apuestum.find(params[:id])\n @apuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to apuesta_url }\n format.json { head :no_content }\n end\n end",
"title"... |
7e1a36819073234f6aae5497229b34f2 | A triangle is classified as follows: right One angle of the triangle is a right angle (90 degrees) acute All 3 angles of the triangle are less than 90 degrees obtuse One angle is greater than 90 degrees. To be a valid triangle, the sum of the angles must be exactly 180 degrees, and all angles must be greater than 0: if... | [
{
"docid": "695529c88a75608c765ce36b693e9875",
"score": "0.86746395",
"text": "def triangle(ang1, ang2, ang3)\n angles = [ang1, ang2, ang3]\n\n case\n when (angles.all? {|a| a > 0} && angles.inject(:+) == 180) == false\n :invalid\n when angles.include?(90)\n :right\n when angles.all? {|a| a <... | [
{
"docid": "70009d0f40eae086c140f04b3c59f840",
"score": "0.9054999",
"text": "def triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n\n return :invalid if angles.any? {|x| x == 0 } || angles.sum != 180\n\n case\n when angles.any? {|x| x == 90 }\n :right\n when angles.all... |
91470dcf15886e0f51e1fa1ce3911ef1 | validate mobile_number method starts | [
{
"docid": "ad12300e401c1586b68932e9fb3396ba",
"score": "0.7322743",
"text": "def validation_of_phone_number(number)\n\n if number.to_s.length == 10\n\n @output = \"Verify\"\n return true, @output\n\n else\n\n @output = \"InValid Number\"\n return false, @output\n\n end\n\n ... | [
{
"docid": "0fbe75764063ba088bbbbd4b9e18fc0f",
"score": "0.79494184",
"text": "def valid_phone_number(number)\r\n\r\nend",
"title": ""
},
{
"docid": "7ac371b957f889a23e8d5e00e2c28d4b",
"score": "0.79115075",
"text": "def checkmobile\n mobile = user_params[:phone]\n if /\\A\\d+\... |
a0660ae581224c0e17479c85aace45e4 | Ruby port note: renamed from the python version's "expect" to not conflict with RSpec Sets the data to expect in the next call to invoke(). | [
{
"docid": "1d3a96adce3a1fa0d214f6a48a8716b3",
"score": "0.58814037",
"text": "def set_expected(method, reqpath, params = nil, data = nil, headers = nil, retdata = nil)\n @_next_expect = [method, reqpath, params, data, headers, retdata]\n end",
"title": ""
}
] | [
{
"docid": "f482813bc4571a3556a4bea3e2f071e8",
"score": "0.7105525",
"text": "def expect; parse_params; @expect; end",
"title": ""
},
{
"docid": "54b1dd680aa39b4b5e37fdc4ca50b308",
"score": "0.66586864",
"text": "def expect(*args)\n @expect.expect(*args)\n end",
... |
5f7b4a86accc4b67b8e5d6216ce8229e | Essentially, define an accessor for +name+ with +block+. Why use let instead of def? I honestly don't know. | [
{
"docid": "ad22c43ef0f98e6ad0cae61730bc1ecc",
"score": "0.6798521",
"text": "def let(name, &block); end",
"title": ""
}
] | [
{
"docid": "8fcf47eb6ed44e45a92b1c8e64a36893",
"score": "0.7203918",
"text": "def foo(name, &block)\n @name = name\n block.call\nend",
"title": ""
},
{
"docid": "ac3679c7b648c44341a937834213d945",
"score": "0.71003896",
"text": "def define_set_and_get_method(name, &block)\n ... |
cb2bf1027c9776ce4a1a8063db60937b | Inputs: A string representing a single word (i.e., no spaces) Returns: The word translated into "pig latin" Prints: Nothing Note 1 There are two rules for translating something into "pig latin": 1. If a word begins with a consonant or sequence of consonants, move the sequence of consonants to the end of the word and th... | [
{
"docid": "42c4c859ee32a2c7b30b21f24c11c14b",
"score": "0.79659617",
"text": "def pig_latin(word)\n if word.chr == \"a\" || word.chr == \"e\" || word.chr == \"i\" || word.chr == \"o\" || word.chr == \"u\" #first character checks if vowel or consonant, if true appends \"ay\"\n word << \"ay\"\n else... | [
{
"docid": "e65705c8231ed381d7bed58b59633b52",
"score": "0.84005016",
"text": "def translate(str)\n #IF the word starts with a vowel, add \"way\" to the end\n match = str.match /^[aeiou]/\n if match.nil? == false\n str = \"#{str}way\"\n #ELSE replace the word with its pig latin equivalent\n el... |
e8b1e0186b50678961628ce755738d20 | Retries loading of a WpCache model, if it was not found the first time. This to avoid NotFound errors due to the delaying of WP API calls. | [
{
"docid": "c5b1bad57f89434aef7eddc410d40c72",
"score": "0.0",
"text": "def retry_when_preview(retrying = false, &block)\n raise \"retry_when_preview requires a block\" unless block_given?\n return block.call\n rescue ActiveRecord::ActiveRecordError => e\n raise e if !params[:preview] || retry... | [
{
"docid": "845eb06c25655295d3ef4f0d0eb58e48",
"score": "0.63320297",
"text": "def fetch(key, options = {})\n retries = 2 \n begin\n super\n rescue ArgumentError, NameError => exc \n if retries == 2\n if exc.message.match /undefined class\\/modul... |
34c11d2872d39b3642ab19c5ace5e010 | Multiply the number with the global number | [
{
"docid": "3eb2bc359d93ef430d0465d1faa0eeb3",
"score": "0.72955215",
"text": "def multiply(input_number)\n $number *= input_number\n return $number\nend",
"title": ""
}
] | [
{
"docid": "eb8ed099952768d66e54f37bc495346a",
"score": "0.73626465",
"text": "def multiplication(num, xtimes)\n\tnew_num = 0\n\txtimes.times do\n\t\tnew_num += num\n\tend\n\tnew_num\nend",
"title": ""
},
{
"docid": "d932fc21153c0887157b5ab9885075e1",
"score": "0.7359609",
"text": "d... |
8e51ba25028f85bbfbed2f25438a850e | You can use this function to fill the background of the picture or of the graph area with a color gradient pattern. You must specify the starting color with its r,g,b values, the number of shades to apply with the decay parameter and optionnaly the target that can be : Rchart:: TARGET_GRAPHAREA The currently defined gr... | [
{
"docid": "2227d4396cff24969601126c020f6b61",
"score": "0.7202398",
"text": "def draw_graph_area_gradient(r,g,b,decay,target=Rchart::TARGET_GRAPHAREA)\n b, g, r = validate_color(b, g, r)\n x1,y1,x2,y2 = 0,0,0,0\n if ( target == Rchart::TARGET_GRAPHAREA )\n x1 = @g_area_x1+1\n x2 = @g... | [
{
"docid": "787e8506cbdf5ffef68c3f6de6b39550",
"score": "0.7286307",
"text": "def fill_background( background )\n background.fill( Color::ColorRGB.new([0.1, 0.2, 0.35]) )\n background.fill( :black, [70,120,80,80] )\n background.fill( \"dark red\", [80,110,80,80] )\nend",
"title": ""
},
{
... |