query_id stringlengths 32 32 | query stringlengths 7 6.75k | positive_passages listlengths 1 1 | negative_passages listlengths 88 101 |
|---|---|---|---|
e5c0edf743dcfd050d7f6d28973d2621 | GET /collaborators GET /collaborators.json | [
{
"docid": "d4b82e3a18ba8f140778f284691be10e",
"score": "0.5542739",
"text": "def index\n @collaborators = Collaborator.accessible_by(current_ability)\n @entities = Entity.accessible_by(current_ability)\n end",
"title": ""
}
] | [
{
"docid": "b6b68bcf8eec6fe5456e3cb272c65275",
"score": "0.7893446",
"text": "def collaborators\n @collaborators ||= get(\"/repos/show/#{owner.login}/#{name}/collaborators\")['collaborators'] || []\n end",
"title": ""
},
{
"docid": "e69dc2e2bc816a6af184f6462b2b5fe0",
"score": "0.... |
9f284e98d5000b875bc25cbdd5edb0f0 | Retrieves the page number from the GET URL. | [
{
"docid": "a719fcdf3ff50e787b886368e9a0604e",
"score": "0.0",
"text": "def page_param\n params.permit(:page)[:page]\n end",
"title": ""
}
] | [
{
"docid": "de77267e5cf56edfe4d53d57ba273982",
"score": "0.7250535",
"text": "def get_page\n page = (params[:page].to_i || 1) - 1\n page = 0 unless page >= 0\n\n page\n end",
"title": ""
},
{
"docid": "4d0cd6e3d2ec4e789580861bbea2a1aa",
"score": "0.7248826",
"text": "def fe... |
e0f2cb505bc5be415104a4c511d1101f | Create a resource hash of JavaScript ImageFile object. image_path:: the path of image file url:: the url to display the image file_name:: The file name that users can see. Generated from image_path if this option is not specified. original_filename:: the original file name | [
{
"docid": "b90863f0a9d47b5afe1e6ce8ae74b19c",
"score": "0.65508395",
"text": "def image_hash(image_path, url, max_width, max_height, in_session, original_filename, file_name = nil)\n unless file_name\n image_path =~ /.*\\/(.*)$/\n file_name = $1\n end\n return nil unless File::file?(... | [
{
"docid": "0cc75b8e1a8bc4ea8254e5763b5978b8",
"score": "0.602324",
"text": "def original_image_path\n return fs_path if is_image?\n return fs_path(:extension => 'jpg') \n end",
"title": ""
},
{
"docid": "44d7d81730f5dd627f32b3fb06b913b2",
"score": "0.6022939",
"text": "... |
fe2da3e2c2a68dca9ebe89e560055144 | Returns 'Product Select' section | [
{
"docid": "5027142da980b6d3a8f89321a8b9c856",
"score": "0.7763741",
"text": "def rcm_product_select_section\n $tracer.trace(__method__)\n return ToolTag.new(div.className(\"/productselect/\"), __method__, self)\n end",
"title": ""
}
] | [
{
"docid": "f3c680e22c97c8aae0be85224b8e9b1d",
"score": "0.7040126",
"text": "def products_section\n\tprint_ASCII(\"Products\")\n\tproducts\nend",
"title": ""
},
{
"docid": "9eee2bf6fca9ed02c4cc4b7d687a0338",
"score": "0.66967726",
"text": "def product_selector\n $tracer.trace... |
ca13ce975b7dfd738c9ea96eb7b89d53 | From inside a query, return an error | [
{
"docid": "be15b08171de3846c28bed4bdcbee63c",
"score": "0.0",
"text": "def return_error(status_code, error_info)\n @delegate.return_error(status_code, error_info) if @delegate.respond_to?(:return_error)\n end",
"title": ""
}
] | [
{
"docid": "9ca71fcfcd63d71665fb71a6a58a943f",
"score": "0.6767572",
"text": "def foreign_key_error?(exception)\n exception.message =~ /query does not return ResultSet/\n end",
"title": ""
},
{
"docid": "b5619ff295f1a95f469ee5170a350f89",
"score": "0.63220036",
"text"... |
b0a4ce91a6e4fe881b968353324c4b2c | FIXME: for compare with standard vector | [
{
"docid": "f2ab76703244edda0718d6c058d80042",
"score": "0.0",
"text": "def ==(other)\n return eql?(other) if other.class == Vector\n return false unless %i[size \\[\\]].all? { |x| other.respond_to? x }\n return false unless self.size == other.size\n\n result = true\n each_with_... | [
{
"docid": "256e2e392b8e4f38efa80455c34432b2",
"score": "0.764193",
"text": "def vector\n end",
"title": ""
},
{
"docid": "274c969e42f73d7943e1e4306a53ba61",
"score": "0.693819",
"text": "def vector_to(point)\r\n end",
"title": ""
},
{
"docid": "8bcfa4cc0cd0bedde3ef38e4... |
341bd325a15cdf13cc7813ed63e9b3f3 | GET /hours_records GET /hours_records.json | [
{
"docid": "9b6358988dfc75a947482bb6b8641635",
"score": "0.6675621",
"text": "def index\n @hours_records = HoursRecord.all.includes(:activity, :bay, :improductive_reason, :main_skill, :main_equipment, :project, :voltage_level, :profile)\n end",
"title": ""
}
] | [
{
"docid": "5baab109f279342e5d76568dc4d6ca64",
"score": "0.72672194",
"text": "def hours\n render json: Pings::Selector.new.hours(params)\n end",
"title": ""
},
{
"docid": "08e72c742cf3f1893f8bb49455b4b642",
"score": "0.724457",
"text": "def index\n @hours = Hour.all\n\n re... |
4b9a98c7a408dc350c968680ad969958 | Get Command Data of Selection Item | [
{
"docid": "7298d298d8f3b828fc0a953649416cfe",
"score": "0.0",
"text": "def current_data\n index >= 0 ? @list[index] : nil\n end",
"title": ""
}
] | [
{
"docid": "7ed09dcdeb7b8c806d2adf56ec664dc9",
"score": "0.67107844",
"text": "def get_selected(data=:id)\n raise_error \"No Column Selection Model Defined\" if config[:sm].blank?\n if data.to_sym == :id\n \"#{config[:sm]}.getSelected().id\".to_l\n else\n \"#{config... |
6a24ee66d06b154c3c8b5e6af0c7ec54 | NOTE When an ambassador has either accepted or declined the booking We need to update the EventRole.role_status with either confirmed or declined | [
{
"docid": "572924a8f5dea61a3dcf72c5b0c9987d",
"score": "0.79480135",
"text": "def update_role_status(status)\n roles_to_update = {}\n role_ids = self.booking_staff_items.pluck('event_role_id')\n self.update_booking_staff_items_status(status)\n EventRole.where(id: role_ids).each do |role|\n ... | [
{
"docid": "0feaf66c13e56d9d1ff01362bf528f93",
"score": "0.6876936",
"text": "def update\n if params[:friend]\n role = Role.where(user_id: @user.id).where(event_id: @event.id)[0]\n role.accepted = true\n respond_to do |format|\n if role.save\n format.html { redirect_to ... |
af13afbc175990a53e106dab4c37ee9e | Part 1: Access multiple elements of a nested array Pseudocode Create a method that takes two arguments: board (as an array of array), and a range of arrays (coords) For each of the arrays (coords) take the first and last element and pass it to the board in the order (array of arrays) Join the result with "" and turn it... | [
{
"docid": "d87151a3e742c12af79d6cf3f4aa2882",
"score": "0.5941225",
"text": "def create_word(board, *coords)\n\tcoords.map { |coord| board[coord.first][coord.last]}.join(\"\")\nend",
"title": ""
}
] | [
{
"docid": "e57664b633040d84340358e7343cac0e",
"score": "0.69763666",
"text": "def create_word(board, *coords) # this is defining the method that will accept a board argument, and an indefinite (splat) amount of arguments.\n coords.map { |coord| board[coord.first][coord.last]}.join(\"\") # this will ... |
289d816b8f0476c3064b23e4840cfb6b | GET /leavetype/edit/1 GET /leavetype/edit/1.json | [
{
"docid": "fb7be3793d00f27c9a14f106076078cf",
"score": "0.79461414",
"text": "def edit\n @leavetype = LeaveType.find(params[:id])\n @form_id = 'edit-form'\n \n respond_to do |fmt|\n fmt.html { render :partial => 'form' }\n fmt.json { render :json => @leavetype }\n end\n end",
... | [
{
"docid": "70549f027afe4405085029c0afb36ccd",
"score": "0.7233973",
"text": "def update\n @leavetype = Leavetype.find(params[:id])\n\n respond_to do |format|\n if @leavetype.update_attributes(params[:leavetype])\n format.html { redirect_to @leavetype, notice: 'Leavetype was successful... |
532255a9c2e6bea7d3def0e1c763181b | replace bar with foo on elements that already have class foo $('li').replaceClass('foo', 'bar') | [
{
"docid": "599a9a34c43544a68437cbafc18d8cc5",
"score": "0.53882396",
"text": "def replace_class\n\n click_button 1 do\n\n assert_equal 0, @selenium.get_expression(js_get %{$('.foo').length}).to_i, \"no elements with classname foo\"\n\n assert_equal 2, @selenium.get_expression(js_get %{$('.... | [
{
"docid": "bc865f1cd9a1bebf6b579502547abc1b",
"score": "0.57847625",
"text": "def add_class_to_elem(page, css_selector, classname)\n elems = page.css(css_selector)\n unless elems.nil?\n elems.each do |elem|\n if !elem['class'].nil?\n elem['class'] << \" #{classname}\"\n else\n ... |
5444337e31a1f9f758242922f7496713 | Logout from your account | [
{
"docid": "89049ae1a16d0d94c494a083277597a7",
"score": "0.0",
"text": "def logout\n reset_session\n redirect_to root_path, notice: \"You have been logged out\"\n end",
"title": ""
}
] | [
{
"docid": "67ca84a90d5741e8e0c6114e2c4f107d",
"score": "0.86703247",
"text": "def logout\n sign_out(current_account)\n end",
"title": ""
},
{
"docid": "f91b7efe3ede18aa2262f7713dfddbac",
"score": "0.83294123",
"text": "def logout\n HttpWrapper.post(\n url: \"#{::... |
cf5fadb9c1336c078564244e9ce43e0b | clicks the Delete Project button | [
{
"docid": "aaf8a4fc9fbdf145cc03d158c75d91d4",
"score": "0.86708754",
"text": "def project_delete\n delete_project.click\n confirm = modal.find('a[data-method=delete]')\n confirm.click\n end",
"title": ""
}
] | [
{
"docid": "3a45a99c109d14954f1eeea2b1b937d9",
"score": "0.80564964",
"text": "def delete_projects\n @driver.find_element(:xpath,(\"//li[@class='list-group-item ng-binding ng-scope'][1]\")).click # chose first project from the list\n sleep 1\n @driver.find_element(:xpath,(\"//button[@class='btn btn-a... |
5374d4f6fa96f6ce68e5fdbc687ed737 | I N S T A N C E M E T H O D S Set the graph that the result belongs to | [
{
"docid": "5bcc9decfc4560e08ce225fe7b4d88b8",
"score": "0.0",
"text": "def initialize( graph )\n\t\t@source_graph = graph\n\tend",
"title": ""
}
] | [
{
"docid": "8f082d7de86d6169ce16eb4a71df302c",
"score": "0.6949761",
"text": "def graph\n @graph\n end",
"title": ""
},
{
"docid": "8f082d7de86d6169ce16eb4a71df302c",
"score": "0.6949761",
"text": "def graph\n @graph\n end",
"title": ""
},
{
"docid": "6755... |
1edb62749fc52ad2837db08592cc1390 | GET /delta/new GET /delta/new.json | [
{
"docid": "e7970091e89b879b1c22557b35109661",
"score": "0.6459394",
"text": "def new\n @deltum = Deltum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @deltum }\n end\n end",
"title": ""
}
] | [
{
"docid": "bf1d472cd6b2fadb7096d2b16bc53b50",
"score": "0.68318635",
"text": "def new\n @deltagere = Deltagere.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @deltagere }\n end\n end",
"title": ""
},
{
"docid": "0b37ffe71290e9f0c... |
13567753eeb144557c4ceae97dc62077 | If this is a preflight OPTIONS request, then shortcircuit the request, return only the necessary headers and return an empty text/plain. | [
{
"docid": "5526879237039de3e1d366ef6155a8a9",
"score": "0.0",
"text": "def cors_preflight_check\n headers[\"Access-Control-Allow-Origin\"] = \"*\"\n headers[\"Access-Control-Allow-Methods\"] = allowed_cors_methods\n headers[\"Access-Control-Allow-Headers\"] = \"X-Requested-With, X-Prototype-V... | [
{
"docid": "9e36f0e05c194cf638c1399a231c6c79",
"score": "0.7639656",
"text": "def handle_options_request\n head(:ok) if request.request_method == \"OPTIONS\"\n end",
"title": ""
},
{
"docid": "18fd73266177c195768a536fc446d0e8",
"score": "0.76335746",
"text": "def handle_optio... |
1fa5af08e0e0cb95ef6579c8ff159786 | redundant, checks that engine is initialized with reset! | [
{
"docid": "b7bf94d6d66933c146b4ee41f378647f",
"score": "0.0",
"text": "def ready\n @roots && @roots.any? && result == 'ongoing'\n end",
"title": ""
}
] | [
{
"docid": "b8426551c54e40cd2c294072e8bd33e9",
"score": "0.75718075",
"text": "def reset!\n engine.reset!\n end",
"title": ""
},
{
"docid": "e9ecbfa52d21b6b6cf1938a47245dec9",
"score": "0.66459054",
"text": "def reset_engine_registrations!\n @@registered_engine_confs = {}\n e... |
4cebd82af76babcb2d74a2011ccacad2 | DELETE /websites/1 DELETE /websites/1.json | [
{
"docid": "5f9e99c639f7f3f6d8df3f33f766cdf0",
"score": "0.72140485",
"text": "def destroy\n @website.destroy\n respond_to do |format|\n format.html { redirect_to websites_url, notice: 'Website was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title... | [
{
"docid": "6a654b43f1b7f1907615cd5679118029",
"score": "0.7172472",
"text": "def destroy\n @website = Website.find(params[:id])\n @website.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "73ecf52b6bf2adfaeef1f7a2db265821",
"score": "0.71704483",
"text": "def... |
007afc90489b03b13c6d818e95fa44a0 | GET /reservas/new GET /reservas/new.json | [
{
"docid": "bfeaa71832e5c50bb4d91935a3748b78",
"score": "0.7961705",
"text": "def new\n @reserva = Reserva.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reserva }\n end\n end",
"title": ""
}
] | [
{
"docid": "d299ba5906269b434cce441f3103bf54",
"score": "0.76184696",
"text": "def new\n @proximo_libros = Libro.find(params[:libro_id])\n @cuenta = Cuenta.find(params[:cuenta_id])\n @reserva = @cuenta.reservas.new(:libro => @proximo_libros, :fecha_reserva => Date.today)\n\n respond_to do |f... |
8270da5509b625528053ebbe143f5b16 | Updates the YAML data file according to the keep setting | [
{
"docid": "b64f63288cecbc8ea19b8c988e95aacf",
"score": "0.6780685",
"text": "def update_storage_file!\n packages = yaml_load.unshift(@package)\n excess = packages.count - @storage.keep.to_i\n @packages_to_remove = (excess > 0) ? packages.pop(excess) : []\n yaml_save(... | [
{
"docid": "cbe4d2ab1b53c5b19bce058fabfe26db",
"score": "0.64253944",
"text": "def update\n yaml_file = File.open(File.join(Dir.pwd, '/kymera_config.yaml'), 'w+')\n @config_options.to_yaml.split('\\n').each do |line|\n yaml_file.write(line)\n end\n yaml_file.rewind\n str ... |
7b1ef55bfcd1a7341b0b8efb8121ed78 | This show action only allows users to view their own profile | [
{
"docid": "541b4c37ad5abd598f96744dce4597fb",
"score": "0.0",
"text": "def show\n @user = current_user\n end",
"title": ""
}
] | [
{
"docid": "e5da815f467592a716b16b063ca71fa8",
"score": "0.83033663",
"text": "def show\n @user = User.find(current_user.id)\n @own_profile = @profile.user_id == current_user.id ? true : false\n end",
"title": ""
},
{
"docid": "e648707c78149f3334b8914bd1bea59b",
"score": "0.825997... |
2e28364534aa9d0e1b6460358c93a2f5 | Set the value of the Systolic input for this Choreo. | [
{
"docid": "7b27c2eb1a7d5e28f69d83d5b07b11b5",
"score": "0.8438843",
"text": "def set_Systolic(value)\n set_input(\"Systolic\", value)\n end",
"title": ""
}
] | [
{
"docid": "4cde97ca8e98fab415580527aee300fa",
"score": "0.6089438",
"text": "def set_Diastolic(value)\n set_input(\"Diastolic\", value)\n end",
"title": ""
},
{
"docid": "ab0cbad266a1de1c92a098b884cbd4c4",
"score": "0.57086986",
"text": "def set_SOQL(value)\n ... |
5a5c45746420054e4c2120ad9a649a05 | The max number of rows to be returned from a query | [
{
"docid": "9666422e72e46ae647869f098eaa8158",
"score": "0.78590554",
"text": "def max_rows_returned\n Rails.application.config.max_rows_returned\n end",
"title": ""
}
] | [
{
"docid": "02b917075ef294227c2683ae5a60e8b1",
"score": "0.87617373",
"text": "def max_rows_returned; end",
"title": ""
},
{
"docid": "2bae3dc12a8b39d36fed8bfac44e21c5",
"score": "0.8605853",
"text": "def max_rows; @@max_rows; end",
"title": ""
},
{
"docid": "81b852d16fde... |
83cab8ae40aae68142bd43e4576225d3 | Internal: Build a single line Returns: Array of ConsoleDraw::Canvas::Point | [
{
"docid": "a115b037226c4444686f89ecfaa3f93e",
"score": "0.53809714",
"text": "def egde(x1, y1, x2, y2)\n ConsoleDraw::Figures::Line.new(x1, y1, x2, y2).calculate_coordinates\n end",
"title": ""
}
] | [
{
"docid": "a1bba6196d8ae61aab6b0389b8dae132",
"score": "0.64424527",
"text": "def lines\n points.each_cons(2).map {|a,b| Line.new a, b}\n end",
"title": ""
},
{
"docid": "a1bba6196d8ae61aab6b0389b8dae132",
"score": "0.64424527",
"text": "def lines\n points.each_cons(2).... |
c657de4b70d266e9a3a784b999ea9e60 | Never trust parameters from the scary internet, only allow the white list through. | [
{
"docid": "c1a8a5987a708f64431aa3bd827084b7",
"score": "0.0",
"text": "def grupocliente_params\n params.require(:grupocliente).permit(:descricao, :racio)\n end",
"title": ""
}
] | [
{
"docid": "e164094e79744552ae1c53246ce8a56c",
"score": "0.69792545",
"text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e662f0574b56baff056c6fc4d8aa1f47",
"score": "0.6781151",
"text": "def strong_params\n params.requ... |
e7b74611eaccf9f7f60807b8304b09f5 | Do some minimal validation of the policyfile we fetched from the server. Compatibility mode relies on using data bags to store policy files; therefore no real validation will be performed serverside and we need to make additional checks to ensure the data will be formatted correctly. | [
{
"docid": "ee9e31f67ff21c062e3818cf915510ce",
"score": "0.7056103",
"text": "def validate_policyfile\n errors = []\n unless run_list\n errors << \"Policyfile is missing run_list element\"\n end\n unless policy.key?(\"cookbook_locks\")\n errors << \"Policyfi... | [
{
"docid": "60bd7c02d35586d4df0d40170bcefa8a",
"score": "0.67693317",
"text": "def policyfile_loaded(policy); end",
"title": ""
},
{
"docid": "934ab79df32a2955eff374918bd4fa98",
"score": "0.6206926",
"text": "def supports_policyfile?\n true\n end",
"title": ""
},
... |
773466d28dd9cff12019019523866096 | Sets the body object of the message object. Example: mail.body = 'This is the body' | [
{
"docid": "3f7bb537f7e582da10079cccc770e0f9",
"score": "0.6094616",
"text": "def body=(value)\n body_lazy(value)\n end",
"title": ""
}
] | [
{
"docid": "7e3314d5371633cc3b121bf899bf9e52",
"score": "0.8515924",
"text": "def set_body\n self.body = message_body\n end",
"title": ""
},
{
"docid": "3ab9eaf8f5a1d30ab130c9236adad27b",
"score": "0.7780922",
"text": "def set_body from_user\n self.body = message_body from... |
f0e5d70e054112d29c75a097acc5b2ca | call this to manually flush a template | [
{
"docid": "1bf453752898169d43b0484eeef13041",
"score": "0.6022304",
"text": "def __flush\n @_undies_io.current.flush\n end",
"title": ""
}
] | [
{
"docid": "7c6122b2f1233e2018d62c95fe8a9574",
"score": "0.63542",
"text": "def flush # :nodoc:\n end",
"title": ""
},
{
"docid": "8df495c6acd6ee3e04c9b094341d5b8f",
"score": "0.626273",
"text": "def flush\n #\n end",
"title": ""
},
{
"docid": "c325919fb7cbfc751163... |
6d4464602cbe18d056915c68362c6620 | POST /itineraries POST /itineraries.json | [
{
"docid": "4d3fc50c8b5f99aeba2f601234fe85fb",
"score": "0.6919261",
"text": "def create\n @itinerary = Itinerary.new(params[:itinerary])\n\n respond_to do |format|\n if @itinerary.save\n format.html { redirect_to @itinerary, notice: 'Itinerary was successfully created.' }\n for... | [
{
"docid": "c1cfd20aec061bfef28813a08608f22f",
"score": "0.72673696",
"text": "def create\n itinerary = current_user.itineraries.create!(itinerary_params)\n itinerary_id = current_user.itineraries.last\n \n events = params[:events]\n events.each do |event|\n itinerary_id = current_us... |
2b0d60f663b6d87dcc986bbb7de781bf | Fallback method in case resources can not be fetched e.g. in case of wrong auth. Typically this is to fetch the RSS/ATOM feed | [
{
"docid": "9754d500000e738b4c356c55dcb6fadc",
"score": "0.72470057",
"text": "def fetch_resources_fallback\n result = Hpricot.XML( open( feed ) ) #more infos but less resources max. 31 #TODO: loop trough annotations to get even more!\n (result/:item).each do |resource|\n i = Reso... | [
{
"docid": "976237983327c79712ac24cb0d76cd44",
"score": "0.71247834",
"text": "def fetch_resources_fallback\n f = FeedNormalizer::FeedNormalizer.parse( open( feed ) )\n f.items.each do |resource|\n i = Resource.factory( type, :feed => resource )\n self.resources << i\n en... |
0d4a2b435ea512aa99d8c4b000fbbef5 | Compute Polychoric correlation with joint estimate, usign derivativeless minimization method. Rho and thresholds are estimated at same time. Code based on R package "polycor", by J.Fox. | [
{
"docid": "5846c12d44778cd14c25eefc4e97b875",
"score": "0.4097477",
"text": "def compute_one_step_mle_without_derivatives\n # Get initial values with two-step aproach\n compute_two_step_mle\n # Start iteration with past values\n rho=@r\n cut_alpha=@alpha\n cut_... | [
{
"docid": "1d2535813fa33c0741215170d61c59f0",
"score": "0.6329817",
"text": "def compute_polychoric_series \n @nn=@n-1\n @mm=@m-1\n @nn7=7*@nn\n @mm7=7*@mm\n @mn=@n*@m\n @cont=[nil]\n @n.times {|j|\n @m.times {|i|\n @cont.push(@matrix... |
d4a1edaae4d92d004632cf64501ce2e7 | DELETE /users/1 DELETE /users/1.json | [
{
"docid": "d88f54bf7def4b130fdd9b981afab643",
"score": "0.0",
"text": "def destroy\n authorize @user\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"... | [
{
"docid": "8e69eb3ff3374e0db6fa9eb17958df65",
"score": "0.78750724",
"text": "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end",
"title": ""
},
{
"docid": "6f74a32c6fdb67babd4a903e37b5baa4",
"score": "0.77518034",
"text":... |
b1e5a08f8a897e4cbb8d0ae441ad2039 | NOTE: We check via File::size? whether this file provides size info via stat (e.g. /proc files often don't), otherwise we have to figure it out by reading the whole file into memory. And while we're at it we also use this as body then. | [
{
"docid": "fd35b4cb7b4907c6bfb191da268fdb0c",
"score": "0.0",
"text": "def serving\n history = @repo.log(@branch_name, @path_info, :max_count => 1, :skip => 0)\n blob = history[0].tree / @path_info\n\n body = blob.data\n last_modified = history[0].aut... | [
{
"docid": "f044a4791cb689c88c45ce1872c64274",
"score": "0.7099156",
"text": "def size\n file.nil? ? 0 : file.body.length\n end",
"title": ""
},
{
"docid": "48e9f2b185e5ba30a48e4846aef797f9",
"score": "0.7037788",
"text": "def file__size\r\nif File.exist?(self.file__p... |
ecf60dd399c22521d1cf1123624eeede | Returns allowed page types (depending on the parent page type). | [
{
"docid": "1f90848d515890205548f1c3bacbe48e",
"score": "0.88419044",
"text": "def allowed_page_types\n if parent.present?\n parent.page_type.allowed_children\n else\n PageType.where( type: :root ).first\n end\n end",
"title": ""
}
] | [
{
"docid": "f2f68f9473baa913a5d5a78705db3c0d",
"score": "0.73772573",
"text": "def proper_types\n Page.distinct(:_type).reject { |type| type.constantize.new.entry? }\n end",
"title": ""
},
{
"docid": "d135f9866095149cd43ba9a600caa616",
"score": "0.6878329",
"text": "def proper_pa... |
ee2863ad07ef4c42a11cb2b5ed6fd19d | returns 10 advertisers, for card game | [
{
"docid": "344c087fac76d5aabbfbafe54171ed7f",
"score": "0.5588075",
"text": "def get_advertisers\n # @advertisers = Advertiser.all.select(:id).limit(10)\n ad_json = {\n :advertisers => Advertiser.all.select(:id).limit(10).pluck(:id)\n }\n render json: ad_json\n end",... | [
{
"docid": "6efc492c5c11d70f26ca519940739b50",
"score": "0.63249904",
"text": "def top10Gainers\n gainersLosers.first(10).to_h\n end",
"title": ""
},
{
"docid": "eeffb107c848670e0ba0365ad07d9dda",
"score": "0.6224886",
"text": "def available_ads_for_pages\n page_ads = []... |
aa88f7c280f02450447170a796f247ad | Support Airbrake custom attrs. When using Airbrake.io the request body will be sent along with the error to assist in debugging. | [
{
"docid": "9f065cf07e29e831a113bdb71f533846",
"score": "0.0",
"text": "def to_airbrake\n { params: { request_body: JSON.parse(raw_body) } }\n end",
"title": ""
}
] | [
{
"docid": "025759c0c94cdd18df917a289da21500",
"score": "0.60340565",
"text": "def get_required_attrs; end",
"title": ""
},
{
"docid": "a33263d643c0a9f7317cf5d9e43b4c1c",
"score": "0.5992874",
"text": "def custom_attrs\n @gapi.custom_attributes\n end",
"title": ""... |
a6d31dc847f9330ddc554a819007ebbc | Attempts to authenticate with the given username and password This will fail with an AuthenticationFailure exception if the credentials are invalid. | [
{
"docid": "68595273fddc9f398bd605707eaede82",
"score": "0.6873968",
"text": "def authenticate(username, password)\n auth_fail unless auth_ok?(username.intern, password.to_s)\n privileges_for(username.intern)\n end",
"title": ""
}
] | [
{
"docid": "9eafc39dc9706b6dd1a56c6514c7aeb5",
"score": "0.7902886",
"text": "def authenticate!\n user = connection.authenticate!(credentials_hash)\n\n if user\n success!(user)\n else\n fail!('Could not log in')\n end\n rescue Net::LDAP::LdapError\n ... |
1676e1231eaeb9bd9d2f7ba98184c94c | Determine whether a file is an example.yml template or real deployment. The inverse of template? filename String Returns true if it is a deployment or false if it is not | [
{
"docid": "7abf981390f3551e1f3cec01301fd62f",
"score": "0.8409647",
"text": "def deployment?(filename)\n filename.include?('.yml') and not filename.include?('example.yml')\n end",
"title": ""
}
] | [
{
"docid": "1a7cc9685b46542a2efe026016d664d0",
"score": "0.6764157",
"text": "def template?\n return false if source_file.nil?\n !::Tilt[source_file].nil?\n end",
"title": ""
},
{
"docid": "4cc7d3fa50d33904a9ab1ba415a9464c",
"score": "0.66620374",
"text": "def yaml... |
212206a84b0fe9350fc92cc95506ff52 | GET /cpps/1 GET /cpps/1.json | [
{
"docid": "a81945373733e4951b987de6ea99f9a1",
"score": "0.0",
"text": "def show\n end",
"title": ""
}
] | [
{
"docid": "b2edd8894eed2300577ada5309a9ba62",
"score": "0.61060303",
"text": "def index\n @peaces = Peace.all\n render json: @peaces\n end",
"title": ""
},
{
"docid": "a2fa564d8e917a978063ffb253e8b2e7",
"score": "0.61040515",
"text": "def get_json(path)\n puts \"*** GET #{pa... |
b50ed5a0ca7be4867ebb5b14158b8524 | An inspectstyle string for IRB and the like. | [
{
"docid": "aecbcca49142f4e45cd5da1765edc593",
"score": "0.0",
"text": "def inspect\n \"#<#{self.class} 0b#{self.to_s}>\"\n end",
"title": ""
}
] | [
{
"docid": "867264ffc9503b6b7d1de07348c67fb7",
"score": "0.6813658",
"text": "def inspect\n str = to_s\n\n case str\n when /^(\\$|@@?)[a-z_][a-z_\\d]*$/i, # Variable names\n /^[a-z_][a-z_\\d]*[=?!]?$/i, # Method names\n /^\\$(-[a-z_\\d... |
68994aff208bf6c68685cef9109af697 | sign parameters in alphabetical order according to dev.karotz.com | [
{
"docid": "1c01c6f809e4f0555569e497dab088f4",
"score": "0.6890827",
"text": "def sign(p, signature)\n sorted = Hash[p.sort]\n url = Addressable::URI.new\n url.query_values = sorted\n #puts url.query\n signed = Base64.encode64((HMAC::SHA1.new(signature) << url.query).digest).str... | [
{
"docid": "ab9917a943d5b49b3e6306e084aecc69",
"score": "0.7479131",
"text": "def sign(params)\n Digest::MD5.hexdigest(wrap_with_secret sorted_option_string(params)).upcase\n end",
"title": ""
},
{
"docid": "98d83c8acd05fa9dd22b6099d206e1df",
"score": "0.74313074",
"text": "d... |
ac9a1a534240925932a9646b109b2316 | Convenience method to return the partial for any given step by name. | [
{
"docid": "6af3decffbaa0ff0e6f414bce256d5b8",
"score": "0.6084526",
"text": "def workflow_partial_for_step(step)\n find_workflow_step_by_name(step)[:edit_partial]\n end",
"title": ""
}
] | [
{
"docid": "1f5a53c58e64cc1b9f32a2a9dab6f41e",
"score": "0.679488",
"text": "def steps_for_name(name)\n steps.select { |s| s.name == name }\n end",
"title": ""
},
{
"docid": "4c0a006eca11028e1e6c773c59d482ef",
"score": "0.6385589",
"text": "def partial(name)\n partia... |
bd64ab1f08c6d7cf0889c890646966ac | GET /razmer_os/new GET /razmer_os/new.json | [
{
"docid": "54dcaa5387b97b6808310e57ca897f3a",
"score": "0.7712201",
"text": "def new\n @razmer_o = RazmerO.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @razmer_o }\n end\n end",
"title": ""
}
] | [
{
"docid": "2325ae30f789d38827e0c28721684871",
"score": "0.7863022",
"text": "def new\n @torneotipo = Torneotipo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @torneotipo }\n end\n end",
"title": ""
},
{
"docid": "5377379d7d29307... |
2d09918124791c545a273a793e294b0b | DELETE /access_tokens/1 DELETE /access_tokens/1.xml | [
{
"docid": "ac6e5aeb1047a1df9721c73f4a7ce6ba",
"score": "0.7331315",
"text": "def destroy\n @access_token = AccessToken.find(params[:id])\n @access_token.destroy\n\n respond_to do |format|\n format.html { redirect_to(access_tokens_url) }\n format.xml { head :ok }\n end\n end",
... | [
{
"docid": "440f6acb7e766737d7c1584107744cf1",
"score": "0.7122208",
"text": "def delete_access_token(id:)\n client.make_request('/delete-access-token', 'post', params: {id: id})\n end",
"title": ""
},
{
"docid": "bb16ab4bf8d70c9efe8f369132f9b13b",
"score": "0.696177",
"text"... |
8e8fadc92826fa15a11679a623b402e9 | Fibonacci 1,1,2,3,5,8 calculate the fib number return index based off length of input | [
{
"docid": "a8aeda9e19aa5461e8be33acbb8797f1",
"score": "0.7990786",
"text": "def find_fibonacci_index_by_length(value)\n\tfirst_num = 1\n\tsecond_num = 1\n\tindex = 2\n\tloop do \n\t\tfib = first_num + second_num\n\t\tindex +=1 \n\t\treturn index if fib.to_s.size == value\n\t\tfirst_num = second_num\n\... | [
{
"docid": "200f0a4096a0314120512d1335580b77",
"score": "0.8471619",
"text": "def find_fibonacci_index_by_length(length)\n a, b = 1, 1\n index = 2\n\n until b.to_s.length >= length\n a, b = b , b + a\n index += 1\n end\n index\nend",
"title": ""
},
{
"docid": "a2f1eacc98fe9e5ee1d9... |
ebde40ab266bd94909c84abaef689b95 | Sets page content width | [
{
"docid": "06c276e04185de3c137b0d18994346c0",
"score": "0.66681343",
"text": "def lim(page_width)\n content_for(:width) { page_width }\n end",
"title": ""
}
] | [
{
"docid": "cfbcbd2cacb0c4de153b3bfc8a90577d",
"score": "0.79159606",
"text": "def pageWidth=(value)\n\t\t\t@width = value\n\t\tend",
"title": ""
},
{
"docid": "b13284c91e691f00db0f3549c5bb4e98",
"score": "0.6977826",
"text": "def setwidth(width)\n @width = width\n end",
... |
61bc7a0409fdc95037eceb022929fc6e | Elementwise logical "and" inplace. | [
{
"docid": "53acd6ccf9ed1d5cae94420b15df1e24",
"score": "0.6540675",
"text": "def and!(s); andi(s); end",
"title": ""
}
] | [
{
"docid": "1493c4336636e7a105025e6adf631b76",
"score": "0.7814523",
"text": "def and(*args)\n new(args.all?{|arg| arg.true?})\n end",
"title": ""
},
{
"docid": "2afcd0b1f253cf4f616c13134255a1ef",
"score": "0.7569901",
"text": "def _and(*vals)\n evaluate_expression '... |
7f3ae82cb6c9b92cb9e8aa9a961d21c7 | stream dump if stream set Args : +stream+ > Open file stream | [
{
"docid": "3e3d2ece45e735b6abbda70c6c5261b6",
"score": "0.7647795",
"text": "def dump(stream = nil)\n # TODO fill me in\n end",
"title": ""
}
] | [
{
"docid": "b5a79d51885630dd9b9d5c8313e5d24c",
"score": "0.709765",
"text": "def stream_opened(stream, options = {}); end",
"title": ""
},
{
"docid": "dd269cfc05d957503500bbdbbb262f3f",
"score": "0.6984261",
"text": "def stream=(stream)\n close()\n @stream = stream\n end",
... |
f8d8cf659f2a031e8dcdae5bbd9eb79f | PUT /gb_repos/1 PUT /gb_repos/1.json | [
{
"docid": "28ce1f98e264b95b661af90728655093",
"score": "0.7131639",
"text": "def update\n @gb_repo = GbRepo.find(params[:id])\n\n respond_to do |format|\n if @gb_repo.update_attributes(params[:gb_repo])\n format.html { redirect_to @gb_repo, notice: 'Gb repo was successfully updated.' ... | [
{
"docid": "89870957a9c6ee63a3df572be621925b",
"score": "0.6846595",
"text": "def update\n unless current_user.repos.map(&:id).include? @repo.id\n raise Errors::NotFoundError.new\n end\n\n @repo.update!(repo_params)\n render json: @repo\n end",
"title": ""
},
{
"docid": "36... |
31c2818df2710a531efc007891437193 | add a custom getter for place that will find and return a Place instance that represents the stored ID (Hint: Place.find) | [
{
"docid": "e4af5c1358c4dc3765d31c187abf3ecf",
"score": "0.70876074",
"text": "def place\n unless @place.nil?\n \tPlace.find(@place.to_s)\n end\n end",
"title": ""
}
] | [
{
"docid": "569413ac157a79c2632e17011d8cb987",
"score": "0.7733774",
"text": "def place(id:)\n Place.find(id)\n end",
"title": ""
},
{
"docid": "e60989310cf3fe5c57f7f10a44138eb9",
"score": "0.7522459",
"text": "def find_place\n\t\t@place = Place.find(params[:id])\n\n\tend",
"... |
ea458c2cdef07baa343de83dd000945f | PATCH/PUT /stations/1 PATCH/PUT /stations/1.json | [
{
"docid": "7ce1227a9be0b28ee998303ae94bf9e6",
"score": "0.6394487",
"text": "def update\n respond_to do |format|\n @station.status = :waiting\n if @station.update(station_params)\n format.html { redirect_to [:back, @station], notice: I18n.t('view.notice.updated') }\n format.j... | [
{
"docid": "eb6ee5c5150e612252b7e710bebade27",
"score": "0.69493765",
"text": "def update\n @station = Station.find(params[:id])\n\n if @station.update(station_params)\n head :no_content\n else\n render json: @station.errors, status: :unprocessable_entity\n end\n end",
"title"... |
b165b1efc28fb85e4c77eb3c9915eba2 | GET /rates GET /rates.xml | [
{
"docid": "613968a64d9e18a33f769b550418f183",
"score": "0.76089686",
"text": "def index\n\t\t# TODO redirect_to somewhere !?\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @rates }\n\t\tend\n\tend",
"title": ""
}
] | [
{
"docid": "f49f6f1b0fc3620eee3394668362d402",
"score": "0.77670157",
"text": "def show\n @rates = Rate.find(params[:id])\n if @rates\n respond_to do |format|\n format.json { render :json => @rates }\n format.xml { render :xml => @rates }\n end\n else\n head :not_fo... |
4b59d04951b55589449ca70e3186fd0b | GET /allergies GET /allergies.json | [
{
"docid": "edf8596e4ca2a06252fe13ce39390e59",
"score": "0.6005318",
"text": "def index\n patient = Patient.find_by(params[session[:patient_id]])\n allergies = @patient.allergies\n end",
"title": ""
}
] | [
{
"docid": "460b376df5769219102e96deca115edc",
"score": "0.7228153",
"text": "def show\n @allergy = Allergy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @allergy }\n end\n end",
"title": ""
},
{
"docid": "ff158daa... |
21e0ef116dfa8b19156a42b5cdde8aa7 | GET /damage_immunities GET /damage_immunities.json | [
{
"docid": "fedd929b378aec8490d2511df910cc05",
"score": "0.7363589",
"text": "def index\n @damage_immunities = DamageImmunity.all\n end",
"title": ""
}
] | [
{
"docid": "370a648c3fd8d239b784ff37c8ff7468",
"score": "0.65608436",
"text": "def set_damage_immunity\n @damage_immunity = DamageImmunity.find(params[:id])\n end",
"title": ""
},
{
"docid": "ed696b4e4ea88bf98233b64d5022a83c",
"score": "0.63080543",
"text": "def index\n @d... |
c6b9a22e85591ae2f80709da5898ed2b | Default frame is 1.0f | [
{
"docid": "11d5c100de469cb4033ac008a32efb65",
"score": "0.7430956",
"text": "def frame\n (@frame || 1).to_f\n end",
"title": ""
}
] | [
{
"docid": "668b5d46084b6cfbd0a6505d883926c7",
"score": "0.7066872",
"text": "def frame\n @rad.frame(0)\n end",
"title": ""
},
{
"docid": "0253d18aee9c1318a080f90f5631c8f2",
"score": "0.68503714",
"text": "def tenth_frame; end",
"title": ""
},
{
"docid": "1623e142326c... |
ba9bb918470bd24ccb5ca321adc0e03a | Fetches a photo by its ID | [
{
"docid": "9bd54a75f3011e0e5bb4bb7eb4fead80",
"score": "0.73079616",
"text": "def get_photo(photo_id)\n Rails.cache.fetch(generate_photo_cache_key(photo_id:), expires_in: 1.month) { client.photos.getInfo(photo_id:) }\n end",
"title": ""
}
] | [
{
"docid": "9be52323af2b7debced69596db1fd716",
"score": "0.74292606",
"text": "def fetch_image_by_id(image_id)\n configure_connection\n Instagram.media_item(image_id)\n end",
"title": ""
},
{
"docid": "36bd38c30726e9cbe49b7fab5f95e098",
"score": "0.7403492",
"text": "def... |
eb3b6631900e2f37e039cfd4ffeba736 | posts a preformatted message to your Slack instance | [
{
"docid": "fbaa719db1ae2329f70eb9f74ad6f060",
"score": "0.6112439",
"text": "def post_to_slack(payload)\n\t\n\t\t# set your slack incoming webhook URL in local_env.yml (for local testing) and as a Heroku config variable (see README)\n\t\t# it looks like \"https://teamname.slack.com/services/hooks/incom... | [
{
"docid": "3218768d1bd4bab10b9eefedbe1948fd",
"score": "0.76103985",
"text": "def send\n slack_notifier.post message\n end",
"title": ""
},
{
"docid": "6f98adfbba11acce039ffb24bb685c4c",
"score": "0.7247061",
"text": "def post_to_slack\n blocks = GamePresenter.new(self).t... |
e3e13a0b263e5dd7d5fecd69fc61a524 | GET /loans/1 GET /loans/1.json | [
{
"docid": "a81945373733e4951b987de6ea99f9a1",
"score": "0.0",
"text": "def show\n end",
"title": ""
}
] | [
{
"docid": "a78d66e835b8f13d4f39b1c558977836",
"score": "0.7296866",
"text": "def index\n #@loans = Loan.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @loans }\n end\n end",
"title": ""
},
{
"docid": "98980591aec5168679b6ea6be7... |
8c7da1337fd3ec2ea99e07d62da33edb | GET /devices GET /devices.json | [
{
"docid": "1f66c5c063c15166a60a2af30dbb5460",
"score": "0.6443995",
"text": "def index\n @user = User.find_by_id(params[:user_id])\n\n if @user == nil\n @devices = Device.where(user_id: current_user.id)\n skip_authorization\n elsif @user != nil\n @devices = Device.where(user_id:... | [
{
"docid": "edf996dbe2aecaff1221c26007b9e88e",
"score": "0.85539824",
"text": "def get_devices\n request(:get, client_api_latest, '/devices')\n end",
"title": ""
},
{
"docid": "330241349a3f63a4f19fa188871a5381",
"score": "0.8040384",
"text": "def read_devices\n return 200, @... |
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "7a4a78adffe9341b7fdec9332fdcb3b2",
"score": "0.0",
"text": "def set_agenda_entry\n @agenda_entry = AgendaEntry.find(params[:id])\n @event = @agenda_entry.event\n end",
"title": ""
}
] | [
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60315156",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.6018921",
"text": "de... |
91f8963bf707812eff622d348203a067 | GET /tryings/1 or /tryings/1.json | [
{
"docid": "a81945373733e4951b987de6ea99f9a1",
"score": "0.0",
"text": "def show\n end",
"title": ""
}
] | [
{
"docid": "a44bc3ecb40ed8fbf0014beaf679a0e8",
"score": "0.6167203",
"text": "def index\n @tryings = Trying.all\n end",
"title": ""
},
{
"docid": "71745e90072425352df2106ba29e1122",
"score": "0.6009976",
"text": "def show\n @try = Try.find(params[:id])\n\n respond_to do |fo... |
6ece72bf28e42bb999da050c590d2078 | A list of all the artists in a user's library, with play counts and tag counts. | [
{
"docid": "d17adc24489bcae9721ebc163a9710cf",
"score": "0.7100879",
"text": "def artists(options={})\n call_pageable('library.getartists', :artists, Artist, {:user => @user.name}.merge(options))\n end",
"title": ""
}
] | [
{
"docid": "4ec7e0a136fac04cfefdbb88d61ba437",
"score": "0.7343978",
"text": "def artists\n artists = []\n self.songs.each do |song|\n artists << song.artist\n end\n artists.uniq\n end",
"title": ""
},
{
"docid": "6a76dd6338fc1216efef51189f85acbb",
... |
80aec86849dbe805fbf6319d36a5c5f0 | INSTANCE METHODS The plan_str returns a string that represents the name of the subscription plan. | [
{
"docid": "22457b8e65d4a91b1033775d868634dd",
"score": "0.78994644",
"text": "def plan_str\n case self.stripe_plan_id\n when PLAN_OPTIONS[:bronze][:plan_id]\n PLAN_OPTIONS[:bronze][:label]\n when PLAN_OPTIONS[:silver][:plan_id]\n PLAN_OPTIONS[:silver][:label]\n when PLAN_OPTIONS[:... | [
{
"docid": "4f72677723d30345b328b1902061852d",
"score": "0.8188221",
"text": "def subscription_plan_name\n if subscription and subscription.plan\n subscription.plan.name\n else\n PlanNames::Free\n end\n end",
"title": ""
},
{
"docid": "34aaecdd9287b6dfb9f680d76eab499a",
... |
f60f1bc3f69e4f7a30a9bd36c4909585 | Creates a new Hash by modifying the entries of the user hash | [
{
"docid": "4c9ea6becd1bd016b1ff99d2866ea03e",
"score": "0.5477867",
"text": "def transform_users\n Hash[@users.map { |name, entry| [name.intern, (yield name, entry)] }]\n end",
"title": ""
}
] | [
{
"docid": "ae4e1ab318c36238f44c6e25a054f8ff",
"score": "0.6674517",
"text": "def create_version_hash\n new_version = {}\n new_version['created'] = ''\n new_version['message'] = ''\n new_version['user'] = {}\n # user is #name, # address.\n new_version['user']['name'] = ''\n... |
e561e11bcf379ef5dc139c210017366b | Only allow a list of trusted parameters through. | [
{
"docid": "0eed7f979bfb27cbf3ff7470f21e8d70",
"score": "0.0",
"text": "def post_params\n params.require(:post).permit(:content, :visibility)\n end",
"title": ""
}
] | [
{
"docid": "3663f9efd3f3bbf73f4830949ab0522b",
"score": "0.7476646",
"text": "def whitelisted_params\n super\n end",
"title": ""
},
{
"docid": "36956168ba2889cff7bf17d9f1db41b8",
"score": "0.7168696",
"text": "def set_param_whitelist(*param_list)\n self.param_whitelist =... |
b4b5a20a9f07bcc3c10e9676c9baf403 | Delete collection Delete n collection | [
{
"docid": "fe67d24dfbbb082fed4d64ffbb1e78ce",
"score": "0.0",
"text": "def private_collection_delete(collection_id, opts = {})\n private_collection_delete_with_http_info(collection_id, opts)\n return nil\n end",
"title": ""
}
] | [
{
"docid": "4b745096f9a4968c5f28f56664ec4e03",
"score": "0.744133",
"text": "def delete(collection)\n delete_objects collection\n end",
"title": ""
},
{
"docid": "5c5140c2403cdf75423aabf89ab4621d",
"score": "0.70461404",
"text": "def delete(collection)\n @log.debug(\"D... |
090a66196e83f7ad6150033039bf2c57 | return the amount for item depends on the item quantity | [
{
"docid": "b4fe541fec942042c8e640cf5f378f82",
"score": "0.75004107",
"text": "def calculate_item_amount(quantity, price)\n if quantity < 1 || price < 0\n 0\n else\n quantity * price\n end\n end",
"title": ""
}
] | [
{
"docid": "cad5bcec24ee78bb2a93ce09b6658e73",
"score": "0.80186754",
"text": "def get_total_qty\n return self.items.sum(:qty)\n end",
"title": ""
},
{
"docid": "674301dec19c2c422f1a58b82485d5df",
"score": "0.7972597",
"text": "def total_quantity\n line_items.sum(:quantity)\n ... |
a892417400ee2af9871b620db02bb5c1 | DELETE /issues/1 DELETE /issues/1.json | [
{
"docid": "5ac68d410905d1c514d092d0a30dcba8",
"score": "0.0",
"text": "def destroy\r\n @issue.destroy\r\n\r\n respond_to do |format|\r\n set_issues_grid\r\n format.html { redirect_to redirect_url, notice: t('activerecord.success.messages.destroyed', model: Issue.model_name.human) }\r\n ... | [
{
"docid": "31e5a51b98ea334a62b796835e31f04b",
"score": "0.786422",
"text": "def destroy\n response = RestClient.delete $api_service+\"/claim_issues/\"+params['id']\n redirect_to :action => \"index\"\n end",
"title": ""
},
{
"docid": "4f2959648f00e7e240fdabd5f87a3278",
"score": "0... |
1675276dd93ec9b1ecbd9dd2298a51b5 | before_action :enforce_show_permissions, :only=>:show self.search_params_logic += [:add_access_controls_to_solr_params] | [
{
"docid": "657e06929ebfed37759e7a47fc3e576c",
"score": "0.0",
"text": "def index\n @page_title = \"All CoreFiles\"\n @results = CoreFile.order(updated_at: :desc)\n\n respond_to do |format|\n format.html { render :template => 'shared/index' }\n format.js { render :template => 'shared/... | [
{
"docid": "3a2b89d4e778c5367765e5e30d5af371",
"score": "0.7282803",
"text": "def add_access_controls_to_solr_params(solr_parameters, user_parameters)\n apply_gated_discovery(solr_parameters, user_parameters)\n end",
"title": ""
},
{
"docid": "847ede9b713fbac5ae41f4d2e122d9ae",
"scor... |
380f3b6deaff3c52a5cad7578f868543 | Floathash flt.hash => integer Returns a hash code for this float. | [
{
"docid": "a5e23f671dd691b971ea0c05c4dc4135",
"score": "0.0",
"text": "def hash\n end",
"title": ""
}
] | [
{
"docid": "29ff08a5b419846d31424e705628e601",
"score": "0.68954825",
"text": "def fnv_hash(bytes)\n hash = FNV_BASIS\n bytes.each_byte do |byte|\n hash = (hash ^ byte) * FNV_PRIME % 2**64\n hash -= 2**64 if hash >= 2**63 # simulate overflow of signed long\n end\n\n # c... |
10a1c0279b539190885cc4697efb88a7 | Attempts to place a word on the board | [
{
"docid": "73700cb44e1807f7462c7a03e70baff5",
"score": "0.0",
"text": "def attempt_score word, board, row, col, dir\n\t\t\tsum =0\n\t\t\tmultiplier = 1\n\t\t\tmore_sum = 0\n\t\t\textra_words = [word]\n\t\t\tword.each_char do |char|\n\t\t\t\tinvalid = invalid(board, char, row, col, dir)\n\t\t\t\treturn ... | [
{
"docid": "93d5d84038961cb15c172153ae3eed9e",
"score": "0.7641632",
"text": "def insert_word(word, x, y)\n for i in 0...word.length\n @grid[x][y+i] = word[i]\n end\n end",
"title": ""
},
{
"docid": "5ce51e06dd45f98bdb093f8d84a272be",
"score": "0.7608772",
"text": "def pl... |
dbb43fc94a506fbb27ae933bdad3c8cb | tells us what parameters we want to use when we create an album | [
{
"docid": "e22a91beba404208c00b6cc2db59a62f",
"score": "0.0",
"text": "def task_create_params\n params.permit(task: [:name, :description, :person_id])\n end",
"title": ""
}
] | [
{
"docid": "094e868da9a6372fc17790e66b6459b8",
"score": "0.7644854",
"text": "def create_album attributes\n perform_post(\"/me/albums\", attributes)\n end",
"title": ""
},
{
"docid": "c871badcab67a9ba2effc57a5320abe1",
"score": "0.74905896",
"text": "def create_an_album\n... |
fcd1b378c352c678a093b2fb012d7b8e | This function will capture the logs and output them to the report | [
{
"docid": "b5b1cc1a7981b0eeadbc9480e3cad0e5",
"score": "0.7397512",
"text": "def capture_logs(report_table)\n if report_table\n if Object.const_defined?(\"Rails\")\n log_folder = Rails.root.to_s\n if (log_folder =~ /\\/features\\/?$/ || log_folder =~ /\\/sp... | [
{
"docid": "973bab71d840a745eaa1253fa4cfef02",
"score": "0.729243",
"text": "def capture_logs(report_table = nil)\n if report_table\n if Object.const_defined?(\"Rails\")\n log_folder = Rails.root.to_s\n if (log_folder =~ /\\/features\\/?$/ || log_folder =~ /\\/spec\... |
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "9827ab4c2e491a77cd122f66b45c5efd",
"score": "0.0",
"text": "def set_com_compra\n @com_compra = ComCompra.find(params[:id])\n end",
"title": ""
}
] | [
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60326946",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.6015941",
"text": "de... |
8bdb7d2752670f171cb1b1ef7e29ee1e | Get the field size | [
{
"docid": "d8b9284e423a2a8ced3733c328a1e612",
"score": "0.0",
"text": "def fbe_size\n 4\n end",
"title": ""
}
] | [
{
"docid": "5b43a93b963f6ae84dcf5cacc31aff46",
"score": "0.9111969",
"text": "def size\n field_size\n end",
"title": ""
},
{
"docid": "9986dcc44f6d1323709e2a503c9acf3b",
"score": "0.83995366",
"text": "def field_size\n if self[:field_size].present? && self[:field_s... |
6c21846afefe602156943e66bab7ec66 | creates an edge Used to set new edges. If the edge is formative, then a node is also formed. | [
{
"docid": "3909dab799fea3dc98d0500dd641adc4",
"score": "0.59756994",
"text": "def make_edge(opts = {})\n data, _status_code, _headers = make_edge_with_http_info(opts)\n return data\n end",
"title": ""
}
] | [
{
"docid": "c65ea1fabeb7a0cc8accf6345df89273",
"score": "0.7876088",
"text": "def new_edge\n\t\t\traise NotImplementedError.new('#new_edge must be implemented')\n\t\tend",
"title": ""
},
{
"docid": "eebd86fdc639730a5dd98b4ce9546984",
"score": "0.76218265",
"text": "def new_edge(*args... |
4c57d967c9da795df4707ba989c1dbfd | Default Methods GET /areas GET /areas.json | [
{
"docid": "a5fd191eee625fa0552b69475fcbde9b",
"score": "0.6400712",
"text": "def index\n manage_filter_state\n init_oco if !session[:organization]\n if session[:organization] != '0'\n # OCO organization active\n @areas = Area.joins(:department).where(departments: { organiza... | [
{
"docid": "43cadf6f56887e6a77acba635e923259",
"score": "0.75910836",
"text": "def areas\n @area = Area.new(geo_json: params.to_json)\n if @area.save\n json_response([id: @area.id], :created, :geo_json_recieved)\n else\n json_response(nil, :error, :db_error)\n end\n end",
"tit... |
f0274e5fb95e4b13fbf95fadaba155e3 | Submits ads for review | [
{
"docid": "f091bd1b635cf9a468583f6b88f317dd",
"score": "0.0",
"text": "def moderate_ads(params)\n response = YandexDirect::V5::Request.new(self, @token, 'ads', 'moderate', params).perform\n @available_units = response[:available_units]\n response[:result]\n end",
"title": ... | [
{
"docid": "5193db4c79ba2509fa2c10944689a82b",
"score": "0.70781845",
"text": "def submitForReview\n @application = App.find(params[:app_id])\n @campaign = Campaign.find(params[:id])\n if (@campaign[:apk].nil?)\n redirect_to app_campaign_path(params[:app_id], params[:id]), :flash => { :not... |
b8d698587ad28c6c5950bf65651bfd45 | PATCH/PUT /time_slots/1 PATCH/PUT /time_slots/1.json | [
{
"docid": "52f6e4b7b9ceea0fa5c516564d48564b",
"score": "0.7613488",
"text": "def update\n respond_to do |format|\n if @time_slot.update(time_slot_params)\n format.html { redirect_to @time_slot, notice: 'Time slot was successfully updated.' }\n format.json { render :show, status: :... | [
{
"docid": "bd23911957a654d4134c529b06a5b919",
"score": "0.7709812",
"text": "def update\n if @time_slot.update(time_slot_params)\n render :show, status: :ok, location: @time_slot\n else\n render json: @time_slot.errors, status: :unprocessable_entity\n end\n end",
"title": ""
}... |
736112e864fb9097ce3b769a1285bceb | GET /business_types/new GET /business_types/new.xml | [
{
"docid": "803578c686a68631c48a2105c6375caf",
"score": "0.0",
"text": "def new\n admin_logged_in?\n \n @business_type = BusinessType.new\n end",
"title": ""
}
] | [
{
"docid": "35ad7c9c2d8c1b5fc54560c101b5d472",
"score": "0.7322145",
"text": "def new\n @type = Type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @type }\n end\n end",
"title": ""
},
{
"docid": "35ad7c9c2d8c1b5fc54560c101b5d47... |
06ed7ceb70a7d140379c24cee8f0e03b | GET /sorts/new GET /sorts/new.xml | [
{
"docid": "bcbcaccd7050eecb1068a6bb1f6332b3",
"score": "0.7334204",
"text": "def new\n\t\t@sort = Sort.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @sort }\n\t\tend\n\tend",
"title": ""
}
] | [
{
"docid": "e53e7098eeb04651b4347e2a4d09189f",
"score": "0.67566055",
"text": "def new\n @sortie = Sortie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sortie }\n end\n end",
"title": ""
},
{
"docid": "afa32f442b18aeb00d1ecc0e... |
cfe2df0117c7f493f6d29a36ad4c1303 | create workers after the server has been created. | [
{
"docid": "41cfde964e1aadb7bc58d867965d4063",
"score": "0.63231754",
"text": "def create_workers(number_of_instances, options = {}, user_id = 'unknown_user')\n defaults = {\n instance_type: 'm2.4xlarge',\n security_groups: [],\n image_id: nil, # don't prescribe the ima... | [
{
"docid": "a70ffe351391b28eaa8605f829777ee1",
"score": "0.74741477",
"text": "def init_workers(servers)\n @w = []\n servers.each{|s|\n @w << Worker.new(s)\n }\n end",
"title": ""
},
{
"docid": "2f46619d4bfc2cc67aec4db402be82b0",
"score": "0.7366232",
"text": "def crea... |
c2d8e70b458cfe38463027a591f1958f | GET /logistics/1 GET /logistics/1.json | [
{
"docid": "a81945373733e4951b987de6ea99f9a1",
"score": "0.0",
"text": "def show\n end",
"title": ""
}
] | [
{
"docid": "fa8f290b32b15307e590236cb9f3286b",
"score": "0.7435414",
"text": "def show\n @logistic = @user.logistics.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @logistic }\n end\n end",
"title": ""
},
{
"docid":... |
d31bb545a3f5315980ba3838325b333c | Adds a supported platform, with version checking strings. === Parameters platform,:: The platform (like :ubuntu or :mac_os_x) version:: A version constraint of the form "OP VERSION", where OP is one of >= ~> and VERSION has the form x.y.z or x.y. === Returns versions:: Returns the list of versions for the platform | [
{
"docid": "9ed5bd5fd73d813fda5b49229df15efb",
"score": "0.7676305",
"text": "def supports(platform, *version_args)\n version = new_args_format(:supports, platform, version_args)\n constraint = validate_version_constraint(:supports, platform, version)\n @platforms[platform] = constr... | [
{
"docid": "53348b30739b6ef85c650f6ec1ba00ba",
"score": "0.71394527",
"text": "def normalize_platform(platform, platform_version)\n if platform == \"solaris\"\n platform = \"solaris2\"\n\n # Here platform_version is set to either 10 or 11 and we would like\n # t... |
441f24551d2337c47eed27a26c594ead | the average score of a given style in the user's ratings | [
{
"docid": "e631e7423b04e4427606b8b08e9b7ff9",
"score": "0.7929227",
"text": "def style_average(style_id)\n\n # find out the which of the user's rated beers belong to a style\n style_specific_beers = beers.select(\"beers.id\").where(\"style_id = ?\", style_id).distinct\n\n # gather the ids of t... | [
{
"docid": "f36b0da9e3d29a8c8a5ae99cb5823438",
"score": "0.78127134",
"text": "def average_rating\n sum = 0\n self.ratings.each do |rating|\n sum += rating.score\n end\n avg = sum/self.ratings.length\n avg.to_f\n end",
"title": ""
},
{
"docid": "d0a8d569aef918329adb6cfcd... |
6d51f7bbb1f3ac77fe92e3e0f36052c4 | DELETE /kompanijas/1 DELETE /kompanijas/1.json | [
{
"docid": "34c0874faa82a09d8e31f1dfefcea14f",
"score": "0.7439259",
"text": "def destroy\n @kompanija = Kompanija.find(params[:id])\n @kompanija.destroy\n\n respond_to do |format|\n format.html { redirect_to kompanijas_url }\n format.json { head :no_content }\n end\n end",
"t... | [
{
"docid": "7452c4d15daf08108aaa5a1b728adb31",
"score": "0.7503479",
"text": "def destroy\n @json.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "b1a17c1ee1af05c79fe156622df44818",
"score": "0.7427686",
"text": "def delete(path)\n begin\n respon... |
b369729c0a8a490fa004c6bd0813fbec | DELETE /cd_admin/courses/1 DELETE /cd_admin/courses/1.json | [
{
"docid": "2a4b5a5da84b47b3f070a01aeb8637ec",
"score": "0.70537037",
"text": "def destroy\n @cd_admin_course.destroy\n respond_to do |format|\n format.html {redirect_to cd_admin_courses_url, notice: 'Course was successfully destroyed.'}\n format.json {head :no_content}\n en... | [
{
"docid": "128adfc7af8c789c00e8dc798f017c28",
"score": "0.74786675",
"text": "def destroy\n @course = Course.find(params[:id])\n @course.destroy\n render json: {success: \"ok\"}\n\n end",
"title": ""
},
{
"docid": "8b34eba501fe79793a5edff2602a7596",
"score": "0.7459175",
"... |
0cd29273d9bb99088f0fdaf55ee29fed | Deserialize the response to the given return type. | [
{
"docid": "25f1dd452a997f6a159c32dd747fc72f",
"score": "0.76340944",
"text": "def deserialize(response, return_type)\n body = response.body\n\n # handle file downloading - return the File instance processed in request callbacks\n # note that response body is empty when the file is writte... | [
{
"docid": "0ea8c3ae4bacf50e7c561391b88feb6d",
"score": "0.7871214",
"text": "def deserialize(response, return_type)\n body = response.body\n return nil if body.nil? || body.empty?\n\n # return response body directly for String return type\n return body if return_type == 'String'\n\n... |
efd8ffc807c8ec9dad3d965e4f0156e7 | Adds SCheduleSMS provisioning object to a product | [
{
"docid": "7a8dae963d22a0dfb8c1d8f6f90eb6a5",
"score": "0.575496",
"text": "def postProductProvisioningSchedulesms( product_id, package)\n params = Hash.new\n params['product_id'] = product_id\n params['package'] = package\n return doCurl(\"post\",\"/product/provisioning/schedulesms\",param... | [
{
"docid": "f7d01b033e72a5c683371d24f9d7980a",
"score": "0.5848122",
"text": "def set_scheduled_product\n @scheduled_product = ScheduledProduct.find(params[:id])\n end",
"title": ""
},
{
"docid": "7b0399a09adab8a4ae76560a51203528",
"score": "0.55163157",
"text": "def provisio... |
cf4603fd351f062f2fd50b0d8b62e35c | returns a hash with key as the prime factor and val as the power of that factor | [
{
"docid": "14ef725c793a520328cc3dfae05df418",
"score": "0.6995081",
"text": "def as_powers_of_prime_factors(num)\n factors = Hash.new\n factors[1] = 1\n \n i = 2 \n while num > 1\n factors[i] = 0\n while num%i == 0\n num/=i\n factors[i] += 1\n ... | [
{
"docid": "f5e2de18084a23cc2860ac67d776f5df",
"score": "0.69061273",
"text": "def calculate_hash(val)\n return ((val ** 2000) * ((val + 2) ** 21) - ((val + 5) ** 3))\n end",
"title": ""
},
{
"docid": "97b3822428899dea3705bc1332092645",
"score": "0.6875051",
"text": "def prime_de... |
ed714fa63e73664f0bfeb98d90adca7a | This method adds an +after_validation+ callback. ==== Parameters +polymorphic_association_name+ Name of the tree polumorphic association with container and component as the name of polymorphic attributes +type+ The component type in which to look for collection +collection_name+ The association name that should be used... | [
{
"docid": "57f7dfcebe0db97cd1b221107c371891",
"score": "0.70403355",
"text": "def validates_uniqueness_in_memory_for_tree_polymorphism(polymorphic_association_name, type, collection_name, attribute, options = {})\n after_validation do\n validate_unique_nested_attributes_for_tree_polymor... | [
{
"docid": "e851d73bdfaefde545821a29811d6255",
"score": "0.58034647",
"text": "def validate_unique_nested_attributes_for_tree_polymorphism(parent, polymorphic_association_name, type, collection_name, attribute, options = {})\n types_with_collection = find_types_and_all_collections(parent, polymor... |
5c84e3bf21158a529b309aa587e9fc28 | Method used when called from a submit of the welcome page. It redirects to the show method. | [
{
"docid": "cc8354e8334eff7dfadf0513ee4d5cad",
"score": "0.0",
"text": "def create\n redirect_to file_changes_path(params[:file].strip)\n end",
"title": ""
}
] | [
{
"docid": "0471d454ca905536233f04a2757a3334",
"score": "0.7552003",
"text": "def show\n\t\tredirect_to root_path\n\tend",
"title": ""
},
{
"docid": "f07a63468e3c6871d96df8a53e84edec",
"score": "0.7492995",
"text": "def show\n\tredirect_to root_path\n end",
"title": ""
},
{
... |
8cc905de01f744c540665ec11deb53e3 | Append _id to 'type' i.e. :resource > :resource_id | [
{
"docid": "b5e420998c83728c908da370e46d6c8d",
"score": "0.7218396",
"text": "def representative_id_for_type(type)\n type.to_s.concat('_id').to_sym\n end",
"title": ""
}
] | [
{
"docid": "5248f333059b8c00c3caa3cb6f76b247",
"score": "0.74729466",
"text": "def idtype\n @idtype ||= \"#{id}:#{type}\"\n end",
"title": ""
},
{
"docid": "489f4fc83042b0e0e9e613d360983c15",
"score": "0.7342732",
"text": "def resource_type_and_id\n \"#{resource_type}-#{resour... |
53292a79ac7d328aad1aef1b01570899 | Convenience method to find all upcoming opponents | [
{
"docid": "a6f5c586f41b6ce83b3fc9ee51a9dbb0",
"score": "0.7542626",
"text": "def opponents\n\t\t# Find all current opponents in the mix\n\t\tret = []\n\t\tself.team1_games.each do |g|\n\t\t\tret << g.team2\n\t\tend\n\t\tself.team2_games.each do |g|\n\t\t\tret << g.team1\n\t\tend\n\t\tret\n\tend",
"... | [
{
"docid": "86e67748c82b37a5404819700a9a5629",
"score": "0.7485621",
"text": "def opponents\n Game.world[:players].select {|p| p != self}\n end",
"title": ""
},
{
"docid": "1db208b4a66886268b12dbb49de3083f",
"score": "0.74221826",
"text": "def get_opponents\r\n #First, get the... |
9c6783e9d0784e19c510b7dcedf55b78 | gets the license that the app is licensed under | [
{
"docid": "9ebc2b09c5665c2d4dea609bbe1b2a24",
"score": "0.7906041",
"text": "def license\n conf['license'] || proj.license\n end",
"title": ""
}
] | [
{
"docid": "7ec3449682ef5d3a1c27c0213773ba5f",
"score": "0.7972301",
"text": "def license\n read_property 'License'\n end",
"title": ""
},
{
"docid": "df967b6e531e090b64845e8e38f4904e",
"score": "0.793698",
"text": "def license\n File.read file_path('LICENSE') if license?\... |
1ff814ea5d60741bae05345921a4bbe8 | GET /entries GET /entries.json | [
{
"docid": "c7c062412c3dbc24b2d00286e0d7088d",
"score": "0.0",
"text": "def index\n @entries = Entry.all.order(\"id DESC\")\n @nowPlayingsLists ||= initializeNowItem()\n @popularLists ||= initializePopularitem()\n\n /------------do report-------------/\n if (params[:report]=='1')\n p... | [
{
"docid": "b6b93dc022ed0d53ef0d20859d99112b",
"score": "0.787958",
"text": "def entries opts = {}\n get :entry, opts\n end",
"title": ""
},
{
"docid": "375b5b4634fbcf282593112630b69413",
"score": "0.76972723",
"text": "def index\n @entries = Entry.all\n\n render json: ... |
e052355c5aa08b55f1a8b04db7b1df82 | POST /facebook_blasts POST /facebook_blasts.json | [
{
"docid": "6fd2a7f77a8e61e1c909245d64490972",
"score": "0.7647311",
"text": "def create\n @facebook_blast = FacebookBlast.new(params[:facebook_blast])\n\n respond_to do |format|\n if @facebook_blast.save\n format.html { redirect_to @facebook_blast, notice: 'Facebook blast was successf... | [
{
"docid": "55de6352120c91f25be56147aca4039b",
"score": "0.6948374",
"text": "def create\n @blast = Blast.new(params[:blast])\n @blast.start_at = Time.now\n @blast.owner_id = current_user.id\n @blast.status = \"pending\"\n\n respond_to do |format|\n if @blast.save\n format.htm... |
949b231b03c9c57377c00e3affbc51e3 | POST /cards POST /cards.json | [
{
"docid": "19cc067de31e780f3f7715258e521571",
"score": "0.69978523",
"text": "def create\n @card = Card.new(card_params)\n\n respond_to do |format|\n if @card.save\n format.html { redirect_to @card, notice: 'Card was successfully created.' }\n format.json { render :show, status... | [
{
"docid": "485dc5ecb6f8ae7217f5a9d9ecc8eb72",
"score": "0.76207536",
"text": "def create\n @card = Card.create(card_params)\n render json: @card\n end",
"title": ""
},
{
"docid": "416ebdf1407f75ace9420c2735ccdf80",
"score": "0.7468143",
"text": "def create\n @card = Card.n... |
dc587e1f8ea2e17770f4fab2e355ab36 | Provides the type of the DB cluster snapshot. | [
{
"docid": "d0875ac4c148cb251130675365112945",
"score": "0.8072514",
"text": "def snapshot_type\n data[:snapshot_type]\n end",
"title": ""
}
] | [
{
"docid": "c993e046adf828838aee86918c0a66b7",
"score": "0.81113535",
"text": "def snapshot_type\n @snapshot_type\n end",
"title": ""
},
{
"docid": "6a809e6a009660ff8c9e7eec014237b6",
"score": "0.7120947",
"text": "def snapshot_type=(value)\n @snapshot_type = value\n ... |