Skip to content

Instantly share code, notes, and snippets.

View nash403's full-sized avatar
🦄
want a cookie ?

Honoré Nintunze nash403

🦄
want a cookie ?
View GitHub Profile
@nash403
nash403 / viewport-sizes.js
Created January 26, 2018 09:15
Get viewport exact width and height
// From this SO answer https://stackoverflow.com/a/2035211
function getViewport() {
var viewPortWidth;
var viewPortHeight;
// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
if (typeof window.innerWidth != 'undefined') {
viewPortWidth = window.innerWidth,
@nash403
nash403 / mini.css
Last active December 4, 2017 07:01
Minimal css file with font-sizes, clearfix & sr-only
html {
font-size: 62.5%; /* 10px */
}
body {
line-height: 1.8em;
font-size: 1.4em; /* 14px */
color: #49525e;
background-color: #f5f5f5;
font-family: Verdana,"Helvetica Neue",Helvetica,Arial,sans-serif;
-webkit-font-smoothing: antialiased;
export function hideOnClickOutside(selector) {
const outsideClickListener = (event) => {
if (!$(event.target).closest(selector).length) {
if ($(selector).is(':visible')) {
$(selector).hide()
removeClickListener()
}
}
}
@nash403
nash403 / immutable-arrays.js
Created November 10, 2017 07:17
Immutable array utils
clone = x => [...x]
push = y => x => [...x, y]
pop = x => x.slice(0,-1)
unshift = y => x => [y, ...x]
shift = x => x.slice(1)
sort = f => x => [...x].sort(f)
delete = i => x => [...x.slice(0,i), ...x.slice(0,i+1)]
splice = (s,c, ...y) => x => [...x.slice(0,s), ...y, ...x.slice(s+c)]
@nash403
nash403 / rwd-meta-tag.html
Created November 1, 2017 12:25
Meta Tag for responsive web design
<meta name="viewport" content="width=device-width, initial-scale=1">
@nash403
nash403 / rem-calc.scss
Created June 6, 2017 13:49
px to rem calculator for SASS
@function trim-unit($value) {
@return $value / ($value * 0 + 1);
}
@function rem-calc($value) { // $value is in px, returned value is in rem
@return $value / trim-unit() * 1rem;
}
@nash403
nash403 / prettify.css
Created June 1, 2017 14:53
Prettify JSON with JS
.string { color: #ff5722; }
.number { color: #009688; }
.boolean { color: #2196F3; }
.null { color: #3f51b5; }
.key { color: #545E6C; }
@nash403
nash403 / release.sh
Created May 18, 2017 19:05
Script for github release
#!/usr/bin/env bash
# Assuming you have a master and dev branch, and that you make new
# release branches named as the version they correspond to, e.g. 1.0.3
# Usage: ./release.sh -v 1.0.3
# Use the -b or --bump parameter to only bump
# Default values
bump=false
@nash403
nash403 / rewrite-git-author.sh
Created May 18, 2017 08:08
Changing the Git history to change the author of commits. Copy paste, replace OLD_EMAIL, CORRECT_NAME & CORRECT_EMAIL and press ENTER.
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"

To completely uninstall node + npm is to do the following:

  • go to /usr/local/lib and delete any node and `node_modules
  • go to /usr/local/include and delete any node and node_modules directory
  • if you installed with brew install node, then run brew uninstall node in your terminal
  • check your Home directory for any local or lib or include folders, and delete any node or node_modules from there
  • go to /usr/local/bin and delete any node executable
sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp /opt/local/bin/node /opt/local/include/node /opt/local/lib/node_modules