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 / Readme.md
Created May 16, 2019 15:03
How to list packages that are listed in the global package.json in Yarn config

cat $(yarn global dir)/package.json

@nash403
nash403 / webpack.config.js
Created February 9, 2018 13:22
Webpack base config to publish libs to production with modern code
const path = require("path");
const webpack = require("webpack");
const UglifyJSPlugin = require("uglifyjs-webpack-plugin");
const PROD = process.env.NODE_ENV === "production";
const configureBabelLoader = browserlist => {
return {
test: /\.js$/,
use: {
@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 / get-attributes.js
Created January 25, 2018 21:10
Get attributes of an HTML element as a JSON Object (not as NamedNodeMap)
function getAttributes (el) {
return Array.from(el.attributes)
.map(a => [a.name, a.value])
.reduce((acc, attr) => {
acc[attr[0]] = attr[1]
return acc
}, {})
}
@nash403
nash403 / scrollbar.scss
Created January 5, 2018 14:41
Scss mixins for custom scrollbar and no scrollbar
// custom scroll-bar
@mixin custom-scroll-bar() {
&::-webkit-scrollbar {
border-radius: 10px;
height: 10px;
width: 8px;
}
&::-webkit-scrollbar-thumb {
background: #999;
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 / .bashrc
Last active April 29, 2024 04:59
Automatically enable/disable proxy settings from command line
# Show proxy settings
function proxy_show(){
env | grep -e _PROXY -e _proxy | sort
}
# Configure proxy
function proxy_on(){
# You may need to hardcode your password, proxy server, and proxy port
# if the following variables do not exist
export HTTP_PROXY="http://$USERNAME:$PASSWORD@$PROXY_SERVER:$PROXY_PORT"
@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;