query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
89dd4a6d4880b16ceb5cd4039d21a672
has a table of spaces; that table has n bookings
[ { "docid": "b6885dfd3031d0a8acf5799e83f4b23f", "score": "0.0", "text": "def password=(password)\n @password = password\n self.password_digest = BCrypt::Password.create(password)\n end", "title": "" } ]
[ { "docid": "8d946df62693440c7f22d8e8c588d6d3", "score": "0.63531685", "text": "def initialize\n @spaces = spaces\n @occupied_spaces = []\n end", "title": "" }, { "docid": "8604caa755061c30ccabe1a8fe45ced2", "score": "0.6171122", "text": "def create_table \n @grid = []\n ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "a88d240e6768e14c63a0b74869aba484", "score": "0.0", "text": "def adopted_pet_params\n params.require(:adopted_pet).permit(:pet_id)\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...
c3478621ccd1079f463b346789561a0c
GET /order_billings/1 GET /order_billings/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "00c18d15b065b149ffca5a71f8c57a14", "score": "0.7305747", "text": "def index\n @order_billings = OrderBilling.all\n end", "title": "" }, { "docid": "c2b3dc47880fd337f1d4303284946422", "score": "0.7265807", "text": "def index\n @billings = Billing.all\n\n respond_...
c4b10e54c843022cc450c5ae854825dd
GET /repairs/1 GET /repairs/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "01e3309013b7b5ac618da512b5ca2145", "score": "0.65849", "text": "def index\n @repairs = Repair.all\n end", "title": "" }, { "docid": "01e3309013b7b5ac618da512b5ca2145", "score": "0.65849", "text": "def index\n @repairs = Repair.all\n end", "title": "" }, { ...
2c2f3476d62ce0a3ef10f1331d92c9e3
PUT /user_certifications/1 PUT /user_certifications/1.json
[ { "docid": "b2d6224b91bd7433f3659667a91e922d", "score": "0.62301564", "text": "def update\n #Log who updated this\n @user_certification.updated_by = current_user.id\n\n respond_to do |format|\n if @user_certification.update_attributes(params[:user_certification])\n format.html { red...
[ { "docid": "5976ee470be332bce7890b75d9692f86", "score": "0.69521624", "text": "def update\n @concertsuser = ConcertsUser.find(params[:id])\n\n respond_to do |format|\n if @concertsuser.update_attributes(params[:concertsuser])\n format.json { head :no_content }\n else\n form...
62f69ac3ee8da9df9291483a89e19e54
Retrieves an array of title string names that can be used for both report titles (and subtitles) or as base names of any output file created with the data associated with this row instance. The array contains any header description characterizing this row instances, in the form: [ header_description_1, header_descripti...
[ { "docid": "bec5b310ef8e79209825636836b31dd8", "score": "0.674899", "text": "def get_title_names\n [\n self.get_verbose_name,\n ( self.firm ? self.firm.get_full_name.split(' ')[0] : '' )\n ]\n end", "title": "" } ]
[ { "docid": "5b87b9ed274c2f28bb22d0b744812e48", "score": "0.7158544", "text": "def title\n value = @metadata[\"title\"] || \"Unknown Title\"\n Array.wrap(value)\n end", "title": "" }, { "docid": "43f42b2e5079aa740e423c9c9c335283", "score": "0.7027044", "text": "def title_like_f...
a7b59463c7844089a92003ffecc3f842
DELETE /blog_posts/1 DELETE /blog_posts/1.json
[ { "docid": "d5c6a0925b7e54c06f55a2f9fccb407a", "score": "0.7359257", "text": "def destroy\n @blog_post.destroy\n respond_to do |format|\n format.html { redirect_to blog_posts_url, notice: 'Blog post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "...
[ { "docid": "69039e3293e7b17fa4936a2a8a76d0fa", "score": "0.7682314", "text": "def destroy\n @blog_post = Blog::Post.find(params[:id])\n @blog_post.destroy\n\n respond_to do |format|\n format.html { redirect_to blog_posts_url }\n format.json { head :ok }\n end\n end", "title": ...
529bc836622bb546fa769460f7a5a9cb
GET /transaccions GET /transaccions.json
[ { "docid": "3a4b82c88a1290cd38ad978956dd20ba", "score": "0.73512834", "text": "def index\n @transaccions = Transaccion.all\n end", "title": "" } ]
[ { "docid": "6c8d0bb89b3254ce41f23ee95c5e6976", "score": "0.7060113", "text": "def index\n json_response(@transactable.transactions)\n end", "title": "" }, { "docid": "16618b6b7b465feeca0755917bec5116", "score": "0.6972667", "text": "def index\n @transits = current_user.transit...
fca88d1b2a00e0211c0545cf5ce2771f
GET /depoimentos/1 GET /depoimentos/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "a19c112ab83a509d10e657d00424e869", "score": "0.6974344", "text": "def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end", "title": "" }, { "docid": "50f004abe06fe9590f83172afdecbe07", "score": "0.68598425", "text": "def index\n logem...
aef3fc844cd63a73713fc1a3d581ff3b
PATCH/PUT /woodensofasets/1 PATCH/PUT /woodensofasets/1.json
[ { "docid": "e253d9e8bdef245e8ef3938274f1a82d", "score": "0.6719149", "text": "def update\n respond_to do |format|\n if @woodensofaset.update(woodensofaset_params)\n format.html { redirect_to @woodensofaset, notice: 'Woodensofaset was successfully updated.' }\n format.json { render ...
[ { "docid": "0a7f39244b84a933f5e2778f23a356bd", "score": "0.6213237", "text": "def update\n @set.update_attributes({ :data => params[:data] })\n render_json :entry => @set and return\n end", "title": "" }, { "docid": "0a7f39244b84a933f5e2778f23a356bd", "score": "0.6213237", "te...
5615d06154ed7e56d554d19896016af7
GET /level2s/1 GET /level2s/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "6a747da08eb321814f91c3461fe72a78", "score": "0.7216145", "text": "def index\n @level2s = Level2.all\n end", "title": "" }, { "docid": "19ff33ce6added283ab66d6d3a88a2a6", "score": "0.6761445", "text": "def set_level2\n @level2 = Level2.find(params[:id])\n end",...
5f21af8cc723a82244669c34d58caef4
given a parsed json object for products, build it into array of Products
[ { "docid": "2de47e4a16bdd29c561c0991239c811f", "score": "0.83007497", "text": "def buildProducts(productObject)\n\n retArray = Array.new\n # iterate over every product json object and parse it into Product class, then add it to the returned array\n productObject.each do |obj|\n new_product = Produ...
[ { "docid": "22fa9ddee587d3d179774e4bb3e6a705", "score": "0.73726374", "text": "def get_products\n products = response['products']\n products_ops = []\n products.each_value do |value|\n product = {}\n product[:sku] = value['sku']\n product[:product_family] = value['productFamily']...
2c57de0389d8a03cda382dfc9b8920af
Daten in PIA schreiben
[ { "docid": "470be24697e030bea2aa63b2413ac30e", "score": "0.0", "text": "def writeItem(app, repo_url, item)\n headers = defaultHeaders(app[\"token\"])\n data = item.to_json\n response = HTTParty.post(repo_url,\n headers: headers,\n body: data)\n res...
[ { "docid": "877aabdf9f1b1b8f4bb3ccc9b4c0c14e", "score": "0.60863656", "text": "def apdata\n \"#{name_rus}, #{iata_code}, г.#{city_rus} (#{city_eng})\"\n end", "title": "" }, { "docid": "e1892c7a78665eb95c4bb4fd8db76aae", "score": "0.60133815", "text": "def get_data()\t\n\tend", ...
90712335c2493451d00ef2d0a91535a5
Get the count of matching documents in the database for the context.
[ { "docid": "4a54226d4a81fcb1f113a894b52532c0", "score": "0.6350005", "text": "def count(extras = false)\n @count ||= klass.collection.find(selector, process_options).count(extras)\n end", "title": "" } ]
[ { "docid": "af78838943eb6fe9cb931fdee69b7777", "score": "0.7231576", "text": "def count\n @count ||= documents.size\n end", "title": "" }, { "docid": "7884bd9089a9ef605e8e8fdf94fbaf97", "score": "0.7209511", "text": "def count\n @documents.count\n end", "title...
255e86542a6bbdae6b7aaa5b15b4e1ac
type instructions and helpers
[ { "docid": "a00d5ed4c60e77b28a4b1234b8dc7438", "score": "0.0", "text": "def recognized_ruby?(item)\n @@classes_to_types.keys.include? item.class\n end", "title": "" } ]
[ { "docid": "96ca88000e5833df84c7789fdd95a14c", "score": "0.79807335", "text": "def type() end", "title": "" }, { "docid": "00541c6dbb230b94bc811e6e49025b0a", "score": "0.79800713", "text": "def type(type); end", "title": "" }, { "docid": "f35a829e821b6fc3c8d2bfb9a1e9a435"...
facdb05b8ef2a4453ea9477fd121a2e3
error message from middleware Rack flagged as params[:bad_request]?
[ { "docid": "631e51c5312910ab05ac2f880b43962b", "score": "0.77858675", "text": "def bad_request?\n if params and params[:bad_request].present?\n logger.error \"bad request! \\\"#{params[:bad_request]}\\\"\"\n flash[:error] = CGI.unescape(params[:bad_request])\n render \"static_pages/bad...
[ { "docid": "55e7bc7895134ae07263a0e90301864e", "score": "0.78054863", "text": "def bad_request(body = nil)\n error Rack::Utils.status_code(:bad_request), body\n end", "title": "" }, { "docid": "3d6691419038540a4b83024e6f3908aa", "score": "0.76191515", "text": "def bad_req...
1640386ae6896a609b3e93c32f736aa4
GET /imagenes GET /imagenes.json
[ { "docid": "34b25d85d99cae1a4c8c17f233ae516a", "score": "0.0", "text": "def index\n @coleccion = Imagen.all\n end", "title": "" } ]
[ { "docid": "19352b0ec7b2c1ccc553453cd1f108c8", "score": "0.70525575", "text": "def show\n @proyecto_imagen = ProyectoImagen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proyecto_imagen }\n end\n end", "title": "" }, ...
6671f306782358a162ae0a2f773940eb
get token from s3
[ { "docid": "f99f5f9395de10be52f9ec2339514081", "score": "0.6514484", "text": "def get_token\n key = File.join( @bucket_prefix, @cluster + \".json\" )\n object = @bucket.object(key)\n @retries.times do |x|\n break if object.exists?\n\n puts \"No ...
[ { "docid": "bde793e799900b328e78227db6c6403b", "score": "0.72426254", "text": "def s3_access_token\n render json: {\n policy: s3_upload_policy,\n signature: s3_upload_signature,\n key: 'add_secret_keys'\n }\n end", "title": "" }, { "docid": "8bfcc0e81fc271849b7...
4c02f222a26546bb4180bbe83e1b4b5e
validates :user, presence: true
[ { "docid": "e729e17fe98cd555e90024307a5dcaa8", "score": "0.0", "text": "def birth_date_cannot_be_in_the_future\n if birthdate.present? && birthdate >= Date.today\n errors.add(:birthdate, \"Can't be in the future\")\n end\n end", "title": "" } ]
[ { "docid": "e7ab6921216e4dc07c953419867c193e", "score": "0.8161215", "text": "def validate_user \n errors.add(:user_id, 'user not presence') if User.find_by_id( self[:user_id] ) == nil\n end", "title": "" }, { "docid": "fa763065832d83b161b6f06c1b731dcd", "score": "0.8109943", "te...
b99fbf84c9ce68f0686cc6f5d038b2b1
present destroy controls, destroy and present the status
[ { "docid": "dddb6d1c7c559877f3ed6e66ff63e28d", "score": "0.0", "text": "def destroy\n if @note\n @parent = @note.get_parent if @note\n @note.destroy\n redirect_to :url => \"/\" if !@parent\n redirect_to :url => @parent.relative_url if @parent\n end\n end", "title": "" } ...
[ { "docid": "fd6953069ba981dbc2491ce213547650", "score": "0.62896353", "text": "def status_return\n @slot_window.unselect\n @status_window.activate\n @help_window.clear\n set_controls_help\n end", "title": "" }, { "docid": "409e7fe4c4a5e30bf3f05d2785895876", "score": "0.62348...
113746c1781b0d7a62ba6dea1178b2df
Checks whether the value of the predicate matches the expected value. If the value looks like an RSpec matcher (it responds to :matches?), runs value.matches?(); otherwise checks for equality using :==.
[ { "docid": "b2be1f7f988a705a2ba6899fa83675d3", "score": "0.80875635", "text": "def matches_predicate_value?\n return false unless responds_to_predicate?\n return true unless @value_set\n\n actual_value = @actual.send(:\"#{@expected}?\")\n\n @matches_predicate_value = (@value.respond...
[ { "docid": "9e3f22310143fc5c18909c735278a29c", "score": "0.7377091", "text": "def matches?(actual)\n expected_value.equal?(actual)\n end", "title": "" }, { "docid": "c4da0c38b1866af742a90c72851734ae", "score": "0.7074295", "text": "def ===(value)\n predicate.call(value...
da093f2ba3c1031d0b2a6809b1fd4106
your Access Denied processor
[ { "docid": "05a15806914c137027353b8b6e29bea7", "score": "0.0", "text": "def access_denied\n return render(text: 'access_denied: requires a role')\n end", "title": "" } ]
[ { "docid": "93880e9b00e074f195a89699e5747c71", "score": "0.7508013", "text": "def access_denied\n end", "title": "" }, { "docid": "dd858b375b764d3dd56581b0561cb6d9", "score": "0.7258883", "text": "def denied\r\n handle_permission_denied\r\n end", "title": "" }, { "do...
9331a0780f793d7c4af6e13aa17b6237
Generates a list of School objects from a list of abbreviations or names, raising an error if any doesn't exist. TODO: better name
[ { "docid": "0974fd39318a9eab79d15d53ff3db87f", "score": "0.74149185", "text": "def school_list(abbrs)\n abbrs.map { |abbr|\n s = school(abbr)\n if s.nil?\n Err.nonexistent_school(abbr)\n end\n s\n }\n end", "title": "" } ]
[ { "docid": "5c45034b2f1a15eca419f1644feef4f1", "score": "0.60543317", "text": "def schools(school_code = nil)\n data = get_data(\"api/v2/schools/#{school_code}\")\n if school_code.nil?\n models = []\n data.each do |school_data|\n models << AeriesNetApi::Models::School.ne...
5533ca86d6dec56ae2e262a70e594f4c
% store ; k' v'
[ { "docid": "12c41cace6cd14f46229afbc37b3740c", "score": "0.5608434", "text": "def store(p0, p1) end", "title": "" } ]
[ { "docid": "5837aa395df2bdbc7dd97fbd3f9dd174", "score": "0.6467972", "text": "def []= k,v\n\t set k,v\n\t end", "title": "" }, { "docid": "b9bea012a9b3428f32420ae6881b1b20", "score": "0.6296167", "text": "def iv=(v); end", "title": "" }, { "docid": "e5068f1037748cb5b0...
840769d041d44b813b4e55856bed7e82
GET /lines/new GET /lines/new.json
[ { "docid": "4cddf732f347521182d5d8b6461f8d86", "score": "0.7334628", "text": "def new\n @line = Line.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line }\n end\n end", "title": "" } ]
[ { "docid": "6314121ab19bc04234f04747139eaafd", "score": "0.6948659", "text": "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { }\n end\n end", "title": "" }, { "docid": "292e4d6a72500022ec7275696a3c072e", "sco...
66d99e2a6440ba049c1a2fe9044513b1
PUT /expression_relationship_types/1 PUT /expression_relationship_types/1.json
[ { "docid": "0d550fd5494f01f45296ae61a277b15c", "score": "0.72294927", "text": "def update\n @expression_relationship_type = ExpressionRelationshipType.find(params[:id])\n\n respond_to do |format|\n if @expression_relationship_type.update_attributes(params[:expression_relationship_type])\n ...
[ { "docid": "cc8b4d9d0ec8b0d3d1e3cdeded52bffa", "score": "0.66205823", "text": "def set_RelationshipType(value)\n set_input(\"RelationshipType\", value)\n end", "title": "" }, { "docid": "2e7354fede50f2195d344e84a8350381", "score": "0.6163917", "text": "def replace_to_...
1e7997ed0d9db1f33b49137c86b74f04
GET /transaction_histories GET /transaction_histories.json
[ { "docid": "b17c7ec8697df13858414836debac0b6", "score": "0.6357539", "text": "def index\n @transaction_histories = TransactionHistory.all\n if !params[:type].nil? && params[:type] != \"\"\n @transaction_histories = @transaction_histories.where(trans_type: params[:type].to_i)\n end\n if ...
[ { "docid": "1eebd7ddc5f642abb0b92b577621a307", "score": "0.74932265", "text": "def index\n @settlement_histories = Settlement::History.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @settlement_histories }\n end\n end", "title": "" },...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "7bce9cddf0eb3361c5ef86c7af02baec", "score": "0.0", "text": "def set_feedback\n @feedback = Feedback.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...
99188044b757e87e9fffd84a6702426e
Returns a build type based on the product version
[ { "docid": "5d4d32fae324f107cd8843728d3187f2", "score": "0.84270513", "text": "def get_build_type(site, product_id, product_version)\n if is_nightly_version(product_version)\n return :nightly\n elsif is_unreleased_version(site, product_id, product_version)\n return :unrel...
[ { "docid": "b092384a429ab23da23dfc1c16717952", "score": "0.84651285", "text": "def get_build_type(site, product_id, product_version)\n if is_stable_version(product_version)\n return :stable\n elsif is_nightly_version(product_version)\n return :nightly\n else\n ...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "ee48235f66284758edd05781042bc06b", "score": "0.0", "text": "def location_params\n params.permit(:latitude, :longitude, :device)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7943618", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.69572574", "text": "def permitted_params\n params.permit!\n end", "title"...
a3b5401204daff568395cb60915bf4a7
Uploads a malicious file and then execute it
[ { "docid": "cb23f01e431a30aab1ed744608d86dd0", "score": "0.73734355", "text": "def upload_exec(sid, filename, malicious_file)\r\n res = upload_file(sid, filename, malicious_file)\r\n\r\n if !res\r\n fail_with(Failure::Unknown, 'The connection timed out while uploading the malicious file.')\r\...
[ { "docid": "52794bb6d29f6c31feeb9f27c4fb42df", "score": "0.7666763", "text": "def exploit\r\n upload\r\n exec\r\n end", "title": "" }, { "docid": "ec9aba2c7db765793537f430947d33c9", "score": "0.70592827", "text": "def exploit\n cookie = login(datastore['USERNAME'], datastor...
d4c06a68ef0e4027a68a8329f314a824
return self in ASCII8BIT
[ { "docid": "3f1a0ab56b92068f196e7bab7428fa08", "score": "0.7612197", "text": "def to_ascii; convert_format(UTF8, ASCII8BIT);end", "title": "" } ]
[ { "docid": "6976cc89fcb6249de174dd147415df3f", "score": "0.7473333", "text": "def to_utf8; convert_format(ASCII8BIT, UTF8); end", "title": "" }, { "docid": "ccd553193491f31e014672a6a4d79f85", "score": "0.7358924", "text": "def utf8\n self.encode('UTF-8', 'binary', :invalid => :rep...
aa55e2e3bd15f7662e8431cd88dd1dd7
We check that the user that is about to edit/update a profile is the owner
[ { "docid": "55b9b799cf41fadd4e89039da26b78c7", "score": "0.0", "text": "def verify_id!\n authenticate_user!\n unless (@empresa.user == current_user)\n redirect_to root_path, alert: \"No eres el propietario de esta empresa y no puedes editarla.\"\n end\n end", "title"...
[ { "docid": "3ac671011fd36aacc025ce6c8510a59b", "score": "0.7578384", "text": "def owner? usr\n user_id == usr.id\n end", "title": "" }, { "docid": "d965997247bd06af839a7e73b59143ad", "score": "0.75407994", "text": "def is_owner?(user)\n user.id == self.user_id\n end", "ti...
1a609d8fe51da15894126e853f93a118
Reorders the instances keeping the order returned from Solr
[ { "docid": "d84eb8bb68950cb9713ecacad2b17e62", "score": "0.62204975", "text": "def reorder(things, ids)\n ordered_things = []\n ids.each do |id|\n record = things.find {|thing| record_id(thing).to_s == id.to_s}\n raise \"Out of sync! The id #{id} is in the Solr index but missing ...
[ { "docid": "13dea585061b2a17598f86594d085d46", "score": "0.65129244", "text": "def reorder(things, ids)\n ordered_things = []\n ids.each do |id|\n record = things.select {|thing| @model.record_id(thing).to_s == id.to_s} \n #raise \"Out of sync! The id #{id} is in the Solr...
6090ccecad2634a5eeb3184407e21ad2
GET /available_offs/1 GET /available_offs/1.xml
[ { "docid": "a806c6047cc780116276d32305618991", "score": "0.6897177", "text": "def show\n @available_off = AvailableOff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @available_off }\n end\n end", "title": "" } ]
[ { "docid": "aa8d4614b74b8bb2440463bdb44f815a", "score": "0.64473295", "text": "def index\n @available_offs=current_employee.available_offs\n if @available_offs\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @available_offs } \n e...
8258b3b6e36d29ceb02627f1fe5856a1
Devuelve el porcentaje de proteinas en el plato
[ { "docid": "2f668e320b15186d618355f4c08688b1", "score": "0.7305838", "text": "def porcentaje_proteinas\n\n\t\tacc_proteinas = 0\n\n\t\tlista_alimentos.each do |alimento|\n\t\t\tif alimento.instance_of? Alimento\n\t\t\t\tacc_proteinas += alimento.proteinas\n\t\t\telse\n\t\t\t\traise TypeError, \"Uno de l...
[ { "docid": "3ec5db5efb5fdc1d68142af439036fcc", "score": "0.76020855", "text": "def por_proteinas\n\t\ttotal_proteinas = @alimentos.get_proteinas\n\t\ttotal_nutrientes = @alimentos.get_nutrientes\n\t\tporcentaje_proteinas = (total_proteinas * 100) /total_nutrientes\n\t\treturn porcentaje_proteinas\n ...
4fb8295dbe6158b83b81cac38f7920dc
Allow a seller to populate houses table with address, price and area Display locations table, prompt for area input by key
[ { "docid": "925f9c0eb2717ef92323c8549ebc2de0", "score": "0.6393668", "text": "def update_houses(db)\r\n\r\n puts \"Please enter the address of the home you wish to sell:\"\r\n address = gets.chomp.upcase\r\n\r\n # If there's no existing record, prompt for remaining information.\r\n if (house = db.ex...
[ { "docid": "bbba39fb2c604bbf04ba61ea8c2d25bd", "score": "0.61736196", "text": "def area_codes\n phone_book = {\n loveland: \"970\",\n denver: \"303\",\n alliance: \"308\",\n magic: \"555\",\n another: \"111\",\n one_more: \"222\"\n }\n \n puts \"Welcome to the Happy Times and Beers...
61c89fe86fa279e1cc341a74a40b358d
Deserializes the data based on type
[ { "docid": "039861fef0447302267092270e325c9c", "score": "0.0", "text": "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i...
[ { "docid": "8310779c7783e884ba8c96184c4c100f", "score": "0.7330926", "text": "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n valu...
0c8216b4e5b8f85dbf7249e3edd28f24
Creates a 1D Image in the Context ==== Attributes +format+ an ImageFormat +width+ width of the image ==== Options +:flags+ a single or an Array of :cl_mem_flags specifying the flags to be used when creating the Buffer +:host_ptr+ if provided, the Pointer (or convertible to Pointer using to_ptr) to the memory area to us...
[ { "docid": "7ddf65b26855d9538580511d17e48312", "score": "0.7659536", "text": "def create_image_1d( format, width, options = {} )\n return OpenCL.create_image_1d( self, format, width, options )\n end", "title": "" } ]
[ { "docid": "3b3574243ec9a1645cd05e7aefca6c23", "score": "0.68220633", "text": "def createImage(context, flags, image_format, image_desc, host_ptr = nil, error_info: nil)\n context = context.handle if context.kind_of? CLUContext\n errcode_ret_buf = ' ' * 4\n\n mem = OpenCL.clCreateImage(context,...
1f7f4ca097ba817e90f9d4d8c2682bf3
The last error reported by the backend.
[ { "docid": "94b7a1738540697d1b15191d60f144e3", "score": "0.8449438", "text": "def err\n @backend.lasterr\n end", "title": "" } ]
[ { "docid": "eba99e2111697fdc9b321d4f3c0d30cd", "score": "0.84420127", "text": "def last_error\n @error\n end", "title": "" }, { "docid": "63c514aa2b075904cdfc159bbeb9cf2b", "score": "0.82276386", "text": "def last_error\n talk('GET-LAST-ERROR')\n end", "title": "" }...
4e272b7a1f8cf4fa5ed53c24cf306d24
returns the Human readable name of a file
[ { "docid": "b09638423a8a106c210e6505f8f0c63b", "score": "0.0", "text": "def [](file_path_key)\n @manifest[file_path_key]\n end", "title": "" } ]
[ { "docid": "a8dabccf505278eb45344d43ac48d4ad", "score": "0.77599174", "text": "def name\n self.class.canonicalize_filename(filename)\n end", "title": "" }, { "docid": "f983af122ae6b34ae5a7dbe86e4699de", "score": "0.7754951", "text": "def file_name; file end", "title": "" ...
8bed6354b73fe49896a7928b3834c369
Returns true if self array contains no elements.
[ { "docid": "98e67c295393abe1bcca14255b436d69", "score": "0.76273125", "text": "def empty?\n return self.size == 0\n end", "title": "" } ]
[ { "docid": "94639704cb89217968eb7c1db26d4d03", "score": "0.8516655", "text": "def empty?()\n return @array.empty?()\n end", "title": "" }, { "docid": "184c94bbda0a2f0c5e30160e3a445f06", "score": "0.8449491", "text": "def empty?\n return true if @arr.count.zero?\n false\...
e12e49a0ad5bc314168c74dfd75bdc62
Time Complexity: O(n log n) Space Complexity: O(n)
[ { "docid": "7917901b4634a83124d08a5ab1f8ecee", "score": "0.0", "text": "def heap_sort(list)\n heap_list = MinHeap.new\n result = []\n\n list.each do |num|\n heap_list.add(num)\n end\n \n i = 0\n while i < list.length\n removed = heap_list.remove() \n result[i] = removed\n puts \"#{res...
[ { "docid": "27f29666484272c0d973e8400c4c357c", "score": "0.6572491", "text": "def hash_two_sum?(arr, num)\n hash = Hash.new(0) #O(1) work\n arr.each do |ele| # N times\n return true if hash.has_key?(num - ele) # O(1) work\n hash[ele]+= 1 # O(1) work\n end\n false\nend", "ti...
4d42caf6f8dd8036b22886cbf1292bd3
PATCH/PUT /postharvest_structure_and_facility_typologies/1 PATCH/PUT /postharvest_structure_and_facility_typologies/1.json
[ { "docid": "335133df9380b727a7ecf4b61dee16e8", "score": "0.710674", "text": "def update\n respond_to do |format|\n if @postharvest_structure_and_facility_typology.update(postharvest_structure_and_facility_typology_params)\n format.html { redirect_to @postharvest_structure_and_facility_typ...
[ { "docid": "684e2dd606b8e7bdd8850b9422e8d0b5", "score": "0.6665363", "text": "def update\n respond_to do |format|\n if @postharvest_equipment_and_machinery_typology.update(postharvest_equipment_and_machinery_typology_params)\n format.html { redirect_to @postharvest_equipment_and_machinery...
0d0b7e1dab542e0e519255ef65b1ec5e
between 1 and the number Computes the sum of all the selected numbers Input: Number Output: Number Steps: => Define a method with 1 number as the argument =>initialize a results array => itterate from 1..number => check if current itteration number % 3 == 0 => append number to new array => check if current itteration n...
[ { "docid": "57e6b6503e72bacc8b37c0cb0f47b381", "score": "0.7115955", "text": "def multisum(num)\n result_arr = []\n \n (1..num).to_a.each do |current_num|\n if current_num % 3 == 0\n result_arr << current_num\n elsif current_num % 5 == 0\n result_arr << current_num\n end\n end\n ...
[ { "docid": "2331042dc8bb45a18907f85a1572e5f4", "score": "0.7825355", "text": "def solution(number)\n array = []\n (0...number).each do |num|\n if num % 3 == 0\n array << num\n elsif num % 5 == 0\n array << num\n end\n end\n array.uniq!\n return array.sum\nend", "title": "" ...
4ae8cbc1304b9626115248dd6212331a
So we can stub out mail sending for tests...
[ { "docid": "623f75e2cb599ce09c6201e3443741bf", "score": "0.0", "text": "def send_mail(payload, args)\n Pony.mail(args)\n end", "title": "" } ]
[ { "docid": "ab36545d6497686f7e54b4c817ab49ec", "score": "0.75519043", "text": "def testmail(recipient, subject, message, body, sent_at = Time.now)\n do_contact(recipient, subject, message, body, sent_at = Time.now)\n\n end", "title": "" }, { "docid": "d7465313f04d55e4ec98a0c9a5863c32",...
0648bc7098936c2b0093c3cbdb7c8154
exposed!, could be read only on the way to refactoring tests....(reduce calls to the method point_to, othrwise reader would be fine )
[ { "docid": "37a75b2ec49b2f15abd974ec279b34af", "score": "0.0", "text": "def initialize(server, receiver)\n @server = server\n @receiver = receiver\n @points_won = []\n end", "title": "" } ]
[ { "docid": "74bf6b9d376b91a7a68a028a9947a4f4", "score": "0.65299845", "text": "def expose; end", "title": "" }, { "docid": "03d48d71109745c6978b1bff77712bb2", "score": "0.6372953", "text": "def expose=(_arg0); end", "title": "" }, { "docid": "44ecfd9c33acd49bb38712e81ecdc...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "dd183566ab8c38acb9a96c3bed616010", "score": "0.0", "text": "def response_params\n base = [:request_id, :quantity, :supplier_observation, :unit_price_supplier,\n :localisation_supplier, :incoterm]\n params.require(:response).permit(base)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7943618", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.69572574", "text": "def permitted_params\n params.permit!\n end", "title"...
aa6851d878156db7cb666d28bdec6604
Set the default collision function. This block will be called whenever an unhandled collision pair is found. The default behavior is to accept all collisions, passing no block or _&nil_ will reject all collisions by default. Add the given shape to the space's active spatial hash. Shapes attached to moving bodies should...
[ { "docid": "174a8625d86673f68986ce30550b1942", "score": "0.4737128", "text": "def add_shape(shape); end", "title": "" } ]
[ { "docid": "1187f2ffcae573685b4551ca02c277b4", "score": "0.6734615", "text": "def set_default_collision_func(&block); end", "title": "" }, { "docid": "1187f2ffcae573685b4551ca02c277b4", "score": "0.6734615", "text": "def set_default_collision_func(&block); end", "title": "" }, ...
7acc22b62105fe35fb8cd3c27bf93715
GET /nominations GET /nominations.json GET /nominations[.json]?institution=1
[ { "docid": "3c762ea9df80cd7084df30f47c722d4a", "score": "0.70479715", "text": "def index\n if params[\"sort\"]\n @sort_params = params[\"sort\"]\n @nominations = @nominations.sorted_by(params[\"sort\"])\n else\n @sort_params = \"name asc\"\n @nominations = @nominations.order(na...
[ { "docid": "9981e91eacff0b8ac2e49e446aec7804", "score": "0.6608098", "text": "def index\n @nominations = Nomination.all\n end", "title": "" }, { "docid": "767d7d5679e904652cbed550c5e70397", "score": "0.648623", "text": "def show\n @institution = Institution.find(params[:id])\n...
5a759d926272edc8d536eb135a185a19
Enter address information on an address form. === Parameters: _first_name_:: text entered into the first name text box _last_name_:: text entered into the last name text box address1:: text entered into the address 1 text box _city_:: text entered into the city text box _state_province_:: value selected from the state/...
[ { "docid": "8c1e1b9f48ca3ec289e3d0c523b90a90", "score": "0.78236985", "text": "def enter_address(first_name, last_name, address1, city, state_province, zip_postal_code, phone_number, country = nil)\n $tracer.trace(\"GameStopAccountFunctions: #{__method__}, Line: #{__LINE__}\")\n $tracer.report(\"S...
[ { "docid": "76105b823a7c398031301bd7abf8f8b6", "score": "0.86870205", "text": "def enter_address(first_name, last_name, address1, city, state_province, zip_postal_code, phone_number)\n first_name_field.value = first_name\n last_name_field.value = last_name\n street_address_field.val...
b1d5de35c9753271ed8c794ec140a901
PATCH/PUT /marketing_teams/1 PATCH/PUT /marketing_teams/1.json
[ { "docid": "02c484caa60610a5c87c3a3b26d41443", "score": "0.7078244", "text": "def update\n respond_to do |format|\n if @marketing_team.update(marketing_team_params)\n format.html { redirect_to @marketing_team, notice: 'Marketing team was successfully updated.' }\n format.json { ren...
[ { "docid": "555b6bd116d1f3a4d47cec062f720056", "score": "0.71217936", "text": "def update\n render json: Team.update(params[\"id\"], params[\"team\"])\n end", "title": "" }, { "docid": "ca341bd1773af925e24be57cf8927a6e", "score": "0.68476623", "text": "def update\n team = ...
ce5f30e76bd7bc75be1dd6bd3ffa011f
GET /subscriptions GET /subscriptions.json
[ { "docid": "badba452de42e0de3be6a1d390362e14", "score": "0.68032604", "text": "def index\n session[:sub_delete_return_to] = request.fullpath\n @subscriptions = Subscription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @subscriptions }\n ...
[ { "docid": "c85c25a44c2481685fc013a94f53f377", "score": "0.81785053", "text": "def subscriptions\n url = url_with_api_version(@base_url, 'subscriptions')\n resp = rest_get(url)\n JSON.parse(resp.body)[\"value\"]\n end", "title": "" }, { "docid": "051fd12045881f45570...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "6dba56d2e0a9683a55163a370f9ddf70", "score": "0.0", "text": "def cliente_acoma_params\n\n params.require(:cliente_acoma).permit(:nombres_cliente, :apellidos_cliente)\n\n end", "title": "" } ]
[ { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.7121987", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "b32229655ba2c32ebe754084ef912a1a", "score": "0.70541996", "text": "def expected_permitted_parameter_names; end", "title": "...
9b0773cd92f4a08544d6cc22f90ad977
strategy that evals block in receiver context closure is rebound to receiver (acting as a function)
[ { "docid": "0d3b3366bbeeb02be1f6b5d4739d7df3", "score": "0.0", "text": "def first_rule_that_predicates_in_receiver(rules, receiver, *args)\n rules.find do |rule|\n receiver.instance_exec(*args, &(rule.predicate))\n end\n end", "title": "" } ]
[ { "docid": "f73c54e722eeffe963108fb688e5dd98", "score": "0.69217443", "text": "def block=(_arg0); end", "title": "" }, { "docid": "f73c54e722eeffe963108fb688e5dd98", "score": "0.69217443", "text": "def block=(_arg0); end", "title": "" }, { "docid": "342bc09c88e650cf636df5...
f548d8858a74b8bbffb6c5ee1c0f09d9
Enumerate all the subqueues
[ { "docid": "d0aa55d03cc164826aea7239f61e330a", "score": "0.76310146", "text": "def subqueues\n JSON.parse(@client.call('queue.subqueues', @name))\n end", "title": "" } ]
[ { "docid": "affa464364afb38abb59fc11a5c1a64c", "score": "0.72381634", "text": "def sub_queues\n sub_queue_obj.find(:all, :order => \"created_at DESC\")\n end", "title": "" }, { "docid": "84ee1c50dd5da394db5398eaeb3e1ba6", "score": "0.6927343", "text": "def queues\n subje...
307dbb518ec984da290a06ba598ce36d
Return products for company
[ { "docid": "ef32294710b6ffdde24aefbd32c8c6b9", "score": "0.75031376", "text": "def get_products()\n products = Product.where(company_id: self.id).order(:name)\n \n return products\n end", "title": "" } ]
[ { "docid": "c7b766ea47dda795fc7baf69823c285e", "score": "0.7908986", "text": "def get_products()\n products = Product.find(:all, :conditions => {:company_id => self.id})\n \n return products\n end", "title": "" }, { "docid": "834c4713b8eef3a63e9cd59bf1397ccb", "score": "0.77925...
741f6250ed550ce398ccd6b21969b8bc
DELETE /households/:id/transactions/1 DELETE /households/:id/transactions/1.xml
[ { "docid": "005457901bf3d64b89815194ed780407", "score": "0.7714151", "text": "def destroy\n raise Exception.new(\"deleting transactions is not allowed\")\n @transaction = Transaction.for_household(params[:household_id]).find(params[:id])\n @transaction.destroy\n\n respond_to do |format|\n ...
[ { "docid": "40c19081824a1c044d25696f6ae3fee4", "score": "0.74488175", "text": "def destroy\n @transaction_xml = Transaction::Xml.find(params[:id])\n @transaction_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(transaction_xmls_url) }\n format.xml { head :ok }\n ...
f9ebc8612e05233d9da5b9763d6492ec
DELETE /bookmarklets/1 DELETE /bookmarklets/1.xml
[ { "docid": "21fdac0abd1723bc46671e4874c5b6de", "score": "0.65599775", "text": "def destroy\n if session[:owns].include?(params[:id])\n @bookmarklet = Bookmarklet.find(params[:id])\n @bookmarklet.destroy\n flash[:notice] = 'Your bookmark has been deleted.'\n redirect_to '/'\n el...
[ { "docid": "f4cec1eaec775966c6ba6acfdfa381b9", "score": "0.72310096", "text": "def destroy\n @custom_bookmarklet = CustomBookmarklet.find(params[:id])\n @custom_bookmarklet.destroy\n\n respond_to do |format|\n format.html { redirect_to(custom_bookmarklets_url) }\n format.xml { head :...
a8d0b2ec4801b58821a9adc56e95c01c
Populate the object attributes from a hash. Returns self for chaining. Uses the attribute writer instead of the instance variable to be more transparent.
[ { "docid": "690b3dc46c1f3fac78654aaf0450b441", "score": "0.0", "text": "def assign_with(hash)\n hash.each { |k, v| \n next if k == \"id\"\n awriter = \"#{k}=\"\n if respond_to? awriter\n case v\n when \"@@TIME\"\n v...
[ { "docid": "66b2a3618c3b14e7d70153baf1703406", "score": "0.7290708", "text": "def initialize(attr_hash)\n attr_hash.each do |key, value|\n # using send method to create whats above (instance variables, keys, values)\n # if key exits, lets create it\n # bc the ...
8f17b5fbd337a82d1c245231b4a32738
View a recurring payment This will pull data associated with a current recurring billing ==== Parameters rebill_id A string containing the rebill_id of the recurring billing that is already active (REQUIRED)
[ { "docid": "43210fc692ba025e0b077db309ac75f0", "score": "0.7362394", "text": "def status_recurring(rebill_id)\n ActiveMerchant.deprecated RECURRING_DEPRECATION_MESSAGE\n\n post = {}\n requires!(rebill_id)\n post[:REBILL_ID] = rebill_id\n post[:TRANS_TYPE] = 'GET'\n ...
[ { "docid": "a2e2cfee49c1645cf4ceb804ab54933c", "score": "0.77746457", "text": "def view_rebilling(rebill_id)\n\tpost = {}\n requires!(rebill_id)\n\t$options[:view_rebilling] = '1'\n post[:ACCOUNT_ID] = $options[:account_id]\n post[:REBILL_ID] = rebill_id\n po...
9a98ff2641ff04360044e064c861509f
Returns the topic name for the model, i.e. the pluralized and underscored class name.
[ { "docid": "186f7805979efa9d0044fe8a67a0bcf5", "score": "0.73919564", "text": "def kafka_topic\n name.pluralize.underscore.gsub(\"/\", \"-\")\n end", "title": "" } ]
[ { "docid": "6b3f48d58e844c93aa06f513fa39334d", "score": "0.78877234", "text": "def topic\n @_topic ||= request.env['loudmouth_map'][:topic_model].singularize.downcase\n end", "title": "" }, { "docid": "a0d0dcbdfa22da25dc86deec97a83c29", "score": "0.71130073", "text": "def topic\n...
c74a1887c4918b7326111b3c3144baf4
Callback to encode `tasks` to a JSON
[ { "docid": "46cbe3449ce9a2fae33f33ffc776666e", "score": "0.83554494", "text": "def encode_tasks\n self.tasks =\n ActiveSupport::JSON.encode(self.tasks) rescue self.tasks.to_json\n end", "title": "" } ]
[ { "docid": "54a6125c282f0b9fa4164694e41e4962", "score": "0.7420468", "text": "def json\n render :json => Task.all.to_json\n end", "title": "" }, { "docid": "d36b26043005ba60e6a8d0b574182ae4", "score": "0.7246338", "text": "def tasks\n\t\trender json: Timesheet.tasks(project),...
ab88fe4e0449e775acd94eee771d6aef
returns an integer of the sum field where conditions are met returns an Integer or an error message
[ { "docid": "639b78fec8e198ed8e099c46c1d3fb33", "score": "0.5479093", "text": "def sum_field_where(sum_field, where_field, where_value, where_relationship)\n result = run_sql(\"SELECT SUM(#{sum_field}) FROM #{table_name} WHERE #{where_field} #{where_relationship} #{add_quotes_if_string(where_value)}...
[ { "docid": "24986ea7d930232932523c5c403ea2ed", "score": "0.6115743", "text": "def check_amount\n @checks.inject(0) {|sum, c| sum = sum + c.check_amount.to_f}\n end", "title": "" }, { "docid": "43a34546f48be85037e3f4792e81d4bc", "score": "0.59943396", "text": "def check_amount\n ...
3c8edeea16bc6ba095e1bc06aa04aee2
The secret String must be at least 32 bytes in size. Options may include: :pad_size Pad encrypted message data, to a multiple of this many bytes (default: 32). This can be between 24096 bytes, or +nil+ to disable padding. :purpose Limit messages to a specific purpose. This can be viewed as a security enhancement to pre...
[ { "docid": "a208b8df7d5bcdd56b76de0afc1b43a7", "score": "0.6754497", "text": "def initialize(secret, opts = {})\n raise ArgumentError, 'secret must be a String' unless secret.is_a?(String)\n\n unless secret.bytesize >= 32\n raise ArgumentError, \"invalid secret: it's #{secre...
[ { "docid": "d0ee08b274cb6decc2705c53a5e7c386", "score": "0.6611968", "text": "def initialize(secret, opts = {})\n raise ArgumentError, 'secret must be a String' unless secret.is_a?(String)\n raise ArgumentError, \"invalid secret: #{secret.bytesize}, must be >=64\" unless secret.bytesiz...
a52d76e6171ec74429539b7ebb388504
define the function method name = print_two args is like argv but for functions
[ { "docid": "4338435053e7fb3af5ac52a59a624646", "score": "0.0", "text": "def print_two(*args)\n # unpacks the argument\n arg1, arg2 = args\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend", "title": "" } ]
[ { "docid": "edc83049deff76f20e4cd23485e81ab5", "score": "0.81282586", "text": "def print_two(*args) #def for define, and we give def a function name\n arg1, arg2 = args\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend", "title": "" }, { "docid": "24a980e1a8884629d649d39e3b07df7c", "score":...
d968c7d270f261b7e908ef3f088edcf1
mock which responds like object with protected method
[ { "docid": "a4d4a25c8783bc2899f3da43cc301354", "score": "0.7733517", "text": "def test_mock_which_responds_like_object_with_protected_method_does_not_respond_when_method_is_not_stubbed\n object = Class.new do\n def foo; end\n protected :foo\n end.new\n test_result = run_as_test do\n ...
[ { "docid": "ee6f43196a56bc8b26da276aed9212c2", "score": "0.716504", "text": "def test_object_with_protected_method_invokes_stubbed_method_when_method_is_stubbed\n object = Class.new do\n def foo; end\n protected :foo\n end.new\n test_result = run_as_test do\n object.stubs(:foo).r...
ab100ee81b4e557ec1cf24e663cfa87c
GET /invoices/1 GET /invoices/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "1e20b47aa88e88870997fbf69751e6c7", "score": "0.78745675", "text": "def index\n @invoices = Invoice.all\n\n render json: @invoices\n end", "title": "" }, { "docid": "d82d7f3bfa25d273bace7fe5bcff8f81", "score": "0.7852044", "text": "def show_invoices\n data = {\n ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "17c323b76b8d2cc2e4041ee8ace27301", "score": "0.0", "text": "def set_book_loan\n @book_loan = BookLoan.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...
cd239008573e8a1b2544c2433f99995c
Returns an HTML style for the status table cell
[ { "docid": "3324c06027c4c22fb967f2ff0bf60b08", "score": "0.6813871", "text": "def status_style( checker )\n \"background-color: #{checker.status.nil? ? :green : :red}\"\n end", "title": "" } ]
[ { "docid": "246f5570b6ba401e1901d60ac9727998", "score": "0.7536733", "text": "def before_cell_render_styling(column_name,cell_value,record)\n if record.status == \"opened\"||record.status == \"paused\"\n \"<font color = 'orange'>\"\n elsif record.status == \"completed\"\n \...
b724ca343c6b7c4c4a8206661d6dab70
GET /posts GET /posts.json
[ { "docid": "2c98beae512eef686ef5e183e75ab073", "score": "0.0", "text": "def index\n render json: Song.all\n end", "title": "" } ]
[ { "docid": "fb578f587fdfe1b0a8d3ac27001f9611", "score": "0.7634022", "text": "def index\n render json: @posts\n end", "title": "" }, { "docid": "4e694f9f0a0313f64d4c0582953f2972", "score": "0.754337", "text": "def show\r\n @posts = Post.find(:all)\r\n\r\n respond_to do ...
97f003b5f8a042aab21e9ca2aa943a38
PATCH/PUT /boolean_answers/1 PATCH/PUT /boolean_answers/1.json
[ { "docid": "59793bb311a4a47e6be97b900f240449", "score": "0.7736373", "text": "def update\n respond_to do |format|\n if @boolean_answer.update(boolean_answer_params)\n format.html { redirect_to @boolean_answer, notice: 'Boolean answer was successfully updated.' }\n format.json { ren...
[ { "docid": "6d65c7344fa0f9fe565f907ecf2a3548", "score": "0.76922673", "text": "def update\n @booleananswer = Booleananswer.find(params[:id])\n\n respond_to do |format|\n if @booleananswer.update_attributes(params[:booleananswer])\n format.html { redirect_to @booleananswer, notice: 'Boo...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "f5251faf10772cb9e6bac15591d54f86", "score": "0.0", "text": "def set_account_payable\n @account_payable = AccountPayable.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...
19da420d4ef22b9d781795cc259040b6
Inserts new attributes into the hash. If the elements are present in the hash it will update them, otherwise it will add the new attributes into the hash as either a child hash or child array of hashes.
[ { "docid": "d6631fdd6794effdff965066e21f4cab", "score": "0.63553613", "text": "def insert(key, attrs)\n elements = self[key]\n if elements\n elements.merge!(attrs)\n else\n self[key] = key.singular? ? attrs : [attrs]\n end\n end", "tit...
[ { "docid": "84f859d593b5bc2f596bcd079bbd5e41", "score": "0.6612475", "text": "def add_attributes(attr_hash)\n return unless attr_hash\n attr_hash.each_pair{ |k,v| self.add_attribute(k, v) }\n end", "title": "" }, { "docid": "e3afd993c6abdb115b3e384b65f1b3ab", "score": ...
54c6f93fe3957f52b3849b9d206ebcb4
rubocop:disable Metrics/CyclomaticComplexity rubocop:disable Metrics/PerceivedComplexity
[ { "docid": "b9636482a04ea56e1e1ae27ed68a19df", "score": "0.0", "text": "def initialize(\n spans,\n agent_sample_rate: nil,\n hostname: nil,\n id: nil,\n lang: nil,\n name: nil,\n origin: nil,\n process_id: nil,\n rate_limiter_rate: nil,\n ...
[ { "docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1", "score": "0.7541669", "text": "def private; end", "title": "" }, { "docid": "0b8b7b9666e4ed32bfd448198778e4e9", "score": "0.62584645", "text": "def probers; end", "title": "" }, { "docid": "3660c5f35373aec34a5a7b0869a4a8bd", ...
bf298c6a3f1c98c5d5b23aef3c0aa64f
Private: Accepts an Element and figures out if its type is already defined in this elements (self) ancestors. Used to prevent recursive child element definitions.
[ { "docid": "741b01a285ac74714569120a1fc33010", "score": "0.6641716", "text": "def recursive_child_definition?(parent, element)\n return false unless element.type\n\n local, namespace = expand_qname(element.type, element.namespaces)\n id = [namespace, local].join(':')\n\n curr...
[ { "docid": "43e82813fbf16f433915688f0457892f", "score": "0.6500745", "text": "def nested_child?\n @elements.last.class.method_defined?('add_element') && @elements.last.container\n end", "title": "" }, { "docid": "868ad3eb3482c9d996c220c760b9d1c3", "score": "0.64614314", "text": "...
307270a1dbfdab010e709451d1be16ba
=> [:ruby, :json_ruby, :json_ruby_sym, :json, :none]
[ { "docid": "c07d76a57bb69f21b30e2cc840c48b58", "score": "0.0", "text": "def initialize db, format\n self.db = db\n self.format = (format || :ruby)\n end", "title": "" } ]
[ { "docid": "123304176c91f05f1c9fc10f4c4a3937", "score": "0.5893994", "text": "def get_available_option_list_types\n [\n {'name' => 'REST', 'value' => 'rest'}, \n {'name' => 'Morpheus Api', 'value' => 'api'}, \n {'name' => 'LDAP', 'value' => 'ldap'}, \n {'name' => 'Manual', 'value'...
f23a3b18601a4d8b66c7b4512ebc9b07
The role works without a preexisting jobdsl workspace.
[ { "docid": "818a759ae1404518731014a3dba41b01", "score": "0.6063536", "text": "def test_no_workspace\n system 'sudo rm -rf /var/lib/jenkins/jobs/job-dsl/workspace'\n ansible_playbook '--tags solita_jenkins_jobs', <<-EOF, :jobs => { \"jobs/a/A.groovy\" => <<-EOF2, \"jobs/b/B.groovy.j2\" => <<-EOF3, ...
[ { "docid": "470f8f37984ca00b9285181c6d2725e4", "score": "0.5918058", "text": "def initialize_with_existing_workspace\n unless Rails.env == 'test'\n\n Rails.logger.info \"#{Time.now}: Study: #{self.name} using FireCloud workspace: #{self.firecloud_workspace}\"\n validate_name_and_url\n ...
3d817c4aa0defb5d5b1d844abf66513a
Search from the current working directory until a suitable bakefile is found and add it.
[ { "docid": "fbb6658f71df3542cf037ce1f60a9a4b", "score": "0.0", "text": "def append_from_root(current = Dir.pwd, **options)\n\t\t\twhile current\n\t\t\t\tConsole.logger.debug(self) {\"Checking current #{current}...\"}\n\t\t\t\t\n\t\t\t\tappend_path(current, **options)\n\t\t\t\t\n\t\t\t\tparent = File.dir...
[ { "docid": "e2a2827b1fe839ed61ce88f32e936b3f", "score": "0.6172704", "text": "def look_for_default_recipe_file! #:nodoc:\n current = Dir.pwd\n\n loop do\n %w(Capfile capfile).each do |file|\n if File.file?(file)\n options[:recipes] << file\n re...
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "786052e39087be91ad9d48c5e374ec35", "score": "0.0", "text": "def shield_params\n params.require(:shield).permit(:name, :attack_points, :defense_points, :required_experience)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7477736", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.7169702", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist =...
df6ec27b10e397d4f887100a9fa65abd
Force preloading of requires for all contained ports
[ { "docid": "231dc334067a2e172e12b576b8767bc7", "score": "0.78084886", "text": "def _load_requires\n @_ports.each(&:_load_requires)\n end", "title": "" } ]
[ { "docid": "94c80a4fbef04d125096360686213acb", "score": "0.6480609", "text": "def load_requires; end", "title": "" }, { "docid": "94c80a4fbef04d125096360686213acb", "score": "0.6480609", "text": "def load_requires; end", "title": "" }, { "docid": "062c3105ea081916bfd44638...
d89d559c04a2d79f642e86813bac7925
fence_lizards = ["Adam Dziuk", "Adam Ryssdal", "Aki Suzuki", "Allison Wong", "Andra Lally", "Anup Pradhan", "CJ Jameson", "Christopher Aubuchon", "Clark Hinchcliff", "Devin A Johnson", "Dominick Oddo", "Dong Kevin Kang", "Eiko Seino", "Eoin McMillan", "Hunter T Chapman", "Jacob Persing", "Jon Pabico", "Parjam Davoody",...
[ { "docid": "b60e0b5dc4d418dad557d9e005ad2e78", "score": "0.0", "text": "def create_groups(input)\n input.sort!\n unit_groups = []\n 3.times { |n|\n\tunit_groups = input.shuffle(random: Random.new(n)).each_slice(4).to_a\n\t}\n\tputs \"Group 1 is #{unit_groups[0]}\"\n\tputs \"Group 2 is #{unit_groups[1...
[ { "docid": "e6dd60354758c76370d8af0a39c20401", "score": "0.604153", "text": "def\n Director_name = [\"Stephen Spielberg\",\n \"Russo Brothers\",\n \"James Cameron,\n \"Spike Lee\",\n \"Wachowski Siblings\",\n \"Robert Zemeckis\",\n \"Quentin Tarantino\",\n ...
2eab35d029e13dee9a480f2bdede237b
Provide a convenient handle for the Javaspace version of self.
[ { "docid": "a2c73a505b411c902475e049c5c1e451", "score": "0.6293094", "text": "def java_self\n @java_self ||= to_java(Java::ProcessingCore::PApplet)\n end", "title": "" } ]
[ { "docid": "632c10182b36d24ded3dd55f9baeb3c0", "score": "0.70966697", "text": "def java_self\n @java_self ||= Java.ruby_to_java self\n end", "title": "" }, { "docid": "b43169d08c34ae428937e657c0274c8c", "score": "0.6749103", "text": "def _java_node\n self\n end", ...
3d8f39d90bd1afb75f5b1bdfa612f7e7
Detects FIN scan only fin flag set
[ { "docid": "aad4fe65b42f878a244e5efc350acb4c", "score": "0.7239125", "text": "def is_fin_scan?(pkt)\n if ! pkt.proto.include?(\"TCP\")\n return false\n end\n\n return ( pkt.tcp_flags.fin == 1 and\n pkt.tcp_flags.ack == 0 and\n pkt.tcp_f...
[ { "docid": "5d85614daa8ba18d56512e26ff316499", "score": "0.80432045", "text": "def isFinScan(packet)\n\treturn (packet.tcp_flags.urg == 0 and packet.tcp_flags.ack == 0 and packet.tcp_flags.psh == 0 and packet.tcp_flags.rst == 0 and packet.tcp_flags.syn == 0 and packet.tcp_flags.fin == 1)\n\t\tisFIN = tr...
4c80777e69da45c0332a5223e4dcc680
A utility for bulk findandreplace operations
[ { "docid": "be4e1ac7ca2c666155e6fa9f07334015", "score": "0.0", "text": "def find\n Actions::Find.new\n end", "title": "" } ]
[ { "docid": "1a9d3c35c18d8fc006515a102547a621", "score": "0.69432735", "text": "def find_and_replace_charecter charecter\n\n end", "title": "" }, { "docid": "2a2875fdeaa3e53d2ddff7504c9fb150", "score": "0.679184", "text": "def find_and_replace(dir, findstr, replacestr)\n Dir[dir]....
44aeff2f553284810c07b4681f8d9570
Constructor: Provide a username and a domain name as arguments. Alternatively an String representing a full email address can be provided.
[ { "docid": "c675dbf5b0b39c555affd64e6c88967f", "score": "0.80153877", "text": "def initialize( username, domain = nil )\n if (domain)\n @username = username\n @domain = domain\n else\n (@username, @domain) = username.split('@')\n end\n replace( \"#{@username}\\@#{@domain}\".do...
[ { "docid": "8e338638d79a09351b7b52d9b8bd4ab3", "score": "0.73876554", "text": "def initialize(first_name, last_name, username, email)\n @first_name = first_name\n @last_name = last_name\n @email = email\n @username = username\n end", "title": "" }, { "docid": "0b793e3063a50934fd...
9b1d7dc85c58b63dafacc7b6329af1d8
Change the name of a folder
[ { "docid": "9ee93958c5e11aa7fbe76256e201dc8c", "score": "0.5934474", "text": "def rename_folder(folderid, mountpoint)\n args = local_variables.reduce({}) { |c, i| c[i] = binding.local_variable_get(i); c }\n response = request(:post, \"folders/#{folderid}/mountpoint\", args)\n h = do...
[ { "docid": "3a8da61f496b29e0b14d972b688c01cb", "score": "0.75270313", "text": "def folder_name=(value)\n @folder_name = value\n end", "title": "" }, { "docid": "bae089ccfd56b6380734c91c066b0b84", "score": "0.7447556", "text": "def rename_folder\n folder =...
cc46fa3ff21a9234ebb5876290c9f453
Infer all client and strategy options from environment variables.
[ { "docid": "50feb207882978b2388013dc4b3374e3", "score": "0.0", "text": "def auto_options(folder)\n options = {}\n debug_folder = folder/\"tmp\"\n\n options[:debugger] = ->(message, user, handler) {\n debug_folder.mkdir_p unless debug_folder.exists?\n (debug_folder/\"#{user[:email]}.ht...
[ { "docid": "f1ac4a6b3035be19aeab6e43d5da226d", "score": "0.61554044", "text": "def populate_environmental_defaults(options)\n case options.farm\n when 'bs'\n # Allow browser/device credentials to exist in separate accounts\n if options[Option::BROWSER]\n ...
29799990ff564adea54dcab5edd7fa67
GET /gratches/1 GET /gratches/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "2db5ccc6d01124d9778bfffcecb701a8", "score": "0.6905636", "text": "def index\n @gratches = Gratch.all\n\n end", "title": "" }, { "docid": "fee26d1f575073facd95e48e0c038ca1", "score": "0.64931464", "text": "def get(path)\n # FAKING RESPONSE\n [{ id: 1, nam...
3a2f8ee104839e549b9d690f703da704
PATCH/PUT /pdf_generators/1 PATCH/PUT /pdf_generators/1.json
[ { "docid": "2715a8ea2ebb5d77d70a17daca68df41", "score": "0.71030384", "text": "def update\n respond_to do |format|\n if @pdf_generator.update(pdf_generator_params)\n format.html { redirect_to @pdf_generator, notice: 'Pdf generator was successfully updated.' }\n format.json { head :...
[ { "docid": "c69ef5a559fc65f554a105367e861e52", "score": "0.6986902", "text": "def update\n# @requests_cloning = Requests::Cloning.find(params[:id])\n\n respond_to do |format|\n if @requests_cloning.update(requests_cloning_params)\n #Generarte PDF\n filename = \"public/pdf/#{'%.6...
854b0ee1ca14d6c3c591594ea66f0dc7
Compares two files/streams in a binary (exact) manner == Signature == Return +true+ if the files/streams have exactly the same content; +false+ otherwise.
[ { "docid": "fbaf928574ec24c74610709e56f9a87d", "score": "0.0", "text": "def compare_binary lhs, rhs, **options\n\n\t\t::CmpFS::Compare::Binary::Internal_.compare_binary_ lhs, rhs, options\n\tend", "title": "" } ]
[ { "docid": "faee6841e3d36ac8bea1922f54fe8f91", "score": "0.70500916", "text": "def equal?(file_1,file_2)\n content_1 = File.read(file_1)\n content_2 = File.read(file_2)\n content_1 == content_2\nend", "title": "" }, { "docid": "246528a139903c0a8fe69c8547b49a68", "score": "0.7009633", ...
f7eec8ff81f61f381a4fa78752f003ea
GET /organizations/1 GET /organizations/1.json
[ { "docid": "6cbbb1cd7e8b4d7d69b7719c9004f803", "score": "0.0", "text": "def show\n @title = t 'view.organizations.show_title'\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @organization }\n end\n end", "title": "" } ]
[ { "docid": "d6650a30986bfa18e1a4ca6767b09f60", "score": "0.7807078", "text": "def index\n @organizations = current_user.organization\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organizations }\n end\n end", "title": "" }, { "doc...
154dd4ac358a61f8045457a5ee7b94c9
Validates hadoop related conf params for local install_mode
[ { "docid": "7c0eb6903f8751fa742666fefbfc4f21", "score": "0.5852777", "text": "def hadoop_validator(hash_to_validate)\n puts '[Debug]: calling hadoop validator' if @debug\n\n hadoop_ha = hash_to_validate[:hadoop_deploy][:hadoop_ha]\n hbase_install = hash_to_validate[:hbase_deploy]\n h...
[ { "docid": "ddf82a06331113daf2c87d6dc7338c69", "score": "0.657907", "text": "def hadoop_validator(config)\n @log.debug 'Initializing hadoop validator'\n install_mode = config[:install_mode]\n\n requires :hadoop_deploy, :hash do\n # Hadoop ha\n requires :ha, :string do |hak, ...
6a1088649007e6711f56dd3a79cca8ea
Combines the authorized and captured methods into a single call === Options date_authorized The date the transaction was authorized. Default is today. date_captured The date the transaction was captured. Default is today.
[ { "docid": "0d475b8b0c0cd20d425d791bc4b794a8", "score": "0.70430946", "text": "def authorized_with_capture(options = {})\n options = { :date_authorized => Date.today, :date_captured => Date.today }.merge(options)\n request_params = {\n 'customerID' => customer_id,\n 'cartID' => c...
[ { "docid": "d5e742de987710eab296245b32dc5b91", "score": "0.6756144", "text": "def authorized_with_capture(options = {})\n options = { date_authorized: Date.current, date_captured: Date.current }.merge(options)\n request_params = {\n 'customerID' => customer_id,\n 'cartID' => cart...
8c4af05db2126d6d22af493ead9f7943
Auto Complete for $ Amount Reason Codes fields in the Add Row of Reason Code Grid
[ { "docid": "a7b06698e3cc479664a630d295d15f8b", "score": "0.63958377", "text": "def auto_complete_for_reason_code_reason_code\n reason_code = params[:reason_code][:reason_code]\n auto_complete_for_reasoncode(reason_code)\n end", "title": "" } ]
[ { "docid": "1a3b647a6a08fd1d63d4ed55f1b2217d", "score": "0.63157094", "text": "def auto_complete_for_reason_code_reason_code_description\n reason_code_desc = params[:reason_code][:reason_code_description]\n auto_complete_for_reasoncode_desc(reason_code_desc)\n end", "title": "" }, { "...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "11a9409ec6d5b6a6b009759642d9a2d5", "score": "0.0", "text": "def fragrance_search_params\n params.require(:fragrance_search).permit(:search_id, :fragrance_id)\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...
48ad33b3b4974d2d1ef030018116f510
Method to destroy the current session.
[ { "docid": "37e43d2e441556364c34dbfa0d331e82", "score": "0.0", "text": "def logout!\n\n # Execute the reset_session_token method after finding current_user.\n # This line alone will destroy the session since they do not match.\n current_user.reset_session_token!\n\n # Set the current session...
[ { "docid": "56d1cdf0e41bb0dde93db2451e1bb755", "score": "0.8415157", "text": "def destroy_session\n\t\t\tret = do_api :post, 'session/destroy', { :session => @session }\n\t\t\t@session = nil\n\t\t\tret\n\t\tend", "title": "" }, { "docid": "cfd5fc29b4812bbad3c1e9978df2f361", "score": "0.8...
a4116d83590590a360e68837db7e2cd6
Returns all cluster identifiers = Example: cluster_uids("grenoble") => ["adonis", "edel", "genepi"]
[ { "docid": "3140d15a00faac1f18f4f265b7644b95", "score": "0.7579805", "text": "def cluster_uids(site)\n return clusters(site).uids\n end", "title": "" } ]
[ { "docid": "ee5bd9f64d8fecac3908965545474255", "score": "0.78607666", "text": "def cluster_ids\n @cluster_ids ||= begin\n clusters = []\n clus = [root_cluster]\n while !clus.nil?\n clusters << clus.first\n clus = next_cluster(clus.first)\n end\n ...
b1de6c281680bdef8fde1a0915e1d109
Check if object is an skill
[ { "docid": "ff2a27d60d1b57081b701550ef69805c", "score": "0.7310109", "text": "def skill?\n return false\n end", "title": "" } ]
[ { "docid": "8b8e4a162a2e79e86d29a1b9fe31fb0b", "score": "0.7939785", "text": "def skill?; current_action._?(:item)._?(:is_a?, ::RPG::Skill); end", "title": "" }, { "docid": "c9f8d394b5684e73fefc371401b1468f", "score": "0.7524794", "text": "def skill?\n return true\n end", "ti...
ca7f7a8fa85960d823e50ba7e0d0493a
Mortgage Calculator Calculate the monthly required payment given the other variables as input (look up the necessary variables)
[ { "docid": "40aa127824f2a21823de3c904d316a13", "score": "0.0", "text": "def mortgage_menu\r\n puts \"-=\" * 40\r\n puts \"Mortgage Calculator\"\r\n puts \"-=\" * 40\r\n puts \"[enter] to start\"\r\n puts \"[q] to quit\"\r\n puts \"\\n\"\r\nend", "title": "" } ]
[ { "docid": "bbb26234f07131926fd223a7aba5b76f", "score": "0.77969927", "text": "def calc_monthly_mortgage(p,rate=0.0,term)\n r = (rate.to_f/100)/12\n n = 12*term\n monthly_payments = p *((r*(((1+r)**n)))/(((1+r)**n)-1)) ;\n puts \"Monthly payment(s) (P=#{p} rate=#{rate} term=#{term}) = #{monthly_paym...