query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
6eaaaadcbb7741a0f844fb5ba4332566
GET /sections/1 GET /sections/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "10d9d4f2c8964e30ebc2af07d1542af4", "score": "0.7490356", "text": "def sections\n title = params[:id]\n page = Page.new(title)\n sections = page.sections\n respond_with sections\n end", "title": "" }, { "docid": "79e79aacb0453d37f1a43e560e4bb6dc", "score": "0.7440...
90712335c2493451d00ef2d0a91535a5
Get the count of matching documents in the database for the context.
[ { "docid": "b6d106a4cd9567cee1012e955849e4c4", "score": "0.0", "text": "def count(extras = false)\n if extras\n self.total\n else\n super()\n end\n end", "title": "" } ]
[ { "docid": "b59bb4eb758abe120fa52218357bce53", "score": "0.72153544", "text": "def count\n find().count\n end", "title": "" }, { "docid": "fcb525b871fad7d416b90cb495e301e9", "score": "0.71755373", "text": "def count\n documents.length\n end", "title": "" }, ...
1705fe103c6d864558b31bc635eb67ae
An object that will track the current size of the stack and the maximum size of the stack for this instruction sequence. source://syntax_tree//lib/syntax_tree/yarv/instruction_sequence.rb163
[ { "docid": "7b0c83a4d6a320271517b44bfe0ab629", "score": "0.6096078", "text": "def stack; end", "title": "" } ]
[ { "docid": "7c6784af8cc226f480eff779a8abebf7", "score": "0.7734198", "text": "def stack_size; end", "title": "" }, { "docid": "e130c2e31ccc29c818516136004d063e", "score": "0.7282221", "text": "def size\n @current_block.instance_eval { @stack }\n end", "title": "" }, {...
ce3e390338516b3995d000251e174485
Transaction request enables caller to execute public methods on this object provider.transaction_request(self) do |prov| prov.provider_method(params) prov.special_provider_method_that_needs_a_callback(callback, params) end
[ { "docid": "36ef337a83f001600955cdb0c4c652a5", "score": "0.60759556", "text": "def transaction_request(callback, &block)\n block.call(self)\n Rails.logger.debug \"transaction_request(Complete) for #{callback.class.name}\"\n true\n rescue Exception => e\n Rails.logger.debug \"tra...
[ { "docid": "20092424c3c910b6e8285fa26f174d5f", "score": "0.5769548", "text": "def get_transaction(*params); raise('Stub or mock required.') end", "title": "" }, { "docid": "278f7a95f6f58d266bbd840858c3ea10", "score": "0.5696927", "text": "def transaction(&block)\n @fb_txns << Ruby...
4a15f1f4de015a0d02097cc2ab890421
generates the return url for file submissions
[ { "docid": "7c482c1021c5dd35499611c3886300b2", "score": "0.659824", "text": "def file_content_return_url(url, text, content_type = nil)\n url = CGI::escape(url)\n text = CGI::escape(text)\n content_type = CGI::escape(content_type) if content_type\n\n return_url = \"#{...
[ { "docid": "66a9aa7bce36ec88b027f47c7d5eb5ad", "score": "0.68675643", "text": "def file_url\n end", "title": "" }, { "docid": "d32709e5c1ffe2520d0683f75c0cfc1a", "score": "0.6592359", "text": "def file_link\n return \"#{SITE_URL}system/ufiles/#{id}/original/#{ufile_file_name}\"\n...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "fc71bd823f6bf7664991934d568a7866", "score": "0.0", "text": "def set_listing\n @listing = Listing.find(params[:id])\n @amenities = Amenity.all\n @rules = Rule.all\n @pictures = @listing.pictures\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;...
d0df87b1bea9b55706b1c7c4184cdaba
PATCH/PUT /posts/1 PATCH/PUT /posts/1.json
[ { "docid": "0fef7c5e43b365c7d4cb09d256bb46ae", "score": "0.0", "text": "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @post }\n ...
[ { "docid": "34c10c4557f689baa30ce671828a8692", "score": "0.7019827", "text": "def update\n @api_v1_post = Post.find(params[:id])\n params[:post].delete :created_at\n params[:post].delete :updated_at\n respond_to do |format|\n if @api_v1_post.update_attributes(params[:post])\n for...
65de64c2e5f966a63452daaaa1d6fbe6
Download a locale in a specific file format. API Path: /api/v2/projects/:project_id/locales/:id/download == Parameters: project_id:: project_id id:: id params:: Parameters of type PhraseApp::RequestParams::LocaleDownloadParams == Returns: err
[ { "docid": "6e19b64f158d63008f39096e7557d5d5", "score": "0.8295837", "text": "def locale_download(project_id, id, params)\n path = sprintf(\"/api/v2/projects/%s/locales/%s/download\", project_id, id)\n data_hash = {}\n post_body = nil\n \n if params.present?\n unless params.k...
[ { "docid": "3fa1dc58c192ffbebea9b857338a0e30", "score": "0.76761", "text": "def locale_download(project_id, id, opts = {})\n data, _status_code, _headers = locale_download_with_http_info(project_id, id, opts)\n data\n end", "title": "" }, { "docid": "de9098689b9b5f225c8a3fdb1c05...
5fb0b11ae7f77ae76636d19472e6f968
GET /cities/1 GET /cities/1.json
[ { "docid": "f7ff3088411c11b4d7c60701c938c300", "score": "0.0", "text": "def show\n # @city = City.find(params[:id])\n @city = City.friendly.find(params[:id])\n end", "title": "" } ]
[ { "docid": "03992d4cf22850c18ff973fb98dd09e6", "score": "0.7298952", "text": "def index\n @cities = City.all\n\n render json: @cities\n end", "title": "" }, { "docid": "e985ae83b9e7b9086fb4ba42e6ceb68a", "score": "0.72530884", "text": "def index\n @cities = City.where(state...
928cf8a4556dc0459b497c01bb333949
sort the array by week
[ { "docid": "f4b7d0c88e1863d8b393f8936cb5a7bd", "score": "0.7751466", "text": "def sort_array_by_week(date_and_snippet_array)\n\treturn date_and_snippet_array if date_and_snippet_array.size <= 1\n\tswapped = true\n\twhile swapped do\n\t\tswapped = false\n\t\t0.upto(date_and_snippet_array.size-2) do |i|\n...
[ { "docid": "380d8942538c5b4975e1486fdca63fe6", "score": "0.7208512", "text": "def sorted_commits_by_week\n sort_array = create_active_date_array(@began.date, @latest_commit.date)\n mapped_commits_array = Array.new(sort_array.size).map {|a| a = []}\n for commit in @commits.reve...
bb52a8065eb63aa4f57745df153ce2fc
Identify and describe the Ruby method(s) you implemented. Person 3
[ { "docid": "e95da42dbcdd0b1cb1a96f72d2b592e5", "score": "0.0", "text": "def my_array_sorting_method(source)\n source.sort {|x,y| x.to_s <=> y.to_s }\nend", "title": "" } ]
[ { "docid": "f4ad13bf5fa71b1e7bc47220336ffdbf", "score": "0.7190859", "text": "def methods() end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.7060052", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd7...
86c345f1e164ba6e6d9468b1957b8841
can_capture?(pieces : ChessPiece[], destination: Position) Checks if a square contains a piece of opposite color
[ { "docid": "7794c698026cdb3c472620a69f1c29d1", "score": "0.8753309", "text": "def can_capture?(_pieces, _destination)\n destination_piece = _pieces.find { |p| p.position.equals?(_destination) }\n\n !destination_piece.nil? && destination_piece.color != color\n end", "title": "" } ]
[ { "docid": "662950d677b98a6ff22e87c773c8b2aa", "score": "0.7031691", "text": "def capture_piece(p_moves, opp_pieces, board)\n # check if opponent piece is in the square\n opp_piece = get_piece(p_moves[1], board)\n # capture and remove piece\n opp_index = opp_pieces.find_index { |piece| piece...
3010abe96a4bcbbadf221a8965fd92f6
Print entries of a table with labels from the mask. The column specified as special_pos is printed underneath the label from the mask.
[ { "docid": "c1e32d7d6776ff7146a02fbc3f9e0487", "score": "0.78829527", "text": "def pretty_print(mask, table, special_pos)\n for i in 0..table.size-1 do\n for j in 0..mask.size-1 do\n puts(mask[j] + \": \" + (if j==special_pos then \"\\n\" else \"\" end) + table[i][j].to_s)\n end\n puts(\"...
[ { "docid": "5b4074ec96215749eaf471ec9df68e1d", "score": "0.7094334", "text": "def pretty_strings(mask, table, special_pos)\n pretty_strings = [];\n for i in 0..table.size-1 do\n string = \"\";\n for j in 0..mask.size-1 do\n string = string + mask[j] + \": \" + (if j==special_pos then \"\\n\...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "b5d9bbd023c34828d5aac75c564af296", "score": "0.0", "text": "def answer_params\n params.permit(:answer, :question_id , :user_id)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whit...
b0e47890c314358020c16adc54fca4de
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Menu OPTION 2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ { "docid": "7224f2e2ec754e2a654be7b85fb94829", "score": "0.0", "text": "def create_story\n puts ''\n puts 'What is the name of your new story?'\n input = gets.chomp\n s = Story.find_or_create_by(story_name: input, user_id: @user.id)\n @user = User.find(@user.id)\n puts ''\n puts \"Y...
[ { "docid": "50cfa32bd4075d190ea1f7160719068d", "score": "0.72473437", "text": "def second_case_menu(selection)\n case selection\n when 'Export To File'\n export_to_file\n when 'Back'\n menu = Menu.new(@user)\n menu.menu_router\n end\n end", "title": "" }, { "docid...
aced2b55d3403f055eacd9726e8a5a32
def obj.one_arg(x) puts "I can take zero or more arguments!" end puts obj.one_arg(1,2,3) dealing with at least two but potentially more arguments
[ { "docid": "b8490ff769c7409d493f8ea6505731dc", "score": "0.7136377", "text": "def two_or_more(a,b,*c)\n puts \"I require two or more arguments!\"\n puts \"And sure enough, I got: \"\n p a, b, c\nend", "title": "" } ]
[ { "docid": "0ad0a3b8bb932b87e60b23d92e979eb3", "score": "0.74152863", "text": "def func4(*args)\n if args.length==0\n puts \"no arguments\\n\"\n elsif args.length==1\n puts (\"one arguemnet = \"+args[0]+\"\\n\")\n elsif args.length>1\n puts (\"more than arguments\")\n puts args\n end\nen...
ac7459fa7ff2dcdbfec9206d58931cff
Deletes recent rows based on timestamp, but also allows filtering by an auxilary timestamp column for the case where the primary one is not indexed on the target (such as the DFR reports, where imported_at is not indexed, but reporting date is).
[ { "docid": "965d8d2b9fca35a09a4b426912881edb", "score": "0.632187", "text": "def delete_recent(plan, since)\n ensure_connection\n query = db[plan.table_name].\n filter(\"#{plan.timestamp} > ?\", since)\n\n if plan.aux_timestamp_column\n query = query.filter(\n \"#{p...
[ { "docid": "785e09a61ddfd84445c08adb0dea9af8", "score": "0.5907368", "text": "def filter_timestamps(schema)\n schema.reject { |item| ['created_at', 'updated_at'].include?(item[0]) }\n end", "title": "" }, { "docid": "23a1cabeecb9f9b68ea4378d64f1b076", "score": "0.58840424", "text...
a7570219973eb3a6c6162310a472aee5
GET /serie_cronologicas/1 GET /serie_cronologicas/1.xml
[ { "docid": "ad9ce7644b240a2f609e4aa6f319b212", "score": "0.6666567", "text": "def show\n @serie_cronologica = SerieCronologica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @serie_cronologica }\n end\n end", "title": "" ...
[ { "docid": "cf95e9fa4dbd86d822b58edc9f6426bf", "score": "0.6492539", "text": "def show\n @cronjob = Cronjob.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cronjob }\n end\n end", "title": "" }, { "docid": "796140...
889a4c97bdbfaf1e5853d07274725387
Parses the options Hash and returns an array of [SSH_PORT, WINRM_PORT] used to attempt to connect to.
[ { "docid": "d25687db6a987b469d39f8189ddddd29", "score": "0.78055066", "text": "def parse_port_options(options)\n ssh_port = options[:ssh][:port] if options[:ssh]\n winrm_port = options[:winrm][:port] if options[:winrm]\n [ssh_port || DEFAULT_SSH_PORT, winrm_port || DEFAULT_WINRM_POR...
[ { "docid": "bbbc34ae00075e100b21593570ffecc3", "score": "0.6795421", "text": "def ssh_options(options)\n mapped_options = options.map do |key, value|\n next if value.nil?\n\n case key\n when :auth_methods then opt_auth_methods(value)\n when :bind_add...
31dd4556503218506aa1ddaf8a501de0
Returns a list of a user's favorite activities.
[ { "docid": "45b56233656b926ba2208ca727173d22", "score": "0.8642434", "text": "def favorite_activities(opts={})\n get(\"user/#{@user_id}/activities/favorite.json\", opts)\n end", "title": "" } ]
[ { "docid": "aca68311c9664a88804606000490aba3", "score": "0.8876303", "text": "def favorite_activities\n get(\"user/#{user_id}/activities/favorite.json\")\n end", "title": "" }, { "docid": "ffec7257638c56309a08704167824272", "score": "0.8655928", "text": "def favorite_activiti...
5ca4ce846c0ff83d364495b838e4c93b
Build a method, team_names, that operates on the game hash to return an array of the team names.
[ { "docid": "42db1b7b422a362d02b25a1b64aa40ff", "score": "0.74263257", "text": "def team_names\n team_names = []\n for location in game_hash.keys\n team_names.push(game_hash[location][:team_name])\n end\n return team_names\nend", "title": "" } ]
[ { "docid": "b4c0ef94bea4cbab5501967a23aa7029", "score": "0.77298486", "text": "def team_names\n # built an empty array called teams\n teams = []\n # game_hash.each do |team, random| iterates over the hash to return all of the team_names\n game_hash.each do |team, random|\n teams.push(game_hash[...
9c9b1f5095bd727fafc8c8c88a540341
returns array of moves possible that wouldn't involve taking another piece
[ { "docid": "2e056fe9ec3ccc0bd9c90e5692413404", "score": "0.7494988", "text": "def get_moves(pieces)\n\t\tarrPos = []\n\t\tupRight, upLeft, downRight, downLeft = true, true, true, true\n\t\tfor i in 1..7\n\t\t\tupRight = false if square_is_taken?(pieces, [@xCord + i, @yCord + i])\n\t\t\tupLeft = false if...
[ { "docid": "a5259ad8fa9a3df5803fc756022c71b8", "score": "0.82944024", "text": "def possible_moves\r\n moves = []\r\n @reach.downto(-@reach) {|num| moves << num}\r\n moves = moves.repeated_permutation(2).to_a\r\n moves = apply_directions(moves)\r\n moves = apply_location(moves)\r\n move...
b747c4c805af477cca85bd3dbbe15658
On converti les celsius en farenheits en utilisant des floats
[ { "docid": "04becc6d13472cae8a03a691170a6c38", "score": "0.59734887", "text": "def ctof(tempc)\n\ttempf = (tempc * 9 / 5.0) + 32\n\treturn tempf\nend", "title": "" } ]
[ { "docid": "c6026b3ac3a6831d85d9625d917a43ab", "score": "0.6894957", "text": "def convert(temp_in_fahrenheit)\n (temp_in_fahrenheit.to_f - 32) * 5/9\nend", "title": "" }, { "docid": "fadab8148e623791e3bd60372eb7b655", "score": "0.6882309", "text": "def convert_temp(value, fromUnits...
75ca3b14e56be1923daeb96c7032eba3
Cleans Certificate and enable autosign. This is run as a before_filter for provisioning templates. The host is requesting its build configuration so I guess we just send them some text so a post mortum can see what happened
[ { "docid": "5277790422a5f6c0be66a56229fa1992", "score": "0.6877576", "text": "def handle_ca\n # The reason we do it here is to minimize the amount of time it is possible to automatically get a certificate\n\n # We don't do anything if we are in spoof mode.\n return true if @spoof\n\n # This ...
[ { "docid": "5d15a7f45a7cc3ef0b24452427bb44ce", "score": "0.6563517", "text": "def autosign\n return unless auto = autosign?\n\n store = nil\n if auto != true\n store = autosign_store(auto)\n end\n\n Puppet::SSL::CertificateRequest.search(\"*\").each do |csr|...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "de562848e5cfcea7e6be7a43c0aab754", "score": "0.0", "text": "def subject_params\n params.require(:subject).permit(:name, :summary, :user_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"...
69b9e297e2466431c75b6eaa35abbbbe
POST /teleproviders POST /teleproviders.json
[ { "docid": "6d8c123b038bbb58b603801818b18d8c", "score": "0.72191197", "text": "def create\n @teleprovider = Teleprovider.new(teleprovider_params)\n\n if @teleprovider.save\n respond_with(@teleprovider, location: teleproviders_url, notice: 'Teleprovider was successfully created.')\n else\n ...
[ { "docid": "ca8f5f835be04ca58255e81c6673caf6", "score": "0.63530636", "text": "def teleprovider_params\n params.require(:teleprovider).permit(:name, :apn)\n end", "title": "" }, { "docid": "073235db8bb3af893538ccccf1cd298d", "score": "0.6065372", "text": "def create\n @telecre...
4b1e12e33668f3a8e41f614275748106
PUT /tasks/1 PUT /tasks/1.json
[ { "docid": "bfb8b12a1a3379df3e6344f57d81d0a3", "score": "0.66440296", "text": "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n forma...
[ { "docid": "8626542611c0376934f5646142b41bf4", "score": "0.75740594", "text": "def update\r\n @tasks = Task.find(params[:id])\r\n if @tasks.update(task_params)\r\n render json: @tasks\r\n else\r\n render json: @tasks.errors, status: :unprocessable_entity\r\n ...
90f76dc55dfa96f9d1fec17ccea50b54
Support methods for deep transforming nested hashes and arrays. source://activesupport//lib/active_support/core_ext/hash/keys.rb116
[ { "docid": "cd66bc5ce6d83c9fc9323a65f3053e5a", "score": "0.70298105", "text": "def _deep_transform_keys_in_object(object, &block); end", "title": "" } ]
[ { "docid": "95d01147445adbc7f5dda74f811ef9c4", "score": "0.7984353", "text": "def deep_transform_keys!(&block); end", "title": "" }, { "docid": "95d01147445adbc7f5dda74f811ef9c4", "score": "0.7984353", "text": "def deep_transform_keys!(&block); end", "title": "" }, { "doc...
7647ad9a7b0b57c0b7bccb86f3235eb9
GET /body_style_product_features/1 GET /body_style_product_features/1.json
[ { "docid": "97633f02ab9e939c7d56282c39e8e5de", "score": "0.7998897", "text": "def show\n @body_style_product_feature = BodyStyleProductFeature.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @body_style_product_feature }\n end\n ...
[ { "docid": "52378f20efd34846b02cc2e6657563ec", "score": "0.78783935", "text": "def index\n @body_style_product_features = if params[:body_style_id]\n BodyStyle.find(params[:body_style_id]).body_style_product_features\n else\n BodyStyleProductFeature.by_body_style\n end.page(params[:pa...
0e173acfa6fbfff19f87d190ffcf6340
shows given commit in a branch
[ { "docid": "4ef995c43cfbd360309e778cbb884d23", "score": "0.79269713", "text": "def show\n\t\t\n\t\trepo = @project.repo\n\t\t@branch = params[:branch]\n\t\t\n\t\tif params[:commit].nil? or params[:commit] == '-'\n\t\t\tcommits = repo.commits @branch\n\t\telse\n\t\t\tcommits = repo.commits params[:commit...
[ { "docid": "5895b2d9eda0df62aa3b2f65f0ab393a", "score": "0.7076463", "text": "def show\n @commit = Commit.find(params[:id])\n if !@commit || @commit.try(:repo).try(:user) != current_user\n redirect_to commits_path, alert: \"commit not found\"\n end\n end", "title": "" }, { "do...
a34eae97fd257f3c582bed74f2f57bb2
POST /invoices POST /invoices.json
[ { "docid": "e9f4d8acefd4d573e32fe7fcf7e3a9fa", "score": "0.0", "text": "def create\n @articles = Article.con_nombre_barcode(params[:q]) if params[:q].present?\n @invoice = Invoice.new(params[:invoice].merge(customer_id: params[:customer_id]))\n @id = @invoice.orders(params[:article_id])\n...
[ { "docid": "a721341fd23fce1b8c0db9e696384d08", "score": "0.7803801", "text": "def create\n @invoice = Invoice.new(invoice_params)\n\n if @invoice.save\n render json: @invoice, status: :created, location: @invoice\n else\n render json: @invoice.errors, status: :unprocessable_entity\n ...
e09e3b49a5ec548b3bec421d8695597c
Throw the given HTTP status code. When used, the execution of a callback or of an action is interrupted and the control returns to the framework, that decides how to handle the event. It also sets the response body with the message associated to the code (eg 404 will set `"Not Found"`).
[ { "docid": "0da6c084eb1f664cf3351e18d222899d", "score": "0.7751757", "text": "def throw(code)\n status(*Http::Status.for_code(code))\n super :halt\n end", "title": "" } ]
[ { "docid": "e9e7583e9b0209ca26b69d46335fbae9", "score": "0.7373082", "text": "def error(code=500, body = nil)\n unless code.is_a?(Integer)\n body = code\n code = 500\n end\n\n response.status = code\n response.body = body if body\n halt\...
ba1be31b222ee645010045951c34bb93
check the rows of the grid If the row has 2 of one mark (X or Y), and one nil value, retun the index of the nil value
[ { "docid": "47207bc987a0030e5a45d093074896b0", "score": "0.723647", "text": "def row_winning_move\n\t\t@board.grid.each_with_index do |row, r|\n\t\t\tother_nil_index = contains_two_marks(row)\n\t\t\tif(other_nil_index)\n\t\t\t\treturn [r, other_nil_index]\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend", ...
[ { "docid": "6727902f9da96ae5faf5370b4da9c3ea", "score": "0.7264211", "text": "def find_empty_cell()\n\t$value_grid.each_with_index do |row, index_r|\n\t\trow.each_with_index do |col, index_c|\n\t\t\tif col.to_i == 0\n\t\t\t\treturn [index_r,index_c]\n\t\t\tend\n\t\tend\n\tend\n\treturn [$N,$N]\nend", ...
8f7bd8842c1e06e58c0db72a535a0123
GET /library_clips/new GET /library_clips/new.xml
[ { "docid": "21ab6469b29bd28151ebb745fd84f7fc", "score": "0.6908125", "text": "def new\n @library_clip = LibraryClip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @library_clip }\n end\n end", "title": "" } ]
[ { "docid": "c08e6e02a3fc2c19967c6c21b048f50e", "score": "0.66176367", "text": "def new\n @clilab = Clilab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @clilab }\n end\n end", "title": "" }, { "docid": "338816eb37ee671ea0f7d8c5...
556177db28c3ca3f546935dd146c02d0
A method for Visitor pattern.
[ { "docid": "9c3f7e4fd17eaf52e7e1281fe586a0ef", "score": "0.0", "text": "def accept(evaluator)\n evaluator.reserved(self)\n end", "title": "" } ]
[ { "docid": "2a4bf63f7b1817f4bdf64b7c3f25dd2b", "score": "0.8370765", "text": "def accept(visitor); end", "title": "" }, { "docid": "2a4bf63f7b1817f4bdf64b7c3f25dd2b", "score": "0.8370765", "text": "def accept(visitor); end", "title": "" }, { "docid": "545e2df060ab5bcc5a82...
52e5868dca2699afe5323764ba03aeef
function to print one line at a time I don't quite understand how it works
[ { "docid": "b48f123980fdfcadc593271bca5b964c", "score": "0.0", "text": "def print_a_line(line_count, f)\n puts \"#{line_count}, #{f.gets.chomp}\"\nend", "title": "" } ]
[ { "docid": "8de393b8ffa6851f4e01b1d7b027f7d1", "score": "0.756233", "text": "def print_line(count)\n (1..count).each do |i| # or, equivalently, for i in (1..count)\n print \"*\" # This prints a single \"*\"\n end\nend", "title": "" }, { "docid": "94aa11be9c42431686b41efe60af6...
5a89e835b46465c0323eb4aab89b3ae6
Returns a Time object that indicates the next time the task will run.
[ { "docid": "4dff71f95bab121207851030e7d7838f", "score": "0.76874185", "text": "def next_run_time\n raise Error, _('No currently active task. ITask is NULL.') if @pitask.nil?\n\n time = nil\n\n FFI::MemoryPointer.new(WIN32::SYSTEMTIME.size) do |ptr|\n @pitask.GetNextRunTime(ptr)\n time...
[ { "docid": "440c9b5e849c8f9f4d30eb3ddad09db3", "score": "0.79994375", "text": "def next_run_time\n check_for_active_task\n @task.NextRunTime\n end", "title": "" }, { "docid": "440c9b5e849c8f9f4d30eb3ddad09db3", "score": "0.79994375", "text": "def next_run_time\n che...
3dbc15cdfabee02f15d6f2641cafbd49
For each turn, show a prompt to the user and return what was typed.
[ { "docid": "3be87694de670f37e06e148edaaddba4", "score": "0.0", "text": "def take_turn(pattern)\n\t\tunless @vowels.empty?\n\t\t\tvowel = @vowels.delete_at(0)\n\t\t\t@letters.delete(vowel)\n\t\t\tvowel\n\t\telse\n\t\t\t@letters.delete_at(0)\n\t\tend\n end", "title": "" } ]
[ { "docid": "85625045986ac983ada3cd43124c172a", "score": "0.7018406", "text": "def prompt\n if @first_guess\n first_turn\n else\n second_turn\n end\n end", "title": "" }, { "docid": "e7144b99f37b8fdc5d3d7fea22f36334", "score": "0.682819", "text": "def get_turn\n ...
aadbc7a5e180b19631c8f6f7f2c18a21
GET /messages/1 GET /messages/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "ea7086ff90058b90c171a0d36a56b3ff", "score": "0.7437026", "text": "def show\n @message = User.find(params[:id]).messages\n\n render json: @message\n end", "title": "" }, { "docid": "01d640eaab3a1942727bd3c46448dee5", "score": "0.74316514", "text": "def show\n msg...
e55ae247a2b6a1e26ca3637856875d0b
List of transactions by address
[ { "docid": "72df9fbdf35b60bdbb868eab1c869eae", "score": "0.76059115", "text": "def transactions_by_address(address, options = {})\n agent.transactions_by_address(self['id'], address, options) do |data, resp|\n yield(data, resp) if block_given?\n end\n end", "title": "" } ]
[ { "docid": "2964377bd042075a01a3a93b0616aed4", "score": "0.74159175", "text": "def fetch_transactions_for(address)\n tid = api_request('queryTransactionInventory', { addresses: [address], limit: 1 })[\"txIds\"].first\n tid ? [fetch_transaction(tid, address: address)] : []\n end", ...
ddb934f0d41b849d064231c6b5735a6a
list of rooms that are not reserved for a given date range, so that I can see all available rooms for that day. It retuns an arrary with rooms with not reservations with a given date.
[ { "docid": "a49807f2c9756b0896c0110dc6b87fd5", "score": "0.7934592", "text": "def get_available_rooms(date_range)\n unavailable_rooms = []\n # Send the room to unavailable rooms if room has a reservation for a specific data_range. \n @reservations.each do |reservation|\n if reserva...
[ { "docid": "bbae131749b63e546a95f80ed5049f6f", "score": "0.87951815", "text": "def unreserved_rooms_by_date(start_date, end_date)\n dates = date_range(start_date, end_date)\n dates << Date.parse(end_date)\n unreserved_rooms = []\n @rooms.each do |room|\n if is_available?(room, dates) &&...
e948f6aea3efdbf8909988ccb463a134
Creates the album path
[ { "docid": "fb1fe73973733ed419e2e4f59735ace9", "score": "0.7776218", "text": "def create_album_path(url)\r\n\t\t\t\t@album_path = url.split('/').last.gsub!(/-|mp3|songs|.html/,\"\").strip\r\n\t\t\t\tDir.mkdir @album_path unless File.exists?(@album_path)\r\n\t\t\tend", "title": "" } ]
[ { "docid": "5c2767973df48e3102bfd4da85e24b89", "score": "0.7126422", "text": "def save! target=\"./Albums\"\n dirname = File.join target, @name\n FileUtils.mkdir_p dirname\n\n self.photos{|p| p.save! dirname}\n end", "title": "" }, { "docid": "80ff8875f851494989bbb1f4d37524...
f1d00012e839fb0572f9f892b37c1e74
Read an unsigned 64bit (8byte) integer.
[ { "docid": "3739a0824cba5defb324a38ee605b964", "score": "0.8534804", "text": "def read_uint64_be\n reader.read(8).unpack(\"Q>\").first\n end", "title": "" } ]
[ { "docid": "80fe116697c0f9ad63e353f69b036713", "score": "0.86962515", "text": "def read_uint64\n reader.read(8).unpack(\"Q<\").first\n end", "title": "" }, { "docid": "bc613a18a7721b5ea77387a8d8bef835", "score": "0.85433495", "text": "def read_uint64\n read_varint\n e...
8f20d91abb107454be62c36d9430ae37
GET /case_recs/new GET /case_recs/new.xml
[ { "docid": "9b2070b7061ce5ee1ac24f5f8d7a3fd4", "score": "0.7716178", "text": "def new\n @case_rec = CaseRec.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @case_rec }\n end\n end", "title": "" } ]
[ { "docid": "da6397c9851b1f4bf753fa330b35d1fe", "score": "0.7220025", "text": "def new\n @case = Case.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @case }\n end\n end", "title": "" }, { "docid": "d91f886ec1f52d22bae5aac314e785b...
fc1557ce5e72f4c2a8c910fade614e5d
=begin Problem: Write a method that takes a number as an argument. If the argument is a positive number, return the negative of that number. If the number is 0 or negative, return the original number. Rephrase: Examples/tests: negative(5) == 5 negative(3) == 3 negative(0) == 0 There's no such thing as 0 in ruby INPUT: ...
[ { "docid": "f5c19f9600c3dacfb18a737fd80dd77c", "score": "0.8392101", "text": "def negative(int)\n int.positive? ? int * -1 : int\nend", "title": "" } ]
[ { "docid": "a6f50b5173c8f4135035cecf9bf27d9c", "score": "0.889662", "text": "def negative(number)\n if number.positive?\n return -(number)\n elsif number.negative?\n return number\n elsif number.zero?\n return 0\n end\nend", "title": "" }, { "docid": "37ad5aa59ba13be0acb7c782c6c...
43f324341569ec5f39123c65125f6222
Set the value of the Movie input for this Choreo.
[ { "docid": "9ffc3a1800d28f65e8383c386372e5e6", "score": "0.7850535", "text": "def set_Movie(value)\n set_input(\"Movie\", value)\n end", "title": "" } ]
[ { "docid": "4b14246abb0768540f2667863475902c", "score": "0.73132885", "text": "def set_movie\n @movie = Movie.find(params[:movie_id] || params[:id])\n end", "title": "" }, { "docid": "6371def826443ba542547f25bffa4cac", "score": "0.72987", "text": "def set_movie\n @movi...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "52659ff6e8177674df2d2726edeaa89e", "score": "0.0", "text": "def set_modifier_instance\n @modifier_instance = ModifierInstance.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...
cdfe704f063dd32dec25f0ee49678375
index is relative to the phrase itself, negative is left, positive is right
[ { "docid": "f76de0b3e582451fc663964b4185d36c", "score": "0.0", "text": "def kwic_sort(phrase, results, index)\n index -= 1 if index > 0\n\n results.sort_by do |result|\n\n parts = result.sentence.downcase.partition(phrase)\n\n part = index < 0 ? parts.first : parts.last\n\n part.str...
[ { "docid": "673123c3c0697d40a5cc14b78e40d36f", "score": "0.6528371", "text": "def find_rotation_point(words)\n floor_index = 0\n ceiling_index = words.length\n\n\n while floor_index + 1 < ceiling_index\n half_distance = (ceiling_index - floor_index) / 2\n guess_index = floor_index + half_distan...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "91efde31de9b53868e3bc31102de3b81", "score": "0.0", "text": "def group_update_params\n params.fetch(:group_update, {})\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7943033", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.69584733", "text": "def permitted_params\n params.permit!\n end", "title"...
adfcfdc1023ac4eeaf241420a3807f30
Find or create collections referenced by works If the import data also contains records for these works, they will be updated during create works
[ { "docid": "fb09b879d1d90b77ebcf0aeed4840faf", "score": "0.6226408", "text": "def create_collections\n collections.each_with_index do |collection, index|\n next if collection.blank?\n metadata = {\n title: [collection],\n work_identifier => [collection],\n v...
[ { "docid": "b82f560c630f576122037a22783214a0", "score": "0.6122268", "text": "def member_of_collections\n base = model.member_of_collections\n return base unless @controller.params[:add_works_to_collection]\n base + [::Collection.find(@controller.params[:add_works_to_collection])]\n...
350eb2e133c6323011710f2015ab2209
.css file paths array
[ { "docid": "bdb232e46af82db5c816dc8ae1a95fc8", "score": "0.0", "text": "def css_files\n exclude_dist_folder(Dir.glob(\"./**/*.css\"))\n end", "title": "" } ]
[ { "docid": "d3f6ad849c39346b3efbb81aab2a21c5", "score": "0.76195574", "text": "def ar_CSS_files_array\n ar_out=Dir::glob(@s_project_fp_prefix_1+\"/demo_2_file_v*.css\")\n return ar_out\n end", "title": "" }, { "docid": "a694937236933ac519d9393a90a803df", "score": "0.7538923",...
9ecdb2bd2f4055ed93105629c50192f2
===> we ask players if they want to play again
[ { "docid": "fdb9493113b75184b4bea43fde342668", "score": "0.6790549", "text": "def play_again\n if winner? == true || @valid_moves == []\n loop do\n puts \"Voulez-vous refaire une partie ? (O/N)\"\n print \"> \"\n answer = gets.chomp.upcase\n if answer == \"O\"\n ...
[ { "docid": "ba50eb98c17b3b4d6e379d5036cc89ab", "score": "0.78976876", "text": "def play_again?\n\t\tplay_again = VR::Dialog.ok_box(\"Would you like to play again\")\n\n\t\tif play_again\n\t\t\treset_board\n\t\t\tif current_player_is_a_bot?\n\t\t\t\tbot_move\n\t\t\tend\n\t\telse\n\t\t\tquit\n \t\tend\n\t...
c3871d5222723b5d7f73ef24ab11e035
Add more helper methods to be used by all tests here...
[ { "docid": "e1bb33586723ac93e33ff22b5be2eef9", "score": "0.0", "text": "def create_test_agreement(formtype = \"multi\")\n agreement = Agreement.new\n agreement.note = 'UNIT_ TESTING'\n agreement.formtype = formtype;\n agreement.audituser = 'UNIT_TESTING'\n agreement.auditdate = ...
[ { "docid": "62158baafece84b452b305badc5dd98c", "score": "0.701972", "text": "def helpers; end", "title": "" }, { "docid": "62158baafece84b452b305badc5dd98c", "score": "0.701972", "text": "def helpers; end", "title": "" }, { "docid": "62158baafece84b452b305badc5dd98c", ...
552bb09cee5b8a91ba91c8ccc23edb10
The results from the response object
[ { "docid": "044964de47d046cf1aca75263b396d30", "score": "0.8709408", "text": "def results\n response.results\n end", "title": "" } ]
[ { "docid": "8438ced2518a16b4d6d2a330fce52655", "score": "0.86789626", "text": "def results\n self.response\n end", "title": "" }, { "docid": "8438ced2518a16b4d6d2a330fce52655", "score": "0.86789626", "text": "def results\n self.response\n end", "title": "" }, ...
f51072127df51d2b415518fceef0b5dc
Retrieves the builtin html5 converter. Returns the instance of the Asciidoctor::Converter::Html5Converter associated with this node.
[ { "docid": "05cf11a95ff0601b061cde3bbfd4e063", "score": "0.7714577", "text": "def html5_converter\n converter.instance_variable_get(\"@delegate_converter\")\n end", "title": "" } ]
[ { "docid": "a467ee3409524478083b3ff1644464c2", "score": "0.79476976", "text": "def html5_converter\n converter.instance_variable_get(\"@delegate_converter\")\n end", "title": "" }, { "docid": "512d62140432dd29ec5fa8ec7661660a", "score": "0.52147734", "text": "def converter_ty...
1f75fd4be09c15a5645fda80cae87885
def get_days(arg) LeavesHolidaysDates.get_days(arg, self.user, self) end
[ { "docid": "5a78fa65b63cbfcd60c06f3797f415a6", "score": "0.0", "text": "def get_days_remaining_with\n remaining = self.user.days_remaining(from_date)\n if !is_actually_deduced? && !is_non_deduce_leave\n remaining -= actual_leave_days\n end\n return remaining\n end", "title": "" }...
[ { "docid": "806ed4480c2ca33a986eb96b4751c759", "score": "0.6704487", "text": "def holidays\n ScheduleDataManager.holidays(@holiday_schedule_name)\n end", "title": "" }, { "docid": "d412e6ea5245dfafd2906682b32668bc", "score": "0.66269636", "text": "def days(*args)\n if args.f...
00d01f2cd02289e46e262557ec47a8a2
def has_access(project) return is_admin || is_proj_mem(project) end def is_proj_mem(project) return current_user.project_id == project.id end
[ { "docid": "a18856659173725f17504d7a211b1c26", "score": "0.6886284", "text": "def redirect_if_no_access\r\n @project = Project.find(params[:id]) if params[:id] != nil\r\n # if !has_access(@project)\r\n # dev_redirect\r\n # end\r\n dev_redirect unless (is_admin || ( params[:id] != nil &&...
[ { "docid": "17c7ab9e533944d9c6dee63bddbdbcce", "score": "0.82293075", "text": "def can_manage_project(project)\n @project = project\n @project.user_id == self.id ? true : false\n end", "title": "" }, { "docid": "1a9880b015e0ed7a010db30cb98441af", "score": "0.80246", "text": "d...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "635f2661fd2d527c247c12ff88ac6c8a", "score": "0.0", "text": "def set_operacione\n @operacione = Operacione.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...
f0ee382ca0e59d43e1cc81393faed7ab
Get value that parameter must be divisible by. Result is 1 when this property is not defined. :rtype: int
[ { "docid": "3e7cb4415f3fd79f75fb1cb80b47d626", "score": "0.0", "text": "def get_multiple_of\n return @payload.get_path(\"multiple_of\"){-1}\n end", "title": "" } ]
[ { "docid": "0dcfd49b40d31d90aa69d954b5b0835c", "score": "0.6458679", "text": "def evaluate_result(num)\n if num == 0\n return 0\n else\n num % num.to_i == 0 ? num.to_i : num\n end\nend", "title": "" }, { "docid": "ea19c607f7c85b73437b573ac27240dd", "score": "0.6095838", "tex...
741ff09d7112bfb3aceb6e3e52214922
The hostmask is the contrary of the subnet mask, as it shows the bits that can change within the hosts prefix = IPAddress::Prefix32.new 24 prefix.hostmask => "0.0.0.255"
[ { "docid": "bdfb2775ff698a674e5680a562fbb327", "score": "0.8000568", "text": "def hostmask\n [~to_u32].pack(\"N\").unpack(\"CCCC\").join(\".\")\n end", "title": "" } ]
[ { "docid": "86f785e96a1e600484a1fcd803a3c1c6", "score": "0.76371664", "text": "def packed_hostmask()\n return(@hostmask)\n end", "title": "" }, { "docid": "925cbd0658476c01a964dbc13655ca8a", "score": "0.7563164", "text": "def netmask\n @prefix.to_ip\n end", "tit...
415592250385d6fa6f37380671772be8
GET /shops GET /shops.json
[ { "docid": "32ffcf56c85b88d0bfe55a28bb7676e4", "score": "0.0", "text": "def index\n @shops = Shop.all.sort_by{|sh| sh.name.downcase}\n end", "title": "" } ]
[ { "docid": "d4e0ea1f652fc99b8823b20dc3e2214f", "score": "0.8048584", "text": "def index\n @shops = current_user.shops\n\n respond_to do |format|\n format.html\n format.json { render json: @shops }\n end\n end", "title": "" }, { "docid": "26f904ff6663f4ba86a5cd4c9381cd73",...
bdde50edc827d51e5b84280762a1030a
returns actual URI object
[ { "docid": "4ce84c6023f325fd1ae7fdbfb051d3a6", "score": "0.0", "text": "def fedora_uri\n # We hope this is the right way to get the actual uri to fetch cheaply?\n # a bit sketchy we're calling it on FileSet not File, but File doesn't\n # have this API, and it seems to work.\n @fedora...
[ { "docid": "8dfabbfefa23185830dba3b95458932b", "score": "0.80390424", "text": "def to_uri\n URI.parse self\n end", "title": "" }, { "docid": "605b17a0458c33cf9b01f2a75af0a709", "score": "0.8028456", "text": "def uri\n URI.new :scheme => scheme,\n :host => host...
cdcd6e35d38fb796be35db215b4f8d8a
GET /series GET /series.json
[ { "docid": "d2852c948b6039bcfa0dc0d68bafc128", "score": "0.0", "text": "def index\n if user_signed_in?\n if current_user.admin\n @series = Serie.all\n else\n @admins = User.where(admin: true)\n @series = Serie.where(user_id: current_user.id)\n @series = @series +...
[ { "docid": "51c45b66ed383b19456d9045db0bef39", "score": "0.8057892", "text": "def series(options = {})\n # v1/public/series\n get('series', options)\n end", "title": "" }, { "docid": "1a6d89ef91f80408d72ff8bff03c0fd5", "score": "0.79581946", "text": "def index\n @seri...
da77dd195c278f2bb9a11e7dea108e53
=begin get article as raw (e. g. if it's a email, the raw email) article = Ticket::Article.find(123) article.as_raw returns: file Store =end
[ { "docid": "f7d7c7ca40b46d4fb94a3ba4c020e4ea", "score": "0.7040287", "text": "def as_raw\n list = Store.list(\n object: 'Ticket::Article::Mail',\n o_id: id,\n )\n return if list.blank?\n\n list[0]\n end", "title": "" } ]
[ { "docid": "e5793007bea6e27136735a1515d23350", "score": "0.6694676", "text": "def get_raw\n\n path = File.join(self.get_dir, self.id.to_s + Email::EXT_RAW)\n\n if File.exist?(path)\n return open(path) { |f| f.read }\n else\n return ''\n end\n end", "title": "" }, { "do...
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "4c36104a57460de51903ca3e0c19e455", "score": "0.0", "text": "def bug_ticket_params\n params.require(:bug_ticket).permit(:bug_behavior, :environment, :status, :priority, :owner, :comment, :category, :main_image, :project_id)\n end", "title": "" } ]
[ { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.69497335", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6812623", "text": "def strong_params\n params.require(:listing_member).permi...
25413bf132396d0c2ef105c86b019fd4
Create a new transformer with Locally Linear Embedding.
[ { "docid": "90f31fc44632842f2c415bc4dd6d3c40", "score": "0.0", "text": "def initialize(n_components: 2, n_neighbors: 10, reg_param: 1e-3)\n super()\n @params = {\n n_components: n_components,\n n_neighbors: [1, n_neighbors].max,\n reg_param: reg_param\n }\...
[ { "docid": "ccde1a61816167e186dae77ea6ab3359", "score": "0.5945641", "text": "def fit(x, _y = nil)\n raise 'LocallyLinearEmbedding#fit requires Numo::Linalg but that is not loaded' unless enable_linalg?(warning: false)\n\n x = Rumale::Validation.check_convert_sample_array(x)\n\n n_s...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "35164e7f3744d5fae1b7ab42ade25936", "score": "0.0", "text": "def consulting_params\n params.require(:consulting).permit(:name, :description, :user_id, :location)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whit...
1ad2cd96bdeb2e6bda8502b2cf60fdf9
function that draws the background and losing font when the users loses the game
[ { "docid": "7e2b2ffbf76093dbe06f9b68121251e3", "score": "0.59972864", "text": "def draw_lose\n draw_quad( 0, 0, LTOP_COLOR,\n @width, 0, LTOP_COLOR,\n 0, @height, LBOTTOM_COLOR,\n @width, @height, LBOTTOM_COLOR,\n -1 )\n @endFont.draw(\"You l...
[ { "docid": "1b9bda5a09b0b7f64e092e7286317bb0", "score": "0.6585171", "text": "def draw_background\r\n Gosu.draw_rect 0, 0, self.width, self.height, Gosu::Color::BLACK\r\n end", "title": "" }, { "docid": "2c7bfec7397e01d58c13ecc55c714bd1", "score": "0.6490509", "text": "def draw\r...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "478927ca00f57a6eb165ec381d3e71d2", "score": "0.0", "text": "def users_account_params\n if params.require(:users_account)[:password].blank? and params.require(:users_account)[:password_confirmation].blank?\n params.require(:users_account).permit(:email, { role_ids:[] })\n else\n ...
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whit...
6665c00b7847a05dfb02594be3100a1f
POST /synonymproteins POST /synonymproteins.json
[ { "docid": "2179bfbfcca72072a226a2499029f657", "score": "0.70951664", "text": "def create\n @synonymprotein = Synonymprotein.new(synonymprotein_params)\n\n respond_to do |format|\n if @synonymprotein.save\n format.html { redirect_to @synonymprotein, notice: 'Synonymprotein was successf...
[ { "docid": "26d1152b3d70756e1281474145352c2b", "score": "0.63893026", "text": "def synonymprotein_params\n params.require(:synonymprotein).permit(:synonymname)\n end", "title": "" }, { "docid": "ba126a7ec639b1ece307c29f9a28c6c9", "score": "0.6053219", "text": "def set_synonym...
18a44353b19664ce1f6cafb49c548569
Returns a url without the protocol (
[ { "docid": "506b39499c3625a8fc21db63d6e3ce06", "score": "0.6195062", "text": "def shorthand_url(input)\n input.gsub /(https?:\\/\\/)(\\S+)/ do\n $2\n end\n end", "title": "" } ]
[ { "docid": "6b238338d24d0c5c7bb7d6c5ea3c2f21", "score": "0.81098735", "text": "def without_protocol\n self =~ %r(^(.*?)://(.*?)$) ? $2 : self\n end", "title": "" }, { "docid": "dfead82cd7d0d6250bc5a47982103ccb", "score": "0.79064494", "text": "def without_scheme_or_port(url)\n ...
5a0ddcfba3b2744570415d4b270f5639
NOTE : mayber we should just integrate it via params at initialization ? Laurent, 13/07/2017
[ { "docid": "88dce6130a1a47269cea33c921bc472a", "score": "0.0", "text": "def identity_solver\n @identity_solver ||= IdentitySolver.new(request, user)\n end", "title": "" } ]
[ { "docid": "0d496e1887126b69b6d6aa4045da4f61", "score": "0.7719932", "text": "def init(params)\n end", "title": "" }, { "docid": "8fb4989df0b1b036ce4942da036d195e", "score": "0.7356607", "text": "def init_params(params)\n super\n end", "title": "" }, { "docid...
cc2dccc8b6132b7df7901d5d005c9c0a
GET /shishas/new GET /shishas/new.xml
[ { "docid": "f78779b24ea3ddacc97d8a588bd48a08", "score": "0.72198296", "text": "def new\n @shisha = Shisha.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shisha }\n end\n end", "title": "" } ]
[ { "docid": "be2e3c7fd59c56b7f9d57946e8de297e", "score": "0.6817813", "text": "def new\n @sushi = Sushi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sushi }\n end\n end", "title": "" }, { "docid": "5e0a535ef6a455fbcdf1626fcace...
cc797780247e40c2f7428a14687d1b77
POST /fixed_rates POST /fixed_rates.json
[ { "docid": "7fbd3937c0624fa541409b2d3e85d504", "score": "0.72368157", "text": "def create\r\n @fixed_rate = FixedRate.new(fixed_rate_params)\r\n\r\n respond_to do |format|\r\n if @fixed_rate.save\r\n format.html { redirect_to @fixed_rate, notice: 'Fixed rate was successfully created.' ...
[ { "docid": "b5051a64961dae6e80a040f8cb20ed78", "score": "0.6744194", "text": "def fixed_rate_params\r\n params.require(:fixed_rate).permit(:ori_tar, :dest_tar, :costo_tar)\r\n end", "title": "" }, { "docid": "d0932a6e87d91f14f46050b326ab14c6", "score": "0.65485746", "text": "...
1237407abc9aa53fccf75c648d02e235
GET /todo_app_lists/1 GET /todo_app_lists/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "cab7f9d4b3ba18cddbb38aa8b3ae49d0", "score": "0.7466178", "text": "def index\n @todo_app_lists = current_user.todo_app_lists\n end", "title": "" }, { "docid": "6fe7369c75e040a208c88b665d5254fa", "score": "0.7302523", "text": "def index\n @todo_items = @todo_list.tod...
c3ca03c61bbfe985299552174ff8159d
Public calling protected speak method
[ { "docid": "1245b35f983cdbcc7570cccc9d3091c6", "score": "0.8566343", "text": "def calling_speak\n speak\n end", "title": "" } ]
[ { "docid": "e125d8c5da1ab6c3ef2750868bd2c458", "score": "0.83970314", "text": "def speak\n\t\traise 'You must implement this in a subclass'\n\tend", "title": "" }, { "docid": "9e58feb6cdbb23367484ccd71c2a448a", "score": "0.83668256", "text": "def speak\n super(\"Woof\")\n end", ...
2272d60663764e9946079ccc9ce6fd9f
Shipped in with Sequel!
[ { "docid": "2dab87e3ac1c6fdd8572a80302ebd2f0", "score": "0.0", "text": "def validate\n super\n validates_presence :user\n validates_presence :account\n validates_presence :operation_type\n validates_presence :amount\n validates_presence :created_at\n validates_presence :updated_at\n...
[ { "docid": "ba25c81ca204cc0f50e6adb0314a5d54", "score": "0.60638326", "text": "def save\r\n\t\tpopulate_ships = '\r\n\t\tINSERT INTO ships (name, scan, signature, thrust, hull, armor, point_defense, group_sizes_id, tonnage, special, points, faction) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);' \r\n\t\t...
ca90d281b8d50c0790b6b4cd8dfaca24
, :only => ["new", "create", "email_unique"] GET /users GET /users.json
[ { "docid": "71d26c2dbb2d70e395b69478e8687863", "score": "0.0", "text": "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "title": "" } ]
[ { "docid": "6da6e5b8fb2dc1dc1b22a598f08b621b", "score": "0.696927", "text": "def users\n\n end", "title": "" }, { "docid": "6da6e5b8fb2dc1dc1b22a598f08b621b", "score": "0.696927", "text": "def users\n\n end", "title": "" }, { "docid": "b1d149c27ecbdf16afd6c34062cfd2e6",...
066675d4dedb4f6f6bebce652b9d552f
Execute the Choreo using the specified InputSet as parameters, wait for the Choreo to complete and return a ResultSet containing the execution results.
[ { "docid": "a2e8d3e802a47aba29c18e409df3986f", "score": "0.0", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = SearchMessagesByRecipientAndDateResultSet.new(resp)\n return results\n end", "title": "" } ]
[ { "docid": "c4ca32683e8ce75eb6a187d63df8fa77", "score": "0.7665963", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = DoneResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "6f7a7d9be674ad4cf17d6743eb1f7836", "score...
a53f9dc57beffe6fde4afaf6b0bc7f65
Takes type of action and params: :shutdown:: +params+ nil :create_order:: +params+ order :cancel_order:: +params+ order
[ { "docid": "1d3c8d833236feefc33b76f023f0d1e7", "score": "0.0", "text": "def initialize(type, destination, params=nil)\n @type = type\n @params = params\n @destination = destination\n end", "title": "" } ]
[ { "docid": "17fe686381fcfb04ed07ce6fae851389", "score": "0.63113284", "text": "def when_to_execute_order(type)\n @stock_details = Finance.current_stock_details(params[:stock_id]) or raise ActiveRecord::RecordNotFound\n\n @order_type = type\n\n case params[type][:when]\n when \"At Market\"\n ...
1e91bd62d7ec4a902ababfdd12ac711e
Converts from FPDF y coordinates to Prawn y coordinates. FPDFthink is setting a topdown y relative to the edge of the paper; we set up Prawn to use a bottomup system origined at the bottom of the page. If new value is not supplied, returns the current value. Does not change the current value.
[ { "docid": "7410b3bcfc20b9297d99e10333343209", "score": "0.7671776", "text": "def py(new_y=nil)\n if ! new_y then return @cur_y end\n if @unit then new_y = @unit.call(new_y) end\n if new_y >= 0\n @page_height - new_y\n else\n -new_y\n end\n end", "title": ""...
[ { "docid": "e3e027fde90aac96788d7745ef3e7a7e", "score": "0.69058526", "text": "def y\n @page_height - mm_to_pt(@padding_top + @mm_y)\n end", "title": "" }, { "docid": "46a8433167c5281a94bd6d4a5748c3b6", "score": "0.68413734", "text": "def fixY(y)\n pageSize.getHeight -...
54351bcd5d59b1028e173303fae7e45f
Route: /database_updates (GET) Purpose: renders a list of all database updates, newest first
[ { "docid": "c0c400ada2b0e006802c672fdbe6cd55", "score": "0.7654786", "text": "def index\n @updates = DatabaseUpdate.all(:order => \"created_at DESC\")\n end", "title": "" } ]
[ { "docid": "1fbb7fe82b7dcf4b012219d88908f826", "score": "0.72687346", "text": "def index\n @updates = Update.all\n end", "title": "" }, { "docid": "26adca7396325d3bd00d2cb58db5c3bc", "score": "0.6845495", "text": "def index\n @updates = Update.all\n\n respond_to do |format|...
ea3da1d6e8de57e7aa04ae43d7e2b357
POST /ethnics POST /ethnics.json
[ { "docid": "bbdc16fee10b15ab4967e1f8afcfd805", "score": "0.61727804", "text": "def create\n @ethnic = Ethnic.new(ethnic_params)\n\n respond_to do |format|\n if @ethnic.save\n format.html { redirect_to @ethnic, notice: 'Ethnic was successfully created.' }\n format.json { render :...
[ { "docid": "15048cf92a039a84e426c411aa8df172", "score": "0.65892327", "text": "def create\n @ethic = Ethic.new(ethic_params)\n\n respond_to do |format|\n if @ethic.save\n format.html { redirect_to @ethic, notice: 'Ethic was successfully created.' }\n format.json { render :show, ...
ef8fc33f23137f844f91a5a3371474ea
Method to return the Audio Format encoding Set to PCM unsigned
[ { "docid": "c43e65ddfd5dfc8d11e0195d839e3b16", "score": "0.7781548", "text": "def encoding\n @encoding ||= AudioFormat::Encoding::PCM_UNSIGNED\n end", "title": "" } ]
[ { "docid": "f1fa15b8de03e2d5be2998cd63e49753", "score": "0.6543714", "text": "def format\n @format ||= \n AudioFormat.new(encoding, rate, size, channels, 1, rate, false)\n end", "title": "" }, { "docid": "042e7ed31297e566a5b55267ab8dbddc", "score": "0.6388832", "text":...
532245fb6b23d242195413af928a67ce
End Method: Edit Method: Update
[ { "docid": "e025aa6f10edb239c222bc8f7905f5b2", "score": "0.0", "text": "def update\n\n\t\t@organizationtype = Organizationtype.find(params[:id])\n\t\t@organizationtype.modified_by = 1\n\n\t\tif @organizationtype.update_attributes(params[:organizationtype])\n\t\t\tflash[:notice] = 'Organization Type Upda...
[ { "docid": "28209ee0aa3e250a92993c5783dadeb1", "score": "0.83812183", "text": "def update\n end", "title": "" }, { "docid": "cb3f5312c0ad8a8187f54e4563389018", "score": "0.8283151", "text": "def update\r\n\r\n end", "title": "" }, { "docid": "394370bce628d74...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "58ee9f60f668eb67248149d9b5907819", "score": "0.0", "text": "def following_params\n params.require(:to_id)\n params.permit(:from_id)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whit...
38ad64c2091fa32e23f90dba2c638695
POST /item_vendas POST /item_vendas.json
[ { "docid": "96df38fa3661b47956f2631fcdd09d55", "score": "0.71466094", "text": "def create\n #@item_venda = ItemVenda.new(item_venda_params)\n @venda = Venda.order(\"created_at\").last\n @item_venda = @venda.item_vendas.create(item_venda_params)\n @venda.valor_total += @item_venda.produto.pre...
[ { "docid": "9abc2f61e1605f03f90037ac6045e98b", "score": "0.67233217", "text": "def item_venda_params\n params.require(:item_venda).permit(:produto_id, :venda_id, :quantidade)\n end", "title": "" }, { "docid": "a24cdf900d75097ac56efa66ad9daab7", "score": "0.64869237", "text": ...
0e8393404173240140613abc8afe8ca7
% empty? : () > Boolean
[ { "docid": "04dd7178145f15ca458df4a6732f5e5b", "score": "0.85072577", "text": "def empty?() end", "title": "" } ]
[ { "docid": "5d4c878723231ffdfb112689c93c96a6", "score": "0.830969", "text": "def empty?\n none? { true }\n end", "title": "" }, { "docid": "f8f8300b940aab1641733eef42d1d19d", "score": "0.82299376", "text": "def empty?; false; end", "title": "" }, { "docid": "f8f83...
470fe8bae42a08355f88ee85fa0aad84
Purpose: A noop method for overriding, intended to process all records assinged to a Batch Process Params: None Response: Returns True if batch is processed successfully
[ { "docid": "e5cebed9356b3f88e9e613c930080392", "score": "0.77918977", "text": "def process_batch!\n # no-op, can be overwritten\n end", "title": "" } ]
[ { "docid": "28ca9c7c7788b4cea34c1c66ce37a9f1", "score": "0.73327553", "text": "def process_batch(batch)\n ret = call([], :process_batch, batch.__calls)\n BatchContext::Return.from_calls_and_return(batch.__calls, ret)\n end", "title": "" }, { "docid": ...
368d73cd2ee38534538b773f65dcc6e1
GET /admin/students GET /admin/students.json
[ { "docid": "aa5edec61ad83543d474c2f4e449b1f5", "score": "0.68222296", "text": "def index\n @students = Student.order(:stu_no).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @students }\n end\n end", "title": "" } ]
[ { "docid": "808860a584dc3bc32b26760cee06ae56", "score": "0.77352077", "text": "def students\n if usernames\n data = {}\n usernames.each {|u| data[u.username] = u.students}\n render json: data and return\n elsif current_user\n render json: {status: \"success\...
a56685175024d2cb1bca3a78081483c7
GET /image_uploads/1 GET /image_uploads/1.xml
[ { "docid": "818a7895d47981495e28db0dc7927059", "score": "0.66249806", "text": "def show\n @image_upload = ImageUpload.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image_upload }\n end\n end", "title": "" } ]
[ { "docid": "6ae970456f0561628b443df6e12d6b1a", "score": "0.66202277", "text": "def index\n @images = Image.find_images\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @images }\n end\n end", "title": "" }, { "docid": "29ada3d32df43...
14eb4931bc6a46e20afaa44b6ebe4c82
Locates the `permissions` service.
[ { "docid": "5a4a731ce263e347758ca5bc39332c34", "score": "0.7822945", "text": "def permissions_service\n @permissions_service ||= SystemPermissionsService.new(self, 'permissions')\n end", "title": "" } ]
[ { "docid": "5ea36dc07f63f88dc01e288260ff887f", "score": "0.75755036", "text": "def permissions_service\n @permissions_service ||= AssignedPermissionsService.new(self, 'permissions')\n end", "title": "" }, { "docid": "5ea36dc07f63f88dc01e288260ff887f", "score": "0.75755036", "...
16ab759d0d2af85e5c93043937d128d1
POST /bus_seat_types POST /bus_seat_types.json
[ { "docid": "54af026b82cc8d7f6402fc34aa29d08c", "score": "0.7339704", "text": "def create\n @bus_seat_type = BusSeatType.new(params[:bus_seat_type])\n\n respond_to do |format|\n if @bus_seat_type.save\n format.html { redirect_to @bus_seat_type, notice: 'Bus seat type was successfully cr...
[ { "docid": "75b7edd0c25a1705fe583678b81af7fe", "score": "0.6499199", "text": "def new\n @bus_seat_type = BusSeatType.new\n @seat_types=SeatType.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bus_seat_type }\n end\n end", "title": "" ...
68fa028535cde6c911eb3e57dd96d2fc
Public: initialize for object Hash with params: where key is parameter name and value is value of this parameter
[ { "docid": "4267109d1cd01d15c881c4412237fba6", "score": "0.74452865", "text": "def initialize(params)\n AVAILABLE_PARAMETERS.each do |param|\n send(sprintf(\"%s=\", param), params[param])\n end\n end", "title": "" } ]
[ { "docid": "0e295835322a4d2b16c518c7619b230d", "score": "0.8335762", "text": "def initialize params={}\n params.each do |key, value|\n self.instance_variable_set to_instance_variable_symbol(key), value\n end\n end", "title": "" }, { "docid": "498446e414e335472c1bf22ed36203e7", ...
66e21a458b23cce0f48c359b9d8b7d7d
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
[ { "docid": "e3061c29e5b1c24792771045ed903e06", "score": "0.0", "text": "def context; end", "title": "" } ]
[ { "docid": "d1758edd04b6374162470ca44c3f1250", "score": "0.6871894", "text": "def context\n unless @instance_context\n @instance_context = AuthTokenPromotionContext.new(@version )\n end\n @instance_context\n ...
579acd7b20411c38b4489ef60e09af77
Checks if a user hasn't passed two steps of registration
[ { "docid": "48a1945c5593461ecdf2329ab52fca7f", "score": "0.0", "text": "def passed_profile_steps?\n [profile_name, slug, cost].all?(&:present?)\n end", "title": "" } ]
[ { "docid": "79c7920f7a40bce14319d11f9a24ff6f", "score": "0.7298032", "text": "def registered?\n not user.nil?\n end", "title": "" }, { "docid": "58502f272febe13be0a413a7da85e8a2", "score": "0.7244451", "text": "def check_registration\n return unless Spree::Auth::Config[:regist...
799b91518f36c4d03bdc391e0fcbdb85
Test when guest is added to full room
[ { "docid": "4e3e2c641cff322b2605b8e231e19652", "score": "0.7576641", "text": "def test_check_entry_full\n @room.add_guest(@guest1)\n @room.add_guest(@guest2)\n @room.add_guest(@guest3)\n assert_equal(\"Room full!\",@room.check_entry_and_add_guest(@guest1))\n end", "title": "" } ]
[ { "docid": "0289297342b2f25f814437e04aeef6a1", "score": "0.76355004", "text": "def test_try_add_guest_to_room\n @room1.add_guest_to_room(@guest1)\n assert_equal(1,@room1.guest_count)\n end", "title": "" }, { "docid": "4769b7138771a5d5c6d7324fc46b2c32", "score": "0.7609797", ...
1fb1716b407b1528c57d2987bde7b650
Finds and invokes a handler by name or by status code.
[ { "docid": "2f906728d67515cfba790bd8682de810", "score": "0.643793", "text": "def handle!(name_or_code, from_logic = false)\n @sets.each { |set|\n if h = set[1].handle(name_or_code)\n Pakyow.app.response.status = h[1]\n from_logic ? throw(:fns, h[2]) : self.trampoline(h[2])\...
[ { "docid": "de79c53a0439e67c62588445435ba95d", "score": "0.6711083", "text": "def handle_status code\n handler = error_handler_for(code)\n instance_exec(&handler) if handler\n end", "title": "" }, { "docid": "cc3c6e48439d46b7019de464cbde8889", "score": "0.67018694", "text": "d...
d30b12b8874b7236d562ea82ae7193c8
_unpack_externsheet() Unpack the EXTERNSHEET recordfor easier comparison.
[ { "docid": "4ecfdc4b203d8ed2d4a506d4ce5fdeb6", "score": "0.7245539", "text": "def _unpack_externsheet(data)\n externsheet = Hash.new\n\n externsheet['record'] = data[0, 2].unpack('v')[0]\n data[0, 2] = ''\n externsheet['length'] = data[0, 2].unpack('v')[0]\n data[0, ...
[ { "docid": "ecfceb4510b86b44924720cfdc1872b2", "score": "0.6093262", "text": "def store_externsheet # :nodoc:\n record = 0x0017 # Record identifier\n\n # Get the external refs\n\n ext = @ext_refs.keys.sort {|a, b| @ext_refs[a].to_i <=> @ext_refs[b].to_i}\n\n # Change ...
e070fa87cc8e66d7965f681cec978fa6
GET /user_places GET /user_places.json
[ { "docid": "0f4237ff086fc09dbfdebc1075826758", "score": "0.7134218", "text": "def index\n @user_places = UserPlace.all\n end", "title": "" } ]
[ { "docid": "9cd9398efc9984c5282f40d8a5d31d61", "score": "0.7122159", "text": "def index\n render json: @places\n end", "title": "" }, { "docid": "f93ebf6374e8ead0e2bb83f477dc6bbe", "score": "0.6941213", "text": "def index\n @places = @site.places.all\n\n respond_to do |...