Skip to content

Instantly share code, notes, and snippets.

View elhachimi's full-sized avatar
🏠
Working from home

elhachimi

🏠
Working from home
View GitHub Profile
set scrolloff=8
set number
set relativenumber
set tabstop=4 softtabstop=4
set shiftwidth=4
set expandtab
set smartindent
call plug#begin('~/.vim/plugged')
Plug 'nvim-lua/popup.nvim'
@elhachimi
elhachimi / watchman.js
Created November 5, 2016 21:35
Watches the current folder and runs "node file" if changed
const fs = require('fs');
const exec = require('child_process').exec;
fs.watch('./', {encoding: 'buffer'}, (eventType, filename) => {
if (filename)
exec(`node ${filename}`, (err, stdout, stderr) => {
if (err) {
console.log(err);
return;
}
console.log(`file ${filename} has changed`);
@elhachimi
elhachimi / nginx.conf
Created October 21, 2015 11:01 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@elhachimi
elhachimi / Base64 JS Demo
Last active August 29, 2015 14:25 — forked from chrisallick/Base64 JS Demo
Base64 in JavaScript turn a json object to a base64 string. boom!
<!DOCTYPE html>
<html>
<head>
<title>Base64 Demo</title>
<meta charset="utf-8">
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js' type='text/javascript'></script>
<script src='https://javascriptbase64.googlecode.com/files/base64.js' type='text/javascript'></script>
#/bin/bash
set -e
if [ -z "$(which brew)" ]; then
echo "This script requires Homebrew."
exit
fi
if [ -z "$VIRTUAL_ENV" ]; then

Font Face

A mixin for writing @font-face rules in SASS.

Usage

Create a font face rule. Embedded OpenType, WOFF2, WOFF, TrueType, and SVG files are automatically sourced.

@include font-face(Samplino, fonts/Samplino);
@elhachimi
elhachimi / gist:56702f52ccfb27e81311
Last active August 29, 2015 14:13
smooth scroll
'use strict';
/**
* @ngdoc service
* @name myApp.anchorSmoothScroll
* @description
* # anchorSmoothScroll
* Service in the myApp.
*/
angular.module('myApp')
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}