query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
7a9d4e38d366123bfab85c96b93ff5ba
DELETE /facts/1 DELETE /facts/1.xml
[ { "docid": "de58440547f69126f011c58add922f95", "score": "0.64691776", "text": "def destroy\n @fact = Fact.find(params[:id])\n @informable = @fact.informable\n @fact.destroy\n\n respond_to do |format|\n format.html { redirect_to(@informable) }\n format.xml { head :ok }\n end\n ...
[ { "docid": "80f1b33d12efeb0e91eb1d91c649e41b", "score": "0.7116206", "text": "def destroy\n @fact = Fact.find(params[:id])\n @fact.destroy\n\n respond_to do |format|\n format.html { redirect_to(facts_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "doc...
f9b3e35d301c0179bd8601de922f368b
Called when a resource has no converge actions, e.g., it was already correct.
[ { "docid": "fb78ae71c56a747157691eb5e721e144", "score": "0.48798084", "text": "def resource_up_to_date(resource, action)\n # Output should be green\n resource_exec_time = Time.now.to_f - @resource_start_time\n puts(\" * #{resource} action #{action} (#{resource_exec_time.round(3)} s...
[ { "docid": "a7ef0f7eec8429f12ec1ed66380a3c63", "score": "0.676137", "text": "def converge_complete\n detect_unprocessed_resources\n end", "title": "" }, { "docid": "026651ed3b6abd81d1d7b403e766547a", "score": "0.64952666", "text": "def converge_complete\n end", "...
8c7042b2f4e6282f9590482571704484
and the same integer values in the same exact order
[ { "docid": "c5424c2252c3fc34a2e7b6b471c2c13e", "score": "0.0", "text": "def array_equals(array1, array2)\n if array1 == nil && array2 == nil # if both are nil\n return true # two nil arrays have the same length and elements\n elsif array1 == nil || array2 == nil # if just one is nil\n return fal...
[ { "docid": "88870e9992037187ecfa9429a6f09388", "score": "0.6013414", "text": "def unique(integers)\r\n\r\n end", "title": "" }, { "docid": "1715dc8be28d342ba2d4d377bd2731b9", "score": "0.58626604", "text": "def same_values?(x,y)\n\t\t@bt[x,y] == @bt[x+1,y] and @bt[x,y] == @bt[x,y+1]...
8875ccba81ed1c6dacf6daa9a15797d1
the func titleize is usable with rails below is a manual version
[ { "docid": "14b276e5a6277e99738b1ff85dbaf74c", "score": "0.0", "text": "def titleize(my_string)\n stop_list = ['and', 'the', 'or', 'with', 'of', 'from', 'in', 'on', 'by', 'out']\n return my_string.split(\" \").each_with_index.map{|x, i|\n if i == 0\n x.capitalize\n elsif stop_list.include?(...
[ { "docid": "8410bc8e61384f2eae3332615425c389", "score": "0.88944966", "text": "def titleize!\n replace(titleize)\n end", "title": "" }, { "docid": "a27dfdd4d863f3c515d06496fb563cd5", "score": "0.8717768", "text": "def titleize(title)\nend", "title": "" }, { "docid...
2aa1b37479784b9727aa38aa97c5c8dd
DELETE /paragraph_ratings/1 DELETE /paragraph_ratings/1.json
[ { "docid": "475b3a1d7e374cd232a67ab913b31677", "score": "0.77042425", "text": "def destroy\n @paragraph_rating = ParagraphRating.find(params[:id])\n @paragraph_rating.destroy\n\n respond_to do |format|\n format.html { redirect_to paragraph_ratings_url }\n format.json { head :no_conten...
[ { "docid": "7a9ef9cf9c1bb6f0dc1d92d5884cf002", "score": "0.67461467", "text": "def destroy\n @rating.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "05add13afb323f23de9735ba453188e7", "score": "0.6719796", "t...
8004ce6ade8f6698cd6db9fc4be21c4a
:type other: List a :rtype: Boolean
[ { "docid": "0b309b4524a47d2026eb67b7e4983a2b", "score": "0.0", "text": "def ==(other)\n match.(\n -> a {\n other.match.(-> a { true }, -> a { false }),\n }\n -> a {\n other.match.(\n -> b { false },\n -> (b) { a == b }\n )\n }\n )\n end",...
[ { "docid": "a4536cb52ed520ba6a6b385e05c08030", "score": "0.71393216", "text": "def is_included_by? other\n return false if self.count > other.count\n return true if self.eql? other\n return other.drop(other.count - self.count).to_a.eql? self.to_a\n end", "title": "" }, { "docid": "...
1d90ba5e6477784b89db92627d2d1dd6
This should return the minimal set of attributes required to create a valid Comment. As you add validations to Comment, be sure to update the return value of this method accordingly.
[ { "docid": "d1ce5958bb8a2a27b15ce0400625ae5c", "score": "0.6234679", "text": "def valid_attributes\n { comment: \"hi\"}\n end", "title": "" } ]
[ { "docid": "2063a4e6a5a7ad9bfcbc4a10f51e9b74", "score": "0.6655565", "text": "def valid_attributes\n { :title => 'title',\n :comment => 'some comments',\n :commentable_id => 1\n }\n end", "title": "" }, { "docid": "e62720e6062b80b81c8b64d93a5a2088", "score": "0.66519445"...
29e7fe057f08066724e10b56382d3d00
find lowest cost path, negative costs allowed
[ { "docid": "2ef7e18d20994b2f6b2446451807a8ef", "score": "0.0", "text": "def bellmanford start, cost, &goal\n end", "title": "" } ]
[ { "docid": "a4e6a7f4538958a14e6723ba6dad4d2b", "score": "0.7825105", "text": "def select_possible_path(possible_paths)\n vertex, data = possible_paths.min_by do |(vertex, data)|\n data[:cost]\n end\n\n vertex\nend", "title": "" }, { "docid": "a4e6a7f4538958a14e6723ba6dad4d2b", "sco...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "089d9b368dc9d759a5b7ddfdeac61b87", "score": "0.0", "text": "def set_amenity\n @amenity = Amenity.where(id: params[:id], property_id: params[:property_id]).first\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60326946", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6015941", "text": "de...
3872741c01f7df7a9b869d1b2c956dd9
parse command line arguments
[ { "docid": "b891b8eb73471042b2ad8f9412707419", "score": "0.6655858", "text": "def parse_arguments\n @cmd_line_arguments = {}\n\n @options = OptionParser.new do |opt|\n opt.on('-C', '--change-dir DIR', 'Change working directory to DIR') do |directory|\n @cmd_line_arguments[:work...
[ { "docid": "1e211a00cdbb0a010283db89ac3cc687", "score": "0.7401021", "text": "def parse_command_line args\n args.options do |opt|\n opt.on(\"rutema v#{Version::STRING}\")\n opt.on(\"Options:\")\n opt.on(\"--config FILE\", \"-c FILE\",String,\"Loads the configuration from FILE\"...
7e21f2d22c4a02bcebc5602b137eb28f
Q1: mystery5('hi') => '' Q1: mystery5('') => '' Q1: mystery5('Hi, there!') => '' Time Complexity: 0(s.length) Space Complexity: O(s.length) return '' + mystery5(s[1..1]) if s[0] is a letter
[ { "docid": "f1bd31cd714b05defaa6213ca5d5dc33", "score": "0.7449225", "text": "def mystery6(s)\n if s == nil || s.length == 0\n return \"\"\n else\n space = 0\n until space >= s.length || s[space] == \" \"\n space += 1\n end\n return mystery6(s[(space+1)..-1]) + \" \" + s[0...space]...
[ { "docid": "932f9da0facaf92d868ab8b36525f821", "score": "0.8012599", "text": "def mystery5(s)\n if s.length == 0\n return \"\"\n else\n return \"*\" + mystery5(s[1..-1])\n end\nend", "title": "" }, { "docid": "932f9da0facaf92d868ab8b36525f821", "score": "0.8012599", "text": ...
36a5cfb873957f520cdadf989c1ba876
POST /incomes POST /incomes.json
[ { "docid": "ab4d90db564805c4b208bf19ddd4cab6", "score": "0.66719234", "text": "def create\n #@income = Income.new(income_params)\n @income = current_user.incomes.build(income_params)\n\n respond_to do |format|\n if @income.save\n format.html { redirect_to incomes_path, notice: 'Inco...
[ { "docid": "c8ee9bdfa34c3ee202d51d1cad0968d9", "score": "0.7126155", "text": "def create\n\n @income = Income.new(params[:income])\n @income.budget = current_budget\n @income.generate_periods = true\n\n if @income.save\n render :json => @income.to_json(:include => :income_values), statu...
8032e178d0c7db66a85e8bc6f91fc0eb
GET /lexicons/1 GET /lexicons/1.json
[ { "docid": "5eda39361c538fbf81594ecaef781e29", "score": "0.685289", "text": "def show\n language = params[:id][0].capitalize\n number = params[:id][1..-1].to_i\n @lexicon = Lexicon.find_by_code(\"#{language}#{number}\")\n\n respond_to do |format|\n format.html # show.html.erb\n for...
[ { "docid": "2406145952c011c612d770fa153bc310", "score": "0.6757075", "text": "def new\n @lexicon = Lexicon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lexicon }\n end\n end", "title": "" }, { "docid": "6bd74d6eb3eb7646cfe66112...
72d5c10967f547da98a7aa50d87f6204
convert original transaction data to one with indexed item
[ { "docid": "9e32e03aeabd37468cc50b830f7e72c7", "score": "0.0", "text": "def convTra(ifile,idxObj,index,convTraFile)\n\ttemp=MCMD::Mtemp.new\n\txxmf=temp.file\n\tidxObj.writeAlphaIndex(index,xxmf)\n\tf=\"\"\n\tf << \"mjoin k=item K=alphabet m=#{xxmf} f=index i=#{ifile} |\"\n\tf << \"mcut f=tid,time,index...
[ { "docid": "ffbb541b7f24cc55df563139252ca7e9", "score": "0.6122215", "text": "def item\n return @data && index >= 0 ? @data[index] : nil unless @category == :transaction\n return transaction_entry(index)\n end", "title": "" }, { "docid": "c9cf91eb863d3e640b25a4aaf63b0b75", "score"...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "971467bb0beda5a46cb086ffe355edb3", "score": "0.0", "text": "def set_car\n @car = Car.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...
373f5ed93b1ea9c5a148ef801c32f8e4
return html for markdown formatted page content
[ { "docid": "a5e9c2206e01e4d36ae32ffede97577d", "score": "0.6695246", "text": "def content\n\t\treturn Redcarpet.new(parse_links(@content)).to_html\n\tend", "title": "" } ]
[ { "docid": "3fad3dfd1e90cab8744101d84c1d528c", "score": "0.82271236", "text": "def render_md page, content\n markdown(content || self.body) # HACK\n end", "title": "" }, { "docid": "3fad3dfd1e90cab8744101d84c1d528c", "score": "0.82271236", "text": "def render_md page, content\n ...
c4911e182705705d23fe4fe94b07ae82
region is not needed for anything, but we can simulate a "more information required" error by passing region "EX" and postal code "99999". see tried to use `normalize_attributes :attempt, with: :integer`, but it wsan't working for an unknown reason
[ { "docid": "980d9ac459831b983cba4b6243d3b820", "score": "0.0", "text": "def attempt=(value)\n @attempt = value.to_i\n end", "title": "" } ]
[ { "docid": "99459407a85ef5dd8d439b8bdb2aaf0a", "score": "0.5944768", "text": "def youraddress_invalid_fill\n invalid = EnvConfig.data['formsV2_data']['formsV2_invalid']\n giw_invalid_youraddress(invalid['postcode'], invalid['a1'], invalid['a2'], invalid['towncity'])\n end", "title": "" }, ...
de728ae515364865d614b4e8d0c17016
DELETE /competitions/1 DELETE /competitions/1.json
[ { "docid": "433605a78eca7425d983e9ed28957d73", "score": "0.77266276", "text": "def destroy\n @competition = Competition.find(params[:id])\n @competition.destroy\n\n respond_to do |format|\n format.html { redirect_to competitions_url }\n format.json { head :no_content }\n end\n end...
[ { "docid": "a5a988a7e83acda9b9c4dbbcc715cee6", "score": "0.7594703", "text": "def destroy\n @mycompetition = Mycompetition.find(params[:id])\n @mycompetition.destroy\n\n respond_to do |format|\n format.html { redirect_to mycompetitions_url }\n format.json { head :no_content }\n end...
9810bb0e3bee8203500ceecfa700a1b9
Test if value is included
[ { "docid": "86f8ac1d4524bca6bc47b8a9fa345095", "score": "0.0", "text": "def matches?(value)\n accepted.include?(value)\n end", "title": "" } ]
[ { "docid": "89ee768efefc77c62688bcf804b917fe", "score": "0.8311925", "text": "def include?(value); end", "title": "" }, { "docid": "f1d7b33c06d5cfe8f81bfb6ac2a199c8", "score": "0.80940056", "text": "def include?(val)\n\n end", "title": "" }, { "docid": "3edb5effc52ebe58e...
b01940eababd91da2fb253a78f723e05
POST /item_lots POST /item_lots.json
[ { "docid": "e2ec0f77e11a931d4a880cf2f8612b62", "score": "0.68577576", "text": "def create\n @item_lot = ItemLot.new(item_lot_params)\n\n respond_to do |format|\n if @item_lot.save\n format.html { redirect_to @item_lot, notice: 'Item lot was successfully created.' }\n format.json...
[ { "docid": "f475d90be6abdacf702aa2e8a437b88f", "score": "0.6731694", "text": "def create\n @lot = Lot.new(lot_params)\n @lot.event_id = @event.id\n # a lot must have at least one item\n # if(params[:item_ids].blank?)\n # redirect_to @lot, notice: 'You must add at least one item to the l...
6fbda6009923f4d8028c81849558f46d
search = mysql_search_count_all() p search
[ { "docid": "05cb3061518e50f09a6815d1aef2d244", "score": "0.68233615", "text": "def mysql_search_count_info(group_name, search_key)\n records = Counter.where(group_name: group_name)\n records.each do |value|\n if search_key == 'group_name' then\n return value.group_name\n elsif search_key ==...
[ { "docid": "b14b6bdccb2f3b68ff313665f3b13eed", "score": "0.75449747", "text": "def count\n search_results.values.collect(&:size).sum\n end", "title": "" }, { "docid": "c1d885565f9c3fcf394f4f4ca272e671", "score": "0.72960705", "text": "def mysql_search_count_all()\n count = []\n ...
360a8b5c565ca64a16c72389c36d14f2
create path: /sofas from /sofas/2
[ { "docid": "222da09b7982649bde62fd4eb620ef0c", "score": "0.0", "text": "def current_first_path\n \"/#{parse_current_uri.path.split('/')[1]}\"\n end", "title": "" } ]
[ { "docid": "5b6db61dabff4e198300221ac82b71a5", "score": "0.663393", "text": "def create_path(path, value)\n \n end", "title": "" }, { "docid": "3d49fecb75c8116d3b65d63433281bf9", "score": "0.63013256", "text": "def create_path\n unless !self.title || self.title.empty?\n ...
657c4e1c7ae0622e1b5c02a5bb2f9878
verify signature with ECDSA
[ { "docid": "46977e35b0545a2f4aaa88df96d84136", "score": "0.7218856", "text": "def verify content, sign\n # raise OpenSSL::PKey::ECError(ECDSA_verify: nested asn1 error) when sign is wrong\n @ec.dsa_verify_asn1 content, Utils::BinUtil.from_hex(sign)\n rescue\n false\n end", "title"...
[ { "docid": "ce18315391cef135ab0f3c4ee49b541d", "score": "0.769322", "text": "def verify_signature(result); end", "title": "" }, { "docid": "bc406aa8ec579ff326537a5687434336", "score": "0.75848633", "text": "def verify_ecdsa_signature(signature, hash)\n BTC::OpenSSL.ecdsa_verify(...
506b38d77d19dd775014f555e8fb1249
GET /razas/new GET /razas/new.xml
[ { "docid": "e4133b06cc05305fc781c2cf1d7e8aa3", "score": "0.0", "text": "def new\n @raza = Raza.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "title": "" } ]
[ { "docid": "2ebebea6740cc061a1f955e86667c2f9", "score": "0.76684046", "text": "def new\n @revista = Revista.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @revista }\n end\n end", "title": "" }, { "docid": "dd438f93f734b054d088d...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "3972b78ceebf7718d951985dd4a39f17", "score": "0.0", "text": "def weather_test_params\n params.require(:weather_test).permit(:date_a)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.69792545", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6781151", "text": "def strong_params\n params.requ...
6741eb8f79ec6a9ccb02dadc0fa09765
compares each reservation to date range in question and returns an array of rooms available for the given period.
[ { "docid": "5051d7bcd8a0182d44bdfc464c644f11", "score": "0.7745492", "text": "def availability_by_date_range(check_in, check_out)\n occupied_rooms = []\n range = (check_in...check_out)#.to_a\n @reservation_list.each do |reservation|\n if (range.include? reservation.check_in...
[ { "docid": "660892a9764b959257cf44e4f0db62ac", "score": "0.8139814", "text": "def available_rooms(date_range)\n available_rooms = Array.new(21, true) # Setting all rooms to available\n @list_of_reservations.each do |r|\n if (r.does_reservation_overlap?(date_range)) # if date_ranges inte...
0aaffe0901c73e3b88d49538ad76b060
PATCH/PUT /carts/1 PATCH/PUT /carts/1.json
[ { "docid": "f85feebc59238c7cda8e0728df5c8aa4", "score": "0.62940913", "text": "def update\n if @cart.update(cart_params)\n redirect_to @cart, notice: 'Корзина изменена.'\n else\n render :edit\n end\n end", "title": "" } ]
[ { "docid": "9111b980ecfe1995443f1089b9a3848d", "score": "0.7168711", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { head :no_content }\n else\n for...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "370b9e158fb10f3aebacab9230248484", "score": "0.0", "text": "def order_params\n params.require(:order).permit\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...
090ae95bb17b06512eeeb4f8010132fe
Read a &39;niatelemetry.PodTimeServerPolicies&39; resource.
[ { "docid": "765ed6985de7c57e2d3a73e887f582d3", "score": "0.44692025", "text": "def get_niatelemetry_pod_time_server_policies_by_moid_with_http_info(moid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: NiatelemetryApi.get_niatelemetry_pod_time_ser...
[ { "docid": "1fecf9b626da1e26d3ec44897995b820", "score": "0.6530546", "text": "def get_niatelemetry_pod_time_server_policies_list(opts = {})\n data, _status_code, _headers = get_niatelemetry_pod_time_server_policies_list_with_http_info(opts)\n data\n end", "title": "" }, { "docid...
b46a08f3ac72645e28f0c4444cc21663
DELETE /customer_relationships/1 DELETE /customer_relationships/1.json
[ { "docid": "76457991d9fe56f5a1800409ba15ac2d", "score": "0.73220056", "text": "def destroy\n @customer_relationship.destroy\n respond_to do |format|\n format.html { redirect_to @business_model_canvase }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "c82c02a37824d0a5c7e310717574cf87", "score": "0.7108075", "text": "def destroy\n relationship = Relationships.find(params[:id])\n relationship.destroy\n head 204\n end", "title": "" }, { "docid": "42934bbd294d5c8147727043f7f0db99", "score": "0.6780105", "text": "...
84e9fe838590c13dabfad4a2e1492f46
If navigationcontact selected, redirect back to contactcontact
[ { "docid": "097c2d3c3412ab447fa9e3126e4e371c", "score": "0.7960989", "text": "def contact\n redirect_to navigation_contact_path\n end", "title": "" } ]
[ { "docid": "351ea15a9d1e55978895035bfc5c301a", "score": "0.64472336", "text": "def index\n redirect_to :new_contact\n end", "title": "" }, { "docid": "6cfbf17984d499032e6aafa48b5602dc", "score": "0.64176047", "text": "def redirect_user_to_dashboard\n redirect_to dashboard_path...
f74bb17356d4598036163d948208fba0
proof of concept for TB 2 trees
[ { "docid": "ba89393159348096721bc4f58c776d38", "score": "0.0", "text": "def test2\n uri = 'http://dbhack1.nescent.org/cgi-bin/phylows.pl/phylows/tree/TB:1999'\n # @x = Net::HTTP.get_response(URI.parse(uri)).body\n @d = Nexml::Document.new(:url => uri)\n end", "title": "" } ]
[ { "docid": "211423f8f625b21c12099488da42cd92", "score": "0.6371427", "text": "def leaf?; false end", "title": "" }, { "docid": "6d4f6a517b676827f3f263eb5b86e1e9", "score": "0.6344008", "text": "def produce_tree(ary); end", "title": "" }, { "docid": "ac621869e0a6d6fc445a78...
adabf54d2e30cac84972b7cb442a92e2
Sets the name of the worker. Setting the name to nil will reset the default worker name
[ { "docid": "cc27f664ffd61a7437601f51178def1b", "score": "0.0", "text": "def name=(val)\n @name = val\n end", "title": "" } ]
[ { "docid": "79a4ed97f8e53b1623cb5385af64bd5c", "score": "0.70488185", "text": "def worker_name\n @parameters[:worker_name]\n end", "title": "" }, { "docid": "8cf89d18bbebd5f02aa186e3f6c28f22", "score": "0.6964408", "text": "def name(value=nil)\n @name = value unless ...
89671590601a274f2310c8ad40451d42
I worked on this challenge with Ian Wudarski. I spent 2 hours on this challenge. Complete each step below according to the challenge directions and include it in this file. Also make sure everything that isn't code is commented. 0. Pseudocode What is the input? An Array of numbers of strings. What is the output? An arr...
[ { "docid": "e8c86abcc2b088b2658ce2fcfbf09195", "score": "0.0", "text": "def mode (array)\n newhash=Hash.new\n array.each do |x|\n newhash[x] = newhash[x].to_i + 1\n end\n modevalue = newhash.values.max\n modearray= Array.new\n newhash.each do |x, y|\n if y == modevalue\n modearray.push(...
[ { "docid": "c15139d84fc481c33dfbf07305e95b8c", "score": "0.7803973", "text": "def find_most_frequent_integer(arr)\n #1. Create hash variable with default 0 value.\n hashld = Hash.new 0\n \n #2. Loop through each array element, count them, and insert the final key/value combo into the hashld ...
b3e115a2664444fdce37b2a4f05119a5
TODO: must have a post_id before_filter
[ { "docid": "7bc21db0c1fab63da45fc0dfd1f2749b", "score": "0.0", "text": "def index\n redirect_to :new\n end", "title": "" } ]
[ { "docid": "1bed21388a7f4927aef81178201d2789", "score": "0.6640942", "text": "def before_request\n @post = Post.find(params[:post])\n end", "title": "" }, { "docid": "76134e8d7480c4a81bcc75eb0a367c9f", "score": "0.659046", "text": "def process_post(post)\n # No-op.\n ...
b4371c79c0c9fd6297cc73ad5931e561
Public: Define the queues worked by members of the worker pool.
[ { "docid": "41d20b20f4d3bde4b7dbcc8ed47a06c0", "score": "0.69341445", "text": "def queue(*queues)\n end", "title": "" } ]
[ { "docid": "66353c0338841801f1ca5258b5d511f3", "score": "0.7727562", "text": "def queues\n\t\t\t@queues ||= {}\n\t\tend", "title": "" }, { "docid": "0f8ccb9453fed2b07aea7fb4966cfc68", "score": "0.73576736", "text": "def queues\n register_classes\n register_bus\n ...
39039a45c2ee48c502a31f90c1bd8522
Encrypts files with the supplied password or master key. The original file is not modified; a new encrypted file is created. The password is not required if a master key has been set (either with `random_key_gen` or with `set_master_key`). If a password is supplied it will be used to create a key with PBKDF2.
[ { "docid": "3a2599c8c65b7f32e03e796a25aa6bab", "score": "0.71699035", "text": "def encrypt_file(path, password = nil)\n salt = random_bytes(@salt_len)\n iv = random_bytes(@salt_len)\n aes_key, mac_key = keys(salt, password)\n\n cipher = cipher(aes_key, iv)\n hmac = OpenSSL::HMAC.new(mac_k...
[ { "docid": "f037ae44a04a4d9b80a6da1f7ceeab96", "score": "0.6263909", "text": "def _encrypt\n cryptor_files(@encrypting)\n end", "title": "" }, { "docid": "fc11d0cbe4082ca2b6e0663300b29fbc", "score": "0.6044591", "text": "def encrypt_file(filename, key)\n File.open(filename) do |...
f76a257e3d2622de8f11f25c1dc674e7
Opcode 8 is equals: if the first parameter is equal to the second parameter, it stores 1 in the position given by the third parameter. Otherwise, it stores 0.
[ { "docid": "ae8c06cbc56569c0149b62fd00448797", "score": "0.7127667", "text": "def op_equals(instruction)\n\t\tptr = instruction.ptr\n\t\tpos_v1, pos_v2, pos_v3 = ram[ptr + 1, 3]\n\t\tv1 = instruction.p1 == 0 ? ram[pos_v1] : pos_v1\n\t\tv2 = instruction.p2 == 0 ? ram[pos_v2] : pos_v2\n\t\tvalue = v1 == v...
[ { "docid": "2dd1ad62dac8591d821f30ad47f372aa", "score": "0.6616957", "text": "def opcode_8(prog, pc, params)\n prog[prog[pc + 3]] = if value(prog, pc + 1, params[-1]) == value(prog, pc + 2, params[-2])\n 1\n else\n 0\n ...
32d98a3addb15761039864beb63caa8b
Set the ini data for the key +key+
[ { "docid": "69f6c7178bac01e9c4e883d34116cf51", "score": "0.6610282", "text": "def []=(key, value)\n raise TypeError, \"String expected\" unless key.is_a? String\n raise TypeError, \"String or Hash expected\" unless value.is_a? String or value.is_a? Hash\n \n @inihash[key] = value\n end", ...
[ { "docid": "68d5877b0569acf7ad54d910b87a203f", "score": "0.7259275", "text": "def _set_setting(key_name, value)\n ini = Rex::Parser::Ini.new(@config_file)\n ini.add_group(@group_name) if ini[@group_name].nil?\n ini[@group_name][key_name] = value\n ini.to_file(@config_file)\n end", "titl...
30b6f6e5b06a13cc74d24918d721be34
es el equivalente a un metodo de clase: def self.publicados Article.where(state: "published") end Custom setter
[ { "docid": "bc298d4c2735bc0e8bcc23c92ee40127", "score": "0.0", "text": "def categories=(value)\n\t\t@categories = value\n\tend", "title": "" } ]
[ { "docid": "e4682ed7ef72785ec3e98ab2796e428b", "score": "0.66863024", "text": "def set_published_state; end", "title": "" }, { "docid": "6fafa79daff4a9b45389dda7a177bc7a", "score": "0.65139997", "text": "def set_publicacao\n @publicacao = Publicacao.find(params[:id])\n end", ...
2c1dc6488a6765c110307eaec6fbdc49
Reads the entries from the URL in the Import Creates a new Importer object for each entry and calls perform on it
[ { "docid": "3ac6515f33136a315e78fb98f2250826", "score": "0.6730337", "text": "def perform\n start_time = Time.now\n LOG.info \"JOB #{self.to_s}: Performing on #{@reader.to_s}\"\n import_entries\n LOG.info \"Finished importing in #{(Time.now - start_time).duration}.\"\n end", "...
[ { "docid": "604d811619e8044b4332d7ca05fa46ac", "score": "0.6542798", "text": "def sequential_import\n each_object_to_import do |object|\n repr = representation_class.from_api_response(object)\n\n importer_class.new(repr, project, client).execute\n end\n end", "ti...
bb3411015b81cfdbe5cd3e7a76d2c5e5
Write a method select_odds(numbers) that takes in an array of numbers and returns a new array containing the odd numbers of the original array. My solution 1) What data type I want to return ? input : nums in array output(returned vablue) : nums in array need a storage(=a new variable) to store a new output/retured val...
[ { "docid": "960e278e9c5b9d64b79a83af2b80c070", "score": "0.798954", "text": "def select_odds(numbers)\n new_arr = []\n\n i = 0\n while i < numbers.length\n if numbers[i] % 2 == 1\n new_arr << numbers[i]\n else \n end\n\n i += 1\n end\n\n return new_a...
[ { "docid": "d5b03e7bb68a7e9236130d61bb9bf757", "score": "0.79271936", "text": "def select_odds(numbers)\n \n i = 0\n \n new_array = []\n \n while i < numbers.length\n \n if numbers[i] % 2 != 0\n \n \tnew_array << numbers[i]\n end\n \n i += 1\n end\n return new_array\n\nen...
e7885b01bb2e70cca398d7c2ec7abdf3
todo: rename this to 'submit_payment'
[ { "docid": "474bd26d33e7c3f114a7c201351f0755", "score": "0.0", "text": "def step2(params)\n transaction_uuid = params[:transaction_uuid]\n transaction = Transaction.by_uuid(transaction_uuid)\n transaction.perform_payment(params)\n transaction\n end", "title": "" } ]
[ { "docid": "a11a77faa5ecec563671688dede27eb3", "score": "0.74994594", "text": "def process_payment!\n @payment_type.pay\n end", "title": "" }, { "docid": "ffb1cf02d51b6aa5e3e683c6acb50cd4", "score": "0.7221705", "text": "def payment_instruction\n end", "title": "" }, { ...
97d456396ca453b07de87cb8c4f9ccad
Returns the data for this item that's defined in the item schema
[ { "docid": "dea3addc7c936eb50af95afb81d8a118", "score": "0.61330694", "text": "def schema_data; end", "title": "" } ]
[ { "docid": "b35015fc987157454e80d180ceaa3945", "score": "0.7864488", "text": "def schema_data\n inventory.item_schema.items[@defindex]\n end", "title": "" }, { "docid": "65e5fd551a6bca9c86376589a9214413", "score": "0.7393111", "text": "def item_data\n if @item_data.nil\n...
ad138018ba8574cdfb139559c78ac560
This is how the array is split, if you can't tell by the regex: 0: user 1: ident 2: host 3: channel/user 4: message
[ { "docid": "a64fb3c361bdffb305446d834552a6c3", "score": "0.6463286", "text": "def grab_info(text)\n if text =~ /^\\:(.+)\\!\\~?(.+)\\@(.+) PRIVMSG \\#?(\\w+) \\:(.+)/\n return [$1, $2, $3, $4, $5]\n else\n return false\n end\n end", "title": "" } ]
[ { "docid": "d11abe985212a03caf71f3b0315494e6", "score": "0.6759121", "text": "def split_params(params)\n channels = params.select { |param| param.start_with?(\"#\") }.map { |param| param[1..] }\n users = params.select { |param| param.start_with?(\"@\") }.map { |param| param[1..] }\n \n ...
c90922797b6fec8d71d7329fc822555d
TODO: pull process_const from obfuscator TODO: pull process_colon2 from obfuscator TODO: pull process_cvar from obfuscator TODO: pull process_dasgn_curr from obfuscator Function definition
[ { "docid": "a4f55f98b810b5564fda9ea6bf45a791", "score": "0.53900546", "text": "def process_defn(exp)\n make_function exp\n end", "title": "" } ]
[ { "docid": "58397bf1c6395f5d82d945f73d228fba", "score": "0.5713111", "text": "def third_party_processors; end", "title": "" }, { "docid": "92a50dee1dc081a758fd9025b5361845", "score": "0.5594366", "text": "def process_directives\n end", "title": "" }, { "docid": "29d0e928...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "4351fb7f6b3c58539d1126d19fb8b07b", "score": "0.0", "text": "def forma_pagamento_params\n params.require(:forma_pagamento).permit(:descricao)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74939764", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6955084", "text": "def strong_params\n params.require(:request).permit(param_whit...
756214d7dd9032279de91b2f6533e7fc
Mapping from dynamo document to api value
[ { "docid": "ec8ffd7f5f72d240ff2da298fdbbc13f", "score": "0.0", "text": "def api_value(val, data)\n case val\n when 'alcoholInteraction'\n data['alcohol_interaction']\n when 'availableGeneric'\n data['available_generic']\n when 'brandNames'\n return [] if data['brand_names'][0]...
[ { "docid": "392598703eed6ea0a3f00ddedf4407b0", "score": "0.5772668", "text": "def get(type,key)\n document = @table.items.query(:hash_value => key,\n :range_value => type).first\n #TODO - sort, and return in rev\n document ? Rufus::Json.decode(document.attributes[:doc]) : n...
8eb6889caea43a1db47e9735fd72d070
Is this a backwards, linear update?
[ { "docid": "36404ed6bf19696e10d6a4ff27696cd9", "score": "0.0", "text": "def backwards?\n remote == ancestor\n end", "title": "" } ]
[ { "docid": "6e4256ea6ab3a80028639656b35330c3", "score": "0.64440465", "text": "def mirror_update pt\n pt.x = pt.x * (-1)\nend", "title": "" }, { "docid": "82df0cc99632d2ebf15cdab4fe6ac44b", "score": "0.6010816", "text": "def should_reverse?\n stops_remaining_in_direction?\n end"...
e22df8c3aa7533b02f5621c552720e5d
Called when a call is made and the circuit is open. Raises a CircuitBrokenException exception.
[ { "docid": "a8bfcc948eec8301808de09233d9f26a", "score": "0.7610255", "text": "def on_circuit_open(circuit_state)\n @logger.info(\"on_circuit_open: raising for #{circuit_state.inspect}\")\n\n raise CircuitBreaker::CircuitBrokenException.new('Circuit broken, please wait for timeout', circuit_state)\...
[ { "docid": "5823ba807977222fef7485a2f89e6e8c", "score": "0.7534557", "text": "def on_circuit_open(circuit_state)\n @logger.debug(\"on_circuit_open: raising for #{circuit_state.inspect}\") if @logger\n\n raise CircuitBreaker::CircuitBrokenException.new(\"Circuit broken, please wait for timeout\", c...
56f354513c6ec2dc8ec94defaafae944
GET /cmtvotes/new GET /cmtvotes/new.json The new method defined provides the view for the user to vote on a comment. It provides the cmtvotes view with the comment information for the user to vote
[ { "docid": "65269fe5c0f4d4afdff7300b7bc87e56", "score": "0.7367657", "text": "def new\n @cmtvote = Cmtvote.new\n @tempcmt = Comment.find(params[:id])\n @tempost = @tempcmt.post_id\n @@ctemp = @tempcmt.id\n @@ptemp = @tempcmt.post_id\n respond_to do |format|\n format.html # new.htm...
[ { "docid": "1451e9579f808dccf578b2098d625d3c", "score": "0.77455425", "text": "def new\n @commentvote = Commentvote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commentvote }\n end\n end", "title": "" }, { "docid": "8b2113e8d41...
bcfb08ecb014675ae1e955d8dade2426
file related utilities collect filenames recursively
[ { "docid": "f356d91806efe3cb288a0ec1b11c7eef", "score": "0.0", "text": "def collect_files(str, regex = nil)\r\n regex ||= //\r\n text_array = Array.new\r\n Find.find(str) do |f|\r\n text_array << f if regex =~ f\r\n end\r\n text_array.sort\r\n end", "title": "" } ]
[ { "docid": "d9554f85713e2194f73e212b2b59e5ba", "score": "0.71964324", "text": "def collect_files\n globs = self.files\n globs = globs.map{ |glob| Dir[glob] }.flatten.uniq\n globs = globs.map do |glob|\n if File.directory?(glob)\n Dir[File.join(glob, '**/*')]\n ...
faad4afbc89981087b28f2e48e7ab1de
Allows you to set matrix elements one by one
[ { "docid": "c55eedb35272fe03dcc29f9b21b7ed5a", "score": "0.0", "text": "def []=(row, column, value)\n @rows[row][column] = value\n end", "title": "" } ]
[ { "docid": "50781f8c5b25df7f1ecc904464601db1", "score": "0.698452", "text": "def set(row, column, value)\n @matrix[row][column] = value\n end", "title": "" }, { "docid": "28ca1d60150dd8fd271f552acb4e6e46", "score": "0.6817378", "text": "def set(m)\n 0.upto(m.row_size - 1) ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "4f4c7d662a9c6c5bfe47f12f1d0ba6ff", "score": "0.0", "text": "def set_meta\n @meta = Meta.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...
609eb39f892550a11ef673e363c7a4cc
c o l u m n _ n a m e s _ f o r _ l o g Depending on which FMS functions are enabled, the columns in the Stats.log may shift, so we need to check which columns are in use.
[ { "docid": "d2a50e25eb3d020fbd3d3e874dc396d3", "score": "0.0", "text": "def column_names_for_log (path)\n\n begin\n file = File.open(path, \"r\")\n # The column names are typically on the first line of log file.\n lines = file.readlines(path,512)\n rescue\n columns = []\n else\...
[ { "docid": "c77c855d6badc33ef1b0c55b9181b9f5", "score": "0.5771892", "text": "def nsf?\n (chron_columns.size <= 1) && (measure_columns.size >= 1) && columns.none? {|col| !col.chron? && !col.dimension? && !col.measure?}\n end", "title": "" }, { "docid": "854b58d3d6cc1fcb6f74f8287888a9...
30b8803c48a3960f4bddb676b6da0e86
Memoize the output of a find in a threadsafe manner.
[ { "docid": "3dc45da40376752b8077a92c06eda3a1", "score": "0.0", "text": "def add_index(name, indexable)\n @lock.synchronize do\n @indexes[name] = indexable\n end\n end", "title": "" } ]
[ { "docid": "fa8baa38455c3e17942c755cd4896235", "score": "0.62660944", "text": "def pure_find(task)\n file.rewind\n current_line = ''\n first_c = 0\n last_c = 0\n file.each_char.with_index do |c, idx|\n if c == LINE_SEP\n current_line =~ /^([^\\s]+)#{SEPARATOR}/\n...
6c0a4b2ffcc0e357e0e86dc6e0781c82
zh/00default.rb: TraditionalChinese resources of 00default.rb. header
[ { "docid": "015f0d46dbcca4a44d46b1ee929837b8", "score": "0.0", "text": "def title_tag\n\tr = \"<title>#{CGI::escapeHTML( @html_title )}\"\n\tcase @mode\n\twhen 'day', 'comment'\n\t\tr << \"(#{@date.strftime( '%Y-%m-%d' )})\" if @date\n\twhen 'month'\n\t\tr << \"(#{@date.strftime( '%Y-%m' )})\" if @date\...
[ { "docid": "7dde9dad3f258d06da0822e451bd64cb", "score": "0.59846014", "text": "def index\n\t\t@file = YAML.load_file(\"#{RAILS_ROOT}/config/locales/#{I18n.default_locale}.yml\")\n @res = @file[I18n.default_locale.to_s]\n @language = I18n.default_locale.to_s\n\t\ttranslation_options\n\tend", "t...
7e8a943e24f71a6e77d2b273770b0b47
Policies that need review
[ { "docid": "0eb38fb35453a3c8479601d899ef2a72", "score": "0.7188583", "text": "def review\n @policies = Policy.where(\"status=? OR status=?\", \"GENERATED\", \"ERRING\")\n end", "title": "" } ]
[ { "docid": "b5ab36b915d8e4191cc5e2703f227c29", "score": "0.7986065", "text": "def policies; end", "title": "" }, { "docid": "fee384cc34a2ee8995d0dcd00feb351f", "score": "0.77429336", "text": "def policies\n end", "title": "" }, { "docid": "ee1e04a5dfc4f69cc08792c48aa...
74a6440611140c8e9a7e4105811f5c40
if alias was changed in not new object it's important, because alias can't be change
[ { "docid": "23bc332b684f390de82a021d3fe2888d", "score": "0.6380368", "text": "def check_alias\n self.alias_str = self.alias_str_was\n end", "title": "" } ]
[ { "docid": "9a3cb344c0099778d69d2973a5883587", "score": "0.65068775", "text": "def alias=(_); end", "title": "" }, { "docid": "7396f84692d53e9eca92d22173752a6f", "score": "0.63058", "text": "def is_alias?; end", "title": "" }, { "docid": "5a130828c5b0c2a14f698b9f25d2ba65"...
6ac945b2630e536f507d6467619875c8
Drops current claim for attached user and removes their current data
[ { "docid": "172da7afec4368bc16509f5af6ce7189", "score": "0.6336432", "text": "def drop_claim(account)\n case self.status\n when STATUS_DE1, STATUS_DE2\n Annotation.destroy_all({document_id: self.id, account_id: account.id})\n Group.destroy_all({document_id: self.id, account_id: acc...
[ { "docid": "f28c128a2084f8043b6642f6cd1bf72d", "score": "0.79410726", "text": "def unclaim\n update(user: nil)\n end", "title": "" }, { "docid": "290e083e7a836caa1db1178595f23c48", "score": "0.67084706", "text": "def delete_current_user\n\t\tcurrent_user = nil\n\tend", "title...
5d5154a3c6bdbcb239c32df4bd7b6f4e
Returns all the listerners instances.
[ { "docid": "129db1bc26b83c653c947fcaf2c77428", "score": "0.0", "text": "def listeners\n @@listeners ||= @@listener_classes.collect {|listener| listener.instance}\n end", "title": "" } ]
[ { "docid": "82ac743875ef7c5ea890138e736672ec", "score": "0.7007815", "text": "def list_of_instances\n super\n end", "title": "" }, { "docid": "bd684f2ba730a96834785db4dd208ef4", "score": "0.68962485", "text": "def instances()\n return @instances\n end", "title...
b9294ba4647d56fa56df2382890b25c4
Builds up the HDS definition of a data element, given a PhEMA definition
[ { "docid": "bfdcd1cde506a2e040d3d90b869d8b65", "score": "0.5643785", "text": "def phema_data_type_to_hds_json element, isSource\n is_subset_function = @hds_translator.is_subset_function(element[\"attrs\"][\"element\"][\"uri\"])\n if is_subset_function\n subset_element = element\n ...
[ { "docid": "100354e085b75e8915a9c9a2819a9f0a", "score": "0.58727926", "text": "def content_definition(element, essence_hash)\n essence_hash.stringify_keys!\n # No name given. We build the content from essence type.\n if essence_hash['name'].blank? && essence_hash['essence_type'].pre...
b9a74eae1cc2f47d36db45edc371db92
signed_in employer required PATCH/PUT /jobs/1 PATCH/PUT /jobs/1.json
[ { "docid": "bdefdbf0c321879dea235f5ece35435c", "score": "0.0", "text": "def update\n authorize(@job)\n job_function = JobFunction.find(job_params[:job_function_id])\n respond_to do |format|\n if @job.update(job_params.merge(archetype_low: job_function.low,\n ...
[ { "docid": "10b65d6ef9ec329e2779c302326a8b0e", "score": "0.72704774", "text": "def update\n if user_signed_in? and current_user.id == @job.user_id\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n ...
6e0542d3bf1fea1c6b14aca390ec86bd
Public: Checks if the given username / realm combination exists username the username to check realm the realm to check Examples digest_file.has_entry?("myuser", "myrealm") => true Returns true or false if the username/realm combination is found.
[ { "docid": "cb77e980f55fd84a536c8c829c3b00b7", "score": "0.7991423", "text": "def has_entry?(username, realm)\n test_entry = DigestEntry.new(username, realm)\n @entries.has_key?(test_entry.key)\n end", "title": "" } ]
[ { "docid": "78b38feb4feb7884b129e805938b6c36", "score": "0.66091895", "text": "def has_entry?(username)\n test_entry = PasswdEntry.new(username)\n @entries.has_key?(test_entry.key)\n end", "title": "" }, { "docid": "78b38feb4feb7884b129e805938b6c36", "score": "0.66091895", ...
64e13fb529bde2f7529c383f3a0ac248
Returns the full title on a perpage basis
[ { "docid": "a471d19325c733e2e3bb5e21253333fd", "score": "0.0", "text": "def full_title(page_title = '')\n base_title = 'DSDA'\n if page_title.empty?\n base_title\n else\n \"#{page_title} | #{base_title}\"\n end\n end", "title": "" } ]
[ { "docid": "8043c004aaf0669f8680ed8029a7fcae", "score": "0.8028669", "text": "def page_title\n title.page\n end", "title": "" }, { "docid": "d5574881411ca267fc1fd9a436ce6844", "score": "0.7777239", "text": "def full_title(page_title)\n base_title = \"Surpass the Limit\"\n ...
c9e410f93dd40bdcf28d55f6dd7af34c
I worked on this challenge with Kennedy 1. Pseudocode What is the input? => The group method takes an input names which => is an array of strings. What is the output? => The method outputs 3 different sets of groups, => each with 4 or 5 people. What are the steps needed to solve the problem? => CREATE method group, tak...
[ { "docid": "a122d28953ce7deb89453f20b309b259", "score": "0.8297913", "text": "def group(names)\n\tunits = []\n\t3.times do\n\t\tnames = names.shuffle\n\t\tremainder = []\n\t\tcount = names.length % 4\n\t\tcount.times do\n\t\t\tremainder << names.shift\n\t\tend\n\t\tgroupsArray = names.each_slice(4).to_a...
[ { "docid": "e37c869dc3bf560dd463c8a5b824c459", "score": "0.81615883", "text": "def create_groups(names)\n groups = []\n names.shuffle.each_slice(4) do |group|\n if group.count == 4\n groups << group\n else\n i = 0\n group.each do |name|\n groups[i] << name\n i += 1\n...
74dc4dcf50a72ed1e1bcee4e56447cd0
button callbacks navigationController() is automatically set whenever we add a view controller to a navigation stack, which we did with initWithRootView
[ { "docid": "66fff109d6b8b37e5471b5c3f71e90f5", "score": "0.0", "text": "def tap_red\n controller = ColorDetailController.alloc.initWithColor(UIColor.redColor)\n self.navigationController.pushViewController(controller, animated: true)\n end", "title": "" } ]
[ { "docid": "ddecfe029e8d56b5201223283d08ca14", "score": "0.6450134", "text": "def create_back_button_callback\n\t\tlambda do\n\t\t\t@main.current_menu = @parent\n\t\tend\n\tend", "title": "" }, { "docid": "cc2202307a43e367d2854f4ef55d2190", "score": "0.63294715", "text": "def navigat...
3bc22d1137dfbbe9401f4ed8cdb1199b
Returns the last segment of the JSON Pointer
[ { "docid": "a551497a2b276eb6cbfe9aff95b4a832", "score": "0.6373268", "text": "def last; @last; end", "title": "" } ]
[ { "docid": "09db565158e353484c07ca2eb90d6071", "score": "0.7125985", "text": "def last\n @data[-1][-1]\n end", "title": "" }, { "docid": "d86115fef1a6cf212563ac6f5e0f9f79", "score": "0.7011931", "text": "def get_last\n return tail.data if tail\n return nil\n end", "tit...
7aee0ce80c466faa656fca2ca9c751b4
Blocking commands inside transaction behave like nonblocking. It shouldn't be done though. source://redis//lib/redis/pipeline.rb68
[ { "docid": "725ba65442b0a398afc594da1456c7dc", "score": "0.6380437", "text": "def send_blocking_command(command, _timeout, &block); end", "title": "" } ]
[ { "docid": "00c5e4ac764091a88c958cd4891ba822", "score": "0.63775706", "text": "def transaction(&block); end", "title": "" }, { "docid": "0d4efea218f2ecbba5a3ff05f9731744", "score": "0.62570935", "text": "def transaction(&blk)\n tap(&blk)\n end", "title": "" ...
042efc3c06c2e2c05d17cd823e88af77
Given a hash with numeric values, return the key for the smallest value require "pry"
[ { "docid": "69917a83c8c8ad1b0d415ab74a5123bd", "score": "0.0", "text": "def key_for_min_value(name_hash)\n# low_price = Float::INFINITY\n low_price = nil\n low_item = nil\n name_hash.each do |item, price|\n if low_price == nil || price < low_price\n low_price = price\n low_item = item\...
[ { "docid": "187165074e32a7573ee53a9cabb44ed4", "score": "0.8309639", "text": "def key_for_min_value(hash)\n lowest_key=nil \n lowest_value= Float::INFINITY\n hash.each do |name,number|\n if number < lowest_value\n lowest_value=number\n lowest_key= name\n end \n end\n lowest_key\nend...
b0cd14ec6be7fbb3ff52626a4a0b42f3
DELETE /scraped_codes/1 DELETE /scraped_codes/1.json
[ { "docid": "cebae54e045f7c2302c2cacac0cbed71", "score": "0.741581", "text": "def destroy\n @scraped_code.destroy\n respond_to do |format|\n format.html { redirect_to scraped_codes_url, notice: 'Scraped code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end...
[ { "docid": "725b3b11701e04d87e00cec959662098", "score": "0.6805732", "text": "def destroy\n @code = Code.find(params[:id])\n @code.destroy\n\n respond_to do |format|\n format.html { redirect_to code_index_url }\n format.json { head :no_content }\n end\n end", "title": "" }, ...
7ca157e4ed8fa9e88e9e494df8d09366
def employee_codes_of_specific_date(employee_time_sheet_id, sun, monday, tuesday, wednesday, thursday, friday, sat)
[ { "docid": "b0d47a4ae23fb257f441fd39f4099ad1", "score": "0.7091505", "text": "def employee_cost_codes(day, employee)\n @timesheet = @project.employee_time_sheets.where(timesheet_created_at: day, employee_id: employee.id)\n end", "title": "" } ]
[ { "docid": "1f188794535baaeb18f3c4dc49ee0c68", "score": "0.595235", "text": "def w_day; end", "title": "" }, { "docid": "d8a5b3ebc9060c8248a9909032a53e65", "score": "0.5846084", "text": "def return_static_day(myday,day_map,human_label)\n\n static_day=myday\n my_1day=(60*60*24) #1 day...
4b494711e99260366ab5fb4f7dceaaf1
Customer edition, GET and POST.
[ { "docid": "968c083ad7b1b69dc36fc4c8a2db2896", "score": "0.67713827", "text": "def edit\n return if request.get?\n @customer.attributes = params[:customer]\n @customer.address.attributes = params[:address]\n Customer.transaction do\n @customer.save!\n @customer.address.save!\n ...
[ { "docid": "2df8adfaea110f03a9134d3de5ff8f6a", "score": "0.74488765", "text": "def edit_customer_details\n end", "title": "" }, { "docid": "1955973018d726e532891c819c1dbb00", "score": "0.67933303", "text": "def edit\n @customer = Customer.find(params[:id])\n end", "title": "...
34e3656289cccb612f14b1903d9d86a4
We need to add width and height to the Image record manually, so we perform this after each save (but not after_save, only in controllers). The reason we cannot do this automatically during save is because a LOT of stuff updates images, and we only need to do this after a create or update. Not to mention, endless loop.
[ { "docid": "fbba66cb9305239cfd4e0d39f3da03b9", "score": "0.57525873", "text": "def save_metadata\r\n img = Magick::Image.read(file.path).first\r\n update_attributes(width: img.columns, height: img.rows)\r\n end", "title": "" } ]
[ { "docid": "41a7353b620862e7dac89d1b1f772cc4", "score": "0.7244207", "text": "def save_image_dimensions\n geo = Paperclip::Geometry.from_file(image.queued_for_write[:original])\n self.width = geo.width\n self.height = geo.height\n end", "title": "" }, { "docid": "864f44b8afbc47528d...
d9846858d62c35ae5deeeec540c78a79
returns tags followed by my friends but not by self TODO: optimize
[ { "docid": "c88f30a39158956f48d116e2edfe85c6", "score": "0.615882", "text": "def suggested_tags(group, limit = 5)\n friends = Membership.where(:group_id => group.id,\n :user_id.in => self.friend_list.following_ids,\n :preferred_tags => {\"$n...
[ { "docid": "fab047bf4aba939921e73bec24bbcf62", "score": "0.6953156", "text": "def following_tags\n Tag.joins(\"JOIN relationships AS r ON r.followed_id = tags.id\").where(\"r.follower_id = ? AND r.item_type = 'Tag'\", self.id)\n end", "title": "" }, { "docid": "44e60243e0eb5bceab0bfaf8b8...
19799aeb67b1f38fc99c1cbc70e2167b
calls the 2 methods. returns the value for the last method
[ { "docid": "1c22dd99fbe26a2677c5fca1ddf97f71", "score": "0.0", "text": "def virus_effects\r\n predicted_deaths\r\n speed_of_spread\r\n end", "title": "" } ]
[ { "docid": "5d120b92da13b2209b2149890f6c5538", "score": "0.6437458", "text": "def last_result=(_arg0); end", "title": "" }, { "docid": "5d120b92da13b2209b2149890f6c5538", "score": "0.6437458", "text": "def last_result=(_arg0); end", "title": "" }, { "docid": "846188f53613...
e17cdea35ba1334cdb74fb946121ae0a
Returns a Hash with the limits for X and Y axis
[ { "docid": "8827912c9af686996c07f73781432b79", "score": "0.7269456", "text": "def edges\n { x: x_limits, y: y_limits }\n end", "title": "" } ]
[ { "docid": "0b6ce5f3275ecb4b677af9db1654d146", "score": "0.7849323", "text": "def x_limits\n { min: 0, max: @x-1 }\n end", "title": "" }, { "docid": "a67ee68dc1cb7d37fea140967686817b", "score": "0.729175", "text": "def bounds\n { x: [@attrs[:x1], @attrs[:x2]].max, y: [@a...
5a40dc3885ca9a5282d790e206a119a0
Lists current resolver tests
[ { "docid": "4adcb66bef26f461c2700d716b5f7066", "score": "0.594473", "text": "def tests(test_name=nil)\n unless test_name\n @registered_blocks[:test] ||= []\n else\n return @registered_blocks[:test].find do |registered_test|\n registered_test[:name] == test_name...
[ { "docid": "807d454ff72dfe727bae6ca11b7f3495", "score": "0.7679375", "text": "def list_tests\n _requirement_hook { @test_collection.list_remote }\n end", "title": "" }, { "docid": "759493987a8c4c006cc338a9577f484f", "score": "0.70159394", "text": "def list_remote\n requirement...
4995a107171a18fca9b3ece3a51b1050
build a month for year cal output
[ { "docid": "8ef0fea580b39789ebc094e1dbdd0869", "score": "0.697017", "text": "def to_year\n month_obj = []\n month_obj << \"#{month_name}\".center(DEFAULT_MONTH_WIDTH)\n month_obj << \"Su Mo Tu We Th Fr Sa\"\n month_obj.concat(format_body)\n end", "title": "" } ]
[ { "docid": "20476665aee07ea2f11c21eabfe3ea90", "score": "0.7466153", "text": "def month() end", "title": "" }, { "docid": "4b777002cc790e3f87c4136b1605e721", "score": "0.72174793", "text": "def build_date_from_year_month(data)\n dt = data['year']\n if data['month']\n ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "fec958f4306c3285fcc2ceca38c0a6bb", "score": "0.0", "text": "def set_template\n @template = Template.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...
0636c2f0ff24bcfafddeb5d1e9c389ac
Replace the inspect method so that it doesn't kill RSpec
[ { "docid": "7e84edb9f28384859f6296e305fccd94", "score": "0.0", "text": "def inspect\n \"I'm located at row #{row} and col #{col}\"\n end", "title": "" } ]
[ { "docid": "f76b3c73f7a0ff8121985dfd29ce546a", "score": "0.70268404", "text": "def define_inspect_method; end", "title": "" }, { "docid": "10d17657d3ce2c02fe2680bc294c24a3", "score": "0.6903507", "text": "def trace_inspect\n inspect\n end", "title": "" }, { "d...
d6c52628ba14363a19cb6470ac928e5c
Enables a plugin if not already enabled. Raises error if plugin cannot be found in the plugin registry.
[ { "docid": "4a4d40e80bb0572b1e952e02e0fa84f4", "score": "0.55517596", "text": "def use(name, **options)\n return self if enabled_plugins.include?(name)\n\n raise PluginNotFoundError, name unless (plugin = Dry::System::Plugins.registry[name])\n\n plugin.load_dependencies\n plu...
[ { "docid": "73319a8a5f995722dd89ca9506307ed1", "score": "0.6434789", "text": "def load!\n begin\n require name unless enabled?\n rescue LoadError => error\n puts(\"Unable to load plugin #{name} due to #{error}.\")\n rescue => error\n puts(\"require '#{name}' failed wi...
bd3a7dfddc30bc69012064ac1ec450c4
Given a hash with numeric values, return the key for the smallest value
[ { "docid": "f61758865047f06ba95487ee218f519f", "score": "0.0", "text": "def key_for_min_value(name_hash)\n values = []\n key_of_smallest_value = []\n\n if name_hash == nil\n key_of_smallest_value = [nil]\n else\n name_hash.each do |key, value|\n values << value\n end\n\n sorted_valu...
[ { "docid": "187165074e32a7573ee53a9cabb44ed4", "score": "0.88810027", "text": "def key_for_min_value(hash)\n lowest_key=nil \n lowest_value= Float::INFINITY\n hash.each do |name,number|\n if number < lowest_value\n lowest_value=number\n lowest_key= name\n end \n end\n lowest_key\nen...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "7c84580f0cfdea23bdba7fa937962514", "score": "0.0", "text": "def ventilation_log_params\n params.require(:ventilation_log).permit(:fan_id, :grid_id, :start_time, :end_time, :speed)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6980629", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.67819995", "text": "def strong_params\n params.requ...
c4fed9f6f152033af2e447f69db1f508
=begin PROBLEM Input: string Output: string rules: Explicit Requirements Write a method that returns the middle word of a phrase/sentence Words are any sequence of nonblank characters Problem Domain: What is the middle word? Odd numbered sentence: array.size / 2 1 Even numbered sentence: array.size / 2 array_middle = a...
[ { "docid": "34edf0354190fa205733158f951796d8", "score": "0.71863127", "text": "def penultimate(string)\n \n string_array = string.split(\" \")\n number_of_words = string_array.size\n \n return string if string.empty?\n \n if number_of_words == 1\n return string\n elsif number_of_words == 2\n ...
[ { "docid": "d26de8ea1f94955c655a2b69af69eab2", "score": "0.85807574", "text": "def middle_word(string)\n words_array = string.split\n array_size = words_array.size\n\n if array_size == 0\n \"empty string entered.\"\n elsif array_size == 1\n words_array[0]\n elsif array_size == 2\n words_ar...
0d01ee3e493677a5609d0ae1a6793a84
DELETE /examenes/1 DELETE /examenes/1.json
[ { "docid": "5f887419fdbeb83b7b60fa3c33c3f692", "score": "0.7019953", "text": "def destroy\n @examen.destroy\n respond_to do |format|\n format.html { redirect_to examenes_url, notice: 'Examen was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": ...
[ { "docid": "ad86927f1fcde37e80086f508ce163d0", "score": "0.7688692", "text": "def destroy\n @exam = Exam.find(params[:id])\n @exam.delete\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { ...
5a7eca1e95ea7a80b9808cf5c0e6fcbe
Convert the self string into the list of the names of the each base.
[ { "docid": "848379948b5f022669f9584d61080a3a", "score": "0.547855", "text": "def names\n array = []\n self.each_byte do |x|\n array.push(Bio::NucleicAcid.names[x.chr.upcase])\n end\n return array\n end", "title": "" } ]
[ { "docid": "6a21ca9bb70f9114afbb86abdaf951f7", "score": "0.61282736", "text": "def split_names\n @adapter.find_strings_by_prefix(namespace_key('.split.'))\n .map { |split| split.gsub(namespace_key('.split.'), '') }\n end", "title": "" }, { "docid": "7d1cc20e1485305...
7f6638fb4e41c4c645f289ac7e5e1808
Compare inequality to nil, an image, constant or array.
[ { "docid": "ecff79f6b28ad2134af239e615b4261d", "score": "0.65008956", "text": "def !=(other)\n if other == nil\n true\n elsif other.is_a?(Vips::Image) \n relational(other, :noteq) \n else\n relational_const(other, :noteq)\n ...
[ { "docid": "9532b992c5440813c8233d1432d03cbc", "score": "0.61652726", "text": "def ==(other)\n other.nil?\n end", "title": "" }, { "docid": "7f32ea91a9f0ad96cee0443b6812f6f1", "score": "0.6103084", "text": "def match(rhs)\n if @is_null and rhs.is_null\n true\n ...
d891f8bf8038ede1d54c8c4a62e3c8fa
PATCH/PUT /systemic_exams/1 PATCH/PUT /systemic_exams/1.json
[ { "docid": "5fad7db4bdfb1ef04379960194088964", "score": "0.685448", "text": "def update\n respond_to do |format|\n if @systemic_exam.update(systemic_exam_params)\n format.html { redirect_to @systemic_exam, notice: 'Systemic exam was successfully updated.' }\n format.json { render :...
[ { "docid": "4e73139db4bdafe9e0ee1a9dd5a6508a", "score": "0.6762382", "text": "def update\n @exam = Exam.find(params[:id])\n\n if @exam.update!(exam_params)\n render json: @exam, status: :ok\n else\n render json: @exam.errors, status: :unprocessable_entity\n end\n end", "title"...
ed741d6227a650237fbc18577b1f999a
Is the name of the method a valid name for an association condition?
[ { "docid": "2db53761a63b299c2384afebea3be907", "score": "0.7292463", "text": "def association_condition?(name)\n !association_condition_details(name).nil?\n end", "title": "" } ]
[ { "docid": "fb4f13605357175a83e5f25460454690", "score": "0.73350465", "text": "def association?(method_name)\n self.class.has_one.include? method_name\n end", "title": "" }, { "docid": "55a8025c82814774c8a240fb9ab7ca99", "score": "0.7305342", "text": "def association? mod...
93c59bf31a34b3708a0ed9c4d1cb37db
TODO: Rename action to mapping and refactor the _action case statement. ++
[ { "docid": "a592f9b0f5a35961b17c1962d9c739a3", "score": "0.0", "text": "def can?(action, resource, options = {})\n\n # Sometimes we are getting a Class, so we need to convert it\n # to string.\n resource = resource.to_s\n\n return false if !resources.include?(resource)\n ...
[ { "docid": "c40551ad7784fb76f10fff517c4cf5a7", "score": "0.7426733", "text": "def map_action(dict)\n map :action, dict\n end", "title": "" }, { "docid": "ba90b127ec9002374752b9acadb8616b", "score": "0.7360105", "text": "def map_api_action(requested_action) #:doc:\n r...
5cbe01dca9006073af8df1850fcef3f2
Breakfast, Lunch, or Dinner? (Part 6) What will the following code print? Why? Don't run it until you've attempted to answer.
[ { "docid": "3257424a648dd289142c0aa81a189804", "score": "0.0", "text": "def count_sheep\n\t5.times do |sheep|\n\t puts sheep\n\tend\nend", "title": "" } ]
[ { "docid": "da3f156aa3832eb73195b8bc12ceea65", "score": "0.68587655", "text": "def tell_fortune()\r\n\t\tprint \"The answer is \" + $predicition + \". \\n\\n: \"\r\n\tend", "title": "" }, { "docid": "c21f053d008bcef9c8e8e7a250cbfed8", "score": "0.6802448", "text": "def explain_game\n...
8da8f0a645ced4ba47de19dc4fc7555e
Reduce a rectangle of pixels to a single pixel so we can find out the average black or whiteness of it. image:: ImageId of the image in question xpos, ypos, width, height:: Coords of the rectangle
[ { "docid": "138713944becaf5d95cbd861991fb130", "score": "0.60374177", "text": "def shrink_to_one image, xpos, ypos, width, height\n# if @intermediate_images\n# tmp_image = \"vo-#{xpos}-#{ypos}\".to_sym\n# copy_subimage image, xpos, ypos, width, height, tmp_image\n# d_write_image(tmp_im...
[ { "docid": "2f9ff3093e82e968ea1b4610f87065ea", "score": "0.62054116", "text": "def optimized_image(image,x,y)\n return image.variant(resize_to_fill: [x,y]).processed\n end", "title": "" }, { "docid": "e07350cf3db989dd9d7b43ff7e9d476f", "score": "0.582906", "text": "def enhance_im...
2fe164526e13b6409e6b954ce0ce480c
Returns true if the file record contains any services which need to be run
[ { "docid": "c943fbd9279bfd294245a2d5ec36d00b", "score": "0.7520488", "text": "def needs_run?(file_rec)\n md_rec = file_rec.metadata_record\n storage_loc = file_rec.storage_location\n service_manager = @app_config.service_manager\n\n # File is not a valid candidate for services if it ...
[ { "docid": "28e3128873c542f0ae4cf91482986703", "score": "0.67144334", "text": "def service_running?(service)\n !service[\"Service\"][\"Status\"].nil? && service[\"Service\"][\"Status\"] == 4\n end", "title": "" }, { "docid": "62df6db90c8130a73572b51084e5160f", "score": "0.6663120...
c2e56c79672519d5f60b38189f655b11
Gets the total exp plus extra
[ { "docid": "ab82d6c13f4ea79f4f185d035ff3ce3a", "score": "0.8171573", "text": "def exp_total\n [h87_d_exp_total + @extra_exp, 0].max\n end", "title": "" } ]
[ { "docid": "15b531d7df7861d06214cb6f774a9182", "score": "0.74891216", "text": "def total_exp\n @minion + @creep + @structure + @hero + @trickle\n end", "title": "" }, { "docid": "a520ee1350f0f24c537ae26adfb3c873", "score": "0.6674053", "text": "def total_expenses\n self.dig_fo...
cc0b156fb5539c96b258ed0cd3a910a2
Verify the host is resolvable
[ { "docid": "2e5a784dd0875b2b5a298c50e417be23", "score": "0.7343679", "text": "def hibp_resolvable?\n begin\n Rex::Socket.resolv_to_dotted(\"haveibeenpwned.com\")\n rescue RuntimeError, SocketError\n return false\n end\n\n true\n end", "title": "" } ]
[ { "docid": "2bcf2c1ca1ea2915a4c4d80285ff3747", "score": "0.8332332", "text": "def is_resolvable(host=self.host)\n begin\n Resolv.getaddress(host.hostname)\n true\n rescue Resolv::ResolvError\n false\n end\n end", "title": "" }, { "docid": ...
5fe3a6a67276d5332008c10765b318ed
The default log format.
[ { "docid": "7fa724cb713cd600f1583c5d9552cb6d", "score": "0.0", "text": "def default(options = T.unsafe(nil)); end", "title": "" } ]
[ { "docid": "0a5df103da3c021585b08f857192f3d6", "score": "0.8049831", "text": "def log_format\n if configuration.log_format.nil? || configuration.log_format.empty?\n format = '%{KIND}: %{message} on line %{line}'\n format.prepend('%{path} - ') if configuration.with_filename\n format.con...
d11fbee2af75c28cd68953ce100663ee
Todo: Add description for test test_boolean_in_exception
[ { "docid": "688e166d593e7f959bd741c7bc544352", "score": "0.72476125", "text": "def test_boolean_in_exception()\n\n # Perform the API call through the SDK function\n assert_raises('ExceptionWithBooleanException'){ \n result = @controller.boolean_in_exception()\n }\n\n # Test response cod...
[ { "docid": "e5a97bfb3b9c5323060b6405db418b57", "score": "0.74924177", "text": "def test_boolean_in_exception()\r\n\r\n # Perform the API call through the SDK function\r\n assert_raise('ExceptionWithBooleanException'){ \r\n result = self.class.controller.get_boolean_in_exception()\r\n }\r\n...
e7eb0f6c72461be83041f4c95027021a
Spawns a subprocess to monitor the parent. The watchdog process' parent is the original parent. The watchdog works by waiting for a pipe also held by the parent to break. When it does, it will issue a signal to the child process.
[ { "docid": "c628b904153271a349341cd11f0f9caf", "score": "0.7275031", "text": "def spawn_watchdog_process\n Process.fork do\n # If we don't close the write end, the read might never end since the OS doesn't\n # generate EOFs if there is a write end still open. We use EOF to signal a failure\...
[ { "docid": "92bbcf87e21168c359413f83daf3c845", "score": "0.7437609", "text": "def fork(&block)\n raise RuntimeError, \"already in use\" unless @pid.nil?\n @pid = Process.fork do\n # The child doesn't need the pipe, and leaving it open\n # will keep the pipe alive even after the parent di...
7213b5a7ccb762ba5417762bd0329d14
PUT /store_categories/1 PUT /store_categories/1.json
[ { "docid": "ea3c677bd05f1d1aa503b572e017ce5a", "score": "0.69621474", "text": "def update\n @store_category = StoreCategory.find(params[:id])\n\n respond_to do |format|\n if @store_category.update_attributes(params[:store_category])\n format.html { redirect_to api_v1_store_category_pat...
[ { "docid": "92b0ced024af9702675ff24c01775602", "score": "0.6833846", "text": "def update\n @category = Category.find(params[:category_id])\n @store = @category.stores.find(params[:id])\n @store.update(store_params)\n redirect_to category_path(@category)\n end", "title": "" }, { ...