Showing posts from March, 2017

Create a responsive navbar with flexbox and boostrap v4

Create a navbar responsive display with flexbox and boostrap v4 Last week we saw how to setup vscode to compile sass. Today we will see how we can compile bootstrap sass files together with our own sass and define a grid layout for the collapsed nav in smaller screen using flexbox. Flexbox Bootstrap sass media directive Build the nav style We will be creating the style for the following navbar: 1. Flexbox Flexbox allows to control how elements are rendered in a responsive layout. We can control precisely how the space available is occupied by elements together with the order of appearance. There’s few settings for it which are applied to the container and the elements within the container. Refer to MDN documentation if you want more explanation . In this tutorial, I will only use the following css properties: For the container: display: flex; flex-flow: row wrap; display:f

Setup vscode to work with sass effortlessly

Setup vscode to work with sass effortlessly Writing sass is very easy with code. Today we will see how we can leverage some NPM packages to compile SASS to CSS, watch file changes and live update the browser for an effortless style development. This post will be composed by 3 parts: 1. Setup vscode task 2. Create a Gulp build script 3. Use live-server for live reload The tasks are from the example of vscode documentation to compile sass . 1. Setup vscode task To use code tasks, we need to create a tasks.json file under the hidden /.vscode folder. | - .vscode - tasks.json | - style.scss | - index.html The tasks allow us to execute programs by selecting from the search bar CMD + shift + P , Run build task . If a default task is set, it can directly be triggered by CMD + shift + B . As a first example we can start by installing the sass compiler with node-sass . npm install -g node-sas

How to make a sticky navbar using Bootstrap

How to make a sticky navbar using Bootstrap Today I will demonstrate one way to achieve a sticky navbar in Bootstrap v4 using fixedsticky . This post will be composed by three parts: 1. Get the librairies 2. Page without the nav sticking 3. Make the nav stick 1. Get the librairies As mentioned in the introduction, we will be using fixedsticky and bootstrap v4. We start first by getting those via bower: Bootstrap v4 bower install bootstrap#v4.0.0-alpha.6 Fixed-sticky bower install filament-sticky You should then have it locally in your bower folder. 2. Page without the nav sticking We build a sample page without sticky. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Example</title> <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" /> <style> .content { background-color: rgba(0, 0, 255, 0.21); height: 2000

More Gimp tips!

More GIMP tips! Every now and then I discover features on Gimp that I didn’t know existed. It is always a good surprise to find a feature which simplify your work. So today I will show four features that I recently discovered: 1. Extra view 2. Color palette 3. Floating layer 4. Animated GIF 1. Extra view Gimp allows us to display multiple time the same file with different zoom and positions. This is very useful as we can use as a preview view. You can open a new view by going View > New View . 2. Palette to choose colors To choose between colours another easy way is to use Palettes. You can open the palette by adding from Windows > Dockable dialogs > Palette . Once selected, it can be used to set the restrict the colors picker to your own colors. For example if we choose the Gold palette, we will have some shades of brown which can be used to colour objects and make them gold’ish. We can also create our own palettes and those are saved into Gimp settings. For example

Create a simple form engine with WebSharper.UI.Next in F#

Create a simple form engine with WebSharper.UI.Next in F# WebSharper came out with WebSharper.Forms. It is a terse DSL to build form, I posted a tutorial on it few months ago . It’s very powerful as the abstraction handles most of the scenarios. Today I would like to show anothe way to create forms by building a form engine. This post will be composed by 4 parts: Define the domain Implement the renderers Use it 1. Define the domain Defining a model is tricky. It needs to be both flexible enough to handle all needed scenario but it also needs to be simple enough that there aren’t too many options which would make the domain messy. I will give an example later to illustrate this. For a form engine, the domain model is composed by the elements of form and the submission behaviors. Form elements For this example we will just implement the input and input area . Implementing the rest of the con