query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
f2fdef02ffe739479bfc4ccc3e208f27
Gets all the rows in a table Returns an Array containing Objects for each row.
[ { "docid": "b1fbb57ee505a3aa175734bf43e99b45", "score": "0.64278805", "text": "def all\n table_name = self.to_s.pluralize.underscore\n results = DATABASE.execute(\"SELECT * FROM #{table_name}\")\n \n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects <...
[ { "docid": "fa4e03870149b73cd8db9bb3eba5128d", "score": "0.76929486", "text": "def rows\r\n assert_exists\r\n arr_rows = get_rows\r\n table_rows = Array.new(arr_rows.length)\r\n for i in 0..arr_rows.length - 1 do\r\n table_rows[i] = TableRow.new(@container, :jssh_n...
1e1d49d5a6b3acf6a3cccff9f1401bd9
Override the refresh_token! method from the Base class to extend with locking logic
[ { "docid": "9472ba9e829bbded8699e114cc56f873", "score": "0.7553483", "text": "def refresh_token!(exception = nil)\n @record.with_lock do\n fetch_fresh_record\n\n if token_requires_refresh?\n @raw_token = @raw_token.refresh!\n @callback.call(@raw_token, exception)\n ...
[ { "docid": "5ef5105f83324f4d28554cec42a91530", "score": "0.77721584", "text": "def refresh_token\n @token = get_token\n end", "title": "" }, { "docid": "bfb13cf03f621ee61623588425036368", "score": "0.7529232", "text": "def refresh_tokens\n raise \"Refresh tokens no...
b9264d3f51e2b73bedc550c9abe6fcd9
This method will validate the shipping information search criteria fields.
[ { "docid": "b1665bdc6d8354e1da228e120d991b2a", "score": "0.6321709", "text": "def shipping_search_field_exist\n $tracer.trace(\"WebInStoreCommonDSL : #{__method__}, Line : #{__LINE__}\")\n search_last_name_field.should_exist\n search_postal_code_field.should_exist\n search_phone_field.should...
[ { "docid": "b3cfe20504e6bcb4803849e0b3cf6cc3", "score": "0.6551568", "text": "def validate_shipping_method\n unless shipping_method.nil?\n errors.add :shipping_method, I18n.t(\"is_not_available_to_shipment_address\") unless shipping_method.zone.include?(address)\n end\n end", "title": ""...
4b6064ce404032f03c2a7f61a23b4f4b
Returns true if the given path has at least one subtool, even if they are hidden or nonrunnable. Loads from the configuration if necessary.
[ { "docid": "db63d693bf4e1cd89b4d5d6cb98cf012", "score": "0.628454", "text": "def has_subtools?(words) # rubocop:disable Naming/PredicateName\n load_for_prefix(words)\n len = words.length\n all_cur_definitions.any? do |tool|\n name = tool.full_name\n name.length > len && name...
[ { "docid": "c9ada352162599aeb1c2889358203373", "score": "0.679677", "text": "def complete_subtools?\n @complete_subtools\n end", "title": "" }, { "docid": "4c4312927824e3d2c0a1b3428ed91066", "score": "0.6507861", "text": "def tool_exist?\n get_tools.each do |tool|\n ...
ef3f48640f7db002aa46d2e37afa0add
Get the highest no from array log(n) complexity
[ { "docid": "a54f28bace190e498ca4d5821f02972f", "score": "0.0", "text": "def highest(a)\n length = a.length\n sub1, sub2 = [],[]\n if length == 1\n return a[0]\n elsif length == 2\n if a[0] > a[1]\n return a[0]\n else\n return a[1]\n end\n elsif length % 2 == 0\n slice = len...
[ { "docid": "2cefc000096248b0220649c65a4ac5c9", "score": "0.75742775", "text": "def find_max_value(array)\n x = array[0]\n array.length.times do |index|\n if array[index] > x\n x = array[index]\n end\n end\n x\n end", "title": "" }, { "docid": "a76769a470eb6cd3d247c1...
c8314d489da1db73cd09da921b1f4ae2
This is how you add a forward declared block. This is called automatically when you call block with ruby block, but has to be done manually if not
[ { "docid": "ddc56339542b85e31cd9d121cf7a85b0", "score": "0.0", "text": "def add_block block\n block.at self.length\n @blocks << block\n end", "title": "" } ]
[ { "docid": "69fde26052a4561a7a2e327d60d392b7", "score": "0.6690642", "text": "def with_block(&block)\n end", "title": "" }, { "docid": "23d13c5f4c410cb3877ef669b4f3391d", "score": "0.66146135", "text": "def add(&block)\n @block_args << block\n end", "title": "" }...
a0c650c927baaa49480915977cf34349
Set the value of the TargetLanguage input for this Choreo.
[ { "docid": "cf4fcac3db97f0aadc35f3ebd279735c", "score": "0.7523514", "text": "def set_TargetLanguage(value)\n set_input(\"TargetLanguage\", value)\n end", "title": "" } ]
[ { "docid": "1c15ecf35f99ada017b65bcd3a1d6a39", "score": "0.6534612", "text": "def set_language\n @language = @options[:language] if @options.has_key?(:language)\n end", "title": "" }, { "docid": "96873086ce9f2f3f032e1a94a18f74e6", "score": "0.64141005", "text": "def langu...
cdf1d170a6bc3f32138b24c9780662c6
builds the sql fragment for event flag searches
[ { "docid": "4911f36849752c31ffce0d091eacdaba", "score": "0.5934956", "text": "def event_attribute_condition_sql(values)\n sql_pieces = values.collect do |v|\n if [true, \"1\", 1, \"t\"].include? v.last\n where = self.event_attributes[v.first.to_sym] ? \"IS NULL\" : \"IS ...
[ { "docid": "61ce5ca8d793ffc3841690cba87db2d4", "score": "0.6200743", "text": "def _gen_sql\n cond_str = @cond_arry.join(\" AND \")\n @conditions = [ cond_str, @cond_hash ]\n end", "title": "" }, { "docid": "3814317e1bd27466ef68a947490cf540", "score": "0.58662415", "text": "def...
208e45159a2de037eb5d8e903a812ffa
Test whether the given method and optional key are scoped.
[ { "docid": "cc84b879091963d9f5e1ab68d411ffbc", "score": "0.8565715", "text": "def scoped?(method, key = nil) #:nodoc:\n if current_scoped_methods && (scope = current_scoped_methods[method])\n !key || !scope[key].nil?\n end\n end", "title": "" } ]
[ { "docid": "c8cce9f0db3f7f707aabcc2a4b6d7bbe", "score": "0.8339099", "text": "def scoped?(method, key = nil) #:nodoc:\n if current_scoped_methods && (scope = current_scoped_methods[method])\n !key || scope.has_key?(key)\n end\n end", "title": "" }, { "docid": "5dc...
f2693d0603931c528a2a4c0b0d515803
Begins automatic connection recovery (typically only used internally to recover from network failures)
[ { "docid": "878e367b319cc5f78ac9a98721560c70", "score": "0.75413316", "text": "def automatically_recover\n ms = @network_recovery_interval * 1000\n # recovering immediately makes little sense. Wait a bit first. MK.\n java.lang.Thread.sleep(ms)\n\n new_connection = converting_rjc_exce...
[ { "docid": "feaf4baf3ff6b2fd23422821461cf08d", "score": "0.7399506", "text": "def disable_automatic_connection_recovery\n @recover = nil\n end", "title": "" }, { "docid": "be0e706f8ff2a390f27422619dba9c84", "score": "0.7354491", "text": "def recover\n listen_for_conn...
04745aff10f2b52a507d9679aaa0f27a
Gets the state property value. The state.
[ { "docid": "c1494ab201ca639403b9fdd115acf1be", "score": "0.782237", "text": "def state\n return @state\n end", "title": "" } ]
[ { "docid": "7162f9cd103e83dc62b843c27ef7a6e0", "score": "0.78988755", "text": "def state\n @@states[@state]\n end", "title": "" }, { "docid": "c511ca7a6c1ec2aa777f3b95e2e9fffc", "score": "0.7740961", "text": "def state\n @state\n end", "title": "" }, { "docid": "3...
8c06799d8ac980e6347d1afdd06754a9
Get/set the query backing the view
[ { "docid": "485ae6fe513096e14e97d18b055b96cc", "score": "0.627376", "text": "def query(val = nil)\n @query = val unless val.nil?\n @query\n end", "title": "" } ]
[ { "docid": "ceca9b9b7ea9c19f60ed2cdb6a05c84f", "score": "0.74863124", "text": "def set_query\n @query = Query.find(params[:id])\n end", "title": "" }, { "docid": "c3ee00fa1040812b25eab288af01cbd0", "score": "0.74719137", "text": "def set_query\n @query = Query.fi...
ffb878e3cad5c48c924f4569936efbb8
GET /tasks GET /tasks.json
[ { "docid": "38905e180b4c7e9160546f7427a45cf3", "score": "0.0", "text": "def index\n page = params[:page] || 1\n @tasks = Task.order(created_at: :desc).page(page).per(10)\n @status_arr = Task.statuses.keys.each_with_object({}) { |status, arr| arr[status] = Task.try(status).count; arr }\n @use...
[ { "docid": "c7fe93d08ee068d33f0c6bc2df5e475f", "score": "0.7889543", "text": "def tasks\n uri = URI(BASE_URL + TASKS_ENDPOINT)\n\n make_request(uri)\n end", "title": "" }, { "docid": "0cf34a8d9937d77b2fd4de07d1325de2", "score": "0.7751927", "text": "def tasks\n @todos = Tod...
342b66228155a3b2516ba22ffa755189
performing a search using the DocSet class to work properly, the user needs to have the macosx developer tools installed.
[ { "docid": "2bc7e6d1b90b41aa7dc6e350decaa2d3", "score": "0.6091473", "text": "def perform_search(sender)\n NSLog(\"searching for #{@search_box.to_s}\")\n begin\n refs = DocSet.search(@search_box.to_s)\n rescue DocSetError => error_message\n alert(:message => \"Missing documentation\",...
[ { "docid": "995421bddaca674fd9a54549ad90f47a", "score": "0.6023965", "text": "def search\n @documents = api.form(\"everything\")\n .query(%([[:d = fulltext(document, \"#{params[:q]}\")]]))\n .submit(ref)\n end", "title": "" }, { "docid": "a7403afe3dd...
556c341e7373ec93d9bc112d899fad3a
Shorthand for months_since(3). source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb205
[ { "docid": "029bf27a0668e17174113eb346d48ea1", "score": "0.0", "text": "def next_quarter; end", "title": "" } ]
[ { "docid": "f24317cd4261b5f8d834235b4a5da67c", "score": "0.8295352", "text": "def months_since(months); end", "title": "" }, { "docid": "f24317cd4261b5f8d834235b4a5da67c", "score": "0.8295352", "text": "def months_since(months); end", "title": "" }, { "docid": "fd214823b3...
453300f6e9fb41312c6611e00ae61a9d
Utility function to get a webhook's avatar URL.
[ { "docid": "acde07d16910af8d7e30b415f42e101e", "score": "0.74807984", "text": "def avatar_url\n return API::User.default_avatar unless @avatar\n\n API::User.avatar_url(@id, @avatar)\n end", "title": "" } ]
[ { "docid": "93b69a297fe7e2698fe274ef696254dd", "score": "0.7955509", "text": "def avatar_url\n avatar_uri(object)\n end", "title": "" }, { "docid": "bbbd10ae3a8510b0d45d51a1b0fc6540", "score": "0.7913021", "text": "def avatar_url\n avatar.url(:original)\n end", "title": "...
c46703750a3e8c9216f47875aed2d717
POST /jobs POST /jobs.json
[ { "docid": "3ac3cc72e50c72339a2c7bee7db3a277", "score": "0.0", "text": "def create\n return unless representsCompany?\n\n @job = Job.new(params[:job])\n @job.category = Category.find_by_name(params[:category])\n @job.location = Location.find_by_name(params[:location])\n @job.company = cur...
[ { "docid": "f0ea857ece19f0d4f9252db0f3912625", "score": "0.74191225", "text": "def create\n @job = Job.new(job_params)\n\n if @job.save\n render json: @job, status: :created\n else\n render json: @job.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { ...
ac10636e9fafdbdce4eff729246070dc
Waits and checks to see if a specific element with an id exists within the view
[ { "docid": "7241245f2fffbd76f43e670f7667060b", "score": "0.74622786", "text": "def check_if_id_exists(id)\n wait_for_element_exists(\"* id:'#{id}'\")\n end", "title": "" } ]
[ { "docid": "9a126efbb0850bcfe07130434d7bb6c3", "score": "0.7004138", "text": "def div_by_id_exists(id_name)\n return div_by_id(id_name).exist?\nend", "title": "" }, { "docid": "3c80ec65c28c4d706b342b7a092b4459", "score": "0.6685608", "text": "def wait_to_appear(sym,id)\n @wait.unt...
4cd7aea89457e2bb56aa678e4eb6a380
Helper for applying the pagination parameters.
[ { "docid": "94d2ecc5741773ef5c605fb46af9f0d5", "score": "0.74108934", "text": "def apply_pagination(data)\n data = data.paginate(page: params[:page], per_page: params[:limit])\n end", "title": "" } ]
[ { "docid": "4f32cc17ac5cdb0668074552aae14dad", "score": "0.7811902", "text": "def do_pagination\n @page_number = 1\n if params[:page] && params[:page].to_i > 0\n @page_number = params[:page].to_i\n end\n @pagination = true\n @pagination_options = { :limit => items_per_page, :offset =...
11e18ed18bf9bd58d8fa80c72c0bb8e6
Extract the model class from controller
[ { "docid": "84ab73832fcf89ad3c76218249068462", "score": "0.7562958", "text": "def model_class\n controller_name.classify.constantize\n end", "title": "" } ]
[ { "docid": "f6208a8fd2633c5920a16d420fca914f", "score": "0.8020882", "text": "def model_class\n\t\t\tget_model_for_controller(self.class)\n\t\tend", "title": "" }, { "docid": "2f4840a00a0bfce689a0ace1624afb69", "score": "0.79972893", "text": "def model_class\n params[:cont...
44373727ca07a5c984f252b21509b5aa
PATCH/PUT /admin/slides/1 PATCH/PUT /admin/slides/1.json
[ { "docid": "afdeb8e722865cc76bfa856efaeb41e1", "score": "0.700361", "text": "def update\n respond_to do |format|\n if @slide.update(slide_params)\n format.html { redirect_to [:admin, @slide], notice: 'Slide was successfully updated.' }\n format.json { head :no_content }\n else...
[ { "docid": "84cebd787445209cef0891acb8fe4679", "score": "0.6942592", "text": "def update\n authorize! :update, resource\n\n respond_to do |format|\n if resource.update_attributes(params[:slideset])\n format.html { redirect_to slideset_slides_path(resource), notice: 'Slideset was succes...
4424fd92b22803b67354909591c7e6ef
Complete the matchingStrings function below.
[ { "docid": "ae009b47fcf76fd8a0cf2bf58c8c67f3", "score": "0.6540632", "text": "def matchingStrings(strings, queries)\n matchingStrings = Array.new\n queries.each do |query|\n matchingStrings << strings.count(query)\n end\n return matchingStrings\nend", "title": "" } ]
[ { "docid": "21202dd9e9e8b3e2b4eae93733b5cf4d", "score": "0.7724611", "text": "def match(array_of_strings)\n array_of_strings.each do |string|\n\n end\n\n end", "title": "" }, { "docid": "70ff08f90363142f11b791f26448dd2e", "score": "0.68034965", "text": "def matchingStrings(str...
7c4d91d27c95389b688cd4fd0d33aa2c
Include the chosen devise modules in your model: devise :database_authenticatable, :confirmable, :recoverable You can also give any of the devise configuration values in form of a hash, with specific values for this model. Please check your Devise initializer for a complete description on those values.
[ { "docid": "bbce3321635278a1c087c218ae63295a", "score": "0.0", "text": "def freemium(*modules)\n include Freemium::Models::Subscribable\n options = modules.extract_options!\n\n# if modules.delete(:authenticatable)\n# ActiveSupport::Deprecation.warn \":authenticatable as module is...
[ { "docid": "b09068a9ed4e1aaa3ecd5a1f02d0e77a", "score": "0.76063234", "text": "def devise(*modules)\n options = modules.extract_options!\n\n modules = Devise::ALL if modules.include?(:all)\n modules -= Array(options.delete(:except))\n modules = [:authenticatable] | modules\n\n ...
282e45f5d944e7d462a27b467b22ab27
Otder of processing has to be respected
[ { "docid": "6fa5b1e1d53a2bb78671f940f07c2fca", "score": "0.0", "text": "def testProcessingOrder\n execute_Process_WithConf({\n :WaveFiles => {\n :FilesList => [\n {\n :Name => 'Wave.wav',\n :Processes => [\n ...
[ { "docid": "abc1e6e900188ecb8541263ff4688363", "score": "0.77305174", "text": "def processing?; end", "title": "" }, { "docid": "abc1e6e900188ecb8541263ff4688363", "score": "0.77305174", "text": "def processing?; end", "title": "" }, { "docid": "a606ff314b37ba47be08b757ff...
a67f691d7f9996d1510793d60263ce9f
Response for last HTTP request
[ { "docid": "980780c2ae9681cbda99c8e0cd441388", "score": "0.7670358", "text": "def last_response\n @last_response if defined? @last_response\n end", "title": "" } ]
[ { "docid": "5eb547c5298a35aed57b2315bade71f8", "score": "0.8295264", "text": "def last_http_response\n @http_response\n end", "title": "" }, { "docid": "65874a98c17ca62e362341cac35d05ca", "score": "0.8158877", "text": "def last_response; end", "title": "" }, { "do...
f9d9abef26c8452c7fb439cacfe6848b
Returns the value of the `hosts` attribute.
[ { "docid": "d95ab4d11bd01a8b0bf8c064eacd46e9", "score": "0.72239846", "text": "def hosts\n @hosts\n end", "title": "" } ]
[ { "docid": "10c91b2a9facb5f48becf96ba24afa03", "score": "0.75948", "text": "def hosts\n @data[:hosts]\n end", "title": "" }, { "docid": "84ebef3f4e7671230ac9c5e683349c39", "score": "0.73520887", "text": "def hosts=(value)\n @hosts = value\n e...
e898c7148793d5987e0c6d27d0aa35b1
Combine the filters and queries
[ { "docid": "f44910407f04e77b13996d9bb59fb435", "score": "0.62578183", "text": "def filtered_query\n make_bool(\n must: queries, # required, score calculated\n filter: filters, # required, score ignored\n must_not: exclusion_filters # disallowed, score ignored\n )\n end", "title...
[ { "docid": "eb2996860362f20764d82a1c47575e1a", "score": "0.7620313", "text": "def query_filters; end", "title": "" }, { "docid": "bbf0eb01c331852fa8b71de5bd326f20", "score": "0.76068795", "text": "def query\n process_filter(params)\n end", "title": "" }, { "docid": "6...
2b415958f732caa465e6e43954d77e85
Runs 'puppet apply' on a remote host, piping manifest through stdin
[ { "docid": "ee50d9e8872a7cd67bfd8b8e1b56cb82", "score": "0.71264505", "text": "def apply_manifest_on(host, manifest, opts = {}, &block)\n on_options = {:stdin => manifest + \"\\n\"}\n on_options[:acceptable_exit_codes] = opts.delete(:acceptable_exit_codes)\n args = [\"--verbose\"]\n...
[ { "docid": "22720636e5222e520b8da2fd003fbd1b", "score": "0.6932859", "text": "def apply_manifest_on(host, manifest, options={}, &block)\n on_options = {:stdin => manifest + \"\\n\"}\n on_options[:acceptable_exit_codes] = options.delete(:acceptable_exit_codes) if options.keys.include?(:acceptab...
6f1529c44046f00e49fe538aad09e097
DELETE /mnps_reports/1 DELETE /mnps_reports/1.json
[ { "docid": "473aaca6d7e7c0c2857a0f0af97d08d0", "score": "0.0", "text": "def destroy\n @mnps_report.destroy\n respond_to do |format|\n format.html { redirect_to mnps_reports_url, notice: 'Mnps report was successfully destroyed.' }\n format.json { head :no_content }\n end\n ActionCab...
[ { "docid": "988d3b3b4cb6675f47827d60a8000bd3", "score": "0.7305482", "text": "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to admin_reports_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6317e1107a485e0...
49926a0e51059022b19af2b300651c21
POST /posts POST /posts.json
[ { "docid": "99a4ecf8b855d24d37c355079657438a", "score": "0.6431938", "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 format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n ...
[ { "docid": "1696d5d4d22767f1a79db670670b4d3b", "score": "0.74466574", "text": "def create\n render json: Post.create(params[\"post\"])\n end", "title": "" }, { "docid": "deba9d8e3b025d0e293927ebdb81e62a", "score": "0.7323201", "text": "def create\n respond_with Post.create...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "31baa2ca3fddc8cb0fbe8d9022509171", "score": "0.0", "text": "def category_event_params\n params.require(:category_event).permit(:ru_title, :description, :icon)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6980244", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6782812", "text": "def strong_params\n params.requi...
3481fc61299b7ae9c8a70a929cc32654
Returns true or false if the page has a page_layout that has cells.
[ { "docid": "af5279c080aa594a4a1f12aaeae5ed02", "score": "0.67569864", "text": "def can_have_cells?\n !definition['cells'].blank?\n end", "title": "" } ]
[ { "docid": "2f9b985df482b8b1bf88ff583738a1af", "score": "0.7036329", "text": "def has_cells?\n not @cells.empty?\n end", "title": "" }, { "docid": "2dbff375cf83e7a757a0c3965cc63e09", "score": "0.68629766", "text": "def table?\n content['format'] == 'grid'\n end", ...
1355aa0aaac53d092cfea275b2c99f69
codecite eof codecite rescue
[ { "docid": "1a2ac45145328de216f2d93fdc39c506", "score": "0.0", "text": "def read_and_respond\n result = calc(prompt_and_read)\n outstream.puts(\"=> #{result}\")\n rescue ParseError\n outstream.puts(\"Invalid expression\")\n end", "title": "" } ]
[ { "docid": "c0eff051c42f00bc1c88f673cbb27dcc", "score": "0.6903899", "text": "def eof(*) end", "title": "" }, { "docid": "1cf7d7e6477353de0d8cdfac78f5c939", "score": "0.676045", "text": "def eof; end", "title": "" }, { "docid": "1cf7d7e6477353de0d8cdfac78f5c939", "sco...
2b19aa0e0b5cba757ddbf6f0d2504fd4
validate_survivors Call all methods to ensure the integrity of the info used in the trading
[ { "docid": "594de43477702cdf913325c89c46757c", "score": "0.7431521", "text": "def validate_survivors\n not(same_survivor? or invalid_survivors?) ? true : false\n end", "title": "" } ]
[ { "docid": "30c7b68412365ab5b7e9cbb2ffcee05d", "score": "0.7336154", "text": "def call\n\n validate_survivors_quantity!\n\n load_and_validate_survivors!\n\n validate_survivor_items_presence!\n\n validate_items_total_points!\n\n trade\n end", "title": "" }, { "docid": "a96ce49...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "abf4990801d0f73cbe579098bcca28e1", "score": "0.0", "text": "def update!(**args)\n @domain = args[:domain] if args.key?(:domain)\n @email = args[:email] if args.key?(:email)\n @name = args[:name] if args.key?(:name)\n @photo_url = args[:photo_url] if args.k...
[ { "docid": "150fa2bdc1fc43d28ac45e2278a1f797", "score": "0.7012263", "text": "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "t...
3b3479b12302659fbe65b6f0d2bdf2f6
effects: Deletes a budget item requires: a valid BudgetItem id
[ { "docid": "4a12e4430e5a77d2429bfcb56dcc3b5d", "score": "0.7915589", "text": "def destroy\n budget_item = BudgetItem.find(params[:id])\n budget_item.destroy\n render :json => 'success'\nend", "title": "" } ]
[ { "docid": "896d8e3ea2d7c112060e6fdff978c642", "score": "0.76815146", "text": "def destroy\n @budget_item = BudgetItem.find(params[:id])\n @budget_item.destroy\n\n respond_to do |format|\n format.html { redirect_to budget_items_url }\n format.json { head :no_content }\n end\n end"...
017a156ef06f0c461b450de5ea15e791
URL helper for the parrot js client If :dummy_tests is true, use a dummy parrot avoiding connections with the server but triggering onconnect
[ { "docid": "46d0c1d97b2ba40cad25faa458c6a52e", "score": "0.0", "text": "def neighborparrot_include_tag\n config = Neighborparrot.configuration\n parrot_js = config[:dummy_connections] ? NEIGHBORPARROT_JS_DUMMY_API : NEIGHBORPARROT_JS_API\n src = \"#{config[:assets_server]}#{parrot_j...
[ { "docid": "bd3acbfae6fb21eee7f930da78a5d873", "score": "0.6285633", "text": "def send_test_request\n\t\t\tdispatch_request({ \n\t\t\t\t:url => \"http://www.example.com/\", # IANA (192.0.32.10) ftw !\n\t\t\t\t:operation => :head, \n\t\t\t\t:repeat => true,\n\t\t\t\t:error_handler => lambda { |error| no_...
262c63ad72f974582e4122e54f9ad838
return plain text view of page
[ { "docid": "5e160469aa481049ef78f5b59c3c5adb", "score": "0.7420082", "text": "def page_text\n @web_browser.text\n end", "title": "" } ]
[ { "docid": "709ad5f1ee1e69286a47933ed1f7a82f", "score": "0.8083605", "text": "def text page\n @client.text page\n end", "title": "" }, { "docid": "0301aaa97b26fdf4667ce0f1eb8c820a", "score": "0.75117826", "text": "def text ; view.text ; end", "title": "" }, { "docid":...
d0848cee9ea416dfbd5b07103b6fd1ec
get every test to pass before coding runner below
[ { "docid": "ee0539e40fe05b11a51503bd7841eceb", "score": "0.0", "text": "def runner\n welcome #introduce the game\n sleep 0.75\n card_total = initial_round #determine your current total & tell user what number they currently have\n until card_total > 21 #continue game until user loses\n card_total...
[ { "docid": "4214d9c38556c2b02453744c9abd3771", "score": "0.7492311", "text": "def pass(suite, test, test_runner); end", "title": "" }, { "docid": "e820a876acc56d01d07c4fe31f07d454", "score": "0.74173", "text": "def run_tests\n count = 0\n puts \"Starting test run...\"\n self...
05a4c642821fcdd8d13a270c107099f0
openHouse : [Hash] Collection of OpenHouses for the property
[ { "docid": "f29c2ef7e1927ab466da013dacb1e03b", "score": "0.6999534", "text": "def open_house\n self.dig_for_array(\"openHouse\")\n end", "title": "" } ]
[ { "docid": "cd07859a6678e3d0affbdd8f33585fb1", "score": "0.7482961", "text": "def open_houses\n if object.open_houses\n object.open_houses\n .map { |x| OpenHouseSerializer.new(x).attributes }\n end\n end", "title": "" }, { "docid": "0c59499ce70863b935d95aacedaa47a5", "...
41044b05464489a411a01978228d7c9b
computes the number of ways to make amount of money with coins of the available denominations. Using a bottomup dynamic algorithm and complexity O(nm) time and O(n) additional space, where n is the amount of money and m is the number of potential denominations.
[ { "docid": "7b9202994e94bda66fa8a40e8b690d44", "score": "0.7179495", "text": "def change_possibilities(amount, denominations)\n ways_of_doing_n_cents = [0] * (amount + 1)\n ways_of_doing_n_cents[0] = 1\n \n denominations.each do |coin|\n (coin..amount).each do |higher_amount|\n higher_amou...
[ { "docid": "a312a7be8a9ac39edd5a3346a1ea9e64", "score": "0.7976835", "text": "def change_possibilities_bottom_up amount, denominations\n ways_of_doing_n_cents = [0] * (amount + 1)\n ways_of_doing_n_cents[0] = 1\n\n denominations.each do |coin|\n (coin..amount).each do |higher_amount|\n higher...
474da659669fdc96de71017201ce6695
Provide a user friendly representation source://twilioruby//lib/twilioruby/rest/chat/v2/service/channel/message.rb527
[ { "docid": "84c2aa104b8a70acbe3f11eca76559b3", "score": "0.0", "text": "def to_s; end", "title": "" } ]
[ { "docid": "95af836a47fb9627a3c699b9bb9b4859", "score": "0.6918667", "text": "def inspect\n \"<Message content=\\\"#{@content}\\\" id=#{@id} timestamp=#{@timestamp} author=#{@author} channel=#{@channel}>\"\n end", "title": "" }, { "docid": "95af836a47fb9627a3c699b9bb9b4859", "sco...
2a27ba06251182a2fa77a120be53a710
Set a sleep delay, ensuring that we will not attempt to fetch messages
[ { "docid": "ee3ff313a17b7060a998850a3eaaa78b", "score": "0.7802866", "text": "def sleep!(delay = @sleep_interval)\n @retry_at = Engine.now + delay\n end", "title": "" } ]
[ { "docid": "3deb90287a587f6deb3a5328f464fa08", "score": "0.80325025", "text": "def delay( seconds = nil )\n sleep ( seconds || @@config[:delay] )\n end", "title": "" }, { "docid": "e05b503386cec01c04c2c52313f9075c", "score": "0.76182324", "text": "def delay(delay_time)\n s...
986cd680f68317cbbd4cb0c3fc4d29ed
Output arcs Initialize a new place. Supports block configuration.
[ { "docid": "60819e8104dc97a7ee0b14a219af3b48", "score": "0.61197805", "text": "def initialize(options = {}, &block)\n @id = next_object_id\n @name = (options[:name] or \"Place#{@id}\")\n @description = (options[:description] or \"Place #{@id}\")\n @capacity = options[:capacity]\n @inputs ...
[ { "docid": "a3d27162eed1e99b6e129fc96f6fbefd", "score": "0.61258155", "text": "def initialize(options = {}, &block)\n @id = next_object_id\n @name = (options[:name] || \"Place#{@id}\")\n @description = (options[:description] || \"Place #{@id}\")\n @capacity = options[:capacity].nil? ? Float:...
ef581f7be221d7c0a3f107862b4ca115
update gear usage values
[ { "docid": "647c8c84624d1a427eaab683233e5f22", "score": "0.606037", "text": "def tick\n vals = Libcgroup.usage\n vals = Hash[vals.map { |uuid, hash| [uuid, hash.select { |k, _| @wanted_keys.include? k }] }]\n\n update(vals)\n rescue Exception => e\n S...
[ { "docid": "a227e788819d9ae579dfe34d86c38fb0", "score": "0.702704", "text": "def update_usage\n logger.debug 'update usage'\n\n # TODO: replace `where` method to get sublist\n usage_data = ResourcesData.where.not(appname: nil)\n\n usage_data.each do |usage; data|\n data = {}\n...
c61fc5d6c14ed0f57d318447eab2c17c
List the contents of the user's directory on the server Indicates whether each item is a directory or not.
[ { "docid": "3b72155c8f3ceb41a9b88ef001041f19", "score": "0.0", "text": "def files\n return [] unless directory.present? && File.directory?(directory)\n Dir[File.join(directory, '*')].inject([]) do |accum, val|\n accum << { name: File.basename(val), directory: File.directory?(val)}\n accu...
[ { "docid": "e609cff2c6424c5c18526ea075a4c5a0", "score": "0.73794603", "text": "def list_directory( dir )\n if !/^\\/.*\\/$/.match( dir )\n throw \"Invalid directory '#{dir}'. Directories must start and end with a slash (/)\"\n end\n\n uri = URI::HTTP.build( {:host => @host, :port ...
cf22edd12ff77e32ccfb19c1511d610e
POST /beacons POST /beacons.json
[ { "docid": "410c720b3ded016d15e52bc1a0854959", "score": "0.6621554", "text": "def create\n @beacon = Beacon.new(beacon_params)\n\n respond_to do |format|\n if @beacon.save\n format.html { redirect_to @beacon, notice: 'Beacon was successfully created.' }\n format.json { render ac...
[ { "docid": "6f7ba962bf108ca204fb84839ddb1c8f", "score": "0.69572043", "text": "def create\n beacon = JSON.parse(params[\"beacon\"])\n @beacon = Beacon.new(beacon)\n\n respond_to do |format|\n if @beacon.save\n format.html { redirect_to @beacon, notice: 'Beacon was successfully creat...
1762dd9cedd0e7f6b42d97e9e32023b5
Add a callback which will pass only the event object to +block+ it will not try to pass arguments as well.
[ { "docid": "b03d8b10fb044a4ac0be8d91965ca790", "score": "0.58866197", "text": "def add_basic_callback(handle=nil, &block)\n add_block_callback(HookR::BasicCallback, handle, &block)\n end", "title": "" } ]
[ { "docid": "0af0f763094007165c6dddaffdcc8e31", "score": "0.73149776", "text": "def add_block_callback(hook_name, handle, block)\n case block.arity\n when -1, 0\n hooks[hook_name].add_internal_callback(handle, &block)\n else\n add_external_callback(hook_name, handle...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "6931689eea9a9545ce170b7b3184e178", "score": "0.0", "text": "def set_our_work\n @work = OutWork.find_by(id: params[:id])\n rescue Exception => e\n render_default_error e, 401\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;...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "2c23aac13240241b90af05aad474bf86", "score": "0.0", "text": "def update!(**args)\n @additional_fixed_point_encodings = args[:additional_fixed_point_encodings] if args.key?(:additional_fixed_point_encodings)\n @compressed_document_embedding = args[:compressed_document_embeddi...
[ { "docid": "150fa2bdc1fc43d28ac45e2278a1f797", "score": "0.7012263", "text": "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "t...
73b3332c2629bf6ab77a94cac679bc7e
List LBService Paginated list of all LBService.
[ { "docid": "47159ac93e865c282043b23e1ccc0263", "score": "0.6607961", "text": "def list_lb_services_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerServicesApi.list_lb_services ...
[ { "docid": "53c6f313cdedd7dc8ae7f962b7e50a96", "score": "0.7143544", "text": "def list_lb_services(opts = {})\n data, _status_code, _headers = list_lb_services_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "52034212a57a5d01d142cd532aa6cb7c", "score": "0.68612...
48d9e8817d0d28f20d914d720f75c477
Get groups for which the given IP address is a member Get policy groups for which the given IP address is a member.
[ { "docid": "307dd9249a443de9e7c9dd7c7e13e712", "score": "0.5970906", "text": "def get_groups_for_ip_address_with_http_info(ip_address, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyInventoryGroupsGroupMembersApi.get_groups_for_ip_address ....
[ { "docid": "b948fec79ef935862ffd3f5bfbb81440", "score": "0.61121917", "text": "def groups\n return [] if memberOf.nil?\n @groups ||= Group.find(:all, distinguishedname: @entry.memberOf).delete_if(&:nil?)\n end", "title": "" }, { "docid": "e3f2c1d6972f91427e06c0f607b43329", "...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "fc52d5cf5d0c07752db09062260a140a", "score": "0.0", "text": "def test_model_params\n params.require(:test_model).permit(:nickname, :status, :description)\n end", "title": "" } ]
[ { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.7121862", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "b32229655ba2c32ebe754084ef912a1a", "score": "0.70524937", "text": "def expected_permitted_parameter_names; end", "title": "...
fd20fd370c3773c4bf0641c88dff263f
methods used from format_wiki
[ { "docid": "970efe08cb3a9baa86423b874b5dff72", "score": "0.0", "text": "def escape_nowiki(str)\r\n if @nowikis\r\n @nowikis.clear\r\n else\r\n @nowikis = {}\r\n end\r\n str.gsub(/<nowiki>(.*?)<\\/nowiki>/m) do\r\n nowiki = $1\r\n nowiki_id = nowiki.object_id\r\n @now...
[ { "docid": "2b8546ebac55b2f2e16e77a2e31ae03f", "score": "0.719992", "text": "def formats; end", "title": "" }, { "docid": "2b8546ebac55b2f2e16e77a2e31ae03f", "score": "0.719992", "text": "def formats; end", "title": "" }, { "docid": "57db8fb8618db6d48ca87408eff5135e", ...
b76cdf49f1adbd63aa7d56496a848a6b
A BeforeAction method to get the event passed from a different controller: Sets a variable 'parent_event' if an event object was passed in:
[ { "docid": "771abcf611d47e1c2470a911d3048288", "score": "0.5423933", "text": "def find_parent_volunteer\n # Find event passed in from filter:\n @parent_volunteer = Volunteer.find_by_id(params[:volunteer_id]); # Will return an object or return nil.\n\n # DEBUG ONLY:\n puts(\"f...
[ { "docid": "fd07d1368e5a00adca69a8d48b4f81b1", "score": "0.75962096", "text": "def parent_event\n @event = Event.find(params[:event_id])\n end", "title": "" }, { "docid": "0229d2a2d5e4e5754b5d4f005fd1faee", "score": "0.7478686", "text": "def parent_event\n @event = Event...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "c185ed47a60d985c65611053ee48e075", "score": "0.0", "text": "def update!(**args)\n end", "title": "" } ]
[ { "docid": "184b1b1ed771473d3eb9f338c0734c38", "score": "0.73066413", "text": "def update *args\n opts = args.extract_options!\n fill_properties opts\n self.save\n end", "title": "" }, { "docid": "5076c5a88404ae72986f958710f5687a", "score": "0.72631145", "text": "def update...
8e666bdadbdd2f4a530f19868b66660a
`git pull` a repository
[ { "docid": "65bb0091e789a003389f3a40d6675b1a", "score": "0.7040605", "text": "def update_repo(repo)\n\trepo = repo.gsub(/\\w*-?\\w*\\//,'')\n\tputs \"\"\n\tputs \"Updating #{repo}\"\n\t`cd ~/workspace/#{repo}; git checkout master; git pull`\nend", "title": "" } ]
[ { "docid": "5a6a0afa7086574cb1466fa5d3fca92f", "score": "0.79917264", "text": "def pull_repo(git_repo, target)\n check_if_git_repo! target\n execute \"Pulling #{git_repo}\", \"cd #{target} && git pull\"\n end", "title": "" }, { "docid": "5d63ea26b7dce5b3f607d0e98f1b151d", "score":...
c0ec088db2281d35ad013a2e5110bd17
Test for text lines
[ { "docid": "6b83c26471471a10293f5c62aefe9804", "score": "0.6104194", "text": "def test_text\n assert(line('Hello World').text?)\n assert(line('Hello World with special characters äöüßÄÖÜ').text?)\n assert(!line('.:!').text?)\n end", "title": "" } ]
[ { "docid": "75538e91666a7d00377e4e1b1d592ed5", "score": "0.75326693", "text": "def is_multiline?(text); end", "title": "" }, { "docid": "563df4b7c474ce385be901af8444607e", "score": "0.73143816", "text": "def on_line?(line)\n end", "title": "" }, { "docid": "c3af1a7475655...
373b68a25cd8010ad7277448df0bb076
unescapes HTML. If xml is true, also converts XMLonly named entities to HTML.
[ { "docid": "b135a429e94018de76a681f44c08cbc8", "score": "0.8040966", "text": "def unescapeHTML(str, xml = true)\r\n CGI.unescapeHTML(xml ? str.gsub(\"&apos;\", \"&#39;\") : str)\r\n end", "title": "" } ]
[ { "docid": "ba7e60fdf1bf7d94b4a7d787d1935267", "score": "0.75059545", "text": "def html_unescape\r\n self\r\n .gsub('&LT;', '<')\r\n .gsub('&lt;', '<')\r\n .gsub('&gt;', '>')\r\n .gsub('&#39', \"'\")\r\n .gsub('&#34', '\"')\r\n end", "title": "" }, { "docid": "58...
9ec54e15ebfca079387ee0c0373dbd7d
Returns a String with the image's content type.
[ { "docid": "968cf0993a5b4923a6bd03707f87cb50", "score": "0.0", "text": "def content_type\n MIME::Types.type_for(@path)[0].content_type.force_encoding 'UTF-8'\n end", "title": "" } ]
[ { "docid": "cfac3b6b3131335f4c5a0446f15d2c56", "score": "0.78256714", "text": "def mime_type\n @image.mime_type\n end", "title": "" }, { "docid": "cfac3b6b3131335f4c5a0446f15d2c56", "score": "0.78256714", "text": "def mime_type\n @image.mime_type\n end", "title": ...
9d199a520353b7715c853771661da7ca
Update the local spec to the specified gem version
[ { "docid": "f8207af38fb5cadd85d39295d86febb2", "score": "0.7034598", "text": "def update_spec_to(gem)\n in_repo do\n spec.update_to(gem)\n File.write(spec_file, spec.to_string)\n end\n end", "title": "" } ]
[ { "docid": "3d82b3ced80cc7e1fdb0b085e037bfab", "score": "0.7094612", "text": "def update_spec_to(gem)\n in_repo do\n spec.update_to(gem)\n File.write(spec_file, spec.to_string)\n @dirty_spec = true\n end\n end", "title": "" }, { "doci...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "9840a4595a8a02878b7d9dfd5a1b9bfa", "score": "0.0", "text": "def league_params\n ActiveModelSerializers::Deserialization.jsonapi_parse(params, only: [\n :name,\n :website,\n :logo,\n :level,\n :season_start,\n :season_end,\n :indoor,\n :marker_icon\n...
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7942467", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.6957796", "text": "def permitted_params\n params.permit!\n end", "title":...
8b3721fbe6c458f8b2e24bc8aef2ae69
Returns a PBXObjectList instance of objects in the list. By default this list will scope the list by objects matching the specified class and add objects, pushed onto the list, to the parent list If a block is given the list instance is yielded so that the default callbacks can be overridden.
[ { "docid": "47e1c20050abee85eb093db816a013c0", "score": "0.7508101", "text": "def list_by_class(klass)\n parent = self\n PBXObjectList.new(klass, @project) do |list|\n list.let(:push) do |object|\n # Objects added to the subselection should still use the same\n ...
[ { "docid": "421f7bc4496d0c870f8d6072b4fadd30", "score": "0.67810357", "text": "def list_by_class(uuid_list, klass)\n PBXObjectList.new(klass, @project) do |list|\n list.let(:uuid_scope) do\n # TODO why does this not work? should be more efficient.\n #uuid_li...
b0fd970a515e14c9706b2842520f1118
Below Generates the slug based on petition title field, if taken adds city name, and then an id at the end
[ { "docid": "e01b8c277d91c91d715cae51cacdc04c", "score": "0.71227086", "text": "def slug_candidates\n [\n :title,\n [self.city.name, :title],\n [self.city.name, :title, :id]\n ]\n end", "title": "" } ]
[ { "docid": "b1bde76320997a206ec011fa4e34ce7e", "score": "0.7560483", "text": "def generate_slug\n if self.slug.blank? || self.slug.nil?\n unless self.name.blank?\n if Department.in_clinic(self).where(slug: name.parameterize).count != 0\n n = 1\n while Department.where(sl...
0a7566561861dcd6c4400564cff2b51f
Get a list of all the car owners that go to a specific mechanic Use the list of cars that a mechanic works on (cars_serviced) then find the .owner value for those cars!
[ { "docid": "89b474f140c7aed5a2a029b9e7235193", "score": "0.82517856", "text": "def owners\n cars_serviced.map do |car|\n car.owner\n end\n end", "title": "" } ]
[ { "docid": "a6f37a68848ae3bd7266cd5bf054de61", "score": "0.8149277", "text": "def my_car_owners\n self.cars_i_service.map(&:owner)\n end", "title": "" }, { "docid": "015abfa1a2c8a5ca323bdf804de72146", "score": "0.8079965", "text": "def car_owners\n cars.collect {|car|car.car_o...
799d06de2f4bff46af94d568940be232
Returns all reviews about a certain user, as well as the users who wrote those reviews.
[ { "docid": "0a7961d9531b0764012137a851572b3b", "score": "0.60610867", "text": "def self_reviews\n if authenticate\n reviews = @user.reviews\n \n render :json => reviews\n else\n error_message(\"Wrong account credentials\")\n end\n end", "title": "" } ]
[ { "docid": "a88698070d0cd3ce926d85b855e915d2", "score": "0.80328494", "text": "def user_reviews\n @user_reviews ||= Exlibris::Primo::WebService::Request::GetAllMyReviews.new(\n user_request_attributes).call.reviews\n end", "title": "" }, { "docid": "cc51f7e0e1d39d46fd6a6...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "f8c13bf79ed912a477e92f0f9162a002", "score": "0.0", "text": "def set_video_set\n @video_set = VideoSet.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.603186", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6015241", "text": "def ...
936272b0d539fc32de7abc420bbd7e1c
def run_game card = get_card puts card.definition guess = get_guess if check_answer(card, guess) == true puts "Correct!" remove_card(card) else
[ { "docid": "284684f37c52b18217a1455fa20b2d0e", "score": "0.8071452", "text": "def run_turn\n random_card = @deck[0]\n puts random_card.definition\n puts \"what's your guess?\"\n print \":>>\" \n input = gets.chomp!\n\n until input == random_card.term \n puts \"sorry! Try again\"\n ...
[ { "docid": "be0e76135edb322a657c479febf3a689", "score": "0.75275916", "text": "def player_turn\n say \"It's your turn. Would you like to HIT or STAY?\"\n response = gets.chomp\n # if user wants to HIT\n if response.upcase == \"HIT\"\n puts\n say \"Okay #{$name}, you said HIT right? Hand before...
b4c9b45c54e24374c2b4ebefb900f062
POST /news POST /news.json
[ { "docid": "330b356e29aa934b3c8f0e7976149bae", "score": "0.0", "text": "def create\r\n # Get all users from database\r\n @users = User.all\r\n\r\n\t# If user not authorized\r\n if !session[:user_id]\r\n\t\t\r\n\t\t# Then redirect user to Index page\r\n\t\tredirect_to index_url\r\n end\r\n\t\...
[ { "docid": "25bc1f7677c040f141b1d54f1b73c289", "score": "0.7534049", "text": "def create\n @news = News.new(params[:news])\n\n respond_to do |format|\n if @news.save\n format.html { redirect_to news_path, notice: 'News was successfully created.' }\n format.json { render json: @n...
ae7061a12384b3a4637582676badf325
Helper method to raise an error if the Resource API is not available
[ { "docid": "f9d25d7952b9559d1cae8f51f8b303ee", "score": "0.0", "text": "def raise_precondition_error(error)\n raise PDK::CLI::ExitWithError, _('%{error}: Creating a %{thing_name} needs some local configuration in your module.' \\\n ' Please follow the docs at https://puppet.com/docs/pupp...
[ { "docid": "8f30cba6633524100cefaa8bf65fa29f", "score": "0.7298283", "text": "def ensure_resource_found!\n raise ResourceNotFound, self if meta[:code] == 4153\n end", "title": "" }, { "docid": "a4320feb4901b6cda14ad2079fbf323f", "score": "0.68633294", "text": "def resource_er...
2f47a706154d768e7beff6ee195f8220
POST /bread POST /bread.json
[ { "docid": "b2a5d8d381bafdebe6bbdaff2efd1d3b", "score": "0.76729524", "text": "def create\n @bread = Bread.new(params[:bread])\n\n respond_to do |format|\n if @bread.save\n format.html { redirect_to @bread, notice: 'Bread was successfully created.' }\n format.json { render json:...
[ { "docid": "1da857d82fc18ccd2cae4237a2176acd", "score": "0.6814836", "text": "def create\n @inindian_bread = InindianBread.new(inindian_bread_params)\n\n respond_to do |format|\n if @inindian_bread.save\n format.html { redirect_to @inindian_bread, notice: 'Inindian bread was successful...
32cbf73df58092a7d1e9f226e182dd92
Adds to the lists of regular expressions used to match the request URI part of the client requests during caching. (see section 5.1 of RFC2616). A match must be found in at least one of the "include" fields. For example, to include requests ending in ".txt", ".htm" and ".html", one would use the following in the uri in...
[ { "docid": "9f359f443eff231f54b7f50a5b28356b", "score": "0.6398297", "text": "def add_ramcache_uri_include(opts)\n opts = check_params(opts,[:reg_expressions])\n super(opts)\n end", "title": "" } ]
[ { "docid": "92592ba16cdc7eee287aecbb87d7bf7d", "score": "0.62129617", "text": "def add_match_expression(expression)\n @matchers << expression.matcher(cache)\n self\n end", "title": "" }, { "docid": "94a1ee14ec94524fdaa321714986dbf4", "score": "0.5655233", "text": "...
9cc239bc2aedc52b70b3a1a3285bcbaf
PATCH/PUT /usuario_da_forcas/1 PATCH/PUT /usuario_da_forcas/1.json
[ { "docid": "13b1732cf523a9ba0aed584088d16241", "score": "0.65458596", "text": "def update\n respond_to do |format|\n if @usuario_da_forca.update(usuario_da_forca_params)\n format.html { redirect_to @usuario_da_forca, notice: 'Usuario da forca was successfully updated.' }\n format.j...
[ { "docid": "8a3601d5bfa4b1fb24290c9d4c096ffd", "score": "0.70993084", "text": "def update\n @usuario = User.find(params[:id])\n \n respond_to do |format|\n if (@usuario.update_attributes(params[:usuario]))\n \n # format.json { render :json => { :success => true, :usuario_id =>...
a21b7abfeec11b5a0d554d376923d479
Process a stream for wheatpasting
[ { "docid": "a0c361b1488b740c9763f66c74c53086", "score": "0.7300129", "text": "def wheatpaste_stream(stream, pause_length, line_by_line)\n if line_by_line\n stream.each_line do |line|\n wheatpaste(line.chomp, pause_length)\n end\n else\n wheatpaste(stream.read.chomp, pause_len...
[ { "docid": "fb5265c9e5a99f73fdfc05a06fa01eb0", "score": "0.6573278", "text": "def process_stream(stream,output)\n raise \"should init streamer with an IO object\" unless stream.is_a?(IO)\n @output = output\n @stream = stream\n begin\n stream_begin # abstract\n while string = get_st...
7f661dc77f84ff3a09d80323354accf2
Translates a +row+ of data from the database with the given +types+
[ { "docid": "e8cf70fdd76fe84a2c5b0d91237eddf3", "score": "0.88487256", "text": "def translate_from_db(types, row); end", "title": "" } ]
[ { "docid": "2935e0c63a5470f71ca731b600b6d2e2", "score": "0.60892487", "text": "def map_for(row_type)\n mappings.for_row(row_type)\n end", "title": "" }, { "docid": "43e0fcfd4e81938d5e2907be0df32a6c", "score": "0.5917293", "text": "def bind_datatypes(op) \n tmp_text_array =...
f367bf16dae9268dd5a2a21f268f9eaa
GET /datapoints/1 GET /datapoints/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "776310ed778b08bcb26c867349510348", "score": "0.70158637", "text": "def index\n @data_points = DataPoint.recent # cached_recent\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @data_points }\n end\n end", "title": "" }, { ...
3644d6858f40c2005784f0311e41bdc8
Call run_on_change for all files which match this guard.
[ { "docid": "1e87f71a76a520ce65b2ef6c69642830", "score": "0.0", "text": "def run_all\n deploy_code\n run_test\n end", "title": "" } ]
[ { "docid": "c6a6d9d40f52dcfc0f97a4ef6d4bc83b", "score": "0.7955216", "text": "def run_all\n run_on_change(\n Watcher.match_files(\n self, \n Dir.glob(File.join(::Guard.listener.directory, '**', '*.s[ac]ss')).\n map {|f| f[::Guard.listener.directory.size+1..-1] }....
f221c7b27f5bf0b9d365df0d33aa4d1c
Returns the last node, last returns its value
[ { "docid": "5e90b5609a85f75c0f5d791c6d8e7947", "score": "0.0", "text": "def tail\n return nil if @head.nil?\n # A list with a loop in has no tail\n return nil if loops?\n\n # Step through nodes until next is nil (which tests to false)\n current_node = @head\n current_node = current_nod...
[ { "docid": "36e0c3363c5ff802b3773ef944f7d183", "score": "0.89873916", "text": "def getLast\n if @lastNode.nil?\n @firstNode.value\n else\n @lastNode.value\n end\n end", "title": "" }, { "docid": "57e9b46b90bd9d805e7dbeffd143b29b", "score": "0.8625493", "text": "de...
22c241883d416479d42723aef6ce1235
Return image dimesions ("WxH") for given style name. If style name not given, return dimesions for default_style.
[ { "docid": "71da46dc2f504881e84b1b9ee22348ef", "score": "0.60950154", "text": "def image_size(style = default_style)\n return nil if instance_read(:meta).nil? || instance_read(:meta).empty?\n \"#{width(style)}x#{height(style)}\"\n end", "title": "" } ]
[ { "docid": "d7e18148714a16f2d84520bd6720a083", "score": "0.68229294", "text": "def dimensions(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n original_width = from_examination(:@original_width)\n original_height = from_examina...
dcb4bb29cdd6aa4dfecfa4a5e3a63765
i steal this from rails
[ { "docid": "4d2e31652ebf5e869c24eeaa779e4213", "score": "0.0", "text": "def find_root_with_flag(flag, default=nil)\n root_path = self.class.called_from[0]\n\n while root_path && File.directory?(root_path) && !File.exist?(\"#{root_path}/#{flag}\")\n parent = File.dirname(root_path)...
[ { "docid": "928512e34ca1d76a28b3e5a1c18a9f87", "score": "0.63957226", "text": "def requestor; end", "title": "" }, { "docid": "40769f9969d33ad71cb2389a7e574114", "score": "0.637788", "text": "def institucional\n\t\t\n\tend", "title": "" }, { "docid": "003f93545faf95741b6d...
6557fc2b27ee8978f35b77507728e2b7
Understant the problem take a string, then break up the string and take the 3 elements the first is a number as a word the second is the operator the third is the second number Data I: string O: integer Solution split the string into an array convert the first and third elements to numbers Then assess which operator is...
[ { "docid": "e4165cd76f008adada9afbb83e9301db", "score": "0.0", "text": "def start_index(array)\n index = array.find_index{ |el| el == 'divided' || el == 'times' }\n index ? (index - 1) : 0\nend", "title": "" } ]
[ { "docid": "b81988fcde97475f4a50c20a38a7c195", "score": "0.7010155", "text": "def calc_ruby(string)\n keyword_hash = {\"add\" => :+, \"subtract\" => :-, \"multiply\" => :*, \"plus\" => :+, \n \"minus\" => :-, \"power\" => :**, \"divide\" => :/, \"divided\" => :/}\n calculate_array = []\n question ...
4a39ab9fcadaa6f96d4cde8146e9f012
removes the last element from the list
[ { "docid": "012b05e556cd0a099e20c68ef9bb288e", "score": "0.0", "text": "def pop\n return nil if @head.next.nil?\n\n node = @head.next\n node = node.next until node.next.next.nil?\n node.next = nil\n end", "title": "" } ]
[ { "docid": "f4337f6f1617d218eed5b4bf18e33ee0", "score": "0.85139465", "text": "def remove_last\n return nil if @list.empty?\n item = @list.delete_at(tail)\n if @list.size > 0\n clear_next_in_listitem(tail)\n update_last_in_listinfo\n else\n clear_first_in_listinfo\n clear...
8d9f751358d0bb79d8844bff16dac56d
Create stripe standalone account
[ { "docid": "2cf1f61606f784c310f822f8d96e43d7", "score": "0.85394716", "text": "def create_stripe_standalone_account\n Stripe::Account.create(\n :managed => false,\n :country => country_code,\n :email => email\n )\n end", "title": "" } ]
[ { "docid": "1e653b43f9884faeba2ba54da9d599c4", "score": "0.8216372", "text": "def create_stripe_account\n if is_managed\n create_stripe_managed_account\n else\n create_stripe_standalone_account\n end\n end", "title": "" }, { "docid": "fa96bfce1a757cb87b9b1a85bbf9f26b", ...
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "5971fd67c9af28baf2223efe49fb8d78", "score": "0.0", "text": "def result_mail_params\n params.require(:result_mail).permit(:recipient_email, :email_object, :email_message, :result_id)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74768823", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.71700543", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist...
edfb541e3046f484ed7e701645a91629
GET /meetingrooms GET /meetingrooms.xml
[ { "docid": "7af1bb8d3a71192cde582ba8adf30842", "score": "0.7254077", "text": "def index\n @meetingrooms = Meetingroom.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @meetingrooms }\n end\n end", "title": "" } ]
[ { "docid": "659eb1d3e19f64ad9ca2ddb968b34802", "score": "0.7095914", "text": "def rooms\n get('rooms')\n end", "title": "" }, { "docid": "ce9a3422687cf39839bd7679c42c4228", "score": "0.6961132", "text": "def get_rooms\n JSON.parse(RESTful.get(URL_MICROSERVICE_ROOMS))\n en...
3a798bb8026081587e83ddf4845362f0
This template is for signups on web
[ { "docid": "1e1692c24950e1b630159d411c532dc5", "score": "0.0", "text": "def web_sign_up_present(member, merchant_store)\n \t@member = Member.find(member)\n @merchant_store = MerchantStore.find(merchant_store)\n \t#attachments[\"rails.png\"] = File.read(\"#{Rails.root}/public/404.html\")\n \t#Se og...
[ { "docid": "efc25b280a6b74fa4b6d72268ec68d92", "score": "0.72261024", "text": "def signup\n end", "title": "" }, { "docid": "efc25b280a6b74fa4b6d72268ec68d92", "score": "0.72261024", "text": "def signup\n end", "title": "" }, { "docid": "ea164e5f5dbf2c44abe3c1a1f252f1e4...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "1d391563679810bce98779f1a58fd31f", "score": "0.0", "text": "def set_cv\n @cv = current_user.cv\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60310465", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60152966", "text": "d...
5d62042dc7ce15eea8280185c603fbce
Manage the context (view) and the block
[ { "docid": "a476daf6e2753f8ef720ce85ff041eb3", "score": "0.0", "text": "def initialize(view, *args, &block)\n raise \"Trying to instantiate abstract class for #{self.class}\" if abstract_class?\n super(*[view, block])\n manage_args(*args)\n instance_exec(self, &callback)\n end", ...
[ { "docid": "50e530d9745093378fa8ef80cf9724cd", "score": "0.71387416", "text": "def context(&block); end", "title": "" }, { "docid": "50e530d9745093378fa8ef80cf9724cd", "score": "0.71387416", "text": "def context(&block); end", "title": "" }, { "docid": "79257a6faeba2c8aa0...
f1863b91f354b1b7d414f68481959a36
Add a member to replicaset
[ { "docid": "89fdb10dd31275c7ac2d8a48db780da6", "score": "0.8441428", "text": "def add_member_to_replicaset(replica_members, member)\n if !replica_members.has_key?(member)\n Puppet.debug(\"REPLICASET-DEBUG: Add node #{member} in the replica\") if active_debug\n mongo(\"#{get_client}\", \"--q...
[ { "docid": "1950715e5aaec14033af5560e1c9f5f7", "score": "0.67921877", "text": "def add_member(member, type = :normal)\n client.put(\"/boards/#{self.id}/members/#{member.id}\", { type: type })\n end", "title": "" }, { "docid": "04c49a516b07995a55b283f0a8a60b2d", "score": "0.678715...
75147382afee6bf82c10823fc78f7c5a
DELETE /calendars/1 DELETE /calendars/1.json
[ { "docid": "f070c898ae165f4f7253674e89c56e42", "score": "0.80688864", "text": "def destroy\n @calendar = Calendar.find(params[:id])\n @calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to '/admin/calendars' }\n format.json { head :ok }\n end\n end", "title":...
[ { "docid": "9d54adaeb5861fe84f271b8ff53faa69", "score": "0.8124993", "text": "def destroy\n @calendar = Calendar.find(params[:id])\n @calendar.destroy\n\n respond_to do |format|\n format.html { redirect_to calendars_url }\n format.json { head :no_content }\n end\n end", "title...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "c648e0879bdfae469874d522f6fc5408", "score": "0.0", "text": "def set_micropost\n @micropost = Micropost.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60310465", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60152966", "text": "d...
92b8d22796389e716fd92ee4f3cc957f
as we are using the in_visible_account scope we must make sure that the sort field is properly prefixed with then entries table name
[ { "docid": "1c3dcbdefcc1e8af695c016b358c801d", "score": "0.55077237", "text": "def options_from_pagination_state_with_entries_prefix(pagination_state)\n unless pagination_state[:sort_field].blank? || pagination_state[:sort_field] =~ /^entries\\./\n pagination_state[:sort_field] = \"entries.#{pag...
[ { "docid": "85f059f1886da94b964d7324399331c2", "score": "0.65587467", "text": "def list_entries\n sortable = sortable?(params[:sort])\n if sortable || default_sort\n clause = [sortable ? sort_expression : nil, default_sort]\n super.reorder(Arel.sql(clause.compact.join(', ...
f04600edf8d7d78ae1e2906b53499bbe
TODO : Move any occupied cells above the removed rows down
[ { "docid": "c89b41718f6b3b534190304e44195f27", "score": "0.68612605", "text": "def remove_filled_rows\n (0...@board_height).each do |row|\n index_range = row * @board_width...(row + 1) * @board_width\n if @board[index_range].reduce(:+) == @board_width\n @board...
[ { "docid": "154cfda84b1b933c52509b3a55bbc537", "score": "0.72741", "text": "def check_row_removal\n to_remove = []\n # First, we find all rows that need removing\n @field.each_with_index do |row, idx|\n # Ignore last row\n next if row == @field[-1]\n\n good = true\n row.each...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "f3b3b284280e7b2d37710edcfcc274bf", "score": "0.0", "text": "def update!(**args)\n @history_id = args[:history_id] unless args[:history_id].nil?\n @id = args[:id] unless args[:id].nil?\n @messages = args[:messages] unless args[:messages].nil?\n @snippet = a...
[ { "docid": "150fa2bdc1fc43d28ac45e2278a1f797", "score": "0.7012263", "text": "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "t...
d22dd8f63972a0991422fa779653248b
define the arguments that the user will input
[ { "docid": "1aacea757e924afab8f41d4a8b0a5987", "score": "0.0", "text": "def arguments\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # this measure does not require any user arguments, return an empty list\n return args\n end", "title": "" } ]
[ { "docid": "c62750f6e8d591e4a244028ec8cd5a7a", "score": "0.7418197", "text": "def arguments\n end", "title": "" }, { "docid": "49665d066ffcf52f2c37b2b1c268e6fd", "score": "0.73753476", "text": "def arguments; end", "title": "" }, { "docid": "49665d066ffcf52f2c37b2b1c26...
7b68b19ead92a105a3a06f0d9e602b1f
how to do the sqlite searches from within an action.
[ { "docid": "06b2e0724d6bdd2f7cfc429d8f2f20a7", "score": "0.0", "text": "def sign_up\n\n # logger.debug \"start of sign up--------------------------------------\"\n\n # #@results = User.select(:user_name).all\n\n # @blah = 'Mike2'\n\n # @results = User.find_by user_name: \"#{@blah}\"\n\n ...
[ { "docid": "03906a6c9143a2e91226a83f9febfddc", "score": "0.70502144", "text": "def execute\r\n search\r\n end", "title": "" }, { "docid": "49ef23333184c57caf551cbdd161ff1a", "score": "0.65849304", "text": "def search\n end", "title": "" }, { "docid": "49ef23333184c57...
55d1ee08c7a7140dd5d525b9718e2ff0
:admin_user_layout GET /admin/pages GET /admin/pages.json
[ { "docid": "cdebd5d838c58e3241818b36c33bb208", "score": "0.0", "text": "def index\n @pages = Page.all\n end", "title": "" } ]
[ { "docid": "c66dc71580d2284eded08e24dc7b92a8", "score": "0.7458192", "text": "def index\n @admin_pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_pages }\n end\n end", "title": "" }, { "docid": "185d662d149aadb...
f635799c916b5473c390633e2963fe70
Return full details of the scraped entity in a Hash.
[ { "docid": "9ed1e85fb0b66f64b4de35b8f845ad65", "score": "0.61942106", "text": "def full_details\n data = self.class\n .data_keys\n .map { |k| [k, send(\"#{k}\")] }\n .to_h\n { id: id,\n url: url }.merge(data)\n end", "title": "" ...
[ { "docid": "d9e2ab74b1f30db5ad7b282990544869", "score": "0.6073289", "text": "def hash\n @hash.hash\n end", "title": "" }, { "docid": "ca68a815e3a70fe76218577d56c2e591", "score": "0.60614073", "text": "def hash\n @content.hash\n end", "title": "" }, { "docid": "82...
82afc93ea67c22389ea5b8b57858a6d4
Innitially tried this but too complicated looking. Dat code smells! def num_points_scored(that_guy) game_hash.each do |location, team_data| team_data.each do |attribute, data| if attribute == :players data.each do |player| if player[:player_name] == that_guy return player[:num_points_scored] end end end end end end sec...
[ { "docid": "0eb869968faf3ccdf6bd880c65ada901", "score": "0.0", "text": "def all_players(game_hash)\n all_players = Hash.new\n game_hash.each do |location, team_data|\n team_data.each do |attribute, data|\n if attribute == :players\n data.each do |player|\n ...
[ { "docid": "c7a59686e5be55cbcdad94281c406d69", "score": "0.9245573", "text": "def num_points_scored(player)\n points = 0\n game_hash.each do |location, team_data|\n team_data.each do |attribute, data|\n if attribute == :players\n data.each do |player_data|\n player_data.each do...
912c0e0cf8816366872f1b29941d2de1
DELETE /events/1 DELETE /events/1.json
[ { "docid": "db4eac2f67ac44c0a3a805d4a0c9447d", "score": "0.0", "text": "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'Event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "ca8002b7f734bce1f1a27f7ec6e59e9d", "score": "0.8085355", "text": "def destroy # DELETE /api/events/:id\n @event.destroy\n render :json => \"Event deleted\", :status => 201\n end", "title": "" }, { "docid": "3281a9c9361cdbd7e683034a763917de", "score": "0.78332...