Skip to content

Instantly share code, notes, and snippets.

View Keqi's full-sized avatar

Maciej Nowak Keqi

View GitHub Profile
namespace :update do
namespace :world_expeditions do
task :fetch do
monitor = Rowlf.monitor("world_expeditions")
monitor.start '.fetch.rake.task', 1 do |progress|
json_doc = JSON.pretty_generate(RowlfTours::WorldExpeditions::Provider.new.wrapper.render)
File.open("tmp/world_expeditions/trips.json", 'w') {|f| f.write(json_doc) }
end
end
All examples were filtered out; ignoring {:focus=>true}
1) RowlfTours::FileSystemFetcher#fetch saves data if cached file not exist
Failure/Error: subject.fetch(url)
NoMethodError:
undefined method `url' for {:uris=>[#<Addressable::URI:0x197f0a8 URI:http://api.com/1>]}:Hash
# ./lib/rowlf_tours/shared/fetchers/file_system_fetcher.rb:42:in `block in missing_files'
# ./lib/rowlf_tours/shared/fetchers/requests.rb:10:in `each'
# ./lib/rowlf_tours/shared/fetchers/requests.rb:10:in `each'
# ./lib/rowlf_tours/shared/fetchers/file_system_fetcher.rb:41:in `reject'
# ./lib/rowlf_tours/shared/fetchers/file_system_fetcher.rb:41:in `missing_files'
irb(main):002:0> summary = "<p>Some summary review.</p>\n\r"
=> "<p>Some summary review.</p>\n\r"
irb(main):003:0> detail = "<p>Some detailed review</p>\n"
=> "<p>Some detailed review</p>\n"
irb(main):004:0> CrazyHarry.fragment(summary).redact!(unsafe: true, tags: 'p').to_s
=> "Some summary review."
irb(main):005:0> CrazyHarry.fragment(summary + detail).redact!(unsafe: true, tags: 'p').to_s
=> "Some summary review.\n\n\rSome detailed review"
departures = [
{
availability: 12,
start_date: "2013-05-11",
pricing: [
{
age_group: "Child",
prices: [
{:name=>"USD", :value=>1199.0},
{:name=>"AUD", :value=>1199.0},
departures = [
{
availability: 12,
start_date: "2013-05-11",
pricing: [
{
age_group: "Child",
prices: [
{:name=>"USD", :value=>1199.0},
{:name=>"AUD", :value=>1199.0},
departures: [
{
availability: 2
discounted: false
discount: nil
start_date: 06-04-2013
pricing: [
Some prices
]
},
departures: [
{
availability: 2
discounted: false
start_date: 06-04-2013
pricing: [
{
age_group: "Adult",
prices: [
{name: "USD", value: 1000},
@Keqi
Keqi / problem.rb
Last active January 9, 2020 15:55
class ProjectsController < ApplicationController
# student.project is the reference to associated AR Project model.
def users_projects
teams = Team.all
students = teams.map(&:students).flatten
@student_projects = students.select do |student|
student.project.status == "Active"
end
end
<div class="row mt-3">
<div class="col-10">
<table class="table dashboard-daily-table">
<thead class="thead-light dashboard-daily-table-header">
<tr>
<th width="18%" scope="col"><%= Date.today.strftime("%A") %></th>
<th width="64%" scope="col"></th>
<th width="18%" scope="col"></th>
</tr>
</thead>
class User
def admin?
role == 'admin'
end
def marketer?
role == 'marketer'
end
def sales?