Stop struggling with cookies in Javascript, use CookieMonster.js :).
Include CookieMonster.js in your HTML file or load it using requirejs.
var CalculusEquation = function(){ | |
return {} | |
} | |
// export the function when this file is included using require | |
module.exports = CalculusEquation; |
# make a model searchable | |
module Searchable | |
extend ActiveSupport::Concern | |
module ClassMethods | |
@@excluded_search_fields = ["id", "created_at", "updated_at"] | |
def exclude_search_fields &block |
**/*.php 0755 | |
some_executable 0777 | |
files/readonly.pdf 0444 |
# sample configuration | |
host: example.com | |
username: my_username | |
password: mysupersecretpassword | |
# source, has to be directory | |
src: src | |
# destination, has to be an existing directory on the server | |
dest: public_html/hackaway |
class MatatuParkingTicket < ParkingTicket | |
def base_fee | |
1100 | |
end | |
def surcharge | |
weekdays.inlcude?(@day) ? super * 1.5 : super | |
end | |
private |
class ParkingTicket | |
BASE FEE = 1000 | |
# This receives a long list of options for | |
# some other logic that I don't care about | |
def initialize(opts) | |
@day = opts[:day] || raise(":day is required") | |
@vehicle_type = opts[:vehicle_type] || raise(":vehicle_type is required") | |
# EET stands for environmental efficiency test |
def surcharge | |
charge = | |
case @day | |
when "Monday", "Tuesday", "Wednesday", "Friday" | |
100 | |
when "Thursday", "Saturday", "Sunday" | |
150 | |
end | |
if @vehicle_type = "Truck" |
def surcharge | |
charge = | |
case @day | |
when "Monday", "Tuesday", "Wednesday", "Friday" | |
100 | |
when "Thursday", "Saturday", "Sunday" | |
150 | |
end | |
if @vehicle_type = "Truck" |
# get rid of the base fee constant | |
def base_fee | |
if @vehicle_type == "Matatu" | |
1100 | |
elsif @vehicle_type == "Truck" | |
1200 | |
else | |
1000 | |
end | |
end |