query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
ba4337b2f481cda8c238d8bf993d6015
Check if this is the first iteration of the partial.
[ { "docid": "d1e6d435597c712ecaf27bb972d63543", "score": "0.68883246", "text": "def first?\n index == 0\n end", "title": "" } ]
[ { "docid": "69c0a7be9bdf9fb7a6a0a7e23a6d8ba2", "score": "0.7734334", "text": "def first?\n\t\treturn @iteration == 0\n\tend", "title": "" }, { "docid": "80d0793674ca80ed5b0c8c832e749536", "score": "0.73094505", "text": "def first?\n if defined? @first\n false\n else\...
66b0489a6d72239981968bc6dc07af6e
Restore Previous Selection Position
[ { "docid": "b92b9fa013e9fbacc45c2eea4fb37a87", "score": "0.0", "text": "def select_last\n select_symbol(@@last_command_symbol)\n end", "title": "" } ]
[ { "docid": "19fe2e683bfaf8683da9dec522315ead", "score": "0.7297521", "text": "def back_selection\n @dominations_window.activate\n @command_window.deactivate\n @command_window.index = -1\n end", "title": "" }, { "docid": "f75e05b2efd3a584fbfe2112b2469ca3", "score": "0.7092327", ...
1f44ee36c5b1dc0c5d54b70a3ae93313
GET /audio_stories/1 GET /audio_stories/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "52af6c56141f056d3795484d13ca7402", "score": "0.76983106", "text": "def index\n @audio_stories = AudioStory.all\n end", "title": "" }, { "docid": "af636de7576febeb1bbea645dd57184a", "score": "0.7208374", "text": "def show\n story = Story.find(params[:id])\n rende...
51629dfc1515944662ecd83a7a884492
for each regex in pattern list, does the file match the pattern?
[ { "docid": "fbd13866538a27135854b083ef9d8834", "score": "0.0", "text": "def is_match?(file)\n return Match.new file, 'No Destinatin for file'\n end", "title": "" } ]
[ { "docid": "66e42c9a631767b763a6e6b010f40435", "score": "0.73338", "text": "def matched_in_patternfile?(filepath, matchthis)\n\n patternlist = []\n\n begin\n open(filepath).each do |l|\n l.chomp!\n\n next if l =~ /^$/\n next if l =~ /^#/\n\n if l =~ /^\\s*(\\S+)/\n...
dd2145b207eefb60d6853fff1018615a
Creates a hash of the time components. Any keys with nil values are excluded from the result.
[ { "docid": "0858264d1a964402a0bf69cb4ce99f3d", "score": "0.59358424", "text": "def to_hash\n hash = {}\n hash[:years] = @years if @years\n hash[:months] = @months if @months\n hash[:days] = @days if @days\n hash[:hours] = @hours if @hours\n hash[:minutes] = @minutes if @min...
[ { "docid": "860bd8cee4a31113483c5b5f7abced75", "score": "0.6949486", "text": "def initialize_time_hash\n time = {}\n (0..23).each do |hr|\n time[\"#{hr}:00 - #{hr+1}:00\"] = 0\n end\n time\n end", "title": "" }, { "docid": "9612fa1c1339fa2850de95caa01f9af9", "score": "0...
4c14494b988825db9554ab71805108d0
Base64encodes the given data. Newlines are removed. This is like `Base64.strict_encode64`, but also works on Ruby 1.8 which doesn't have that method.
[ { "docid": "cbc401759ffed74bde486439f3f977a4", "score": "0.806171", "text": "def base64(data)\n result = Base64.encode64(data)\n result.delete!(\"\\n\")\n result\n end", "title": "" } ]
[ { "docid": "7371f986d26bca9659e15a5e708e9069", "score": "0.81253207", "text": "def base64(data)\n result = Base64.encode64(data)\n result.delete!(\"\\n\")\n result\n end", "title": "" }, { "docid": "4499141711ff0adcadce54de1c6bee7f", "score": "0.777031", "text": "de...
c20c74077ac30d664cfc294feb1eef10
++ This is for testing the custom validation, 'validate_name_and_account_number'. Name and Account Number should contain alphabets, numbers, | hyphens and periods only. | Input : Invalid Name and Account Number. | Output : Returns error message if balance_record_config is not valid. | Author : Ramya Periyangat | ++
[ { "docid": "8c231e7ec4dec4ac722fa0d07e0a7c53", "score": "0.7819882", "text": "def test_validate_name_and_account_number_by_giving_invalid_data\n balance_record_config = BalanceRecordConfig.new\n balance_record_config.first_name = \"RAJ*\"\n balance_record_config.last_name = \"CC.j)\"\n balan...
[ { "docid": "6eafd7939f1f3881967d59295a19219c", "score": "0.7778726", "text": "def test_validate_name_and_account_number_by_giving_valid_data\n balance_record_config = BalanceRecordConfig.new\n balance_record_config.first_name = \"RAJ.jk-9\"\n balance_record_config.last_name = \"CC.9-\"\n bal...
da55010c00c68ff8ab61a8b38260c1a6
Subdivide each set of morpheme hypotheses in a phonetic equivalence class into a semantic equivalence classes based on meaning intersections. [powerset_search_cutoff] size of an allomorph set above which we will not do a powerset search for the semantic equivalence classes
[ { "docid": "8280754789f2591a57033f7d19364a04", "score": "0.73980165", "text": "def group_into_semantic_equivalence_classes!(powerset_search_cutoff)\n each do |allomorphs, hyps|\n LOGGER.debug(\"Compile semantic equivalence class for \"+\n \"#{allomorphs} (#{self[allomorph...
[ { "docid": "610e554ced8934e5cfe2cc4e61359ce9", "score": "0.64654785", "text": "def group_into_phonetic_equivalence_classes!(morpheme_hypotheses)\n morpheme_hypotheses.each do |morpheme_hypothesis|\n compatible = keys.find_all do |allomorphs|\n allomorphs.is_compatible?(morpheme_hypo...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "0ac6ba8ac20eb8f663adf926244ba6cb", "score": "0.0", "text": "def communication_params\n p = params.require(:communication).permit(:title, :start_date, :expiry_date, :description, :attachment)\n p[:expiry_date] = Date.parse(p[:expiry_date])\n p[:start_date] = Date.parse(p[:start...
[ { "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...
c09b097c3c32ba9377a3c0ec8c907808
GET /featureds GET /featureds.json
[ { "docid": "53c7eb44507c828d5f41f43432b7531a", "score": "0.54167026", "text": "def index\n @pagy, @featureds = pagy(Featured.all.order(\"created_at DESC\"), items: 80)\n # @pagy, @featureds = pagy(Featured.order(\"impressions_count DESC\"), items: 80)\n if params[:search]\n @search_term =...
[ { "docid": "9902f619e67f9be2fac0f4ce035c81a7", "score": "0.7202464", "text": "def index\n @featureds = Featured.all\n end", "title": "" }, { "docid": "4468df9072e261c9e95d89adfc8b432d", "score": "0.7057654", "text": "def features\n validate_loaded\n resource = FEATURES ...
f08a2b21661b998ede8e13dfc714cf4d
This method spawns a thread
[ { "docid": "77db9c96d16b237083b1ae1c937f1b77", "score": "0.0", "text": "def answer_pings\n\t\t@ping_thread = Thread.new do \n\t\t\tbegin\n\t\t\t\tloop do \n\t\t\t\t\tpkt = @tap.recv\n\t\t\t\t\ticmp = icmp_offset(pkt)\n\t\t\t\t\tif icmp and pkt[icmp] == \"\\x08\" #type == Echo Request\n\t\t\t\t\t\tpkt[i...
[ { "docid": "2db934807f7f4907674b011838f55ec2", "score": "0.7642397", "text": "def start_thread #does this need to be its own thread?\n @@thread = Thread.new do\n self.run\n end\n end", "title": "" }, { "docid": "bc4d776256b5adb6444b94119fa98ad1", "score": "0.72957313", "t...
0efd220a035445209b36e4b790c5fdb3
Define a Mongoid::Document delegate class
[ { "docid": "4ca0abdbf3321c6c7b41da5139aad950", "score": "0.7024713", "text": "def delegate_klass(klass_name)\n klass = self.class.const_set(klass_name, Class.new)\n klass.send :include, Mongoid::Document\n klass.send :include, Mongoid::Attributes::Dynamic\n klass.store_in collection:...
[ { "docid": "89f527d6b33928e3816ced34fa168e85", "score": "0.6636282", "text": "def method_missing(name, *args, &block)\n unless @target.respond_to?(name)\n object = @klass.send(name, *args)\n object.documents = @target\n return object\n end\n super\n e...
7133aeccbc0ab9f462064ccd9259cfac
displays single submission and associated params
[ { "docid": "b0ace135f8fedef4a0e9459793f1bd71", "score": "0.7557497", "text": "def show\n @submission = Submission.find(params[:id])\n end", "title": "" } ]
[ { "docid": "0997fad58feda7afe43434c31a1c2ec6", "score": "0.767917", "text": "def show\n @submission = Submission.find(params[:submission_id])\n end", "title": "" }, { "docid": "2bb2ced8fca24c7208c5b8b870e962ac", "score": "0.73933876", "text": "def show\n \t@submission = @job.sub...
4307732f770727137672eb60d750d1c5
Add a vote for an object
[ { "docid": "5af2a548fbd951d6361408e13073be95", "score": "0.7508744", "text": "def add_vote(id, verdict)\n id = to_id(id)\n params = {\n data: {\n type: \"vote\",\n attributes: {\n verdict: verdict\n }\n }\n ...
[ { "docid": "7d39953b7cb5349ce4dcd079c8783d06", "score": "0.7920922", "text": "def add_vote(vote)\n self.score = self.score + vote.value\n self.votes_count = self.votes_count + 1\n end", "title": "" }, { "docid": "6e7c657dd2015ee315fadacae1268922", "score": "0.7902411", "text":...
2bc4d0c172ed009480e0e77f0223de9f
Roles of the Cloudera Management Services
[ { "docid": "a8948b512a3504c841ef06feed659458", "score": "0.0", "text": "def cms_roles(cm, api_base_url, user, password)\n url = \"#{api_base_url}/cm/service/roles\"\n roles = API.get_req(url: url, user: user, password: password,\n props: :items, sym_na...
[ { "docid": "7bb0cfae8d530d7ca0792aaa4b43c9cf", "score": "0.723222", "text": "def roles; end", "title": "" }, { "docid": "7bb0cfae8d530d7ca0792aaa4b43c9cf", "score": "0.723222", "text": "def roles; end", "title": "" }, { "docid": "007d2f0cd9201a66d0dfed9ffe7d9642", "sc...
b75b8c421e83826f9b5fb78af8449875
PUT /clients/1 PUT /clients/1.xml
[ { "docid": "6ea8e7a741dc60ad95378fa510ad1e75", "score": "0.64362854", "text": "def update\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n flash[:notice] = 'Client was successfully updated.'\n format.html { redirec...
[ { "docid": "31f70c735c99bdbe7444474c2a79cbd9", "score": "0.6486044", "text": "def update\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n flash[:notice] = 'Client was successfully updated.'\n format.html { redirect...
22de9a0a3d641e1d4f7b0b37ea3a5658
def is_a_crj_900?(row) row['Designator'].downcase == 'crj9' end
[ { "docid": "f24eef7ac9936d39a3d1aff014f66cf0", "score": "0.8054006", "text": "def is_a_g159?(row)\n row['Designator'] =~ /^G159$/\n end", "title": "" } ]
[ { "docid": "413c64174eb17b8be104dd4ba4f86675", "score": "0.65251935", "text": "def aleph_cr_record?\n if @record.eds_accession_number.present? &&\n @record.eds_accession_number.start_with?('mitcr.')\n true\n else\n false\n end\n end", "title": "" }, { "docid": "e40c...
0a30097baa04b0430e2f318a6d9aa862
Finally, this does the same as the above, but sorted by the bill's issue. Same maintenance suggestion.
[ { "docid": "9da09571f2c3d65ea6499d3d5d85dc79", "score": "0.0", "text": "def generate_repsissues(congress, data)\n puts \"generating repsissues for #{congress.number}...\"\n @columns = reps_columns\n representatives = congress.representatives.sort {|x,y| x.last_name <=> y.last_name }\n all_bi...
[ { "docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1", "score": "0.7047385", "text": "def private; end", "title": "" }, { "docid": "0b8b7b9666e4ed32bfd448198778e4e9", "score": "0.620835", "text": "def probers; end", "title": "" }, { "docid": "65ffca17e416f77c52ce148aeafbd826", ...
9039d41a87a575425bcc807b4f2cff13
Arguments: 1 integer, position Side effects: None Return: Integer, should return the position'th fibonacci number. Edge cases: fibonacci(1) should return 1 fibonacci(2) should return 1 Algorithm: position <= argument 1) fibonacci_numbers = [1, 1] 2) do the following (position 2) times: add up the values of the last 2 n...
[ { "docid": "82b01495a1d134f5d1a1f896ac9fc7dc", "score": "0.7374547", "text": "def fibonacci(nth)\n fibonacci_numbers = [1, 1]\n (nth - 2).times do |_|\n fibonacci_numbers << fibonacci_numbers[-2] + fibonacci_numbers[-1]\n end\n fibonacci_numbers.last\nend", "title": "" } ]
[ { "docid": "4527e8e9634623f7f02683181b430df6", "score": "0.859434", "text": "def fibonacci(position)\n if (position == 1 || position == 2)\n 1\n else\n fibonacci(position-1) + fibonacci(position-2)\n end\nend", "title": "" }, { "docid": "f8557b3a3c822055acb9da948daf5bb4", "score...
59ca7effeca7f2eecdfda59c1ed799b5
enable login and update the status This means the user is added to the LDAP group that corresponds to the given role
[ { "docid": "b564f0284d6c987740bfac7fe498c3a0", "score": "0.0", "text": "def add_user_group(email_address, group_id)\n user_dn = email_address\n group_dn = get_group_DN(group_id)\n\n filter = Net::LDAP::Filter.eq( \"cn\", group_id)\n\n Net::LDAP.open(@ldap_conf) do |ldap|\n group_found ...
[ { "docid": "4d0e21e75e11251f2eb00ed9a83c3c1d", "score": "0.62535137", "text": "def update_user\n @user = @user || student.user || student.build_user\n @user.update_attribute(:login, loginname)\n @user.roles << Role.find_by_name('student') unless @user.has_role?(\"student\")\n self.update_att...
726fb31e27b3357cf188bb9239a73681
PUT /responses/1 PUT /responses/1.xml
[ { "docid": "47f9ab527fad62adbb9a4580747484db", "score": "0.6128103", "text": "def update\n @response = Response.find(params[:id])\n\n respond_to do |format|\n if @response.update_attributes(params[:response])\n format.html { redirect_to(@response, :notice => 'Response was successfully ...
[ { "docid": "23b5f5e4dacfb330cb1e0ffd4590ef63", "score": "0.655676", "text": "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post opts.fetch(:path, update_path), opts\n end", "title": "" }, { "docid": "9ddf960eb3f437e62b9b99d34992bc0f"...
fb24a5239824c42c690b9c8780b22a7b
get the types of datafiles existing on a node recursive method
[ { "docid": "a638764f25575a529009d9f617e5b072", "score": "0.7558111", "text": "def get_types_datafiles_on_node(node, level)\n\tfname=\"plm_modeling:#{__method__}\"\n\tret=[]\n\tunless node.nil?\n\t\tlnk = get_node_link(node)\n\t\tunless lnk.nil?\n\t\t\tchild = lnk.child\n\t\t\tLOG.debug(fname) {\"child_p...
[ { "docid": "7946c4cffc194c9e846138c21b2c70a1", "score": "0.7492512", "text": "def get_types_datafiles_on_tree(tree)\n\tfname=\"plm_modeling:#{__method__}\"\n\tret=[]\n\tunless tree.nil?\n\t\t#LOG.debug(fname) {\"#{tree.nodes.count} nodes\"}\n\t\tret = get_types_datafiles_on_node(tree,0)\n\tend\n\tret\ne...
1e79f2cfc020909d4769f24a989e4c41
POST /build_objects POST /build_objects.json
[ { "docid": "99e08b8b7d90fc779cfb3815124cdcec", "score": "0.70743364", "text": "def create\n @build_object = BuildObject.new(params[:build_object])\n\n respond_to do |format|\n if @build_object.save\n format.html { redirect_to @build_object, notice: 'Build object was successfully create...
[ { "docid": "f7eac0e734217959b9c72ce6c05e4cb9", "score": "0.6463173", "text": "def build_objects\n build_objects_by_subject\n link_objects\n\n @objects\n end", "title": "" }, { "docid": "e01ac2a67894e5c12ade12179d54de5b", "score": "0.6143263", "text": "def build()\n ...
3a0c09f0b4335ccfb66fe73d3ccdf260
Gets the connection limits for this virtual addresse.
[ { "docid": "3c49e4a5e693f66ab547756bbaf507e7", "score": "0.5940035", "text": "def connection_limit\n super\n end", "title": "" } ]
[ { "docid": "dea6918a16ef609852206c634e7e0fea", "score": "0.66788644", "text": "def limits\n return @opts['api_limits']\n end", "title": "" }, { "docid": "fe4eb2942bb6489d505d3b73ead7f81c", "score": "0.66060436", "text": "def limits\n c = get_connection\n result = c.li...
11d0091ad41762f110e1ddcede3e25cb
The alpha= method is used to set the opacity of the material. The value must be between 0.0 and 1.0. A value of 0.0 means that the material is completely transparent. A value of 1.0 means that the Material is completely opaque.
[ { "docid": "c79464f4348f564eba7e5f8a2e40651c", "score": "0.57814014", "text": "def alpha=(alpha)\n end", "title": "" } ]
[ { "docid": "c2917a646708d830d4172de6a9ffa5de", "score": "0.7474426", "text": "def alpha=(val)\n @color.alpha = val\n end", "title": "" }, { "docid": "5ca2d9558c53846f023bb036ab098f56", "score": "0.70712686", "text": "def alpha=(value)\n self.rgba = (rgba & ~0xFF000000) |...
27082469b4ba47a88c00838f7924c1df
can the current element deal with a lookahead?
[ { "docid": "aed0c278c86dd5b0b219c0402537e165", "score": "0.6359956", "text": "def expect_lookahead?(element)\n return element.class == Node[:capture] unless element.is_a? Node[:group]\n element.payload.all? { |e| expect_lookahead?(e) }\n end", "title": "" } ]
[ { "docid": "8acc7838432fa029772f047f5a41d93e", "score": "0.67900527", "text": "def lookahead(lookahead = nil) \n @lookahead = lookahead unless lookahead.nil?\n @lookahead\n end", "title": "" }, { "docid": "be051de324c9fd25655db8ebf3d6078f", "score": "0.64776665", "...
325d4e97c88ed514714b5638b468d278
get the result of the web request
[ { "docid": "b35a16d5010a4d1eca2b06c6af8b0246", "score": "0.74933606", "text": "def get_result\n uri = URI.parse(self.url)\n \n # debugging output\n WebServiceDocumenter.log(\"Getting #{self.url}\")\n \n result = if @method =~ /post/\n if @multipart == true\n ...
[ { "docid": "e216d3d03a6bc90c7b1347b57a94c8f6", "score": "0.7223076", "text": "def get_request (url='')\n res=@http_session.get(url).body\n\n if @debug then\n puts res\n end\n\n res\n end", "title": "" }, { "docid": "a97d4ffa09a6aaf6fa4909708c6accfd", "score"...
205e5e0104674f025ca9deda9646c1d7
Returns an array of hierarchical managers for a user. +depth+ : if provided, traverse upto the depth. if not provided, traverse upto possible depth. +hierarchical_manager_ids+ : it is exclusively used by the recursion and should not be passed in when calling from outside. Note: The following conditions terminate the re...
[ { "docid": "618ddca982e43de83554a554d65661cd", "score": "0.834983", "text": "def hierarchical_managers_recursive(depth: nil, hierarchical_manager_ids: [])\n can_not_go_deeper = self.manager.blank? || (depth && depth <= 0)\n user_is_her_own_manager = self.id == self.manager&.id\n cyclic_hierarch...
[ { "docid": "78d7a3698a0836b9ac34ebe17221a5f5", "score": "0.5614105", "text": "def hierarchy\n hierarchy = []\n hierarchy << self\n manager = superior\n while manager\n hierarchy << manager\n manager = manager.superior\n end\n hierarchy\n end", "title": "" }, { "d...
f9cb75e56052c87d02fe1af751da2547
Fill the entire window with a Rubydraw::Color. Do this by feeding SDL the numeric version of the color; see Rubydraw::Colorto_i
[ { "docid": "6c1eb0971a374b63149797c25aca03dc", "score": "0.75265896", "text": "def fill_with(color)\n SDL::FillRect(@screen, nil, convert(color))\n end", "title": "" } ]
[ { "docid": "5f6dba16aae1a404099ad5c9656b270e", "score": "0.72565013", "text": "def fill(color)\n SDL.FillRect(@sdl_surface, nil, color.to_i(:surface))\n end", "title": "" }, { "docid": "cd3eb396c97786e970b6fa7e46434880", "score": "0.69509655", "text": "def draw\n green ...
7379e77352067cb7050e5ca162a43540
GET /departments/1 GET /departments/1.xml
[ { "docid": "c7145ab12e3d5da0a814c04d0452f75c", "score": "0.6609636", "text": "def show\r\n @department = Department.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @department }\r\n end\r\n end", "title": "" } ]
[ { "docid": "c502e9f36f63490e231ca711c59eb523", "score": "0.67473924", "text": "def show\n @department = Department.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @department }\n end\n end", "title": "" }, { "docid...
12741507635c9ae44aafa62f873527c1
Override to_model to always return the proxy, otherwise it returns the target object. This allows us to integrate with action view.
[ { "docid": "0997d8630022d54092fa6793f35f6462", "score": "0.6513057", "text": "def to_model\n self\n end", "title": "" } ]
[ { "docid": "3f2a0ddb6fbe1f6aa35af675b0d36b0d", "score": "0.71078724", "text": "def to_model\n __getobj__\n end", "title": "" }, { "docid": "40d90b7329fa9b8e3e55e27a6d7201b7", "score": "0.7024399", "text": "def to_model\n __getobj__\n end", "title": "" }, { "do...
58929b1aaf63e6633f07958def38d917
Returns the orthogonal between two arrays.
[ { "docid": "2fb55f35a37d2ef770b571f1ed408465", "score": "0.7978469", "text": "def orthogonal(array)\n # Check the dimensions, raise error if they don't match.\n first_lenght = self.count\n second_lenght = array.count\n raise 'Wrong dimension error' if first_lenght != second_lenght\n # Fin...
[ { "docid": "c3fedf4d7d0803bcd03b44f97aaaca5e", "score": "0.7091299", "text": "def orthogonal(origin)\n select { |square| Vector.new(origin, square).orthogonal? }\n end", "title": "" }, { "docid": "84b9024e0e664184fe9e9f4e2ea91c1d", "score": "0.69087815", "text": "def orthogon...
72f3b2d0c7328d9642e3d7ed8e7974c0
checks if the customer is within 100km of the Intercom office
[ { "docid": "28e1d97e226a754cb16d7e2b6541b54b", "score": "0.67007273", "text": "def isNearIntercomOffice(latUser, longUser)\n\t\t#Uses Haversine formula to calculate distance between GPS co-ord\n\t\tlatIntercom, longIntercom = 53.3381985, -6.2592576\n\t\t\n\t\t#Converts all GPS coordinates from degrees t...
[ { "docid": "2f57fffd7901e19a13e90cd9451bace3", "score": "0.7220366", "text": "def customer_in_range(customer, range)\n distance = GeoCalculator.distance(\n customer['latitude'].to_f, customer['longitude'].to_f,\n @lat_origin, @long_origin\n )\n\n distance <= range.to_f\n end", "t...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "869ffbd6cd24d7fb6fa784eb20dac887", "score": "0.0", "text": "def student_has_semester_params\n params.require(:student_has_semester).permit(:concluido, :student_id, :semester_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...
66dc474366f3fef5f9e7427fcbbe7308
List of currently used countries
[ { "docid": "972e12b41579374e5d4d02546c879478", "score": "0.61505747", "text": "def set_countries\n writer_arr = Writer.select(\"country_id\").distinct.map{|c| c.country_id}\n outlet_arr = Outlet.select(\"country_id\").distinct.map{|c| c.country_id}\n @current_countries = (outlet_arr + writer_ar...
[ { "docid": "eb3452c674bb7aa73d1545f167241b88", "score": "0.79367137", "text": "def country_list\n @countries ||= case kind\n when 'country' then\n zoneables\n when 'state' then\n zoneables.collect(&:country)\n ...
05de90f4b6e0c2e80a99cf0d5189c8d8
POST /shopping_carts POST /shopping_carts.json
[ { "docid": "603b76ed335e91420aaf3801011f08a1", "score": "0.70963407", "text": "def create\n @shopping_cart = ShoppingCart.new(shopping_cart_params)\n\n respond_to do |format|\n if @shopping_cart.save\n format.html do\n redirect_to(\n @shopping_cart,\n not...
[ { "docid": "2ed05351f8959b1c59c31fd25ed18632", "score": "0.74898875", "text": "def create\n response, status = BeyondApi::Request.post(@session,\n \"/carts\")\n\n handle_response(response, status)\n end", "title": "" }, { "docid": ...
6faabf179f4d27c3021c418f305e2f87
get_council_reference Parameters:: (tag) params:da_container tag Return:: council_reference Author::
[ { "docid": "d9b58b91d427f02ae11a8a3c3556c47b", "score": "0.53374785", "text": "def get_council_reference(tds)\n return clean_whitespace(tds[0].at('a').inner_text )\nend", "title": "" } ]
[ { "docid": "fdefae24a3e2cd7672deac2857f076ca", "score": "0.5701989", "text": "def citation\n if h.user_signed_in? && h.current_user.csl_style\n if fulltext_url\n cloud_icon = h.content_tag(:span, '',\n data: { tooltip: true },\n ...
e9aff20fb34a309fcf841688fe0f03fd
charset_id2name(charset_id) > charset_name Returns the Oracle character set name from the specified character set ID if it is valid. Otherwise, +nil+ is returned. === Oracle 9iR2 client or upper It is done by using the mapping table stored in the client side. === Oracle 9iR1 client or lower It executes the following PL...
[ { "docid": "aecf474ac93bd404ffb75684b39a0a35", "score": "0.7956695", "text": "def charset_id2name(charset_id)\n #This is a stub, used for indexing\n end", "title": "" } ]
[ { "docid": "22fec4e27d59333c2bec0b99d9cdd4be", "score": "0.7046856", "text": "def charset_name2id(charset_name)\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "43f83be61c0ce39c8b5f6e83e75aec45", "score": "0.68314767", "text": "def get_charset_name(ch...
d936492133039a02f62bb178cdd680d6
Skip the array until the target is found self : Array
[ { "docid": "f5038e3a972ec619176af10e2a3a47f0", "score": "0.6529486", "text": "def skip_to(target_id)\n result = [] ; target_found = false\n each{|d|\n result << d if target_found\n target_found = true if d.id == target_id\n }\n result\n end", "title": "" } ]
[ { "docid": "b521d31816d8a0b826f325ac3ed48897", "score": "0.61609834", "text": "def chop(target, array)\n search(target, array, 0, array.length)\n end", "title": "" }, { "docid": "5eeda9a430d603573b759e2dad0b726c", "score": "0.6010921", "text": "def skip(array)\n new_array ...
935faea3dbceaed3d7ca2b06584322db
Returns Time.now rounded down to the nearest second.
[ { "docid": "5cfbd8f93c6172d4a9a5246f73c9c1fa", "score": "0.70545447", "text": "def truncated_now\n Time.at(Time.now.to_i)\n end", "title": "" } ]
[ { "docid": "c8420dee80e23c41b11d2971ec44e2dc", "score": "0.73560464", "text": "def current_time\n time=Time.at(Time.now.to_i) # this way nsec and usec is 0\n if @resolution == :second\n sec = time.strftime(\"%S\").to_i % @duration\n time = time - sec\n end \n return time\n end", ...
842f8ba9a121a5b4c144de882f228195
Find the version of pip currently installed in this Python runtime. Returns nil if not installed.
[ { "docid": "25d242918bd8813c5980fcd289009260", "score": "0.8126647", "text": "def pip_version\n version_cmd = [new_resource.parent.python_binary, '-m', 'pip.__main__', '--version']\n Chef::Log.debug(\"[#{new_resource}] Running pip version command: #{version_cmd.join(' ')}\")\n ...
[ { "docid": "f8bf552ff391f8c3eb6472d13e7181ba", "score": "0.7857258", "text": "def pip_version\n return `pip --version 2>&1`.match(/pip\\s+([\\d\\.]+)/)[1].chomp('.')\n end", "title": "" }, { "docid": "3aea21f04f99c40e1d74a1d970c981d1", "score": "0.6851316", "text": "def g...
e9631c92e3ac7821453f4c301e1e32a5
Every n letters insert a break
[ { "docid": "58e85c3e2bcede1bd1f1f964014d9d43", "score": "0.7543648", "text": "def format_text(n)\n if (text.length < n)\n return text\n end\n count = 0\n formatted_text = ''\n text.split('').each do |letter|\n if count == n\n formatted_text += '\\n'\n count = 0\n ...
[ { "docid": "46ede8c32409e08abcaff3c899d5ee0b", "score": "0.6950857", "text": "def repeat (text, nb=2)\r\n return nb.times.collect{text}.join(\" \")\r\nend", "title": "" }, { "docid": "53ae9715c5f47a64307333c1bc96b435", "score": "0.6775968", "text": "def staircase n\n i = 1\n u...
371339c11277486999025c15969e65c4
wave 5 checks to see if input is in English dictionary
[ { "docid": "b044ce219146527604f2ae7bbf941bb4", "score": "0.6562199", "text": "def is_in_english_dict? (input) \n path = '/Users/kelseykrippaehne/Documents/Ada/hw/adagrams/lib/dictionary-english.csv' # deliberate absolute path\n lower_case_input = input.downcase\n File.open(path) do |file|\n whole_...
[ { "docid": "68927f507a05ed2b43105cfcc415cbe1", "score": "0.76532704", "text": "def is_in_english_dict?(input)\n input.downcase! \n\n dictionary = CSV.read(\"assets/dictionary-english.csv\")\n dictionary = dictionary.flatten\n\n dictionary.include?(input) ? true : false\nend", "title": "" }, ...
c1ea9f3d3a6a79c03c96675b6b15f64f
GET /week_data GET /week_data.json
[ { "docid": "416370a9da710b9217674df94a79ca82", "score": "0.75376284", "text": "def index\n @week_data = WeekDatum.all\n end", "title": "" } ]
[ { "docid": "1cd0149601367371e19ed75395d07c32", "score": "0.7482323", "text": "def index\n @weeks = Week.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weeks }\n end\n end", "title": "" }, { "docid": "3da85f29df1dc5f725acc213290...
8c45819e392eabb79f1bd518d2e53dcb
Depth concatenation with +matrices+.
[ { "docid": "3053bd8de03dad1170acfcda819e7036", "score": "0.6783574", "text": "def dconcat(*matrices)\n concat(*matrices, :layer)\n end", "title": "" } ]
[ { "docid": "84593bc5c36878442701f58c73e3f005", "score": "0.671406", "text": "def concat(*matrices)\n rank = nil\n rank = matrices.pop unless matrices.last.is_a?(NMatrix)\n\n # Find the first matching dimension and concatenate along that (unless rank is specified)\n if rank.nil?\n rank =...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "bc663ff8f48f015ee90b76cbfebf1717", "score": "0.0", "text": "def sensor_find_params\n params.require(:sensor_find).permit(:sensor_id, :time, :comments)\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...
b555cfd5c7d2a6b7bb44451ce9faf4e9
GET /topics/new GET /topics/new.json
[ { "docid": "94ac1c221762c13bad60159cf04f08a4", "score": "0.81443727", "text": "def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end", "title": "" } ]
[ { "docid": "9bc9d588cf56a86eaad978c51af6c416", "score": "0.81783783", "text": "def new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end", "title": "" }, { "docid": "2ba090cd93b11a08429edd7123a0899c", "score":...
cba5a47249da78c71bd1b53213c3d9db
uploads data to specified url parameters: url upload url data data to upload returns: true if upload was successful false otherwise
[ { "docid": "6b687c491ae2a2b25165f75eda2a01de", "score": "0.756441", "text": "def upload_part(url, data)\n conn = Faraday.new(url: url) do |faraday|\n faraday.adapter :net_http\n end\n resp = conn.put do |req|\n req.body = data\n # to prevent Fa...
[ { "docid": "438ec22c8b17222bd87cdeff7b36c349", "score": "0.6604394", "text": "def upload(filename)\n begin\n file = File.open(\"#{filename}\")\n response = @client.put_file(\"/#{filename}\",file,true)\n return true\n rescue\n return false\n end\n end", "title": "" }, ...
58d65ff617cb553a86698ad62519e1a1
GET /permissions/load_permission_tree get permission tree for zTree
[ { "docid": "dd72fcf99dab977219e5c277d27ebc59", "score": "0.8092404", "text": "def load_permission_tree\n render :json => Permission.load_permission_tree.to_json\n end", "title": "" } ]
[ { "docid": "98e45968f1000ed4c6e9c3c4bf14b19d", "score": "0.61054945", "text": "def get_tree\n @api.get_account_tree(id, 'simple')['tree']['folder']\n end", "title": "" }, { "docid": "9852ce07db1b33ca5dcd8cb4f6f965af", "score": "0.60836756", "text": "def ajax_get_tree\n Log...
2d9bddf3625b2ddcc648de176bf808ca
Reset the body (leave the header) between successful responses Returns nothing
[ { "docid": "c302a177917cdb112a7aaae88319e774", "score": "0.74296695", "text": "def reset\n self.body = \"\"\n end", "title": "" } ]
[ { "docid": "c8ca5812a1ce9ccd9b3f985495e7eafe", "score": "0.79516697", "text": "def flush\n @resp_body = \"\"\n @resp_headers = {}\n end", "title": "" }, { "docid": "3c8e863be50b52de48962cdada4cb7b4", "score": "0.7923943", "text": "def reset\n if @body_sent\n raise ...
5f66c8a8abd6a5472a93331639e13a58
Returns details on the IG Markets applications for the accounts associated with this login.
[ { "docid": "10a5f814cbb24790678ef45949767b86", "score": "0.6433719", "text": "def applications\n Application.from session.get 'operations/application', API_V1\n end", "title": "" } ]
[ { "docid": "a2009aaf5ec2d210cd557ba009f63eda", "score": "0.6682707", "text": "def applications\n select_application gp_card_manager_aid\n secure_channel\n gp_get_status :apps\n \n # TODO(costan): there should be a way to query the AIDs without asking the\n # SD, which req...
82938d3120bc9a38c1605f3165ba70c3
execute the most profitable swap for a given flight
[ { "docid": "3f4d884e9124fbfa2435fca075ef27ae", "score": "0.74836814", "text": "def best_swap_for_flight(flight_1)\n swaps = swaps_for_flight(flight_1)\n do_swap!(flight_1,swaps.last.last) if swaps\n end", "title": "" } ]
[ { "docid": "7908ee88626a88d98877ddb63ad90b97", "score": "0.6705076", "text": "def full_swap_pass\n @swap_counter = 0\n @flights.each do |flight|\n best_swap_for_flight(flight)\n end\n return @swap_counter\n end", "title": "" }, { "docid": "87833f0a518ef221cb9f899b00a45f6e",...
d371fa9e1e21e144d3c911ee5fea8c63
POST /caravan_model_sections POST /caravan_model_sections.xml
[ { "docid": "00c401094cf7a5319a8fe8d69a69bf99", "score": "0.68678063", "text": "def create\n @caravan_model_section = CaravanModelSection.new(params[:caravan_model_section])\n\n respond_to do |format|\n if @caravan_model_section.save\n format.html { redirect_to(@caravan_model_section, :...
[ { "docid": "1480391a290bf8ee2e840d60d91ee18d", "score": "0.6413142", "text": "def create\n @caravan_make_section = CaravanMakeSection.new(params[:caravan_make_section])\n\n respond_to do |format|\n if @caravan_make_section.save\n format.html { redirect_to(@caravan_make_section, :notice...
1612f6c7926b8703dace6a9c8aa4ff78
POST /swproducts POST /swproducts.xml
[ { "docid": "ee0725d7f4cc660efd5654473df8f566", "score": "0.6447693", "text": "def create\n @swproduct = @swlist_whitelist.swproducts.new(params[:swproduct])\n @license_types ||= Swproduct.license_types.invert\n @tier_choices ||= Swproduct.tier_choices\n\n respond_to do |format|\n if @sw...
[ { "docid": "2e645fb55ecab46c6f3e0c5eda18a29b", "score": "0.63414174", "text": "def create(product_params)\n @client.post(\"/#{@model}\", product_params)\n end", "title": "" }, { "docid": "605022df667cde5b7c426c74e2b75c18", "score": "0.61960995", "text": "def create\n @serv...
bf77c31105d2d0041de7ef004f1bc882
def trouble(arr, t) i = 0 while i < arr.length 1 do starting_arr_length = arr.length (arr[i] + arr[i + 1]) == t ? arr.delete_at(i + 1) : arr arr.length < starting_arr_length ? i : i += 1 end arr end 2
[ { "docid": "e0eb728d79cad41b1daa6982b95e224b", "score": "0.89168966", "text": "def trouble(arr, t)\n loop do\n index = arr.each_cons(2).find_index { |a,b| a + b == t }\n break unless index\n\n arr.delete_at(index + 1)\n end\n\n arr\nend", "title": "" } ]
[ { "docid": "9a9b4511d91cdecfb6cb6dac82c6ff69", "score": "0.7069774", "text": "def every_other(arr)\n counter = 0\n x = 1\n while counter != arr.length do\n arr.delete_at(x)\n counter += 1\n x += 1\n end\n p arr\nend", "title": "" }, { "docid": "df6e7df0efc1dc744fd4d...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "31d5f63b73fcca71a389a4e8a87ad045", "score": "0.0", "text": "def circul_params\n params.require(:circul).permit(:name, :father_circul_id, :friend_ids => [])\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...
a20a3b096e804cc4b2d2080752ceb83a
GET /translation_lines GET /translation_lines.json
[ { "docid": "4add8a195060105b033c1649084faf01", "score": "0.75451267", "text": "def index\n @translation_lines = TranslationLine.all\n end", "title": "" } ]
[ { "docid": "0f67aacf9fd524a6a78559ebed74bca0", "score": "0.6934957", "text": "def show\n @translated_line = TranslatedLine.new\n @translated_lines = TranslatedLine.where(translation_code: @translation_line.translation_code)\n end", "title": "" }, { "docid": "2dc0824693eb9e771c714eb79f...
a3d824e2e3740b68f260e50346e212ab
Searches all source indexes. See Gem::SourceIndexsearch for details on +pattern+ and +platform_only+. If +all+ is set to true, the full index will be loaded before searching.
[ { "docid": "4679700adc40072a0afd2dede1410a06", "score": "0.7195681", "text": "def search(pattern, platform_only = false, all = false)\n read_all_cache_data if all\n\n cache_data.map do |source_uri, sic_entry|\n next unless Gem.sources.include? source_uri\n sic_entry.source_index.search p...
[ { "docid": "53f78571ccda566b511382d681b1bd5b", "score": "0.6695697", "text": "def index_all\n ::MojoDNA::Searchable::Ferret::Indexer::index_all( self )\n end", "title": "" }, { "docid": "727af92e56877c136dcbe2dc85108c4e", "score": "0.6661631", "text": "def index_all\n ...
d5501d78136f653d1aa946cbdbdbf18b
me = me other substract other to this this method overwrites the components of this vector
[ { "docid": "103d93afcb0d415b505a8e5072b41893", "score": "0.6546681", "text": "def sub(other)\n @x = @x - other.x\n @y = @y - other.y\n @z = @z - other.z\n self\n end", "title": "" } ]
[ { "docid": "8aec136061acac10041d525ef3195564", "score": "0.7098073", "text": "def -(other_vector)\n Vector.new @x - other_vector.x, @y - other_vector.y\n end", "title": "" }, { "docid": "4d5de25e616f1225630849089b428a2d", "score": "0.70715237", "text": "def -(other)\n @vec...
8d3396e7069a32ddef2858ee33c7da7f
Cut the series down to the requested number of samples using a simple mod & drop function. The time step is not guaranteed to be uniform and is not normalized.
[ { "docid": "510a8439ea1074bbed90e51fa82506dd", "score": "0.4777408", "text": "def resample(series, control, samples)\n each_subseries_in series, control do |name, subseries|\n if samples < subseries.count\n new_subseries = {}\n count = 0\n sample_every = (subseries...
[ { "docid": "a4ff48d211d3f8d891b57543cd43455c", "score": "0.63548404", "text": "def truncate_samples\n @samples.sort!{|a,b| a.duration <=> b.duration}\n @samples.slice!(0..-(max_capacity + 1))\n end", "title": "" }, { "docid": "6f5ae02ef1468afca3a57b63aec0b0f2",...
a82097402241488c6ce139d729dad5d0
GET /favorite_parkings GET /favorite_parkings.json
[ { "docid": "6b099d51cc85cf85d6cef5ef1635879f", "score": "0.7362969", "text": "def index\n @favorite_parkings = FavoriteParking.all\n end", "title": "" } ]
[ { "docid": "0cb15a6190f40b925fb9252d8d089c8e", "score": "0.6954332", "text": "def index\n favorites = Favorite.all\n render json: favorites\n end", "title": "" }, { "docid": "1df00c0cf68853b6150587ff9aed3685", "score": "0.6804031", "text": "def show\n @api_v1_favorite_spots...
6b0b57b3e072f64757257739e1517802
Reverse all words of five more more letters in a string. Return the resulting string, e.g., reverse_five("Looks like my luck has reversed") => "skooL like my luck has desrever")
[ { "docid": "b61c73a999f9fd47fb504760826cdaf4", "score": "0.78503126", "text": "def reverse_five(str)\n\tresult_arr = []\n\tstr.split.each do |word|\n\t\tif word.length > 4\n\t\t\tresult_arr << word.reverse\n\t\telse \n\t\t\tresult_arr << word\n\t\tend \n\tend \n\tresult_arr.join(\" \")\n\n\nend", "t...
[ { "docid": "b39e55e7559877a483749ba9c7e8531e", "score": "0.85785425", "text": "def reverse_words(string)\n array = string.split\n array.each do |e|\n e.reverse! if e.length >= 5\n end\n array.join(' ')\nend", "title": "" }, { "docid": "4351c97aef0c184cb4b3e89147c149e0", "score": "...
660404d30738d4d07250efa30615f737
Expected places for the instances.list to be located at on the machine
[ { "docid": "f8a352d5139406be519ba42d94860e18", "score": "0.66268235", "text": "def local_instances_list_file_locations\n [\n \"#{Base.storage_directory}/#{name}-instances.list\",\n \"#{Base.base_config_directory}/#{name}-instances.list\",\n \"~/.#{name}-instances.list\"...
[ { "docid": "846b0edcd7595732459ad76de020b216", "score": "0.68560344", "text": "def available_instances\n @available_instances ||= {}\n end", "title": "" }, { "docid": "6bde3e6314fcd438626ecea9d7f85ef9", "score": "0.6671466", "text": "def check_missing_instances(instances)\n ...
503688dc82978f838e9bee8661e5cdba
Registers load hooks with `ActiveSupport.on_load`.
[ { "docid": "0909e0f4034711bbd8d58ad96f478e89", "score": "0.0", "text": "def register\n module_pathname_set.each do |module_pathname|\n relative_module_pathname = module_pathname.relative_path_from(root)\n relative_module_path = relative_module_pathname.to_path\n underscored_module_name...
[ { "docid": "300bc5cbe55797a2959d598fefbb10fc", "score": "0.7683611", "text": "def on_load(name, options = {}, &block)\n @loaded[name].each do |base|\n execute_hook(name, base, options, block)\n end\n\n @load_hooks[name] << [block, options]\n end", "title": "" }, { "d...
5e110c079c829f5e76a5be2483b6311e
Get Settings Flow When accessing this endpoint through Ory Kratos&39; Public API you must ensure that either the Ory Kratos Session Cookie or the Ory Kratos Session Token are set. The public endpoint does not return 404 status codes but instead 403 or 500 to improve data privacy. You can access this endpoint without cr...
[ { "docid": "5b2eb55742de6e7e3359289059c563fc", "score": "0.5560314", "text": "def get_self_service_settings_flow_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AdminApi.get_self_service_settings_flow ...'\n end\n # ve...
[ { "docid": "2cbfc0f93bbb3262c2b1b6c41bdeffa4", "score": "0.74752367", "text": "def get_settings\n get_uri = @data['uri'] + '/settings'\n response = @client.rest_get(get_uri, {}, @api_version)\n @client.response_handler(response)\n end", "title": "" }, { "docid": "c5...
ea7e7a583f03b6c6cbf70cfbb8b4b09c
Grants a privilege to a channel member, such as voicing a member. The stem must have the required privilege level to perform this command. +privilege+ can either be a symbol from the Daemon instance or a string with the letter code for the privilege. grant_user_privilege 'mychannel', 'Somedude', :operator grant_user_pr...
[ { "docid": "d59ff92d7b8921576b6ccbdd8e087bc3", "score": "0.7404318", "text": "def grant_user_privilege(channel, nick, privilege)\n channel = normalized_channel_name(channel)\n privcode = server_type.privilege.key(privilege).chr if server_type.privilege.value? privilege\n privcode ||= priv...
[ { "docid": "e6eb84154a2ffde3f61660bb7073032e", "score": "0.6631125", "text": "def someone_did_gain_privilege(stem, channel, nick, privilege, bestower)\n end", "title": "" }, { "docid": "b2f22795acefca7e3e677a1d5de6f7f4", "score": "0.645156", "text": "def privilege(channel, user)\n...
d0565ebdc8fbf264047b610f39886bb5
Writer for happiness where happiness can only be between 0 and 10
[ { "docid": "7916465d16b95598d51385486146fde3", "score": "0.6623815", "text": "def happiness=(happiness)\n if happiness < 0\n @happiness = 0\n elsif happiness > 10\n @happiness = 10\n else\n @happiness = happiness\n end\n end", "title": ...
[ { "docid": "c6e810b962709c80fe7ca55e382b9a7b", "score": "0.6710972", "text": "def happiness=(number)\n @happiness = number\n if @happiness > 10\n @happiness = 10\n elsif @happiness < 0\n @happiness = 0\n end\n @happiness\n end", "title": "" }, { "docid": "06bedaf78e...
18c03341994c4b5416c19860a6c8eec9
Performs the differential of exponential ``` d(exp(x)) exp(x) = dx d(x)/dx ``` argument: variable according to the differential must be done returns: result of the operation.
[ { "docid": "c16d4ef1f67fb6d047fda7334334f707", "score": "0.0", "text": "def diff(var)\n s = self.clone\n s.top = true\n return s * self.arg.diff(var)\n end", "title": "" } ]
[ { "docid": "6b71f0d26c7c7671b80af8dab8d3acd3", "score": "0.6003392", "text": "def exponential(value1)\n result = Math.exp(value1)\n puts \"The result is #{ result }\"\nend", "title": "" }, { "docid": "3f64563f34fd108c2de405446754f986", "score": "0.5843559", "text": "def derivative(...
a572d164b5fcce1759738964fa25717a
deprecated since version 2.2. Will be deleted in version 3.0.
[ { "docid": "52a8dd6c2622ff933714ca35ca53d43d", "score": "0.0", "text": "def detect_human(params: {}, timeout: Relay::DEFAULT_CALL_TIMEOUT)\n detect = {\n type: Relay::CallDetectType::MACHINE,\n params: params\n }\n component = Signalwire::Relay::Calling::Detect.new(call: sel...
[ { "docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1", "score": "0.7584326", "text": "def private; end", "title": "" }, { "docid": "6a6ed5368f43a25fb9264e65117fa7d1", "score": "0.63925743", "text": "def internal; end", "title": "" }, { "docid": "530e65cba197567f73b8125444ac33cc",...
dfa30e58b17f4dbcb5fc2ea736092b30
GET /tents/1 GET /tents/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "248ab1123a630e4dba35e7108303b425", "score": "0.625396", "text": "def index\n @tents = Tent.all.order(updated_at: :desc)\n end", "title": "" }, { "docid": "9bf8cdad046f3c0e43b311a401434c71", "score": "0.6145203", "text": "def show\n @tenure = Tenure.find(params[:id]...
b5a51b8555b79873172f10f572373cf3
convert a single character to a virtual keycode
[ { "docid": "9ef008775ca0be7ddefbfb693600ca22", "score": "0.8629052", "text": "def char_to_virtual_keycode(char)\n\n unless char.size == 1\n raise \"virtual keycode conversion is for single characters only\"\n end\n\n code = char.unpack('U')[0]\n\n case char\n when '0'.....
[ { "docid": "481fbe92ace9aadaea82f8da7db235d3", "score": "0.7216346", "text": "def get_key\n char = get_char\n\n if char == \"\\e\"\n a = get_char \n b = get_char \n c = b =~ /[0-9]/ ? get_char : \"\"\n\n char = char + a + b + c\n end\n\n ...
7a6f8cf045afb655a62469361a66a4c5
GET /tourneys GET /tourneys.json
[ { "docid": "1379c9ad4d29cf3951df8f55095adfb4", "score": "0.6420791", "text": "def index\n puts \"current_user: #{current_user.inspect}\"\n @curr_user = current_user\n @tourneys = Tourney.all\n end", "title": "" } ]
[ { "docid": "4c50510d14d227a20f13fd8d61bbab92", "score": "0.7415334", "text": "def index\n journeys = current_user.journeys\n render json: journeys, adapter: :json\n end", "title": "" }, { "docid": "7e930bd25c6163cb94a265fb6adda50e", "score": "0.73268014", "text": "def journeys...
099ba26e843210f1820618f1660b0460
Set attachment attributes from the direct upload
[ { "docid": "2ddc21e6c0c3992818198a73cf071586", "score": "0.0", "text": "def set_page_attributes\n PictureProcessor.new(self).set_page_attributes\n end", "title": "" } ]
[ { "docid": "c52059f53d61540c1b00a56fa14c7314", "score": "0.7718947", "text": "def set_upload_attributes\n set_upload_attributes_with_block do |type, direct_upload_url_data, direct_upload_head|\n case(type)\n when :pdf\n self.pdf_file_name = direct_upload_url_data[:filename]\n...
f3b25392029bca4b322ef640c9d1b3df
POST /weight_logs POST /weight_logs.json
[ { "docid": "5a2446cd4992eb9997922eb159668642", "score": "0.74085504", "text": "def create\n @weight_log = WeightLog.new(params[:weight_log])\n\n respond_to do |format|\n if @weight_log.save\n format.html { redirect_to @weight_log, notice: 'Weight log was successfully created.' }\n ...
[ { "docid": "66a28e97a591793508b00ce5fcb134d6", "score": "0.6899803", "text": "def log_weight(weight, date, time = nil, options = {})\n params = key_value_date_time_params('weight', weight, date, time)\n post_json(path_user_version('/body/log/weight', options), params)\n end", "tit...
63a9039c116ff87b5f75e867d1a1a784
GET /projects/new GET /projects/new.json
[ { "docid": "a6243b19cd4a151de44d7047e2a19556", "score": "0.0", "text": "def new\n @project = current_user.object.projects.new\n @project.pictures.build \n @project.tags.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n e...
[ { "docid": "418912bb7d0ea9eac7e1b03b9b51de2d", "score": "0.84909844", "text": "def new\n @root = \"projects\"\n @branch = \"new\"\n \n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "ti...
435a8319b3b671cf297123ba3d077556
GET /elements/1 GET /elements/1.json
[ { "docid": "695d78b68dc5105e6dda8d02f34fc19a", "score": "0.69424504", "text": "def show\n @element = Element.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @element }\n end\n end", "title": "" } ]
[ { "docid": "2309072c73cadd71b5b5f1a69f1dddb8", "score": "0.7135799", "text": "def element(id, params = {})\n get \"elements/#{id}\", {query: params}\n end", "title": "" }, { "docid": "0bbff8c00d4258cf480f50bded5861e8", "score": "0.6401687", "text": "def show\n @element...
58422f42f621f1a34b94fc2307022525
Optional. eg. `confirmation_url` Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.custom_mailer.reset_password_instructions.subject
[ { "docid": "f33e3afb827eff9548deb46864e0667c", "score": "0.6686039", "text": "def reset_password_instructions(record, token, opts={})\n @token = token\n super\n #devise_mail(record, :reset_password_instructions, opts)\n end", "title": "" } ]
[ { "docid": "7061a04e0a270051526efc8d5aac09d7", "score": "0.7602196", "text": "def password_reset_instructions(user) \n subject I18n.t(\"email.pw_reset\") \n from I18n.t(\"email.admin_email\") \n recipients user.email \n sent_on Time.now \n body :edit_...
f90a729eb3e658422bf5804061528f64
POST /coords POST /coords.json
[ { "docid": "f1cd2e33727452388bac1506e3ebdf26", "score": "0.5978385", "text": "def create\n @coord = @member.build_coord(coord_params)\n \n respond_to do |format|\n if @coord.save\n format.html { redirect_to new_member_adhesion_url(@member), notice: 'Coordonnées enregistrées' }...
[ { "docid": "210a79b27d8645756166915e3aa18822", "score": "0.7171391", "text": "def coordinates\n location = Location.new(location_params)\n if location.save\n render json: location\n else\n render json: \"ERROR\"\n end\n end", "title": "" }, { "docid": "ab83b76843662c28...
a1b0fcd981c5f5bbb9fa2506e4d4d943
Only allows one substitution per page
[ { "docid": "6272179c1c6df940c6b33fd80b4d5fd1", "score": "0.46312028", "text": "def subs!(pattern, replacement)\n sub!(pattern, replacement)\n self\n end", "title": "" } ]
[ { "docid": "d45965a4de4ba96a47048f09657cb4e4", "score": "0.5527574", "text": "def match_unsolved\n glossary = Glossary.find(params[:id])\n render :update do |page|\n page.replace_html(\"unmatched_#{glossary.id}\", :partial => \"/glossary/editor\", :locals => { :glossary => glossary })\n en...
7fdc85cbb78e30537510229a72db5a01
the difference between two images
[ { "docid": "a8db2adb283d5da16ec5ed75f4ec3ae8", "score": "0.6629941", "text": "def -(a_pixmap)\n if @width != a_pixmap.width or @height != a_pixmap.height\n raise ArgumentError, \"can't compare images with different sizes\"\n end\n sum = 0\n each_pixel {|x,y| sum += self[x,y] -...
[ { "docid": "23d8376bc6ee44817a6c0026f16b3155", "score": "0.78816026", "text": "def difference\n img1 = Magick::ImageList.new(@img_path1)\n img2 = Magick::ImageList.new(@img_path2)\n diff = nil\n comptime = Benchmark.realtime{\n diff = img1.difference(img2.scale(img1.columns, img1.rows))...
3777de96ddb4ea5231538fd4fd3dfe49
GET /kuaibovideos/new GET /kuaibovideos/new.json
[ { "docid": "2d97ebf68394de7e0825ae041c5e7328", "score": "0.78048444", "text": "def new\n @kuaibovideo = Kuaibovideo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kuaibovideo }\n end\n end", "title": "" } ]
[ { "docid": "3be03a7007b15886f3d2016144ae400d", "score": "0.7845221", "text": "def new\n \n @video = Video.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "title": "" }, { "docid": "9abe6d5da0097a6822d...
29d986d5a1b9eb599b7c07986cf51dfe
Set the duration for the next play sound duration: :loop, :async
[ { "docid": "0e68936be96764ed5d351543537d23b5", "score": "0.71001446", "text": "def set_duration(type, duration)\r\n if $g_os_type == :win32_system\r\n @duration_win[type] = Sound::ASYNC\r\n if duration == :loop\r\n @duration_win[type] = Sound::ASYNC|Sound::LOOP\r\n end\r\n en...
[ { "docid": "97498c7e14c63d8e74636b53253f3c1e", "score": "0.73140246", "text": "def play(*args)\n sleep(duration)\n end", "title": "" }, { "docid": "d0aa580dbf89621a19a2ed030edc494d", "score": "0.6392127", "text": "def play\n @sound += 1\n @sound %= @overlap\n ...
95ec54ed7cc59611f8cec3a69a743c04
POST /appjayans POST /appjayans.json
[ { "docid": "2cb5c4e087ef30e933ef08c0b26904ff", "score": "0.65152735", "text": "def create\n @appjayan = Appjayan.new(appjayan_params)\n\n respond_to do |format|\n if @appjayan.save\n format.html { redirect_to @appjayan, notice: 'Appjayan was successfully created.' }\n format.jso...
[ { "docid": "8047b42db62c6e41a28dde569f408a0b", "score": "0.66708195", "text": "def create\n megam_rest.post_appdefn(to_hash)\n end", "title": "" }, { "docid": "f6e5c183741ed8756e21af93a31fdfc7", "score": "0.6460547", "text": "def create\n @app = App.new(app_params)\n\n ...
ef533efc68e037266d9fc4fe15340088
returns an array of delicious posts, newer posts first
[ { "docid": "0e65b54ce58e3a72a9f1b297158b8250", "score": "0.0", "text": "def fetch_entries\n logger.info \"#{SERVICE_NAME}: Fetching the most recent photos by #{self.flickr_user_name}\"\n photo_entries = []\n doc = Hpricot.XML(open(\"http://api.flickr.com/services/feeds/photos_public.gne?id=#{se...
[ { "docid": "2fb7d2dfb392e3d112eea0c34c06c2b6", "score": "0.7497688", "text": "def posts\n Post.all(self).sort_by { |entry| entry.created }.reverse\n end", "title": "" }, { "docid": "90bd4ebf8bc837a581c3ae69396f43b8", "score": "0.738071", "text": "def prepare_posts\n posts = []...
200bb41ae6113894ebace17e9174ace2
automatically decode JSON messages to Hash and perform logging when active
[ { "docid": "40b8fd943ff79be6e5815841a17d5397", "score": "0.5569666", "text": "def onmessage(&block)\n super( &proc do |msg|\n msg = JSON.parse(msg)\n Hammer.logger.debug \"Websocket recieved: #{msg}\" if config[:logger][:show_traffic]\n block.call msg\n end)\n e...
[ { "docid": "c03a58e1a887f6a1501116193159bce2", "score": "0.6668997", "text": "def process\n data = JSON.parse(@message)\n Log.info data.ai\n end", "title": "" }, { "docid": "9c0544d7de81673d9729fa40272f6886", "score": "0.6410292", "text": "def legacy_parse(json, &block)\n ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "c203bb2cabc491f8bee7190d7a39bb55", "score": "0.0", "text": "def link_params\n params.require(:link).permit(:slug, :destination, :count)\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...
6bda81c60db16ead4947aed0ecfc16fe
Add xmlenc padding as specified in the xmlenc spec.
[ { "docid": "f3e4dd658a8c28d5b89a6c8663ef58b4", "score": "0.6981494", "text": "def add_xmlenc_padding(block_size, unpadded_string)\n data = unpadded_string.dup\n raise \"block size #{block_size} must be > 0.\" if block_size <= 0\n\n padding_length = (block_size - data.length % block_...
[ { "docid": "948efa98e60a4a3bcaeab812fba57ac6", "score": "0.6450688", "text": "def with_padding; end", "title": "" }, { "docid": "36369dbfbb5e7e70c9b6ed8df0ee6c29", "score": "0.62447274", "text": "def padding; end", "title": "" }, { "docid": "92a170970af20be9aa36c9041dfa25...
aade8cffd096a701ac6b923ae1c5bc3b
POST /broker_profiles POST /broker_profiles.json
[ { "docid": "7a83252c735d1dcb3793275bf42ae36a", "score": "0.72764975", "text": "def create\n @broker_profile = BrokerProfile.new(broker_profile_params)\n\n respond_to do |format|\n if @broker_profile.save\n format.html { redirect_to @broker_profile, notice: 'Broker profile was successfu...
[ { "docid": "e3219edfc0f016c8582d1bd5bc3be716", "score": "0.6339636", "text": "def set_broker_profile\n @broker_profile = BrokerProfile.find(params[:id])\n end", "title": "" }, { "docid": "19d82a63ee9216c8810ae9b3d86e0ca3", "score": "0.6155356", "text": "def broker_profile_par...
dce2c4b443dd2caa63d528921d544ee6
:startdoc: Returns an Array of String corresponding to the Device extensions
[ { "docid": "5a568acc90dcec34855bbbf395b433d0", "score": "0.802887", "text": "def extensions\n extensions_size = FFI::MemoryPointer::new( :size_t )\n error = OpenCL.clGetDeviceInfo( self, EXTENSIONS, 0, nil, extensions_size)\n error_check(error)\n ext = FFI::MemoryPointer::new( extens...
[ { "docid": "1b291a023f94af230c2e586997964c7c", "score": "0.8095666", "text": "def extensions\n extensions_size = MemoryPointer::new( :size_t )\n error = OpenCL.clGetDeviceInfo( self, EXTENSIONS, 0, nil, extensions_size)\n error_check(error)\n ext = MemoryPointer::new( extensions_size...
27417c6ddc643f1052f613384aa8f780
Returns the HTML element containing the value for the field specified by +field+.
[ { "docid": "afc2889128b2c74e9a660aa08ab00c56", "score": "0.5937911", "text": "def formatted(field, wrap_in = :span)\n value = value_for(field)\n options = @options[field]\n\n if value.blank?\n # If the field is blank, we want to return _unless_ the field is the\n #...
[ { "docid": "ad14e9b8a26fcc76080f5ca6f70deee0", "score": "0.6625593", "text": "def value_for(field)\n value = instance_variable_get(:\"@#{field}\")\n value.nil? ? nil : value.to_s\n end", "title": "" }, { "docid": "b3f9395ecb7e08fdfad831c43da2e3f4", "score": "0.6581022"...
21b810858a510d923205e1ff9bcfa6b5
GET /bookings GET /bookings.json
[ { "docid": "b347080fcec135abb3e8605d2dd15615", "score": "0.73217666", "text": "def index\n @bookings = Booking.order(updated_at: :desc).page(params[:page]).per(NUM_PER_PAGE)\n end", "title": "" } ]
[ { "docid": "ac8355d07e1353ac36659b08db8f2002", "score": "0.8231102", "text": "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "title": "" }, { "docid": "b5050fec6bce05bf345e907c218e23af", "score": "0.80365145", "text": "def index\n @bookings = Booking...
4dffb8e43d434dc361faa156ef623a6f
DELETE /condolences/1 DELETE /condolences/1.json
[ { "docid": "3ccb14f9cb9bc4ce93f29e21825ae4c5", "score": "0.6454658", "text": "def destroy\n @condolence = Condolence.find(params[:id])\n @condolence.destroy\n @orbituarysite = @condolence.orbituarysite\n\n respond_to do |format|\n format.html { redirect_to @orbituarysite }\n format...
[ { "docid": "25766d4c4a8af413ec52707c6a170c66", "score": "0.6651211", "text": "def destroy\n @clinical_course = ClinicalCourse.find(params[:id])\n @clinical_course.destroy\n\n respond_to do |format|\n format.html { redirect_to clinical_courses_url }\n format.json { head :no_content }\n...
9048896dcd95ca6ba1bfae3d04f1a659
Returns a list of commits starting from head commit. Options: :path Restrict to path/or paths :max_count Maximum count of commits :skip Skip n commits :start Commit to start from
[ { "docid": "0d0366d7d4ac84d887fa86e385f2bb69", "score": "0.672036", "text": "def log(opts = {})\n max_count = opts[:max_count]\n skip = opts[:skip]\n start = opts[:start]\n raise ArgumentError, \"Invalid commit: #{start}\" if start.to_s =~ /^\\-/\n log = git_log('--pretty=tforma...
[ { "docid": "22fcc243af7871ae71e3b0e5525e7253", "score": "0.7326978", "text": "def commits(start = 'master', max_count = 10, skip = 0)\n self.find_commits(options = {:ref => start, :max_count => max_count, :skip => skip})\n end", "title": "" }, { "docid": "ecac5c75d3e8eb909c9b8198...
9bd2786258099961dccd9e04071fd174
GET /articles GET /articles.json
[ { "docid": "70772a82d87c17eefba16f6bbe932aba", "score": "0.70509905", "text": "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html\n end\n end", "title": "" } ]
[ { "docid": "19a11bbe551c564fa7cca7d31c8cbc3f", "score": "0.8121748", "text": "def show\n @articles = Article.find(params[:id])\n render json: @articles\n end", "title": "" }, { "docid": "d3f6690e96780612b04d7c8ac2519fb1", "score": "0.7839019", "text": "def index\n @articl...
fdc4faaff971857c0446cd4d9e3997b6
retrieve the object when checking student program constraints
[ { "docid": "5ec80a526a1c80e582cb15077ac9164d", "score": "0.5321256", "text": "def get_p_module_object(mandatory)\n\t\tp_module = ConstraintsChecker::Entities::PModule.new(id: self.id, name: self.name)\n\t\tp_module.add_constraint(ConstraintsChecker::Constraints::Min.new(p_module, self.min))\n\t\tp_modul...
[ { "docid": "099814aa03a4719ff5859c7aa36325fe", "score": "0.5689623", "text": "def lower_bounds_constraint\n self.students.each do |student|\n self.sections.each do |section|\n self.problem[ VAR_f(student.id, section.id) - self.lower_fte_bound * VAR_b(student.id, section.id, \"bool\") >= 0...
036636d9aceb02250672a4bbb7769017
Assert and wait for the element with id next sibling is the element with id expected_sibling_id.
[ { "docid": "70c4699b5fd80c0372ac2a915f01c9bf", "score": "0.91061807", "text": "def assert_next_sibling(id, expected_sibling_id)\n wait_for(:message => \"id '#{id}' should be next to '#{expected_sibling_id}'\") do\n actual_sibling_id = get_eval(\"this.page().findElement('#{id}').nextSibling.i...
[ { "docid": "644ab283e73dca87a8123389fcd6975f", "score": "0.6754925", "text": "def test_next_sibling\n setup_test_tree\n\n assert_nil(@root.next_sibling, \"Root does not have any next sibling\")\n assert_equal(@child2, @child1.next_sibling, \"Child1's next sibling is Child2\")\n asser...
7bd9d9cdbf07e3775b7ff755248264fb
GET /list POST /list
[ { "docid": "d092807abfab611a1de6f57d807dd1d2", "score": "0.0", "text": "def list\n if !current_user.is_admin?\n render 'shared/forbidden'\n return\n end\n\n @list_title = \"SIMPD Complete List\"\n @list_type = 'complete'\n @fields = params[:fields]\n if !@fields\n @field...
[ { "docid": "0f72eed0e360095f061d4e75f898ced5", "score": "0.7699616", "text": "def list(*args)\n fail \"Unacceptable HTTP Method #{request.env['REQUEST_METHOD']} for list\" unless request.get?\n {:action => 'list',\n :args => args}\n end", "title": "" }, { "docid": "769a6e0ea07292c...
1e4ad4d1e85ef971bf5f65dcd10fcc37
POST /cart_items POST /cart_items.json
[ { "docid": "2fcf5d3ca0d8c6b1cb1dfc2ff67f0ff2", "score": "0.71958566", "text": "def create\n @cart_item = CartItem.new(cart_item_params)\n\n respond_to do |format|\n if @cart_item.save\n format.html { redirect_to @cart_item, notice: 'Cart item was successfully created.' }\n forma...
[ { "docid": "50d5a8baea8a271aed88483ae1d8a08e", "score": "0.7788001", "text": "def create\n @cart_item = CartItem.new(cart_item_params)\n\n if @cart_item.save\n render json: @cart_item, status: :created, location: @cart_item\n else\n render json: @cart_item.errors, status: :unprocessab...
2ff6eab52fb0a27bb2307ea83ab8ff20
return boolean to represent whether the deliverable has effort logs
[ { "docid": "f819c406f862bcb90d2e77916ae9c51f", "score": "0.83149356", "text": "def has_effort_log?\n if EffortLog.find_by_project_phase_deliverable_id(self.id) then\n return true\n end\n return false\n end", "title": "" } ]
[ { "docid": "c0fa5de5ffc83cc005efc2c121d9853f", "score": "0.663891", "text": "def condense_logs?\n @condense_logs ||= false\n end", "title": "" }, { "docid": "f3b3fe2e5fdcd67300c45bc0cd8a4030", "score": "0.66134197", "text": "def emailed_recently\n return false if self.effo...
42e5e784864c6c6f3243c51215776902
List of configured servers
[ { "docid": "874eb7306de145f5d1145d0697fe6608", "score": "0.82107997", "text": "def servers\n @servers ||= []\n end", "title": "" } ]
[ { "docid": "dea5d247074ba4eb0b2acc1a55086891", "score": "0.84786433", "text": "def list_known_servers\n connect.servers.all\n end", "title": "" }, { "docid": "dea5d247074ba4eb0b2acc1a55086891", "score": "0.84786433", "text": "def list_known_servers\n conn...