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
| 4 def import | |
| 5 unless params[:file].blank? | |
| 6 labels = Array.new | |
| 7 IO.foreach( params[:file].tempfile ) do |line| | |
| 8 if /;/.match( line ) | |
| 9 labels << line.split( ';' ) | |
| 10 elsif /,/.match( line ) | |
| 11 labels << line.split( ',' ) | |
| 12 else | |
| 13 labels << line |
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 Task < ActiveRecord::Base | |
| def self.todays_tasks | |
| where(due_date: Date.today.beginning_of_day..Date.today.end_of_day) | |
| end | |
| def self.tomorrows_tasks | |
| where(due_date: Date.tomorrow.beginning_of_day..Date.tomorrow.end_of_day) | |
| end | |
| 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
| <body id="brands" data-hook="body"> | |
| <ul class="letters"> | |
| <% ('A'..'Z').each do |letter| %> | |
| <li><%= link_to letter, "#", class: "key-link", data: { letter: letter } %></li> | |
| <% end %> | |
| </ul> | |
| <hr> | |
| <% @brands.each do |key, brands| %> | |
| <ul class="brand-letters"> | |
| <li id="letter-<%= key %>" class="key"><%= key %></li> |
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
| def home | |
| render 'signed_out_home' and return unless signed_in? | |
| current_user.active_subscription? ? load_signed_in_page : redirect_to plans_path | |
| 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
| app | |
| engines | |
| engine_one | |
| app | |
| models | |
| ..etc | |
| engine_two | |
| app | |
| models | |
| ..etc |
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 Widget < ActiveRecord::Base | |
| attr_accessible :name, :snippets, :snippets_attributes, :company_id, :hostname, :first_page, :affiliate_id, :item_defaults, :read_only | |
| has_many :snippets | |
| has_many :permissions, dependent: :destroy | |
| has_many :users, through: :permissions | |
| accepts_nested_attributes_for :snippets | |
| attr_accessor :read_only | |
| def read_only | |
| true |
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 JTask | |
| # JTask.find() | |
| # Retrieves records from the database file. | |
| # -------------------------------------------------------------------------------- | |
| # Eg: JTask.find("test.json", 1) || JTask.find("test.json", first: 10) | |
| # #=> <JTask id=x, ...> | |
| # -------------------------------------------------------------------------------- | |
| # See wiki guide for more usage examples... | |
| # https://github.com/adammcarthur/jtask/wiki/find |
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
| # Variable substitution works here | |
| foo: "The quick brown %{ animal } jumped over the lazy dog" | |
| # Variable substitution done not work here | |
| # Instead, "%{ animal }" gets rendered | |
| bar: "The quick | |
| brown %{ animal } | |
| jumped over | |
| the lazy dog" |
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
| search_all = LOCAL_SETTINGS["single_site_search"] | |
| if params[:ref].present? | |
| spaces = Space.where(id: { params[:ref] }, parent_id: nil }) | |
| spaces = spaces.eager_loads(slots: :companies).where(companies: { parent_id: current_company_id }) unless search_all | |
| render partial: 'call_centre_results' and return | |
| 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
| AppUser.authenticate('ADMIN', '') | |
| AppUser Load (0.9ms) EXEC sp_executesql N'SELECT TOP (1) [AppUsers].* FROM [AppUsers] WHERE [AppUsers].[UserID] = N''ADMIN'' AND [AppUsers].[Password] = N'''' ORDER BY [AppUsers].[UserID] ASC' | |
| => #<AppUser UserID: "ADMIN", UserName: "Administrator", MenuGroup: "SYS_ADMIN", Password: "", DefaultStoreID: "1", FullRights: true, LastChanged: "2013-10-23 17:59:52", ChangedBy: "ADMIN", Email: "", Phone: "", Deleted: false, CashierID: "", HideCostPrice: false, WebLogin: false, CustomerID: "", DepID: "", NetworkID: ""> |
OlderNewer