This file contains 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
station_id | stationname | date | daytype | rides | |
---|---|---|---|---|---|
40680 | Adams/Wabash | 01/04/2016 | W | 8163 | |
40680 | Adams/Wabash | 01/05/2016 | W | 8665 | |
40680 | Adams/Wabash | 01/06/2016 | W | 8852 | |
40680 | Adams/Wabash | 01/07/2016 | W | 9005 | |
40680 | Adams/Wabash | 01/08/2016 | W | 8260 | |
40680 | Adams/Wabash | 01/11/2016 | W | 8326 | |
40680 | Adams/Wabash | 01/12/2016 | W | 8280 | |
40680 | Adams/Wabash | 01/13/2016 | W | 8633 | |
40680 | Adams/Wabash | 01/14/2016 | W | 9321 |
This file contains 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
array_of_numbers = [1, 2, 3, 4, 8, 9, 10, 12, 14, 18] | |
def rewrite_array(array) | |
answer_string = "" | |
first_of_range = nil | |
array.each_with_index do |value, index| | |
previous_value = array[index-1] | |
# outputs last of range with dash |
This file contains 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/models/company.rb | |
class Company < ActiveRecord::Base | |
has_many :taggings | |
has_many :tags, through: :taggings | |
include TagMethods | |
end | |
# app/models/user.rb |
This file contains 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
# rails generate migration AddUserIdToTaggings user:integer:index | |
# rails generate migration AddInvestorIdToTaggings investor:integer:index | |
class AddUserIdToTaggings < ActiveRecord::Migration[5.0] | |
def change | |
add_index :taggings, :user | |
end | |
end | |
class AddInvestorIdToTaggings < ActiveRecord::Migration[5.0] |
This file contains 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
{% if totalPages == 0 or totalPages == 1 %} | |
{% assign startNum = 1 %} | |
{% assign endNum = collection.products_count %} | |
{% elsif current_page < totalPages %} | |
{% assign endNum = current_page | times:paginate.page_size %} | |
{% assign startNum = endNum | minus:paginate.page_size | plus: 1 %} | |
{% elsif current_page == totalPages %} | |
{% assign endNum = collection.products_count %} | |
{% assign startNum = current_page | minus: 1 | times:paginate.page_size | plus: 1 %} | |
{% endif %} |
This file contains 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
{% if totalPages > 1 %}{{ startNum }}-{{ endNum }} of {% endif %}{% if collection.products_count == 0 %}No{% else %}{{ collection.products_count }}{% endif %} {{ collection.products_count | pluralize: 'result', 'results' }}{% if collection.products_count == 0 %} found. <span>[ <a href="javascript:history.back();" style="text-decoration:underline;">Unselect last filter</a> ]</span>{% endif %} |
This file contains 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
{% if collection.products_count < paginate.page_size %} | |
{% assign totalPages = 1 %} | |
{% elsif collection.products_count | modulo: paginate.page_size > 0 %} | |
{% assign totalPages = collection.products_count | divided_by: paginate.page_size | plus: 1 %} | |
{% else %} | |
{% assign totalPages = collection.products_count | divided_by: paginate.page_size %} | |
{% endif %} |
This file contains 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
function getCartCount(count) { | |
var oldTotal = $('#totalCartCount').text(); | |
var newTotal = parseInt(oldTotal) + parseInt(count); | |
$('#totalCartCount').text(newTotal); | |
} |
This file contains 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
<ul class="selectedFilters"> | |
{% assign curr_tags_count = current_tags | size %} | |
{% assign collTitleArr = collection.title | split: ' ' %} | |
{% assign collTitleStr = '' %} | |
{% for word in collTitleArr %} | |
{% assign collTitleWord = word | capitalize %} | |
{% assign collTitleStr = collTitleStr | append: ' ' | append: collTitleWord %} | |
{% endfor %} |
This file contains 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
// javascript | |
$('#select-price').insertAfter('#select-brand'); | |
$('#select-light-source').insertAfter('#select-finish'); | |
$('#select-height').insertAfter('#select-width'); | |
$('li.price-100-200').insertAfter('li#select-price ul li:last-child'); | |
$('li.price-200').insertAfter('li#select-price ul li:last-child'); | |
{% for tag in collection.all_tags %}{% if current_tags contains tag %} | |
{% if tag contains 'brand' %}$('#select-brand').hide(); |
NewerOlder