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
# encoding: UTF-8 | |
$:.push File.expand_path('../lib', __FILE__) | |
require 'solidus_my_extension/version' | |
Gem::Specification.new do |s| | |
s.name = 'solidus_my_extension' | |
s.version = SolidusMyExtension::VERSION | |
s.summary = 'This is for test summary' | |
s.description = 'This is for test description' | |
s.license = 'BSD-3-Clause' |
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
default: &default | |
adapter: postgresql | |
encoding: unicode | |
pool: 5 | |
username: postgres | |
password: root | |
host: localhost | |
development: | |
<<: *default |
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 MessagesController < ApplicationController | |
def index | |
@message = Message.all | |
#Retrives all messages and divides into two groups todays messages and other messages | |
@grouped_messages = @message.group_by{ |t| t.created_at.to_date == DateTime.now.to_date } | |
if @grouped_messages[false].present? | |
#Create month wise groups of messages |
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
<h1>Messages</h1> | |
<!-- Todays messages --> | |
<% if @grouped_messages.present? && @grouped_messages[true].present? %> | |
<h3> Today </h3> | |
<% @grouped_messages[true].each do |msg| %> | |
<%= msg.content %> | |
<%= msg.created_at.strftime('%I:%M %p') %> | |
<br /> |
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
case | |
when input = '+' | |
puts 'The operation is addition' | |
when '-' | |
puts 'The operation is subtraction' | |
when '*' | |
puts 'The operation is multiplication' | |
else | |
puts 'The operation is division' | |
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 send_mail(source) | |
Mailer.deliver( to: '[email protected]', | |
from: '[email protected]', | |
subject: 'Message subject', | |
body: source.text) | |
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
variable_result = if condition_1 | |
a | |
else_if condition_2 | |
b | |
else | |
c | |
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
class WordCountController < ApplicationController | |
CHARGE_PER_WORDS_BUNCH = 50 | |
WORDS_PER_BUNCH = 100 | |
def index | |
@sentence = 'Keyword density is the percentage of times a keyword or phrase appears on a web page compared to the total number of words on the page. In the context of search engine optimization keyword density can be used as a factor in determining whether a web page is relevant to a specified keyword or keyword phrase. | |
In the late 1990s, which was the early days of search engines, keyword density was an important factor in how a page was ranked. However, as webmasters discovered this and the implementation of optimum keyword density became widespread, it became a minor factor in the rankings. Search engines began giving priority to other factors that are beyond the direct control of webmasters. Today, the overuse of keywords, a practice called keyword stuffing, will cause a web page to be penalized. | |
Many SEO experts consider the optimum keyword density t |
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 ApplicationHelper | |
STOP_WORDS = ["a", "about", "above", "above", "across", "after", "afterwards", "again", "against", "all", "almost", "alone", "along", "already", "also","although","always","am","among", "amongst", "amoungst", "amount", "an", "and", "another", "any","anyhow","anyone","anything","anyway", "anywhere", "are", "around", "as", "at", "back","be","became", "because","become","becomes", "becoming", "been", "before", "beforehand", "behind", "being", "below", "beside", "besides", "between", "beyond", "bill", "both", "bottom","but", "by", "call", "can", "cannot", "cant", "co", "con", "could", "couldnt", "cry", "de", "describe", "detail", "do", "done", "down", "due", "during", "each", "eg", "eight", "either", "eleven","else", "elsewhere", "empty", "enough", "etc", "even", "ever", "every", "everyone", "everything", "everywhere", "except", "few", "fifteen", "fify", "fill", "find", "fire", "first", "five", "for", "former", "formerly", "forty", "found", "four", "from", "front", "full", "further", |
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
<h1>Content</h1> | |
<p> <%= @sentence%></p> | |
<h1>Content Stats</h1> | |
<p><b>Total Words</b> = <%= @counter_with_stop_words.token_count %></p> | |
<p><b>Total Price</b> = $<%= @price %></p> |
OlderNewer