Skip to content

Instantly share code, notes, and snippets.

View mikaelhadler's full-sized avatar
🌻
Make your reality

Mikael Hadler mikaelhadler

🌻
Make your reality
View GitHub Profile
@mikaelhadler
mikaelhadler / checkDeviceService.js
Last active March 29, 2019 14:55
Service for get name the browser in device
let _getUserDevice = function () {
let userAgent = $window.navigator.userAgent;
let browsers = {chrome: /chrome/i, safari: /safari/i, firefox: /firefox/i};
for(let key in browsers){
if (browsers[key].test(userAgent)) {
return key;
}
}
@mikaelhadler
mikaelhadler / checkIsMobile.js
Last active March 29, 2019 16:27
Function return true when device is mobile and false else
module.exports = {
return $window.screen.width <= 767 ? true : false;
}
@mikaelhadler
mikaelhadler / .gitconfig
Created January 12, 2018 00:03
Alias graph for git cli : ]
[alias]
graph = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
import axios from 'axios'
axios.interceptors.request.use(function (config) {
// Do something before request is sent
return config
}, function (error) {
// Do something with request error
console.log('Request error: ', error)
return Promise.reject(error)
})
@mikaelhadler
mikaelhadler / Git-alias.md
Last active February 10, 2023 11:32
Add alias bash and git alias

For your alias to be insert in commands bash, you need to include that in .bashrc, so take this example and to be happy:

echo alias g=\'git\' >> .bashrc

If you have a success with this command, you can now call git with 'g' command.

Now, if you like alias git, you can create your personal alias file, take this example and edit your file ~ / .gitconfig:

@mikaelhadler
mikaelhadler / dockerfile
Last active March 29, 2019 16:13
Production example
#==================== Building Stage ================================================
# Create the image based on the official Node 8.9.0 image from Dockerhub
FROM node:9
# Create a directory where our app will be placed. This might not be necessary
RUN mkdir -p /app
# Change directory so that our commands run inside this new directory
WORKDIR /app
@mikaelhadler
mikaelhadler / launch.json
Created January 22, 2019 14:25
Config file debugger Vue.js apps in VS Code
{
"version": "0.2.0",
"configurations": [
{
"type": "browser-preview",
"name": "Browser Preview: Attach",
"request": "attach"
},
{
"type": "browser-preview",
const path = require('path');
const fs = require('fs');
const webpack = require('webpack');
const { VueLoaderPlugin } = require('vue-loader');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { NODE_ENV } = process.env;
@mikaelhadler
mikaelhadler / npm-without-sudo.md
Created April 22, 2019 13:28
Use npm without root or sudo rights on Linux

Today we're going to setup our npm installation to be used without root or sudo rights.

By default, if you install packages globally with npm, npm tries to install them into a system directory (i.e. /usr/local/lib/node_modules). With the next steps, we're going to use your home directory for those files.

First we create a directory in your home directory where all the npm packages will be installed.

$ mkdir ~/.node
@mikaelhadler
mikaelhadler / .vimrc
Created May 7, 2019 01:51
mapping keyboard shortcuts for NERDTree in vim
nmap <F6> :NERDTreeToggle<CR>