query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
45d1ef03e3de1367715872177325bec4
Builds a Metadata instance from a FieldStruct class
[ { "docid": "6496e5a55a606d57ba596f5262324ddf", "score": "0.47893515", "text": "def from(klass)\n new klass.name.to_s,\n nil,\n build_type(klass),\n klass.extras,\n build_initial_attributes(klass)\n end", "title": "" } ]
[ { "docid": "3d395efc5983114fd94364256ee0d866", "score": "0.67461675", "text": "def to_struct_class\n # flatten fields to handle the case where a helper has contributed a series of fields\n # in an array\n args = @fields.flatten\n # prepend the name if specified\n args ...
64b55dd6f928c041c5ef9348afe7ad25
GET /additional_payments/1 GET /additional_payments/1.json
[ { "docid": "18b333e632d5eeaebd648073f8949844", "score": "0.0", "text": "def show; end", "title": "" } ]
[ { "docid": "6f187e28a2876c752a34ad85a38c8a50", "score": "0.6730038", "text": "def show\n @payments = Payment.find(params[:id]) \n render json: @payments\n end", "title": "" }, { "docid": "de70615e348b44b1fd49d0461392dd7e", "score": "0.6705069", "text": "def set_additional_paym...
33a9a65b6a57e8a5600dd8919001cb7c
225 Write a method called toonify that takes two parameters, accent and sentence. If accent is the string "daffy", return a modified version of sentence with all "s" replaced with "th". If the accent is "elmer", replace all "r" with "w". Feel free to add your own accents as well! If the accent is not recognized, just r...
[ { "docid": "867a418b25e038356a09508807902730", "score": "0.8361379", "text": "def toonify accent, sentence \n\n\t mod_sent = \"\"\n\n\t if accent === \"daffy\"\n\t \tmod_sent = sentence.gsub(\"s\", \"th\");\n\t elsif accent === \"elmer\"\n\t \tmod_sent = sentence.gsub(\"r\", \"w\");\n\t else \n\t \tmod_...
[ { "docid": "6acce7d173c71369ef63eae49fc81b2c", "score": "0.87552637", "text": "def toonify(accent, sentence)\n\tif accent === \"daffy\"\n\t\tp sentence.gsub(\"s\", \"th\")\n\t\t#gsub(pattern, replacement) → new_str\n\telsif accent === \"elmer\"\n\t\tp sentence.gsub(\"r\", \"w\")\n\telse\n\t\tp sentence\...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "21d60ec11b111b72d081570dbe7a765b", "score": "0.0", "text": "def quiz_attempt_params\n params.require(:quiz_attempt).permit(attempted_questions_attributes: [:id, :submitted_answer])\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...
bc4c39144538edd2c5b5f60481f73e5d
This authenticates against bluepages using LDAP.
[ { "docid": "f7c7378b9271cfe6090f111b026df069", "score": "0.76766306", "text": "def ldap_authenticate\n # logger.debug(\"ldap_authenticate\")\n # ldap_time = Benchmark.realtime { ActiveLdap::Base.setup_connection }\n # logger.debug(\"LDAP: took #{ldap_time} to establish the connection\")\n au...
[ { "docid": "730a751c83c8e88ad651d01b5c572590", "score": "0.76872563", "text": "def ldap_authenticate\n # logger.debug(\"ldap_authenticate\")\n # ldap_time = Benchmark.realtime { ActiveLdap::Base.setup_connection }\n # logger.debug(\"LDAP: took #{ldap_time} to establish the connection\")\n au...
f260b0743e3635ff851ba1fb8f391b00
GET /users/1 GET /users/1.json
[ { "docid": "7b829586bb241f30e0b16615a073341a", "score": "0.0", "text": "def show\n\n end", "title": "" } ]
[ { "docid": "9f7c735ace683c5c2b12c914cc9ad8a8", "score": "0.771752", "text": "def get\n users = User.all.as_json\n render(json: users.as_json, status: :ok)\n end", "title": "" }, { "docid": "a95dfe28d6b386aafc5fb53749e84258", "score": "0.75107867", "text": "def user\n...
68e4195f7fb48c3e5cfc0ae1ea3ee5c6
Offset the current timestamp by a number of hours
[ { "docid": "3d2bdfd7dbe5edaaad52787a4404d5b7", "score": "0.52224606", "text": "def hours(num)\n t = current_time + num * SECONDS_IN_HOUR\n {\n type: :datetime,\n value: t.iso8601\n }\n end", "title": "" } ]
[ { "docid": "57f8bc0ef494306a6f4619a3394d4ffb", "score": "0.6975928", "text": "def get_time(offset = 0)\n @now += offset + 1\n end", "title": "" }, { "docid": "9787c16b589e66f19b91da8e77a6a523", "score": "0.6564212", "text": "def next_hour(time, time_source = nil)\n sec...
98d04f0cea01d943407e6f3b5384d693
parser rule dim_struct (in Hephaestus.g) 132:1: dim_struct : LBRACK exp ( COMMA exp )? RBRACK ;
[ { "docid": "f792923cfe72b2e12177ddbeb3242b94", "score": "0.8087972", "text": "def dim_struct\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 7 )\n\n\n begin\n # at line 133:5: LBRACK exp ( COMMA exp )? RBRACK\n match( LBRACK, TOKENS_FOLLO...
[ { "docid": "89482eaa98239f4178569e9e9206e1ed", "score": "0.598509", "text": "def dim_dec\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 5 )\n\n\n __ID3__ = nil\n __INTEGER5__ = nil\n type4 = nil\n\n\n begin\n # at line 125:5: D...
3377c1986131b5d73f6806c7734f0d88
Mark that the process is executor. This prevents the remote setting from applying. Needs to be set up before the world is being initialized
[ { "docid": "e2579df0b8ab063f8de8017a3b8914bc", "score": "0.6527891", "text": "def executor!\n @executor = true\n end", "title": "" } ]
[ { "docid": "04cc9bb3419539ef41afad94eb941a96", "score": "0.5929008", "text": "def executor(executor)\n @cli_executor.executor = executor\n end", "title": "" }, { "docid": "187e385ff45b7e11fb97910c30daa151", "score": "0.57183546", "text": "def after_probe_master\n unless @run...
d10325aa772134881b3651183c6336aa
Determines the total number of matches that the wrestler has
[ { "docid": "5ea1aba1f785f4d64c6ec744cc1e35b1", "score": "0.60247016", "text": "def matches\n @wins + @losses + @draws\n end", "title": "" } ]
[ { "docid": "4f32e0260910bc2be2f3f080a8a40858", "score": "0.7593481", "text": "def matched_count\n @results[MATCHED_COUNT]\n end", "title": "" }, { "docid": "04859581b4067ab0ef44d83406016da6", "score": "0.74290216", "text": "def return_count\n return @matchedCount\n en...
e1a4432fc98fe716695683fa1055d58e
checks to see if the position on the board is taken. If it is taken, true, if not, false.
[ { "docid": "98c0073f4bf0f09309bd361f55a322bc", "score": "0.7904363", "text": "def position_taken?(board, index)\n if board[index] == \"X\" || board[index] == \"O\"\n true\n else board[index] != \"X\" || board[index] != \"O\"\n false\n end\nend", "title": "" } ]
[ { "docid": "60415d139dd7a9ddd1948845673d9a7d", "score": "0.81727624", "text": "def position_taken? (board,position)\n if board[position]==\" \" || board[position]==\"\" || !board[position]\n return false\n elsif board[position]==\"X\" || board[position]==\"O\"\n return true\n end\n e...
5a2220c5b27b5573613e5f07ddd46461
Newer rubies have this; older rubies don't
[ { "docid": "3679fa3e8b29b4e5b05207766c48f32a", "score": "0.0", "text": "def to_h\n Hash[members.map(&:to_sym).zip(values)]\n end", "title": "" } ]
[ { "docid": "516c2bf61da21ddeea3cb9744e6a708a", "score": "0.6631783", "text": "def older_rubies\n @older_rubies ||= %w[ ruby-3.0 ruby-2.7 ruby-2.6 ruby-2.5 ]\n end", "title": "" }, { "docid": "f19fa747343a3d99b474a4b7beb900fe", "score": "0.63902307", "text": "def recent_rubies\n ...
7c524baf088ea7115f106c9261b625d9
Given a basic rack environment, will properly fill it in with the information gleaned from the parsed request. Note that this only fills the subset that can be determined by the parser library. Namely, the only rack. variable set is rack.input. You should also have defaults in place for SERVER_NAME and SERVER_PORT, as ...
[ { "docid": "0f68c724b35b283a5ab2f6de3f1298ec", "score": "0.7613082", "text": "def fill_rack_env(env = {})\n env[\"rack.input\"] = @body || StringIO.new\n env[\"REQUEST_METHOD\"] = @method\n env[\"SCRIPT_NAME\"] = \"\"\n env[\"REQUEST_URI\"] = @path\n env[\"PATH_INFO\"], query = ...
[ { "docid": "4517a82cff21c1399ced0887ed40dfd5", "score": "0.6654423", "text": "def rack_input ; @env['rack.input'] ; end", "title": "" }, { "docid": "62b930d32de127d37b833b244587a54e", "score": "0.65874016", "text": "def build_rack_env\n uri = URI.parse(request_env....
6ed1336a4fb7f83bdf9eea0209a8c942
PUT /bids/1 PUT /bids/1.json
[ { "docid": "e01c89bc5aa246d4fc78bc84ed5e8d14", "score": "0.63410693", "text": "def update\n @bid = Bid.find(params[:id])\n\n respond_to do |format|\n if @bid.update_attributes(params[:bid])\n format.html { redirect_to @bid, notice: 'Bid was successfully updated.' }\n format.json...
[ { "docid": "cc9077fd597b69bec2413bfe47fcf32d", "score": "0.6879835", "text": "def update\n @bid = @swarm_request.bids.find(params[:id])\n\n respond_to do |format|\n if @bid.update_attributes(params[:bid])\n format.html { redirect_to(swarm_request_bid_url(:id => @bid.to_param, :swarm_re...
16459f0b518f25ad415354e08230aa8b
Downloads the document located at `url`.
[ { "docid": "29ca9f1565e6deefa0a3657f17856f64", "score": "0.6920764", "text": "def download(url)\n resp = http.get(url, :follow_redirect => true)\n\n unless resp.ok?\n raise(\n HTTPClient::BadResponseError,\n \"Got HTTP #{resp.status}: #{resp.body}\"\n ...
[ { "docid": "06d9e70c74604286d5aece75ec4baa0e", "score": "0.776083", "text": "def download(url)\n base.get(url, @file_path)\n end", "title": "" }, { "docid": "c7e0a60e518c4a16f16aae6fec11827d", "score": "0.7534194", "text": "def download(url)\n Net::HTTP.get_response(ur...
b1ed20bf95954903b3b5fc7586067790
GET /trade_items/1 GET /trade_items/1.json
[ { "docid": "e5780bb1c03508a08d417f4ff7baad9d", "score": "0.7427697", "text": "def show\n @trade_item = TradeItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trade_item }\n end\n end", "title": "" } ]
[ { "docid": "62fa0efcc2c0fee8e3ab77bc075dbb82", "score": "0.71378267", "text": "def index\n @trade_items = TradeItem.all\n end", "title": "" }, { "docid": "b036b8dff3ad368f655b7e8c63972eee", "score": "0.65937614", "text": "def new\n @trade_item = TradeItem.new\n\n respond_to...
a40b6df7370f2322c0eff132ef2b715c
tests checkout with local repository and rsync
[ { "docid": "4ba53f8283194e876fb544c07884836c", "score": "0.84386635", "text": "def test_checkout_local_rsync\n @actor.story = []\n @config[:repository_is_not_reachable_from_remote]= true\n @config[:use_rsync]= true\n @config[:local_rsync_cache]= \"/tmp/local_cache\"\n @config[:remote_rsyn...
[ { "docid": "e9f80f6d39a3961bf4b0d19cb21bbe3d", "score": "0.7500847", "text": "def test_checkout_local\n @actor.story = []\n @config[:repository_is_not_reachable_from_remote]= true\n\n assert_nothing_raised { @scm.checkout(@actor) }\n\n assert_equal 2, @scm.local_cmds.size\n\n # get direct...
1b3046457d96167882624923b3b8c2ad
Inject request context into serializers.
[ { "docid": "069e2e3423daef0cab5eb04210a118a9", "score": "0.0", "text": "def default_serializer_options\n {\n root: false,\n }\n end", "title": "" } ]
[ { "docid": "a882926581a5d5204aa986fc0f52a0bb", "score": "0.715583", "text": "def serialization_context request\n options[:serialization_context] = OpenStruct.new(\n request_url: request.original_url.split('?')[0], # url without query params\n query_parameters: request.query_parameters\n ...
7f3b54ea58afd2faec5c3f5fe64bd64d
Public: Renews the lease. The lease can be renewed if the lease ID specified on the request matches that associated with the container. Note that the lease may be renewed even if it has expired as long as the container has not been modified or leased again since the expiration of that lease. When you renew a lease, the...
[ { "docid": "3fb8e3ed55f901b7769b7e702a68c8c9", "score": "0.80447525", "text": "def renew_container_lease(container, lease, options = T.unsafe(nil)); end", "title": "" } ]
[ { "docid": "548693352c87b687af8c7fadc2f97a34", "score": "0.74100685", "text": "def change_container_lease(container, lease, proposed_lease, options = T.unsafe(nil)); end", "title": "" }, { "docid": "90b786c681bc03699e7f9da83a37df44", "score": "0.7229342", "text": "def renew_blob_leas...
15ae75caafe1507f3b57ab6eb6a17131
Set the job servers to be used by this client.
[ { "docid": "ebca95f01d33523d3e59daa0d0065536", "score": "0.8481271", "text": "def job_servers=(servers)\n @job_servers = Util.normalize_job_servers(servers)\n self\n end", "title": "" } ]
[ { "docid": "b8474a8a9a34434210465058849a0067", "score": "0.8065982", "text": "def job_servers=(servers)\n @servers_mutex.synchronize do\n update_job_servers(servers)\n end\n end", "title": "" }, { "docid": "5264512a14e6548f704edc9b94ee7379", "score": "0.7262837", "text": ...
10a9b3bf1820313586d396eee7c0fc7f
Takes an unsorted array of data and turns it into a binary tree full of Node objects appropriately placed.
[ { "docid": "6c1bafe58d6e13e4767e8edb653813f0", "score": "0.70626086", "text": "def build_tree_unsorted(array)\n # Since we can't sort the array, there's no way to know what's the\n # median of the values. So we're gonna choose a random input for the root.\n @root = Node.new(array[array.length/2...
[ { "docid": "8cfe532992c2714865acf32e325366ab", "score": "0.8001688", "text": "def build_tree(array)\n #Assign first value (at 0 index) as root node, shift removes the first element, so array is shorten by 1\n @root = Node.new(array.shift) if @root.nil?\n # Take each remaining element and make i...
c750963f57c09142510fe2808fab4eb6
GET /projects/new GET /projects/new.xml
[ { "docid": "f2db6dd81b5f897f844155050b793a73", "score": "0.0", "text": "def new\n tab :project\n @project = Project.new\n @project.status = \"Created\"\n @project.license_id = 2\n @licenses = License.find(:all)\n @project_types = PROJECT_TYPES\n end", "title": "" } ]
[ { "docid": "dbef0ee582f283b231fc4f78e9ba31ba", "score": "0.80594975", "text": "def new\n @new_project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @new_project }\n end\n end", "title": "" }, { "docid": "3cc479fe95fda...
00fbb1eb64b58c44f1820a345a9963e0
expire log to make the target artifact expired
[ { "docid": "852a0a6f2ac274e0d32b1b6d20f19917", "score": "0.7627793", "text": "def expire_logs()\n return unless can_artifact_be_tracked?\n\n p1 = items_log_path()\n File.delete(p1) if is_items_log_enabled? && File.exists?(p1)\n\n p2 = attrs_log_path()\n File.delete(p2)...
[ { "docid": "f22f8ff502ed22d63b0d856401ae7b89", "score": "0.6732255", "text": "def expire!; end", "title": "" }, { "docid": "f22f8ff502ed22d63b0d856401ae7b89", "score": "0.6732255", "text": "def expire!; end", "title": "" }, { "docid": "87b94f45b155f08b33d9702e1cb8e768", ...
c7a802bccf442ca77f683cb148197b3f
Convert to configuration file string
[ { "docid": "fb2120843e303dbf218fe46fe862d2ac", "score": "0.58096606", "text": "def to_config\n \" PROCESSOR #{@name} #{self.class.name.to_s.class_name_to_filename} #{@item_name} #{@value_type}\\n\"\n end", "title": "" } ]
[ { "docid": "aea90ce75ae78222a912a7cfd5a5cf71", "score": "0.73033106", "text": "def to_config_file_str\n config = {\n 'dataDir' => data_dir,\n 'skipACL' => skip_acl,\n 'tickTime' => tick_time,\n 'initLimit' ...
d1a562a586092614ab05065fde577404
Sets the attribute server_url
[ { "docid": "fe89118972fef26d221326c485ead3f8", "score": "0.7107479", "text": "def server_url=(_arg0); end", "title": "" } ]
[ { "docid": "90425d079ca89fe90420da00777fa977", "score": "0.81812567", "text": "def server_url=(new_url)\n @server_uri = build_resource_uri_from new_url\n end", "title": "" }, { "docid": "e618cb55833a64455eb25ddf73b01bc2", "score": "0.76405483", "text": "def server=(server) #:...
529416ee2a1c0f7b9deabf49a870b544
DELETE /teststandards/1 DELETE /teststandards/1.xml
[ { "docid": "19e14c9d758a4de6305d945b708da94c", "score": "0.71334136", "text": "def destroy\n @teststandard = Teststandard.find(params[:id])\n @teststandard.destroy\n\n respond_to do |format|\n format.html { redirect_to(teststandards_url) }\n format.xml { head :ok }\n end\n end", ...
[ { "docid": "df26116eb86dbadafed7137f9e3c2f9e", "score": "0.6795875", "text": "def delete!\r\n return nil unless exists? \r\n xml = xml_at_top\r\n par = xml.instance_variable_get(:@parent) \r\n par['delete'] = 'delete'\r\n xml_on_delete( xml )\r\n rsp = write_xml_config!( xml.doc....
6653093e115f49c64cf0398364a25f05
DELETE /mini_map_roads/1 DELETE /mini_map_roads/1.json
[ { "docid": "3fdb86d1c1d3d1661c50286600b8aa3b", "score": "0.8157913", "text": "def destroy\n @mini_map_road = MiniMapRoad.find(params[:id])\n @mini_map_road.destroy\n\n respond_to do |format|\n format.html { redirect_to mini_map_roads_url }\n format.json { head :no_content }\n end\n...
[ { "docid": "b665af3e40d8ac0ab623e392e177c53f", "score": "0.7507803", "text": "def destroy\n @roadmap.destroy\n respond_to do |format|\n format.html { redirect_to roadmaps_url, notice: 'Roadmap wurde erfolgreich gelöscht' }\n format.json { head :no_content }\n end\n end", "title":...
7bdcb4ed54e78c034facf184d3f3fd84
Instantiates a new deviceAndAppManagementRoleDefinition and sets the default values.
[ { "docid": "c57459d8d0c0ba8de68bf0a6b2bbd759", "score": "0.67993706", "text": "def initialize()\n super\n @odata_type = \"#microsoft.graph.deviceAndAppManagementRoleDefinition\"\n end", "title": "" } ]
[ { "docid": "d05f0c68c5d96ebc17dd1dfaf3233a14", "score": "0.526615", "text": "def setup_role\n if self.role_ids.empty?\n self.role_ids = [2]\n end\n end", "title": "" }, { "docid": "e46a15bfb7ef307908e29f2fde4fb63c", "score": "0.5247046", "text": "def new\n @rol...
7c726db2cbd5da4a245ba013fbc55f95
an object is added to the end of the stack by calling push on stack and passing it the object
[ { "docid": "927e6b6be6322138c30f3410a374d7bf", "score": "0.87625647", "text": "def add_to_stack(obj)\n stack.push(obj)\n end", "title": "" } ]
[ { "docid": "ea8b9abf981e5720cb6bff34d1da19eb", "score": "0.7983631", "text": "def <<(obj)\n stack << obj\n self\n end", "title": "" }, { "docid": "20dc4ad6aa9b847605c8f7cd4fdb9445", "score": "0.7818883", "text": "def push(o)\n @stack.push o\n @pc += 1\n end"...
31d9158e0684d0b474ed05eb3d116da5
Check whether a tracker record with the same protocol already exists for this master If it does then a DB trigger will update the existing record rather than creating a new one. This following method ensures that the latest tracker entry for this protocol is returned, whatever action is taken by the DB triggers behind ...
[ { "docid": "ef796641c375e334a8597612f8329af1", "score": "0.73362654", "text": "def merge_if_exists\n # Get the existing tracker item for the master / protocol pair in the new record (self)\n # If it exists then we handle saving the new record and getting the appropriate response.\n # If it does...
[ { "docid": "c965352b580444ae42779e23fc559b24", "score": "0.58147484", "text": "def set_record_updates_event(record)\n # Decide if this is a new or updated record. Check both id_changed? and save_change_to_id? since we can't be sure\n # if we'll be in an after_save or after_commit callback\n new...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "518b4fd6ab05bfdf31bf8932b6f7bb00", "score": "0.0", "text": "def set_user\n @user = User.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;...
138c5ba2adb8a9b2ddbd798e203aecf0
Adds a given album to this artist's releases
[ { "docid": "5f395e4751a3436a06042db10c498187", "score": "0.6851083", "text": "def add_album(p_album)\n\n\t\t\t# Check parameter\n\t\t\treturn unless p_album.is_a? Album\n\n\t\t\t# Only add album if not already present\n\t\t\tunless @albums.include?(p_album)\n log.debug \"[#{self.name}] Added albu...
[ { "docid": "e4a42a68d54b692947acc9b67c30f682", "score": "0.73605984", "text": "def add_album=album\n\t\t@albums << album\n\tend", "title": "" }, { "docid": "483a1f5aa8f6b171df39fda35b99d086", "score": "0.7132443", "text": "def add_album( album )\n existing_item = @items.find {|ite...
d160bd9fd7575e132b22e9b909ce32c2
Private: The connection Returns the current connection to the device
[ { "docid": "f7d6322a32a5e26ff47206790e8bd64c", "score": "0.7326164", "text": "def connection\n @_connection ||= Airplay::Connection.new(@device)\n end", "title": "" } ]
[ { "docid": "29b7e4695e64e40dd860ed9bb9cd6b9a", "score": "0.78052753", "text": "def connection\n state.connection\n end", "title": "" }, { "docid": "833e9f99873df4036b225353788d18a7", "score": "0.7687983", "text": "def connection\n\t\tself.connect\n\t\t\n\t\t@connections[T...
a7aa172b04ecb824c301acadb4e659d3
Return the path of the specified +dir+ under the svn root of the checkout.
[ { "docid": "2e95377c701c4239294ff9bf4e1cbfac", "score": "0.8358314", "text": "def get_svn_path( dir='.' )\n\troot = get_svn_repo_root( dir )\n\turl = get_svn_url( dir )\n\t\n\treturn url.sub( root + '/', '' )\nend", "title": "" } ]
[ { "docid": "fe86a28434ab75321e662fb3ed85041e", "score": "0.72871006", "text": "def get_svn_repo_root( dir='.' )\n\tinfo = get_svn_info( dir )\n\treturn info['Repository Root']\nend", "title": "" }, { "docid": "17fe95e22e3bf2dda8c4dd8bd2baa0be", "score": "0.675866", "text": "def get_s...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "fd9dea9f968facd2c27edfd2216a7c10", "score": "0.0", "text": "def search_term_params\n params.require(:search_term).permit(:user_id, :search, :type)\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"...
5cd402fd66d07f16cf0f06da3cd6f8de
Generic parse action, overridden by subclasses
[ { "docid": "5790349e472e63a67ffa0b9e9e437b54", "score": "0.0", "text": "def parse_date(value)\n ::Date.parse(value)\n end", "title": "" } ]
[ { "docid": "cfc64655d8a635c2b0e52549825348ed", "score": "0.741956", "text": "def parse; end", "title": "" }, { "docid": "cfc64655d8a635c2b0e52549825348ed", "score": "0.741956", "text": "def parse; end", "title": "" }, { "docid": "cfc64655d8a635c2b0e52549825348ed", "sc...
e791d93dc3dd12d28171d51a81a6d8c8
Validates the username submitted by the admin and shows error messages if the username is not valid
[ { "docid": "d08cb3a21f6c73517ad7bc2edf20afdc", "score": "0.772106", "text": "def validate_username\n if username.nil?\n errors.add(:username, \"Käyttäjätunnuksen tulee olla vähintään 3 merkin pituinen\")\n return false\n end\n\n if username.length < 3\n errors.add(:username, \"Kä...
[ { "docid": "650938c0dffd4d095371577df4d0b83c", "score": "0.8670226", "text": "def username_validation\n if name && !username\n errors.add(\"Please enter a username!\")\n end\n end", "title": "" }, { "docid": "5c26c77ad2514e44741bab0ab58fc2fa", "score": "0.8269...
9eb9e05ed345d001a86af88dfea30132
4 spaces per one deep
[ { "docid": "ae5ae7710678fa1c1d8c66cfab9f902b", "score": "0.66963714", "text": "def indentation(depth)\n \" \" * 4 * depth\nend", "title": "" } ]
[ { "docid": "e2489be33f2b562b77f1ff88aca86f7e", "score": "0.6769943", "text": "def printLinesLevel(baseWidth,stack,i)\n if i == 0\n return\n end\n dir = 1\n for j in 0..(( 2**i ) - 1)\n element = stack[j].to_s.length\n printSpace(baseWidth - 1)...
8aa42824c661b62bcdd570110de1f576
Assemble a Page's filename from its name and format. name The String name of the page (should be precanonicalized). format The Symbol format of the page. Returns the String filename.
[ { "docid": "f0afebfe59df0cca9bebd99d0e38123b", "score": "0.8134208", "text": "def page_file_name(name, format)\n format.nil? ? name : \"#{name}.#{::Gollum::Page.format_to_ext(format)}\"\n end", "title": "" } ]
[ { "docid": "0e2fdf006de48a64f41b43769fb4b630", "score": "0.82315075", "text": "def page_file_name(name, format)\n ext = @page_class.format_to_ext(format)\n @page_class.cname(name) + '.' + ext\n end", "title": "" }, { "docid": "e496f47391a94135a305ff094151427d", "score": "0.6...
7c44b7c79b04e5dfb55791bc1d6697e3
GET /topics GET /topics.json
[ { "docid": "ad4d16c0e64b9162f07c77896560168e", "score": "0.75847054", "text": "def index\n @topics = Topic.all\n render json: @topics\n end", "title": "" } ]
[ { "docid": "b64878a9e43283c9c1e729077a1f3c5c", "score": "0.84226954", "text": "def topics\n get 'topics'\n end", "title": "" }, { "docid": "e7f1c7a4d11f981f7846cf4ba6b56a88", "score": "0.7653341", "text": "def index\n @topics = Topic.order(:name).all\n \n respond_to do...
ec533f36c601be3c51f5618d28c4cacc
POST /testresultcomments POST /testresultcomments.json
[ { "docid": "1b937c1da2c41007c9975228743cbf57", "score": "0.7362616", "text": "def create\n @testresultcomment = Testresultcomment.new(testresultcomment_params)\n\n respond_to do |format|\n if @testresultcomment.save\n format.html { redirect_to @testresultcomment, notice: 'Testresultcom...
[ { "docid": "2fd8d8b6729ecd8d660df7e609226381", "score": "0.7320453", "text": "def create\n @test_comment = TestComment.new(test_comment_params)\n\n respond_to do |format|\n if @test_comment.save\n format.html { redirect_to @test_comment, notice: 'Test comment was successfully created.'...
238bd067330de366b195864e7cf7e7b5
Rarity of the size given rarity divisions
[ { "docid": "6e5516b1a521cf5751c8e17e8ee24db9", "score": "0.59088314", "text": "def rarity(rarity_data = nil)\n if rarity_data.nil?\n # Only cache when default rarity being used\n @rarity ||= Rarity::Value.new(@bsd, rarity_data)\n return @rarity\n else\n return Rarit...
[ { "docid": "dd6beebfa62710a1577d9531bcb2e751", "score": "0.7129617", "text": "def rarity\n RARITY.key(read_attribute(:rarity))\n end", "title": "" }, { "docid": "867ad34dcc41049bb7b75e67b138a930", "score": "0.6283096", "text": "def compute_size(*dimensions)\n\t\tdimensions.sort!\...
52c868398b1890571024591d81434778
Before any action require the user to be admin
[ { "docid": "e6914d08f022a98d1795ca083a1112b5", "score": "0.0", "text": "def index\n @project = Project.all.order(\"created_at desc\").paginate(:page => params[:page], :per_page => 5)\n end", "title": "" } ]
[ { "docid": "da417a9c255d06af4c02c956e874bed5", "score": "0.79218453", "text": "def require_admin\n\t if logged_in? & !current_chef.admin?\n\t flash[:danger] = \"Only admin users can perform that action\"\n\t redirect_to root_path\n\t end\n\tend", "title": "" }, { "docid": "fe516d4b9f5b63...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "422e57e11508daa7b9b709fc246df6c2", "score": "0.0", "text": "def set_setup\n @setup = Setup.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...
f7d811f52e86763e444a91f21ecbd02f
PATCH/PUT /anime_titles/1 PATCH/PUT /anime_titles/1.json
[ { "docid": "d74e75069bc280a89e3027696d995ef1", "score": "0.700939", "text": "def update\n respond_to do |format|\n if @anime_title.update(anime_title_params)\n format.html { redirect_to @anime_title, notice: 'Anime title was successfully updated.' }\n format.json { render :show, st...
[ { "docid": "381be792c7c67d47ddb107d2b161f8c0", "score": "0.65409243", "text": "def update\n @title = Title.find(params[:id])\n\n respond_to do |format|\n if @title.update_attributes(params[:title])\n format.html { redirect_to @title, notice: 'Title was successfully updated.' }\n ...
d6c13dd842ea87a665f53f4b98920e53
method to add user feedback to profile even if prepped missed them
[ { "docid": "15327520b3140042942604213052d1a2", "score": "0.6502616", "text": "def addUserFeedback user \n feedback = user.feedback.select{ |f| f.choice == self }.first\n unless feedback.nil?\n option = self.options.select{|o| o.id == feedback.option_id }.first\n option[:feedbacks].push(...
[ { "docid": "69687cf8f33dd81d6bff625e19aa18b2", "score": "0.6539066", "text": "def feedback\n end", "title": "" }, { "docid": "9f3fbb8500cb40a3ebe73e8a0175335e", "score": "0.61911714", "text": "def confirm!\n # add if else here in case user already existed and is updating/changing...
267a19cc843105d84d941c321fc6a8e7
Big Octopus and Biggest Fish
[ { "docid": "adbdc47e2dcf4a950a3ec7a7ea1a2ade", "score": "0.0", "text": "def sluggish(arr) #O(n^2)\n arr.each do |word|\n return word if arr.all? { |other_word| word.length >= other_word.length }\n end\nend", "title": "" } ]
[ { "docid": "a44a3b3919bb2da2a619c72f8b10c9b4", "score": "0.73024637", "text": "def dominant_octopus(fish)\n return fish if fish.size <= 1\n mid = fish.size/2\n left = fish[0..mid-1]\n right = fish[mid..-1] \n sorted_octo = octopus_helper(dominant_octopus(left), dominant_octopus(right)) \n sorted_...
ab0ee7695e547f06d8e3ee9416194b70
POST /menus POST /menus.xml
[ { "docid": "145e5888a9e6d6b51e96e3c77b822c29", "score": "0.0", "text": "def create\n @menu = Menu.new(params[:menu])\n @menu.save\n\n respond_to do |format|\n format.js\n end\n end", "title": "" } ]
[ { "docid": "67d23edb64ca767ce25e70e155895e4c", "score": "0.66717637", "text": "def create\n @menu = Menu.new(params[:menu])\n respond_to do |format|\n if @menu.save\n format.html { redirect_to(@menu, :notice => 'Menu was successfully created.') }\n format.xml { render :xml => @...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "a5f49aa261f9f795d34da899bcdd18c2", "score": "0.0", "text": "def order_group_params\n params.require(:order_group).permit(:order_date, :user_id)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7498391", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6958937", "text": "def strong_params\n params.require(:request).permit(param_white...
9787701663f05583c426e476d236c3af
the location or locations in which to archive the json
[ { "docid": "14a2defe83a0250bd5e72de05d8695e0", "score": "0.57053363", "text": "def archive_locations\n @supervisor.archive\n end", "title": "" } ]
[ { "docid": "83301eef6ce7d0ce625608d352eb369e", "score": "0.6462387", "text": "def store_dir\n 'geojson'\n end", "title": "" }, { "docid": "5ed84108a69952c0be493eec3c25fb0e", "score": "0.64476115", "text": "def as_json(_options = {})\n as_json_bkp only: [:id,\n ...
01df484d783a8df393ee3f42d57cde39
DELETE /mini_reviews/1 DELETE /mini_reviews/1.json
[ { "docid": "4b0dbb30effcbf83da895cd4455079c4", "score": "0.8059626", "text": "def destroy\n @mini_review = MiniReview.find(params[:id])\n @mini_review.destroy\n\n respond_to do |format|\n format.html { redirect_to mini_reviews_url }\n format.json { head :no_content }\n end\n end",...
[ { "docid": "a98f5d6d8e3270d7d4f6b3bab2368d85", "score": "0.7376291", "text": "def destroy\n @review = @dish.reviews.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "title"...
0b0b80ec707cf81a10be4a7dea264985
Determines the current state of the given object as configured by this state machine. This will attempt to find a known state that matches the value of the attribute on the object. == Examples class Vehicle state_machine :initial => :parked do other_states :idling end end states = Vehicle.state_machine.states
[ { "docid": "79825052abd062bdb0871c74dab9efea", "score": "0.0", "text": "def match(object); end", "title": "" } ]
[ { "docid": "63bdc943efd812bf28fa48bf26af117f", "score": "0.6465381", "text": "def state\n object.state_code\n end", "title": "" }, { "docid": "587a04ed681346c42d5cf84673a2a1d3", "score": "0.64237565", "text": "def state\n object.human_state_name\n end", "title": "" }, ...
a1130521bdf59dfa63ee46ce330b4b18
controller filters strong params
[ { "docid": "f73c8d53a324ca3c779eff9f8b00c2b8", "score": "0.0", "text": "def work_params\n params.require(:work).permit(:category, :title, :creator, :publication_year, :description )\n end", "title": "" } ]
[ { "docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8", "score": "0.8233553", "text": "def filter_params\n end", "title": "" }, { "docid": "3aebcec0d6b9e421e14dc0ffa9e6ae6d", "score": "0.800791", "text": "def filter\r\n params[:filter] && params[:filter].permit! || {}\r\n end", "titl...
2dad6b0d14cdf347f464a358e968127f
Updates the state of the Torpedo.
[ { "docid": "99410d0539bd36b273de97b154e98598", "score": "0.0", "text": "def update\n\t\tmove\n\t\tif @game_state.outside_bounds?(@x, @y, @@img.width, @@img.height) \t\n\t\t\t@game_state.death_mark(self)\n\t\tend\n\tend", "title": "" } ]
[ { "docid": "43fb671a52082bd4d6921d12ce1a8c94", "score": "0.718567", "text": "def update\n @state.update\n end", "title": "" }, { "docid": "ad3f36cdfcb8f3ce693449e4f546c0a2", "score": "0.71275264", "text": "def update\r\n @state.update\r\n end", "title": "" }, { ...
cf25cf4b40737a9654ec807f453e7f05
human readable description of modeling approach
[ { "docid": "74cd19a4bae606a3625ffaa435117b25", "score": "0.0", "text": "def modeler_description\n return 'This measure uses 4 loops to model the waste water heat pump. The WW-Water Connections loop records the waste water temperature and flow rate with EMS controls. The Waste Water Heat Pump loop mod...
[ { "docid": "400f38055c710e3f9ca3606b0d0e6dcf", "score": "0.7710149", "text": "def modeler_description\n return 'Gather orientation and story specific construction, fenestration (including overhang) specific information'\n end", "title": "" }, { "docid": "7f312e0afd1fe5a95907a214078a6c88"...
6e6a28947b2d605d1c885127989572b5
Add files which have not been executed at all (i.e. with no coverage)
[ { "docid": "cb12897bd37971bce2b09ddff9500d56", "score": "0.6153069", "text": "def find_bash_files!\n return if Bashcov.options.skip_uncovered\n\n Dir[\"#{Bashcov.root_directory}/**/*.sh\"].each do |file|\n @coverage[file] ||= [] # empty coverage array\n end\n end", "title": ...
[ { "docid": "7a496bba03993aab7881870736fa5705", "score": "0.7565354", "text": "def add_not_loaded_files(result)\n if tracked_files\n result = result.dup\n Dir[tracked_files].each do |file|\n absolute_path = File.expand_path(file)\n result[absolute_path] ||= SimulateCo...
49926a0e51059022b19af2b300651c21
POST /posts POST /posts.json
[ { "docid": "05ffb0e9cfdf92b55ededee2b8421968", "score": "0.0", "text": "def create\n @post = Post.new(params[:post])\n @post.user_id = current_user.id\n respond_to do |format|\n if @post.save\n# flash[:success] = \"Post created!\"\n# redirect_to @post\n format.html { r...
[ { "docid": "92c50133f120b4421970b36c5df90a46", "score": "0.739982", "text": "def create\n @post = Post.new(post_params)\n @post.save\n render json: @post\n end", "title": "" }, { "docid": "abed7ddc94f10bcd0f62efa65c40c143", "score": "0.7250132", "text": "def create\n pos...
6ac81a4e096f09181dfe010e2e28696b
DELETE /comments/1 DELETE /comments/1.json
[ { "docid": "787fe56d3e1509dec6bac3245d003dfe", "score": "0.0", "text": "def destroy\n if @comment.destroy\n flash[:success] = \"Comment deleted\"\n redirect_to request.referrer || root_url\n end\n end", "title": "" } ]
[ { "docid": "3e527a9d859cb967c5442cb3625a69d8", "score": "0.7533932", "text": "def destroy\n render json: comment.destroy!, status: :ok\n end", "title": "" }, { "docid": "021c3490c1e2fb25c05ca0b44b7d297d", "score": "0.75216246", "text": "def destroy\n Comment.find(params[:id])....
403a3422d7a51ef1443e65f178b32d75
Returns Persister object built from serialized data
[ { "docid": "be801c51efc57c4aa80da810e177521b", "score": "0.65816313", "text": "def from_hash(persister_data)\n # Extract the specific Persister class\n persister_class = persister_data['class'].constantize\n unless persister_class < ManageIQ::Providers::Inventory::Persister\n raise...
[ { "docid": "fdb7253d7f93d17f96636af3af8f6b42", "score": "0.6130048", "text": "def instantiate(data)\n create_from_hash(data)\n end", "title": "" }, { "docid": "fdb7253d7f93d17f96636af3af8f6b42", "score": "0.6130048", "text": "def instantiate(data)\n create_from_hash(data...
75be1f691f6f93c8842ef5b37ad5bd5f
GET /members/new GET /members/new.xml
[ { "docid": "ab861f0a2575a9de189bcad70e8b9334", "score": "0.0", "text": "def new\n main_page_cred\n begin\n @group = Group.find(params[:group_id])\n rescue\n slug = Slug.find_by_name(params[:group_id])\n @group = Group.find(slug.sluggable_id)\n end\n \n if (@group.size > ...
[ { "docid": "032c2b65305a0096b34fb319bce35e12", "score": "0.7713128", "text": "def new\n @member = Member.new\n @people = []\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @member }\n end\n end", "title": "" }, { "docid": "35fe327...
18500bace4595873fbec20e85f068737
Human readable representation === Return desc(String):: Auditable description
[ { "docid": "ccad7a5d8bca3fa898af68d881ca8665", "score": "0.0", "text": "def to_s\n desc = @executables.collect { |e| \"< #{e.nickname} >\" }.join(', ') if @executables\n desc ||= 'empty bundle'\n end", "title": "" } ]
[ { "docid": "f9855bd3bf0c0037faedfabf2359ab47", "score": "0.773695", "text": "def desc\n @desc.to_s\n end", "title": "" }, { "docid": "4e7237210f79272abe7e4a0b8d38c3f3", "score": "0.7582356", "text": "def desc\n if @inspected\n desc_short\n else\n @...
2b2a1dd279243eca5eaaeb1724be122d
Inverts the the active flag of the event. If another event has a set active flag it is set to false. Only one event can have set the active event set POST /events/1/activate
[ { "docid": "b41f237d2fd2fc84a85f53eddfd31005", "score": "0.7130921", "text": "def activate\n @event = Event.find(params[:id])\n if carts_empty?\n @event.active = @event.active ? false : true\n updated_events = []\n updated_events << @event\n Event.all.each do |event|\n n...
[ { "docid": "830e95677991a12227bac0695f783dbc", "score": "0.7252104", "text": "def inactivate!\n self.update_attributes(active: false)\n end", "title": "" }, { "docid": "96950e8d2d426ef89085f1d3818e4750", "score": "0.6979333", "text": "def activate_events\n current_user.events....
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "5dce34a95ec91df3f6974bf01e3c7f40", "score": "0.0", "text": "def user_params\n params.require(:user).permit(:display_name, :profile_picture)\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": "...
ed976f78c82e65425e55a293bdf059a2
decide before assigning a data type how you need to manipulate the data.
[ { "docid": "8db4b1a7ed22b7d7c130cc7a41c139d3", "score": "0.0", "text": "def initialize(name,bank_account=25,happiness=8,hygiene=8)\n@name = name \n@bank_account = bank_account\n@happiness = happiness \n@hygiene = hygiene \nend", "title": "" } ]
[ { "docid": "89554c82b82d69f791a12dd9c2ca8b39", "score": "0.72990835", "text": "def data_type(*) end", "title": "" }, { "docid": "7e3ecf38024a67f7d8681e5ed093f2d5", "score": "0.72685975", "text": "def apply_type\n data.apply_type\n end", "title": "" }, { "docid": "...
69cda1cb1529cdd3c1816b92a02fbfdc
Does the +answers+ hash exist?
[ { "docid": "8ddc624df01efb57f8901e1b3e6a737d", "score": "0.715343", "text": "def answers?\n !options[:answers].nil?\n end", "title": "" } ]
[ { "docid": "aa15a594ad332b1d32251f1a6e6d58c7", "score": "0.7368935", "text": "def has_answers?\n answer_count > 0\n end", "title": "" }, { "docid": "6002ef149e868fcc0af0ee8b5f609970", "score": "0.7208776", "text": "def has_answer?\n not answer.empty?\n end", "title": ...
f99ae11e9e2c6e2a66547c9eca08dce4
RTN TRUE FOR PRIME NUMBERS RTN FALSE FOR NONPRIME NUMBERS
[ { "docid": "441a76dfaab725879a1256c42618c300", "score": "0.0", "text": "def prime?(num)\n # binding.pry\n return false if num < 2\n n = 2\n while n < num\n return false if num % n == 0\n n += 1\n end\n true\nend", "title": "" } ]
[ { "docid": "45daee96cd22e0e686c2537100fd96f5", "score": "0.6607565", "text": "def pseudoprime_test(n, base)\r\n\t\treturn power(base, n - 1, n) == 1\r\n\tend", "title": "" }, { "docid": "cc7cd9f1d4dfd0cc04e44ba7dff7209a", "score": "0.63229424", "text": "def miller_rabin(n, t=3)\n\t\t...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "b24ecf689603a6045bebdb949d7e18b6", "score": "0.0", "text": "def ciudade_params\n params.require(:ciudade).permit(:nombre, :paise_id)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whit...
9af3fcb7e135febb58b6037e52bb33f8
the same as markdown
[ { "docid": "a9ed81280a3a2a06f13c782323841ff8", "score": "0.0", "text": "def parse_inline_code\n if s = @src.scan(/\n (`{1,})(\\ ?)\n .*?\n \\2\\1\n /x)\n s =~ /^\n (`{1,})(\\ ?)\n (.*?)\n \\2\\1\n $/x\n @out << (::Mar...
[ { "docid": "b317616fa0eaf071b0489c0e1ceda6f4", "score": "0.83649945", "text": "def html_markup_markdown(text); end", "title": "" }, { "docid": "f9ffd3de1704b3a7184c0a97cb0db542", "score": "0.76926726", "text": "def markdown(text)\n puts text\n html = BlueCloth::new(text).to_htm...
1de006f75f13758aa1f90f0a25eea177
Get the raft leader for the datacenter in which the local consul agent is running
[ { "docid": "6b7553a1cf50d0ac64fe6f17b9de4533", "score": "0.6445092", "text": "def leader(options = {})\n ret = send_get_request(@conn, ['/v1/status/leader'], options)\n JSON.parse(ret.body)\n end", "title": "" } ]
[ { "docid": "1da95cdfba6d55d7db47f565f0003653", "score": "0.70360726", "text": "def leader\n @leader ||= @cluster.leader || update_cluster && self.leader\n end", "title": "" }, { "docid": "2f7c83ce6183471a78631a5e797386aa", "score": "0.70282143", "text": "def leader\n lea...
e75f50e6852dcec6bcab5a5d3bdeea71
Craft a string for describing an action
[ { "docid": "a3997a1b252f01e41993d0a8904ec835", "score": "0.6428953", "text": "def action_summary controller, action\n case controller\n when \"users\"\n case action\n when \"collection\"\n return \"view someone's collection\"\n end\n when \"invitations\"\n case acti...
[ { "docid": "bcf9f2a0a9c4f38d64bd00b5aa1e3eea", "score": "0.7529594", "text": "def action_description\n case action\n when 'took_damage'\n \"Ship #{object.name} took #{params['damage']} damage\"\n when 'fired'\n \"Ship #{object.name} hit #{params['ship']['name']} for #{params['damage']...
c12464c00e612b340364827a49f4688a
Runs the migrations in the given paths.
[ { "docid": "534fd77c705c38f8ff026af6c4d11c79", "score": "0.6346326", "text": "def migrate(paths:, quiet:, &filter)\n verbose_was = ActiveRecord::Migration.verbose\n ActiveRecord::Migration.verbose = !quiet\n migrate =\n -> { ActiveRecord::MigrationContext.new(paths, ActiveR...
[ { "docid": "d636287acfc89d86eade2a938afd042f", "score": "0.73503375", "text": "def run_migrations(migrations)\n migrations.each do |direction, version_or_filenames|\n Array.wrap(version_or_filenames).each do |version_or_filename|\n version = File.basename(version_or_filename)[...
91ec2e7d9f07dd3f3bd139fc4d1f6934
Calcula el score de Paper contra m.
[ { "docid": "f9e71c25d56eb40815fbe6d9328bed77", "score": "0.7488444", "text": "def score m\n m.contra_paper\n end", "title": "" } ]
[ { "docid": "8b220afb0c1d94137098f6f931dd669c", "score": "0.826124", "text": "def score m\n m.score_Paper self\n end", "title": "" }, { "docid": "8556010c27f895ad9fdbc1112e8d9430", "score": "0.74245834", "text": "def score m\n m.score_Rock self\n end", "title": "" }, {...
151a9287ff2b0f4ef7ba828fee6f6a21
Rolls back the transaction (and turns on autocommitting). Must be done if the transaction block raises an exception or returns false.
[ { "docid": "4d57ab3ea96dbc4b7f38648c323dffe3", "score": "0.63070256", "text": "def rollback_db_transaction\n log('rollback transaction', nil) { @connection.rollback }\n end", "title": "" } ]
[ { "docid": "05a38b974be10defffebcf78adb0505b", "score": "0.7793312", "text": "def rollback\n execute \"rollback transaction\"\n @transaction_active = false\n true\n end", "title": "" }, { "docid": "05a38b974be10defffebcf78adb0505b", "score": "0.7793312", "text": "de...
74559351a78688e9678657a4f530a67e
POST /map_areas POST /map_areas.xml
[ { "docid": "bdfc363d09ebfb95bca2d73218494571", "score": "0.5863109", "text": "def create\n @map_area = MapArea.new(params[:map_area])\n @map_area.craigslist = params[:map_area][:craigslist] + \".craigslist.org\"\n respond_to do |format|\n if @map_area.save\n flash[:notice] = 'MapAre...
[ { "docid": "43cadf6f56887e6a77acba635e923259", "score": "0.630032", "text": "def areas\n @area = Area.new(geo_json: params.to_json)\n if @area.save\n json_response([id: @area.id], :created, :geo_json_recieved)\n else\n json_response(nil, :error, :db_error)\n end\n end", "title...
3b640897bc022b14f70be5df66e8bd00
Point (x, y) is on the edge of a circle Draw a line from (x, y) to (x, center_y) All the cells intersecting that line will have their coordinates added to the set
[ { "docid": "37021a229acb16b259df7b69755b2f44", "score": "0.7812071", "text": "def include_cell_in_circle(coord_set, x, y, center_y)\n cell_x, cell_y = x / WIDTH, y / HEIGHT\n cell_center_y = center_y / HEIGHT\n y_range = ([cell_center_y, cell_y].min)..([cell_center_y, cell_y].max)\n y_range....
[ { "docid": "fe72893597819e39c54577d8fee309a4", "score": "0.6992198", "text": "def cells_intersecting_circle(x0, y0, radius)\n in_circle = Set.new\n x = radius\n y = 0\n radius_error = 1-x\n\n while x >= y\n include_cell_in_circle(in_circle, x + x0, y + y0, y0)\n include_cell_in_...
4289a5d89c8c77857b26307e58ea54a0
An array containing each unique word used in the text sample.
[ { "docid": "5f5b46e217e51e86c04614e6cdd92d14", "score": "0.72966206", "text": "def unique_words\n\t\t@frequencies.keys\n\tend", "title": "" } ]
[ { "docid": "dddba5e5bb52ac296f53b53be47bb5f7", "score": "0.79989684", "text": "def words\n text.words.map {|word| word.to_s}.uniq\n end", "title": "" }, { "docid": "f206db233b37976b527c5692321e952a", "score": "0.78649753", "text": "def generate_word_array( text )\n return [] unl...
0e263eb43689cb82cfbea6d3c6c173d3
Write a method that takes one argument, a positive integer, and returns the sum of its digits. without looping or iterators convert to string split to array use Arraysum to convert each elem to integer and return sum
[ { "docid": "4c76354fdc51124b9a9d74d94d598466", "score": "0.8049585", "text": "def sum(number)\n number.to_s.split('').sum { |n| n.to_i }\nend", "title": "" } ]
[ { "docid": "0e06119ecbcccfa1d6e5b8c34c808b1a", "score": "0.852996", "text": "def digits_sum\n self.split('').map {|x| x.to_i}.inject(0) do |res,elt|\n res += elt\n res\n end\n end", "title": "" }, { "docid": "2fed83408714d72e08e7b2d7435659ec", "score": "0.8421519", "...
61efdab1dbec9a5ac33cc07f8f135493
Returns true if Sitemap is a regular list of URLs.
[ { "docid": "9181ad0822d51e8fef269b23dc293c0b", "score": "0.7421995", "text": "def sitemap_urlset?\n sitemap_root_name == 'urlset'\n end", "title": "" } ]
[ { "docid": "5281b0b89b3f7843cc30a70311dc28c8", "score": "0.6377269", "text": "def sitemap_index?\n sitemap_root_name == 'sitemapindex'\n end", "title": "" }, { "docid": "7454040376d090a410c8a90cb2cedeb4", "score": "0.6338851", "text": "def sitemap_index?\n root_name == '...
eedc86729796a853c47f35ada88aed30
Executes a Git commit in given directory with given message, for those times when you're in a mad hurry
[ { "docid": "79065c4270b16f7b600f0e555774ac20", "score": "0.6514175", "text": "def quick_commit(repo, msg='WARNING: This commit was made automatically by a script, and should be reviewed!')\n log = File.open \"#{LOG_DIR}/git.txt\", 'a'\n Dir.chdir Pathname(repo).expand_path do |p|\n prin...
[ { "docid": "d800f4dcecdb6bf555e7b1a3f52f32fa", "score": "0.74354327", "text": "def commit(message)\n Dubya.logger.info \"Updating Git repository...\"\n system %(cd #{path} && git commit -am \"#{message}\" && git push)\n end", "title": "" }, { "docid": "29468a7e66e43b685828014a4a...
fc0049b37c34551155e345eb80aab258
Time Complexity: O(log n) if the tree is balanced, O(n) if it is unbalanced where n is the number of nodes in the tree Space Complexity: O(log n) if the tree is balanced, O(n) if it is unbalanced where n is the number of nodes in the tree
[ { "docid": "2dcc774dccaa9e16dc7e05dc94a86641", "score": "0.0", "text": "def find(key)\n if root.nil?\n return nil\n else\n root.find(key)\n end\n end", "title": "" } ]
[ { "docid": "2ff17111aba2b4a96b9d22cb7fdf5ae3", "score": "0.73356646", "text": "def is_balanced(root)\n # 1) empty trees are balanced.\n return true if root.nil?\n\n # 2) find left and right depth\n left_bal = depth(root.left)\n right_bal = depth(root.right)\n\n #\n (left_bal - right_bal).abs <= 1...
48aedc2dc1274b1bc4098df79adb6e7c
Method for getting price of given code of product
[ { "docid": "7284651c9b80774bf5bdd1942647d277", "score": "0.6212433", "text": "def getPriceOfProduct\n\t\t@basket.each_with_object({}) do |item, products|\n \t\t\tproducts[item[:id]] = item[:price]\n\t\tend\n\tend", "title": "" } ]
[ { "docid": "ed3b4538aa62155b84ec63e4c7a56015", "score": "0.7669777", "text": "def get_price_by_currency(currency_code)\n currency_id = Currency.find_by_code(currency_code).id\n product_prices.find_by_currency_id(currency_id)\n end", "title": "" }, { "docid": "e33ed0dcbafb4c64774eb2294...
d566259cddf5f180b9fafddc56e8a58f
GET /question_paperships/1 GET /question_paperships/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "876b02a83aae84808c72b79dc9822638", "score": "0.7475649", "text": "def index\n @question_paperships = QuestionPapership.all\n end", "title": "" }, { "docid": "e65cf739df9920ab73270addf08c3131", "score": "0.7032535", "text": "def set_question_papership\n @question_...
d079fe3621113c464fe110c4cc50bca1
Check if a particular action is the current one args One or more action names to check Examples On Projectsnew current_action?(:new) => true current_action?(:create) => false current_action?(:new, :create) => true
[ { "docid": "351d3766a05640466c675599e4b3907d", "score": "0.81538904", "text": "def current_action?(*args)\n args.any? { |v| v.to_s.downcase == action_name }\n end", "title": "" } ]
[ { "docid": "8f36e01860b7d54d92e5a27c39fb3d71", "score": "0.8221915", "text": "def current_action?(*args)\n args.any? do |v|\n v.to_s.downcase == action_name\n end\n end", "title": "" }, { "docid": "5d174c296c2b9916987df633469d5bd4", "score": "0.812785", "text": "def curre...
ef2cae0d706562058f4194860e1b94d5
Search email segment customers
[ { "docid": "ecd21cce45c53dd5061f4b2fa0092f40", "score": "0.6175326", "text": "def search_email_segment_customers(storefront_oid, email_segment_uuid, opts = {})\n data, _status_code, _headers = search_email_segment_customers_with_http_info(storefront_oid, email_segment_uuid, opts)\n data\n e...
[ { "docid": "bf1c92770175667d3b075ea558566749", "score": "0.6930399", "text": "def search_by_email\n setup_search(params)\n @orders = Order.paginate(\n :order => \"orders.created_on DESC\",\n :conditions => ['order_users.email_address LIKE ?', \"%#{@search_term}%\"],\n :include => :o...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "d71f5bc5def2e91ed0b691641d3a6f30", "score": "0.0", "text": "def address_params\n params.permit(:id, :street_1, :street_2, :city, :state, :zip,\n :primary, :participant_id)\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"...
d27609be352d6eff775d6192cafbd633
Given the core_fields what TW objects are possible
[ { "docid": "2aa06d858f84a758c41ff43185426dbd", "score": "0.6264431", "text": "def referenced_models(core_fields)\n core_fields = core_fields.collect{|i| i[:term]}\n models = []\n DWC2TW.keys.each do |k|\n if (core_fields & DWC2TW[k].keys) != []\n models.push k \n en...
[ { "docid": "81ee9c9fa98042177c93dd8b4b79fe01", "score": "0.61903805", "text": "def available_fields(sobject_type, fields, action = :read)\n fields.select do |field|\n known_field = available?(sobject_type, field, action)\n relationship = action == :read && relationship?(field)\n...
78f0d0e72aa7e8980c622822cb6e9828
/ Interact image My list View
[ { "docid": "ab4c4baa05c070d97d7001523d16bb46", "score": "0.0", "text": "def my\n # Author\n authorize! :view_my, RealEstate\n\n # Get params\n page = (params[:page] || 1).to_i\n per = (params[:per] || 12).to_i\n ...
[ { "docid": "80f50914c7c99be9c80348e8d40903e4", "score": "0.7260439", "text": "def show\n process_images(@item)\n\n @list_item = ListItem.new \n end", "title": "" }, { "docid": "f878b8f5486088c6db1b70ed6e03220f", "score": "0.6264487", "text": "def display_list_image(resource...
d8e459bc04d22aea5b70da3014bf440d
Returns a specific auth control exemptmids
[ { "docid": "228d85841bfab85a596626e738ce2aff", "score": "0.5828109", "text": "def get_authcontrols_exemptmids_token(token, opts = {})\n data, _status_code, _headers = get_authcontrols_exemptmids_token_with_http_info(token, opts)\n data\n end", "title": "" } ]
[ { "docid": "251eb7386354ebc705840c8acfafa8dd", "score": "0.7071548", "text": "def get_authcontrols_exemptmids(opts = {})\n data, _status_code, _headers = get_authcontrols_exemptmids_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "aa88f3adb28b77ab628cee688f1299bc",...
fd68ceb8091ae799a483ef438353c16b
TODO: This should be recursive, but it's not
[ { "docid": "75ff80d59a261f505913cb922a6ce9db", "score": "0.0", "text": "def hash_to_liquid(hash)\n hash.map do |key, value|\n case key\n when \"title\"\n if value.is_a?(Array)\n title = value.detect { |t| t[\"type\"] == \"main\" } || value.first\n v = ti...
[ { "docid": "08de766c3aa9ce01608aa15f9aa2c871", "score": "0.65031815", "text": "def recursive; end", "title": "" }, { "docid": "08de766c3aa9ce01608aa15f9aa2c871", "score": "0.65031815", "text": "def recursive; end", "title": "" }, { "docid": "115f0358715636a4e7b59a4d1f6a47...
44935e6fe51be7a1046216ce603362e7
Determines whether the current action has a layout definition by checking the action name against the :only and :except conditions set by the layout method. ==== Returns Boolean True if the action has a layout definition, false otherwise.
[ { "docid": "ba23025e181b8f566889c12c24b92a7f", "score": "0.6137501", "text": "def _conditional_layout?\n return unless super\n true\n end", "title": "" } ]
[ { "docid": "4b6c865992326b9befadc490155d043d", "score": "0.80598444", "text": "def _conditional_layout?\n return unless super\n\n conditions = _layout_conditions\n\n if only = conditions[:only]\n only.include?(action_name)\n elsif except = conditi...
42035721131afd4f8f7183821e424020
:nodoc: Debugging help: returns a representation of the instance.
[ { "docid": "0f01dc99983a5b02940dd67f71502027", "score": "0.0", "text": "def inspect\n \"#<Word 0x#{to_hex}>\"\n end", "title": "" } ]
[ { "docid": "cbe9255c01c7a060e7726e26df4e3868", "score": "0.78865665", "text": "def inspect\n \"#<#{self.class.to_s} #{to_s}>\"\n end", "title": "" }, { "docid": "f17d381f3d4cd93b8cbdd5f34141a2c1", "score": "0.78589743", "text": "def inspect\n _raw_instance.inspect\n e...
0bb069e0c5bc212843bb506c0250e516
Get a header value
[ { "docid": "76f85f79698c6b8b8297bc23b1c7885e", "score": "0.6800524", "text": "def [](header)\n @headers[header.to_s.downcase]\n end", "title": "" } ]
[ { "docid": "4fe4626c9529a6cd136a7bcdd5a79687", "score": "0.85582715", "text": "def get_header_value(header_name)\n @response.get_header_value(header_name)\n end", "title": "" }, { "docid": "808b2237755a99f430fac23157816883", "score": "0.8460113", "text": "def get_header_value...
cd9661e3b0ebdcfbd8267624543adbe6
Returns true if the user has tagged this order
[ { "docid": "7b3762e6ffcdaf25d848f1bfba9f5d77", "score": "0.77561355", "text": "def tagged? user\n users.include? user\n end", "title": "" } ]
[ { "docid": "fb01badf71fd2d3a08e7aaa22ae15123", "score": "0.73820937", "text": "def user_tag?\n @user == true\n end", "title": "" }, { "docid": "4a6c4834421197afa732db06a7975e06", "score": "0.6995126", "text": "def has_tag?\n return !self.user_id.nil?\n end", "title": "" ...
6b7b4185b11f1f2a93eabdd868de87fa
GET /listings GET /listings.json
[ { "docid": "7a528ada52e4035c440880fc0450f757", "score": "0.0", "text": "def index\n @show_deleted_and_no_image = params[:show_deleted]\n @hide_ugly = params[:hide_ugly]\n @hide_dupes = params[:hide_dupes] || true\n\n if @show_deleted_and_no_image\n @listings = Listing.order('created_at ...
[ { "docid": "e70649c15d97f7df223d71cd23d54d9a", "score": "0.8287588", "text": "def index\n @listings = Listing.all\n render json: @listings\n end", "title": "" }, { "docid": "0b02cd49ecfa42162d10e00988515a3f", "score": "0.80742246", "text": "def index\n @listings = Listing.a...
7c0a27cec72c224be6205df4ee11748d
Simulates a financial advice transaction
[ { "docid": "57f30eff58895c1f0480952ef63b0215", "score": "0.0", "text": "def post_simulate_financial_advice_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SimulateApi.post_simulate_financial_advice ...'\n end\n # ver...
[ { "docid": "e09e46b862bb24817977febbb90b4237", "score": "0.65604556", "text": "def record_payment amount=0, detail_type=UrTransaction.detail_types[:cc_payment]\n # raise error is amount is less that outstanding balance\n if self.check_outstanding > amount then\n raise \"Amount is not enough t...
e9439ae78eb652e1414c201b84bc99f6
Add one or more children to the tree
[ { "docid": "fb0cd1ac051946c491f0b892e21781a3", "score": "0.7665166", "text": "def add_child(*names)\n names.flatten!\n return unless (name = names.shift)\n\n node = children.find { |c| c.name == name }\n node ? node.add_child(names) : (children << TreeNode.new(name, names))\n end"...
[ { "docid": "ba3309cad9b6842728f2835dcfd3d260", "score": "0.8292214", "text": "def add_children(*children)\n @children.push(*children)\n end", "title": "" }, { "docid": "d91d07e3101d62bb913dd44d81c0b7e0", "score": "0.82523346", "text": "def add_children(*children)\n child...
9cfc421ff6dc250b24ccf408ea42c83d
POST /hypotheses POST /hypotheses.json
[ { "docid": "2b094bc2f314657096170e62f4cf764d", "score": "0.6568733", "text": "def create\n @hypothesis = Hypothesis.new(hypothesis_params)\n\n respond_to do |format|\n if @hypothesis.save\n format.html { redirect_to @hypothesis, notice: 'Hypothesis was successfully created.' }\n ...
[ { "docid": "f3583376dfcb8fb53ab76848a394917c", "score": "0.67763776", "text": "def hypothetical_params\n params.require(:hypothetical).permit(:hypo1, :hypo2)\n end", "title": "" }, { "docid": "3bdbbf8defd644b0da1f094afdbcb387", "score": "0.6340529", "text": "def hypothesis_pa...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "0677f8b2d659796fcade2285b3d19160", "score": "0.0", "text": "def set_mail_list\n @mail_list = MailList.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;...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "9249ab00418f5f7e38d1b9d31154d753", "score": "0.0", "text": "def book_params\n params.require(:book).permit(:title, :content)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6980384", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6782743", "text": "def strong_params\n params.requi...
0325d8172f0a799b8e2bbec8e300d8af
Parses the response of an Update request and returns the update Timestamp.
[ { "docid": "88616971153d664ee1c3c0863b8c0e44", "score": "0.79539394", "text": "def parse_update_response(body)\n dom = parse_and_validate_response(body, :root_name => 'update')\n dom.root.if_attribute_value(:time) { |v| Time.parse(v) }\n end", "title": "" } ]
[ { "docid": "5f259233748bd6e12b70af0253de0715", "score": "0.68539083", "text": "def updated_time\n Time.parse(object[\"updated_time\"]) if object[\"updated_time\"]\n end", "title": "" }, { "docid": "3d73d747eca4fcf1eb9910d7f1ea7456", "score": "0.6628136", "text": "def updated\...