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 / 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="[email protected]"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="[email protected]"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
@nash403
nash403 / perfect-modulo.js
Created April 12, 2017 08:08
Modulo that always returns a value always between 0 and `size - 1`
/**
* Returns a value always between 0 and size - 1.
* @param a current index
* @param b size
*/
export function modulo(a, b) { return (+a % (b = +b) + b) % b; };
@nash403
nash403 / change_user_premission.md
Last active April 12, 2017 08:06
Change user/Group permission on Unix
@nash403
nash403 / preload-image.js
Created March 22, 2017 14:18
Preload images in JS
let img = new Image();
img.onload = () => {
console.log('youpiiii img preloaded !')
};
img.src = 'some_url';
@nash403
nash403 / pager.ts
Last active March 23, 2017 13:35
Simple Pager structure in TypeScript
import { modulo } from "./utils";
export class Pager {
next:number = 0;
previous:number = 0;
constructor(public current:number = 0, public length:number = 0, noModulo:boolean = false) {
this.setNeighbours(noModulo);
}
@nash403
nash403 / image_broken_replacement.scss
Last active April 12, 2017 08:10
hide image broken icon and replace it with alt content
img[alt] {
position: relative;
&:after {
display: block;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
/* Add bg color and the text of the alt attribute in place of the broken image */

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