query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
2bc073e4b71c0055bfbd96cb2871373b
Public: Constructor opts A Hash of options :client_id The soundcloud client id as a String. :path A String, path to a directory where downloaded files will be stored. If no path is specified, downloaded files will be saved in a temporary directory and deleted upon exit Returns an instance of StreamClient
[ { "docid": "1ab03e5ca0c2aa89f07b1500007cb27a", "score": "0.634257", "text": "def initialize(opts)\n @client_id = opts[:client_id]\n @path = opts[:path]\n @url = nil\n end", "title": "" } ]
[ { "docid": "4641364225f3a9d58ee06c24086a8c5d", "score": "0.6295456", "text": "def stream( opts={} )\n file_content_path = \"#{fs_path('fs-content')}#{Egnyte::Helper.normalize_path(path)}\"\n file_content_path += \"?entry_id=#{opts[:entry_id]}\" if opts[:entry_id]\n @session.streaming_down...
05cd7a6876fe772423fcb1b11314dec8
DELETE /boat_widths/1 DELETE /boat_widths/1.xml
[ { "docid": "6b58ba1f2a1cb0aafa75a1d8fc9cf9d4", "score": "0.73122096", "text": "def destroy\n @boat_width = BoatWidth.find(params[:id])\n @boat_width.destroy\n\n respond_to do |format|\n format.html { redirect_to(boat_widths_url) }\n format.xml { head :ok }\n end\n end", "titl...
[ { "docid": "19c1758f589ebe3ef4c2b849dba0544d", "score": "0.60482454", "text": "def destroy\n @boat.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "576cf906fbe75888caa55663abb87306", "score": "0.60123414", "text": "def destroy\n @boat = Boat.find(params[:id])...
c7062386be97e784c6acff4fb31f1678
encrypt("swordfish") =begin decrypt method while index is less than the length of the string Go backward one letter for each letter of the string. Ex. input = "abc" output = "zab" if string contains a space leave unchanged and move to next letter =end
[ { "docid": "ec7b4a3410e29c2426e9b37c01871080", "score": "0.0", "text": "def decrypt(word)\n\nindex = 0\n# declare empty string we will add to\ndecrypt_letter = \"\"\n# declare alphabet index to compare to\nalphabet = \"abcdefghijklmnopqrstuvwxyz\"\n# loop over letters of string\nwhile index < word.lengt...
[ { "docid": "828ea069cfec4903010163ed5ad36f4b", "score": "0.8031959", "text": "def decrypt(str)\n\talphabet = \"abcdefghijklmnopqrstuvwxyz\"\n\tstart_count = 0\n\ta_count = 0 \n\tuntil start_count == str.length\n a_count = alphabet.index(str[start_count])\n\t str[start_count] = alphabet[a_count-=1 ]\n...
c0eb866008ab0349b9296ef6b7a88915
Subscribe to an issue.
[ { "docid": "5273def09d0b5ee5cdd9767093f7330a", "score": "0.7598729", "text": "def subscribe_to_issue(project, id)\n post(\"/projects/#{url_encode project}/issues/#{id}/subscribe\")\n end", "title": "" } ]
[ { "docid": "b01606c7b6bd109001874dfad6996399", "score": "0.7092386", "text": "def subscribe\n @issue.skip_email_notifications = true\n @issue.subscribe(current_user)\n render 'issues/update.js.erb', locals: {project: @project, key: @key, translation: @translation, issue: @issue }\n end", "...
d264c5d69b7ba8ee2a12c7893a091809
Find all shares that need to be exchanged and do so. Also places remaining corporation shares in it's treasury and gives the branch company it's partial cap.
[ { "docid": "b00c0807d2397f399acde32b9ddd0a21", "score": "0.7351341", "text": "def exchange_split_shares(corporation, branch)\n # Setup the corporation to be incremental capitalization now\n corporation.capitalization = :incremental\n\n # Handle the players presidency\n ...
[ { "docid": "0c82d24ec396134258bf4f0ff1dbd2f5", "score": "0.63421047", "text": "def shares_common(entity_id = nil)\n if entity_id\n sell_condition = \"buyer_id = #{entity_id}\"\n buy_condition = \"seller_id = #{entity_id}\"\n else\n sell_condition = \"seller_id = #{company.entity_id}...
e73a42695dafd878415bf576e2732555
YELP EVENT API METHODS
[ { "docid": "1935eed04c27edd1949df3e97670bde8", "score": "0.0", "text": "def submit_events_api_call(date, begin_time, end_time, location, itinerary)\n preferences_request = current_user.supplemental_preferences\n designated_preference = preferences_request.sample\n category_request = designated_...
[ { "docid": "ff1cb32628977acc28cd1a7e6b85541e", "score": "0.78358495", "text": "def events; end", "title": "" }, { "docid": "ff1cb32628977acc28cd1a7e6b85541e", "score": "0.78358495", "text": "def events; end", "title": "" }, { "docid": "ff1cb32628977acc28cd1a7e6b85541e", ...
ae3fd8be2efa5caf13e5b2aeb19e11d1
Updates all the sprites in the collection
[ { "docid": "0ab188258da34769d9e9a279ccaa6afd", "score": "0.86013955", "text": "def update\n @sprites.each_value do |list|\n list.each {|x| x.update}\n list.reject!{|x| x.die?} # delete all doomed sprites\n end\n end", "title": "" } ]
[ { "docid": "cb674390ea5a450834b4a80055df84d9", "score": "0.73587453", "text": "def update_icon_scroll_sprites\n return unless @iconscroll_sprites\n @iconscroll_sprites.values.each {|sprite| \n sprite.update # Update each sprite\n # Match the opacity of the rest of the contents\n spr...
16144c097877f369b6644cbbdb469d91
POST /shareds POST /shareds.json
[ { "docid": "475589af6a38b3ab168d06ba1d8345ff", "score": "0.71797734", "text": "def create\n @shared = Shared.new(shared_params)\n\n respond_to do |format|\n if @shared.save\n format.html { redirect_to @shared, notice: 'Shared was successfully created.' }\n format.json { render :...
[ { "docid": "c5a71bff57519f8d88e0220a429f670a", "score": "0.6456203", "text": "def shared_params\n params.require(:shared).permit(:via, :body, :checked, :user_id, :post_id)\n end", "title": "" }, { "docid": "117264cac6d2f1037a7f99e2c2ecdf7b", "score": "0.6375645", "text": "def...
3642b4915506595601974163b6464f88
GET /search_engines GET /search_engines.json
[ { "docid": "a094dfb7dbd615a693513287b2080ed0", "score": "0.6546428", "text": "def index\n @search_engines = SearchEngine.order(:position)\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "title": "" } ]
[ { "docid": "bc10b8833825fd7395b93d1c7d98866b", "score": "0.7259822", "text": "def search_engines\n @search_engines || {}\n end", "title": "" }, { "docid": "5a33dea57c74f6cc5dcfe8c8c1d1fa44", "score": "0.67584044", "text": "def index\n @engines = Engine.all\n\n rende...
4d5c364f614e459ddcf6217c47655974
Sets the value of the `level` attribute.
[ { "docid": "56bed2b9b06f6e1f1bfd2a84d80f0489", "score": "0.8658045", "text": "def level=(value)\n @level = value\n end", "title": "" } ]
[ { "docid": "6bde7ba4324fb2d4fb7469f4b526a1c2", "score": "0.8868737", "text": "def set_level(level)\n @level = level\n end", "title": "" }, { "docid": "275aadc3a151ffd79bcb949f15e5f80c", "score": "0.8861044", "text": "def level=(value)\n set :level, value\n end", ...
555fbd8cff53cbbc5ce3a6fa10cee7c5
== Parameters: point: Coordinates of the point value: Function value at the point
[ { "docid": "6b5e290d64537937644eda16ba6a4dd2", "score": "0.0", "text": "def initialize(point, value)\n @point = point.clone\n @value = value\n end", "title": "" } ]
[ { "docid": "336e64ffd6790243d579f03fd0f0d77c", "score": "0.62752974", "text": "def reflect(center, point, alpha=1.0)\n #center.map.with_index{|e,i| e + alpha * ( e - point[i] )} # version for simple arrays\n p = center + ( center - point ) * alpha\n p.result = func(p)\n p\n end", ...
1c8325a6c7f99d0410704ea9da809154
For removed, the default action is to call changed for it
[ { "docid": "d75bf7a43a0dd1d3eb72d233cdd169bb", "score": "0.54280585", "text": "def removed(attribute_name)\n changed(attribute_name)\n end", "title": "" } ]
[ { "docid": "5a4607fc8aac63633476c3826fdcf3dd", "score": "0.6822201", "text": "def change!\n @_changed = true\n unsend!\n self\n end", "title": "" }, { "docid": "ce83dd3e9cefd7d78c8688bd405fa73a", "score": "0.65439916", "text": "def reset_change!\n @_changed = false\n ...
59fc48753778d073d3334a8f154aa3f3
Escapes the given string to be used as a column.
[ { "docid": "0c0b583a4587e60c7b7227f98152732d", "score": "0.7265569", "text": "def esc_col(str)\r\n self.conn_exec do |driver|\r\n return driver.esc_col(str)\r\n end\r\n end", "title": "" } ]
[ { "docid": "c17b296b1444caca144c48c2323440ed", "score": "0.74983966", "text": "def escape_str_field(str)\n str = str.to_s.sub(/\\`/,'')\n @mysql.escape(str)\n end", "title": "" }, { "docid": "5c0d6c39fda5a269eb7f040cc6807e69", "score": "0.7451154", "text": "def escape(st...
92f30e9d09c3a9252573cdfca72c0269
GET /redirects GET /redirects.json
[ { "docid": "f542c71c19bb6b5338eaef7f43d681e8", "score": "0.7210948", "text": "def index\n @redirects = Redirect.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @redirects }\n end\n end", "title": "" } ]
[ { "docid": "cee43fdba74fc85898ef1708bf9c42a9", "score": "0.6946459", "text": "def index\n @redirects = Redirect.all\n end", "title": "" }, { "docid": "84dc038e7d3ce8125828e5b2c85b7cea", "score": "0.6907413", "text": "def json_redirect(url)\n render json: { status: 'redirect', ...
43d5b1845840517f319dc15e56743c99
This is a duplication of a patient validation that won't work if using nested attributes. Don't like doing this.
[ { "docid": "968fe41aae64f9250d59a282afe8948e", "score": "0.0", "text": "def patient_diagnosis_date_is_after_dob\n\t\tif !patient.nil? && !patient.diagnosis_date.blank? && \n\t\t\t\t!dob.blank? && patient.diagnosis_date < dob\n\t\t\terrors.add('patient:diagnosis_date', \"Diagnosis date is before study_su...
[ { "docid": "480b22db1705235e948a3b66103022eb", "score": "0.6471876", "text": "def test_valid_with_attributes\r\n patient = Patient.new\r\n patient.first_name = @patient.first_name\r\n patient.last_name = @patient.last_name\r\n patient.dob = @patient.dob\r\n patient.ssn = @patient.ssn\r\n ...
b4ac36873c993b9d0b831a0ebeb226df
Filter all of the provisioners of the given vagrant environment with the given name
[ { "docid": "05e3248f44e7875d3d0b6869be7a175d", "score": "0.7648902", "text": "def provisioners(name, env)\n config_global = env.respond_to?(:config_global) ? env.config_global : env[:global_config]\n \n config_global.vm.provisioners.select { |prov| prov.name == name }\n end", ...
[ { "docid": "f4c29fa641e6a2cedf480f12d7e3d5e1", "score": "0.75963783", "text": "def provisioners(name, env)\n env[:machine].config.vm.provisioners.select { |prov| prov.name == name }\n end", "title": "" }, { "docid": "f4c29fa641e6a2cedf480f12d7e3d5e1", "score": "0.75963783", ...
24b61727fe513e062da9481aad34803e
GET /pos_comments GET /pos_comments.json
[ { "docid": "71182d496b37e818257aef7a04f079a6", "score": "0.70186985", "text": "def index\n @pos_comments = PosComment.all\n end", "title": "" } ]
[ { "docid": "934b852e3aa55b01ef52fac23c4b87b5", "score": "0.7145548", "text": "def get_comments\n url = params[:ifq_url]\n \n comments_id = get_comments_id(url) \n unparsed_comments = get_unparsed_comments(comments_id)\n comments = parse_comments(unparsed_comments)\n respond_to do |f...
988d4b31ac7d76fadb8e030331eb94fe
quite nasty scans both collections. some day I should build a lookup abstraction which could be optimized against storage TODO make some tests...
[ { "docid": "36c58025042adc9780dc6a4b76ac2e4b", "score": "0.0", "text": "def from(other_collection, join_condition, columns, prefix = 'other_')\n other_index = {}\n other_collection.pick(join_condition.values).each_with_index do |row, i|\n other_index[row.values] = row\n end\n ...
[ { "docid": "5930761249ad935482b7956d18120e62", "score": "0.62137806", "text": "def lookups; end", "title": "" }, { "docid": "d893b690b2e353a82ef5e7312b0a1ed7", "score": "0.61267155", "text": "def findUnion(set1, set2)\n #clone() must be used otherwise set3 will point to the same m...
7d4dd0cccd27f52b7cb5d6903108b0b3
Creates a sample sheet in tmp/sample_sheets for the given form (object) and language name. Returns the full filepath, but without the file extension. Does not recreate existing files.
[ { "docid": "c28562d648db8af4ee5bef8c13e87cbd", "score": "0.7091392", "text": "def make_sample_sheet(form, lang)\n # this is hardcoded throughout the project\n dir = \"tmp/sample_sheets/\"\n FileUtils.makedirs(dir)\n filename = \"#{dir}sample_#{form.id}#{lang.to_s.empty? ? \"\" : \"_#{lang}\"}\"\n\n ...
[ { "docid": "d7e28889f16b541f3e374e6af7ac8e0f", "score": "0.56497", "text": "def create\n @worksheet = Worksheet.new(worksheet_params)\n unless @worksheet.sheet.path\n flash[:error] = 'You Must Supply a file'\n render :action => \"new\"\n return\n end\n if @worksheet.save\n ...
5f849252168ee0a7da3361787ba69f69
a board can be passed in to allow manual control for testing
[ { "docid": "be3b91d4a7c4fdf3dbcc38e22c387545", "score": "0.0", "text": "def initialize(width, height, board = nil)\n @width = width\n @height = height\n\n if board.nil?\n @board = []\n\n height.times do\n row = []\n width.times do\n row << random_integer\n ...
[ { "docid": "f159c01278ecbbf1f975ebad26579ed4", "score": "0.76906556", "text": "def board\n end", "title": "" }, { "docid": "458a08a02bae544ea337bc7f61f14dce", "score": "0.7628834", "text": "def board\n\n end", "title": "" }, { "docid": "458a08a02bae544ea337bc7f61f14dce"...
54d55b7ba665583bd5e9e8179f6d4a6c
Render a form to edit a given task
[ { "docid": "2744da218253160a38e20cfe67d9efa1", "score": "0.0", "text": "def edit\n @users = User.accessible_by(current_ability).all\n @departments = Department.accessible_by(current_ability).all\n end", "title": "" } ]
[ { "docid": "a310ccb34e75ee06df177ebdba5d319a", "score": "0.81841147", "text": "def edit\n #Tasks will be set each time we have an edit. Since form is set based on @tasks, the form will be different each time. \n @task = Task.find params[:id]\n end", "title": "" }, { "docid": "bab6ce17...
afa5b739427e31c70b86fe61a7d9f1f1
Default implementation for the Root configuration objects. Any validation rules should be defined in validate_fields() that will be automatically called on all the nested configuration objects. This method is only called for the plugin top level configuration object.
[ { "docid": "eb25ee5ef448f9a5534da0b5357adc95", "score": "0.0", "text": "def validate(machine)\n errors = _detected_errors\n\n validate_fields(errors, machine)\n\n { 'vSphere Provider' => errors }\n end", "title": "" } ]
[ { "docid": "99a2dfac5d16286a5d0c878f1a9aa6b3", "score": "0.6253947", "text": "def configure(root_config)\r\n super(root_config)\r\n end", "title": "" }, { "docid": "99a2dfac5d16286a5d0c878f1a9aa6b3", "score": "0.6253947", "text": "def configure(root_config)\r\n sup...
533effb5dfc68225f83806da685b5c43
i. Given an array of integers between 1 and 1,000,000. One integer is in the array twice. Find the duplicate. ii. Find the first nonrepeating character in a string:("DEFD" > E ) iii. A standard deck of 52 cards is represented in an array. Each card is represented as an integer. Write a method to shuffle the cards.
[ { "docid": "2f42a42f95c7d2f06c040797fdec79e9", "score": "0.0", "text": "def duplicate(array)\n if array.uniq.length == array.length\n return \"array doesn't have any duplicates homey\"\n else\n arycpy = array\n while arycpy != nil do \n y = arycpy.pop\n if arycpy.include? y\n ...
[ { "docid": "9ee0f24401dc083414f43cc2161e29c4", "score": "0.6790248", "text": "def shuffle\r\n @deck_of_cards.shuffle!\r\n end", "title": "" }, { "docid": "d82680979ee72dd7730820f2caafe124", "score": "0.6726599", "text": "def shuffle(cards)\n shuffled = []\n\n while (cards.any?)...
c58e0c8827e5a765e08397b8d5265fcc
GET /expenses GET /expenses.json
[ { "docid": "6d95f131e793b5b2143e179c0c5d6b9e", "score": "0.6937268", "text": "def index\n set_expense_list_path(expenses_path)\n respond_to do |format|\n format.html { render template: 'expenses/index.html.erb', locals: { title: 'Listing Expenses', jason_url: expenses_url(format: \"json\")} }...
[ { "docid": "b6f455b68a6369a701b0729e38c67dff", "score": "0.7868928", "text": "def index\n @expenses = Expense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end", "title": "" }, { "docid": "c7bd3b0d51d666c1c3...
0b43b592b346cda266f80197ee4229f5
Write a function that merges two sorted arrays into a single one. The arrays only contain integers. Also, the final outcome must be sorted and not have any duplicate. Kata Link: Discuss Link: Solutions Link:
[ { "docid": "eda632cfe7880bc37269a638f4f68116", "score": "0.0", "text": "def greet\n return \"hello world!\"\nend", "title": "" } ]
[ { "docid": "d3e2ef99240202c8133cbdb2a437c94e", "score": "0.7890985", "text": "def merge(arr1, arr2)\n #check if there are any non numbers in either array\n return nil if !(arr1.all? { |num| num.is_a? Numeric })\n return nil if !(arr2.all? { |num| num.is_a? Numeric })\n\n # set up a results array...
43b1fbb4abe931d991b03f1884787fbb
Internal support for dispatch on other methods
[ { "docid": "77211328160f3434817482f8de838a39", "score": "0.0", "text": "def list_item\n self.name\n end", "title": "" } ]
[ { "docid": "3c9fe7816cbcdddf1ce5060e94c1d5b8", "score": "0.8221347", "text": "def dispatch; end", "title": "" }, { "docid": "3c9fe7816cbcdddf1ce5060e94c1d5b8", "score": "0.8221347", "text": "def dispatch; end", "title": "" }, { "docid": "68bc0bfd28b47ce0da497a1979c22480",...
4b532627240bdfbb117527f3abd9fb86
CACHING METHODS helper method to invalidate any matching frontend caches when parsing/deleting a study_file
[ { "docid": "3d73a7fa6b857b89cb1e6522e8660085", "score": "0.64473945", "text": "def invalidate_cache_by_file_type\n cache_key = self.cache_removal_key\n unless cache_key.nil?\n # clear matching caches in background\n CacheRemovalJob.new(cache_key).delay.perform\n end\n end", "titl...
[ { "docid": "08358e25d8737b0f8ce6d0ccdbd1559d", "score": "0.75605685", "text": "def cache_removal_key\n study_name = self.study.url_safe_name\n case self.file_type\n when 'Cluster'\n name_key = self.cluster_groups.first.name.split.join('-')\n @cache_key = \"#{study_name}.*render_...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "b91b3ee77b21ffaa1e894e3936e53091", "score": "0.0", "text": "def set_credit_type\n @credit_type = CreditType.find(params[:id].to_i)\n @abs_credit_type = JSON.parse(Redis.current.get(\"credit_purposes\")).select{|x| x[\"ID\"]==@credit_type.type_id}.first\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;...
5ff179412069b9879939f5b39aebc439
POST /messages POST /messages.json
[ { "docid": "69dbcdc12dedb2ff4a3b7f0a1cfce01b", "score": "0.0", "text": "def create\n @message = Message.new(params[:message])\n @message.group_id = session[:group_id]\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, :notice => 'Message was successf...
[ { "docid": "c31738c4d3e8abb88223bb78078be929", "score": "0.76773125", "text": "def post_messages(options={})\n post(\"1/messages\", options)\n end", "title": "" }, { "docid": "f0e30f164be0ab5b3abd6b7675410795", "score": "0.749269", "text": "def message(message)\n pos...
a26a293b8682b4fcc224e6de25f9528b
get file type file types: "chardev" "blockdev" "symlink" ..
[ { "docid": "e775e607ec3cb199ad9b8455f898c964", "score": "0.7442694", "text": "def type(path)\n case (t=File.ftype(get(path)))\n when \"characterSpecial\"\n \"chardev\"\n when \"blockSpecial\"\n \"blockdev\"\n when \"link\"\n \"symlink\"\n els...
[ { "docid": "77b9060be3f8772c8ce3f5faad3d6405", "score": "0.7487605", "text": "def fstype_from_file_magic(dev)\n return 'ext4' unless File.exists?(dev)\n dev_type_str = `file -s '#{dev}'`\n case\n when dev_type_str =~ /SGI XFS/ then 'xfs'\n when dev_type_str =~ /Linux.*ext2/ ...
cb6ada55ca5371d92e7d13b8289e5bc0
Allow field names to be used as methods for filtering: stat.yearID(2012) stat.yearID(2012, 2013)
[ { "docid": "e87662c52f1f33f70a596acb81fccde8", "score": "0.0", "text": "def method_missing(symbol, *args, &blk)\n key = find_actual_key(@keys, symbol)\n\n if @keys.include?(key) && args.length > 0\n filter{|obj| args.include?(obj[key])}\n else\n super\n end\n end", "title": ""...
[ { "docid": "0f5685693d7ec47aba9a0b37dd028204", "score": "0.6209507", "text": "def by_year(query)\n apply_filter_list \"years\", query\n\n self\n end", "title": "" }, { "docid": "b96b6859ec0453d7481a6047a8f75f32", "score": "0.5998493", "text": "def all_year; end", "title": ...
5ae8223cac69171466e8ab58fbe75a32
GET /quizes GET /quizes.json
[ { "docid": "8198d889cb797b29419fb01b8216ad20", "score": "0.705258", "text": "def index\n @quizes = Quize.all\n end", "title": "" } ]
[ { "docid": "59af6bc41da4fb9f2654d74f96afcc06", "score": "0.62277573", "text": "def get_sizes\n @item = Item.find(params[:id])\n @sizes = @item.variants_for(:size, nil, params[:colour])\n respond_to do |format|\n format.json { render :json => @sizes }\n end\n end", "title": "" }, ...
a5ceebe2f735d77e1884d9bfcf01f174
POST /m_countries POST /m_countries.json
[ { "docid": "e6ce3e3e6213a1c6e73096ad98f208e2", "score": "0.6652913", "text": "def create\n @m_country = MCountry.new(m_country_params)\n\n respond_to do |format|\n if @m_country.save\n format.html { redirect_to @m_country, notice: 'M country was successfully created.' }\n format...
[ { "docid": "c8c6e186bfb9cb183b2c6493eeeee156", "score": "0.7342191", "text": "def create\n countries = Country.create(country_params)\n render json: countries, status: :created\n \n end", "title": "" }, { "docid": "0cafd5df77b1d93b8a4378eec10c56bc", "score": "0.723102...
a196ef316bdcb3f6901c1c460ab83e6f
GET /cred_cards/1 GET /cred_cards/1.json
[ { "docid": "b6b5f96a8f71180473a11f7ede934193", "score": "0.0", "text": "def show\n if params[:modal] == 'true'\n @modal = true\n render :show, layout: false\n end\n end", "title": "" } ]
[ { "docid": "c768f0df8e5acf0170b8deb220759bea", "score": "0.737777", "text": "def get_cards\n render_json_success(cards: Card.where(user_uuid: @session.user_uuid))\n end", "title": "" }, { "docid": "248e7ae50bc042acdd46fdf596239265", "score": "0.7208536", "text": "def getCard(card...
591f3231bfa5bccb7da3c279ffffba4e
Time Complexity: O(n) Space Complexity: O(n)
[ { "docid": "4733aba6ff5fa611a5e2c2bb35312106", "score": "0.0", "text": "def postorder\n return postorder_helper(@root, [])\n end", "title": "" } ]
[ { "docid": "5944c445a0d5d1383cd670cc84d3fc3b", "score": "0.6914348", "text": "def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend", "title": "" }, { "docid": "2481cbf165330db256eee896a32c82e4", "score": "0...
98a911d7724744982a54f01ce8b04ad0
DELETE /empleadors/1 DELETE /empleadors/1.json
[ { "docid": "95d120d652bc0f1b3bc8ecf71075ef00", "score": "0.67054766", "text": "def destroy\n @empleador.destroy\n respond_to do |format|\n format.html { redirect_to empleadors_url, notice: 'Empleador was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", ...
[ { "docid": "4cf05e9783c8dd1abd9a32e239649f97", "score": "0.71631145", "text": "def destroy\n @empleadot.destroy\n respond_to do |format|\n format.html { redirect_to empleadots_url, notice: 'Empleadot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", ...
4ecf66739f94cc728fa0b11720be9e62
Create a vapp starting from a template Params: vdc: the associated VDC vapp_name: name of the target vapp vapp_description: description of the target vapp vapp_templateid: ID of the vapp template
[ { "docid": "57135211c485a622ed3a1ec91d3d046c", "score": "0.8542085", "text": "def create_vapp_from_template(vdc, vapp_name, vapp_description, vapp_templateid, poweron=false)\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.InstantiateVAppTemplateParams(\n \"xmlns\" => \...
[ { "docid": "1cc87d282f3424a3a3291169aee9f981", "score": "0.8502716", "text": "def create_vapp_from_template(vdc, vapp_name, vapp_description, vapp_templateid, poweron=false)\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.InstantiateVAppTemplateParams(\n \"xmlns\" => \"http://www....
91491af3e9bc7510c50a33c43f2c3fd8
POST /nightclubs POST /nightclubs.json
[ { "docid": "fb0e9c9146eac3a4d000e26395740ce1", "score": "0.7862618", "text": "def create\n @nightclub = Nightclub.new(nightclub_params)\n\n respond_to do |format|\n if @nightclub.save\n format.html { redirect_to @nightclub, notice: 'Nightclub was successfully created.' }\n forma...
[ { "docid": "3e4209d514d27368c8bea396f5407214", "score": "0.80317783", "text": "def create\n @nightclub = Nightclub.new(params[:nightclub])\n\n respond_to do |format|\n if @nightclub.save\n format.html { redirect_to @nightclub, notice: 'Nightclub was successfully created.' }\n fo...
7300636eab435bc349583add8ef54fe1
Complete the 'pageCount' function below. The function is expected to return an INTEGER. The function accepts following parameters: 1. INTEGER n 2. INTEGER p
[ { "docid": "4389f9bdbecfc0c7a3455c586ed24803", "score": "0.821523", "text": "def pageCount(n, p)\n from_front = p / 2\n from_back = ((n.odd? ? n : n + 1) - p) / 2\n [from_front, from_back].min\nend", "title": "" } ]
[ { "docid": "b9284f431bad2922d59a4061117f799d", "score": "0.7753729", "text": "def page_count(input)\n info = info(input)\n return nil if info.nil?\n info['Pages'].to_i\n end", "title": "" }, { "docid": "27f29de0d7dd3e8300eca87add525e33", "score": "0.7729977", "text": "def p...
fd3b7903f3159b28c7f12ab05872999f
Returns +Player+ ids who are members of this +Alliance+.
[ { "docid": "8d4bba42083f9b51b52108231fa2317d", "score": "0.76305306", "text": "def member_ids\n self.class.player_ids_for([id])\n end", "title": "" } ]
[ { "docid": "b1e0ed7018713bce612615c8c267b10d", "score": "0.7308908", "text": "def players\n gp = Player.where :instance_id => self.id\n gp.map { |p| p.user_id }\n end", "title": "" }, { "docid": "824853f297729209453594061f2d13e1", "score": "0.6973204", "text": "def player_ids\...
07ecbc408704747b70657567d1a7989c
Creates the node in UpGuard
[ { "docid": "3593942aa2cd12416309c58a12404091", "score": "0.6998263", "text": "def upguard_node_create(api_key, instance, ip_hostname, os)\n domain_details = determine_domain_details(ip_hostname, os)\n Puppet.info(\"#{log_prefix} node_create ip_hostname=#{ip_hostname}\")\n Puppet.info(\"#{log_pr...
[ { "docid": "f1582cd2046944d960ce4f76fd4d1fdc", "score": "0.7450424", "text": "def create_node\n @neo.createNode\n end", "title": "" }, { "docid": "55c89a7084ccd244e20ed3ac8fb130c6", "score": "0.70197564", "text": "def create!\n FileUtils.mkdir(self.path)\n self.node...
95bcbebbd0157da21bff463810bf4751
PATCH/PUT /part_positions/1 PATCH/PUT /part_positions/1.json
[ { "docid": "8754d4d432ed2fe02df2fcedea0d0f83", "score": "0.70626193", "text": "def update\n respond_to do |format|\n if @part_position.update(part_position_params)\n format.html { redirect_to @part_position, notice: 'Part position was successfully updated.' }\n format.json { render...
[ { "docid": "cc466eb4bd6063716b01b8955762d58e", "score": "0.65249866", "text": "def update\n @part = @product.parts.find(params[:id])\n\n respond_to do |format|\n if @part.update_attributes(params[:part])\n format.html { redirect_to [@product,@part], notice: 'Part was successfully updat...
f0affc6d1dc1210247adaa45724ec7b5
method initializes instance variables
[ { "docid": "f60f74455d859f1540749cc3a8c04215", "score": "0.0", "text": "def initialize(id, products, customer, fulfillment_status = :pending)\n @id = id\n if products.keys == {}\n @products = 0\n end\n @products = products\n @customer = customer\n if fu...
[ { "docid": "5cf2cba0ee7f9825b63b087af5363b37", "score": "0.82330126", "text": "def init; end", "title": "" }, { "docid": "5cf2cba0ee7f9825b63b087af5363b37", "score": "0.82330126", "text": "def init; end", "title": "" }, { "docid": "5cf2cba0ee7f9825b63b087af5363b37", "...
aaf04c3b79a393097d893dbe15f09902
Returns the WorkItem describing the last ingested version of this object.
[ { "docid": "79643727f15a28b3546e493e106b6f27", "score": "0.82791793", "text": "def last_ingested_version\n WorkItem.last_ingested_version(self.identifier)\n end", "title": "" } ]
[ { "docid": "27845c2e683504c1e9d9acbbf6fe5aa2", "score": "0.67208356", "text": "def last_version\n object.versions.last\n end", "title": "" }, { "docid": "bb89b62841f8a4192265d9d89a1544ec", "score": "0.67051727", "text": "def most_recent_work\n Work.find(recent_work_id)\n end"...
e7274a404f961cd047f24ec694c946b6
PATCH/PUT /jobs/1 PATCH/PUT /jobs/1.json
[ { "docid": "9383e1007c5f656383ba28eee9d1f3c8", "score": "0.0", "text": "def update\n\n tp = job_params\n tp[:tags_id] = job_params[:tags_id].slice(1,job_params[:tags_id].length).join(\",\")\n tp[:employers_id] = session[:user_id]\n\n\n respond_to do |format|\n if @job.update(tp)\n ...
[ { "docid": "bb1acb04a7a42a40db9b7b0e4aa3f572", "score": "0.72656006", "text": "def update\n @job = Job.find(params[:id])\n\n if @job.update(job_params)\n head :no_content\n else\n render json: @job.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "d...
13c37544d4cbcaa64640bd9ac5b485db
may need to adapt the ldap attributes to the Investigator data model
[ { "docid": "6ff37790ec006e81b1bec94563efa147", "score": "0.0", "text": "def BuildPIobject(pi_data)\n if pi_data.blank?\n puts \"BuildPIobject: this shouldn't happen - pi_data was nil or blank\" \n thePI = Investigator.new\n return thePI\n end\n thePI = Investigator.find_by_username(pi_data.u...
[ { "docid": "5bcb10482a3e88ed26c5565fcdba503a", "score": "0.62028354", "text": "def associate\n associate_data = {}\n associate_data[:associate_id] = associate_id.upcase\n\n ldap.search(base: ENV['BASE'], filter: filter_by_employee_id,\n return_result: true) do |entry|\n entry...
9ab1d11c9e3110b4d1ea355098b11157
build a nested block depending on the wrappers enabled
[ { "docid": "9fdb14bb9d39cf10567805f5bf8f7ad2", "score": "0.0", "text": "def build_wrapped_handler(wrappers)\n wrappers.inject do |inner, outer|\n proc do |event:, context:|\n outer.call(event: event, context: context, &inner)\n end\n end\n end", "title...
[ { "docid": "edd4b105a06f76a72191872de9768a79", "score": "0.6894833", "text": "def build_basic_blocks; end", "title": "" }, { "docid": "18d5be344475378f9dfa1e0886785951", "score": "0.66767424", "text": "def wrap_for_nesting(source); end", "title": "" }, { "docid": "18d5be3...
ce576d5cc3da53961aff1c370a632754
POST /customers POST /customers.json
[ { "docid": "e85702c5436026ae5b8e29ad92448eff", "score": "0.0", "text": "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n PersonMailer.account_activation(@customer.person).deliver_now\n Invoice.create(:payment_id => @customer...
[ { "docid": "238da214b7aaf17b49205491ac2f4e10", "score": "0.75873667", "text": "def create\n @customer = @client.customers.create(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n ...
db430f8be5e560923b761b00f26c39de
Just like time_element, but relative to now.
[ { "docid": "e10f8fa12162b328533a6d505926957f", "score": "0.7525427", "text": "def relative_time_element(time)\n time_element(time, 'js-relative-time')\n end", "title": "" } ]
[ { "docid": "aa9782ddb1ad165406156eeff7fae003", "score": "0.66322315", "text": "def at(*args) = Time.at(*args, in: self)", "title": "" }, { "docid": "51cb5d141b13fec769330d22c88b5599", "score": "0.66145813", "text": "def since(time = ::Time.now)\n time + self\n end", "title": ...
dc5f0633e4b46b51104c97e5bde058a1
Get a string for the date / time as it should be displayed
[ { "docid": "2233f48aef65e40314e26d1de54a293f", "score": "0.0", "text": "def listing_date() self.created_at.strftime('%a %b %d, %Y') end", "title": "" } ]
[ { "docid": "1e834cff81fc3b28b4aa53af8c667084", "score": "0.80145776", "text": "def show_in_strftime\n @date.strftime(\"%d/%m/%Y -- %H:%M\")\n end", "title": "" }, { "docid": "3c7259736e6a71508f2533f9858ec656", "score": "0.787894", "text": "def display_datetime(time)\n time.str...
6a891ec3c5152047bf3c38b9f73b44e6
this says even if you're not signed in, you can still see new user page
[ { "docid": "478a18059b084ff73d9407b3780eacd9", "score": "0.0", "text": "def index\n @friends = current_user.friends\n @nonfriends = User.all - @friends\n end", "title": "" } ]
[ { "docid": "538d4e9674ca467b823414c45ff6f95b", "score": "0.73337007", "text": "def in_new\n \tif session[:user_id] == nil\n \t\t@user = User.new\n \telse\n \t\tflash[:error] = \"Already Logged In\"\n \t\t#session[:return_to] ||= request.referer\n \t\t#redirect_to session.delete(:return_to)\n \t\t...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "23306d107f59202eda67362bfab9ed74", "score": "0.0", "text": "def set_user\n @user = User.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...
2f381d966b246ea33baf7db3df63fdb9
Complete this inflight execution. This method must be called exactly once on the result of any call to +run!+. Where possible, prefer +wrap+.
[ { "docid": "c3bf25947d8b5bcdfefc6bcdefd0b9ed", "score": "0.5516539", "text": "def complete!\n complete\n ensure\n IsolatedExecutionState.delete(self.class.active_key)\n end", "title": "" } ]
[ { "docid": "d20eaff8839f808dca76c902dfb08e7a", "score": "0.64883184", "text": "def wrapup # :nodoc:\n log \"Finishing\"\n end", "title": "" }, { "docid": "70373cf5d3a03397db3e8e14494561d9", "score": "0.6140564", "text": "def run\n start\n trace\n wrapup\n en...
975675a5507b150b3d4ae3434ff40af0
Retrieve a single page of DomainInstance records from the API. Request is executed immediately.
[ { "docid": "2ed1503ff488b5ae1ac2161d4e519b0e", "score": "0.0", "text": "def get_page(target_url)\n response = @version.domain.request(\n 'GET',\n target_url\n )\n DomainPage.new(@versio...
[ { "docid": "c2c4e9797e33c5433d595b5c287bdc6f", "score": "0.63931555", "text": "def index\n page = params[:page]\n per_page = (params[:per_page] || 10).to_i\n if page\n entities = _all_instances_query.page(page).per(per_page)\n render json: entities, entity: _get_class,\n meta: { ...
2671df83c7553499bcb6ab0cba69149e
Generate the seeds of the permissions.
[ { "docid": "38443bcf0eaa127d58ca55380a9fcc60", "score": "0.7224367", "text": "def generate_seeds\n respond_to do |format|\n if system('rake db:seed:dump MODELS=Permission FILE=db/seeds/permissions.seeds.rb') &&\n system('rake db:seed:dump MODELS=PermissionRole FILE=db/seeds/roles_permis...
[ { "docid": "6566afc7681578a08f40f4ba4ee3fdbd", "score": "0.6420878", "text": "def insert_roles_and_permissions_permissions\n create_permission(6, 'CanEditAllRoles')\n create_permission(7, 'CanEditAllPermissions')\n add_permission_to_super_admin(6)\n add_permission_to_super_admin(7)\nend", "title...
a8a0d56650d22d8c668216806fc24f05
Clicks the Permissions button in the page header (below the Header bar, though), clicks "Add Content", then waits for the Add Content stuff to load, then includes the AddContentContainer module in the object's Class.
[ { "docid": "ebf1a2ab9a985c1c99c8a474299d1cfd", "score": "0.8486896", "text": "def add_content\n self.button(:id=>\"entity_group_permissions\").click\n self.button(:text=>\"Add content\").click\n self.wait_until { self.text.include? \"Collected items\" }\n self.class.class_eval { include AddC...
[ { "docid": "ae5aa69cec609382faa0a3ba2696f9d8", "score": "0.73282427", "text": "def add_content\n self.link(:id=>\"navigation_create_and_add_link\").fire_event(\"onmouseover\")\n self.link(:text=>\"Add content\").click\n self.wait_until { @browser.text.include? \"Collected items\" }\n self.cl...
b68c4030c00ba7cc33fd8926ebc3c243
Exchange an Authorized RequestToken for a working user object === Required Field request_token The Request token created using get_request_token and authorized on Agree2 by your user Example:
[ { "docid": "998ccd945649e1cee798b6783fe65c8f", "score": "0.75987333", "text": "def user_from_request_token(request_token)\n access_token=request_token.get_access_token\n user(access_token.token,access_token.secret)\n rescue Net::HTTPServerException=>e\n if e.response.code=='401'\n ...
[ { "docid": "c0637e3010d198fcf04a018cbdc90cd6", "score": "0.6935607", "text": "def get_request_token( save_user=false ) \n raise AuthenticationError, \"User object required for request_token requests\" unless user \n @request_token = oauth_gateway.get_request_token\n set_token_in_user( req...
71752f9b9dd5ad20df83809b00b3fb44
Sends user a reminder if current_date is equal to the reminder date of the bet
[ { "docid": "251146f385f57ca03fd29762776b5386", "score": "0.7536074", "text": "def check_bet(bet)\n \tcurrent_date = Time.now.strftime(\"%Y-%m-%d\").to_s\n #@bets = Bet.all\n #@bets.each do |bet|\n BetMailer.bet_reminder(bet).deliver and bet.sent = true and bet.save! if bet.reminder.to_s == cur...
[ { "docid": "675023fe4eef61e13db957adcaa8bc66", "score": "0.6587487", "text": "def pledge_reminder(user, payment, is_today = false)\n return unless user.receive_notification\n @user = user\n @payment = payment\n @is_today = is_today\n mail to: @user.email, subject: \"Your pledge to #{payme...
6d93e6d5d3864a0cf3e31eb0ef675f3d
IP address String conversion
[ { "docid": "43d1979a7bcf12534df72ca0697b51bc", "score": "0.6754088", "text": "def str2ipaddr(str, delim = '.')\n ipaddr = 0\n str.split(delim).each {|o| ipaddr *= 256; ipaddr += o.to_i}\n\n return ipaddr\nend", "title": "" } ]
[ { "docid": "37675d76f63459aad27e82e7206a81fd", "score": "0.77952385", "text": "def to_ipaddr\n unless ip_addr?\n lookup = `host #{to_s} | grep address`.split(/\\s+/)\n return to_s unless lookup.length == 4\n lookup[3]\n else \n to_s\n end\...
929a73e3b51bf404aeae22271d5960a7
You may (and should) use the substrings_at_start method you wrote in the previous exercise: input string ouput array that contains all substrings of input string Create an empty new array Iterate over two structures to get subarrays
[ { "docid": "508f283403db35c02e93d3132b46c9e3", "score": "0.79460174", "text": "def substrings_at_start(string)\n \n new_array = []\n 1.upto(string.size) do |idx|\n new_array << string.slice(0, idx)\n end\n new_array\nend", "title": "" } ]
[ { "docid": "16982f5e82453f91e14d925e4e0adb1f", "score": "0.82492477", "text": "def substrings(str)\n arr_out = []\n str.length.times {|i|\n arr_out << substrings_at_start(str[i..(-1)])\n }\n arr_out.flatten\nend", "title": "" }, { "docid": "70515a785a437015787ebce8b02861bf", "scor...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "b38dbf0feb42ea2f283d01cec9da8fb0", "score": "0.0", "text": "def set_departamento\n @departamento = Departamento.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...
1387faa5ef90a6c03e45a90c99a00bf9
find_appointment appointments is the collection of appointments slot is the slot we want to know is booked or not returns appointment if it can be found, nil if not
[ { "docid": "9c374ca891da67eaf45f5923ad62a9d6", "score": "0.8061734", "text": "def find_appointment(appointments, slot)\n appointments.find { |appointment| appointment.include_slot_number?(slot) }\n end", "title": "" } ]
[ { "docid": "5aa236b2c776e3ba07a77a3ae203bae6", "score": "0.67124474", "text": "def appointment_by_status(appointments)\n if params[:booked] == 'true'\n appointments.booked\n else\n appointments.free\n end\n end", "title": "" }, { "docid": "ad562207f1963293650f56c0b1e5731a...
27a8e6fdc247b829053d532726b6b394
PATCH/PUT /customersps/1 PATCH/PUT /customersps/1.json
[ { "docid": "d1ea98ededd6a95197138e8c5fba44a0", "score": "0.70529956", "text": "def update\n respond_to do |format|\n if @customersp.update(customersp_params)\n format.html { redirect_to @customersp, notice: 'Customersp was successfully updated.' }\n format.json { render :show, stat...
[ { "docid": "d47c0dfbe30eee39fa478a7ba4c4aedd", "score": "0.6688146", "text": "def update\n respond_to do |format|\n if @s_customer.update(s_customer_params)\n format.html { redirect_to @s_customer, notice: 'S customer was successfully updated.' }\n format.json { render :show, statu...
ac13c8f11e84f6f94b5f6cf69d8f0022
Returns a hash structure used to identify the revisioned associations.
[ { "docid": "f612e1c1252e3071e2231c7a10f38e73", "score": "0.6141874", "text": "def revisionable_associations (options = acts_as_revisionable_options[:associations])\n return nil unless options\n options = [options] unless options.kind_of?(Array)\n associations = {}\n options.each do |...
[ { "docid": "aec0c1cd9f3edaece7faee0eb0448ec8", "score": "0.7113805", "text": "def hash\n return @revision.hash if @revision\n return object_id\n end", "title": "" }, { "docid": "4855476c301c5693939757b46bfe4f44", "score": "0.6681152", "text": "def to_h\n {\n ...
26e2861c11a2e94108c963a6b293599d
Create a server with the given Barrister::Contract instance
[ { "docid": "d844806efe5bc6e7b11091ead0f4c333", "score": "0.0", "text": "def initialize(contract)\n @contract = contract\n @handlers = { }\n end", "title": "" } ]
[ { "docid": "7d9f0f3b9e3d17bfc6380ffa94857dc5", "score": "0.660175", "text": "def create_client\n @networking.create_client\n end", "title": "" }, { "docid": "0471d7694c5babc91944a1631abb8108", "score": "0.6537342", "text": "def create_server\n raise_not_implemented\n ...
ceb8d17dc6de1f0e0b84f3c77abe179b
Custom validation method to ensure the domain + bookmark actually exists
[ { "docid": "71fe4024c00aca10477a5f988ebd7903", "score": "0.0", "text": "def validate_url\n unless url.blank?\n begin\n http_object = HTTParty.get(url)\n rescue HTTParty::UnsupportedURIScheme\n errors.add(:url, \"Make sure that you enter a valid URL\")\n rescue...
[ { "docid": "2fbf56f1faad7fec6fb02b5874202b66", "score": "0.72217077", "text": "def validate_unique\n if Bookmark.find_by_url(self.url)\n s = \"is not unique\"\n errors.add(:url, s)\n end\n end", "title": "" }, { "docid": "a1f2d9471c9798db168b03aa10831224", "score": "0.70...
422a14f9d4b0dc4e733ccbf21d070a93
Calculates the difficulty of the game
[ { "docid": "e9fe25b1dafee470f2e4771b7541f390", "score": "0.7672733", "text": "def difficulty\n ratio = (self.won.to_f / self.played.to_f) * 100\n case ratio\n when 67..100 then 1 #easy\n when 34..67 then 2 #moderate\n when 0..34 then 3 #hard\n else -1\n end\n end", "title": "" ...
[ { "docid": "c6201d3a06f70bca4ba2ae29c4de1a0d", "score": "0.7140941", "text": "def difficulty\r\n\t @difficulty = @sse / @par\r\n end", "title": "" }, { "docid": "481cd92a86fc8627e8a7f27896079c52", "score": "0.69549954", "text": "def get_score(time_taken, difficulty)\n case diffi...
7d93b347c6bb31ca0925e714420c6bd7
Finally, a board can return values based on its state such as full? when entirely occupied with "X" and "O"s and a turn_count based on how many positions in the cells array are filled.
[ { "docid": "c776141387a0d59e3ec7c98bbe11e4f4", "score": "0.0", "text": "def full?\n @cells.all? {|x| x != \" \"}\n end", "title": "" } ]
[ { "docid": "7ec3322c9f06459098f7cf300f27541c", "score": "0.71803665", "text": "def get_board_state\n\t\tboard = Array.new(@tile.size) { Array.new(@tile[0].size)}\n\t\t@tile.each_with_index do |line, row|\n\t\t\tline.each_with_index do |current_gem, col|\n\t\t\t\tif current_gem.alive\n\t\t\t\t\tboard[row...
f67cfae094cf87d17675b3e57eff8a08
PATCH/PUT /log_files/1 PATCH/PUT /log_files/1.json
[ { "docid": "66538a8d1eb99dc36ccb5f2160709f7a", "score": "0.6763202", "text": "def update\n respond_to do |format|\n if @log_file.update(log_file_params)\n format.html { redirect_to @log_file, notice: 'Log file was successfully updated.' }\n format.json { render :show, status: :ok, ...
[ { "docid": "d6db128ad66cff3b6df8c524a06db122", "score": "0.6390711", "text": "def s3LogJsonUpdate\n logs_json_path = \"/etc/instance-controller/logs.json\"\n println \"Updating #{logs_json_path}\"\n json_obj=JSON.parse(File.read(\"#{logs_json_path}\"));\n sections = json_obj[\"logFileTypes\"]\n sec...
4a87c681eb3d52b5404fa3fa136c0d6d
Get statistics for downlink router port on tier0 router Segment ID is the ID of the segment that is connected to the the tier0
[ { "docid": "d36a3716bb4a5d62d2162eefb57d12fd", "score": "0.62685883", "text": "def get_downlink_port_statistics_summary_for_infra_segment_with_http_info(segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0G...
[ { "docid": "ba26574ae3e6273dce67e6a7ccb04cc5", "score": "0.6862183", "text": "def get_downlink_port_statistics_for_infra_segment_0_with_http_info(segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0Gateways...
b794b42d5793658ba70f2e54d7badb4a
Marks the end of the transaction. NOTE: Once set, duration should be considered immutable. I.e. you cannot affect the duration of this Transaction by calling finished twice.
[ { "docid": "e074799042a9eb1443a6ff979013ee22", "score": "0.61659706", "text": "def finished\n fin = Time.now\n @duration ||= calculate_duration(fin)\n fin\n end", "title": "" } ]
[ { "docid": "e2dbc355b09419375768305386663399", "score": "0.616562", "text": "def end\n @end_time = Time.now.utc\n end", "title": "" }, { "docid": "d0e2b7de5dd662ca780eca8067d36d4d", "score": "0.606484", "text": "def duration=(int)\n @duration = int\n set_ends_at\n ...
18cb5ef37c9372df20f6462dd0d5a7dd
Gets the version information for this interface.
[ { "docid": "1b26c6cd13e8ea597ffef6d8a6e75d46", "score": "0.0", "text": "def version\n super\n end", "title": "" } ]
[ { "docid": "8459dc9134734576a23e9c574b07f699", "score": "0.7575575", "text": "def get_version()\n @version\n end", "title": "" }, { "docid": "b282cad6bc99baed090762528ce3162c", "score": "0.7565999", "text": "def get_version\n return @version\n end", "title":...
3f52973818698070d105a2c20fdb77a5
Serializes information the current object
[ { "docid": "ff90065b9ad17b72fd4f0e8719fcb65d", "score": "0.0", "text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_enum_value(\"direction\", @direction)\n writer.write_string_value(\"label\", @label)\n ...
[ { "docid": "d162e297d0f84ca205afa381c3f6a428", "score": "0.7830697", "text": "def serialize\n Marshal.dump(self)\n end", "title": "" }, { "docid": "762bca0e2db3ff19d91cc4521bb1e1d9", "score": "0.7645999", "text": "def serialize(object) end", "title": "" }, { "docid": ...
6bf115fe764588a257aa390f24ac189e
Set the value of the ClientID input for this Choreo.
[ { "docid": "e1a1894d59f1da4a22ebe4e7554023b5", "score": "0.0", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" } ]
[ { "docid": "79945fc348ead54cb4e355166bfd6206", "score": "0.7315469", "text": "def client_id=(client_id)\n if client_id.nil?\n fail ArgumentError, 'client_id cannot be nil'\n end\n\n if client_id.to_s.length < 1\n fail ArgumentError, 'invalid value for \"client_id\", the char...
c04b60f039c1724ec06dc966f5022d89
Hanldes user selectes actions And responds on the basis of user selected action whether he want to [deposit, withdraw,transfer] the money
[ { "docid": "94b877581f5c18f210413a3d5b45a29b", "score": "0.7828606", "text": "def perform_action\n case @choice\n when 1\n amount = @prompt.ask(\"Enter amount to be deposited?\", required: true)\n balance = user_balance(current_user_id) + Integer(amount)\n ...
[ { "docid": "a95f1e2f9bd13d5e184e3e15bd403f36", "score": "0.70660293", "text": "def actions\n com = (price_without_options * 30 / 100).to_i\n insurance_fee = (com / 2).to_i\n assistance_fee = duration * 100\n drivy_fee = com - insurance_fee - assistance_fee\n\n debit_driver = {\"who\": \"d...
c299b66f005377b69ccab199b9ed6e6e
Override this to customise the display name of the component. The module name is the default display name.
[ { "docid": "619c27c6e8772ca3b22e8905ab2641a5", "score": "0.0", "text": "def display_name\n name\n end", "title": "" } ]
[ { "docid": "60b85d84de22cedf946e996ff21d0e05", "score": "0.7368271", "text": "def component_module_name(opts = {})\n if component_module = component_module()\n opts[:no_namespace] ? component_module.display_name : component_module.full_module_name\n end\n end", "title": "...
83bb94986c1a2936783fc4bc99ffe5ab
GET /photos GET /photos.json
[ { "docid": "336930a533a9de106300698757f0b494", "score": "0.0", "text": "def index\n sort = params[:sort]\n order = 'processing_time DESC'\n if !sort.nil?\n order = \"#{sort} DESC\"\n end\n @photos = Photo.paginate :page => params[:page], :order => order\n end", "title": "" } ]
[ { "docid": "267bc4eadea5cb3ae063591993b4366e", "score": "0.7820687", "text": "def index\n @photos = Photo.all\n\n render json: @photos\n end", "title": "" }, { "docid": "da3f44581f63cc851049d11be9250f14", "score": "0.7819825", "text": "def index\n @photos = Photo.all\n r...
a96edf00d5b3203a47e51772f9f88c16
list of published variables
[ { "docid": "6dec327814c4077e97ea39d54419b641", "score": "0.7868572", "text": "def published_variables\n @__published_variables ||= {}\n end", "title": "" } ]
[ { "docid": "c9e1b7755c19a1e910ccf74361117135", "score": "0.7308584", "text": "def variables()\n return @variables\n end", "title": "" }, { "docid": "7605767a27db6e9b3679458f77018c8a", "score": "0.7228083", "text": "def variable_list\n variables.map(&:name).join(' ')\n end", ...
860aa5531ad74f75f1c12e78b966c8f2
you can write to stdout for debugging purposes, e.g. puts "this is a debug message"
[ { "docid": "8a349bfa30f2ca510eeb00dfd8f6b612", "score": "0.0", "text": "def solution(a)\n # write your code in Ruby 2.2\n if a.nil?\n 0\n end\n \n result_hash = Set.new\n \n a.each do |item|\n result_hash << item # unless item.nil?\n end\n \n result_hash.length\n \nend", "title": ""...
[ { "docid": "df02a8deb8f7d23a230447dbcab99b23", "score": "0.7623083", "text": "def stdout(message)\n puts message if verbose?\n end", "title": "" }, { "docid": "17a35f1a44e7df96b83d3b1cec2c470b", "score": "0.7578705", "text": "def write(text=\"\")\n puts text if @verbose\...
cad1a78c61f4a63b79abadd0fdbe33a1
GET /tbl_categories/1 GET /tbl_categories/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "c794e2b53005975ecd30bf9e84242e82", "score": "0.75034314", "text": "def getAllCategories\n render json: Category.all\n end", "title": "" }, { "docid": "ae939484b2c3a1f4b3216a4613476d97", "score": "0.72355175", "text": "def index\n categories = Category.all\n rend...
aeebc43ceb8a2244c4bc5941a99b8ac9
POST /acessos_apis or /acessos_apis.json
[ { "docid": "81fb6f271aaab866a59c98fd1aa49205", "score": "0.7265655", "text": "def create\n @acessos_api = AcessosApi.new(acessos_api_params)\n\n respond_to do |format|\n if @acessos_api.save\n format.html { redirect_to @acessos_api, notice: \"Acessos api was successfully created.\" }\n...
[ { "docid": "991521dc2abea15fb4db52b6c13bf42c", "score": "0.70658344", "text": "def set_acessos_api\n @acessos_api = AcessosApi.find(params[:id])\n end", "title": "" }, { "docid": "e2ee24d39c88ebdf796e44d7103fd3ea", "score": "0.68256104", "text": "def acessos_api_params\n ...
885a4527bcd768eb3ee3ac0936e4ffbb
Whether in +:async+ execution mode.
[ { "docid": "971535423b5df40efcc35f4242451eb1", "score": "0.8500402", "text": "def execute_async?\n execution_mode == :async_all ||\n (execution_mode.in?([:async, :async_server]) && in_server_process?)\n end", "title": "" } ]
[ { "docid": "14360964860519b609d9821e58f6460c", "score": "0.8625199", "text": "def execute_async?\n @configuration.execution_mode == :async_all ||\n @configuration.execution_mode.in?([:async, :async_server]) && in_server_process?\n end", "title": "" }, { "docid": "b881ef57488b3...
b99509c2a5ad5c6ce41c0f2cabb3c268
balance_count = 0 right_paren = 0 left_paren = 0 star_count = 0 diff = '' current_str = '' mapIt = true arr = str.split('') while mapIt mapIt = false arr.map!.with_index do |char, i| char if char == '' || char == '' if char == '(' && arr[i + 1] == ')' mapIt = true arr[i + 1] = '' '' else char end end arr.delete('') end...
[ { "docid": "6df9bb8e8dd9c36bf0e3ace33249545b", "score": "0.7272686", "text": "def string_check(str)\n low_left = 0\n high_left = 0\n right_stars = 0\n left_paren = 0\n arr = str.split('')\n arr.each do | char |\n right_stars += 1 if char == '(' || char == '*'\n left_paren += 1 if char == ')'...
[ { "docid": "4df3200f8955b6c126f16ebc0ea15b50", "score": "0.7867886", "text": "def solution(a)\n # if string is nested, balance will be 0\n balance = 0\n\n # can use 'else' with ternary since chars limited to [\"(\", \")\"]\n a.each_char do |char|\n balance += (char == \"(\" ? 1 : -1)\n\n # if ...
bb922b8fe9b9eb6eab7a6356f12ad10c
In this expression, will `self` be the same as the innermost enclosing class or module block (:lexical)? Or will it be something else (:dynamic)? If we're in an instance_eval block, return that.
[ { "docid": "bdb472809ff7358cf1acce7d6b93148d", "score": "0.0", "text": "def scope_type(node); end", "title": "" } ]
[ { "docid": "1ffc48130fed7cf1eb04ab708d641707", "score": "0.6660011", "text": "def self()\n @_self ||= eval(\"self\")\n end", "title": "" }, { "docid": "e7f959c49c9d79e13a704d80c5fda6fd", "score": "0.65850556", "text": "def evaluate(&block)\n self.original_self = eval \"self\...
68e4ecb1fc03a8399a18ca6cddcb1882
============================================================================ Class and object attributes. ============================================================================
[ { "docid": "e821e80178b2ad3c84d2361a804128b5", "score": "0.0", "text": "def initialize(scoreType)\n\n # Remember the Orion trace level locally.\n\n @trace = configuration.value(:tracelevel).to_i\n\n # Remember the scoring method.\n\n @scoreType = scoreType\n\n # Get the exemplars into an ...
[ { "docid": "693a4959f5a4697883f8952da0fc5fcb", "score": "0.7459935", "text": "def class_attributes; end", "title": "" }, { "docid": "66772495623d88c945e27cb063c2f981", "score": "0.70718926", "text": "def attributes\n raise Symgate::Error, \"No attributes defined for object type ...
3a285216f9960ece4fa8627525e1a431
Creates a scope named after the first given parameter Scope then defines methods for getting and setting values in the object Usage: scope :brief, :title, :description defines scope :brief for fields: :title, :description
[ { "docid": "bbe656f939534bc8c0b5e378e61f0155", "score": "0.6272103", "text": "def scope(scope_name, *args)\n scope_fields = args\n\n @@all_scope_fields ||= {}\n @@all_scope_fields[scope_name] ||= []\n @@all_scope_fields[scope_name] += scope_fields\n @@all_scope_fields[scope_name] = @@all_...
[ { "docid": "09679b64a9e1979e7874ac3920a0c42c", "score": "0.68126655", "text": "def scope\n build_scope\n end", "title": "" }, { "docid": "a24cfe926000b691015a29ff44fabaef", "score": "0.66235846", "text": "def define_scope_for(opts={:field => nil, :scope => nil})\n...
33b7a853315f8433e77cd47f44937c0d
back to the previous track
[ { "docid": "bf16401bfbf069c4ab33d2307bacdfca", "score": "0.0", "text": "def back\n itunes 'back track'\n Rails.cache.clear\n get_itunes_status\n end", "title": "" } ]
[ { "docid": "95d51016b643914d3933fbb47a0b8378", "score": "0.78002274", "text": "def previous\n changeCurrentSong(:backward)\n end", "title": "" }, { "docid": "8bd2a75de5f1c5eb666ff5a8b6e19b67", "score": "0.77620447", "text": "def previous; end", "title": "" }, { "docid...
653a700caf23dfb7a429f6b14dcbd967
GET /feedback_comments/1 GET /feedback_comments/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "43e1018e94df0e7d6ab78621c98262cd", "score": "0.7106328", "text": "def showcomments\n @comments = Post.find(params[:id]).comments\n render json: @comments\n end", "title": "" }, { "docid": "0a9911bce458af3c5e21430e7fc5f3ec", "score": "0.70984745", "text": "def index...
9b21e4718aed66c84f3ebadfdd942821
Convert integer to two's complement signed 16 bit integer. Note that the Roomba is bigendian...I need to fix this code to make it portable across different architectures.
[ { "docid": "3195bffadc58c095aef5b3a3c7d542b0", "score": "0.6130076", "text": "def convert_int(int)\n [int].pack('s').reverse\n end", "title": "" } ]
[ { "docid": "3dbb5d71954740cf83629a4cbeb17a53", "score": "0.71588635", "text": "def to_16bit a\n a *= 32767\n a = a.round\n\n # clip\n a = 32767 if a > 32767\n a = -32767 if a < -32767\n\n # round\n [a, a].pack('s<s<')\nend", "title": "" }, { "docid": "96899f80895228f120c5d08fd364e59c"...
6bce014edd4832711c830122d86acf8c
returns "bottle" or "bottles"
[ { "docid": "1168b44995d1abba4d4b849fefbcbff9", "score": "0.6764344", "text": "def bottle(n)\n if n == 1 then 'bottle' else 'bottles' \n end\n end", "title": "" } ]
[ { "docid": "3bdd4328944a6b753fc89b27c8f0d65d", "score": "0.7769891", "text": "def bottles?(bot)\n\tif bot == 1\n\t\t\"bottle\"\n\telse\n\t\t\"bottles\"\n\tend\nend", "title": "" }, { "docid": "d7ec44afd04f61a07e48ae19e3c46149", "score": "0.7629733", "text": "def bottle(n)\n\t\tn == 1...
2a667f013b07d5395fd4785893075070
Create a new Rugged::Index based off of "refs/remote/origin/master" Based off of GitWorktree in ManageIQ/manageiq
[ { "docid": "e5c0cf155c96b15783dcacc6fa25bb5f", "score": "0.66181004", "text": "def rugged_index\n @rugged_index ||= Rugged::Index.new.tap do |index|\n index.read_tree(branch_ref.target.tree)\n end\n end", "title": "" } ]
[ { "docid": "e2fd9c631dee1e8ba106989ebec0aecd", "score": "0.67455876", "text": "def create\n unless saved?\n raise \"cannot create unless saved\"\n end\n \n index.create(sha)\n repo.create(sha)\n self\n end", "title": "" }, { "docid": "90f9ab7f15839f40d...
c9156181282d0bbf18d202de96f33f91
DELETE /companies/1 DELETE /companies/1.json
[ { "docid": "0bef6a1a2d2e37e29f6fac06b51e2422", "score": "0.7363719", "text": "def destroy\n @company.destroy\n respond_to do |format|\n format.html {redirect_to companies_url, notice: 'Company was successfully destroyed.'}\n format.json {head :no_content}\n end\n end", "title": "...
[ { "docid": "b39a03413d606391c52e7c71e957a049", "score": "0.8019473", "text": "def delete\n render json: Company.delete(params[\"id\"])\n end", "title": "" }, { "docid": "5ff96663ef4eea6c4a06d9ce0fe8bad1", "score": "0.7862428", "text": "def destroy\n @company.destroy\n respo...
f160556c32980d3758915f2f361cb1a0
Builds a link to index page of the resources Needs the controller data and the parent_resource, wich can be null in case of the root Controller
[ { "docid": "ed222ec89a49b3b265dee72a85762f86", "score": "0.7049429", "text": "def ar_build_index_link data, resource\n plural_label= data.breadcrumbs.plural\n meth= \"#{data.resources_method(resource, '')}_url\"\n plural_url= resource ? send(meth, resource) : send(meth)\n \"#{link_to...
[ { "docid": "2aa4484f4b1c61bef8e0037d62b26d4d", "score": "0.6802652", "text": "def index_link(resource)\n return unless policy(resource).index?\n link_to(\"All #{resource.model_name.human.pluralize.titleize}\", url_for(resource.class), class: \"button is-link\")\n end", "title": "" }, { ...
bbb734ab60518c09efd36b0727e420f8
Displays all the animals, and the habitat in which each lives.
[ { "docid": "ad1a89cf7bf166f6dac3507bc50d5d22", "score": "0.70596725", "text": "def list_animals\n puts\n Animal.all.each do |animal|\n print animal\n print \" - habitat: #{animal.habitat}\" unless animal.habitat.nil?\n puts\n end\n puts\nend", "title": "" } ]
[ { "docid": "2e0fc84067e1deaba43dcbadecf35098", "score": "0.7586465", "text": "def display_animal_records\n \tself.animals.each do |animal|\n puts \"Name: #{animal.name} Age: #{animal.age} Gender: #{animal.gender} Species: #{animal.species}\"\n end\n end", "title": "" }, { ...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "0417e07e7e75caad4c0efca520bd3f6a", "score": "0.0", "text": "def product_params\n params.require(:product).permit(:title, :product_img_url, :product_url, :category_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"...
a89da50b7fa92f3e44d5bb6644930a93
Check if the struct value is valid
[ { "docid": "3c5b6001674985a74e35d62cba14d1e2", "score": "0.0", "text": "def verify(fbe_verify_type = true)\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return true\n end\n\n fbe_struct_offset = read_uint32(fbe_offset)\n if (fbe_struct_offset == 0) || ((@_bu...
[ { "docid": "c9c74e11ce00d94d2b4dea00452ee430", "score": "0.75569487", "text": "def valid?\n value\n end", "title": "" }, { "docid": "db7201a695772216a6bedbb620650237", "score": "0.729865", "text": "def valid?(value)\n true\n end", "title": "" }, { "docid":...
d786e28ed318c1005e1143605d3aea42
Vanilla map is really really dumb It would take a lot of work to make it sensible, so just some easy code The most annoying crap is empire of Italy
[ { "docid": "55423d9ed0c1664ecfd3fdaf2f34fa8c", "score": "0.0", "text": "def fix_de_jure_map!\n patch_mod_file!(\"history/titles/k_italy.txt\") do |node|\n node[Date.parse(\"0100.1.1\")] = PropertyList[\"de_jure_liege\", \"e_byzantium\"]\n node[Date.parse(\"0867.1.1\")] = PropertyList[\"de_j...
[ { "docid": "359a4fe88a8158f890c7005ec4411ac3", "score": "0.6677147", "text": "def set_map\n # Sets up map of cities\n @map = [\n ['Sutter Creek', 'Coloma', 'Angels Camp'],\n ['Coloma', 'Virginia City', 'Sutter Creek'],\n ['Angels Camp', 'Nevada City', 'Virginia City', 'Sutter Creek'...
21c272d16cfdf8b01a3030e3156da33a
Get an options hash for a property
[ { "docid": "cb57cf09ffe65fcdcdbc4b95af4050a0", "score": "0.67828983", "text": "def __options_hash_for__(property)\n _nested_path = @path.add(property)\n super(property).merge(\n properties: @properties,\n types: @types,\n blocks: @blocks\n )\n end", "title": ""...
[ { "docid": "f553f8543e1d154e344663824a15fdf9", "score": "0.7807534", "text": "def __options_hash_for__(property)\n hash = {}\n hash[:not_configured] = __not_configured_hash_for__(property) if @__not_configured__[property]\n hash[:methods] = @__methods__[property] if @__methods__.key?(prop...
d4c3560e80829cd633622feec7ef2085
Returns the corresponding message for the current HTTP status code: response.status = 200 response.message => "OK" response.status = 404 response.message => "Not Found" source://actionpack//lib/action_dispatch/http/response.rb297
[ { "docid": "e645915e946fed44d3b1bec04579e9d3", "score": "0.0", "text": "def message; end", "title": "" } ]
[ { "docid": "831bba94d30e2fc354dc371a2d27c25f", "score": "0.79943365", "text": "def message\n @response.status_message\n end", "title": "" }, { "docid": "cb58cb760818698e2cd58b50d463aefd", "score": "0.7702937", "text": "def status_message\n Rack::Utils::HTTP_STATUS_CODES[...
38c1143ee61a97d57611a3f41845563c
needed for "found_by" wql searches that refer to search results of these cards
[ { "docid": "afca12ae96feabc3a8a0ef2e95835b18", "score": "0.5534235", "text": "def wql_from_content\n ids = search return: :id\n if ids.any?\n { id: [:in] + ids }\n else\n { id: -1 } # HACK: ensure no results\n end\nend", "title": "" } ]
[ { "docid": "9082c696c664c49721a64e02a94fc74e", "score": "0.7158138", "text": "def full_card_search(search_term)\r\n # Takes a param and searches Title, Gametext, Lore in Cards for it\r\n # Returns a list of IDs of matching cards\r\n \r\n #horribly inefficient\r\n \r\n results_i...