- Generate new rails app using
--webpack
flag
rails new myApp --webpack=vue
Note:
- You can use
--webpack=angular
for angular application and--webpack=react
for react.
def self.get_docs(some_input, required_docs, optional_docs, base_id = nil) | |
base_req = self.get_parameters_from_request(some_input) | |
user_department_id = some_input.user_department.try("id") || -1 | |
doc = Document.arel_table | |
dept = Department.arel_table | |
dept_rule = DepartmentRule.arel_table | |
dept_code = DepartmentRuleCode.arel_table | |
debt_state = DepartmentRuleState.arel_table |
#example of scrapping information such as a listing from a website | |
#that list results in a container for each 'match' of the search criteria. | |
require 'nokogiri' | |
website = "www.example.com" | |
scrapped_info = Array.new | |
doc = File.open(ARGV[0]) { |f| Nokogiri::HTML(f) } | |
doc.css('.result-container').each do |x| |
require 'yaml' | |
require 'mysql' | |
@dbconfig = YAML.load(File.read('/home/dev/app/config/database.yml')) | |
@con = Mysql.new(@dbconfig["#{env}"]['host'], | |
@dbconfig["#{env}"]['username'], | |
@dbconfig["#{env}"]['password']) |
RAILS_ROOT = File.dirname(File.dirname(__FILE__)) | |
RAILS_ENV = "staging" | |
RUBY_PATH = "/home/rails/.rvm/rubies/ruby-1.9.3-p392/bin/ruby"# path of rails user | |
def generic_monitoring(w, options = {}) | |
w.start_if do |start| | |
start.condition(:process_running) do |c| | |
c.interval = 10.seconds | |
c.running = false | |
c.notify = {:contacts => ['team'], :category => 'Start if processing running false'} | |
end |
SomeList.find(:all, :conditions => ["some_id = ?", some_object.attribute_of_some_object.id]) | |
SomeList.where(some_id: some_object.attribute_of_some_object.id) | |
CODE | |
****************************** | |
------------------------------ | |
def value_returned(number) | |
if is_divisible_by?(number) | |
return number | |
else | |
return 0 | |
end |
Some things in supermarkets have simple prices: this can of beans costs $0.65. Other things have more complex prices. For example: | |
three for a dollar (so what’s the price if I buy 4, or 5?) | |
$1.99/pound (so what does 4 ounces cost?) | |
buy two, get one free (so does the third item have a price?) | |
The exercise is to experiment with various models for representing money and prices that are flexible enough to deal with these (and other) pricing schemes, and at the same time are generally usable (at the checkout, for stock management, order entry, and so on). Spend time considering issues such as: | |
does fractional money exist? | |
when (if ever) does rounding take place? |
me |
#not started |