This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //= require jquery | |
| //= require jquery_ujs | |
| //= require turbolinks | |
| //= require moment | |
| //= require_tree . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Tab Index</title> | |
| </head> | |
| <body> | |
| <h1><a href="/">Title</a></h1> | |
| <input type="search" tabindex="1" /> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gem 'puma' | |
| gem 'redis' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xhr = new XMLHttpRequest | |
| xhr.onreadystatechange = (e) -> | |
| if @readyState is 4 and @status is 200 | |
| document.body.innerHTML = @responseXML.body.innerHTML | |
| xhr.open 'GET', '/page' | |
| xhr.responseType = 'document' | |
| xhr.send() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| data = | |
| X100: | |
| description: "A really cool camera" | |
| stock: 5 | |
| X1: | |
| description: "An awesome camera" | |
| stock: 6 | |
| # Multiline: parentheses not required | |
| cameras = for own name, info of data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class DocumentsController < ApplicationController | |
| def create | |
| FileUtils.mv document.tempfile, upload_path | |
| end | |
| private | |
| def document | |
| params[:document] | |
| end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| reader = new FileReader | |
| reader.onload = (e) -> | |
| @file.data = @result | |
| $('#file_field').on 'change', (e) -> | |
| reader.file = e.target.files[0] | |
| reader.readFileAsDataURL reader.file | |
| ### |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # data:[<MIME-type>][;charset=<encoding>][;base64],<data> | |
| require 'base64' | |
| file = File.new('my_file.png') | |
| filename = File.basename(file) | |
| mime_type = %x[file --brief --mime-type #{filename}].chomp | |
| data = Base64.encode64(file.read).delete("\n") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Event < ActiveRecord::Base | |
| attr_reader :start_date, :end_date, :days | |
| has_many :performances | |
| def build_performances | |
| (start_date..end_date).each do |date| | |
| next unless days.include? date.wday | |
| self.performances << Performance.new(date: date) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ApplicationController < ActionController::Base | |
| # ... | |
| include AuthorizationSystem | |
| after_filter :validate_authorization_checked | |
| end |