<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Duarte M on Medium]]></title>
        <description><![CDATA[Stories by Duarte M on Medium]]></description>
        <link>https://medium.com/@duartem?source=rss-960de5ca095a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*cXmKFTZR2n9ztxoQIhIsBg.jpeg</url>
            <title>Stories by Duarte M on Medium</title>
            <link>https://medium.com/@duartem?source=rss-960de5ca095a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 15:09:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@duartem/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Cabo Verde’s Huge Potential For Innovation Through Drone Technology and Renewable Energy]]></title>
            <link>https://duartem.medium.com/cabo-verdes-huge-potential-for-innovation-through-drone-technology-and-renewable-energy-6fb8bb46afe1?source=rss-960de5ca095a------2</link>
            <guid isPermaLink="false">https://medium.com/p/6fb8bb46afe1</guid>
            <category><![CDATA[business]]></category>
            <category><![CDATA[economics]]></category>
            <category><![CDATA[sustainability]]></category>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[Duarte M]]></dc:creator>
            <pubDate>Tue, 03 Dec 2024 20:05:37 GMT</pubDate>
            <atom:updated>2024-12-03T20:05:37.786Z</atom:updated>
            <content:encoded><![CDATA[<p>Original link <a href="https://www.santiago-martins.com/cabo-verde-facts.html">here</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*k8xwzSaB8ZnnYU6q" /><figcaption>Photo by <a href="https://unsplash.com/@brunus?utm_source=medium&amp;utm_medium=referral">Bruno Martins</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Introduction: A Nation at the Crossroads of Innovation</h3><p>Cabo Verde represents an intriguing case of potential national transformation. Situated off West Africa’s coast, this small archipelago confronts significant environmental challenges while simultaneously possessing remarkable strategic advantages. The country’s geographical position offers abundant renewable energy potential — consistent trade winds and intense solar radiation — yet it paradoxically struggles with energy infrastructure and water scarcity.</p><p>The nation’s primary asset is its institutional stability. Since transitioning to democracy in 1990, Cabo Verde has developed robust democratic processes and a reputation for pragmatic governance. This political foundation creates a unique environment for ambitious technological and ecological innovations that many developing nations cannot easily implement.</p><p>The most promising avenue for development lies in integrated resource management. By combining renewable energy infrastructure with advanced water technologies, Cabo Verde could fundamentally reshape its economic prospects. Drone-based cloud seeding, solar-powered desalination, and strategic land restoration represent more than infrastructure projects — they’re a comprehensive approach to national resilience.</p><p>The core strategy involves transforming environmental limitations into technological opportunities. With approximately 70% of its land currently unproductive, Cabo Verde has significant potential for agricultural and ecological redesign. The proposed initiatives could potentially convert over half of its currently arid terrain into productive agricultural zones, generating new economic pathways and enhancing food security.</p><p>Renewable energy and water management aren’t just technical challenges here, but keys to national survival and potential prosperity. By viewing these constraints as design problems rather than insurmountable barriers, Cabo Verde could create a remarkable development model for other resource-limited nations.</p><h3>The Technological Foundation: Integrated Water and Energy Solutions</h3><h3>Drone Cloud Seeding and Desalination: A Synergistic Approach</h3><h4>Water Generation Potential</h4><ul><li><strong>Drone Cloud Seeding</strong>:</li><li>Estimated additional rainfall: 52.4 million m³ annually</li><li>Technological approach: Solar and wind-powered autonomous drones</li><li>Precision particle dispersion for enhanced precipitation</li><li><strong>Desalination Capacity</strong>:</li><li>Projected water production: 30–50 million m³ annually</li><li>Powered entirely by renewable energy infrastructure</li></ul><p><strong>Total Potential Water Generation</strong>: 82–102 million m³ annually</p><h3>Renewable Energy Infrastructure</h3><h4>Solar Array Development</h4><ul><li><strong>Infrastructure Specifications</strong>:</li><li>Targeted capacity: 200 MW</li><li>Total panels: 500,000</li><li>Land requirement: 800–1,000 hectares (2–2.5% of national territory)</li><li>Estimated investment: $150–200 million</li></ul><h4>Wind Turbine Installation</h4><ul><li><strong>Farm Characteristics</strong>:</li><li>Targeted capacity: 300 MW</li><li>Number of turbines: 50–60</li><li>Land use: 1,500–2,400 hectares</li><li>Estimated investment: $400–600 million</li></ul><h3>Land Transformation: From Desert to Productivity</h3><h3>Current Landscape</h3><ul><li><strong>Total land area</strong>: 4,033 km² (403,300 hectares)</li><li><strong>Arid/semi-arid land</strong>: Approximately 282,310 hectares (70% of total area)</li></ul><h3>Transformation Potential</h3><h4>Agricultural Conversion</h4><ul><li><strong>Potential Arable Land</strong>: 50,000–75,000 hectares</li><li><strong>Economically Viable Crops</strong>:</li></ul><ol><li><strong>Greenhouse Tomatoes</strong></li></ol><ul><li>Potential production: 20–25 million kg annually</li><li>Export value: $50–75 million</li></ul><ol><li><strong>Specialty Pepper Cultivation</strong></li></ol><ul><li>Potential production: 15–20 million kg annually</li><li>Export value: $60–90 million</li></ul><ol><li><strong>Hydroponic Leafy Greens</strong></li></ol><ul><li>Potential production: 50–60 million kg annually</li><li>Export value: $75–100 million</li></ul><ol><li><strong>Purgueira for Biodiesel</strong></li></ol><ul><li><strong>Land Use</strong>: Up to 50,000 hectares of arid land</li><li><strong>Projected Yield</strong>: 1.5–2 tonnes of seeds per hectare annually</li><li><strong>Biodiesel Production</strong>: 20–25 million litres per year</li><li><strong>Economic Impact</strong>: $25–35 million saved annually in reduced fuel imports</li><li><strong>Environmental Benefits</strong>: Improves degraded soil, sequesters CO2, and avoids competition with food crops.</li></ul><h4>Ecological Restoration</h4><ul><li><strong>Revegetation Area</strong>: 100,000–150,000 hectares</li><li><strong>Strategies</strong>:</li><li>Drought-resistant native species</li><li>Advanced terracing techniques</li><li>Microclimate management</li></ul><h3>Projected Land Transformation</h3><ul><li><strong>Current unproductive land</strong>: 282,310 hectares</li><li><strong>Potential productive land</strong>: 150,000–225,000 hectares</li><li><strong>Transformation percentage</strong>: 37–56%</li></ul><h3>Economic and Environmental Impact</h3><h3>Investment Overview</h3><ul><li><strong>Renewable Energy Infrastructure</strong>: $550–800 million</li><li><strong>Land Transformation</strong>: $700–1,050 million</li><li><strong>Purgueira Cultivation for Biodiesel</strong>: $100–150 million</li><li><strong>Total Investment</strong>: $1.35–2.0 billion</li></ul><h3>Projected Returns</h3><ul><li><strong>Agricultural Export Potential</strong>: $250–400 million annually</li><li><strong>Energy Export/Savings</strong>: $125–185 million annually (including biodiesel)</li><li><strong>Carbon Credit Potential</strong>: $50–100 million annually</li><li><strong>Estimated Return on Investment</strong>: 15–20 years</li></ul><h3>Ecological Benefits</h3><ul><li><strong>Carbon sequestration</strong>: 700,000–1,200,000 tons CO2 annually</li><li><strong>New agricultural jobs</strong>: 12,000–17,000</li><li><strong>Reduced soil erosion</strong></li><li><strong>Enhanced biodiversity</strong></li><li><strong>Improved local microclimate</strong></li></ul><h3>Institutional Enablers: Cabo Verde’s Competitive Advantage</h3><p>Cabo Verde’s successful implementation relies on critical institutional strengths:</p><ol><li><strong>Political Stability</strong></li></ol><ul><li>Consistent democratic governance since 1990</li><li>Transparent and predictable policy environment</li></ul><ol><li><strong>International Collaboration</strong></li></ol><ul><li>Strong track record of partnerships</li><li>Open to technology transfer and foreign investment</li></ul><ol><li><strong>Strategic Vision</strong></li></ol><ul><li>Long-term commitment to sustainable development</li><li>Flexible regulatory frameworks</li><li>Proactive climate adaptation strategies</li><li>Cheap Finance</li></ul><h3>Technological Innovation Ecosystem</h3><p>The proposed transformation goes beyond infrastructure — it represents a comprehensive approach to:</p><ul><li>Water security</li><li>Energy independence</li><li>Agricultural diversification</li><li>Climate resilience</li><li>Economic modernization</li></ul><h3>Key Technological Components</h3><ul><li>Autonomous drone cloud seeding</li><li>Renewable-powered desalination</li><li>Precision agricultural technologies</li><li>Advanced ecosystem restoration techniques</li></ul><h3>Conclusion: A Global Model of Adaptive Development</h3><p>Cabo Verde has the opportunity to redefine its economic and environmental future by combining innovative technologies and sustainable practices. From drone-assisted rainmaking and renewable desalination to purgueira cultivation for biodiesel, the nation can turn its abundant sunlight, trade winds, and arid lands into engines of growth. With strong institutions, sound governance, and bold investments, Cabo Verde could transform itself into a global model for adaptive development, proving that even the most challenging landscapes can be fertile ground for innovation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6fb8bb46afe1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[European Accelerationism Open Letter — eu/acc]]></title>
            <link>https://duartem.medium.com/european-accelerationism-open-letter-eu-acc-00b8e33f65bd?source=rss-960de5ca095a------2</link>
            <guid isPermaLink="false">https://medium.com/p/00b8e33f65bd</guid>
            <category><![CDATA[economics]]></category>
            <category><![CDATA[politics]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[progress]]></category>
            <dc:creator><![CDATA[Duarte M]]></dc:creator>
            <pubDate>Tue, 03 Dec 2024 18:50:19 GMT</pubDate>
            <atom:updated>2024-12-03T18:50:49.538Z</atom:updated>
            <content:encoded><![CDATA[<h3>European Accelerationism Open Letter — eu/acc</h3><p>&gt; The original link to this article, including signatories, can be found <a href="https://www.santiago-martins.com/european-accelerationism-open-letter-eu-acc.html">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*b2cJ3iqQ7Kk3ZLJt" /><figcaption>Photo by <a href="https://unsplash.com/@bkaraivanov?utm_source=medium&amp;utm_medium=referral">Bozhin Karaivanov</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Dear European Leaders,</strong></p><p>This letter is directed at all leaders across Europe, encompassing not only the European Union but all countries within the European continent. Our aim is to present a set of proposals, which we believe are both feasible and crucial for driving forward the collective potential of our nations. These suggestions are designed to be politically neutral, grounded in solid evidence, and intended to be readily implementable. Furthermore, each proposal is informed by successful European precedents, ensuring their relevance and feasibility within the continental context.</p><h3>European Accelerationism: 5 Proposals for Accelerating European Progress</h3><ol><li><strong>Corporate Tax Reform: Adoption of Cash Flow Tax Design</strong></li></ol><p>The empirical evidence in the economic literature suggests that corporate tax, as currently structured, is a suboptimal method of taxation due to its inefficiency and distortionary effects.<a href="https://www.santiago-martins.com/european-accelerationism-open-letter-eu-acc.html#fn:1">1</a> We propose shifting European corporate taxes to a cash-flow-based tax system where taxes are levied only when profits are distributed to shareholders. This change will encourage reinvestment of profits back into businesses, thereby fostering capital formation and economic growth. Estonia and Latvia offer leading examples of this approach, with the UK having also moved towards similar mechanisms.<a href="https://www.santiago-martins.com/european-accelerationism-open-letter-eu-acc.html#fn:2">2</a><a href="https://www.santiago-martins.com/european-accelerationism-open-letter-eu-acc.html#fn:3">3</a></p><p><strong>2. Creation of Common Markets — Priority given to Defense Procurement, Capital, and Energy</strong></p><p>a) Establishing a European Capital Markets Union is essential for strengthening Europe’s economic foundation, enhancing access to capital, and mitigating the risk of economic stagnation. There is widespread academic and institutional consensus in favour of this proposal,<a href="https://www.santiago-martins.com/european-accelerationism-open-letter-eu-acc.html#fn:4">4</a><a href="https://www.santiago-martins.com/european-accelerationism-open-letter-eu-acc.html#fn:5">5</a> and the EU has already laid the groundwork to bring this to fruition.</p><p>b) A common Defense Procurement Market is essential for strengthening the European defense-tech sector, a vital step if Europe is to assume a leadership role in safeguarding freedom and democracy amidst the rising global threats posed by authoritarian regimes.<a href="https://www.santiago-martins.com/european-accelerationism-open-letter-eu-acc.html#fn:6">6</a></p><p>c) The development of a Common Energy Market, which integrates diverse energy sources across Europe, is critical not only for sustainability but also for strategic autonomy. The current geopolitical landscape has heightened the urgency for this initiative, catalysing political will to create a robust and independent energy framework.<a href="https://www.santiago-martins.com/european-accelerationism-open-letter-eu-acc.html#fn:7">7</a></p><p><strong>3. Standardisation and Digital Integration</strong></p><p>a) We advocate for a vastly simplified incorporation process across Europe, making it digital, cost-effective, and universally compliant. Incorporating anywhere in Europe should be as easy and cheap as in the UK. In the EU, incorporation should be automatically compliant across the Union, by building on the Societas Europea (SE) framework<a href="https://www.santiago-martins.com/european-accelerationism-open-letter-eu-acc.html#fn:8">8</a>.</p><p>b) Introduce standardised convertible note investment instruments, modelled after the successful American SAFE note, to harmonise early-stage funding mechanisms across Europe. This approach would standardise and simplify investment processes, providing a clear and consistent framework for startups and investors throughout the continent.</p><p>c) Extend standardisation to public digital infrastructures such as health records, KYC, transport systems, payments, and e-signatures, which should be accessible via REST APIs to ensure interoperability and efficiency. The EU could expand on the digital single market and individual countries should look at existing precedents such as the X-Road initiative.</p><p>d) Adopt a uniform design system for all European government digital services, inspired by the UK’s gov.uk system, to reduce costs, enhance security, improve user experience, and ensure inclusion. This design approach should be open source and made accessible for other countries, to set a global standard.<a href="https://www.santiago-martins.com/european-accelerationism-open-letter-eu-acc.html#fn:9">9</a></p><p><strong>4. Innovation through Digital Sandboxes</strong></p><p>Implement Digital Sandboxes across Europe to allow businesses to test and scale new ideas within a framework with lower regulatory burden. This approach, inspired by the UK’s Financial Conduct Authority<a href="https://www.santiago-martins.com/european-accelerationism-open-letter-eu-acc.html#fn:10">10</a>, would reduce barriers to market participation for innovative businesses, particularly in sectors like healthcare and energy, enhancing Europe’s capacity to lead in technology and services in a more inclusive manner.</p><p><strong>5. European Advanced Research Agency</strong></p><p>Finally, we propose the establishment of a European Advanced Research Agency modelled after ARPA &amp; ARC in the US and ARIA in the UK. This agency would focus on high-risk, high-reward research with the potential to yield long term transformative technological advances. One way to do this could be for the EU to revise the charter of existing agencies like the European Institute of Innovation and Technology (EIT).</p><p>In conclusion, the above strategies are designed to harness Europe’s full potential through thoughtful economic and regulatory reform. Your engagement and support in implementing these proposals are crucial for a prosperous and resilient European future.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=00b8e33f65bd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adding Plaid to your Rails App]]></title>
            <link>https://duartem.medium.com/adding-plaid-to-your-rails-app-1eda889314b5?source=rss-960de5ca095a------2</link>
            <guid isPermaLink="false">https://medium.com/p/1eda889314b5</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <dc:creator><![CDATA[Duarte M]]></dc:creator>
            <pubDate>Sun, 19 May 2024 19:37:09 GMT</pubDate>
            <atom:updated>2024-05-19T19:43:00.254Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*FH3_WkwCeUfGNk7HfMwnlQ.jpeg" /></figure><p>This is a repost of the orignal article at: <a href="https://popadex.com/2024/05/19/adding-plaid-to-rails-app">https://popadex.com/2024/05/19/adding-plaid-to-rails-app</a><br> <br>Integrating Plaid into your Rails application allows you to link bank accounts and retrieve financial data, providing a seamless way to access and manage financial information. This guide will walk you through the process of adding Plaid to your Rails app, assuming you have TailwindCSS already set up for styling. We will cover the necessary steps to configure the backend, set up routes, and create views for linking bank accounts and displaying account details.</p><p><strong>Step 1: Add the Plaid Gem</strong></p><p>Gemfile:</p><pre>gem ‘plaid’</pre><p>Then, run:</p><pre>bundle install</pre><p><strong>Step 2: Set Up Plaid Configuration</strong></p><p>Next, you need to initialize Plaid in your application. Add the following code to your initializers:</p><p>config/initializers/plaid.rb:</p><pre><br># Initialize Plaid configuration<br>plaid_config = Plaid::Configuration.new<br>plaid_config.server_index = Plaid::Configuration::Environment[“sandbox”] # or another environment as needed<br>plaid_config.api_key[“PLAID-CLIENT-ID”] = Rails.application.credentials.dig(:development, :plaid, :client_id)<br>plaid_config.api_key[“PLAID-SECRET”] = Rails.application.credentials.dig(:development, :plaid, :secret)<br># Create an API client instance<br>api_client = Plaid::ApiClient.new(plaid_config)<br># Create a Plaid API instance to use across the application<br>PlaidClient = Plaid::PlaidApi.new(api_client)<br>api_client.create_connection do |builder|<br> builder.use Faraday::Response::Logger<br>end</pre><p><strong>Step 3: Set Up Routes</strong></p><p>Add the necessary routes to your `config/routes.rb` file:</p><pre>Rails.application.routes.draw do<br> root ‘plaid#index’<br> post ‘plaid/create_link_token’, to: ‘plaid#create_link_token’<br> post ‘plaid/exchange_public_token’, to: ‘plaid#exchange_public_token’<br> get ‘plaid/accounts’, to: ‘plaid#accounts’<br>end<br></pre><p><strong>Step 4: Create the Plaid Controller</strong></p><p>Create a controller to handle Plaid operations:</p><p>**app/controllers/plaid_controller.rb:**</p><pre>ruby<br>class PlaidController &lt; ApplicationController<br> before_action :authenticate_user!<br> protect_from_forgery with: :null_session # to handle CSRF protection for API requests<br>  def index<br>  end<br><br>def create_link_token<br> user = current_user<br> link_token_create_request = Plaid::LinkTokenCreateRequest.new({<br> user: { client_user_id: user.id.to_s },<br> client_name: ‘Your App Name’,<br> products: %w[auth transactions],<br> country_codes: [‘US’],<br> language: ‘en’<br> })<br>begin<br> link_token_response = PlaidClient.link_token_create(link_token_create_request)<br> render json: { link_token: link_token_response.link_token }<br> rescue Plaid::ApiError =&gt; e<br> Rails.logger.error(“Plaid API error: #{e.response_body}”)<br> render json: { error: e.response_body }, status: :internal_server_error<br> end<br> end<br>def exchange_public_token<br> Rails.logger.debug(“Received public_token: #{params[:public_token]}”)<br>if params[:public_token].blank?<br> Rails.logger.error(‘No public_token received’)<br> return render json: { error: ‘No public_token received’ }, status: :bad_request<br> end<br>begin<br> exchange_token(params[:public_token])<br> render json: { message: ‘Bank account linked successfully.’ }, status: :ok<br> rescue Plaid::ApiError =&gt; e<br> Rails.logger.error(“Plaid API error: #{e.response_body}”)<br> render json: { error: e.response_body }, status: :internal_server_error<br> end<br>end<br>def exchange_token(public_token)<br> request = Plaid::ItemPublicTokenExchangeRequest.new({ public_token: public_token })<br>response = PlaidClient.item_public_token_exchange(request)<br> access_token = response.access_token<br> item_id = response.item_id<br>Rails.logger.debug(“Access token: #{access_token}”)<br> Rails.logger.debug(“Item ID: #{item_id}”)<br>if current_user.update(plaid_access_token: access_token, plaid_item_id: item_id)<br> Rails.logger.debug(‘Access token and item ID saved successfully.’)<br> Rails.logger.debug(“Current user after save: #{current_user.inspect}”)<br> else<br> Rails.logger.error(“Failed to save access token and item ID. Errors: #{current_user.errors.full_messages.join(‘, ‘)}”)<br> end<br>end<br>def accounts<br> access_token = current_user.plaid_access_token<br> <br> if access_token.blank?<br> flash[:error] = ‘Access token is missing. Please link your account again.’<br> return redirect_to root_path<br> end<br> <br> begin<br> accounts_request = Plaid::AccountsGetRequest.new({ access_token: access_token })<br> accounts_response = PlaidClient.accounts_get(accounts_request)<br> @accounts = accounts_response.accounts<br> rescue Plaid::ApiError =&gt; e<br> Rails.logger.error(“Plaid API error: #{e.response_body}”)<br> flash[:error] = “Plaid API error: #{e.response_body}”<br> return redirect_to root_path<br> rescue StandardError =&gt; e<br> Rails.logger.error(“Internal server error: #{e.message}”)<br> flash[:error] = ‘Internal server error’<br> return redirect_to root_path<br> end<br> end<br>end<br></pre><p><strong>Step 5: Create the View</strong></p><p>Create a view to display the link button and account details.</p><p>app/views/plaid/index.html.erb:</p><pre><br>&lt;!DOCTYPE html&gt;<br>&lt;html class=”dark”&gt;<br>&lt;head&gt;<br> &lt;title&gt;Account Details&lt;/title&gt;<br>&lt;/head&gt;<br>&lt;body class=”bg-white dark:bg-gray-900 text-black dark:text-white”&gt;<br> &lt;div class=”container mx-auto p-4&quot;&gt;<br> &lt;h1 class=”text-3xl font-bold mb-4&quot;&gt;Link Your Bank Account&lt;/h1&gt;<br> &lt;button id=”link-button” class=”bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded dark:bg-gray-900 dark:hover:bg-gray-700 dark:text-white”&gt;Link Account&lt;/button&gt;<br> &lt;script src=”https://cdn.plaid.com/link/v2/stable/link-initialize.js&quot;&gt;&lt;/script&gt;<br> &lt;script&gt;<br> document.getElementById(‘link-button’).onclick = function() {<br> var csrfToken = document.querySelector(‘meta[name=”csrf-token”]’).getAttribute(‘content’);fetch(‘/plaid/create_link_token’, {<br> method: ‘POST’,<br> headers: {<br> ‘Content-Type’: ‘application/json’,<br> ‘X-CSRF-Token’: csrfToken<br> },<br> body: JSON.stringify({})<br> })<br> .then(response =&gt; response.json())<br> .then(data =&gt; {<br> if (data.error) {<br> console.error(‘Error:’, data.error);<br> return;<br> }var linkHandler = Plaid.create({<br> token: data.link_token,<br> onSuccess: function(public_token, metadata) {<br> fetch(‘/plaid/exchange_public_token’, {<br> method: ‘POST’,<br> headers: {<br> ‘Content-Type’: ‘application/json’,<br> ‘X-CSRF-Token’: csrfToken<br> },<br> body: JSON.stringify({ public_token: public_token })<br> })<br> .then(response =&gt; response.json())<br> .then(data =&gt; {<br> if (data.error) {<br> console.error(‘Error:’, data.error);<br> return;<br> }<br> window.location.href = ‘/plaid/accounts’;<br> });<br> },<br> onExit: function(err, metadata) {<br> console.log(‘Plaid link exit’, err, metadata);<br> }<br> });linkHandler.open();<br> })<br> .catch(error =&gt; {<br> console.error(‘Fetch error:’, error);<br> });<br> };<br> &lt;/script&gt;<br> &lt;/div&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;<br></pre><p><strong>app/views/plaid/accounts.html.erb:</strong></p><pre><br>&lt;!DOCTYPE html&gt;<br>&lt;html class=”dark”&gt;<br>&lt;head&gt;<br> &lt;title&gt;Account Details&lt;/title&gt;<br>&lt;/head&gt;<br>&lt;body class=”bg-white dark:bg-gray-900 text-black dark:text-white”&gt;<br> <br> &lt;div class=”container mx-auto p-4&quot;&gt;<br> &lt;h1 class=”text-3xl font-bold mb-4&quot;&gt;Account Details&lt;/h1&gt;<br> &lt;% if @error %&gt;<br> &lt;div class=”bg-red-500 text-white p-2 rounded mb-4&quot;&gt;<br> Error: &lt;%= @error %&gt;<br> &lt;/div&gt;<br> &lt;% else %&gt;<br> &lt;div class=”overflow-x-auto”&gt;<br> &lt;table class=”min-w-full bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-700&quot;&gt;<br> &lt;thead&gt;<br> &lt;tr class=”bg-gray-200 dark:bg-gray-700&quot;&gt;<br> &lt;th class=”py-2 px-4 border-b border-gray-300 dark:border-gray-600&quot;&gt;Name&lt;/th&gt;<br> &lt;th class=”py-2 px-4 border-b border-gray-300 dark:border-gray-600&quot;&gt;Type&lt;/th&gt;<br> &lt;th class=”py-2 px-4 border-b border-gray-300 dark:border-gray-600&quot;&gt;Subtype&lt;/th&gt;<br> &lt;th class=”py-2 px-4 border-b border-gray-300 dark:border-gray-600&quot;&gt;Mask&lt;/th&gt;<br> &lt;th class=”py-2 px-4 border-b border-gray-300 dark:border-gray-600&quot;&gt;Balance&lt;/th&gt;<br> &lt;/tr&gt;<br> &lt;/thead&gt;<br> &lt;tbody&gt;<br> &lt;% @accounts.each do |account| %&gt;<br> &lt;tr class=”border-b border-gray-300 dark:border-gray-700&quot;&gt;<br> &lt;td class=”py-2 px-4&quot;&gt;&lt;%= account.name %&gt;&lt;/td&gt;<br> &lt;td class=”py-2 px-4&quot;&gt;&lt;%= account.type %&gt;&lt;/td&gt;<br> &lt;td class=”py-2 px-4&quot;&gt;&lt;%= account.subtype %&gt;&lt;/td&gt;<br> &lt;td class=”py-2 px-4&quot;&gt;&lt;%= account.mask %&gt;&lt;/td&gt;<br> &lt;td class=”py-2 px-4&quot;&gt;&lt;%= number_to_currency(account.balances.available) %&gt;&lt;/td&gt;<br> &lt;/tr&gt;<br> &lt;% end %&gt;<br> &lt;/tbody&gt;<br> &lt;/table&gt;<br> &lt;/div&gt;<br> &lt;% end %&gt;<br> &lt;/div&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;<br></pre><p><strong>Conclusion</strong></p><p>By following these steps, you can integrate Plaid into your Rails application to link bank accounts and display account details. This guide covers the necessary configuration, routes, controller actions, and views to set up Plaid. Make sure to handle API keys securely and configure the environment properly for production.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1eda889314b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ European Accelerationism — eu/acc]]></title>
            <link>https://duartem.medium.com/european-accelerationism-eu-acc-c589e7c64d16?source=rss-960de5ca095a------2</link>
            <guid isPermaLink="false">https://medium.com/p/c589e7c64d16</guid>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[europe]]></category>
            <category><![CDATA[european-union]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[policy]]></category>
            <dc:creator><![CDATA[Duarte M]]></dc:creator>
            <pubDate>Sun, 05 May 2024 14:02:31 GMT</pubDate>
            <atom:updated>2024-05-05T14:04:22.640Z</atom:updated>
            <content:encoded><![CDATA[<h3>🇪🇺 European Accelerationism — eu/acc</h3><p>This is a repost of the original blog post at <a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html">https://www.santiago-martins.com/european-accelerationism-eu-acc.html</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lpBudAyH7nSXtFID" /><figcaption>Photo of the <a href="https://en.wikipedia.org/wiki/Flag_of_Europe">European Flag</a> by <a href="https://unsplash.com/@christianlue?utm_source=medium&amp;utm_medium=referral">Christian Lue</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote><em>““Europe is rich. [The] question is how you . . . get Europe to regain self-confidence. I’ve never seen anybody succeeding with a lack of confidence,” said Kristalina Georgieva, the IMF’s managing director. “So maybe if the European leaders talk more about what Europe can do rather than what it cannot, we’ll be in a better place.””</em><a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fn:1"><em>1</em></a></blockquote><p>The internet has been awash with anti-europe memes for as long as I can remember. It’s a common experience opening up X and seeing American VCs harp on about how all the EU does is over-regulate and how Europe is doomed to failure. It has become so common that even some Europeans have started to believe this. I will show that the data points to this being largely unwarranted, but that there’s a kernel of truth to the accusation and there is still a case to be made for European Accelerationism.</p><h3>So what is wrong with Europe?</h3><p>While it’s unclear what <strong><em>specifically</em></strong> the anti-European argument is, I will attempt to present a steel-man:</p><ol><li>Europe does not have the same tech giants that the US, and increasingly China, have.</li></ol><p>There’s no question that the “Magnificent 7” stocks are unparalleled world-class companies, having driven 2/3rd of the US public markets growth in 2023. Further, out of the top 50 global companies by market cap, 36 are American, and only 13 are European. Only 24% of the Fortune 500 are European.<a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fn:2">2</a><a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fn:3">3</a></p><p>It is clear that given the size of our continent we should be doing much better.</p><p>2. Our investments in AI fall short, in large part as a consequence of the above.</p><figure><img alt="https://ourworldindata.org/grapher/private-investment-in-artificial-intelligence?tab=chart" src="https://cdn-images-1.medium.com/max/1024/1*49sJRuXjyeRhXaAAm1Q5nw.png" /><figcaption><a href="https://ourworldindata.org/grapher/private-investment-in-artificial-intelligence?tab=chart">https://ourworldindata.org/grapher/private-investment-in-artificial-intelligence?tab=chart</a></figcaption></figure><p>We have fallen behind in AI investment, which is both an existential threat for the EU and evidence of our lack of competitiveness at a global scale.</p><p>3. The EU over-regulates and Europe is overly statist.</p><p>It is difficult to come up with an objective metric of this, but it is undoubtedly true that some European countries have excessive bureaucracy, taxation, and are globally uncompetitive. Countries such as Belgium, Germany, Denmark, and Sweden are to the right of the Laffer curve, meaning they would actually increase their tax revenues if they reduced their tax rate.<a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fn:4">4</a></p><p>The EU is often accused of regulating too much, and we can all point to some instances where this is likely the case, whether it be pseudoscientific food labelling, ESG requirements, or the seemingly never ending list of anti-trust cases against American tech giants. It also has a frighteningly long list of largely unknown agencies and bodies that could surely be rationalised.</p><h3>Facts about Europe</h3><p>In doing some research for this essay I put together a small list of things where Europe is world leading. I bet some of them will come as a surprise to the reader. For example, did you know that European countries are among the most tax competitive, or that we have the highest rates of entrepreneurship and business density in the world? Here are a bunch of other indicators, ranging from Economics to Education and Health:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WjnPAhcLMekTur3OnMS0Nw.png" /><figcaption><a href="https://v2-embednotion.com/4f188e35127b4599b86d8af892c54985">https://v2-embednotion.com/4f188e35127b4599b86d8af892c54985</a></figcaption></figure><p>I mean, just look at those stats! It’s hard to argue that we have anything but a truly fantastic continent. To directly address the European doomer arguments however, this is what the data speaks to on the points above:</p><ol><li>We have the largest economic market in the world, and the data shows that our tech ecosystem is growing rapidly, fast approaching the world leader.</li><li>We produce the most AI research behind China, the second most AI code repositories behind India, and have a very high amount of AI companies; the countries with the highest amount of AI companies per capita are European.</li><li>We also have among the most tax competitive, and freest economies on the globe. Our infrastructure is world-leading in so many areas — I hope the reader will pardon a bit of Euromaxxing but we invented the world wide web, we have high speed rail tunnels under the alps and roundabouts under the sea. Among many other examples, Europe is home to CERN, ITER, the Onkalo spent nuclear fuel repository, and the Copernicus programme, but in anything from energy, sea, roads, rail, scientific, and air infra, the only countries that can rival us are the Asian Tigers and Japan. There’s no two ways about it: we are a continent of builders.</li></ol><p>Based on the above, I think it’s fair to say that while some of the criticism is entirely valid, the doomerism as a whole is not justified. We live in a brilliant continent, and it’s sometimes easy to forget just how priviledged we are to be in Europe. Lets not let narrative supersede reality.</p><h3>What can we do to improve?</h3><p>Still, there is much we can do to improve. We can, and should have high expectations, aiming for being world-leading in every aspect. In the spirit of blog-driven policy making, below are a few proposals to accelerate European potential; Europe on Rails if you will. They are intended to be acceptable across the political spectrum, evidence-based (let’s keep it effective, after all), and relatively easy to implement.<a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fn:5">5</a></p><ol><li><strong>Corporate tax:</strong> change to cash flow tax design</li></ol><blockquote><em>The differences in standards of living between countries is not attributable to technology, the qualities of the workers, or the skills of the entrepreneurs, but to the availability of capital.</em></blockquote><p>This is a quote by Nobel Prize winner Ludwig von Mises, but really it could have been said by any mainstream economist. <a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fn:6">6</a><a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fn:7">7</a> According to the OECD, corporate tax is the most economically damaging way to raise taxes.<a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fn:8">8</a> Due to its inherent mechanism, it is highly distortionary and inefficient, but the good news is that there’s a way to make it much better. <strong>Corporate taxes should be made to be cash-flow taxes</strong>, meaning that they are only collected when profits are distributed to shareholders instead of on an annual basis, because this incentivises businesses to reinvest their profits into their firms, leading to new capital formation and increased economic growth.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/0*meKVOYUapmpHiE4z.png" /></figure><p>We already have the best global examples of this fiscal design in Estonia and Latvia<a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fn:9">9</a>, with the UK recently implementing a similar mechanism with full expensing. At the same time, the EU has the power of scale to implement economic literacy across all of its member states, while allowing states to compete with each other on other factors. It stands to reason therefore that the EU should implement this policy across all member states, and other European countries should follow suit.</p><ol><li><strong>Common Markets</strong> — Defense Procurement, Capital, and Electricity</li></ol><p>The second proposal is to build common markets where possible, with the most urgent being for Defense Procurement, Capital, and Electricity.</p><p>a) Most economists agree that a common European Capital market will put Europe on much stronger footing<a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fn:10">10</a>, and the head of the IMF has mentioned this is absolutely key for Europe to fix its economy. This is a policy that requires nothing other than political will, it would vastly improve access to capital across the union and put the risk of stagnation to bed.</p><p>b) A common Defense Procurement market would allow our defense-tech sector to thrive, which is necessary now more than ever in the face of increasing threats and authoritarianism globally. Europe faces the very real risk of being the only global power with realistic projection capabilities defending freedom and democracy. It is said that Europe is forged in crises, and what bigger crisis is there than a looming global conflict? We should use this opportunity to create the conditions to develop our homegrown Palantir and Anduril equivalents.</p><p>c) The relationship between energy use and economic development is very clear<a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fn:11">11</a>. To accelerate a transition away from fossil fuels, while powering the electrification and increased demands of a future where AI and other technologies will require abundant amounts of power, we need to facilitate a common energy market. We need to connect Portuguese solar with French nuclear and Danish wind if we are to ever gain strategic autonomy. Luckily great strides have recently been made in this direction and there seems to finally be a political desire to go through with it.<a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fn:12">12</a></p><p><strong>2. Standardisation</strong></p><p>One of the greatest benefits of the EU is its potential for standardisation across multiple countries. Innovations like the digital single market or the Societas Europea (SE)<a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fn:13">13</a> are great but don’t go far enough. Spend enough time with entrepreneurs in Europe and you’ll soon hear horror stories that are hard to believe<a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fn:14">14</a>. Let’s take a page out of our own best examples, as well as the Indian Digital Public Infrastructure, to vastly reduce our bureacracy and increase our scalability.</p><p>a) Build on the SE framework to provide a limited company formation process as quick as Britain’s. It should cost €20, be fully digital, and instantly valid in the entire EU and compliant with various tax schemes. We have done the difficult part and set precedent with SE, let’s take the next step and free our builders and creators.</p><p>b) Create standardised convertible note investment instruments. Much like the American SAFE note has become an easy to understand standard that startups can use to raise capital in a few minutes, we should have a European equivalent. We could start with a few more dynamic host countries such as Estonia and Luxembourg, and then make it implementable across all other countries.</p><p>c) Standardise other public digital infrastructure — health records, know your customer processes, payments infrastructure, e-signatures, immigration, and other public services should all be standardised and accessible by REST API.</p><p>d) A common design system across all European government services. The current disparity in interfaces both within and across countries is an embarrassment — it is costly, insecure, not inclusive, and simply a huge waste of time and resources. We should follow the British example of the open source gov.uk design system<a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fn:15">15</a> and apply that across the entire EU, while making it available for other countries to follow suit.</p><p><strong>3. Digital Sandboxes</strong></p><p>While regulation plays an important role, it has a trade off of making one of the pillars of liberal democracy, market access, less inclusive. One way to overcome this is using Digital Sandboxes, which are testing grounds that allow companies to try new ideas safely within rules and regulations. Inspired by the UK’s Financial Conduct Authority (FCA) approach<a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fn:16">16</a>, these sandboxes could be a game-changer for industries like healthcare, energy, and transport, which are often held back by strict regulations. By setting up these test zones across the EU, businesses can innovate without the immediate fear of breaking the law. This would not only speed up the introduction of new technologies but also make it easier for solutions proven in one country to be rolled out across the EU. Support from both public and private sectors could further lower barriers for small businesses and startups, making it easier for them to bring fresh ideas to the table. This move could attract more investment and keep Europe competitive on the global stage, ensuring high standards of safety and consumer protection.</p><p><strong>4. European Advanced Research Agency</strong></p><p>The EU could significantly advance its innovation capabilities by revising the charter of existing frameworks like the European Institute of Innovation and Technology (EIT)<a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fn:17">17</a>, which despite a budget of over 2 billion Euros doesn’t have a functioning website at time of writing, to emulate the successful models of Arc<a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fn:18">18</a> and ARPA in the US, and ARIA<a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fn:19">19</a> in the UK. These institutions aim to drive transformational change by serving as independent hubs for groundbreaking research and development with long time horizons. By adopting a model that encourages radical ideas and accepts the risk of failure as part of the innovation process, a revamped EU agency could accelerate the development of new technologies and solutions. Drawing on the collaborative and cutting-edge research environments of other European organisations such as CERN and EMBL<a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fn:20">20</a>, this agency would not only push the boundaries of scientific advancement but also ensure that the EU remains a leader in global innovation. Such a transformation would invigorate Europe’s innovation landscape, ensuring that significant investments are translated into tangible, world-changing advancements.</p><h3>Conclusion</h3><p>To conclude, while we must recognise an element of truth in some accusations of <em>European doomerism</em>, the data warrants a very different narrative. We have excellent conditions on which to build upon, and by establishing an advanced research agency, leveraging digital sandboxes, standardising processes, implementing unified markets, and promoting good corporate tax design, Europe can usher in a renaissance of innovation and growth. The continent already boasts numerous strengths, from a robust economic market to leadership in scientific and infrastructural endeavours, and now is the time to amplify these strengths through strategic policy and investment, turning potential into reality.</p><p>Let this be our clarion call: to rise, to strive, and to succeed. This is <em>European Accelerationism</em>.</p><p><strong>PER ARDUA AD ASTRA LFG</strong> 🚀</p><p>Q.E.D.</p><h3>Footnotes</h3><ol><li><a href="https://www.ft.com/content/af44329d-e861-449e-9d2f-0656e2e0aa15">https://www.ft.com/content/af44329d-e861-449e-9d2f-0656e2e0aa15</a> <a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fnref:1">↩</a></li><li><a href="https://uk.marketscreener.com/quote/index/MSCI-WORLD-107361487/components/">https://uk.marketscreener.com/quote/index/MSCI-WORLD-107361487/components/</a> <a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fnref:2">↩</a></li><li><a href="https://en.wikipedia.org/wiki/Fortune_Global_500">https://en.wikipedia.org/wiki/Fortune_Global_500</a> <a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fnref:3">↩</a></li><li><a href="https://www.lisdatacenter.org/wps/liswps/711.pdf">https://www.lisdatacenter.org/wps/liswps/711.pdf</a> <a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fnref:4">↩</a></li><li><a href="https://www.economist.com/britain/2023/11/30/how-to-change-the-policy-of-the-british-government">https://www.economist.com/britain/2023/11/30/how-to-change-the-policy-of-the-british-government</a> <a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fnref:5">↩</a></li><li><a href="https://blogs.worldbank.org/en/psd/productivity-prosperity-long-run-it-almost-everything">https://blogs.worldbank.org/en/psd/productivity-prosperity-long-run-it-almost-everything</a> <a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fnref:6">↩</a></li><li><a href="https://www.jeffsachs.org/newspaper-articles/money-makes-the-world-go-round">https://www.jeffsachs.org/newspaper-articles/money-makes-the-world-go-round</a> <a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fnref:7">↩</a></li><li><a href="https://taxfoundation.org/data/all/eu/comparing-corporate-tax-systems-europe-2023/">https://taxfoundation.org/data/all/eu/comparing-corporate-tax-systems-europe-2023/</a> <a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fnref:8">↩</a></li><li><a href="https://www.oecd.org/ctp/tax-policy/tax-policy-reform-and-economic-growth-9789264091085-en.htm">https://www.oecd.org/ctp/tax-policy/tax-policy-reform-and-economic-growth-9789264091085-en.htm</a> <a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fnref:9">↩</a></li><li><a href="https://www.kentclarkcenter.org/surveys/capital-markets-union/">https://www.kentclarkcenter.org/surveys/capital-markets-union/</a> <a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fnref:10">↩</a></li><li><a href="https://ourworldindata.org/grapher/energy-use-per-person-vs-gdp-per-capita">https://ourworldindata.org/grapher/energy-use-per-person-vs-gdp-per-capita</a> <a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fnref:11">↩</a></li><li><a href="https://www.euractiv.com/section/energy-environment/news/macron-at-sorbonne-energy-key-to-french-presidents-new-european-paradigm/">https://www.euractiv.com/section/energy-environment/news/macron-at-sorbonne-energy-key-to-french-presidents-new-european-paradigm/</a> <a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fnref:12">↩</a></li><li><a href="https://europa.eu/youreurope/business/running-business/developing-business/setting-up-european-company/index_en.htm">https://europa.eu/youreurope/business/running-business/developing-business/setting-up-european-company/index_en.htm</a> <a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fnref:13">↩</a></li><li><a href="https://eidel.io/how-to-found-a-company-in-germany-14-easy-steps-and-lots-of-pain/">https://eidel.io/how-to-found-a-company-in-germany-14-easy-steps-and-lots-of-pain/</a> <a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fnref:14">↩</a></li><li><a href="https://design-system.service.gov.uk/">https://design-system.service.gov.uk/</a> <a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fnref:15">↩</a></li><li><a href="https://www.fca.org.uk/firms/innovation/digital-sandbox">https://www.fca.org.uk/firms/innovation/digital-sandbox</a> <a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fnref:16">↩</a></li><li><a href="https://en.wikipedia.org/wiki/European_Institute_of_Innovation_and_Technology">https://en.wikipedia.org/wiki/European_Institute_of_Innovation_and_Technology</a> <a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fnref:17">↩</a></li><li><a href="https://arcinstitute.org/">https://arcinstitute.org/</a> <a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fnref:18">↩</a></li><li><a href="https://www.aria.org.uk/about-aria/">https://www.aria.org.uk/about-aria/</a> <a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fnref:19">↩</a></li><li>European Molecular Biology Laboratory, an organisation based on the CERN model. <a href="https://www.santiago-martins.com/european-accelerationism-eu-acc.html#fnref:20">↩</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c589e7c64d16" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Achieved Over 90 on All LightSpeed Scores for PopaDex’s Jekyll-based Site]]></title>
            <link>https://duartem.medium.com/how-i-achieved-over-90-on-all-lightspeed-scores-for-popadexs-jekyll-based-site-e7e97480db0c?source=rss-960de5ca095a------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7e97480db0c</guid>
            <category><![CDATA[seo]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[jekyll]]></category>
            <category><![CDATA[personal-finance]]></category>
            <category><![CDATA[finance]]></category>
            <dc:creator><![CDATA[Duarte M]]></dc:creator>
            <pubDate>Wed, 10 Apr 2024 19:05:30 GMT</pubDate>
            <atom:updated>2024-04-10T19:05:30.279Z</atom:updated>
            <content:encoded><![CDATA[<h3>A Website for a Net Worth Tracker</h3><p>My objective when launching <a href="https://popadex.com/">PopaDex</a> was to provide an excellent net worth tracker that was not only functional but also efficient and user-friendly. I decided to build the marketing website using <a href="https://jekyllrb.com/">Jekyll</a> and a <a href="https://tailwindcss.com/">TailwindCSS</a> component library called <a href="https://flowbite.com/">Flowbite</a>. However, after deploying the website, the initial LightSpeed scores indicated a need for substantial optimisation, despite some of the good SEO and Best Practice scores that come with a good Jekyll site. This essay is an overview of the steps taken to transform <a href="https://popadex.com/">popadex.com</a> into a fast and efficient website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8gTO_jTAfhS3xHGAzBo2gQ.png" /><figcaption>Initial scores — Performance needed improving, particularly on mobile</figcaption></figure><h3>Hosting with Netlify</h3><p>The decision to host popadex.com on Netlify was driven by its robust features, including a global content delivery network (CDN), automatic SSL certification, and integrated support for forms. Netlify’s capability for server-side rendering (SSR), particularly with Google Tag Manager, also played a role in making this decision. This latter feature optimises the loading times of third-party scripts, which can significantly hinder site performance.</p><p>Using Netlify’s SSR for Google Tag Manager provides several benefits:</p><ul><li><strong>Faster Load Times:</strong> Server-side rendering minimises the reliance on client-side JavaScript, which is often slowed down by heavy third-party scripts. This setup reduces the time to first paint, which is fairly important for retaining users’ attention and reducing bounce rates.</li><li><strong>Reduced Bandwidth Consumption:</strong> SSR reduces the amount of data transferred over the network, which not only speeds up the loading process but also lowers hosting costs and improves accessibility for users with limited internet bandwidth.</li></ul><p>By implementing SSR, Netlify not only improved the load times of <a href="https://popadex.com/">popadex.com</a> but also ensured that the site’s interactions with Google Tag Manager did not impede its performance.</p><h3>Optimising Images with ImageMagick</h3><p>High-quality images are crucial for an engaging user interface, yet they can hinder site speed. When I replaced a stock SVG with a demo of the product as the hero image, there was a significant trade off between user experience and site speed. The srcset attribute in HTML is recommended for displaying responsive images so I used ImageMagick to generate a series of images for various screen sizes, in WebP for enhanced compression without losing image quality. Because I use TailwindCSS, I made them so they correspond to TailwindCSS’s breakpoints. This ensured that regardless of the device or screen size, the website would load an image optimised for that specific view, significantly improving load times and user experience. The command script used in this process was as follows:</p><pre>for width in 2902 2602 2302 2002 1702 1402 1102 802 502; do convert /path/to/original/image.jpg -resize ${width} /path/to/output/image@${width}w.webp; done</pre><p>With the optimised images ready, the next step was to implement them on the website using the srcset attribute, which as mentioned is the standard method for displaying responsive images in HTML. This attribute allows the browser to select from a list of images, choosing the best fit based on the current viewport&#39;s width. Here&#39;s how it was integrated:</p><pre>&lt;img src=&quot;/assets/images/screenshot.webp&quot; alt=&quot;Screenshot&quot; <br>     class=&quot;w-full&quot;<br>     srcset=&quot;<br>     /assets/images/screenshot@2902w.webp 2902w, <br>     /assets/images/screenshot@2602w.webp 2602w, <br>     /assets/images/screenshot@2302w.webp 2302w, <br>     /assets/images/screenshot@2002w.webp 2002w, <br>     /assets/images/screenshot@1702w.webp 1702w, <br>     /assets/images/screenshot@1402w.webp 1402w,<br>     /assets/images/screenshot@1102w.webp 1102w, <br>     /assets/images/screenshot@802w.webp 802w, <br>     /assets/images/screenshot@502w.webp 502w&quot;<br>     sizes=&quot;(min-width: 1280px) 1280px, (min-width: 1024px) 1024px, (min-width: 768px) 768px, 100vw&quot;<br>     loading=&quot;lazy&quot;<br>     decoding=&quot;async&quot;<br>     width=&quot;2902&quot; <br>     height=&quot;2518&quot;&gt;</pre><p>The srcset implementation, coupled with the WebP formand and TailwindCSS for styling, ensured that images are displayed in their optimal size, contributing significantly to the site&#39;s overall performance and enhancing the user&#39;s visual experience. Incidentally, this strategy is an example of how combining backend image processing with frontend responsive design principles can lead to substantial improvements in website speed and efficiency.</p><h3>Leveraging Jampack for Above the Fold Optimisation</h3><p><a href="https://github.com/divriots/jampack">Jampack</a> is a solid tool offering a suite of features aimed at optimising web performance, and one of its standout capabilities is the optimisation of “above the fold” content. By prioritising the loading of critical CSS and deferring less crucial resources, Jampack ensures that the initial viewport loads as quickly as possible, significantly reducing perceived load times. More specifically, here’s how it contributed to enhancing PopaDex:</p><p><strong>Critical CSS Extraction and Inline Loading:</strong> Jampack automatically identifies and extracts CSS critical to rendering the “above the fold” content. This CSS is then inlined in the HTML document. What this means is the need for browsers to fetch an external CSS file before rendering the page is removed, thus speeding up the time to first paint.</p><p><strong>Deferring Non-Critical Resources:</strong> For resources not required immediately for the initial render — such as certain JavaScript files or below-the-fold images — Jampack defers loading until after the main content is displayed. This ensures that the browser’s main thread is not blocked by resources that are not critical to the initial user experience, improving the site’s responsiveness from the user’s perspective.</p><p>As a result, the site’s “above the fold” content began loading significantly faster, creating a snappier initial loading experience. This not only improved our LightSpeed scores but also enhances user engagement, as visitors are more likely to stay on a site that appears responsive and quick.</p><h3>Accessibility</h3><p>I also added aria labels, and meta lang tags as suggested in the accessibility section, in order to boost this score. Google uses this as a factor when ranking websites, but naturally this is just best practice.</p><h3>The final result</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TZ3s0DucOu_wvCVw5Za0eA.png" /><figcaption>The final Lightspeed scores</figcaption></figure><p>Using these methods together, I managed to get all scores to an acceptable level both on Mobile and Desktop.</p><h3>Conclusion</h3><p>By hosting the Jekyll site on Netlify, I leveraged features like their global CDN and server-side rendering for Google Tag Manager to improve load times. Image optimisation was key; using ImageMagick, I automated the resizing of images to fit TailwindCSS breakpoints and conversion to WebP, significantly reducing load times without sacrificing quality. The srcset attribute in HTML allowed for responsive image delivery, optimising download efficiency based on the user&#39;s device. Additionally, Jampack optimised above-the-fold content by prioritising critical CSS and deferring non-critical resources, which streamlined the initial page load and enhanced user engagement.</p><p>Put together, the strategies turned <a href="https://popadex.com/">popadex.com</a> into a fast, efficient, and user-friendly marketing website for the net worth tracker, dramatically improving its LightSpeed scores.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vKoGDVhWqp8s14X86uWoug.jpeg" /><figcaption>The PopaDex marketing website front page at time of writing</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7e97480db0c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to delete your Facebook account in 2021]]></title>
            <link>https://duartem.medium.com/how-to-delete-your-facebook-account-in-2021-dbc30e0b7d1?source=rss-960de5ca095a------2</link>
            <guid isPermaLink="false">https://medium.com/p/dbc30e0b7d1</guid>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[social-media]]></category>
            <category><![CDATA[mental-health]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[tips-and-tricks]]></category>
            <dc:creator><![CDATA[Duarte M]]></dc:creator>
            <pubDate>Sat, 06 Mar 2021 19:17:44 GMT</pubDate>
            <atom:updated>2024-05-05T17:09:58.433Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to delete your Facebook account and keep your data</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*d65TQOLmS1K1SiNR" /><figcaption>Make more time for high value activities like hiking outdoors! Photo by <a href="https://unsplash.com/@beccatapert?utm_source=medium&amp;utm_medium=referral">Becca Tapert</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplas</a>h</figcaption></figure><p>There are several reasons to consider deleting Facebook. A couple good ones are user privacy and psychological impact. First, as a company it has been fairly hostile to user privacy concerns, even when controlling for the fact that as a major platform it attracts more scrutiny than the vast majority of other software companies. Second, as a platform it works a bit like a slot machine, in that it promotes addictive behaviours and keeps you from engaging in deep work.</p><p>A few things might keep you from wanting to fully leave, however if you’re reading this in all likelihood you don’t use Facebook to the same extent you once did, considering that their key market is now the less tech-native segment of the baby-boomer generation. Many people have found that they don’t feel like they’re missing out on anything of value after leaving the platform, and I include myself among those that have enjoyed adopting a more minimalist approach to their digital lives.</p><p>A relevant concept here is Dunbar’s number — a suggested cognitive limit to the number of people with whom one can maintain stable social relationships — named after British anthropologist Robin Dunbar. That number is 150, however it’s worth bearing in mind that is the upper limit. In reality, most of us never come close to maintaining 150 close relationships at any one time.</p><p>Should you want to go ahead with deleting your account, there are a few things worth considering. One of Facebook’s main uses is as a reminder for your friends’ birthdays, so we want to make sure we export its calendar. Another thing we might want to do is a bit of privacy-focused prevention: delete our posts, leave all groups, download and delete our photos, and unlike all of our liked pages. This is in case Facebook’s ghost profiles turn out to be a real practice, and the evidence seems to suggest they are. Ghost profiles are accounts that Facebook creates, with information it contains on people that aren’t signed up to the platform. Finally, we might want to let our contacts know that we’re leaving the platform and ask them to not upload any photos or information about us, should privacy be a concern.</p><p>1. Download all photos</p><p>2. Download Facebook’s calendar</p><p>3. Unfriend, unlike, and delete all photos</p><p>4. Announce departure</p><h4>1: Download all photos</h4><p>It’s fairly easy to export all of the photos you uploaded by simply using using Facebook’s [download your information tool](https://www.facebook.com/settings?tab=your_facebook_information). It’s less easy to download photos you’ve been tagged in. For this you’ll have to use some external tools, and most likely have to make use of a little programming.</p><p>The first and most simple option is using one of these IFTT recipes:</p><p>- <a href="https://ifttt.com/applets/126727p-back-up-photos-you-re-tagged-in-on-facebook-to-an-ios-photos-album">FB to iOS</a></p><p>- <a href="https://ifttt.com/applets/47704776d-save-photos-you-re-tagged-in-on-facebook-to-a-dropbox-folder">FB to Dropbox</a></p><p>If for whatever reason you want to use another alternative you can follow <a href="https://matthew-johnston.com/DownloadAllFacebookTaggedPhotos/">this tutorial</a>. Essentially go to your photos page at <a href="https://facebook.com/me/photos">facebook.com/me/photos</a> and run this JS script in your browser console to get the “FBIDs” of your photos:</p><p><em>for (link of document.getElementsByTagName(‘a’)) {</em></p><p><em>if (!link.href.includes(“?fbid=”)) continue;</em></p><p><em>console.log(new URL(link.href).searchParams.get(“fbid”));</em></p><p><em>}</em></p><p>Then feed that list to <a href="https://github.com/mgjohnston/fmpd/tree/patch-1">this python script</a> which downloads your photos.</p><p>I would recommend then hosting your photos on another cloud-hosting provider such as Apple Photos.</p><h4>2: Download Facebook’s calendar</h4><p>You can use <a href="https://chrome.google.com/webstore/detail/birthday-calendar-extract/imielmggcccenhgncmpjlehemlinhjjo">this Chrome extension</a> for that, it’s quite straightforward.</p><h4>3: Unfriend, unlike, and delete all photos</h4><p>There are quite a few command line interfaces that can help you with this:</p><ul><li><a href="https://github.com/spieglt/fb-delete">https://github.com/spieglt/fb-delete</a></li><li><a href="https://github.com/weskerfoot/DeleteFB">https://github.com/weskerfoot/DeleteFB</a></li></ul><p>Another strategy is to scramble the information before you delete your account, however this requires a fair bit more time and programming some custom scripts.</p><h4>4: Announce departure</h4><p>As a final step I suggest announcing to your network that you’re leaving the platform, leaving alternative contact details and requesting that others don’t upload photos of you.</p><p>The process should take a few days to complete on Facebook’s end, at which point your data is <em>_supposedly_</em> deleted from their servers.</p><p>Now enjoy being away from the platform — try to select for high value activities to do in your free time, and notice how you’ll focus more on your most meaningful and rewarding relationships.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dbc30e0b7d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Love and a Cavani (Translation)]]></title>
            <link>https://duartem.medium.com/love-and-a-cavani-translation-88131fdce786?source=rss-960de5ca095a------2</link>
            <guid isPermaLink="false">https://medium.com/p/88131fdce786</guid>
            <category><![CDATA[economics]]></category>
            <category><![CDATA[inequality]]></category>
            <category><![CDATA[portugal]]></category>
            <category><![CDATA[soccer]]></category>
            <category><![CDATA[football]]></category>
            <dc:creator><![CDATA[Duarte M]]></dc:creator>
            <pubDate>Sat, 26 Sep 2020 11:42:30 GMT</pubDate>
            <atom:updated>2020-09-26T11:43:23.067Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zrSrTCYNmahavxHk" /><figcaption>Photo by <a href="https://unsplash.com/@viennachanges?utm_source=medium&amp;utm_medium=referral">Vienna Reyes</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><em>This article originally appeared in the Portuguese publication</em><a href="https://eco.sapo.pt/opiniao/amor-e-um-cavani/"><em> Eco Online</em></a><em>. It has been translated into English with the author’s permission. Original article by Carlos Guimarães Pinto.</em></p><p>If there is one thing that Portugal needs, it is to attract people who earn well and have accumulated wealth, even if this increases statistical inequality.</p><p>The government loves the SNS [1]. The Socialist Party[2] loves the SNS. It is true that we have people dying waiting for surgery. It is true that the pandemic has put even more people on the wait list and that, due to ideological prejudice, there seems to be little interest in using the capacity installed in the private sector to fill these gaps. It is true that when the nursing council (Ordem dos Enfermeiros) complained about the conditions in which nurses worked, the government began a persecution that culminated in an investigation. It is true that when the medical council (Ordem dos Médicos) decided to investigate what had happened in Reguengos de Monsaraz[3], the government started a war against doctors, with the prime minister as a spearhead. The government loves the SNS and everything related to the SNS, except that small part of the SNS that are the users, doctors and nurses.</p><p>There are few industries that the Portuguese follow as well as football. There are also few of which the Portuguese are so proud. And with good reason for that. Football must be one of the few industries in which Portugal competes toe to toe with the countries of Central Europe.</p><p>It is also an industry in which, unlike the rest of the economy, the countries of the East are still a long way from catching up on us. This is only possible because football is, by its nature, a competitive industry which means that many of the factors that delay the rest of the economy cannot be applied to football (although others, unfortunately, not even the nature of football can keep away).</p><p>Unlike other industries, in the game of football there is no room for exchanging places on the squad for favours. A political party can even help a club a lot, but that club will never put the prime minister’s fat nephew at left-back. Those that the coach considers to be the best among the players that the club can afford are always the ones on the pitch. Even when that competition is tainted by refereeing favours (something that, for all legal purposes, I’m not implying exists or has ever existed in Portugal), no club can afford to not put good players on the pitch.</p><p>Any kid from a run-down neighborhood who knows how to actually play football will always have a better chance of entering the starting lineup than the leader of a local PS chapter. That is why football is also an industry where meritocracy is most visible. Any boy, born in any social environment, of any race can aspire to become a millionaire in football, even if he cannot aspire to anywhere else (and girls cannot, yet, have that aspiration in football).</p><p>Unfortunately, although they like and follow a lot of football, the Portuguese rarely learn lessons from football for the rest of the economy. The importance of a competitive environment for growth, social mobility and the elimination of prejudice is one of these lessons. But there are more lessons that can be learned and the recent novella over the signing of Cavani[4] is an excellent opportunity to learn something.</p><p>The first lesson has to do with taxation. Cavani, like Casillas and Schmeichel before him, would bring great added value to both the club that signed him and Portuguese football. It is complicated to estimate exactly how much, because a lot would depend on his performance, but it is certain that his coming would bring more attention to the Portuguese championship, and to everyone who plays here. Many would win. From Gil Vicente’s[5] left-back who, thanks to the increased attention to Portuguese football, could be lucky enough to have a scout watching a game that would give him a millionaire contract in the second Chinese league, to the textile company that produces the Benfica store’s t-shirts.</p><p>Apparently, the club and the player had already agreed the net salary, but the deal fell through because the tax burden necessary to pay that net salary was unaffordable for the club. In the end, the club and its fans lost out, Gil Vicente’s left-back lost out, the textile company lost out, they all lost out, except for Cavani himself who will easily find another club offering a similar sum. An entity that also lost out was the Portuguese state, which will receive absolutely nothing from Cavani’s salary. In economics, this is called the deadweight loss of tax, that is, all the costs that the tax burden brings to the economy resulting from what never happens (contracts, investments) due to the weight of this tax burden. It’s called deadweight because those potentially involved lose everything, but the state does not obtain any tax revenue either.</p><p>Cavani’s case is an extreme one and it is very easy to appeal to feelings of social justice for a guy who gets 10 million a year. But we could think of a company that needs to retain a key engineer, and that to pay them 4 thousand euros a month (a low salary for a good engineer anywhere in Europe) needs to spend 10 thousand euros a month between salary, Income Tax and Social Security. We can think of all the companies that are unable to retain this talent, and all the talented professionals who later end up abroad adding value and creating new jobs in other countries. Or, even worse, those who become unmotivated and unproductive because they feel that their talent is not adequately compensated. We can think of the impact on our productivity, which punishes companies that create well-paid jobs.</p><p>But there is another lesson. A lesson on inequality. As soon as Cavani arrived, he would immediately increase all inequality statistics, both income and wealth. He would earn as much in one year as a factory worker in several centuries. Inequality in the country would increase, but this would not mean that the poor would be worse off.</p><p>There are inequality drivers that actually make the poor worse off. When the Portuguese state guarantees better teaching conditions for children in wealthy areas than for children in poor areas, it is generating unjustified inequality. When the government collects taxes to finance their friends’ businesses it is creating unjustified inequality. When a thief robs a person in the middle of the street, he is creating unjustified inequality. Inequality is a problem when it results from a process in which one coercively takes from some to give to others (I gave a good example of this here at Eco two weeks ago). When inequality appears because someone who creates value keeps a part of that value created, there is no harm to the poorest. On the contrary, when income or wealth is acquired through voluntary processes, the accumulation by some can only be done to the benefit of others. If tomorrow a scientist invents a vaccine for a certain virus and became a millionaire with it, inequality will increase, but it can hardly be said that the poor are losing out.</p><p>If there is one thing that Portugal needs, it is to attract people who earn well and have accumulated wealth, even if it increases statistical inequality. Because only then will we be able to improve the lives of everyone, especially the poorest. As anyone comparing the salary and standard of living of a cleaner in Portugal and Luxembourg will realize, there is no one who benefits as much from attracting capital as the poorest. There is no ideological prejudice capable of reversing this reality.</p><p>[1] Serviço Nacional de Saúde, the Portuguese National Health Service</p><p>[2] The social democratic party currently in power, under a minority government with a confidence and supply arrangement with the far left parties. Known by its initials in Portuguese: PS.</p><p>[3] A small town at the centre of a recent scandal involving the government and the medical council.</p><p>[4] It was reported that the Portuguese football club S.L. Benfica made a significant, yet ultimately unsuccessful, effort to try and sign Uruguayan international Edinson Cavani over summer 2020.</p><p>[5] Small football club from the town of Barcelos that competes in the Portuguese top flight.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88131fdce786" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to automatically delete spreadsheet rows with few records using Ruby]]></title>
            <link>https://duartem.medium.com/how-to-automatically-delete-spreadsheet-rows-with-few-records-using-ruby-c547a050e25c?source=rss-960de5ca095a------2</link>
            <guid isPermaLink="false">https://medium.com/p/c547a050e25c</guid>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Duarte M]]></dc:creator>
            <pubDate>Mon, 20 Apr 2020 17:21:57 GMT</pubDate>
            <atom:updated>2020-04-21T10:34:25.022Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-nc-sa/4.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Z0d5VOYF5jMx_iEe" /><figcaption>A wind turbine assembly line, making extensive use of automation. Photo by <a href="https://unsplash.com/@scienceinhd?utm_source=medium&amp;utm_medium=referral">Science in HD</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Ruby is a great scripting language, it’s easy to read and write, and it can automate pretty much anything. It’s a prime candidate for data analysis and general business process automation.</p><p>When working with CRM exports to carry out audience analyses, one simple time saver would be if we could instantly delete irrelevant columns that haven’t got enough data in them to be useful. To that end, I wrote this little ruby script that deletes columns with fewer than 10 records, it uses nothing other than ruby’s standard CSV library.</p><pre>require ‘csv’</pre><pre>table = CSV.table(‘./spreadsheet.csv’, headers:true).by_col! <br># This opens the CSV as a table and sets it to be handled by columns</pre><pre>table.delete_if do |col|<br> col[1].compact.size &lt;10<br>end<br># Here we delete columns if they have fewer than 10 records, using .compact to discount empty cells</pre><pre>File.open(‘cleanspreadsheet.csv’, ‘w’) do |f|<br> f.write(table.to_csv)<br>end<br># Finally, we save the file in a new CSV.</pre><p>I hope that by sharing this I can save others in the same situation some time. 👍</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c547a050e25c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rails from first principles: Building a has_many bi-directional association]]></title>
            <link>https://duartem.medium.com/rails-from-first-principles-building-a-has-many-bi-directional-association-3b70abc6fbbd?source=rss-960de5ca095a------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b70abc6fbbd</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[mvp]]></category>
            <dc:creator><![CDATA[Duarte M]]></dc:creator>
            <pubDate>Sun, 19 Apr 2020 18:49:15 GMT</pubDate>
            <atom:updated>2020-04-19T18:49:15.379Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-nc-sa/4.0/</cc:license>
            <content:encoded><![CDATA[<p>A great way to learn is by trying to explain, so as part of my rails association learning process, I’ll attempt to explain a slightly more complex bi-directional association between two models. This is part of the “Building advanced forms” exercise of The Odin Project.</p><p>Objective: I want to build a proof of concept flight-booking app, and the first requirement is to create associations between an Airport model and a Flight model.</p><p>Steps:</p><ol><li>Each airport will have many flights, and each flight will belong to an airport. Airports have 3-letter international codes, e.g. LIS for the Lisbon international airport.</li><li>Each flight, however, will need both origin and destination airports.</li><li>Each airport will have departing and arriving flights.</li></ol><p>So what does this mean for our model associations?</p><p><strong>Step 1:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y9lnEwls9B0u73SmeiY_QQ.png" /></figure><p>The airport model has a Code variable, which is a string field, such as “SFO” or “LIS”. This association creates the Airport.find(1).flight and Flight.find(1).airport methods which let you query Airport flights and flight airports, respectively.</p><p><strong>Step 2:</strong></p><p>Now we need to separate flight airports into origin airports and destination airports, since flights fly from A to B. We will call these from_airport and to_airport to make the relationships easier to understand. The Flight associations are changed to:</p><p>belongs_to :from_airport, class_name: “Airport”<br>belongs_to :to_airport, class_name: “Airport”</p><p>This means that each flight will have a from_airport and a to_airport, but that these are simply different instances of the Airport model. This means we have to create a from_airport_id field and a to_airport_id field in the Flight model in order to associate each Flight to two airports, the origin and destination ones.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-k_eFSdzP0zjd_O-xtZsSw.png" /></figure><p><strong>Step 3:</strong></p><p>The next step is to add departures and arrivals to the airport model. A departing flight of an airport is a flight whose from_airport field corresponds to the airport id of that airport. An arriving flight is a flight whose to_airport field corresponds to the airport’s id.</p><p>So what we want to do is to call these flights “departing_flights” and “arriving_flights”, and associate them to a from_airport_id field and a to_airport_id field, in the Flight model. This association is done by setting a foreign_key.</p><p>has_many :departing_flights, foreign_key: :from_airport_id, class_name: “Flight” <br> has_many :arriving_flights, foreign_key: :to_airport_id, class_name: “Flight”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mA2rxjieQ7QUyY9EsASQUg.png" /></figure><p>In narrative form, this means that Airports have flights, and they are either departing or arriving depending depending on whether the from_airport_id or to_airport_id field corresponds to the airport ID.</p><p>Likewise, Flights have “from airports” (origins) and “to airports” (destinations), which is set by the ids in from_airport_id and to_airport_id.</p><p>We can now use methods such as Airport.first.departing_flights to get the departing flights of the first airport, and Flight.first.from_airport to get the origin of the first flight.</p><p>If we wanted to, we could change from_airport to origin and to_airport to departure but we’ll leave it as it is in the interest of simplicity. We could also add inverse_of to make database querying more efficient, but we’ll also leave that out as it’s not a strict requirement.</p><p>And that’s it. Our app now has Airports with many departing and arriving flights, as well as Flights with origins and destinations.</p><p>— — —</p><p>Hope this was insightful. Feedback is always welcome.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b70abc6fbbd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to easily extract URLs from a webpage]]></title>
            <link>https://duartem.medium.com/how-to-easily-obtain-urls-from-a-webpage-bbeb719012a0?source=rss-960de5ca095a------2</link>
            <guid isPermaLink="false">https://medium.com/p/bbeb719012a0</guid>
            <category><![CDATA[digital-marketing]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[growth-hacking]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Duarte M]]></dc:creator>
            <pubDate>Sat, 01 Sep 2018 19:26:07 GMT</pubDate>
            <atom:updated>2020-04-20T17:27:43.525Z</atom:updated>
            <content:encoded><![CDATA[<p>I found it far too time-consuming to discover how to do this, so I have written this mini guide in the interest of simplicity and passing on knowledge. Hopefully the next person to do this won’t have to spend so much time searching the web.</p><p>A few use cases:</p><ul><li>Scrape contacts to generate leads</li><li>Find price differences between restaurants</li><li>Find related links in a wikipedia page</li><li>Find related music artists</li></ul><p>This is how to do it on macOS, but you can probably do the same thing using a similar method on Windows, Linux, etc.</p><ol><li>Download the webpage source as an html file.</li><li>Find the class where your desired urls are. In your browser right click the type of link you are looking for and click “inspect element”. The class name will be where it says ‘class=”x”’.</li><li>The html needs to be cleaned as it is probably a mess. Open the html file using a text editor like Sublime Text or Atom and use the following regex to find the classes you need: &lt;div[^&lt;&gt;]*class=”my-class”[^&lt;&gt;]*&gt;[\s\S]*?&lt;/div&gt; where you replace the class name with the one you found in step 2. Copy and paste this into a new html file.</li><li>Now to remove everything except the full URLS we can use a terminal program called grep on our new html file. Open up terminal and put this in:<br>grep -Eoi ‘&lt;a [^&gt;]+&gt;’ Yourfilepath.html |<br>grep -Eo ‘href=”[^\”]+”’ | <br>grep -Eo ‘(http|https)://[^”]+’</li><li>If there are any duplicates you can use your text editor to remove them. On Sublime you would do the following:<br>Edit -&gt; Sort Lines (F9)<br>Edit -&gt; Permute Lines -&gt; Unique</li></ol><p>And that’s it. This is certainly a messy way to go about it but it’s quick and it works. If you can recommend a cleaner way, please do.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bbeb719012a0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>