Roine
About
  • Jan 24, 2019

    Keep same URL in now.sh

    In the world of static file hosting there are plenty of solutions. I picked now.sh. It’s free, easy to use and works well. I have had one problem with now.sh so far, it creates a new URL everytime you push. It’s a feature that I dont need in some cases, here’s how to solve. Put this in package.json:

    {
      "scripts": {
        "deploy": "now && now alias && now remove YOUR_APP_NAME --safe -y"
      }
    }
    
    Replace YOUR_APP_NAME by the name of your app. Then go to your now.json and add/change:
    "name": "YOUR_APP_NAME",
    "alias": "YOUR_UNIQUE_SUBDOMAIN.now.sh",
    
    Replace YOUR_UNIQUE_SUBDOMAIN by your unique subdomain. Just run yarn deploy.

    now.sh   static file hosting   til  
  • Jan 23, 2019

    touch to update a file timestamp

    Touch is mainly known for creating files. Touch main purpose is actually to update the file’s timestamp. From the man:

    The touch utility sets the modification and access times of files. If any file does not exist, it is created with default permissions.

    shell   til  
  • Jan 17, 2019

    Pretty format ELM model in browser

    An example of pretty format in browser Using Debug.toString is really helpful to help debug the model but the format of the output is hard to read. Looking for solution I stumbled upon this gem(not the ruby gem). I changed it to work in elm 0.19 and fix a minor issue when using custom type for the Model. Here’s the final result on Gist.

    debug   elm   elm 0.19   til  
  • Dec 20, 2018

    Empty Tag in React

    When you need to return more than one element you have few solutions.

    Wrap with an element

    <div>
      <span>1</span>
      <span>2</span>
    </div>
    

    Return a list (requires a key)

    function List() {
        return [<span key='1'>1</span>, <span key='2'>2</span>]
    }
    

    Use Fragment (16.2.0+)

    <Fragment>
      <span>1</span>
      <span>2</span>
    </Fragment>
    

    Use empty tag (some kind of alias for Fragment)

    <>
      <span>1</span>
      <span>2</span>
    </>
    

    react   til  
  • Dec 20, 2018

    Reuse last argument from previous command

    If you need to reuse the reuse the last argument from the previous command this is for you:

    touch config.js
    vi !$
    
    Last command is equivalent to
    vi config.js
    
    Bonus: echo $? will display the exit code of therevious command !! will re-execute the previous command, sudo !!

    shell   til  
  • Dec 20, 2018

    Calendar in shell

    I love calendars and shell has a way to display the calendar for the current month

    $ cal
    
    shell cal output

    calendar   shell   til  
  • Dec 20, 2018

    Message

    I don’t have much time to write complete articles, so I’ll start publishing Today I learned short articles

  • Sep 4, 2018

    Building a calendar UI in ELM - Part 2

    In the previous part of this tutorial we’ve seen how to represent the current month view into a list of dates. Now let’s see how we transform this data into something similar to the screenshot below.

    elm   functional programming   tutorial  
  • Aug 26, 2018

    Building a calendar UI in ELM - Part 1

    ELM was redesign recently and Date and Time have been removed from the core to the Time library. With that in mind let’s build a calendar.

    elm   functional programming   tutorial  
  • Aug 22, 2018

    How to use hash parsing in ELM 0.19

    Before in ELM 0.18 if you used evancz/url-parser you would use parseHash to parse the fragment. But now in 0.19 elm/url doesn’t have such function. It is still possible to parse the hash though.

    elm   elm navigation   functional programming  
  • Aug 15, 2018

    Common errors in Javascript and how it's solved in ELM

    One of my favorite things about ELM is the compiler, it will catch errors before they could make their way to production. Let’s have a look at the most common Javascript errors and see how ELM makes sure they don’t bother you.

    elm   functional programming   javascript  
  • Aug 13, 2018

    Why I ditched JS for ELM

    I’ve been working with ELM for 2 years now. When I started I had very little knowledge about functional programming. I remember being skeptic about it at first then falling in love with it. Now going back to ReactJS or AngularJS feels like trading a swiss army knife for a hammer.

    elm   functional programming   javascript  

Roine

  • Roine
  • roine

Tech blog