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
// Path: app/javascript/packs/application.js | |
/* eslint no-console:0 */ | |
// This file is automatically compiled by Webpack, along with any other files | |
// present in this directory. You're encouraged to place your actual application logic in | |
// a relevant structure within app/javascript and only use these pack files to reference | |
// that code so it'll be compiled. | |
// | |
// To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate | |
// layout file, like app/views/layouts/application.html.erb |
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
<div class="container"> | |
<%= form_tag comparisons_compare_sections_path, remote: true do %> | |
<div class="row"> | |
<div class="col-6 pad-a10"> | |
<%= text_area_tag 'left_section', @sample_text, class: 'form-control', size: '50x25' %> | |
</div> | |
<div class="col-6 pad-a10"> | |
<%= text_area_tag 'right_section', @sample_text, class: 'form-control', size: '50x25' %> | |
</div> | |
<div class="col-12 text-center pad-t10"> |
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 @diff_percentage != 0.0 %> | |
$('.result') | |
.removeClass('text-success') | |
.addClass('text-danger') | |
.html("Percentage Difference: <%= '%.2f' % @diff_percentage %>"); | |
<% else %> | |
$('.result') | |
.removeClass('text-danger') | |
.addClass('text-success') | |
.html("Both contents are same!"); |
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 ComparisonsController < ApplicationController | |
SAMPLE_TEXT = | |
"<header> | |
<title> Sample Title </title> | |
</header> | |
<navbar> | |
<ul> | |
<li>Sample Title 1</li> | |
<li>Sample Title 2</li> |
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
SELECT spree_products.id AS product_id, | |
MAX(CASE WHEN r.property_id = (select "spree_properties"."id" from "spree_properties" where "spree_properties"."name"='THC' ) THEN r.value ELSE NULL END) AS "THC", | |
MAX(CASE WHEN r.property_id = (select "spree_properties"."id" from "spree_properties" where "spree_properties"."name"='CBD' ) THEN r.value ELSE NULL END) AS "CBD", | |
MAX(CASE WHEN r.property_id = (select "spree_properties"."id" from "spree_properties" where "spree_properties"."name"='Material' ) THEN r.value ELSE NULL END) AS "Material", | |
MAX(CASE WHEN r.property_id = (select "spree_properties"."id" from "spree_properties" where "spree_properties"."name"='Ingredients' ) THEN r.value ELSE NULL END) AS "Ingredients", | |
MAX(CASE WHEN r.property_id = (select "spree_properties"."id" from "spree_properties" where "spree_properties"."name"='Serving Per Container' ) THEN r.value ELSE NULL END) AS "Serving Per Container", | |
MAX(CASE WHEN r.property_id = (select "spree_properties"."i |
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
How to add tags in github project. | |
git tag -a v2.8.0 -m "v2.8.0 Release" | |
git push origin master --follow-tags | |
heroku run rake db:migrate --remote=production # Run migrations if needed |
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
//= require jquery | |
//= require spec_helper | |
describe("Static Page Test", function () { | |
it("test static page", function () { | |
// replace body contents with static HTML | |
$('body').html(JST['templates/static_template']()); | |
expect($('#sample-form').is(':visible')).to.be.true; |
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
<div id="sample-form"> | |
<h1>I am sample title</h1> | |
<input type="textbox" name="" value="type here" id="input-1"> | |
</div> |
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
Konacha.configure do |config| | |
config.spec_dir = 'spec/javascripts' | |
config.spec_matcher = /_spec\.|_test\./ | |
config.stylesheets = %w(application) | |
config.driver = :webkit | |
end if defined?(Konacha) |
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
//= require calculator | |
describe("Calculator", function () { | |
it("test add function", function () { | |
expect(add(1, 2)).to.equal(3); | |
}); | |
it("test subtract function", function () { | |
expect(subtract(10, 4)).to.equal(6); |