<InfiniteScroll
pageStart=0
loadMore={loadFunc}
hasMore={true || false}
loader={<div className="loader">Loading ...</div>}>
{items} // <-- This is the "stuff" you want to load
</InfiniteScroll>
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
#/routes.rb | |
get "/productos/:name" => 'products#show', as: :products | |
#/controller.rb | |
def show | |
#buscar producto | |
end |
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=” <%= get_price_css(@product) %>”> | |
<li> Nombre: <%=@product.name %></li> | |
<li> Precio: <%=@product.get_price %></li> | |
<li> Fabricante: <%=@product.maker_name || “No disponible” %></li> | |
</ul> |
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
module ProductHelper | |
def get_price_css(product) | |
product.is_in_promotion ? "product-promotion" : "product" | |
end | |
end |
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
# Date | |
# ---------------------------- | |
Date::DATE_FORMATS[:default] = "%d/%m/%Y" # 03-01-2016 | |
#Date::DATE_FORMATS[:default] = "&proc" # November 3rd, 2013 | |
#Date::DATE_FORMATS[:default] = "%B %e, %Y" # November 3, 2013 | |
#Date::DATE_FORMATS[:default] = "%e %b %Y" # 3 Nov 2013 | |
#Date::DATE_FORMATS[:default] = "%Y%m%d" # 20131103 | |
#Date::DATE_FORMATS[:default] = "%e %b" # 3 Nov | |
#Date::DATE_FORMATS[:default] = "" # custom |
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
window.ClearDOM = { | |
clearOnClick: function(element){ | |
var code_block = $(element).attr('onclick') | |
$(element).on('click', function(event){ | |
eval( code_block ) | |
}) | |
$(element).attr('onclick', '') | |
}, | |
run: function(selector){ | |
$('*[onclick]').toArray().forEach( (element) => ClearDOM.clearOnClick(element) ) |
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
class Setting | |
include Mongoid::Document | |
field :support_email, type: String, default: "" | |
def self.method_missing(method, *agrs, &block) | |
_initialize unless first | |
first.send(method, *agrs, &block) | |
end |
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
def link_tab(content, tab_name, options={}) | |
prefix_active = "active" | |
tab_name = tab_name.to_s | |
css_class = | |
if params[:tab].blank? | |
options[:default] ? prefix_active : nil | |
elsif params[:tab] == tab_name | |
prefix_active | |
end | |
link_to content, current_path({tab: tab_name}), class: css_class |
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
import React, { PropTypes } from 'react' | |
import ReactOnRails from 'react-on-rails' | |
import {Api} from '../../app' | |
export class PaginateMore extends React.Component { | |
constructor(props) { | |
super(props) | |
const current_page = this.props.current_page || 1 | |
this.offset = this.props.offset || 0.8 | |
this.state ={ |
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
instagram_username = "foofighters" | |
def instagram_scraper(instagram_username) | |
require "mechanize" | |
mechanize = Mechanize.new | |
page = mechanize.get("https://www.instagram.com/#{instagram_username}") | |
scripts = page.search("script").map(&:to_s) | |
script = scripts.select{|script| /window._sharedData =/ =~ script}.first | |
_sharedData = JSON.parse(script.split("window._sharedData = ").second.split(";</script>").first) |
OlderNewer