query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
a8f220d4d41dc3e86c3ab3fd178fc3d3
Uses Rails' sanitize method to remove all HTML tags from all inputs except for the following tags: +p, br, strong, em, b, i, ol, ul, li, a, img+ Also removes any IE conditional crap like +<![if+ and all that.
[ { "docid": "1b4119d15090b8f10b0df95915a32e28", "score": "0.75486076", "text": "def sanitize_user_input\n self.attributes.each do |name, value|\n if value.is_a?(String)\n value = ActionController::Base.helpers.sanitize(value, :tags => %w(strong em b i ol ul li a img p br))\n value =...
[ { "docid": "427f13122a3868cde207e3ae2757746d", "score": "0.78865755", "text": "def strip_tags(html)\n self.class.full_sanitizer.sanitize(html)&.html_safe\n end", "title": "" }, { "docid": "faac8ad852a62047e1f2c62cd945e730", "score": "0.78572226", "text": "def sanitize\n\t...
ff49baa14ccd120b7fb8f3a68dace791
GET /contacts GET /contacts.json
[ { "docid": "40329d025c091853ad61e710858f7091", "score": "0.0", "text": "def index\n @user_types=UserType.all\n new\n end", "title": "" } ]
[ { "docid": "8eea3a2e86364d38226af95d61abd66e", "score": "0.845876", "text": "def contacts\n get('contacts')\n end", "title": "" }, { "docid": "680464823216e7f4871a0a4894b924aa", "score": "0.83591413", "text": "def contacts()\n get('contactsList')\n end", "title": "" ...
e3a9a3769ebf02d6c9d66ebca7fa65e0
Typecast the value for booleans and integers in hashes.
[ { "docid": "6c9a323462249135a75e9adaab9ec4ab", "score": "0.7167133", "text": "def typecast_hash_value(field, key, value)\n case key\n when \"$exists\"\n Serialization.mongoize(value, Boolean)\n when \"$size\"\n Serialization.mongoize(value, Integer)\n else\n...
[ { "docid": "9766d08e1d1fd60201c6d94516d68fc7", "score": "0.7796932", "text": "def cast(value)\n if value == 'true'\n true\n elsif value == 'false'\n false\n elsif value =~ /[\\d]/\n value.to_i\n else\n decode(value).to_sym\n end\n end", "title"...
3d669e2b55c72b4d7411990fa15e00e1
TODO Might have to cheat and make this a index or show so we can use a GET request to record the data. This will avoid cross origin issues.
[ { "docid": "d297a2ef2f38b0349fe7f343884a05b0", "score": "0.0", "text": "def create\n rendered_time, referer, user = tracking_info\n assessment_result = user.assessment_results.create!(\n assessment_id: params[:assessment_id],\n eid: params[:eid],\n src_url: params[:src_url],\n ...
[ { "docid": "318460a168d00fb2e78c910e4ecef99d", "score": "0.6929888", "text": "def index\n #@data_entries = DataEntry.all\n end", "title": "" }, { "docid": "f44cef8be8c3ea9f32af00529bfb42b5", "score": "0.69226795", "text": "def show\n\t\tresponse = @@conn.get '/api/v1/data/index',...
fd411d1676d2bdbc7f503fef84d4016e
Report unbalanced braces in a string to STDOUT: used for designer bios return true iff there are no problems
[ { "docid": "55eaae04e8d826179edf30e5c7a0b18a", "score": "0.720639", "text": "def check_braces\n depth = 0\n pos = 0\n if bio.nil?\n puts \"Note: nil bio for designer id #{name} \"\n return true\n end\n bio.each do |c|\n depth += 1 if c.eql?\"\\{\"\n if c.eql? \"\\}\"\n...
[ { "docid": "bd72610a5e7a15643ab4da6a7b680afe", "score": "0.6830416", "text": "def check_for_matching_braces\n\t\t\tbrace_counter = 0\n\t\t\t@code.each_char do |char|\n\t\t\t\tif char == \"[\"\n\t\t\t\t\tbrace_counter += 1\n\t\t\t\telsif char == \"]\"\n\t\t\t\t\tbrace_counter -= 1\n\t\t\t\t\tif brace_cou...
878d5aecc0d2f54d330b378a3e3ae3ad
The heart of formatting. This method is highly delicate and complex. It has come about from extensive testing and works very well, even when columns have been created incorrectly or have incorrect values assigned to them.
[ { "docid": "01634508aa76fa6af1b04fd7ff8e9b8d", "score": "0.0", "text": "def type_formatting(value)\n @type = 'json' if @type == 'text' && (value.is_a?(Hash) || value.is_a?(Array))\n\n if @type == 'text[]'\n value = value.flatten.uniq.to_s if value.is_a?(Array)\n value = \"{#{valu...
[ { "docid": "57db8fb8618db6d48ca87408eff5135e", "score": "0.7283517", "text": "def formatting; end", "title": "" }, { "docid": "1305405f12ab4fd59bc10c7adec3c057", "score": "0.7145381", "text": "def formatting\n @col_opts[:formatting]\n end", "title": "" }, { "docid": "...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "1e53f29943a50f0ce6a8f20c70c1ef78", "score": "0.0", "text": "def set_development_result\n @development_result = DevelopmentResult.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6165422", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.60457647", "text": "def action_hook...
9bd2786258099961dccd9e04071fd174
GET /articles GET /articles.json
[ { "docid": "a920313c94b47f912ff66de3dbb5c6c3", "score": "0.0", "text": "def index\n @greffes = Greffe.search_and_paginate(params)\n end", "title": "" } ]
[ { "docid": "9cb21440d77022ee6f0542d4ebd0003b", "score": "0.78232944", "text": "def articles\n @articles = Article.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end", "title": "" }, { "docid": "f62c2acde...
5e2ddbca42c3ac1d65668d9c873a4801
loop forever checking the queue for messages and processing them every minute we check for stuck jobs
[ { "docid": "7fac53e0fd60d993b5f07d2081595df0", "score": "0.0", "text": "def process_loop(looping_infinitely = true)\n @started = Time.now\n begin\n process\n end while looping_infinitely\n end", "title": "" } ]
[ { "docid": "38ef5c88b0228f5f279b7d290ba2a7fe", "score": "0.70825756", "text": "def process_queue\n puts \"Waiting for new messages\"\n th = Thread.new do\n Thread.current.abort_on_exception = true\n loop do\n # This will sit around and wait forever.\n ...
6820869d34b869d8c3b369f63213b34c
Retrieve an integer value of known length from the response.
[ { "docid": "e1bfa9a737f672ce6cab695a8fa046e7", "score": "0.72856396", "text": "def numeric(position, length)\n raw_response[position + 2, length].to_i\n end", "title": "" } ]
[ { "docid": "363409475a3ee251cd77821ea6d54405", "score": "0.6997718", "text": "def to_i\n result.fetch('response').fetch('numFound').to_i\n end", "title": "" }, { "docid": "16f39f008602b6053511b9eb74c043da", "score": "0.68237305", "text": "def len\n self[:int].value\n ...
ccbef076feb60785106d1158fb5fb39b
Whether or not amount is in Earth masses.
[ { "docid": "a90624371c2ff3caa4c0801af3af3f6a", "score": "0.7692841", "text": "def earth_mass? = unit == 'earth-mass'", "title": "" } ]
[ { "docid": "c7d6d097b18a3f3230441f7d29a84204", "score": "0.71417874", "text": "def solar_mass? = unit == 'solar-mass'", "title": "" }, { "docid": "f74ddbea015c5f15eed369dfc639b434", "score": "0.623217", "text": "def full_moon?\n pom == FULL_MOON\n end", "title": "...
a1814b8779889b0da13990ca99344d65
For a given (Windows) server, return it's administrator user and password. This is generally for requests made to MommaCat from said server, which we can assume have been authenticated with the deploy secret.
[ { "docid": "6b7579420c0b7e31e9aa7fd3ee25929e", "score": "0.75077844", "text": "def retrieveWindowsAdminCreds(server)\n if server.nil?\n raise MuError, \"retrieveWindowsAdminCreds must be called with a Server object\"\n elsif !server.is_a?(MU::Cloud::Server)\n raise MuError, \"ret...
[ { "docid": "272210c426be1f70c07db48fb4917d3d", "score": "0.7660841", "text": "def getWindowsAdminPassword\n @deploy.fetchSecret(@mu_name, \"windows_admin_password\")\n end", "title": "" }, { "docid": "05209baf52c70e86c1bcd4f2e5d1cbb1", "score": "0.735997", "text": "de...
3ab2ad673f79facf7866185fddab0f7d
This is the main control method
[ { "docid": "afa54b4fadbf159158ebddb22ee1d8b4", "score": "0.0", "text": "def run_host(ip)\n\t\t# Initialize some variables\n\t\ttext = \"\\\\#{datastore['WINPATH']}\\\\Temp\\\\#{Rex::Text.rand_text_alpha(16)}.txt\"\n\t\tbat = \"#{datastore['SYSDRIVE']}\\\\#{datastore['WINPATH']}\\\\Temp\\\\#{Rex::Text.ra...
[ { "docid": "4da8b4c3bd5770e60b33f86f7d85b9b4", "score": "0.7197307", "text": "def run\n end", "title": "" }, { "docid": "bc3e0880d8b9c0c44e60030e2f8d8933", "score": "0.7145241", "text": "def run\n\n\t\tend", "title": "" }, { "docid": "c376309f69511ff11b1194127d...
f46aa9ae1b18ecb7619e4ae64ec031e4
Returns the description of the project contained in the repository This will load the description through a VCS specific mechanism if required.
[ { "docid": "256137c69829d965b63b083c46725b68", "score": "0.619183", "text": "def description\n load_description if @description.nil?\n @description\n end", "title": "" } ]
[ { "docid": "ae02375e0f32ab0c4a96aae172f39090", "score": "0.77166134", "text": "def description\n project.description\n end", "title": "" }, { "docid": "405a5550456a47545a9a98ef0e4cd791", "score": "0.761469", "text": "def get_desc(project)\n api_url = \"https://api.github.c...
a78778795e84a965deffa84e495bc866
Removes old session token and generates a new one, assigning it to User
[ { "docid": "ec6b385bcc6d74917863f3d31c39be85", "score": "0.78608185", "text": "def reset_session_token!\n session_token = self.class.generate_session_token\n save!\n session_token\n end", "title": "" } ]
[ { "docid": "7c41ff437afa8fe344478cabcc101bbf", "score": "0.8449017", "text": "def reset_session_token\n # reassign to a new one, then save then return\n self.session_token = User.generate_session_token\n self.save!\n self.session_token\n end", "title": "" }, { "docid": "24159f99...
aefd94f264f548f1a05e5d63d1218167
don't use slugs larger than 50 bytes
[ { "docid": "fe70695a727b643b57dcddef61429480", "score": "0.0", "text": "def episode_slug\n self.name\n end", "title": "" } ]
[ { "docid": "517a436ba0c0fdc5a59573bcf665f9dd", "score": "0.703677", "text": "def generate_1000_slugs\n one.generate_1000_slugs\n end", "title": "" }, { "docid": "e6bd54ff97ecc2ace89b9faf002d5459", "score": "0.64304507", "text": "def slug ; 'chipy' ; end", "title":...
1022c8a7fef0a4fbb5ac07f116e83bdc
before_filter :admin_user, :only => :destroy
[ { "docid": "1fa719ff955c99c107e5f2c87cac3c4d", "score": "0.0", "text": "def index\n @title = \"用户列表\"\n @users = User.paginate(:page => params[:page])\n end", "title": "" } ]
[ { "docid": "caec68cd8913bbbddac00918c17a1769", "score": "0.7665397", "text": "def destroy\n restrict 'allow only admins' or begin\n @admin = Admin.find_by_id(params[:id])\n @admin.destroy\n respond_to do |format|\n format.html { redirect_to admins_url }\n format.xml { he...
94f7a657d7c9b76e8daae27ebfd9462b
Prettyprint the elements of the list
[ { "docid": "9c96a115d69c79f6e586573090954573", "score": "0.0", "text": "def to_s\n\t\t\t\t'[' << map(&:to_s).join(', ') << ']'\n\t\t\tend", "title": "" } ]
[ { "docid": "fafa5e130f82e85d9888029eaa790c0d", "score": "0.7859066", "text": "def print_pretty(list)\n list.each { |item, value| puts \"#{item} #{value}\" }\nend", "title": "" }, { "docid": "23e9c440d08e6dd83b6a8fd006cabb18", "score": "0.77081394", "text": "def pretty_list(list)\r...
8876e86ab823a97928c3808a6d60cbce
Retrieves data from Riak Raises an error on type mismatch
[ { "docid": "5fb1be1aee573fcc049ea6cb29ac9434", "score": "0.5916417", "text": "def data\n result = riak_object.data || {}\n\n if result[\"_type\"] && (result[\"_type\"] != type_key)\n raise TypeError, \"#{@bucket}:#{@key} expected type to be #{type_key}, got #{result[\"_type\"]}\"\n ...
[ { "docid": "a9414d76b0e6443b5be92f4a75bff8f8", "score": "0.61544657", "text": "def get_data\n end", "title": "" }, { "docid": "7eacd015c9b1b3f8f7baf1e46b4869b9", "score": "0.60245", "text": "def retrieve_data\n unless @raw_data\n begin\n unless config[:server].start...
32882cab5eb613aa0d28d530829c67c6
As a traveler, I'd like to visit a number towns while only driving a set number of miles, so that I don't fall asleep at the wheel. Scope number of towns will vary (k) number of miles will very (t) list of towns and miles between will be provided (ls) Acceptance Criteria return the number of miles to visit three towns ...
[ { "docid": "ccd35346db84c23019a06682901f78b5", "score": "0.50534743", "text": "def choose_best_sum(miles, towns, list)\n list.combination(towns)\n .map { |path| path.inject(:+) }\n .select { |sum| sum <= miles }\n .max\nend", "title": "" } ]
[ { "docid": "83228e434d83dc2afacbf9d32add89a5", "score": "0.5820945", "text": "def game_trains\n trains = build_train_list({\n '2' => 0,\n '3' => 0,\n '4' => 0,\n ...
933bebb24aa296436cd1fa5e5aac55d3
Export report to CSV with given datasource
[ { "docid": "9ea4e71016c76a560b71f68eacae8010", "score": "0.6504373", "text": "def to_csv(*args)\n to(:csv, *args)\n end", "title": "" } ]
[ { "docid": "02ad842961e8b0961bbc4bffdbeb909c", "score": "0.6885248", "text": "def report_to_csv(options = {})\n if !@report.empty? \n CSV.generate(options) do |csv|\n csv << @report[0].keys\n @report.each do |assignment|\n csv << assignment.values\n end\n end\n end\nend", ...
034c3e18e009eae1e05d9beb7fa5ab46
DELETE /tois/1 DELETE /tois/1.json
[ { "docid": "128d6b9fb26524105efccce92eb13b85", "score": "0.69423723", "text": "def destroy\n @toi = Toi.find(params[:id])\n @toi.destroy\n\n respond_to do |format|\n format.html { redirect_to tois_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "b1a17c1ee1af05c79fe156622df44818", "score": "0.70384645", "text": "def delete(path)\n begin\n response = client[path].delete :accept => 'application/json'\n rescue Exception => e\n puts e.inspect\n end\n end", "title": "" }, { "docid": ...
0cee841f20ecd22d3d48326b11d92ef5
Get city names from the hash
[ { "docid": "3be9c691cb4131e19eb2a8db247338ee", "score": "0.6021845", "text": "def get_city_names(area_codes)\n area_codes.each do |city, code|\n puts \"#{city}\"\n # puts \"The area code for #{city} is #{code}.\"\n end\nend", "title": "" } ]
[ { "docid": "6a56f42736e77489e4935f0aeba43043", "score": "0.8052428", "text": "def get_city_names(city_hash)\n city_hash.keys\nend", "title": "" }, { "docid": "a286782141e5d2c01670fd7d5e167da3", "score": "0.78113794", "text": "def get_city_names(somehash)\n # print out the names o...
d8bd31dd42554822b648d97031ddddb1
\ The heart of the Template Method: the template method
[ { "docid": "efd9df07911309c0ceafa667e66f0a23", "score": "0.61860996", "text": "def template_method\r\n\r\n setup\r\n schedule\r\n heat\r\n optimize # Step to be overridden\r\n cleanup # Step to be overridden\r\n putaway\r\n\r\n end", "title": "" } ]
[ { "docid": "e90d2a4012d4d19e71c2c1141dad2897", "score": "0.7920872", "text": "def template; end", "title": "" }, { "docid": "e90d2a4012d4d19e71c2c1141dad2897", "score": "0.7920872", "text": "def template; end", "title": "" }, { "docid": "e90d2a4012d4d19e71c2c1141dad2897",...
20d27f3501dc53c75e3e562c4c45dc35
nonadmin member > nonmember
[ { "docid": "86af3dac07df0f6801ce3a67e84f9eb1", "score": "0.0", "text": "def test_change_member_status_member_remove_member\n change_member_status_helper(rolf, katrina,\n :change_member_status_remove_member,\n false, true, false, fals...
[ { "docid": "9aeb1adf91b6bbb29d566fff34f08f80", "score": "0.7492474", "text": "def not_member\n end", "title": "" }, { "docid": "9aeb1adf91b6bbb29d566fff34f08f80", "score": "0.7492474", "text": "def not_member\n end", "title": "" }, { "docid": "ef586c7ca1ad4522de6c7525fe...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "cb2a89dfa9909673662d2f529249fed0", "score": "0.0", "text": "def set_clinic_event\n @clinic_event = ClinicEvent.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...
24ff8c5453afdb615122d6e7f68d9e92
POST /reward_owners POST /reward_owners.json
[ { "docid": "e50afbe3b3f4ee4abb50fef3c7e5d6e8", "score": "0.6735817", "text": "def create\n @reward_owner = RewardOwner.new(reward_owner_params)\n @reward_owners = RewardOwner.all\n\n respond_to do |format|\n if @reward_owner.save\n @reward_owner = RewardOwner.new\n format.js ...
[ { "docid": "7dac49d5eae26d7bed6680be2168ad4b", "score": "0.69360775", "text": "def update\n @reward_owner.update(reward_owner_params)\n @reward_owner = RewardOwner.new\n @reward_owners = RewardOwner.all\n end", "title": "" }, { "docid": "d63986b955d5d4fe9426bfc0c8eded1e", "scor...
c0b980200b8012f2a576d9f25b311834
PUT /welcomes/1 PUT /welcomes/1.json
[ { "docid": "d3dd0891660d05d16727470c7ca27105", "score": "0.72419816", "text": "def update\n #@welcome = Welcome.find(params[:id])\n respond_to do |format|\n if @welcome.update_attributes(params[:welcome])\n format.html { redirect_to root_url, notice: 'Welcome was successfully updated.'...
[ { "docid": "a300b23bbcbb172eb0c5ab0d47523a3e", "score": "0.7450652", "text": "def update\n @welcome = Welcome.find(params[:id])\n\n respond_to do |format|\n if @welcome.update_attributes(params[:welcome])\n format.html { redirect_to @welcome, notice: 'Welcome was successfully updated.'...
093e5efc2fd7d4e2d637f30a1b4cc973
GET /orders/new def new
[ { "docid": "a860d99cfb28f6db9530a66dbcd28e3c", "score": "0.0", "text": "def delete\n end", "title": "" } ]
[ { "docid": "bf7ffbb38bb61cfd717b30b5b7f8e16f", "score": "0.80574495", "text": "def new\n \t@title = \"New Order\"\n @navinner = \"1\"\n @order = Order.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end", "title": "" ...
9f3ef12eccda7fc83fc6c6f395988804
If the underlying dataset selects from a single table and has no explicit selection, explicitly select all columns from that table, qualifying them with table's name.
[ { "docid": "64e41082dd21960e2648756cad6ba523", "score": "0.59404033", "text": "def convert_input_dataset(ds)\n ds = super\n if !ds.opts[:select] && (from = ds.opts[:from]) && from.length == 1 && !ds.opts[:join] # SEQUE5: just !ds.opts[:select]\n if db.supports_schema_parsing...
[ { "docid": "200058975c56303d56a271088504bb75", "score": "0.6806549", "text": "def select(*cols)\n if ((f = @opts[:from]) && f.any?{|t| t.is_a?(Dataset) || (t.is_a?(SQL::AliasedExpression) && t.expression.is_a?(Dataset))}) || ((j = @opts[:join]) && j.any?{|t| t.table.is_a?(Dataset)})\n su...
6c88dd4a0d02003c1e7ea7b9f0237c91
Secrets are not generally something passed around in developer copies These are things set up by the cluster administrator, so we can assume if it is present on the server, we can skip it. As such, better to use recreate than apply for secrets.
[ { "docid": "c1fa42646dc9f7dd70f411c78a2fed93", "score": "0.0", "text": "def converge!(opts = {})\n converge_by_recreate!(opts)\n end", "title": "" } ]
[ { "docid": "edd3b40ab9797e4b9988363606d5df8b", "score": "0.704692", "text": "def load_secrets\n include_recipe 'chef-vault'\n begin\n chef_secrets = chef_vault_item('chef-secrets', node.chef_environment)\n chef_secrets.delete('id')\n rescue\n raise 'The chef-server must be built first to gen...
4251d00aeb2eae3a44343a2259f3f71f
PATCH/PUT /anonymous_denounciations/1 PATCH/PUT /anonymous_denounciations/1.json
[ { "docid": "464048813dd3d04b4487ac644e0fdca6", "score": "0.7534245", "text": "def update\n respond_to do |format|\n if @anonymous_denounciation.update(anonymous_denounciation_params)\n format.html { redirect_to @anonymous_denounciation, notice: 'Anonymous denounciation was successfully up...
[ { "docid": "f11d645fd9339559d6a9075694ffa90d", "score": "0.6551239", "text": "def set_anonymous_denounciation\n @anonymous_denounciation = AnonymousDenounciation.find(params[:id])\n end", "title": "" }, { "docid": "0c6afb30edb1d09d121d1fa3c0966303", "score": "0.62048507", "te...
1a0c9e828e27a71710c36ef3c94e1a74
challenge 5 challenge 6 throw error
[ { "docid": "aeb7b3444caf857738d010fda68f9ffe", "score": "0.0", "text": "def throw_error(jobs)\n jobs = {\"a\" => \" \", \"b\" => \" \", \"c\" => \"c\"}\n jobs.each do | key, value | \n if key == value\n return \"error!\"\n else\n end\n end\n end", "title": "" ...
[ { "docid": "f712d49ec6c615538b2e2aa846391fda", "score": "0.71923834", "text": "def challenge; end", "title": "" }, { "docid": "ce13cdc311c17978cf37cab76555386d", "score": "0.6953235", "text": "def challenge\n end", "title": "" }, { "docid": "c3cb3e948c27b241ea4299b2df1fa...
7dae40f1d61006f3395f73999784b361
this method returns the the 2 letter code for the airline with the most arrival delays
[ { "docid": "476db43ccb0ed985582cb617724c8e66", "score": "0.598881", "text": "def most_arrival_delays\n sql = %q[\n SELECT \n carrier,\n count(*)\n FROM delays\n WHERE arr_delay_new > 0\n GROUP BY carrier\n ORDER BY count DESC\n LIMIT 1;\n ]\n result =...
[ { "docid": "d18a00df56ee782b87ea59c158a3bc3e", "score": "0.7467193", "text": "def longestRunway()\n rw = 0\n cod = \"\"\n AIRPORT_DATA.each do |a|\n if a[APT_LONG] > rw\n rw = a[APT_LONG]\n cod = a[APT_IATA]\n end\n end\n return cod,rw\n end", "title": "" },...
761bc9a0098fe1e7e0f26b9abb3dc153
POST /questions POST /questions.json
[ { "docid": "48681088c16d23c766500e1bfe0e36a4", "score": "0.0", "text": "def create\n blow_up_multiple_invitations\n @question = current_user.questions.new(params[:question])\n respond_to do |format|\n if check && @question.save\n pending_answers = @question.answers.pending\n ...
[ { "docid": "56850646224a2709f3405ab227e6e9c2", "score": "0.7311781", "text": "def create\n \t@question = Question.new(questions_params)\n\n \trespond_to do |format|\n \t\tif @question.save\n \t\t\tformat.html { redirect_to @question, notice: 'question was successfully created.' }\n \t\t\tformat.jso...
9e7a7e95b1c25221c5203465122fe10d
this can be called from the API (with no args) or from notifier.rb (which will pass a severity to use, and an effective time)
[ { "docid": "e08ab751c38ad9a7b93ee9b5809f179b", "score": "0.0", "text": "def alerting_media(opts = {})\n time = opts[:time] || Time.now\n severity = opts[:severity] || self.condition\n\n # return empty set if disabled, or in a maintenance period (for API only,\n # these will h...
[ { "docid": "dcde6ae72bb2150d059b5e29c12c32f2", "score": "0.6995773", "text": "def call(severity, time, progname, msg)\n if @@show_time\n sprintf(\"[%s] %s: %s\\n\", time.iso8601, severity, msg2str(msg))\n else\n sprintf(\"%s: %s\\n\", severity, msg2str(msg))\n end\...
3c6f021bb486aebd31e22267a92e0583
gets the value of variable, copies it to tape. If found on :object , writes 1 to ra, else writes 0.
[ { "docid": "564f5a94c79bf7f0092f98f99e847b26", "score": "0.587186", "text": "def getVar(tape, name)\n\tmFoundEnv = SubMachine.stub 'lookup3'\n\tmFoundEnv.simpleMerge copy(:env, tape)\n\tmFoundEnv.simpleMerge writeConstant(:ra, 0)\n\n\t# Scan to end of env\n\tmNotFound = scan(:env, :right, BlankSymbol)\n...
[ { "docid": "48532fe933187ae1387916e5934efd2f", "score": "0.5181997", "text": "def look_up(variable)\n \ti = @@scope\n \twhile(i>=@@scope_base.last)\n \tif @@variables[i][variable] != nil\n \t\treturn @@variables[i][variable][0]\n \t\tputs \"#{@@variables[i][variable]} is found\" if (@@Deb...
e70415a961fef42a62b38ddafc288851
GET /course_sessions/1 GET /course_sessions/1.json
[ { "docid": "a703cdfb633a174276deed7c0b83b765", "score": "0.0", "text": "def show\n authorize @course_session\n end", "title": "" } ]
[ { "docid": "c047f17bcf8054edf1e4cbe185731f98", "score": "0.76409423", "text": "def index\n @course = Course.by_account(@current_account).find(params[:course_id])\n @course_sessions = CourseSession.by_course(@course)\n\n respond_to do |format|\n format.html # index.html.erb\n format.js...
24ceb869cf0a17dd9f40860bdb87e9a8
after_initialize do config[:data_type] ||= :integer TODO: this overrides the config ! end
[ { "docid": "ce554c0cf7bd3823a564b74fb06633cc", "score": "0.0", "text": "def data\n is_multiple? ? self.data_text : converted_data\n end", "title": "" } ]
[ { "docid": "46f67996830227fec2967c7d9f6e227f", "score": "0.68994474", "text": "def init\n if(@new_record)\n self.type_id = Datagrouptype::DEFAULT\n end\n end", "title": "" }, { "docid": "eea4f4bada2ea048a18aa2cfdad24cd8", "score": "0.65867025", "text": "def configure data...
355b4ddcd67c088172a921144a72cfdc
Write a file to disk for the schema for a database/collection. db_name String name of database. Required. collection_name String name of collection. Required. schema String schema contents. Required. returns the schema on success; raises an error on failure.
[ { "docid": "fe0a1a772f9038b77a5e80b1f0a5ee7c", "score": "0.85835135", "text": "def write_schema(db_name, collection_name, schema)\n File.open(schema_path(db_name, collection_name), 'w') do |f|\n f.puts schema\n end\n\n schema\n end", "title": "" } ]
[ { "docid": "739f4f2ce427061eb47ffabb84282cc2", "score": "0.7303476", "text": "def schema_path(db_name, collection_name)\n File.join(@path, db_name, collection_name, 'schema.json')\n end", "title": "" }, { "docid": "1a65e7a16bd49962df4a82d73cf12c30", "score": "0.69203526", "te...
2a1d3f51147ba805459e51d5ef49e1bd
sets the parent of current node to the passed in node also sets current node as passed in node's child
[ { "docid": "68a59a3eaefbc65b6777fdb334840fb3", "score": "0.799901", "text": "def parent=(node)\n # this is for deleting child when we are reassigning parent\n if @parent != nil\n @parent.children.delete(self)\n end\n\n @parent = node\n if node\n node.children << self unless node...
[ { "docid": "3fb3bfa77e2556e9d6c2c7369a54cd1f", "score": "0.83691186", "text": "def set_parent(node)\n @parent = node\n end", "title": "" }, { "docid": "945c286f8b66f5683cce565437a54beb", "score": "0.8155859", "text": "def parent=(node)\n #debugger\n @parent.children.del...
e12670283fa4033b9368d7ab6266c116
GET /commitmentitems/1 GET /commitmentitems/1.json
[ { "docid": "bf94375f4e0708adf1c2993f8740b92b", "score": "0.64708334", "text": "def show\n @commitmentitem = Commitmentitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commitmentitem.as_json }\n format.js\n end\n end", ...
[ { "docid": "2ea176f113be3fa4c64a397fd19ce971", "score": "0.6431122", "text": "def index\n @commitments = Commitment.all\n end", "title": "" }, { "docid": "86a280632c21c2cb6a2fda433c8c9f0f", "score": "0.5999149", "text": "def index\n @committees = Committee.all\n\n respond_t...
5575d02122d0e8ae4ba5023ea1fafb92
TODO: make exceptions for these instead of just returning nil / silently failing
[ { "docid": "bff31c6783981e2d40884f3bfb49c5a3", "score": "0.0", "text": "def read_file(path)\n raise \"read_file not overridden on #{self.class}\"\n end", "title": "" } ]
[ { "docid": "8b79e8f7bbe83880e51794d26cd62a8f", "score": "0.687888", "text": "def try; end", "title": "" }, { "docid": "d882f3a248ba33088a4284a47c263d0d", "score": "0.66918683", "text": "def missing?; end", "title": "" }, { "docid": "3dd49bf89ca13eba8cb278cfe6edcd89", ...
d0df87b1bea9b55706b1c7c4184cdaba
PATCH/PUT /posts/1 PATCH/PUT /posts/1.json
[ { "docid": "e2e71bd33e799c70b8b9b9012b0a4e8d", "score": "0.0", "text": "def update\n flash.now[:alert] = 'Post has been updated'\n respond_to do |format|\n if @post.update(post_params)\n format.js\n format.html do\n redirect_to action: 'index',\n no...
[ { "docid": "2a642a611c63a85b6ef6e72d09830e50", "score": "0.71859056", "text": "def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end", "title": "" }, { "docid": "e2c68cadce474543233abd080997b452", "score": "0.7040584", "text": "def update\n respond_...
5cfa618e8e15d167d7c77985b51ac920
Defines new state on this state machine.
[ { "docid": "ab093de640d62e81f98e33d389fe49d0", "score": "0.0", "text": "def state(state, options={})\n options[:initial] ||= false\n\n @transition_table ||= {}\n states.push state\n\n if options[:initial]\n unless @initial_state.nil?\n raise OnlyOneInitialState.new('O...
[ { "docid": "a20e678d3e4ac7da793a077949faa479", "score": "0.74025923", "text": "def new_state()\n add_state(new_id())\n end", "title": "" }, { "docid": "c26cbf72590f00226b04eb79cdcce594", "score": "0.73973477", "text": "def new_state(s)\n if s != @state\n @state = ...
7cbcce3eb63019c6abfe1ffdae512b24
instance = DateTime.parse("20140101 16:35:45 0800") d1 = DateTime.parse("20131225 04:45:00 0800") d2 = DateTime.parse("20151225 5:00:01 0800") p instance.between?( d1, d2 )
[ { "docid": "02e85573312a66b61ab5283851a60d34", "score": "0.0", "text": "def new_event\n client = Signet::OAuth2::Client.new(client_options)\n client.update!(session[:authorization])\n\n service = Google::Apis::CalendarV3::CalendarService.new\n service.authorization = client\n\n today = Da...
[ { "docid": "da9828462e2f0aa38411b1ad8c10eb4c", "score": "0.6851718", "text": "def between_times(*args)\n t1 = nil\n t2 = nil\n if args.size == 2\n t1 = parse_time(args[0])\n t2 = parse_time(args[1])\n elsif args.size == 4\n t1 = parse_time(args[0], args[1])\n t2 = parse_t...
f0c8ebc080c48c2f260ffb43b1834e56
GET /products/1 GET /products/1.json
[ { "docid": "34420e0190debe9642709e99ec4e96f3", "score": "0.0", "text": "def show\n @part = @product.parts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @part }\n end\n end", "title": "" } ]
[ { "docid": "cda9cc6ce501e0759ebd220bb0d15c09", "score": "0.77224106", "text": "def product(name)\n get(\"/apiproducts/#{name}\")\n end", "title": "" }, { "docid": "fd872907eafc1e4ecae3f32975d12906", "score": "0.76329553", "text": "def show\n product = Product.find_by_i...
e0bd06946d35bb7bb62ae790401b435f
def contig_subsum(array) return [array.first] if array.length <= 1 arrays = [] arrays[0] << contig_subsum(array[1..1]) end
[ { "docid": "c46661d9e92a8c6b9714955e1b55f0c6", "score": "0.8002647", "text": "def contig_subsum(array)\n sub_arrays = []\n i = 0\n j = 0\n while i < array.length do\n while j < array.length do\n sub_arrays << array[i..j]\n j += 1\n end\n i += 1\n j = i\n end\n\n max_sum = 0\n...
[ { "docid": "337fd96528a6d50c3c0a86b9d21166f1", "score": "0.7924818", "text": "def sub_sum(array)\n sums = []\n i = 0\n j = 0\n\n while i < array.length\n while j < array.length\n sums << array[i..j]\n j += 1\n end\n i += 1\n j = i\n end\n sums.sort_by{|x| x.reduce(:+)}.last.re...
91eeb53d63e6abaac85863e6fe33230b
3. total refactored solution
[ { "docid": "3d81b8cb48d80011b2a217a11bf7fbb8", "score": "0.0", "text": "def total(arr)\n arr.inject {|x,y| x + y}\nend", "title": "" } ]
[ { "docid": "bc658f9936671408e02baa884ac86390", "score": "0.614783", "text": "def anchored; end", "title": "" }, { "docid": "b9960478999684c2b536f76e22f6fc63", "score": "0.59552205", "text": "def solution4(input)\n end", "title": "" }, { "docid": "1151221aa9457e5cad317e4f...
d7db440a1bc10f98f3d5c01e43339643
PATCH/PUT /contacts/1 PATCH/PUT /contacts/1.json
[ { "docid": "ef1bc9259af7be5f2018c87012409e89", "score": "0.6746591", "text": "def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' ...
[ { "docid": "8a1fcbdae3046e2102f533f681b61c66", "score": "0.77271706", "text": "def update_contact\n url = Addressable::URI.new(\n scheme: 'http',\n host: 'localhost',\n port: 3000,\n path: '/contacts/3'\n ).to_s\n\n puts RestClient.patch(\n url, {contact: {name: \"Josh\", email: \"josh...
d7785917fb01535dff98c111928b0978
PUBLIC METHODS ============================================================ ACTIONS
[ { "docid": "90fdce1b8bbb5dbd381c1b3c9b769777", "score": "0.0", "text": "def bubble(heading)\n\t\tbranching = Branching.new\n\n\t\tbranching.heading = heading\n\t\tbranching.child_node = Branch.new\n\n\t\tself.child_branchings << branching\n\t\treturn branching\n\tend", "title": "" } ...
[ { "docid": "2dbabd0eeb642c38aad852e40fc6aca7", "score": "0.69852805", "text": "def operations; end", "title": "" }, { "docid": "2dbabd0eeb642c38aad852e40fc6aca7", "score": "0.69852805", "text": "def operations; end", "title": "" }, { "docid": "3660c5f35373aec34a5a7b0869a4...
5a2e983b3ee4f0e18ceeb3157026fc06
Retrieves default action context from the controller.
[ { "docid": "c8190cf0e89a916f3f5fab27e8990075", "score": "0.0", "text": "def default_configuration\n configuration[:_default] || {}\n end", "title": "" } ]
[ { "docid": "4e423b5b46d570ea1a83f36a4fd60614", "score": "0.74084604", "text": "def default_view_context\n ActionController::Base.new.view_context\n end", "title": "" }, { "docid": "4e423b5b46d570ea1a83f36a4fd60614", "score": "0.74084604", "text": "def default_view_context...
7fed0273efa298c137ff8ef120c7cf95
p second_anagram?("gizmo", "sally") => false
[ { "docid": "e57345fc1044610bf7480838af6f0398", "score": "0.0", "text": "def third_anagram?(string1, string2)\n sorted_string1 = string1.split(\"\").sort\n sorted_string2 = string2.split(\"\").sort\n\n sorted_string2.join(\"\") == sorted_string1.join(\"\")\nend", "title": "" } ]
[ { "docid": "25658f488c5949a582a88f3c72ca251b", "score": "0.85604036", "text": "def fourth_anagram?(str1, str2)\n\nend", "title": "" }, { "docid": "0a87b436a1406615cf83df5d11533ad5", "score": "0.8522319", "text": "def third_anagram?(str1, str2) \n \nend", "title": "" }, { ...
86f6e026a2b58f73d4ecc5e2e05d379b
return the user's loggedin information.
[ { "docid": "bd7066015f9afb48018626a360a74849", "score": "0.0", "text": "def current\n current_user.update!(last_login: Time.now)\n render json: current_user\n end", "title": "" } ]
[ { "docid": "a3c6ac75cbda1307ba89015b6724f685", "score": "0.79318815", "text": "def get_user_logged_in\n\t\tif current_user != nil\n\t\t\treturn 'Currently signed in as: ' + current_user.forename + ' ' + current_user.surname\n\t\telse\n\t\t\treturn 'You are not logged in!'\n\t\tend\n\tend", "title": ...
81d56bb1d8971ba49f4c240ac039f912
PATCH/PUT /app_priorities/1 PATCH/PUT /app_priorities/1.json
[ { "docid": "86a31f19806743bc45c3f99bb452f9f6", "score": "0.6239221", "text": "def update\n respond_to do |format|\n if @app_priority.update(app_priority_params)\n format.html { redirect_to @app_priority, notice: 'App priority was successfully updated.' }\n format.json { render :sho...
[ { "docid": "b43d6797bf0f9e8035d09cdbbabbd9ae", "score": "0.59397674", "text": "def update\n @prior = Prior.find(params[:id])\n\n respond_to do |format|\n if @prior.update_attributes(params[:prior])\n format.html { redirect_to @prior, notice: 'Prior was successfully updated.' }\n ...
cdb9f1ca21f8d3ec39d607826d4a5311
This generates change by gathering all coins available to the machine and sorting them from large to small. Then it iterates over each of those coins and adds them to the pile of change to be returned if they are smaller than the amount of change we have yet to gather together. If after iterating over all the coins we ...
[ { "docid": "0ec8a11a370cb8947330e828a0c933a3", "score": "0.69994456", "text": "def change_for(name:)\n price = product_price(name: name)\n\n remaining_value = balance - price\n selected_change = []\n\n coins_available_for_change = (inserted_coins + change).sort.reverse\n\n coins_available...
[ { "docid": "5ab479c3880848b0a9766ee58a9c461d", "score": "0.7877077", "text": "def make_change(change_needed, cash_register)\n return [] if change_needed == 0\n \n pile_of_coins = []\n biggest_coin = cash_register[0]\n remaining_balance = change_needed\n\n until remaining_balance == 0\n...
8fc7597a6728756417ece852bf7cdfd7
POST /postavshiks POST /postavshiks.json
[ { "docid": "6b4453afc80296bdfd8388ce4b8d9d8a", "score": "0.7318675", "text": "def create\n @postavshik = Postavshik.new(params[:postavshik])\n\n respond_to do |format|\n if @postavshik.save\n format.html { redirect_to @postavshik, notice: 'Postavshik was successfully created.' }\n ...
[ { "docid": "d2fe10e4603925fb3ff9c1d77b3de632", "score": "0.6056452", "text": "def do_post(host, port)\n\tbody = get_viking_data.to_json\n\theaders = { \"Content-Type\" => \"application/x-www-form-urlencoded\",\n\t \"Content-Length\" => body.length }\n\tmake_request(host, port, :post, '/viking...
36640cc2659aadf75827e178e2f04d84
Load the Rails generator and apply it to the specified directory.
[ { "docid": "45e37fb952aeb132df86b42977999791", "score": "0.65709966", "text": "def execute_apply_to!\n require 'switchtower/generators/rails/loader'\n Generators::RailsLoader.load! @options\n end", "title": "" } ]
[ { "docid": "0430f1e2fd65103c1a9cc69cefe0bf34", "score": "0.6661354", "text": "def run_base_generator\n Rails::Generators::AppGenerator.start([destination_path])\n end", "title": "" }, { "docid": "5511fc7e5012ffe3fb27b9dcde12fd21", "score": "0.6391573", "text": "def genera...
184b3d40b09d623cefa8beec2faa757a
DELETE /enquiries/1 DELETE /enquiries/1.json
[ { "docid": "1164aba189bd7b800e3b54a40959eb11", "score": "0.0", "text": "def destroy\n @enquiry = Enquiry.find(params[:id])\n authorize! :destroy, @enquiry\n \n stat = EnquiryStatus.find_by_name(\"deactivated\").id\n @enquiry.update_attributes(status_id: stat,active: false)\n \n tl(\...
[ { "docid": "29658a91d3988d8346ed6f6e2d1f1ad9", "score": "0.7356746", "text": "def destroy\n @enquiry = Enquiry.find(params[:id])\n @enquiry.destroy\n\n respond_to do |format|\n format.html { redirect_to enquiries_url }\n format.json { head :no_content }\n end\n end", "title": ...
99b399da39b11dbf30816de13c0d01cf
I tried this method with UNIXServer raises the exception I am raising here.
[ { "docid": "55a62e1468e0f9652b459cb3148af97f", "score": "0.0", "text": "def peeraddr\n\t\tif self.instance_of?(UNIXServer) \n\t\t\traise Errno::ENOTCONN, \"Transport endpoint is not connected - getpeername(2)\", caller\n\t\telse\n\t\t\t[@af,@path]\n\t\tend\n\tend", "title": "" } ]
[ { "docid": "1321f0eee23590dcbb0f2f4da7c35e1e", "score": "0.62455606", "text": "def server_error?; end", "title": "" }, { "docid": "6ed338944d439a0eaa7a73866fce050c", "score": "0.5864444", "text": "def server_error\n\n end", "title": "" }, { "docid": "712f9ce0ead43cb2f6af...
75c5aaeb57474287c749f471748b0844
Returns the value of attribute options. source://shouldamatchers//lib/shoulda/matchers/active_model/validation_matcher.rb136
[ { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.0", "text": "def options; end", "title": "" } ]
[ { "docid": "a96b25f3f0895c6149d958d9324abb72", "score": "0.6749522", "text": "def options\n attributes.fetch(:options)\n end", "title": "" }, { "docid": "478646e81dacae21f4cc97dc7ffe6438", "score": "0.6626649", "text": "def value\r\n assert_exists\r\n op...
bf53f7e0d279708be239f2fb302fd3f6
Create a new DataMigrationService client object.
[ { "docid": "a36a06c6c283141881be97b87acb85c7", "score": "0.5622668", "text": "def initialize\n # These require statements are intentionally placed here to initialize\n # the gRPC module only when it's required.\n # See https://github.com/googleapis/toolkit/issues/4...
[ { "docid": "06986e029d311faf170955b808eb6d55", "score": "0.60876274", "text": "def create_client(options)\n PulsarAdmin::Api.new(options)\n end", "title": "" }, { "docid": "bfabcbe45ea4021a624eb911f90234d8", "score": "0.6021367", "text": "def initialize\n # These req...
57532c102d44a308313d606696a66185
GET /projects/1 GET /projects/1.json
[ { "docid": "885d3d75582ebf2975958a984c272e7d", "score": "0.0", "text": "def show\n @project_tasks = ProjectTask.where('project_id = ?', @project.id)\n @projectdocuments = ProjectDocument.where('project_id = ?', @project.id)\n @projectimages = ProjectImage.where('project_id = ?', @project.id)\n\...
[ { "docid": "b2d778e1a6b6df24139d1f5864dedb0f", "score": "0.7869598", "text": "def list\n get 'projects'\n end", "title": "" }, { "docid": "723f580541bd41ab30bb2973cfdea294", "score": "0.76979095", "text": "def listprojects\n get('listprojects.json')['projects']\n end", "t...
26ea0454f2a70559ed80dfebee492bb5
Returns true if the link is definitely online.
[ { "docid": "abf01dd5f7dd8e3601f102e0a8af817e", "score": "0.76110584", "text": "def online?\n return @status == :online\n end", "title": "" } ]
[ { "docid": "d94394665d72e62b5aa4e31d7d452e49", "score": "0.7679969", "text": "def online?\n @online_state != 'offline'\n end", "title": "" }, { "docid": "cd9300cf98a6775f9ac050680db3fc8b", "score": "0.7672952", "text": "def online?\n response = @client.get(@url, \n ...
a0335dce3fef79109f3b4adae5bd20ac
Get symptoms of desease GET /deseasesymptoms/:id
[ { "docid": "2f165fb328d5ce1e4b3035c8b4fcaafd", "score": "0.7634858", "text": "def get_symptoms\n begin\n @desease = Desease.find(params[:id])\n\n @symptoms = @desease.symptoms\n render json: @symptoms\n rescue ActiveRecord::RecordNotFound => e\n render json: e, status: :unprocess...
[ { "docid": "7e6cb0c6847ce1bad1461d454e09a5e5", "score": "0.6757077", "text": "def show\n symptom = Symptom.find(params[:id])\n render response: { symptom: symptom }\n end", "title": "" }, { "docid": "76083328082cf9505b0c59f0f173e48f", "score": "0.660205", "text": "def add_symp...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "15a82748b4b95e777a76d09049a8f6b5", "score": "0.0", "text": "def set_trail\n @trail = Trail.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163163", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045976", "text": "def action_hook;...
e02bac8f831158596aeec1b6dedf3f7a
Find application servers using tags. This will find all active application servers, or, if `application_name` is given, it will find all application servers serving that application.
[ { "docid": "48805faa46da12669354fc25fce3325c", "score": "0.78748196", "text": "def find_application_servers(node, application_name = nil, options = {})\n Rightscale::RightscaleTag.find_application_servers(node, application_name, options)\n end", "title": "" } ]
[ { "docid": "8b38e114cecf34124dfe4f70e66c197f", "score": "0.62606704", "text": "def app_servers(identifier = EY::Metadata::DEFAULT_IDENTIFIER)\n environment['instances'].select { |i| %w{ app_master app solo }.include? i['role'] }.map { |i| i[identifier] }.sort\n end", "title": "" }, {...
fbb2e7841d0cec6cf62a00f030183cab
Returns content for the createimport form. Responds to `GET /imports/new` (XHR only)
[ { "docid": "ec46ee79752c35f6f20fa5caf3ba3cdd", "score": "0.7286799", "text": "def new\n authorize Import\n @import = Import.new\n render partial: \"imports/import_form\"\n end", "title": "" } ]
[ { "docid": "2cbe178847dc24e7c074ad0e66c501c2", "score": "0.71821064", "text": "def new\n @import = Import.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @import }\n end\n end", "title": "" }, { "docid": "2cbe178847dc24e7c074ad0e66...
8bf522ff61970aa46324cbf780616596
def require_no_user if current_user store_location flash[:notice] = "You must be logged out to access this page" redirect_to account_url return false end end
[ { "docid": "3be331c7e8f886d93da8c8a48732beaf", "score": "0.0", "text": "def store_location\n session[:return_to] = request.request_uri\n end", "title": "" } ]
[ { "docid": "aec0e0c1c2645fef07ca096b54ca0625", "score": "0.9608072", "text": "def require_no_user\n if current_user\n store_location\n flash[:notice] = \"You must be logged out to access this page\"\n redirect_to account_url\n return false\n end\n end", "title": "" }, { "...
1b7f8cdbcdd156ba1097f140deef3b91
GET /graphiks/1 GET /graphiks/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "a4d23f678891630642af7625aae36d2f", "score": "0.7364154", "text": "def index\n @graphiks = Graphik.all\n end", "title": "" }, { "docid": "3626d1ea71d9aa86d3334bc101062a21", "score": "0.6814247", "text": "def get_graph\n \n return json_graph_api.graph\n \n end...
2c8e89e7a65c1a1830a7c59109e6d868
Try to set string value to continents, it shoudl be an array
[ { "docid": "28e7ebdbe5341ce5ce373626479bdbf9", "score": "0.5307059", "text": "def test_set_string_to_continents\n input_value = {name: \"test_bird\", continents: @continents.sample, family: @families.sample}\n\n assert_raises Mongoid::Errors::InvalidValue do\n bird = Bird.new(input_value)\n ...
[ { "docid": "0845196f953acbcfac553ecd2ced3da9", "score": "0.63352853", "text": "def Characters=(v)", "title": "" }, { "docid": "fe01716b5ee042990d72ba76c08efa27", "score": "0.6199518", "text": "def characters=(v); end", "title": "" }, { "docid": "4f6296cf0047134e9e556030e4...
b51cbe8c4426feccfa211653877c7fe5
method for user staus
[ { "docid": "24845645b0aa575ab577db1cdcc65c8e", "score": "0.0", "text": "def user_status(activated_date)\n if activated_date.blank?\n return \"Inactive\"\n else\n return \"Active\"\n end \n end", "title": "" } ]
[ { "docid": "12ee5a306fa94d6c08708388e886012d", "score": "0.6703043", "text": "def user; end", "title": "" }, { "docid": "12ee5a306fa94d6c08708388e886012d", "score": "0.6703043", "text": "def user; end", "title": "" }, { "docid": "56f45ea8eaa64dec823594d4b5846a6d", "sc...
7ff1c8c7b03287bb7490f80c819ac8aa
Set the value of this field to +value+. Valid values are as in Field.create().
[ { "docid": "88a1cfc1ae3b44ab1605268d611611c6", "score": "0.67056185", "text": "def value=(value)\n mutate(@group, @name, @params, value)\n value\n end", "title": "" } ]
[ { "docid": "c39e75e717f8082736d27ab7e0a178b9", "score": "0.819344", "text": "def set_value(value)\n _set(:value, value)\n end", "title": "" }, { "docid": "fe61adf3744b2b94fde27db3e4c0cb10", "score": "0.8107005", "text": "def set_value(value)\n @value = value\n end", ...
e9b83cc3ad651876cc416e31b4ae4a81
Specifies a new singularization rule and its replacement. The rule can either be a string or a regular expression. The replacement should always be a string that may include references to the matched data from the rule.
[ { "docid": "7857682d965846c4cc10f12ad652d5b5", "score": "0.7077577", "text": "def singular(rule, replacement)\n @uncountables.delete(rule) if rule.is_a?(String)\n @uncountables.delete(replacement)\n @singulars.prepend([rule, replacement])\n end", "title": "" } ]
[ { "docid": "5f7e1a0b8878cc390e294964eb6231a9", "score": "0.7332339", "text": "def singular(rule, replacement, term: :noun)\n @singulars[term] << [Regexp.new(rule, \"i\"), replacement]\n end", "title": "" }, { "docid": "2bb8bc3d63c227d88b2c58a4b2f0ed38", "score": "0.71343553",...
4d2b40c624bb95383808d81b0c13a9d8
Whether or not the given unit is an ally of this Unit. if not my_unit.allied_with?(other_unit) my_unit.attack other_unit end
[ { "docid": "82c142cc15b8cd97e8487ffe637eb23c", "score": "0.6790202", "text": "def allied_with?(unit)\n @faction == unit.faction\n end", "title": "" } ]
[ { "docid": "3be6d2f004dba1f64c9d05966032d70a", "score": "0.7397372", "text": "def attack!(unit)\n unless self.dead? || unit.dead?\n unit.damage(attack_power) \n end\n end", "title": "" }, { "docid": "a91d9f971282177840a06ae8b7c854aa", "score": "0.7031023", "text": "def at...
945d26c0388f346efc39c4f51396cfac
Manually sets timeout for currently running example. If spec doesn't call done before timeout, it is marked as failed on timeout.
[ { "docid": "d0c81076b5c02ad489b6874463cd14c4", "score": "0.6499261", "text": "def timeout(*args)\n @evented_example.timeout(*args) if @evented_example\n end", "title": "" } ]
[ { "docid": "6d701a18365e89506bc7e111c4875423", "score": "0.74241567", "text": "def setup_timeout timeout = TIMEOUT\n EM.schedule do\n EM.add_timer( timeout ) do\n raise TimeoutError, \"Test was timed out after #{timeout} seconds.\"\n end\n end\n end", "title": "" }, { ...
58157795fc52b7abaa839fe1e9d7708b
GET /notes/1 GET /notes/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "087ae0244972391ee162117afe3cfda0", "score": "0.78219503", "text": "def get_notes\n Resources::Note.parse(request(:get, \"Notes\"))\n end", "title": "" }, { "docid": "80a1692fc3b155b6b41f0425f4f782df", "score": "0.7443521", "text": "def index\n @notes = Notes.al...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "d5db8b6d018d50976eb1e9b357e7d172", "score": "0.0", "text": "def page_params\n params.require(:page).permit(:title, :content)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7496024", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69581187", "text": "def strong_params\n params.require(:request).permit(param_whit...
d9d9a0a7e3b738e70cef55346375c672
This is simple version of 'YAML::dump' with force quoting of strings started with prefixed numeral values
[ { "docid": "0b12d4bfd9cb2b8d8890e06cc4b0c823", "score": "0.6649618", "text": "def safe_yaml_dump(obj)\n visitor = Psych::Visitors::YAMLTree.new({})\n visitor << obj\n visitor.tree.grep(Psych::Nodes::Scalar).each do |node|\n node.style = Psych::Nodes::Scalar::DOUBLE_QUOTED if\n ...
[ { "docid": "e32b908421e5c45a5bf94a3bb1e5ed1f", "score": "0.6276", "text": "def yaml_escape(data)\n case data\n when String\n if data =~ /:\\s/\n data.dump\n elsif data.include?($/)\n lines = ['']\n\n data.each_line do |line|\n ...
d98300ae491685b85ffc22698a35b13a
Mock a serialized entry response.
[ { "docid": "4651b2f3c64750b52e8146aaaaaeeb2f", "score": "0.6999839", "text": "def mock_entry(identifier, entry)\n url = entry.class.get_one_url(identifier)\n xml = Feed.new(entry.class).add_entry(entry).to_xml\n xml.elements['*:entry'].add_element('atom:id').add_text(url)\n mock_xml(...
[ { "docid": "e25e80fe2ad26ac6418572a2d9d40f9d", "score": "0.63166004", "text": "def store_simple_entry(*request_args)\n path, headers = request_args\n @request = mock_request(path || '/test', headers || {})\n @response = mock_response(200, {'Cache-Control' => 'max-age=420'}, ['test'])\n body ...
9c094983abd44fa777c21ca3a8e43842
Return hash of attributes with LDAP naming
[ { "docid": "9ba13945947235977836ab48965270f3", "score": "0.62534535", "text": "def attributes_from_user\n user_attributes = {}\n ldap_attribute_map.each do |ldap_attr, attr|\n user_attributes[ldap_attr] = attr.is_a?(Proc) ? attr.call(self.user) : self.user[attr]\n end\n user_attributes\...
[ { "docid": "54bddf75740a20593a017e8f26e61c80", "score": "0.75086176", "text": "def ldap_attribute_map\n {\n 'uid' => 'uid',\n 'sAMAccountName' => 'uid',\n 'uidNumber' => 'uid_number',\n 'gid' =>...
e007f1b6805aa3248d9a47f4f9d3e2b6
== Instance methods ==
[ { "docid": "830dae1a031defbdeb7d63e8b53ac8a5", "score": "0.0", "text": "def active_facebook_accounts\n facebook_accounts.where(is_active: true)\n end", "title": "" } ]
[ { "docid": "b5b25700e97a3ff8649acd443cb60f46", "score": "0.7918152", "text": "def instance; end", "title": "" }, { "docid": "b5b25700e97a3ff8649acd443cb60f46", "score": "0.7918152", "text": "def instance; end", "title": "" }, { "docid": "b5b25700e97a3ff8649acd443cb60f46",...
e1ae0ee1c8e77f3c4a44c1e2ada57021
Sets the model instance attribute of `test` to `true`
[ { "docid": "b3a5e00eecf0d64a6636db2e9c3c7393", "score": "0.60693425", "text": "def testify!\n update!(test: true)\n end", "title": "" } ]
[ { "docid": "b82f6f9d629195fc98ba4cc0bcf576bc", "score": "0.75467163", "text": "def is_test=(value)\n @is_test = value\n end", "title": "" }, { "docid": "7ae099f8dd1c0b75d088477db388d691", "score": "0.65232384", "text": "def set_test\n @test = Test.find(...
c589455f0d1453acd0947a9956e797f8
Returns the NSUndoManager for the application. In this case, the manager returned is that of the managed object context for the application.
[ { "docid": "32993eb0537968a0299b0b433fb3410f", "score": "0.6945878", "text": "def windowWillReturnUndoManager(window)\n self.managedObjectContext.undoManager\n end", "title": "" } ]
[ { "docid": "aa2598dbfa8ee12f2baf6aa8a661090f", "score": "0.7301758", "text": "def windowWillReturnUndoManager(window)\n return self.managedObjectContext.undoManager\n end", "title": "" }, { "docid": "4c9e4bac68d68c31b390db4d9c5b50ac", "score": "0.7124137", "text": "def windowWill...
59ecb3a01468c88757f72bfa6e253704
Focal points are stored as a [0,1] range, but Mastodon expects a [1,1] range.
[ { "docid": "a1c76dc094bd7dbad6cb94b6fe2486a7", "score": "0.7152436", "text": "def mastodon_focal_point\n return [] if focal_x.blank? || focal_y.blank?\n\n focal_x_transformed = ((focal_x * 2) - 1).round(3)\n focal_y_transformed = (1 - (focal_y * 2)).round(3)\n\n [focal_x_transformed, focal_y...
[ { "docid": "03e2c622fe9f9918cc21aadff21309c3", "score": "0.5428292", "text": "def dft_abs_points\n @range.map { |i| [ @x_axis[i], @dft_complex_y_axis[i].abs ] }\n end", "title": "" }, { "docid": "e91ec3d8eaab4f2ddf38785d1e7b14d4", "score": "0.53456557", "text": "def set_coordinat...
b20ce5e20d2472083b2d2725eeac3d82
PATCH/PUT /public_talks/1 PATCH/PUT /public_talks/1.json
[ { "docid": "1c33cbde23d6f22a93290bed99082040", "score": "0.7054261", "text": "def update\n respond_to do |format|\n if @public_talk.update(public_talk_params)\n format.html { redirect_to @public_talk, notice: 'Public talk was successfully updated.' }\n format.json { render :show, s...
[ { "docid": "318f8caa87cbf84967608088d7730f13", "score": "0.70574385", "text": "def update\n\n respond_to do |format|\n if @talk.update_attributes(params[:talk])\n format.html { redirect_to @talk, notice: 'Talk was successfully updated.' }\n format.json { head :no_content }\n e...
a37881f7e88ae40f9543be39b28dca3a
GET /estoque_reboques GET /estoque_reboques.json
[ { "docid": "939c84a953ce9e0a8fceeee6c03431c2", "score": "0.73325914", "text": "def index\n @estoque_reboques = EstoqueReboque.all\n end", "title": "" } ]
[ { "docid": "a4f6779276a63192c6e26412dec75660", "score": "0.73658794", "text": "def index\n @reboques = Reboque.all\n end", "title": "" }, { "docid": "c0c90e45c9538c7b2cf7b8637852aec3", "score": "0.68563294", "text": "def index\n @ques = Que.all\n respond_to do |format|\n ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "67f317cb70c72ce74c67fc93af7ab10b", "score": "0.0", "text": "def set_newsletter\n @newsletter = Newsletter.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...
9bc817bab841d27f5a186c619c2185e5
The entry in index.yaml for this chart version
[ { "docid": "22b1f05b8f8b487b9c7e8e7e59ee3c5f", "score": "0.5819569", "text": "def build_entry\n wanted_keys = %w(apiVersion description name version)\n chart_info = read_chart(tar_file_path).select { |k, v| wanted_keys.include? k }\n digest = Digest::SHA256.file(tar_file_path).hexdigest\n re...
[ { "docid": "40195144cce00479470e03164e1ceba8", "score": "0.67209494", "text": "def version\n @metadata[:version]\n end", "title": "" }, { "docid": "f516214e841ce04c7d4c231cd50e1f53", "score": "0.67148364", "text": "def version\n metadata_item(\"version\")\n end", ...
a1ce98536282b51f36adf89296daa5ec
halt with status 423 Locked, responding with the given errors object on the 'errors' key
[ { "docid": "bba2c673c379d3e8b5cfee78b375d1e5", "score": "0.7726485", "text": "def halt_locked(errors, render_options = {})\n halt_error(423, errors, render_options)\n end", "title": "" } ]
[ { "docid": "2170d17b9db20931f42450f44518e1e3", "score": "0.69089806", "text": "def halt_bad_request(errors, render_options = {})\n halt_error(400, errors, render_options)\n end", "title": "" }, { "docid": "84fe3c970e0f089eb314b9efa96da295", "score": "0.6765105", "text": "def ...
147c94314b0afc8c556805536353cd7e
this also worked but didn't pass the test because it technically didn't puts out line by line I got it to work using a variety of print vs. puts but the test didn't like that so I made a new method This one also works for any size holiday_hash Whereas the one I made to pass the test only works if there are 2 or fewer i...
[ { "docid": "0670a898b07d1fc60da3b204b20b2b5c", "score": "0.86019045", "text": "def all_supplies_in_holidays(holiday_hash)\n holiday_hash.each do |season, holidays|\n puts season.to_s.capitalize! + \":\"\n holidays.each do |holiday, items|\n split_holidays = holiday.to_s.split(\"_\")\n spl...
[ { "docid": "544e328f1b09b1ff2b174d79ff1e2630", "score": "0.8510031", "text": "def all_supplies_in_holidays(holiday_hash)\n holiday_hash.each do |season, holidays|\n puts \"#{season.capitalize}:\"\n holidays.each do |holiday, supplies|\n capitalized_holiday = holiday.to_s.gsub(\"_\",\" \").sp...
85efb9837404f230665771d58eb09d80
in seconds, time until a session fully expires
[ { "docid": "88e64b622a9a4a83a2754a7b18e6adf5", "score": "0.0", "text": "def user?\n session[\"auth_user\"] = nil unless (session[\"auth_start\"] || 0) + SESSION_DURATION > Time.new.to_i\n session[\"auth_user\"] = nil unless (session[\"auth_time\"] || 0) + SESSION_TIMEOUT > Time.new.to_i\n ...
[ { "docid": "870372891dec81640217104fe10a7da4", "score": "0.7937408", "text": "def session_timeout_seconds\n 60 * 60 * 0.5\n end", "title": "" }, { "docid": "50648470d93bbc479485c1c81efffacd", "score": "0.7901415", "text": "def seconds_remaining\n if @key.nil?\n raise ...
82698a68c7ad34cdc5a2e54305c01db4
Methods to add players, coaches, games to tables
[ { "docid": "eae13e6d6f7a94e9acda95f9fb8faf84", "score": "0.67264897", "text": "def add_player(db, name, number, position)\n\tdb.execute(\"INSERT INTO roster (name, num, position, points_scored, games_played) VALUES (?, ?, ?, 0, 0)\", [name, number, position])\nend", "title": "" } ]
[ { "docid": "289651bac9fbe2a24209d9c5e21fd107", "score": "0.70663595", "text": "def add_players(players) @players = players end", "title": "" }, { "docid": "f9e3a3a24276de31ab36c93916d334ac", "score": "0.70461136", "text": "def create_players\n\t\t\tend", "title": "" }, { ...
c5050057e963f9acf05d5ba387cb13d8
GET /escolas/1 GET /escolas/1.json
[ { "docid": "76e90d3b34050ded0ac36e18b7b564ff", "score": "0.0", "text": "def show\r\n end", "title": "" } ]
[ { "docid": "d0936d42116b9d55615e0ad36ffb14b9", "score": "0.6998837", "text": "def show\n json_response @escola\n end", "title": "" }, { "docid": "121d477554ed2da5933060722f113c9f", "score": "0.6984084", "text": "def index\n @casos = Caso.all\n\n respond_to do |format|\n ...
d089be71e1f7ea19bb515797c8e4824e
Returns wifi network info
[ { "docid": "856862fe0fa17c81c92c54b043c99d3e", "score": "0.787017", "text": "def wifi_info\n send_message!(Protocol::Device::GetWifiInfo.new,\n wait_for: Protocol::Device::StateWifiInfo) do |payload|\n {\n signal: payload.signal, # This is in Milliwatts\n ...
[ { "docid": "e803f753d003b85cbfe38decb9ffd784", "score": "0.7377784", "text": "def network\n lines, errs = networksetup(\"getairportnetwork #{options[:device_id]}\")\n lines.join('\\n') =~ /Current Wi-Fi Network: (.+)$/i\n $1\n end", "title": "" }, { "docid": "063c31ed018490...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "9c402a56db73e2bb5e1686865a04761f", "score": "0.0", "text": "def transcript_params\n params.require(:transcript).permit(:title, :filename, :file, :content_type, :description, :tag, :user_id, :imagefile)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6978086", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6780264", "text": "def strong_params\n params.requi...
fe81cdd16a002ac486a6c7a69c9ae4f7
////////////////////////////////////////////////////////////////////////// Properties ////////////////////////////////////////////////////////////////////////// Get the current battle formation GET
[ { "docid": "88f51b6bce08df6b4c18af94b6705265", "score": "0.0", "text": "def selected_formation\n return @data[self.index]\n end", "title": "" } ]
[ { "docid": "5a20f230b0d1973270126ad51a96a41a", "score": "0.6691965", "text": "def battle_bgm\r\n if @battle_bgm == nil\r\n return $data_system.battle_bgm\r\n else\r\n return @battle_bgm\r\n end\r\n end", "title": "" }, { "docid": "ce8e875a93be7970f7d30676790d42ed", "s...
75c42bdd794f65b4b3f41eb6d05f3de2
Returns hash keyed by unique service name, value service definition hash.
[ { "docid": "7949021897dcd6c9a2a226e5cd14ea6b", "score": "0.6259439", "text": "def service_definitions\n unless defined? @service_definitions\n @service_definitions = {}\n config.each_pair do |group_name, group|\n if group[\"services\"]\n # Add the group name to each service\...
[ { "docid": "3d7327376ab2558cefa128b3dd54945b", "score": "0.72443575", "text": "def hash\n [dd_service, description, display_name, service_tier].hash\n end", "title": "" }, { "docid": "e1f99dd471656a7681727f77dfe88c87", "score": "0.6291766", "text": "def service_hash()\n ...
44f31c7df8cdef128bc1074ab29e27e7
SMART L, Chisholm LOGN
[ { "docid": "545654744a2d5ca914ea8a817096097f", "score": "0.0", "text": "def normalized_log_term_frequency(term)\n count = term_counts[term]\n if count > 0\n (1 + Math.log(count)) / (1 + Math.log(average_term_count))\n else\n 0\n end\n end", "title": "" } ]
[ { "docid": "43a773d4bd2ecdc67f4f8055bc6cbd3f", "score": "0.6881235", "text": "def stat_theil_l_index\n stat_normalized_distribution.inject(0) { |s,ae| \n e=ae[1].to_f; a=ae[0].to_f; s + a*Math.log(a/e) }\n end", "title": "" }, { "docid": "9c79efd5bf353a6c423a90c831caa706", "scor...
7ba5bcb666d9b6d7fa2984a9f62fe416
POST /owners POST /owners.json
[ { "docid": "192a6e4f0ac4c60d7e7c7570ab2e31b6", "score": "0.6745191", "text": "def create\n @owner = Owner.new(owner_params)\n @owner.id = Owner.all.last.id + 1 #manually set id\n respond_to do |format|\n if @owner.save\n format.html { redirect_to @owner, notice: 'Owner was successfu...
[ { "docid": "dc8d1a5cf8f6cccf42dfdbad0bd012db", "score": "0.6936448", "text": "def create\n @owner = Owner.new(owner_params)\n\n respond_to do |format|\n if @owner.save\n format.html { redirect_to @owner, notice: 'Owner was successfully created.' }\n format.json { render :show, s...