query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
34a02f30278d6d52913be54444e694ee
end load_supported_games Run the boot
[ { "docid": "6d7fdbe64b605767cc5581c3edf35e26", "score": "0.0", "text": "def run\n #p @app_settings\n if @app_settings[:log_level] == :develop || \n @app_settings[:log_level] == :develop_withfile\n log_debug\n end\n #puts YAML.dump(@settings_default)\n @join_game = @app_settings[...
[ { "docid": "6a468921d981a17dd3c76b97cc574554", "score": "0.6930644", "text": "def load_supported_games\n @supported_game_map = InfoAvilGames.info_supported_games(@log)\n #@supported_game_map.each{|k,v| p k}\n #p @supported_game_map\n # execute require 'mygame'\n @all_games_bots.each do |b...
29f6a1fca78f75f9336be42370c2bcad
All the maze can do is ask the initial_segments if they are solvable
[ { "docid": "5543761ca6d6b76308ca1909ceb4fafe", "score": "0.6686315", "text": "def solvable?\n self.initial_segments.detect { |s| s.solvable? } ? true : false\n end", "title": "" } ]
[ { "docid": "ac5d88157f633d5667dada360cf40e21", "score": "0.70451814", "text": "def maze_solver(maze, start_pos, end_pos)\n \n end", "title": "" }, { "docid": "dc376a6149226a67440ad8c5d6e9f6e7", "score": "0.6807354", "text": "def solvable?\n # Either the points array is already...
c9ccd1b55507972c769e4a79ddcb1b20
From the drop down find all the people associated with a list and populate the search results
[ { "docid": "c8d8b6463698facd449e0f7bc59d4145", "score": "0.0", "text": "def use_saved_list\n logger.debug \"**** USE SAVED LIST ****\"\n \n show_params(params) #debug params and put them in logs\n \n\tsaved_contact_list_id = params[:saved_contact_list][:saved_contact_list_id] if !params[:sav...
[ { "docid": "47f9bb5ae303e9b49e99431b3b74f668", "score": "0.657471", "text": "def auto_complete_for_person_name\n \tname = params[:person][:name].downcase\n \tnames = name.strip.split(' ')\n \t\n find_options = {\n :order => \"last_name, first_name ASC\",\n\t :limit => 10 }\n\n\t\tif names.si...
eda9a728907ab23d5fe1d279450c0db1
being passed and determine the largest double digit number within the whole number. For example: if num is 4759472 then your program should return 94 because that is the largest double digit number. The input will always contain at least two positive digits. PROBLEM UNDERSTANDING input Integer (positive, at least 2 dig...
[ { "docid": "f72482f2bfa10e0a784b90df6c050d09", "score": "0.7971201", "text": "def LargestPair(num)\n largest_num = 0\n num.digits.reverse.each_cons(2) do |num1, num2|\n curr_num = num1 * 10 + num2\n largest_num = curr_num if curr_num > largest_num\n end\n largest_num\nend", "title": "" }...
[ { "docid": "a53973bdf79b9193f45de0b6079515a2", "score": "0.77330405", "text": "def max_number(num)\r\n num.digits.sort.reverse.join.to_i\r\nend", "title": "" }, { "docid": "f5e972d795afff1f45e292d1c5931959", "score": "0.7715271", "text": "def solution(digits)\n # split digits and p...
d51d72506cb08e7e8a71ae4ecb5053bf
GET /migrations/1 GET /migrations/1.json
[ { "docid": "16c7dffb8798e4eb7765d6c967445c1c", "score": "0.6549308", "text": "def show\n @migration = Migration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @migration }\n end\n end", "title": "" } ]
[ { "docid": "e4fc57aadf06ed5fab344b765596b382", "score": "0.6528844", "text": "def migration_status(org, id, options = {})\n options = ensure_api_media_type(:migrations, options)\n get \"#{Organization.path(org)}/migrations/#{id}\", options\n end", "title": "" }, { "docid":...
c860b25013d4ca32ee068ff58699f82e
Get maximum value for parameter. :rtype: int
[ { "docid": "9b198e97ecfaaeaf162ee4fd8f1071be", "score": "0.7224", "text": "def get_max\n return @payload.get_path(\"max\"){10000} # sys.maxsize\n end", "title": "" } ]
[ { "docid": "9f432b9ea2131244b74b7c4cdc50f31d", "score": "0.78812164", "text": "def max_value\n @max_value\n end", "title": "" }, { "docid": "a103989d00ccb90a682e35a9dc70a87b", "score": "0.7725182", "text": "def max()\n @max\n end", "title": "" }, { "docid": "3...
d4a1edaae4d92d004632cf64501ce2e7
DELETE /users/1 DELETE /users/1.json
[ { "docid": "427f56c5a5085414b6bb425998eba665", "score": "0.0", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "be9d8ff5c0124f1d5efc98ec2baa3fc1", "score": "0.7590564", "text": "def test_delete_user\n delete '/users/2'\n data = JSON.parse last_response.body\n\n assert_equal 'Daniel', data['name'], 'Propiedad name incorrecta'\n assert_equal 'Arbelaez', data['last_name'], 'Propiedad last_nam...
5cd39e3ff558501c6556d51e0728fd06
Find out this record type supports priorities. We set this to false by default, record types that support priorities. shoule override this. Returns true this record type support priorities.
[ { "docid": "3a2f42e543245780ff63d5e195fa4685", "score": "0.68216217", "text": "def supports_prio?\n false\n end", "title": "" } ]
[ { "docid": "fef425021e9d7c02b6f09cc82aacd05b", "score": "0.6894272", "text": "def normal_priority?\r\n @priority_type == 1\r\n end", "title": "" }, { "docid": "858290ac99bbcc7f4437b1d0fb0cd024", "score": "0.6864137", "text": "def supports_prio?\n true\n end", "title": "" ...
b8246126a5b1b640bbd276baed7e877a
Add this to nested form in forms, so there will not be an add button: :add_field => false
[ { "docid": "f72bf34348753a97a77a8aee760a0caa", "score": "0.6295191", "text": "def nested_form(attribute, options={})\n control_group do\n label(attribute, class: 'control-label')+\n controls do\n content_tag(:div, :class => 'well fields-wrapper') do\n fields_for(at...
[ { "docid": "8c9909f2a2d01b4ecf6b79ab21bdb0e3", "score": "0.6580224", "text": "def extra_fields_in_form\n []\n end", "title": "" }, { "docid": "479e0da8fdaa99af4bc059d7f5c1a4a7", "score": "0.6476544", "text": "def render_nested_form(associated, opts = {})\n opts[:fields_for...
91f36146a62f82559709647c87d72e6e
def keyword( k = nil )
[ { "docid": "c5b608f0226937230097b2a61bc49f10", "score": "0.0", "text": "def project_required?\n @project_required = true if @project_required.nil?\n @project_required\n end", "title": "" } ]
[ { "docid": "37e70ac9b47986846c1d71dda17a9789", "score": "0.8162541", "text": "def keyword\n\n end", "title": "" }, { "docid": "53b4c22a3f0b3f33f3220bc875adefa3", "score": "0.8138912", "text": "def keyword; end", "title": "" }, { "docid": "53b4c22a3f0b3f33f3220bc875adefa3...
e340fb57afeeafc516758901893e59f2
Creates a Task and yield to a block with the newly create Task. Used to configure Tasks.
[ { "docid": "8b3d94836c93610bf3500f49eb9f0418", "score": "0.5749614", "text": "def task(name, actor_class, options={}, &block)\n has_state = options.has_key?(:state)\n unless has_state\n options = options.clone\n options[:state] = Task::STOPPED\n end\n t = Task.new(self,...
[ { "docid": "dd8ef07ab3443bf81f7b31a2f0d52354", "score": "0.67090553", "text": "def task(&block) \n task = TaskRunnable.new\n task.proc = Proc.new(block)\n task\n end", "title": "" }, { "docid": "7804fa41e32a658eb38a1248b33d23a2", "score": "0.67066354", "text": "def tas...
c9abac0f7d1ba8115d3b9f66f18ad805
DELETE /ccomments/1 DELETE /ccomments/1.xml
[ { "docid": "88a6d9e9e4c80a5d007bb0801eb88188", "score": "0.7157098", "text": "def destroy\n @ccomment = Ccomment.find(params[:id])\n @ccomment.destroy\n\n respond_to do |format|\n format.html { redirect_to(ccomments_url) }\n format.xml { head :ok }\n end\n end", "title": "" ...
[ { "docid": "96e79a13fa5c22caf82287066f94d004", "score": "0.70568043", "text": "def test_delete_comment\n filename = 'test_multi_pages.docx'\n remote_name = 'TestDeleteComment.docx'\n comment_index = 0\n\n st_request = PutCreateRequest.new remote_test_folder + test_folder + '/' + remo...
1a3a738e4188ddc2fa122f70158a1523
Given a response object, this method extract and returns a hash of response data.
[ { "docid": "4689a0151bf99ef8dfb8a78463770f05", "score": "0.6024243", "text": "def extract_data response \n @parser.parse(response.http_response.body)\n end", "title": "" } ]
[ { "docid": "e4ba3c7189af9487a3e5bb7a70bffe82", "score": "0.74533486", "text": "def to_hash\n @hash ||= JSON.parse(@data)\n @hash['response']\n end", "title": "" }, { "docid": "9347975c493d4ce2a6e42107280890df", "score": "0.73352414", "text": "def to_hash\n response....
1ed6f48e9234004afb86d8120e82e186
permissions are as in the project this sample belongs to
[ { "docid": "374450bdeaaee78f9845841bde1dd908", "score": "0.0", "text": "def allows?(action, user)\n project && project.allows?(action, user)\n end", "title": "" } ]
[ { "docid": "e7fa55c996c89a154f6ff748543f9ee3", "score": "0.8317811", "text": "def define_permissions\n end", "title": "" }, { "docid": "89cb1849101eaf5614248e8c9b6f3080", "score": "0.81397843", "text": "def permissions; end", "title": "" }, { "docid": "73e508b62772b93fcc...
c1b46ac3311f1cec4953fc06ac15ae5b
Get the hash value for the decimal128.
[ { "docid": "bc580928dbeb530f6de51550b1f1ea76", "score": "0.6026613", "text": "def hash\n num = @high << 64\n num |= @low\n num.hash\n end", "title": "" } ]
[ { "docid": "caaac57095e6a9b97583448a39ee037a", "score": "0.67703843", "text": "def get_hash(key)\n (Zlib.crc32(key).abs % 100).to_s(36)\n end", "title": "" }, { "docid": "7db4dedc2d36f8f40703893f1a709a1a", "score": "0.67121637", "text": "def hexhash\n hash.to_s(16)\n ...
cdf252e5d363bb705d2a4a15fe82b417
GET /mydbs/1 GET /mydbs/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "ede66205d489b99140608fc50813b30d", "score": "0.7017214", "text": "def list_dbs\n http_request(\"GET\", \"admin/databases\", \"application/json\", \"\")\n end", "title": "" }, { "docid": "4154c808b27c562cc6780f0f79a2d0f9", "score": "0.694076", "text": "def all_dbs\...
66e63b8ba99ea11ad98d866c7ee7e0c9
before_action :log_out_before_login, only: [:new]
[ { "docid": "b51f8ded2a42d2da3db24c4c3754f38f", "score": "0.0", "text": "def map\n @concerts = Concert.all\n @concert = @concerts.select(:name, :latitude, :longitude)\n @users = User.find params[:id]\n @user = @users.select(:name, :latitude, :longitude)\n end", "title": "" } ]
[ { "docid": "7b47c38a2c587fc5c5dcb5b2c4a85452", "score": "0.78665686", "text": "def _before_logout; end", "title": "" }, { "docid": "23a43b27e809db6e22827abd4c4109e4", "score": "0.7186507", "text": "def logged_out\n end", "title": "" }, { "docid": "763315b8f6edd51835f8686...
ff2da1d79240779ab4f25f75a14cfb6a
GET /images/1 GET /images/1.json
[ { "docid": "18b333e632d5eeaebd648073f8949844", "score": "0.0", "text": "def show; end", "title": "" } ]
[ { "docid": "a830ab57c6055538be9c6c825680b7c1", "score": "0.79076755", "text": "def list params = {}\n @connection.get(build_path(\"/images/json\", params)) \n end", "title": "" }, { "docid": "9dac3d3d8052036617f7c40dd8026e1f", "score": "0.76163614", "text": "def show\n r...
f0ef998d9c9f680aff5c6d37098298bc
Confirms a loggedin user.
[ { "docid": "38a8765ef7d609515edfcdb38dcdc035", "score": "0.0", "text": "def logged_in\nunless logged_in?\n redirect_to root_url, flash: {danger: '请登陆'}\nend\nend", "title": "" } ]
[ { "docid": "71b4815350ad43bbdc0f6266ba0d6a96", "score": "0.6876832", "text": "def confirm\n user = User.find(params[:id])\n authorize user\n if user.state != \"active\"\n user.confirm!\n user.make_user_a_member\n\n # assume this type of user just activated someone from somewhere ...
08943b89afd95b71e545f600a0f85c69
Creates a Formkeep::Form object to make calling of other methods simpler.
[ { "docid": "92f09dd42ec9fa58a5ac4ee35f22d4ae", "score": "0.6534857", "text": "def initialize(form)\n @form = form\n end", "title": "" } ]
[ { "docid": "8e1e5f0e82f9a2ead8b78b0878a034c5", "score": "0.70620894", "text": "def form(*args, &blk)\n _singleton_form_context.form(*args, &blk)\n end", "title": "" }, { "docid": "7df735cbf0ea2dd6e97326550d1c593f", "score": "0.7053435", "text": "def form\n form = Form.new(se...
c2be59bd05efd3d8d15605e85edc4cfc
Configure variables. See Textcaptcha::Configuration
[ { "docid": "ae1c9772b01035cae1b91fd74a8755ba", "score": "0.0", "text": "def configure\n self.configuration ||= Configuration.new\n yield configuration\n end", "title": "" } ]
[ { "docid": "a62688bf5e8f490d62029967c312dd1b", "score": "0.6172656", "text": "def recaptcha\n env_config.fetch('recaptcha', {})\n end", "title": "" }, { "docid": "156af5ebe2baad9312cb3ed2be0c01e6", "score": "0.595084", "text": "def setup!\n configuration = Enceladus:...
27754151cbadfdcd63b4cd627bb73248
build new operation id for operations that have multiple parameters all going to the same endpoint
[ { "docid": "571b976fbb2d41b5da2f6da37cbd4af1", "score": "0.7579408", "text": "def build_operation_id(new_api_object, old_api_object, uri, method)\n # builds nice operationId if we have multiple operations.\n\n prefix = \"\"\n if method == \"get\"\n prefix = \"retrieve\"\n elsif method == \"put\"\...
[ { "docid": "91c703d74334528965894271593f3393", "score": "0.70513636", "text": "def operation_id(unique_id)\n if brainstem_params_context == DEFAULT_BRAINSTEM_PARAMS_CONTEXT\n raise \"`operation_id` is endpoint specific and cannot be defined on the controller\"\n end\n\n ...
f4b9fcfa08240318211ab4247a79cf98
Todo: Change the include to substring
[ { "docid": "f738c055339ed4b788bf6361e857497d", "score": "0.0", "text": "def location_check(preferred_locations_array, tweet_location_to_check)\n preferred_locations_array.each do |location|\n if tweet_location_to_check.include? location\n return true\n end\n end\n return false\nend", "...
[ { "docid": "58cdbcbc4b8a0ad139d93accf0911de2", "score": "0.7057937", "text": "def formate_balises_include str\n str.gsub!(/INCLUDE\\[(.*?)\\]/){ traite_fichier_include($1) }\n return str\n end", "title": "" }, { "docid": "6ab61370479ca5081f8333312121c1dc", "score": "0.6997903", ...
d26f263d7286e3c142ddd62d69c4df36
link the src object to the newly created standard object
[ { "docid": "6b88106f956a84f522f2c415e62be9ed", "score": "0.0", "text": "def link_object_to_standard(standard_object)\n if new_record?\n self.standard_id = standard_object.id\n else\n update_column(:standard_id, standard_object.id)\n end\n end", "title": "" } ]
[ { "docid": "50b693b1a0701240b43877bad9be48af", "score": "0.68675214", "text": "def link(src, dst)\n\n end", "title": "" }, { "docid": "5aece9fa6f35b49ad4f914cc47232c2f", "score": "0.6517946", "text": "def link(src, dst)\n assign(src, dst)\n end", "title": "" }, { ...
016563f7300c76f4ff613591f26367dd
GET /items/1 GET /items/1.xml
[ { "docid": "edbe3615c4166ab04bd6dd52d48ceb7c", "score": "0.0", "text": "def show\n @item = Item.find(params[:id])\n render :json => @item\n end", "title": "" } ]
[ { "docid": "5cf88c246c59a555b593493e4faf248b", "score": "0.7472082", "text": "def show\n @item = Item.get!(params[:id])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n end\n end", "title": "" }, { "docid": "b637e6b4fd81915...
2b82d8e7347f6ad503b56f6adcd42e7e
can players be added to this game?
[ { "docid": "85955a004866a1c48549f4c9a4fd751f", "score": "0.8177365", "text": "def can_add_player?\n players.length < MaxPlayers\n end", "title": "" } ]
[ { "docid": "b547dc53f0fd815d7041aff659268d40", "score": "0.7894358", "text": "def can_add_new_player?\n waiting_to_start? && (players.length < MaxPlayers)\n end", "title": "" }, { "docid": "1cfb3f2344b2bf8e2a77f57aaf693112", "score": "0.7177975", "text": "def looking_for_players?...
ec25f5492089957dba1b6f113c0934e4
Return url for user's avatar image
[ { "docid": "b330b16a125097662c7adc70abf69e41", "score": "0.0", "text": "def image_url(size = :default)\n if self[:image_url]\n self[:image_url]\n else\n gravatar_id = Digest::MD5::hexdigest(self.email).downcase\n size_param = size == :thumb ? '&s=50' : '&s=200'\n\n \"http://gra...
[ { "docid": "acde07d16910af8d7e30b415f42e101e", "score": "0.87072533", "text": "def avatar_url\n return API::User.default_avatar unless @avatar\n\n API::User.avatar_url(@id, @avatar)\n end", "title": "" }, { "docid": "acde07d16910af8d7e30b415f42e101e", "score": "0.87072533", ...
3c196b60f89780ce8891595c6e9d1dec
check and record the error from the expected and actual integers
[ { "docid": "bdd29c43f50109e1d0feb445430be352", "score": "0.7105582", "text": "def check_error(expected, actual)\n @chars_seen += 1\n @bits_seen += @num_outputs\n\n if expected != actual\n @chars_wrong +=1\n puts \"char wrong, expected: #{expected.chr}, guessed: #{actual.chr}...
[ { "docid": "33ab670cf381e6876f5d3703163b0d5f", "score": "0.68547446", "text": "def valtest_errors(received, expected)\n assert(expected.length == received.length,\n valtest_unsame_messages(received, expected, \"Error\", ERRHEAD))\n received.each_index do |i|\n assert(received[i] == ...
2c346b2562a97046fe07ef7b02acaa49
POST /accounts POST /accounts.json
[ { "docid": "213e6a44b3ca69e1e27261c9b529f0e1", "score": "0.0", "text": "def create\n @user = current_user\n if @user.valid_password?(params[:current_password])\n if params[:new_password] == params[:re_type_password]\n @user.password = params[:new_password]\n @user.save\n ...
[ { "docid": "77f307f64106f05b8f139085144085f2", "score": "0.7698442", "text": "def create\n @account = current_user.accounts.create!(account_params)\n @account.save\n render json: @account\n end", "title": "" }, { "docid": "345d97ffa21872a109a16575d6d574c6", "score": "0.7598518"...
95483306aaff5f66052b625e6864411e
find a comment in a discipline/topic/post
[ { "docid": "6195e0a3faa51f2ff3baf0242b68ef20", "score": "0.79953116", "text": "def findComment(discipline_id, topic_id, post_id, comment_id)\n @post = findPost(discipline_id, topic_id, post_id)\n @comment = @post.comments.find(comment_id)\n end", "title": "" } ]
[ { "docid": "661f100c788761e7ac6c87cf9f1de6f1", "score": "0.73007023", "text": "def find_comment(story_id, comment_id, *args)\n path = \"story/#{story_id}/comments/#{comment_id}\"\n Rdigg.fetch(path, @@type, args)\n end", "title": "" }, { "docid": "3469240d9e23116cd95024294f538ce1", ...
9ef2ecc775c11a7b107aab521774e980
Returns true if response starts with a 'y' or 'Y' (as in 'yes') Returns false if response starts with a 'n' or 'N' (as in 'no') Aborts if response starts with a 'q' or 'Q' (as in 'quit')
[ { "docid": "0f3f7ab8f5df9b09c18ef6e42e1ba56c", "score": "0.7498846", "text": "def respond_yes_to? prompt\n print \"#{prompt} (y/n/q) \"\n normalized_response = gets[0].chomp.downcase\n normalized_response.eql?('q') ? abort('... quitting') : normalized_response.eql?('y')\nend", "title": "" } ]
[ { "docid": "995ad1fcc4965543544e8a732bbdc852", "score": "0.76470125", "text": "def user_agree?\n return gets.chomp =~ /^(y|yes)$/i\n end", "title": "" }, { "docid": "adc88198b787328ea01e52535fdaf479", "score": "0.7611118", "text": "def require_yes_no\n while ![\"yes\", \"no\"]...
bb6779a88e8eaedc7a0ad6a8049effa0
Carry out static testing on the code below. Read through the code. Comment any errors you can see without correcting them.
[ { "docid": "c3cfcf65941692caa14403a649b1adcc", "score": "0.0", "text": "def func1 val # argument should be in brackets\r\n if val = 1 #should be == not =\r\n return true\r\n else\r\n return false\r\n end\r\n end", "title": "" } ]
[ { "docid": "16a6d5e8eabd975007f205c109c50890", "score": "0.6791806", "text": "def testing; end", "title": "" }, { "docid": "deca5e01605df7655cd433763b5329db", "score": "0.6762801", "text": "def non_example_failure; end", "title": "" }, { "docid": "36d6426b60095cdd1428a9f3...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "8254ec44eee03dfe1c9cb48920354244", "score": "0.0", "text": "def set_task\n @task = Task.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...
d59288e3d283fbb1ac7410540c9aba5f
Restituisce l'ID del gruppo di mostri
[ { "docid": "966b186d8f0a7803e212d9dfbb2182ef", "score": "0.0", "text": "def troop\n return 0 if @item_type != 1\n item.troop_id\n end", "title": "" } ]
[ { "docid": "aa2f2b8a43f8b8e596e5f65f4574d084", "score": "0.6834893", "text": "def gm_id\n @meta['gm_id'].to_s\n end", "title": "" }, { "docid": "5b7d947cbe00c5a80c9632535cd1f64b", "score": "0.6785486", "text": "def id\n return self.group['id'].to_i\n end", "ti...
47e0ce4be71e687ecbd1a23762a1ec93
POST /users/batch_create POST /users/batch_create
[ { "docid": "e814c3a92a6688e8aba32092b90c2318", "score": "0.0", "text": "def admin_create\n @user = User.new(user_params)\n @user.company = current_user.company\n @user.assign_random_password\n if @user.save\n @user.approve\n @user.activate\n # add in each role type\n @use...
[ { "docid": "7e3516fd71d37802237f55196144e939", "score": "0.76359284", "text": "def batch_create\n params[:batch]&.to_unsafe_h&.each do |batch_resource, objects|\n batch_resource = batch_resource.to_s\n batch_module = batch_resource.underscore.singularize.to_sym\n resource = bat...
9dc0c1c81821d38057b03921c07d728d
A decorator should return this ideally that way, we'd ensure the hostname featured too
[ { "docid": "f591facf8d884b73f29d3ac7d54fa546", "score": "0.0", "text": "def uri\n '/formats/' + @id\n end", "title": "" } ]
[ { "docid": "41303d1d072b9f06253adb1d38716fd6", "score": "0.74998415", "text": "def hostname; end", "title": "" }, { "docid": "41303d1d072b9f06253adb1d38716fd6", "score": "0.74998415", "text": "def hostname; end", "title": "" }, { "docid": "41303d1d072b9f06253adb1d38716fd6...
91da26dc9d20f724e7d48201207f5a47
RIGHTS SET Extracts the editionSet fields and creates Solr::Field objects == Returns: An array of Solr::Field objects
[ { "docid": "fd4a1053b597bdd5e22157770e0138d7", "score": "0.74220264", "text": "def extract_rightsSet\n rightsSet_array = {}\n self.find_by_terms('//vra:rightsSet/vra:display').each do |rights_display|\n insert_solr_field_value(rightsSet_array, \"rights_display_tesim\", rights_display.text)\n ...
[ { "docid": "c3b7e25cfb62b016df6ebdc8d732e862", "score": "0.74045587", "text": "def extract_editionSet\n editionSet_array = {}\n self.find_by_terms('//vra:editionSet/vra:display').each do |edition_display|\n insert_solr_field_value(editionSet_array, \"edition_display_tesim\", edition_display.t...
d0ce3b6accd4842671a5a1fee983e6a9
I worked on this challenge [by myself, with: ]. shortest_string is a method that takes an array of strings as its input and returns the shortest string +list_of_words+ is an array of strings shortest_string(array) should return the shortest string in the +list_of_words+ If +list_of_words+ is empty the method should ret...
[ { "docid": "80cea8de737c9e9a1ac81cf1273f24a1", "score": "0.81911725", "text": "def shortest_string(list_of_words)\n shortest = list_of_words[0]\n list_of_words.each do |word|\n if \n word.length < shortest.length\n shortest = word\n end\n end\n return shortest\nend", "title": "" ...
[ { "docid": "96eb6b341b08a6a244124d87f7c414da", "score": "0.8691857", "text": "def shortest_string(list_of_words)\n # Your code goes here!\n#Need to iterate through each string in the the array and count the length\n#Compare the first index of the array with the other index to determine if \n#the first ...
6e107c90460a403dd83907aaadfd2429
method to deactivate record
[ { "docid": "18ab00072c0fd060fd0744b2ea6fdbf3", "score": "0.820447", "text": "def deactivate\n if self.deactivated == 0\n self.deactivated = 1\n else\n errors.add(:deactivated, \"record already deactivated\")\n end\n end", "title": "" } ]
[ { "docid": "6f18cf2fef8ea8046988d0d47a835653", "score": "0.82438004", "text": "def deactivate\n if self.deactivated == 0\n self.deactivated = 1;\n else\n errors.add(:deactivated, \"record already deactivated\")\n end\n end", "title": "" }, { "docid": "2097456881f52c73d2a5...
876d9e59f1276b87626b94d73f6c64da
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.user_mailer.welcome_email.subject
[ { "docid": "8ee02e6d0906a4b63d2f2a980adff280", "score": "0.0", "text": "def welcome_email user\n require 'mandrill'\n\n return if user.email.blank?\n email = user.email\n p ENV['MANDRILL_APIKEY']\n\n mandrill = Mandrill::API.new ENV['MANDRILL_APIKEY']\n template_name = ENV['MANDRILL_TE...
[ { "docid": "f2fecd58a29b9acf94ad3b95a78dc2e7", "score": "0.8055369", "text": "def welcome_email_subject\n @attributes[:welcome_email_subject]\n end", "title": "" }, { "docid": "ea740e704e8f1173fb87b45dfcaaf989", "score": "0.76168793", "text": "def subject_for(key)\n I18n.t...
bca70bb718fd3372078fd01083dc2996
p sorted_arrays [1,3,5], [2,4,6] [100, 101, 200, 3, 1000] ==> [2,4] brute force Largest Sum Contiguous Subarray return index
[ { "docid": "a93dc8f53eb14e418d426797498bf514", "score": "0.0", "text": "def puppy_golden_age array\n res = []\n # store the moving max sum of sub arrays.\n max_sum = 0\n\n for i in (0...array.length)\n for j in (i...array.length)\n # this is the key to reset the sum every iteration in inner ...
[ { "docid": "d28507a92f86a077371bd9c3e9a67c6c", "score": "0.80135345", "text": "def largest_contiguous_subsum(array)\n best_sum = 0\n sum = 0\n subarray = []\n array.each_with_index do |el1, idx1|\n array.each_with_index do |el2, idx2|\n subarray << array[idx1..idx2]\n end\n end\n subarr...
974210510d34d3ca6e06af3080218156
This function return the name of the superuser of the message.
[ { "docid": "859cfac689a31aae725e529e99af912a", "score": "0.78227776", "text": "def get_superuser_name\n superuser = LatoCore::Superuser.find_by(id: self.superuser_creator_id)\n return superuser.name if superuser\n end", "title": "" } ]
[ { "docid": "c0956eb80c2018a6e67fcfd73f9cb017", "score": "0.75436556", "text": "def string_superuser_creator_name\n superuser = LatoCore::Superuser.find_by(id: self.superuser_creator_id)\n return superuser.name if superuser\n end", "title": "" }, { "docid": "c0956eb80c2018a6e67fc...
b711b02416f06d4af1ab6434ac475aa3
GET /pratices GET /pratices.json
[ { "docid": "534879a37e04fc7737f6629edbece7fb", "score": "0.7084058", "text": "def index\n @pratices = Pratice.all\n end", "title": "" } ]
[ { "docid": "a48a033a788fdebb2a77104f36901d8c", "score": "0.71854496", "text": "def index\n @pessoas = Pessoa.all\n render json: @pessoas\n end", "title": "" }, { "docid": "51ea57fcafe28ace1ac99853d21ecc72", "score": "0.71005625", "text": "def show\n render json: @pessoa\n ...
a794e918ba3eacbadcde2ceef25d3a10
this helper method returns an array of all prime numbers less than limit using the sieve of eratosthenes algorithm
[ { "docid": "3ea60bccdc6fd78645777e438b5b4301", "score": "0.79388523", "text": "def prime_sieve(limit)\r\n\tnums = (2..limit).to_a\r\n\tsqrt = Math.sqrt(limit)\r\n\tprimes = []\r\n\r\n\t# once sqrt is passed, all multiples of remaining nums have already been rejected.\r\n\tuntil nums.first > sqrt\r\n\t\t...
[ { "docid": "1d4d89e8cf8a72b3ede3b1d6b55620b0", "score": "0.83349603", "text": "def prime_sieve(limit)\n numbers = (0..limit).to_a\n cancel = Array.new(numbers.size) { |i| i > 1 }\n numbers.each_with_index do |x, i|\n if cancel[i]\n (2..(limit / x)).each do |j|\n cancel[j * x] = false\n...
3a0d489e5da08507bce245bbdb838278
Generates real floatingpoint numbers which are never positive. Shrinks towards 0 c.f. real_float >> Generators.real_nonpositive_float().sample(10, size: 10, rng: Random.new(44)) => [9.125, 2.3636363636363638, 8.833333333333334, 1.75, 8.4, 2.4, 3.5714285714285716, 1.0, 6.111111111111111, 4.0]
[ { "docid": "08d58cb2720758f546d88ea8c626b303", "score": "0.69354254", "text": "def real_nonpositive_float\n real_nonnegative_float.map(&:-@)\n end", "title": "" } ]
[ { "docid": "186bbc38e69e0a7c3308477c704907c6", "score": "0.6782499", "text": "def float(range = nil)\n case range\n when Range\n between(range.begin, range.end - 1) + rand\n when Numeric\n between(0, range - 1) + rand\n else\n between(FLOATMIN, FLOATMAX) + rand\n...
a2ce3b9cb236c52063138feb730aee4e
returns the number of rows/weeks in the calendar this month
[ { "docid": "d4e7ccf9280d40eeb1aad4adb22f8b6b", "score": "0.7364266", "text": "def num_weeks\n date_range.count / 7\n end", "title": "" } ]
[ { "docid": "455f8f4e4fc3549a3a94f74dc8a08efc", "score": "0.835157", "text": "def rows_count\n starting_wday = @day_start.wday - 1\n starting_wday = 6 if starting_wday < 0\n\n ((days_in_month(@day_start) + starting_wday) / 7.0).ceil\n end", "title": "" }, { "docid": ...
c2dbc18b2dc0810c253eec3df3d9d38a
GET /universities/new GET /universities/new.xml
[ { "docid": "4e84f70029485c137a8eb420af46d1b6", "score": "0.70736676", "text": "def new\n @university = University.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @university }\n end\n end", "title": "" } ]
[ { "docid": "6f7f29d61e40d5b675a915438be745b4", "score": "0.66806394", "text": "def create\n\t\t@university = University.new(params[:university])\n\n\t\tif @university.save\n\t\t\trecord_activity(\"created univeristy: \" + @university.id.to_s)\n\t\t\tredirect_to universities_path\n\t\telse\n\t\t\trender ...
54e9e2307cf1e53567caffbb9ee0bf5f
DELETE /apps/1 DELETE /apps/1.json
[ { "docid": "8993e2bbd7c0019bfb3ca48197163935", "score": "0.7131444", "text": "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to admin2017_apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": ...
[ { "docid": "f35cfd6b358f2131ff1263972a0e6bdb", "score": "0.77280873", "text": "def destroy\n @client.app_destroy(params[:id])\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "df0c...
36318d1ef71f904fc5cf7a42ae5b5826
GET /mies/1 GET /mies/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "bf36f78f493a7e9db8aed21318b1b215", "score": "0.63770455", "text": "def get_monster(monster_id)\n RESTful.get(\"#{URL_MICROSERVICE_MONSTER}/monster/#{monster_id}\")\n end", "title": "" }, { "docid": "fb115d07548d427d5f3cd484cabf0df1", "score": "0.6333038", "text": "def...
459f472247655d36280fd3ce0d5ad54b
Reads params from a file. Can handle cases where some params contain an array of values. All params that have only a single value will not be arrays.
[ { "docid": "c984d0424361dca8ea8aebddbfc6f020", "score": "0.5401076", "text": "def read_params csv_file, sym_keys = true, autocast=true\n params = {}\n File.open(csv_file, \"r\") do |infile|\n while (line = infile.gets)\n if !['#', nil, ''].member? line.strip.split('')[0]\n par...
[ { "docid": "6ca6674bfd1e77a92f60134770e3d740", "score": "0.6665403", "text": "def read_params(paramfile) \n\tparams = []\n\tdomain = Hash.new\n\tdefault = Hash.new\n\tconditionals = Hash.new\n\tforbidden_combos = []\n\n\tFile.open(paramfile){|file|\n\t\t#=== Match parameter format: param_name {value1,va...
4ae6628c7ad835f6d368a82b68342690
Check if the checksum is valid for the parameters received from PayTm. This is requrired to make sure that the request is received from PayTm.
[ { "docid": "0248b7e4594dfa2ca43af6b340a95624", "score": "0.75292414", "text": "def is_checksum_valid?(received_params)\n paytmparams = Hash.new\n\n keys = received_params.keys\n keys.each do |k|\n paytmparams[k] = received_params[k]\n end\n\n checksum_hash = paytmparams[\"CHECKSUMHAS...
[ { "docid": "28c10591ed5f7f4fc62f681101293473", "score": "0.71006435", "text": "def validate_checksum?\n self[:checksum] !~ /time/\n end", "title": "" }, { "docid": "e263d1e83b6048c8638e7fb77e2d86bd", "score": "0.70919", "text": "def checksum_invalid?\n !checksum_valid?\n end"...
08a7ed1989da2ae6bcc218872261cbbf
Specify a list of mimetypes associated with this lexer.
[ { "docid": "82074c03e3e7e673617b87d2d2e378e5", "score": "0.748217", "text": "def mimetypes(*mts); end", "title": "" } ]
[ { "docid": "e7d5a301c0d33c2de05d251eb4b14b41", "score": "0.7783794", "text": "def mimetypes(*mts)\n (@mimetypes ||= []).concat(mts)\n end", "title": "" }, { "docid": "e7d5a301c0d33c2de05d251eb4b14b41", "score": "0.7783794", "text": "def mimetypes(*mts)\n (@mimetype...
293f5a117f43431c80fdcda9a0bd7d0b
for use in request specs
[ { "docid": "2df285dcda086cea7506070f04a1c6b5", "score": "0.0", "text": "def login_admin\n @admin = FactoryBot.create(:user)\n @admin_role = FactoryBot.create(:role, name: 'Admin')\n FactoryBot.create(:authority, :authorizable => @admin, :role => @admin_role)\n login_as @admin\n end", ...
[ { "docid": "c5036a247d6d36888e108137980f43eb", "score": "0.70857376", "text": "def request; end", "title": "" }, { "docid": "c5036a247d6d36888e108137980f43eb", "score": "0.70857376", "text": "def request; end", "title": "" }, { "docid": "c5036a247d6d36888e108137980f43eb",...
6de68c449eb977df66b0526b97281102
DELETE /powe_factor_nozzle_xes/1 DELETE /powe_factor_nozzle_xes/1.json
[ { "docid": "fc67946df76caa49d7eea03e75486b19", "score": "0.79491097", "text": "def destroy\n @powe_factor_nozzle_x.destroy\n respond_to do |format|\n format.html { redirect_to powe_factor_nozzle_xes_url, notice: 'Powe factor nozzle x was successfully destroyed.' }\n format.json { head :n...
[ { "docid": "35ab56ebb002945e082b40b130885d41", "score": "0.6500708", "text": "def destroy\n @powiadomienie = Powiadomienie.find(params[:id])\n @powiadomienie.destroy\n\n respond_to do |format|\n format.html { redirect_to powiadomienia_url }\n format.json { head :no_content }\n end\...
2eee264f187c5686e378b7951f6ee75d
GET /turns GET /turns.json
[ { "docid": "31eddf56a2955c9eb36fd30bb3dd040b", "score": "0.63944066", "text": "def index\n @turns = Turn.where(user_id: (current_user)).all\n end", "title": "" } ]
[ { "docid": "495337e61d72b4c2604a957d5521ceac", "score": "0.7721048", "text": "def index\n @turns = Turn.all\n\t\trespond_with @turns\n end", "title": "" }, { "docid": "0eb89d23f9133a03e83419b7fffe2e89", "score": "0.70756906", "text": "def index\n @games = current_user.games\n ...
1d6f9916f3d50d4a47cd0f6a9036ff35
Returns what move to make for the computer based on the analysis. The method creates a Mind object to hold an exponential smoothed vector in RPS space. It goes through the history and checks whether or not to add to the mind. If the length of history is less than 2 it returns a random value.
[ { "docid": "2c102946c84f4515fa76008989c0e52c", "score": "0.0", "text": "def think\n # Return if there just isn't enough history\n return rand(3) if @user.size < 2\n # Set up the hashes\n user = {} if @analyze_user\n comp = {} if @analyze_computer\n # Set up the patterns\n upattern, ...
[ { "docid": "db4b615f446d6b47e9c093a6a0a1f9c1", "score": "0.57989144", "text": "def suggest_move(current_x, current_y, current_angle)\n speed = ( (rand() *2) - 1) * @factor\n angvel = ( (rand() *2) -1) * @factor\n m = Move.new(speed, angvel)\n return m\n end", "title": "" },...
ecb8c34940f4c4d206a26bfc6ef1b75e
Append new results in the json file
[ { "docid": "8a4586a97e3ea3bfcd663d5a0219c013", "score": "0.54362375", "text": "def append_results(reports, filename, res)\n reports[filename] ||= []\n reports[filename] << {\n 'Date' => Time.now,\n 'Issues with convention' => (res[:C].empty?) ? nil : res[:C],\n 'Errors' =>...
[ { "docid": "14b0ac1baf0c8c6af17884b49db741b6", "score": "0.6790671", "text": "def combine_data\n results = []\n (1...15).each do |i|\n puts i\n f = File.read(\"data/#{i}.json\") #read the file\n h = JSON.parse(f) # parse json\n h['results'].each do |result|\n results << result # appen...
a902f04a36a2b2036dcb996b9ed5e315
Get all project assets
[ { "docid": "b4ade445be3fdef1686e0d01cc27a1fc", "score": "0.7631218", "text": "def project_assets\n assets = [\n ['style.css'],\n ['plugin.css'],\n ['admin.css'],\n ['javascripts', 'theme.js'],\n ['javascripts', 'plugin.js'],\n ['javascripts', ...
[ { "docid": "dd20206a8a185105bb1e3fd6f2059eec", "score": "0.7537038", "text": "def assets\n @assets ||= []\n end", "title": "" }, { "docid": "6922e8b13a026e717d50828216f781fe", "score": "0.74023074", "text": "def assets\n if @assets.nil?\n @assets = AssetsT...
107c97d2d7de765a689fe89ee6d9b89b
rand(1..6) user input (gets) win/lose
[ { "docid": "be40db5dfbdf184652349257629b7dcc", "score": "0.69425184", "text": "def run_guessing_game\n puts \"Guess a number betwen 1 and 6.\"\n num=rand(6)+1\n input=gets.chomp\n \n if input.to_i ==num\n puts\"You guessed the correct number!\"\n end\n \n if input==\"exit\"\n puts \"Goodby...
[ { "docid": "a2d48aaccff8b389c72e2adf32f1bd35", "score": "0.72898495", "text": "def game\n@comp_wins = []\n@user_wins = []\n\n\tuntil @comp_wins.length == 5 || @user_wins.length == 5 do\n\t\t\t\n\t\t\t\t\n\n\t\tp user = 1 + rand(6)\n\t\tp comp = 1 + rand(6)\n\n\t\tif user > comp\n\t\t\tputs \"Winner winn...
250e45df0dc8dbceed4db348d31351ae
To be overriden on child classes whenever blocking position updates is necessary.
[ { "docid": "832a432be256a937522f06ad4e330668", "score": "0.0", "text": "def check_repositioning_allowed!\n nil\n end", "title": "" } ]
[ { "docid": "5f6dbb299090029575b0837cf491ee71", "score": "0.77629846", "text": "def update_positions\n super if @update_positions\n end", "title": "" }, { "docid": "4babee9a3f54a5612c5229e31d18f24b", "score": "0.74357516", "text": "def update_position\n end", "title":...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "a6a3b57f14a0d4a27f2697ec1c82cddf", "score": "0.0", "text": "def set_assignment\n @assignment = @course.assignments.find(params[:assignment_id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.61637366", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.60446453", "text": "def action_hoo...
64fbed488c36a6b62ce258d60ccfaf9a
See Client.AddQuery for details.
[ { "docid": "8e9b6fc60377a5a72b2f9b7c94bef8e8", "score": "0.7106038", "text": "def AddQuery(query, index = '*', comment = '')\n Lib.sphinx_add_query(@sphinx, query, index, comment)\n end", "title": "" } ]
[ { "docid": "c8e771ae82b50606e4fb51e48f06a2e7", "score": "0.84903336", "text": "def add_query\n @multiple_queries = true\n @client.AddQuery(@query, @index)\n end", "title": "" }, { "docid": "f38e329cd43481455c5cfb5e8bfda73e", "score": "0.76687396", "text": "def add_...
92cc0aef91f8867bdc9337a3fc984243
Create an SP initiated SLO
[ { "docid": "339232b17c455e65ced0c2f7f9523326", "score": "0.45648846", "text": "def sp_logout_request\n # LogoutRequest accepts plain browser requests w/o paramters\n settings = saml_settings(url_base)\n\n if settings.idp_slo_target_url.nil?\n logger.info \"SLO IdP Endpoint not found in set...
[ { "docid": "418f472f112f8573cfc29fb3e562e592", "score": "0.5598582", "text": "def create_sr(package,from,to)\n puts \"Creating submit request for package #{package} from #{from} to #{to}\"\n if Options.instance.debug_project\n to = Options.instance.debug_project\n puts \"Creating submit request ...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "5139f5b4ad9704fbbe6f86ae3ea7c800", "score": "0.0", "text": "def key_analytical_params\n params.require(:key_analytical).permit(:cat_pgd_axi_id, :cat_ere_expending_focu_id, :cat_ere_result_id, :cat_ere_subresult_id, :year, :sector, :subsector, :unidad_responsable, :cat_cfu_finality_id, :...
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.79438007", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.6958792", "text": "def permitted_params\n params.permit!\n end", "title"...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "c41eaa1ea9ce7ebd742d4e4f88e9be04", "score": "0.0", "text": "def announcement_params\n params.require(:announcement).permit(:description, :member_id)\n end", "title": "" } ]
[ { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.7121987", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "b32229655ba2c32ebe754084ef912a1a", "score": "0.70541996", "text": "def expected_permitted_parameter_names; end", "title": "...
ad4fdeb6122e630aa2901c5514e07d94
Get the full URL for email notifications This should get pushed upstream to Hyrax
[ { "docid": "48434fed7076c706d75c522cd663392c", "score": "0.0", "text": "def document_url\n key = document.model_name.singular_route_key\n Rails.application.routes.url_helpers.send(key + \"_url\", document.id)\n end", "title": "" } ]
[ { "docid": "7d44c4582d1c6f09ed5b31935d4a65b8", "score": "0.7468117", "text": "def notification_email\n \"notifications@#{Danbooru.config.hostname}\"\n end", "title": "" }, { "docid": "650c8afaa57f3e55168e66992b6c3ef5", "score": "0.69924563", "text": "def notification_channel_...
40362930b531d75c3de468bcef3aff2a
Safari has a hard time rendering base64 images if the base64 data does not contain line breaks (it will peg the CPU for seconds or minutes). The workaround is to split the base64 into short lines. This method detects base64 image data inside an HTML value and modifies it by inserting line breaks. Returns a modified cop...
[ { "docid": "9b30747401bc606e835ba22dea6c6959", "score": "0.68382424", "text": "def summernote_safe_value(value)\n value.gsub(%r{\"data:image/jpeg;base64,([^\"]*)\"}) do\n base64_data = $1.scan(/.{1,76}/).join(\"\\n\")\n %Q(\"data:image/jpeg;base64,#{base64_data}\")\n end\n end", "ti...
[ { "docid": "cbc401759ffed74bde486439f3f977a4", "score": "0.63373005", "text": "def base64(data)\n result = Base64.encode64(data)\n result.delete!(\"\\n\")\n result\n end", "title": "" }, { "docid": "cbc401759ffed74bde486439f3f977a4", "score": "0.63373005", "...
1907466d266a44a1f563085ecc8fbf02
a helper method to determine if this response has any particular fields in its payload, potentially nested
[ { "docid": "cb2edc7fa7e53f8c8096773f4266fc04", "score": "0.0", "text": "def has?(*attrs)\n entity = self\n attrs.each do |attr|\n return false unless entity.has_key?(attr.to_sym)\n entity = entity.send(attr.to_sym)\n end\n true\n end", "title": "" ...
[ { "docid": "e53417026b908d8647d141127ac5672f", "score": "0.6641648", "text": "def any?\n attributes.present?\n end", "title": "" }, { "docid": "1ddb8f04b57be3d16ac5d94c2685a7a1", "score": "0.6581897", "text": "def were_fields_requested?\n !all_requested_fields.empt...
6b79e50cd7eddc6f4199ab747b9a204d
`watch_project` is available in 3.1+ but it's awkward to use without `relative_root` (3.3+), so use the latter as our minimum version.
[ { "docid": "f0af6315b9ed25d9f8eab42515836280", "score": "0.65505755", "text": "def use_watch_project?\n return @use_watch_project if defined?(@use_watch_project)\n version = %x{watchman --version 2>/dev/null}\n major, minor = version.split('.')[0..1] if !$?.exitstatus.nil? && ...
[ { "docid": "40c800fae69b6cbd2bd7108db563765c", "score": "0.5586495", "text": "def project_root; end", "title": "" }, { "docid": "40c800fae69b6cbd2bd7108db563765c", "score": "0.5586495", "text": "def project_root; end", "title": "" }, { "docid": "40c800fae69b6cbd2bd7108db5...
10c58a7366c2ba99ba2346c781799f03
Gets option index (option number, starting at 0) for selected option in the specified select element. Related Assertions, automatically generated: assert_selected_index(select_locator, pattern) assert_not_selected_index(select_locator, pattern) verify_selected_index(select_locator, pattern) verify_not_selected_index(se...
[ { "docid": "add48f48ed058dc67229c9732d4731b3", "score": "0.5325443", "text": "def store_selected_index select_locator, variable_name\r\n command 'storeSelectedIndex', select_locator, variable_name\r\n end", "title": "" } ]
[ { "docid": "107e7b67bcb1e18cfad8552ae20cd10b", "score": "0.63418597", "text": "def select_by_id_get_index(id_name)\n return select_by_id(id_name).selected_index\nend", "title": "" }, { "docid": "394e29f7b589097abc1f4af62b399502", "score": "0.6263342", "text": "def select_item_by_ind...
7688dd253245ae44b3b514e8aaabc0b7
But doesn't redirect for an XHR request for a component file.
[ { "docid": "e7dcee9b6b08d702c64041654e80696f", "score": "0.65562046", "text": "def test_application_as_file_url_from_xhr\n get \"/test/component.vwf\" # TODO: verify the HTTP_ACCEPT headers for an XHR for a component\n assert last_response.ok? # 200, not 3xx\n end", "title": "" } ]
[ { "docid": "4a4b9e29c4ddc8a2965058e094b5eab4", "score": "0.5905248", "text": "def render_component(options) #:doc:\n component_logging(options) do\n response = component_response(options, true)[2]\n if response.redirect_url\n redirect_to response.redirect_url\n ...
2eb569149262e7392de8503da8d69145
screen.unuse_user > array Get unuse user screen.unuse_user => ["admin_user", "delete_user", "edit_user", "new_user", "view_user"]
[ { "docid": "ceac9de6739c73d5a52749a295b1476d", "score": "0.6591989", "text": "def unuse_user\n used_user = []\n users = []\n self.fields.each do |f|\n Cell.find(:all, :conditions => ['field_id = ?',f.custom_field_id]).each do |c|\n used_user << c.value.to_s if !c.value.to_s.empty?\n...
[ { "docid": "0388fae49173b30bbcd943b216509ae5", "score": "0.64638776", "text": "def undeny_user(*ua)\n ua.each do |u|\n case u\n when Integer\n u = @wiki.user_by_id(u)\n when String\n u = @wiki.user_by_name(u)\n end\n @denied_users.delete(u)\n ...
8b8491e0a38a4112681f1ca55f087120
Authorize the Auditee for current audit
[ { "docid": "611897330ffb62251ec9d96b3c950a92", "score": "0.7669249", "text": "def authorize_auditees\n\t \tunless @audit.auditees.map(&:id).include?(current_user.id)\n flash[:alert] = \"Access restricted\"\n\t \t\tredirect_to audits_path\n\t \tend\n\tend", "title": "" } ]
[ { "docid": "f84e9b190ecd0805f813afa1491e3ef2", "score": "0.77532196", "text": "def authorize_auditor\n\t \tunless @audit.auditor == current_user.id\n flash[:alert] = \"Access restricted\"\n\t \t\tredirect_to audits_path\n\t \tend\n end", "title": "" }, { "docid": "17d8ddfb778366b9...
442ef73fe1e9b8b7308eb550c3c63b74
GET /cart_items/new GET /cart_items/new.json
[ { "docid": "dbe4fdc12aaf91eb40eb9e139f3a97d0", "score": "0.82764703", "text": "def new\n @cart_item = CartItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cart_item }\n end\n end", "title": "" } ]
[ { "docid": "fa475aa76a84322e1d21bbd031fcf927", "score": "0.8292654", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cart_item }\n end\n end", "title": "" }, { "docid": "bb121b2aacbdf4346229f53c78b945a6", "score": "0.7...
156b57dbece91ddb1a62a4a067b23d46
Define commonlyused functions on Editor page objects.
[ { "docid": "8545a74c5ba0755765d49eb2382d6efd", "score": "0.0", "text": "def set_functions\n super\n # Click the submit button, wait until a message appears, and return the message text.\n function(:save_record) {submit_button.click ; message.wait_until_present ; mes...
[ { "docid": "c1d47d4d0f99f34760e68f1373e93a5a", "score": "0.65921354", "text": "def promote_page_object_methods\n ::Pages.constants.each do |class_name|\n Kernel.send(:define_method, class_name.to_s.downcase) do\n Pages.const_get(class_name)\n end\n end\nend", "title": "" }, { "d...
193c7641bfe7e1cd679e9131f71458f9
STATUS Show the summary status for all components and containers
[ { "docid": "d80e29d2acf2f30361545f5888b8db07", "score": "0.55132455", "text": "def status_summary(statuspage_id)\n request :method => :get,\n :url => @url + 'status/summary/' + statuspage_id\n end", "title": "" } ]
[ { "docid": "23f2fac029c03e6d1b7069e393e9746f", "score": "0.67189217", "text": "def summary\n res = description\n\n {\n in_service: res.instances.all?{ |e| e[:lifecycle_state] == 'InService' },\n healthy: res.instances.all?{ |e| e[:health_status] == 'Healthy' },\n size: res.instances...
83ec0d19afb27771366aadcbb10d8df5
Check if user has student role
[ { "docid": "12667949b5e40cab1ee0c71e3bd90aa3", "score": "0.86042374", "text": "def student?\n has_role? :student\n end", "title": "" } ]
[ { "docid": "1d2a775ef40523744114ba9337c392f6", "score": "0.8544461", "text": "def student?\n has_role?('learner') || has_role?('student')\n end", "title": "" }, { "docid": "d1ddeac2c5fd495f683c99c425577fe1", "score": "0.8505648", "text": "def student?\n if current_user.rol...
ad55fbf94e71d7ae1d1237447d31c52b
Helper to add twitter feed. FUN FUN!
[ { "docid": "72b871c1b3f1f1bc95ff2ff77d2caf4e", "score": "0.7299458", "text": "def add_twitter\n Socket2me.exec_js %Q{document.body.innerHTML += '<a class=\"twitter-timeline\" href=\"https://twitter.com/hashtag/vim\" data-widget-id=\"750697258291568640\">#vim Tweets</a>'}\n\n Socket2me.exec_js %Q{\...
[ { "docid": "d08db55bab71b827603442ea70ab63ba", "score": "0.7152791", "text": "def addTweets (tweets)\n\t\ttweets.each do |jsonTweet|\n\t\t\taddTweet jsonTweet\n\t\tend\n\tend", "title": "" }, { "docid": "c16d8bc5e1555dd45b57f1f3320aae69", "score": "0.69820726", "text": "def set_twitt...
5960748c67e3b9a39a4a241c216e25d1
Handling uniquness exception coming from db
[ { "docid": "f809ab6ab6889db0aa9e644c7a40556a", "score": "0.55820644", "text": "def save(*args)\n \tsuper\n \t\trescue ActiveRecord::RecordNotUnique => error\n \t\terrors[:base] << \"Please select Different preferences\"\n \t\tfalse\n \t\tend", "title": "" } ]
[ { "docid": "dec215a8263d4b24acc8c85b63d5cdf6", "score": "0.6971567", "text": "def postgresql_not_unique_error_class\n /(PG::UniqueViolation)|(ActiveRecord::RecordNotUnique)|(ActiveRecord::JDBCError)/\n end", "title": "" }, { "docid": "ac08bfadbb6c9c96e17526e29b581eba", "score": "0.66...
fe1313d3ad41ab31df691a61c152bb0b
Replace this with your real tests.
[ { "docid": "8cb773d5b33d21913d2435dd9e1d798d", "score": "0.0", "text": "def test_always_passes\n assert true\n end", "title": "" } ]
[ { "docid": "16a6d5e8eabd975007f205c109c50890", "score": "0.7378937", "text": "def testing; end", "title": "" }, { "docid": "1068832c8229c37488788b46a0871f26", "score": "0.6994956", "text": "def testing\n end", "title": "" }, { "docid": "8fbc98d9068bd9c82033a031286f0a1e",...
3bf9209c761daaec41523d0f14fb57dc
Returns true if +comparison_object+ is the same exact object, or +comparison_object+ is of the same type and +self+ has an ID and it is equal to +comparison_object.id+. Note that new records are different from any other record by definition, unless the other record is the receiver itself. Besides, if you fetch existing...
[ { "docid": "70f19c59eada608f49074ed931f52b21", "score": "0.76511854", "text": "def ==(comparison_object)\n comparison_object.instance_of?(self.class) &&\n id.present? &&\n comparison_object.id == id\n end", "title": "" } ]
[ { "docid": "f7496f2fe76ae795a44dff11e8938162", "score": "0.8410996", "text": "def ==(comparison_object)\n comparison_object.equal?(self) ||\n (self.class.to_s == comparison_object.class.to_s &&\n comparison_object.id == id && !comparison_object.new_record?)\n end", "title": "...
b227ce606d7f457241a497337e0c1e6e
Returns the button for canceling a reply or an edit to a comment
[ { "docid": "7be110eda1e86f96bdac8a30326b22e5", "score": "0.7118705", "text": "def cancel_button_element(index_position)\n comment_elements[index_position].button_element(:xpath => '//button[contains(.,\"Cancel\")]')\n end", "title": "" } ]
[ { "docid": "278b7bca1fa80eb855e69c38385cc6ce", "score": "0.76844496", "text": "def cancel_comment_button(comment, commentable)\n if comment.new_record?\n if commentable.class == comment.class\n # canceling a reply to a comment\n commentable_id = \"#{commentable.ultimate_parent.clas...
c45d9601c02513ca5d1c9fcce72c329c
generate an authorization URL to get the needed authorization key...
[ { "docid": "b1c25c9e2f6cd1ad09d7337946c4597c", "score": "0.0", "text": "def authorization_Url(return_url=nil,app_logo_url=nil)\n # name of application is required.\n raise 'Application Name Required' if @app_name.nil?\n\t\tparam_hash = {}\n\t\tparam_hash['applicationName'] = @app_name\n\t\tparam_h...
[ { "docid": "25494a477dea4ee0e50e28c80541e023", "score": "0.7533842", "text": "def authorization_url\n \"https://\" + auth_host + authorize_path + \"?\" + authorize_url_params\n end", "title": "" }, { "docid": "84e2003627164368f181b9acc0ea96b1", "score": "0.7500364", "text...
b30115969a9b05954bd6719206792d34
vi: set ft=ruby :
[ { "docid": "7593dcc6baa7ffa2db2505338fa12396", "score": "0.0", "text": "def prov_install_php_proxy(config)\n\n $script = <<-SCRIPT\n echo 'if [ ! -z \"$XDEBUG_CONFIG\" ]; then docker exec -e XDEBUG_CONFIG=$XDEBUG_CONFIG -e IDE_PHPUNIT_CUSTOM_LOADER=/app/vendor/autoload.php -t fpm php \"$@\"; e...
[ { "docid": "e3b5aa7fb9019ba714796fec13e3bb5f", "score": "0.5853188", "text": "def enable_indent\n \tVim.command(\"set filetype=#{@filetype}\")\n end", "title": "" }, { "docid": "7aa8cf3a94ceb07fde09c2dbbb1bb333", "score": "0.56426823", "text": "def default_vimrc\n <<-EOS.uni...
210857f9747b60c3dfc496291594ac50
params: email, String returns: Hash, response data from server Return information about an email address, including replacement vars and lists.
[ { "docid": "5e21f81548287ec4ffdc32cadd971cb2", "score": "0.67152226", "text": "def get_email(email)\n self.api_get(:email, {:email => email})\n end", "title": "" } ]
[ { "docid": "3981a290cf91af3ca9282c9a00f138af", "score": "0.6831784", "text": "def search_by_email(email)\n # Build and send request\n response = connection.get do |req|\n req.url \"#{CS_BASE_URL}/#{@resource}/?email=#{email}\"\n end\n render_error_msg(response.body) unless res...
9c0be3ed44c25eb60cc851490ff286aa
Returns if user is root
[ { "docid": "27a3dffc4184bdfd52d15f0daef98a32", "score": "0.7341948", "text": "def root?\n role_is? \"root\"\n end", "title": "" } ]
[ { "docid": "7fcc9153046e8674971e7fc316bc08fa", "score": "0.923282", "text": "def root?\n user == 'root'\n end", "title": "" }, { "docid": "ccf8caf60fe9642f099c60403c6e55fe", "score": "0.8848928", "text": "def root?\n whoami == 'root'\n end", "title": "" }, { ...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "32b7fd95ec0d6e0e917f96f1aa448dfe", "score": "0.0", "text": "def scheduleset_params\n params.fetch(:scheduleset, {})\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.79427844", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.6957069", "text": "def permitted_params\n params.permit!\n end", "title"...
78da61607f528f397a791069d17769b9
ANONYMOUS IMGUR API UPLOAD THAT RETURNS JSON
[ { "docid": "40288dad54b91c569360531351de5d27", "score": "0.6939213", "text": "def upload\n respond_to do ||\n name = params[:image_name]\n @api_key = '647a88812a5dc2a'\n c = Curl::Easy.new(\"http://imgur.com/api/upload.json\")\n c.multipart_form_post = true\n c.http_post( Cur...
[ { "docid": "457f589782dd14d0823d6e5557b2563d", "score": "0.7209738", "text": "def upload_image_file(args = {}) \n post(\"/files.json/captiveportal/images\", args)\nend", "title": "" }, { "docid": "a3c071e74edf9f483e5cc3c2371ac9cc", "score": "0.70492536", "text": "def upload_image(ima...
3d1075f345e0843171fd68c2d45b0942
helper function to extract header field integer or return 1
[ { "docid": "e4d02e6a74c291b76cf6282f1dc52d2f", "score": "0.0", "text": "def getElseM1(d, k)\n if d.key? k\n return d[k].to_i\n else\n return -1\n end\n end", "title": "" } ]
[ { "docid": "f4e530df2c740012aabb2525ce6afbcb", "score": "0.6877873", "text": "def header_index_of(value); end", "title": "" }, { "docid": "eb9def898b63ebd8393d41fb3be83cbd", "score": "0.67788786", "text": "def parse_header(header)\n \tcheck_ID3(header)\n \tcheck_ver(header)\n \tre...
a3b77c04becd852443c75a1b23aa3d19
DELETE /protocols/1 DELETE /protocols/1.json
[ { "docid": "72910ee62e02d0d99e0194bcd8fea8c7", "score": "0.0", "text": "def destroy\n#status_url(Status.find_by_survey_id(protocol.access_code)\n #@p = ResponseSet.where(:user_id => current_user)\n #@protocol = user_id.find_by_survey_id(protocol.access_code)\n #@p = ResponseSet.where(:question...
[ { "docid": "3a50618d0773452b9bf83c766e7b7aef", "score": "0.7641114", "text": "def destroy\n @protocol = Protocol.find(params[:id])\n @protocol.destroy\n\n respond_to do |format|\n format.html { redirect_to(protocols_url) }\n format.xml { head :ok }\n end\n end", "title": "" ...
7fe8d96a2e5396e2e44a64758b18af25
insert new1 to the right of old1
[ { "docid": "50acb3198b84f7b0d4e18ba58f851d1a", "score": "0.597181", "text": "def insertr(new1, old1, lat)\n\treturn [] if lat == []\n\tif old1 == car(lat)\n\t\tcons(old1, cons(new1, cdr(lat)))\n\telse\n\t\tcons(car(lat), insertr(new1, old1, cdr(lat)))\n\tend\nend", "title": "" } ]
[ { "docid": "a1de37a556a5ce1287403bb2b05b4898", "score": "0.6466979", "text": "def insertr2(new1, old1, l)\n\treturn [] if l == []\n\tif atom?(car(l))\n\t\tif car(l) == old1\n\t\t\tcons(car(l), cons(new1, insertr2(new1, old1, cdr(l))))\n\t\telse\n\t\t\tcons(car(l), insertr2(new1, old1, cdr(l)))\n\t\tend\...
21a07d1b20a74e14589a62f35d9fd5f6
remove old shipping category id from ids array add new to ids array
[ { "docid": "a2c4ef796d7d9e8c09399959716808b4", "score": "0.6973801", "text": "def prep_for_deletion (old_id, new_id, vender_id)\n @vendor = Spree::Company.where(id: vender_id).first\n @products = @vendor.products.where(shipping_category_id: old_id).update_all(shipping_category_id: new_id)\n @ve...
[ { "docid": "02832bae6bb8443fc56c4acd91a48fee", "score": "0.6634479", "text": "def save_category_ids\n if @category_ids\n array = @category_ids.delete_if {|category| category.blank? }.delete_if{|category| Category.find_by_id(category.to_s.to_i).nil? }\n array = array.map {|category| Category...
08e910018d576f8fe1ee0d8502208d45
Wandelt ein Kassenobjekt in ein Array von Werten der StandardRubytypen um. Zur Ergebnisstruktur
[ { "docid": "fc700dda6f1fe7672fc8aa7f967b0f49", "score": "0.5456447", "text": "def to_values(eine_kasse)\n instance_vars = @kasse.instance_variables().sort()\n instance_var_values_kasse = instance_vars.map(){|var| @kasse.instance_variable_get(var)}.flatten()\n return (instance_var_values_kasse.i...
[ { "docid": "5a921b7bdd43c4707d68fc39b63b8ef1", "score": "0.6051816", "text": "def converted_arrays; end", "title": "" }, { "docid": "5c0482166e03cf548234b360453f94fb", "score": "0.5876843", "text": "def simbolizza\n self.map do |element|\n if element.is_a? Hash or element.is_...
1c662267fae43beef1aa8d0287458bc3
Creates and assigns the activation token and digest.
[ { "docid": "d3140264ccb691cd6397ddc442793451", "score": "0.8573494", "text": "def create_activation_digest\n self.activation_token = Ambassador.new_token\n self.activation_digest = Ambassador.digest(activation_token)\n end", "title": "" } ]
[ { "docid": "c3df1d3ca9735cd6ad7ef6e8056593e0", "score": "0.8703761", "text": "def create_activation_digest\n self.activation_token = new_token\n self.activation_digest = digest(activation_token)\n end", "title": "" }, { "docid": "7a93a50a66b3bcb1519ceb13ef72f036", "score": "0.869...
0cbb98114ca31ee02c3644b81f5bbe77
Common Schedule button handler routines
[ { "docid": "e7e92e4fe05eb57d0c2c5c2ad3b77967", "score": "0.0", "text": "def process_dialogs(dialogs, task)\n process_elements(dialogs, Dialog, task)\n end", "title": "" } ]
[ { "docid": "c172d4040c3d03c09976f666a5ba84f7", "score": "0.60365325", "text": "def handle(command)\n super do\n check_schedule_validity(command)\n show_short_schedule(@schedule.id)\n end\n end", "title": "" }, { "docid": "1b248c869281a9fac859226...
34fc8c0fc7c0b12706f1c4b14187e7c2
===================================================================================================================== Objective : to open the light box to edit question type
[ { "docid": "43e48bd0b5ebbf877ba7b3b5b59e7e63", "score": "0.0", "text": "def edit_question_category\n \n @question_category = QuestionCategory.find(params[:question_category_id])\n @traits_lists = Trait.where(:status => [\"internal\", \"public\"])\n return render :partial => \"edit_category\", :...
[ { "docid": "11cfdc0d16c31db720b388018b584eb9", "score": "0.67955506", "text": "def edit\n # find_question\n end", "title": "" }, { "docid": "31cb72323e1824db8dbb52bac7878d5c", "score": "0.6623007", "text": "def show_input_options_during_edit\n \t@input_type = params[:selected]...
e937d018e55791bc891d605eb07d32b5
Prints the current game board The board should have the same dimensions each time
[ { "docid": "e5475580b61a12eab5fa6afcdce3e41c", "score": "0.0", "text": "def print_gameboard\n @players.each do |player|\n game_board= []\n game_board << player\n @length.times do |num|\n game_board << \"|\"\n # @player_position.each do|player,position|\n\n ...
[ { "docid": "4c1b96ea0b6f83dacf8fb6b92309a3e5", "score": "0.8535296", "text": "def display_board\n puts \"#{@game_cells[0]} | #{@game_cells[1]} | #{@game_cells[2]}\"\n puts \"--+---+--\"\n puts \"#{@game_cells[3]} | #{@game_cells[4]} | #{@game_cells[5]}\"\n puts \"--+---+--\"\...
05bc305601d507efef28827e8e6ddffa
M42 Stop on material exhausted / Switch I/O pin
[ { "docid": "05eda4fc55ad11b08d0994f124d841b8", "score": "0.78216696", "text": "def stop_on_material_exhausted_switch_i_o_pin(args={})\n fc = Wihajster::GCode.format_command(\"Stop on material exhausted / Switch I/O pin\", arguments)\n write_command(fc)\n end", "title": "" } ]
[ { "docid": "d95150eb5beeacdc6a0230a106cb2f42", "score": "0.6475507", "text": "def turn_off\n @output_pins.each do |pin|\n set_low(pin)\n end\n end", "title": "" }, { "docid": "3c93925964ff45e5c8f6fedadd184bbf", "score": "0.64199203", "text": "def stop\n @porta = 0b...
ff6d8a3e0caff167f0db7a0ba7ef27f4
Takes atoms and adds or removes them from the index depending on the passed operation.
[ { "docid": "6bb45bf237557565b3f98630d9360cab", "score": "0.72198635", "text": "def operate(operation, atoms)\n # ActiveSupport always available?\n atoms_sorted = ActiveSupport::OrderedHash.new\n\n # Sort the atoms into the appropriate shards for writing to individual\n # files.\n ...
[ { "docid": "5b46e44ba210bff42a6f094aa15fde95", "score": "0.6129282", "text": "def apply_mutate(operation)\n\t\tdoc = @documents[operation.document_id] ||= []\n\t\t\n\t\titem = 0 # in the 'contents' array\n\t\tindex = 0 # in a string\n\t\toperation.components.compact.each do |component|\n\t\t\tif compone...
1e6c23fa9be66df51927beb2828cefb6
Write a function that given an array, now CHANGES each of the numbers to be twice as big. This should mutate the original array!
[ { "docid": "12f8e4873ad2a03893bce214cfc35aea", "score": "0.62071764", "text": "def array_times_two!(array)\nend", "title": "" } ]
[ { "docid": "9cd0fecc9c7fb37249af65be4623799b", "score": "0.71438986", "text": "def double_numbers(array)\n new_array = []\n\n array.each do |number|\n new_array << number *= 2\n end\n return new_array\nend", "title": "" }, { "docid": "7fc5e5f60e97238747d9d27c48eb70e9", "score": "0...