query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
9fcd8e3275f06a06dd24b7b94867879f
If the file exists and the file size is the same return true else return false
[ { "docid": "825e0973acc3cfce01b420b2e549fc8a", "score": "0.811398", "text": "def check_file\n if File.exists?(\"#{location}/#{output}\") && check_size\n return true\n else\n return false\n end \n end", "title": "" } ]
[ { "docid": "c867f256203521c459bff0fb4e6c2ff8", "score": "0.83060074", "text": "def same_size_as?(other_file)\n @file_size && @file_size == other_file.file_size ? true : false\n end", "title": "" }, { "docid": "0b143ac6d1096429fbf7e269dcfab57c", "score": "0.79913807", "text": "def...
7c733e68bd3599c83810817569b6cf57
Public: check if user has truly read some topic. It means that the user didn't click "dismiss" or "mark as read" topic the Topic to check Return a Boolean true or false
[ { "docid": "67a5d6464cce8c754e7a58a974c89614", "score": "0.8304909", "text": "def has_truly_read_topic?(topic)\n r = has_read_topic?(topic)\n r && r.to_i >= 0\n end", "title": "" } ]
[ { "docid": "e032f207c75b224bfc730838a2614e0b", "score": "0.79244965", "text": "def topic_read?(topic)\n # Use last_reply_id as cache key, for implement cache by LRU, so the popular cache will keep\n last_reply_id = topic.last_reply_id || -1\n Rails.cache.read(\"user:#{id}:topic_read:#{top...
f47f6f3400fea9a4e2980e1c05fb299b
alias_method :original_email, :email def email self.original_email || email_from_infos end
[ { "docid": "764214e3ed510ff5c661130f4c7a5ceb", "score": "0.0", "text": "def email_from_infos\n user_infos.map(&:email).try(:first)\n end", "title": "" } ]
[ { "docid": "a7c526dd9ccb367581ca8e98edf13d2f", "score": "0.79565203", "text": "def email\n self.user.try(:email) || self.original_email\n end", "title": "" }, { "docid": "a7c526dd9ccb367581ca8e98edf13d2f", "score": "0.79565203", "text": "def email\n self.user.try(:email) || se...
a428c657661bedcdbde62438d6c1a4e0
The various status types: valid, invalid incomplete (???) unreachable (for all communications errors) error (for unpredictable errors)
[ { "docid": "f334a7949edac10311520e2bdfe2fa11", "score": "0.0", "text": "def validation_successful\n new_status = :valid\n _log.info(\"[#{resource_type}] [#{resource_id}], previously valid/invalid on: [#{last_valid_on}]/[#{last_invalid_on}], previous status: [#{status}]\") if status != new_status.t...
[ { "docid": "ddf0fdadfc55b472b8cb991bfbb046fc", "score": "0.6937614", "text": "def status\n case @status\n when 'INVALID_TRUSONA_ID'\n :invalid_trusona_id\n when 'IN_PROGRESS'\n :in_progress\n when 'REJECTED'\n :rejected\n when 'ACCEPTED'\n ...
72f71b654b66feeb48c38920ee32759a
=> [:abc, :def, "ghi", /jkl/, 1, 2] how might we use it?
[ { "docid": "663b94663780e60cb9f17dc1778051b7", "score": "0.0", "text": "def minimum( *numbers )\n min = numbers.first\n numbers.each { |number| min = number if number < min }\n min\nend", "title": "" } ]
[ { "docid": "556bb57c1cb686d26403353f75a5fe15", "score": "0.61240876", "text": "def split; end", "title": "" }, { "docid": "da46290746c4db83621c0bbf3fa19eb4", "score": "0.5709655", "text": "def create_list(items)\n list = {}\n arr = items.split(' ')#split string into indivdual strings...
6d888d38bd9987ab77fd929d870153ee
GET /cautelas GET /cautelas.json
[ { "docid": "1e05dcbb56d1803408117cf371afa065", "score": "0.0", "text": "def index\n \n if can? :admin_reserva, Cautela\n \n @cautelas = Cautela.select(\"cautelas.id,cautelas.militar_id,cautelas.reserva_id, cautelas.data_cautela\",+\n \"cautelas.data_fim_cautela, c...
[ { "docid": "35a26c6908beaa51dbe07ba1d2676780", "score": "0.66311693", "text": "def index\n @normas = Norma.all\n render json: @normas\n end", "title": "" }, { "docid": "519198608870334ec6a6d2e8eca03bec", "score": "0.6368798", "text": "def index\n @interno_unidads = InternoU...
d3f649933bc030093901ae8477829660
GET /categories/1/edit Function to edit a category
[ { "docid": "46afba059d4634b125d5b2bc498542c8", "score": "0.0", "text": "def edit\n #locates the selected category\n @category = Category.find(params[:id])\n #creates a sorted array using all categories\n @all_categories = Category.all.sort {|x,y| x.name <=> y.name }\n #creates an empty h...
[ { "docid": "1aa6c32df19254ef44d4e4d598752783", "score": "0.8515472", "text": "def edit\n # this is now in get_category\n #@category = Category.find(params[:id])\n end", "title": "" }, { "docid": "9a925f3e168277694ba44444c6c30dec", "score": "0.8402772", "text": "def edit\...
1d143f2941bc73fb0e425dea6c36041b
GET /templates GET /templates.json
[ { "docid": "8577769d9662b9eb0f332471e963ed34", "score": "0.67261654", "text": "def index\n @templates = Template.all\n end", "title": "" } ]
[ { "docid": "88c544c265ccbafeced4b371a73363e4", "score": "0.8019614", "text": "def templates\n response = get 'templates'\n response.map{|item| Hashie::Mash.new(item)}\n end", "title": "" }, { "docid": "88c544c265ccbafeced4b371a73363e4", "score": "0.8019614", "text": "def...
74cbb15f690fea94b81b69d193b257ee
Used when creating a new animal. Example: Animal.new('Timmy', 4, 'toad')
[ { "docid": "9b6a674c8e3e6f8767581558c267fd7a", "score": "0.7355807", "text": "def initialize(name, age, species)\n @name = name\n @age = age\n @species = species\n @animal = new_animal\n @toys = toys\n end", "title": "" } ]
[ { "docid": "12bed2fa0473027864b18909f4ad4c16", "score": "0.7252153", "text": "def create_animal\n name, description, cuteness, habitat = capture_animal_attributes\n\tanimal = Animal.create(name: name, description: description, cuteness: cuteness, habitat: habitat)\n\tif animal.valid? # huh, Animal.crea...
a6527a2ee7f77ed7a93a4b65ae76ef25
Obtain an InputSet object, used to define inputs for an execution of this Choreo.
[ { "docid": "2a0a1b0990eb6a2255dc1e7c398bea6f", "score": "0.0", "text": "def new_input_set()\n return DeletePlanInputSet.new()\n end", "title": "" } ]
[ { "docid": "d8eb34cfc5a1e737977f7023d4849c46", "score": "0.6741255", "text": "def new_input_set()\n return CreateObjectInputSet.new()\n end", "title": "" }, { "docid": "7c0d7c433cd4eb8e36bdc3a383e9ec33", "score": "0.65807736", "text": "def new_input_set()\n return Ru...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "aab28679e67c424e2c9a1f5bb89e1cd9", "score": "0.0", "text": "def event_notice_params\n params.require(:event_notice).permit(:title, :content, :publisher)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7498391", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6958937", "text": "def strong_params\n params.require(:request).permit(param_white...
6f02a76d3b67357b9f492186885992c6
List Groups List [groups]( under an account. Prerequisite: Pro or higher account. Scopes: `group:read:admin`
[ { "docid": "3b46714741282ba7c1a3738df422c59d", "score": "0.0", "text": "def groups(opts = {})\n data, _status_code, _headers = groups_with_http_info(opts)\n data\n end", "title": "" } ]
[ { "docid": "fdc427dd6b04713a9d2718e525c05871", "score": "0.8394644", "text": "def list\n response = @client.get('groups')\n verify response,\n forbidden: 'You do not have permission to view the groups list'\n end", "title": "" }, { "docid": "fe0cc0b73a80abbd409c84a89...
d91d2b09ae303b76b620242e12c7da25
GET /users/:user_id/xemojis/1 GET /users/:user_id/xemojis/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "3cb7ecbd5de5c230cf8605b62dab7994", "score": "0.7907821", "text": "def index\n @xemojis = XemojisForUserService.new({user: @user}).call\n end", "title": "" }, { "docid": "99479610fc95954695030adda266445c", "score": "0.5919946", "text": "def scrape_emoji_page(url)\n ...
70c7337dfc52f9bef93e35cc6ebbb0c3
Performs an advanced whiteboard search
[ { "docid": "44a83b748fdaa416011a6e0eee405fc7", "score": "0.0", "text": "def advanced_search(string, user, inc_deleted = nil)\n logger.info 'Performing advanced search'\n open_advanced_search_button unless advanced_search_keyword_input_element.visible?\n logger.debug \"Search keyword...
[ { "docid": "dfa246bd237534d14f835057a4c0e786", "score": "0.6478264", "text": "def search\n \n end", "title": "" }, { "docid": "626f2e7ee988b6af00b877499f8539cf", "score": "0.6466767", "text": "def advanced_search\n \n end", "title": "" }, { "docid": "c7b471f...
1d4766fac573d3487d67bc426ee581f8
Starts garbagecollecting and then flushes the finalized objects to the subprocess. Does the same thing in the subprocess.
[ { "docid": "70379253ab3ff8d1733e674c70a02d0d", "score": "0.76746523", "text": "def garbage_collect\n GC.start\n self.flush_finalized\n send(cmd: :garbage_collect)\n return nil\n end", "title": "" } ]
[ { "docid": "afa46bd6a2992f704fe2036b8d6978c0", "score": "0.74540496", "text": "def cmd_garbage_collect(obj)\n GC.start\n self.flush_finalized\n return nil\n end", "title": "" }, { "docid": "aed041e4c4ead52930fb72e57047ae17", "score": "0.6968946", "text": "def garbage_collec...
27cc634db9de03267fb1de9a914d57b1
Pulls from the remote api, handles qps issues by sleeping and retrying silently
[ { "docid": "d72e5cb49134d17183265f7f504c8e6a", "score": "0.0", "text": "def fetch_entity\n # log the element, get the api singleton, and trigger the api call\n log \"Processing #{@element.namespace.to_s.singularize} #{@element.permalink.inspect}\"\n api(@element.data_source).fetch_entity(...
[ { "docid": "9a5d8359db2e7e48c6c390377e4f8f83", "score": "0.64208037", "text": "def pull\n if !pull_in_progress? && !pulled_at.nil? && (Time.now - pulled_at) > 900\n PullRepo.perform_async id\n end\n end", "title": "" }, { "docid": "c18dd4e05b36383a0c15f4b8bad42613", "score": ...
61c86500a6798b40bd78e7dc9f70ba3c
Redirect to a specific page on successful sign in
[ { "docid": "7848491e9aa962b95497bfd8806dee73", "score": "0.0", "text": "def after_sign_in_path_for(resource)\n #if params[:user][:referring_page].present?\n if params.try(:[], :user).try(:[], :referring_page).present?\n params[:user][:referring_page]\n else\n root_path\n end\n end...
[ { "docid": "d275fdc1a5f6d48fa4bdfdd1e39c4957", "score": "0.76769245", "text": "def signed_in_user\n unless signed_in?\n store_location #record url of intended page before redirect\n redirect_to signin_url, notice: \"Please sign in.\"\n end\n end", "title": "" }, { "docid": "...
2c00e7d5c754564c9e14bb084182e97b
Indicates that we've reached some kind of completion state, by default this is :succeeded or :failed. Due to these semantics, the :completed state is reserved for internal use.
[ { "docid": "78a51ca1561d785c91749801173264c9", "score": "0.686359", "text": "def completed?; end", "title": "" } ]
[ { "docid": "d2e7c803db3a304473b9163bb23a8b58", "score": "0.8026462", "text": "def state\n if completed?\n :complete\n else\n :in_progress\n end\n end", "title": "" }, { "docid": "658b0eed07e11b1f949f9e9eb4d6b4be", "score": "0.791058", "text": "def completion_state...
f9ba87ebe9c774eb4e8b68c236bc8cf9
GET /abilities/1 GET /abilities/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "a19aa1746ca3ee1e66222e054c011fab", "score": "0.7169107", "text": "def abilities\n get('/ability/')\n end", "title": "" }, { "docid": "5f29bb26e328fa83def60834eff9439d", "score": "0.7163355", "text": "def ability(id)\n get(\"/ability/#{id}\")\n end", "t...
e89c8f48921c32b6f1c99ebff85ec893
accepts a board and returns true if the board has not been won and is full and false if the board is not won and the board is not full, and false if the board is won.
[ { "docid": "e6dfda9b2fa8a265319f0610118cf175", "score": "0.7766831", "text": "def draw?(board)\n if won?(board) == false && full?(board) == true\n return true\n end\nend", "title": "" } ]
[ { "docid": "fd89af1a7ee16d577184d9ec53101de9", "score": "0.84242904", "text": "def over?(board)\n if(!!won?(board))\n return true\n elsif(full?(board))\n return true\n end\n return false\nend", "title": "" }, { "docid": "39e7da27f8fc353079302229f9f84280", "score": "0.83710134",...
1c4dbd0cb4038fc886473c1b822f379c
POST /tarefas POST /tarefas.json
[ { "docid": "2a1ed664783dbf2c90632fef9823961f", "score": "0.61732453", "text": "def create\n @tarefa = Tarefa.new(tarefa_params)\n @tarefa.usuario_curso_id = @perfil.id\n respond_to do |format|\n if @tarefa.save\n format.html { redirect_to @tarefa, notice: 'Tarefa cadastrada com suce...
[ { "docid": "62b777e5fd38cced433409ce3157d936", "score": "0.6981731", "text": "def create\n @tarefa = Tarefa.new(params[:tarefa])\n\n respond_to do |format|\n if @tarefa.save\n format.html { redirect_to @tarefa, notice: 'Tarefa was successfully created.' }\n format.json { render ...
1472d352e53d5b269abcc45cd52da467
Amount should be a decimal between 0 and 1. Higher means lighter
[ { "docid": "555bfb1fc2b58de50321e4c4733fb8d0", "score": "0.0", "text": "def lighten_color(hex_color, amount=0.6)\n hex_color = hex_color.gsub('#', '')\n rgb = hex_color.scan(/../).map { |color| color.hex }\n rgb[0] = [(rgb[0].to_i + 255 * amount).round, 255].min\n rgb[1] = [(rgb[1].t...
[ { "docid": "833a999a82b5895315a21aae90b84eb5", "score": "0.6769095", "text": "def amount\n read_attribute(:amount) / 100.to_f if read_attribute(:amount)\n end", "title": "" }, { "docid": "8edc489e99c59132cca6f1eb4f6774d0", "score": "0.66339725", "text": "def ltv\n (amount.to_f...
4e382777018e26e94da5af41c5908107
Save all the objects to db. Roll back if any of the object fails to save.
[ { "docid": "5b7afe0224acc40324a6f123884a1ff0", "score": "0.6758215", "text": "def save_objects_to_db\n \n if !@quant_section.save\n roll_back_created_objects\n return false\n end\n \n @questions.each_with_index do |question,question_index|\n \n questi...
[ { "docid": "a299f932e10d3c0590594d390cfa0c1d", "score": "0.80443394", "text": "def save_all()\n @store.transaction do\n @save_in_progress = true # allows saving\n @objects.each do |object|\n if @to_delete.include?(object)\n delete_in_real(object...
58e3c64b6e058d36b849cca78ad6f681
Static and business validations of this service
[ { "docid": "879acf52fc0a0b65dd47a1e518a35039", "score": "0.696457", "text": "def validate()\n\t\t\tif !(valid?)\n\t\t\t\treturn Core::ServiceError.new(\"Validation failed.\")\n\t\t\tend\n\n\t\t\treturn Core::ServiceSuccess.new\t\t\n\t\tend", "title": "" } ]
[ { "docid": "8e5e9b517bcf9d7fb6cde375bb570c94", "score": "0.7433504", "text": "def validate\n validate_internal\n end", "title": "" }, { "docid": "ecdb8cb23c8841cfdb179bf0443d2fc3", "score": "0.7132762", "text": "def validate\t\n\t\t\tif !(valid?)\n\t\t\t\treturn Core::Service...
8a732119b45654b9c0692f0f63dc5e9f
includes them as instance methods attr_accessor, attr_reader ? Defensive Programming give it the least amount of permissions/functionality needed hairballs hariball status initialize => this one is last => the last method seen wins, overrides
[ { "docid": "b8fd3706b58e2d57526f62fe41349703", "score": "0.0", "text": "def initialize(name, lives)\n # @name = name\n # @mood = \"nervous\"\n puts \"before super\"\n # super #(self) # it passes along the arguments from this method\n super(name) # this will call the Parent class's identic...
[ { "docid": "1f66e3ee5cc498f12b23d4a8242b1eab", "score": "0.6865388", "text": "def attr_reader(*)\n end", "title": "" }, { "docid": "5c17a19a63d1cee82afe68e21d863a56", "score": "0.68038625", "text": "def initialize #constructor - when ruby creates a new object, it executes this...
19ff889b6f4016efb9d46fce2e8295db
Returns the value of attribute memo.
[ { "docid": "52884a6298251d060573be742d8f0b13", "score": "0.6209426", "text": "def memo; end", "title": "" } ]
[ { "docid": "6e08d4d63e6043f9cd081bc8df35b69c", "score": "0.67145413", "text": "def memo\n return @memo_file\n end", "title": "" }, { "docid": "1067cae528bfe3e031ba89869e653965", "score": "0.65592086", "text": "def memo\n end", "title": "" }, { "docid": "43853e7...
56b486aa723822c79a7931c5384ef9b8
GET /qrcodes GET /qrcodes.json
[ { "docid": "e5ab5b43d6e37088ccbb52f57da38c2d", "score": "0.75200903", "text": "def index\n @qrcodes = Qrcode.all\n end", "title": "" } ]
[ { "docid": "4cb09fb7fe23c73b175d4aeec778aabb", "score": "0.7785388", "text": "def index\n @qr_codes = QrCode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @qr_codes }\n end\n end", "title": "" }, { "docid": "fe21f77b489a465c056...
1d131502a37713b57e9438a8a921a1a3
batman can handle Rails 3 respond for this action
[ { "docid": "cacf1cce75b331c081c53f7d9348c019", "score": "0.0", "text": "def destroy\n respond_with Post.destroy(params[:id])\n end", "title": "" } ]
[ { "docid": "80b04a136a75b4290184aed81e400116", "score": "0.71420085", "text": "def respond\n end", "title": "" }, { "docid": "f845e336977867d0ee5275bc6b746fb6", "score": "0.71027637", "text": "def response; end", "title": "" }, { "docid": "f845e336977867d0ee5275bc6...
39f2f602fbe3821c7f92d2efbb5f39d1
True if identifier is the same.
[ { "docid": "3cb32e6af7c05c551ea9636d09338ec5", "score": "0.78255236", "text": "def ==(other); self.identifier == other.identifier; end", "title": "" } ]
[ { "docid": "625f951a74884ffac77925391c200a2c", "score": "0.7106686", "text": "def is_same()\n return @item1.id == @item2.id\n end", "title": "" }, { "docid": "625f951a74884ffac77925391c200a2c", "score": "0.7106686", "text": "def is_same()\n return @item1.id == @item2.id\n end...
ad714136c0b213f2c0839be12cd93078
If 'job_seeker_id' is null, assume this skills profile will be assigned to a job
[ { "docid": "a42bd3c091905e796ff318cf3c32408b", "score": "0.56985486", "text": "def save_skills_profile(flags = {})\n \n profile_type = entity_id = entity_type = nil\n \n if flags[:job_seeker_id]\n entity_id = flags[:job_seeker_id]\n entity_type = ENTITY_TYPES[:job_seeker]\n pr...
[ { "docid": "34eaab4c2ae880f053e30c759fa696f7", "score": "0.6787829", "text": "def init_job_seeker!\n if current_user.admin?\n #@job_seeker = JobSeeker.find(params[:job_seeker_id])\n #TODO: error--admin cannot apply for jobs!!\n else\n @job_seeker = @current_user.profileabl...
993bed05fc2a90a53fe43a3518560343
DELETE /specialties/1 DELETE /specialties/1.json
[ { "docid": "6c819ebf7a2e9101719bae96f5e976bc", "score": "0.68400526", "text": "def destroy\n @specialty.destroy\n respond_to do |format|\n format.html { redirect_to specialties_path }\n format.json { head :no_content }\n flash[:destroy] = \"La Specialidad se Elimino con\"\n end\n...
[ { "docid": "5021d87fad6b1f954ccd59371a62b5e0", "score": "0.7216421", "text": "def destroy\n @surgeon_specialty.destroy\n respond_to do |format|\n format.html { redirect_to surgeon_specialties_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid":...
e7e4db1012c1dc339eab22e9fa34d5ee
Allow direct comparison of book objects.
[ { "docid": "60c141d38615ee5db3ffb7c7e026c623", "score": "0.6267351", "text": "def <=>(other_book)\n title <=> other_book.title\n end", "title": "" } ]
[ { "docid": "3ceb341cef1c6aedafc6af0cd405e1e8", "score": "0.7449703", "text": "def compare(book1, book2)\n (\n book1.title == book2.title &&\n book1.author == book2.author &&\n book1.genre == book2.genre &&\n book1.year == book2.year &&\n book1.isbn == book2.isbn &...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "90f2460073f1c3b09964bfff0e4c827a", "score": "0.0", "text": "def order_yurist_params\n params.require(:order_yurist).permit(:project_id, :apartment_id, :yurist_id)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.69792545", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6781151", "text": "def strong_params\n params.requ...
deb105724c89136e49d2b1c54ec0b3e5
Is this a "deny" ACL entry
[ { "docid": "35cfdf5170c4bc4ebd5104849a9c2bc1", "score": "0.73559016", "text": "def is_deny?\n !is_allow?\n end", "title": "" } ]
[ { "docid": "97c436b4deecbb5c2a3651aae95adc1d", "score": "0.7006988", "text": "def numbered_acl?\n false\n end", "title": "" }, { "docid": "b183e6857c9d28ce0506860bc4b1dbdc", "score": "0.6930623", "text": "def test_privilege_deny\n @acl.allow!\n @acl.deny!(nil, nil, 'som...
05b66660e334869df231ff2c851bd892
GET /course_staffs/1 GET /course_staffs/1.json
[ { "docid": "022683350824139e4b8f8acb46ba90ec", "score": "0.7881296", "text": "def show\n @course_staff = CourseStaff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course_staff }\n end\n end", "title": "" } ]
[ { "docid": "fdd1a2404285c2b12cebc23ca64b6f7b", "score": "0.70700026", "text": "def get_students\n @course = Course.find(params[:course_id])\n\n render json: @course.students\n end", "title": "" }, { "docid": "b8072d57c7abc540dff0ea8623b4f9e0", "score": "0.6958285", "text": "de...
87da7c53aee1c584c524c54e32276ac3
find the nth from last node in a linked list
[ { "docid": "6a7c406faed4461230740e1f9a36734e", "score": "0.7830277", "text": "def nth_to_last(n)\n \t\t# current will move forward 1 each step\n \t\tcurrent = @head\n\n \t\t# trailing will move forward 1 each step,\n \t\t# but trailing will start n steps later\n \t\ttrailing = @head\n\n \t\t# move...
[ { "docid": "7b3f439b760eb37485e35d7f44055db4", "score": "0.8444735", "text": "def nth_to_last_node(n, head)\n current = head\n # count total number of nodes\n counter = 1\n until current == nil do\n counter += 1\n current = current.nextnode\n end\n\n # subtract n from count\n diff = counter...
b50db76e295ce189285addcaf0385eba
Logger for Auto Job Allocation
[ { "docid": "82ae830097e2abf77b2744bfac3518b7", "score": "0.6619281", "text": "def allocation_log\n @allocation_logger ||= RevRemitLogger.new_logger(LogLocation::ALLOCATIONLOG)\n end", "title": "" } ]
[ { "docid": "f577e4f86e976ac22740d0d787c051db", "score": "0.667769", "text": "def logger\n SidekiqUniqueJobs.logger\n end", "title": "" }, { "docid": "623bf48e70f09ca8d272bc0f6587a405", "score": "0.6677231", "text": "def debug_logging\n logger.trace 'enable tracing level ...
5e96f245ce52b7b400fc4e8dde8d4799
a.i. Create a method to return the grade of a student, given that student's name.
[ { "docid": "78cf1b20415822ae778ed7a49fe3f07f", "score": "0.81680936", "text": "def get_grade(school, name)\n\t\tschool[:students].select{|s|s[:name]==name}.collect{|s|s[:grade]}.join\n\tend", "title": "" } ]
[ { "docid": "e2a29f771f5c377c591007ecef1ea521", "score": "0.83383447", "text": "def student_grade(student_name)\n @school[:students].each do |x|\n return x[:grade] if x[:name]==student_name\n end\n end", "title": "" }, { "docid": "3a5cd79aca301e82630c653e73f3eaaa", "score": "0...
8fd7582ca7737f77eaa4363a8fd833ce
TODO return both draft and published in response and let the application decide
[ { "docid": "3b1d99a2f9e568f1ec9c5dda26e9eb59", "score": "0.0", "text": "def template_get(id)\n check_id_or_raise id\n\n response = http_request :get, \"#{@base_url}/templates/#{id}.xml\", 200,\n { :params => { :provider_key => @provider_key } }\n\n doc...
[ { "docid": "5d0f08d0f00e0eb6d63aa08af922e574", "score": "0.71994776", "text": "def draft?; end", "title": "" }, { "docid": "cf7a4415d048771e03cd04e197812770", "score": "0.715972", "text": "def draft?\n self.status == \"Draft\" || self.status == \"draft\" \n end", "title": "" ...
19376faff439226ea7b6e0e0234f3b58
Sort the given object.
[ { "docid": "48a39157bee570dae5d96056eee14b61", "score": "0.79914784", "text": "def sort(object)\n object.sort! { |a,b| a.send(@method) <=> b.send(@method) }\n end", "title": "" } ]
[ { "docid": "dd27065dd3daad7549d5bbfefcd6c43d", "score": "0.76782733", "text": "def sort(objects)\n objects.sort\nend", "title": "" }, { "docid": "2948654b3bda2b00e7c11f06c0845d1d", "score": "0.74401", "text": "def sort_object(object, sort, reverse_sort=false)\n if object[0].is_...
1b76dbb5ec9b42e847d6ce258a8ff351
Input: ["tea", "ate", "eat", "apple", "java", "vaja", "cut", "utc"] Output: ["tea", "ate", "eat", "java", "vaja", "cut", "utc"] about anagrams: they must be same length n^2 time worst case (when there are no anagrams) 2n space complexity worst case list=n anagrams=n
[ { "docid": "77e03dd92241d426456587650a7e0e41", "score": "0.7182225", "text": "def anagrams(list)\n anagrams = []\n comparisons = 0\n \n list.each_index do |idx|\n \n list.each_index do |jdx|\n next if idx == jdx\n comparisons += 1\n if list[idx].split(\"\").sort() == list[jdx].s...
[ { "docid": "4cfb149fb0f9f5a2df0141bd85449d14", "score": "0.8042609", "text": "def anagrams(array_of_words)\n ana_hash = Hash.new { |hash, key| hash[key] = [] }\n array_of_words.each { |word| ana_hash[word.split(\"\").sort.join] << word }\n ana_hash.map { |key, list| list }.select { |list| list.size >...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "da84159b27ae6629826a16997a154a9e", "score": "0.0", "text": "def term_page_params\n params.require(:term_page).permit(:script)\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...
20a9d30768c9bc97627efbb81b630bf3
subchapter service for the mobile application input:chapter_id,offset(record to begin with during paging) output:json,returns the chapter list of the given chapter id created by :parthi
[ { "docid": "458d3eebcef90beafdc5e4511de60961", "score": "0.7624074", "text": "def get_subchapters\n @retval = Hash.new()\n if !params[:chapter_id].blank?\n @subChapters = MobileSubChapter.find(:all,\n :conditions=>{:tagid=>params[:chapter_id],:status=>'active'},\n :select=>\"v_d...
[ { "docid": "b6b606324f158317969bf251778d50f7", "score": "0.6741595", "text": "def get_chapters\n @retval = Hash.new()\n if !params[:user_id].blank? #&& !params[:offset].blank?\n @output = Array.new\n mobile_chapter = MobileTag.find(:first,:conditions => \"uid = #{params[:user_id]} and ta...
5b12e542ada7a9237e094e83e2a6af98
define what you want to permit in a post. HTML is checked in model so just permit content.
[ { "docid": "a599acbd88d188414e9a946dd1288362", "score": "0.68660367", "text": "def post_params\n\t\tparams.require(:post).permit(:content)\n\tend", "title": "" } ]
[ { "docid": "df30fbd50304c7e82cc02ef4c4a1c0ad", "score": "0.70470613", "text": "def post_params\n params.require(:post).permit(:content, :image_content, :content_html, :user_id)\n end", "title": "" }, { "docid": "b1a8d400c874aac769332423e9b88a27", "score": "0.69708073", "text": "d...
c817b1543d884250ac919a9abcc476fe
the "join" event is triggered when the server sends a JOIN command, meaning this event is also triggered when we join a channel, so we check who joined and react appropriately
[ { "docid": "9f58fbf92e69b6ae623b812cc99a248c", "score": "0.81263787", "text": "def on_join(event)\r\n \r\n end", "title": "" } ]
[ { "docid": "cf9a088d743adc5c4925dc821100ed80", "score": "0.80993116", "text": "def on_join(connection, channel, user)\n end", "title": "" }, { "docid": "13dcda902ca4573004871c81838dc2b4", "score": "0.7945355", "text": "def irc_join_event(stem, sender, arguments) # :nodoc:\n ...
258296c46cad72e64d5255c43be96417
hard coded increase def pedal_faster
[ { "docid": "fb6e734f799bd32b3bfb37851e94be57", "score": "0.0", "text": "def brake num\n if num > @speed\n @speed = 0\n else\n @speed -= num\n end\n end", "title": "" } ]
[ { "docid": "7109b3be182f46c6f5597bf7b816f373", "score": "0.83150774", "text": "def pedal_faster\n\t\t@speed += 10\n\tend", "title": "" }, { "docid": "66ce0cd27fe7bd09c3f345fab1b2c669", "score": "0.81518143", "text": "def pedal_faster\n @current_speed = @current_speed+1\n en...
7b9dfcafe687db21de8c5a09f8f8e4a3
Admin update only PATCH/PUT /users/1 PATCH/PUT /users/1.json
[ { "docid": "0a376aa22e419e807428574627aa0b42", "score": "0.0", "text": "def update\n current_user_id = params[:id]\n current_edit_user = User.find(current_user_id)\n okr_sign_in = OkrSignIn.find_by(user_id: current_user_id)\n okr_user_role = OkrUserRole.find_by(user_id: current_user_id)\n ...
[ { "docid": "8329cc612bbe5e1125ab6a8fd15957d2", "score": "0.751034", "text": "def update\n #Preventing mass assignment of admin attribute unless the admin is adding a user w/ admin account\n @user = User.find(params[:id])\n @user.accessible = :all if current_user.admin?\n respond_to do |forma...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "6721ee8c8fc7c68d7db5fd0ca8a5f826", "score": "0.0", "text": "def set_product\n @product = Product.find(params[:id])\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;...
ca4133b2db8908894f8e3f97104239da
def collection_class?(klass) return klass.is_a?(Array) || klass.is_a?(Hash) end def scalar_class?(klass) return !klass.is_a?(Array) && !klass.is_a?(Hash) && klass != Object end
[ { "docid": "db7e477cfc9680c827f470ef42486f3a", "score": "0.77030873", "text": "def collection?(val)\n return val.is_a?(Array) || val.is_a?(Hash)\n end", "title": "" } ]
[ { "docid": "a0f61aed2c28b746eb6d11783a747e10", "score": "0.76183206", "text": "def is_a?(klass)\n klass == Array || super(klass)\n end", "title": "" }, { "docid": "ea5fbf7e7ae38dcc969c39edd80b395a", "score": "0.7602741", "text": "def collection?\n return array? || hash?\...
89ae60140dbed5449cc2659541bc93c7
GET /searchs GET /searchs.json
[ { "docid": "eaa758c6da9d72fdb223fbcc4e1ee752", "score": "0.7095181", "text": "def index\n @searches = @website.searches.all\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @searches }\n end\n end", "title": "" } ]
[ { "docid": "72c47bd35d3820128debc21eda36b9d0", "score": "0.7497973", "text": "def Search query\n \n APICall(path: \"search.json?query=#{query}\",method: 'GET')\n \n end", "title": "" }, { "docid": "85fc181ad0b9cb4324c012d00b42b373", "score": "0.7420901", "te...
66a646ac64cda97f920e90596cab459e
renders a json response for 'Invalid credentials'
[ { "docid": "ec9c823d0f86f5f977de1059f03db950", "score": "0.87119186", "text": "def invalid_credentials\n render json: {message: 'Invalid credentials', status: 400}, status: 400\n end", "title": "" } ]
[ { "docid": "ac37888c4a696b644280cef41a3f539f", "score": "0.8353169", "text": "def render_failed_auth_response\n render status: 401,\n json: json_response(:fail, data: {user: \"Valid user email and token must be present.\"})\n end", "title": "" }, { "docid": "bb609573fe1dc20bff...
6a5bcadcbc1a7d9eeb819d800fb576ea
API methods api/campaigns (all campaigns) api/campaigns/active (all active campaigns) api/:country/campaigns (campaigns in country) api/:country/campaigns/active (active campaigns in country)
[ { "docid": "ae767b346850bcba1b0bc237bad95ae5", "score": "0.8253609", "text": "def api_index\n campaigns = Campaign.all\n campaigns = campaigns.for_country(params[:country].presence) if params[:country]\n campaigns = campaigns.active if 'active' == params[:status]\n respond_to do |format|\n ...
[ { "docid": "a07d97b587d179cf30f78b3c8aac480a", "score": "0.70781124", "text": "def campaigns(options={})\n response = connection.get do |req|\n \treq.url \"campaigns\", options\n end\n return_error_or_body(response)\n \tend", "title": "" }, { "docid": "630fa47ab4a3757977...
98d61f3c010dcd94161b95f0e2a2543a
called after play each frame, updates the display
[ { "docid": "05132fe5beadc1c5d391d14731fb5687", "score": "0.0", "text": "def draw\n\t\t@board.draw\n\t\t@player.draw\n\t\t@computer.draw\n\t\tif @board.winner == \"red\"\n\t\t\t#text output for victorious party here!\n\t\t\t@title.draw(\"YOU WON!\", 215, @scroll, 10, 1.0, 1.0, 0xff_FD0000)\n\t\t\t@subtit...
[ { "docid": "4f30aee3eaf3e7778bf1064521fcc2a7", "score": "0.7151384", "text": "def play\r\n show_title_screen\r\n activate_movewalls\r\n reset_timers\r\n update_buffer\r\n\r\n while true\r\n check_input\r\n check_collisions\r\n update_buffer\r\n update_doors\r\n up...
b2f55779c245debef3052bb16074b56c
not used yet: if we can get the exactly hipchat user, we can use this to get the exact hipchat mention name:
[ { "docid": "5b1845e047a463bb9845e502a6efd958", "score": "0.83785456", "text": "def hipchat_mention_name_bak\n user = hipchat.users_list['users'].find { |u| u['name'] == name }\n user['mention_name']\n end", "title": "" } ]
[ { "docid": "e01deccc68609208faa0d8fc9bfbfd2c", "score": "0.7527781", "text": "def mention\n \"<@#{user_id}>\"\n end", "title": "" }, { "docid": "50b78ffcb05cdb92a1f362b69fadc300", "score": "0.747574", "text": "def find_appropriate_username(msg, to)\n users_in_current_c...
94e2a009976c91125fc975713c22207a
This method displays the jobs saved by the active user to their profile and allows the user to search through those jobs.
[ { "docid": "5db838a9733e59d4a4d32efb79e51a69", "score": "0.74732244", "text": "def user_joblist\n if @active_user.list.length == 0\n system \"clear\n \"\n puts \"You have not saved any jobs to your profile yet!\n \n \".light_blue\n ...
[ { "docid": "b11fdc8d66a7d6aec054bd408a9c604d", "score": "0.7297862", "text": "def index\n @jobs = current_user.jobs\n end", "title": "" }, { "docid": "f8098309241e7210ef57d47f6cb9429d", "score": "0.7296371", "text": "def index\n if user_signed_in?\n @search = Job.ransack(...
3fbceac84eea150b94d8b65c45ef4a0c
POST /qr_collection_placements POST /qr_collection_placements.json
[ { "docid": "46e9b8763324bde1b0bcb4e21cf87f07", "score": "0.68464404", "text": "def create\n @qr_collection_placement = QrCollectionPlacement.new(params[:qr_collection_placement])\n\n respond_to do |format|\n if @qr_collection_placement.save\n format.html { redirect_to @qr_collection_pl...
[ { "docid": "f62f6fc091386c2f161edc6911a94901", "score": "0.6098212", "text": "def create\n @burger_place = BurgerPlace.new(burger_place_params)\n\n if @burger_place.save\n render json: @burger_place, status: :created, location: @burger_place\n else\n render json: @burger_place.errors,...
dd1b2bfa78fb404d9becd847c1334be6
Return the text of the first text node found as a descendant under the specified node
[ { "docid": "785bf6ea8eb8baca5a2695772436b05c", "score": "0.8439887", "text": "def first_text_under(node)\n node.xpath(\".//text()\").first.to_s\n end", "title": "" } ]
[ { "docid": "207418a8ac79c65948c325852cd346d2", "score": "0.75147426", "text": "def text_under(node)\n node.xpath(\".//text()\").collect{ |e| e.to_s }\n end", "title": "" }, { "docid": "9de7ba02f05570cd18232a9584927427", "score": "0.7242472", "text": "def node_text(node)\n sear...
b6ad3d00ab18a50cf64bf3c44d78bd27
POST /users POST /users.json
[ { "docid": "fb3792fe55cd2fee58307fa2a6b21ee1", "score": "0.0", "text": "def create\n \n if logged_in?\n #flash[:notice] = \"#{current_user.name} #{current_user.lastname}, voce ja esta logado, efetue o logout antes de realizar um novo cadastro\"\n @user = User.new\n return render act...
[ { "docid": "24c5e44d772da89269600975eeebdfda", "score": "0.71918935", "text": "def create\n @user = User.new(user_params)\n @user.save\n json_response(@user, :created)\n end", "title": "" }, { "docid": "6e1490da4a56756e02c8de2a503a156e", "score": "0.7185745", "text": "def c...
d9a0793e9db57b59c1702dd2c01bc444
Use when there are multiple words to parse, e.g. pulling a name from a string.
[ { "docid": "a929aa9c5e6ffcb05b7031e6c3162b97", "score": "0.0", "text": "def from(string)\n return unless string.present?\n names = Grammar::NgramFactory.new(string).omnigrams\n names = names.map{|g| g.join ' '} << string\n names = names.uniq - Grammar::LanguageHelper::IDENTIF...
[ { "docid": "49fac9698b8fbc17f454e65596f8d7fd", "score": "0.6435833", "text": "def parse_words(words)\n words.scan(/\\w[A-z\\uffe2\\u0027\\u2019]+/)\n end", "title": "" }, { "docid": "e71708d6f31d384399711c72c54d96c7", "score": "0.63902086", "text": "def parse_keyword_phrase()\n ...
8a388b5f85662ca7a9cfda6fe7a3112d
Finds Ogre plugins and adds them to the list Plugin names is an array containing names like 'RenderSystem_GL' and 'Plugin_ParticleFX'
[ { "docid": "d93624828105fecd64f4524f7a802907", "score": "0.73598677", "text": "def findOgrePlugins(libs, pluginnames)\n\n ogreDir = File.join(findLibraryFolder(libs, /.*OgreMain.*/i), \"OGRE\")\n\n if not File.exists? ogreDir\n onError \"Failed to find Ogre root directory for plugins (#{ogreDir})\"...
[ { "docid": "8fe39737d5294fcd78547f995071d759", "score": "0.6918666", "text": "def locate_plugins\n Gem.refresh\n (Gem::Specification.respond_to?(:each) ? Gem::Specification : Gem.source_index.find_name('')).each do |gem|\n next if gem.name !~ PRY_PLUGIN_PREFIX\n plugin_name = gem...
6b7b9cf67b194850768853af29993f35
CloudWatch takes care of watching the metrics for us, so all we have to do is make sure that the appropriate alarms exist...
[ { "docid": "ad15c48b5e42559213c2ce849eff91f2", "score": "0.5115258", "text": "def watch(*watches)\n watches.each do |watch|\n prefixed_watch = watch.dup\n prefixed_watch.name = watch_name(watch)\n\n if watch_needs_update?(prefixed_watch)\n put_watch_as_alarm(...
[ { "docid": "5349303099df930482e63a6e64d7da5f", "score": "0.6657789", "text": "def describe_metric_alarms(cloudwatch_client)\n response = cloudwatch_client.describe_alarms\n\n if response.metric_alarms.count.positive?\n response.metric_alarms.each do |alarm|\n puts \"-\" * 16\n puts \"Name...
5fc045e6b55e5a383a6dd2c0cd530a60
DELETE /parishes/1 DELETE /parishes/1.json
[ { "docid": "93bcd2b5c5a647e71cd4b2be4d325049", "score": "0.6938508", "text": "def destroy\n @parish.destroy\n\n head :no_content\n end", "title": "" } ]
[ { "docid": "ca983bf097e40937df709445fbaa23b5", "score": "0.6819782", "text": "def destroy\n @parjo.destroy\n respond_to do |format|\n format.html { redirect_to parjos_url, notice: 'Parjo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" ...
41150026234f1d06db14a7c279dde047
Sets the startMenuHideLock property value. Enabling this policy hides lock from appearing in the user tile in the start menu.
[ { "docid": "e1fcd549d297a89af1c1fa9a82427d0b", "score": "0.8039979", "text": "def start_menu_hide_lock=(value)\n @start_menu_hide_lock = value\n end", "title": "" } ]
[ { "docid": "9da437ced7050ae30e919981466bea6a", "score": "0.7129111", "text": "def start_menu_hide_lock\n return @start_menu_hide_lock\n end", "title": "" }, { "docid": "a87de1e976759a7012a6146cb8dd0479", "score": "0.6426127", "text": "def start_menu_hide_sle...
7cb50f431936d1352e3f2055e64142f4
The id of the resource (e.g. User) referenced in the cookie.
[ { "docid": "9d10e0c50bf25649adceef6631df7b81", "score": "0.0", "text": "def id\n value[0]\n end", "title": "" } ]
[ { "docid": "cc3f21c47056263444a3aee96875c43f", "score": "0.7069235", "text": "def resource_id\n self.end_user_login\n end", "title": "" }, { "docid": "f25d840a9164a0176b41c8e1a94156d4", "score": "0.7050102", "text": "def get_userid\n request.cookies['userid']\n ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "82d7b601753fa3d8acdc635a2c7079fb", "score": "0.0", "text": "def order_line_params\n params.fetch(:order_line, {})\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74954116", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6956924", "text": "def strong_params\n params.require(:request).permit(param_whit...
0d8523e73edb53bfbf644903a6b644c2
return the sort section with selected sort_order
[ { "docid": "2b5cb0ba8a15652f33fb0706dbbe21ab", "score": "0.56827897", "text": "def headers_with_selection selected_sort, except: [], headers: nil\n headers ||= self.headers\n all_headers = []\n if selected_sort.keys.length > 0\n all_headers = headers.each do |header|\n if ...
[ { "docid": "b98f942302a522cd4706677a64acd8a1", "score": "0.6350708", "text": "def sort\n @phase = Phase.find(params[:id])\n authorize @phase\n ordering = phase_params[:sort_order] || []\n Section.update_numbers!(ordering, parent: @phase)\n head :ok\n end", "title": "" }...
afef38942ff12b68e057653e64fbb8fd
Add tracking information to an object
[ { "docid": "d81cec54f7ddfdac07838e9ef7e59f20", "score": "0.0", "text": "def track(parent = nil)\n @script_uuid ||= Tracking.script_uuid\n @parent_uuid ||= parent.uuid if parent && parent.is_a?(Trackable)\n @uuid ||= SecureRandom.uuid\n self\n end", "title": "" } ]
[ { "docid": "e35bbac62f9a05befd2985d7482871ad", "score": "0.682377", "text": "def track\n self.class.track(@tracking)\n end", "title": "" }, { "docid": "571aa3fd5ed4a5472f64ba723a71f443", "score": "0.6678412", "text": "def track(object)\n tracker.store_transient(object,...
d0deaef63b1aa176d8ab99fba36e8ba4
Ensures that all properties with state managers are in valid states
[ { "docid": "6d9b3c7d59769246215759069ce7a246", "score": "0.8010035", "text": "def validate_states!\n self.class.state_managers.each do |name, klass|\n # Simply ensuring that all of the state managers have been\n # instantiated will make the corresponding states valid\n ...
[ { "docid": "954175aae1a0730aba973168680e52d5", "score": "0.65156966", "text": "def validate_state(state = {}); end", "title": "" }, { "docid": "954175aae1a0730aba973168680e52d5", "score": "0.65156966", "text": "def validate_state(state = {}); end", "title": "" }, { "docid...
57b21ff8419b9596a759632ab2151902
GET /manutencao_preventivas/1 GET /manutencao_preventivas/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "aebb26c08209fb61b8a93be2976c1088", "score": "0.64784396", "text": "def destroy\n @manutencao_preventiva.destroy\n respond_to do |format|\n format.html { redirect_to manutencao_preventivas_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { ...
40098c8679840d0ef3226f6ae9157cc7
POST /casetes POST /casetes.json
[ { "docid": "249bf47ff01fa51464ff719d307ee7df", "score": "0.7030781", "text": "def create\n @casete = Casete.new(casete_params)\n\n respond_to do |format|\n if @casete.save\n format.html { redirect_to @casete, notice: 'Casete was successfully created.' }\n format.json { render :s...
[ { "docid": "c66518e0b07c4b9ce3e4315f9515f514", "score": "0.6228523", "text": "def create\n @acerca = Acerca.new(params[:acerca])\n\n respond_to do |format|\n if @acerca.save\n format.html { redirect_to @acerca, notice: 'Acerca was successfully created.' }\n format.json { render ...
ab28754ce617bf2a94d1fa26badbfa5e
GET /subtipos/1 GET /subtipos/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "f2c25caf74bde2bc3debc1bf3eb43765", "score": "0.6839327", "text": "def index\n @subtipos = Subtipo.all\n end", "title": "" }, { "docid": "f7a975c6ca643a10d2b04c97dfef9d0b", "score": "0.6593556", "text": "def show\n @subtask = @task.subtasks.find(params[:id])\n\n ...
b1b05527e386a7a3887a62113cecdd92
Returns the first section of a block of content formated into a paragraph
[ { "docid": "83eb396cd5a8932ebd5ee9fafdbc1da1", "score": "0.0", "text": "def formated_intro(content, link_destination)\n return \"\" if content.blank? || content.split(\"%p\").second.blank?\n link_destination ||= \"#\"\n appended_link = \"... #{link_to \"(view more)\", link_destination}\"\n i...
[ { "docid": "dff05d648f0e067c085535cd91e7c4f0", "score": "0.7101965", "text": "def first_paragraph(args=nil)\n first_element('p', args)\n end", "title": "" }, { "docid": "8b79038be284ae6122dbecd71d13124b", "score": "0.71009713", "text": "def first_paragraph_of(text)\n if de...
946498953bb8a9f4e4e7001942c246a4
If we don't have an XML file, create one
[ { "docid": "1b7db28e6caeb75f0e6463f963a052d7", "score": "0.0", "text": "def check_for_target_document\n Rails.logger.debug(\"$$$ DocumentMock::check_for_target_document\")\n if @ot.target_frbr_manifestation_id.nil?\n target_frbr = AutomaticMarkup.generate_initial_markup(@ot.source_frbr_manife...
[ { "docid": "162d39e98f1864c0f6c434cdf436ea99", "score": "0.6591018", "text": "def create_Package_xml(pathForPackageXml, listOfContent)\n\ttestSFDCPackageFile = File.new(\"#{pathForPackageXml}/package.xml\",\"w\")\n\ttestSFDCPackageFile.puts package_xml(listOfContent)\n\ttestSFDCPackageFile.close\nend", ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "dcf6d048bd9d5fa5c292b44b9a041394", "score": "0.0", "text": "def student_params\n params.require(:student).permit(:first_name, :last_name, :profile_name, :profile_pic_url, :about_me, :github_username, :codecademy_username, :user_id, :classroom_id, :school_id, :devpost_username, :credly...
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74954116", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6956924", "text": "def strong_params\n params.require(:request).permit(param_whit...
77805878a4950bc27e06e9b8e205d1f6
Return closing tag of _name_.
[ { "docid": "f8e02d5cbebb0b0d5314ffd29c41d7b5", "score": "0.8547146", "text": "def closing_tag(name) \n \"</#{name}>#{add_newline?}\"\n end", "title": "" } ]
[ { "docid": "e565ee5d89fcf78ddf4931ab9cfca539", "score": "0.8828016", "text": "def close_tag(name)\n \"</#{name}>\"\n end", "title": "" }, { "docid": "3b48a4138e84cba9dc0a9834dd7aafcb", "score": "0.87786216", "text": "def close_tag(name)\n \"</#{name}>\"\n end", ...
c207fa14854546af9d63664e1d30fd53
PUT /activities/1 PUT /activities/1.xml
[ { "docid": "93e713045108843279c1b90d2bd8bbec", "score": "0.6169944", "text": "def update\n @activity = Activity.find(params[:id])\n\t\tauthorize! :update, @activity\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = 'Activity was successfu...
[ { "docid": "46e3abff3179b01b949ad1897c6b32f0", "score": "0.68618745", "text": "def update\n @activity = Activity.find(params[:id])\n \n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to activities_path }\n format.xml { rend...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "f6f7a3f4fc86722a75d9c03a458f07a7", "score": "0.0", "text": "def set_pattern\n @pattern = Pattern.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...
6fd27ee4db23566e16dc051d5853e4dd
Creates a new Query object.
[ { "docid": "d32593c9d85f78588af9f3b2d5b20807", "score": "0.0", "text": "def initialize(addr=nil, options={})\n @timeout = options[:timeout]\n\n ip = [addr].flatten\n @url = \"#{SCRIPT}?ip=#{URI.escape(ip.join(','))}\"\n @xml = Nokogiri::XML.parse(open(@url))\n end", "title": "...
[ { "docid": "223f83953d502de01206a70a072e1dfe", "score": "0.81123537", "text": "def build_query want\n Query.new want\n end", "title": "" }, { "docid": "5c61e5a4aa2524391604170a538bf6e1", "score": "0.80692714", "text": "def query\n Query.new(self)\n end", "titl...
7a4521398e6031737afaa479bcefc8e1
To require config and environment
[ { "docid": "8a9d1cfae747c4f416dab2e50f917987", "score": "0.0", "text": "def init_save_require(filename)\n begin\n require filename\n rescue LoadError => e\n title = \"INIT Error [#{filename}]: #{e}\"\n $stderr.puts title\n err = ''\n e.backtrace.each do |b|\n err << \" #{b}\\n\"\n en...
[ { "docid": "bd1d501b2cb07953ec759dab24efe265", "score": "0.73835826", "text": "def env_config; end", "title": "" }, { "docid": "bd1d501b2cb07953ec759dab24efe265", "score": "0.73835826", "text": "def env_config; end", "title": "" }, { "docid": "9ed750f700c03e8c63baa9801b13...
b2d708bb2699e7352b17f44097384ffb
SOLUTION 2 PSEUDOCODE: In a 2dimension matrix, for every (x, y) point, the corresponding rotated point (x', y') = (xcos(0)ysin(0), xsin(0) + ycos(0)) where 0 is the angle between the point and the xaxis. For a rotation of 0 = 90, (x', y') = (y, x). Therefore matrix[row][column] becomes matrix[matrix.length column 1] We...
[ { "docid": "8c78640891abc72a1b4fb843b512a2d0", "score": "0.69508743", "text": "def rotate_2(matrix)\n len = matrix.length\n return matrix if len < 1\n rotated_matrix = Array.new(matrix[0].length) {Array.new(len)}\n matrix.each_with_index do |row, row_index|\n row.each_with_index do |col, col_inde...
[ { "docid": "93d08018de16a23b5c9b249f8a3d3776", "score": "0.7524131", "text": "def rotate90(matrix)\n columns = matrix.size\n rows = matrix.first.size\n r_row = []\n r_matrix = []\n\n 0.upto(matrix.first.size - 1) do |y|\n r_row = []\n 0.upto(matrix.size - 1) do |x|\n r_row << matrix[x][y...
ea88aaf6b394adcadb97d1e7d0157be8
Validates that the team has less than 15 players
[ { "docid": "72d9fb5c68b1833d817a7584db52c96f", "score": "0.7388145", "text": "def player_count\n if self.active_players.count > 15\n self.errors.add(:players, I18n.t('team.errors.too_many_players'))\n end\n end", "title": "" } ]
[ { "docid": "cdae526368b1314d0d9570e9056425de", "score": "0.74510884", "text": "def check_the_team_limit_per_user\n errors.add(:teams, \"Cannot create more than #{TEAM_LIMIT_PER_USER} per user\") if user && user.teams.count >= TEAM_LIMIT_PER_USER\n end", "title": "" }, { "docid": "e294e28...
d70e4a1a6624404d79d917491859d7ba
Draws a circular form at pixel coordinates (left, top) with a width and height of radius pixels. The line and fill colors are used to draw the shape. By default, the coordinates are for the oval's leftmost, top corner, but this can be changed by calling the transform method or by using the :center style on the next met...
[ { "docid": "07680e9165e5ddccd7614e7f16110e8d", "score": "0.57317203", "text": "def oval(left, top, radius)\n # returns Shoes::Shape\n throw NotImplementedError\n end", "title": "" } ]
[ { "docid": "2cacf4fea62def4107a79f893b4dd644", "score": "0.7475053", "text": "def draw_circle(xc,yc,height,r,g,b,width=0)\n width = height if ( width == 0 )\n b, g, r = validate_color(b, g, r)\n\n c_circle = allocate_color(@picture,r,g,b)\n step = 360 / (2 * 3.1418 * [width,height].max)\...
f5ad130ef7a5ed64565210c4b302eb99
is given section context valid to current page
[ { "docid": "44d68f92f85bc8e0e5fdd5911e241a54", "score": "0.7384131", "text": "def valid_context?\n #Rails.logger.debug \"valid=#{page.current_context}, self.template_tag.current_piece=#{self.template_tag.current_piece.title}\"\n ret = theme.valid_context?(template_tag.current_piece.page_layout...
[ { "docid": "9619ca7c462a948a8af804e7bfe493b6", "score": "0.71663415", "text": "def valid_context?\n self.template_tag.current_piece.context_either? or (self.template_tag.current_piece.current_contexts.include? menu.current_context) \n end", "title": "" }, { "docid": "94a2192652e...
3c578b918a0ab54f649ef0e186b98c4b
Returns a hash of user info if logged in to Wordpress, or nil otherwise.
[ { "docid": "6661f319aeeac665be6a2e062deed7f7", "score": "0.79511666", "text": "def get_wordpress_user_info\n if wordpress_cookie\n response = HTTParty.get(\"#{WORDPRESS_AUTH_URL}?cookie=#{URI.encode(wordpress_cookie)}\")\n return JSON.parse(response.body) if response.code == 200\n ...
[ { "docid": "2101b2920b14f7a182668641fe7d5b34", "score": "0.70328146", "text": "def site_user_info\n site_info[:user_info]\n end", "title": "" }, { "docid": "0f40b720d84d241a5fd578f5b856fe2d", "score": "0.6484112", "text": "def user_info\n {}\n end", "title": "" ...
284e8ca577ab3c2c2a8498d6c32df7c5
Not in use right now
[ { "docid": "126eafe416b17b6c2a74850666c4f10c", "score": "0.0", "text": "def parse_book_new_rental_price(book_node)\n end", "title": "" } ]
[ { "docid": "6ab77a9219ee157923bc58599ba6aa77", "score": "0.77272856", "text": "def in_use; end", "title": "" }, { "docid": "6ab77a9219ee157923bc58599ba6aa77", "score": "0.77272856", "text": "def in_use; end", "title": "" }, { "docid": "33e1db3c06643dd523dcc31fccf3a005", ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "1e126be9db338cacd2d43b4771e349e7", "score": "0.0", "text": "def set_setup\n @setup = Setup.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163821", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045432", "text": "def action_hook;...
fe6ed7235ee6e45758446e728f006a8e
Test 5: Flag Note Inline Comment
[ { "docid": "56af89c51cf87b016dd1cfbbce0675cb", "score": "0.68194926", "text": "def test05_post_closed_news_FlagNoteComment\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_news_post_closed_note)\n\t\tsleep 2\n\t\tcommentPopSubmit \"Test Comment #{random}\"\n\t\tsleep 2\n\t\tcommentFl...
[ { "docid": "6b4c1a45f8a72b6d15b5dfb20c3ec50f", "score": "0.7198939", "text": "def verify_comment(line) \n end", "title": "" }, { "docid": "5c9988499e60ddb40d882dc3ef7a0b95", "score": "0.7009388", "text": "def comment?; end", "title": "" }, { "docid": "5c9988499e60ddb40...
21a92c999c03862a244401f832c1f773
sets page default options, selected tab states ETC
[ { "docid": "a663b5b1cc9075396ccfc1a59f5e21c6", "score": "0.7295499", "text": "def initialize_page\n super\n action = action_name == 'index' ? \"#{@_name}s\" : \"#{action_name.capitalize} #{@_name}\"\n @page_title = action\n @render_options[:selected_tab] = @_selected_...
[ { "docid": "f34f402bd7b5fe8b1bcf1ac363c5ed9e", "score": "0.69585526", "text": "def initialize_page_options(options); end", "title": "" }, { "docid": "63870efc6586873c538ad60e1c4d886b", "score": "0.62942624", "text": "def set_tab_state\n set_state current_tab: params[:current_tab]\...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "bf853c24a0e6ad6a5bb51abc3721c437", "score": "0.0", "text": "def set_employee_examination_session\n @employee_examination_session = EmployeeExaminationSession.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60328794", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6017492", "text": "de...
fd7f8b72c0447184c8611576226dd1a1
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.order_mailer.shipped.subject
[ { "docid": "bfab301d377eac223248930914301a44", "score": "0.56878364", "text": "def shipped(order)\n @order = order\n\n mail to: order.email, subject: 'Cookie Store Order Shipped'\n end", "title": "" } ]
[ { "docid": "ea740e704e8f1173fb87b45dfcaaf989", "score": "0.71952266", "text": "def subject_for(key)\n I18n.t(:subject, scope: [:mailer, key])\n end", "title": "" }, { "docid": "8928fe4f050d7ebd3e9aa992b07e320a", "score": "0.70935893", "text": "def subject_for\n ActiveSuppo...
3512098a49ecd3d9f7634bad288c2453
Baseline implementation for the start_manual_transfer_runs REST call
[ { "docid": "ae7c330d02e7588fdcb5e0f272e9c1ed", "score": "0.7638781", "text": "def start_manual_transfer_runs request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transco...
[ { "docid": "8d9964532fdaaf7991827ee6c9e349e5", "score": "0.61747885", "text": "def start(transfer_spec,options)\n # check parameters\n raise \"transfer_spec must be hash\" unless transfer_spec.is_a?(Hash)\n raise \"options must be hash\" unless options.is_a?(Hash)\n # process...
21be8ddb269413503d9d2abb1f427f85
Constructor ==== Options [:pvt] The PVT used by this database. Defaullt is nil. [:logfile] The log file name. nil disables logging. Default is nil. [:mysqlhost] The MySQL server host name. Default is localhost. [:mysqlport] The MySQL server port number. Default is 3306. [:mysqldb] The MySQL database name. Default is Li...
[ { "docid": "f701de396bab75b8dd008ec0d43f0537", "score": "0.7696959", "text": "def initialize( options = {} )\n defaults = { :pvt => nil,\n :logfile => nil,\n :mysqlhost => \"localhost\",\n :mysqlport => 3306,\n :mysqldb => \"LibertyFile\...
[ { "docid": "be7c0e39c6b3ad193ad159f4252f3317", "score": "0.8051508", "text": "def initialize( options = {} )\n defaults = { :pvt => nil,\n :logfile => nil,\n :mysqlhost => \"localhost\",\n :mysqlport => 3306,\n :mysqldb => \"LibertyFile\...
b8639f2871794e735fbfb2fd8a52a855
PATCH/PUT /greets/1 PATCH/PUT /greets/1.json
[ { "docid": "59f5e3e93382245c64e67d58ce7f69d0", "score": "0.59968734", "text": "def update\n respond_to do |format|\n if @greet.update(greet_params)\n format.html { redirect_to @greet, notice: 'Greet was successfully updated.' }\n format.json { render :show, status: :ok, location: @...
[ { "docid": "d5eaea298e64625a71a15a970f3b75ed", "score": "0.670775", "text": "def patch *args\n make_request :patch, *args\n end", "title": "" }, { "docid": "fa16209f5ac39ae638cdf45c17fd5f18", "score": "0.6427934", "text": "def rest_patch(path, options = {}, api_ver = @api_version...
122c79438d8063a9d1ed8ba3b82e9243
The absolute path derived from the request where files will be stored
[ { "docid": "9d0c6b77ceda3ddf4413200be5541b95", "score": "0.67756265", "text": "def base_request_path\n Merb.dir_for(:public) / slice_url(:external_delete_all)\n end", "title": "" } ]
[ { "docid": "7cfef02f83bc526b07da1a0d58c7038e", "score": "0.74823177", "text": "def request_path\n @request_path ||= ::File.expand_path(::File.join(root_dir, ::Rack::Utils.unescape(path_info)))\n end", "title": "" }, { "docid": "ce0ada7aad1c71374c6160765beab5e9", "score": "0.74335...
50e77d0a5f2da1be1d5b6787aa803bc6
input: string character name output: a hash of a character's info
[ { "docid": "f8cb72831103bfa375c97af647accd61", "score": "0.6136264", "text": "def get_character_info (character)\n get_all_characters.find do |person_hash|\n person_hash[\"name\"].downcase == character\n end\nend", "title": "" } ]
[ { "docid": "9a0c339768f16425aa946591d3962948", "score": "0.7522924", "text": "def hash\n @char.hash\n end", "title": "" }, { "docid": "3b6de92386f3dd8bf55179520665b211", "score": "0.7016554", "text": "def hash\n # Hash of the cell is the hash of the character.\n char.hash\n...
1319ca79990953d11b892f07c7f787ef
just like attr_accessor for c++
[ { "docid": "bbfe9dfb6075b377348a9947ba1f937f", "score": "0.0", "text": "def accessor type, *pros\n (reader_only type, *pros) +\n (writer_only type, *pros) +\n (member_only type, *pros)\nend", "title": "" } ]
[ { "docid": "e94d864158cecc9b939ebcd033f73b02", "score": "0.79439133", "text": "def attribute_accessor?; end", "title": "" }, { "docid": "e94d864158cecc9b939ebcd033f73b02", "score": "0.79439133", "text": "def attribute_accessor?; end", "title": "" }, { "docid": "e94d864158...
b3541cf6e7d0ad721a7dfa75f2a8fd85
test manually with: curl i X GET H "ContentType: application/json"
[ { "docid": "91a1358ea753e5a9ddd790ffc778e719", "score": "0.0", "text": "def show_by_original_word\n @translated_word = TranslatedWord.find_by_word_id(Word.find_by_text(params[:wordtext]))\n respond_to do |format|\n format.json do\n render :json => @translated_word.to_json(:include => :...
[ { "docid": "33da27e37af3ffeb67cab25dff675ea1", "score": "0.67073447", "text": "def test_should_be_json_response\n get '/mock/example'\n assert_equal last_response.content_type, \"application/json\"\n end", "title": "" }, { "docid": "4115574b1e69e83dbfac927cb86d77c4", "score": "0.6...
fa264dbf9f641e18f06f66f3ceeb0974
parent will setup the steps to read the csv
[ { "docid": "9eaac15fae6eb79229c3a57541421935", "score": "0.0", "text": "def build_model(row)\n row[:id] = row[:id].to_i # Convert column to Integer\n row[:price] = row[:price].to_i # Convert column to Integer\n new_instance = Meal.new(row)\n return new_instance\n end", ...
[ { "docid": "3f170c6bbfa5c350b2b07ed6392da483", "score": "0.6721853", "text": "def initialize \n\t\t@tasks = read_csv_file\n\tend", "title": "" }, { "docid": "60d2b563c0a8ed60c7010daaee67723c", "score": "0.66457784", "text": "def setup()\n @stopList = [] ;\n scanCsv(getConf(:csv...
fc7c4867a41d3d5982164c8334d570f0
Called from asset helpers to alert you if you reference an asset URL that isn't precompiled and hence won't be available in production.
[ { "docid": "bc1d1762b00f746ae2f9d5ef535a6597", "score": "0.58509815", "text": "def asset_precompiled?(logical_path)\n if precompiled_assets.include?(logical_path)\n true\n elsif !config.cache_classes\n # Check to see if precompile list has been updated\n precompiled_assets...
[ { "docid": "6d4a1fdc57668b3842453af02833a988", "score": "0.71434677", "text": "def external_asset_url?\n !same_source_host? && url_from_asset_tag?\n end", "title": "" }, { "docid": "60048fb32bc8a2c48749411924b6f2cb", "score": "0.6894032", "text": "def request_debug_assets?; e...
d8f59a830780ded1cb432f546edc83c2
Return the timetag as a number
[ { "docid": "fd038cf0bb59ff74ff50cf80ec3c490d", "score": "0.85703015", "text": "def gettimetag\n ttag = to_i(@timetag)\n return ttag\n end", "title": "" } ]
[ { "docid": "b90939b874eea3f79afa3f8a3f718d13", "score": "0.69690996", "text": "def to_i\n return self.time.to_i\n end", "title": "" }, { "docid": "654376f9cbe09840f4f494de8c7d853d", "score": "0.69157326", "text": "def to_i\n return @tv_sec\n end", "title": "" }, { ...