Skip to content

Instantly share code, notes, and snippets.

View radum's full-sized avatar
🚀
I can see what you see not

Radu Micu radum

🚀
I can see what you see not
View GitHub Profile
@radum
radum / facer.io
Last active September 17, 2019 13:59
facer.io free watch faces
cd ~/personal/watch-faces
ws -z --key ~/personal/ssl-certs/local.dev+1-key.pem --cert ~/personal/ssl-certs/local.dev+1.pem
https://api.facer.io/parse/functions/isAdmin
true
https://api.facer.io/parse/functions/getWatchface
"allowInspection": false,
@radum
radum / README.md
Created March 8, 2019 12:36
Building Robust Layouts With Container Units
@radum
radum / README
Created January 23, 2019 11:21 — forked from joelambert/README
Drop in replacements for setTimeout()/setInterval() that makes use of requestAnimationFrame() where possible for better performance
Drop in replace functions for setTimeout() & setInterval() that
make use of requestAnimationFrame() for performance where available
http://www.joelambert.co.uk
Copyright 2011, Joe Lambert.
Free to use under the MIT license.
http://www.opensource.org/licenses/mit-license.php
@radum
radum / redux-mini.js
Created November 13, 2018 13:40 — forked from jakoblind/redux-mini.js
A mini redux implementation
/*
You need node 6.9 or later.
Run with:
node redux-mini.js --harmony
Want a more in depth explanation of how things works? Read the blog post I have written about it here:
http://blog.jakoblind.no/2017/03/13/learn-redux-by-coding-a-mini-redux/
*/
/*
@radum
radum / getOverlap.js
Created October 18, 2018 19:08 — forked from pankajpatel/getOverlap.js
Function to get the overlap between two elements
/**
* isOverlapping() returns the overlapping status between two elements
* based on the passed in Element objects
*
* @param {Element, Element} Element object of DOM
* @return {Boolean|null} overlap status or null if native objet not received
*/
function isOverlapping(e1, e2){
if( e1.length && e1.length > 1 ){
e1 = e1[0];
@radum
radum / z-index.scss
Created September 27, 2018 14:28
z-index management
// From my boilerplate here: https://github.com/radum/webapp-boilerplate/blob/develop/src/styles/tools/_tools.z-index.scss
/**
* Check if map has nested keys
* @param {string} $map Key to find
* @param {object} $keys... Object of keys to look into
* @return {boolean} Return true or false if map has nested keys
*/
@function map-has-nested-keys($map, $keys...) {
@each $key in $keys {
@radum
radum / localStorage-proxy.js
Created September 24, 2018 14:32
localStorage Proxy
Object.defineProperty(window, 'localStorage', {
configurable: true,
enumerable: true,
value: new Proxy(localStorage, {
set: function (ls, prop, value) {
console.log(`direct assignment: ${prop} = ${value}`);
debugger;
ls[prop] = value;
return true;
},
@radum
radum / http2.js
Created September 22, 2018 14:43 — forked from davidgilbertson/http2.js
HTTP2 server with compression and caching
const http2 = require('http2');
const fs = require('fs');
const path = require('path');
const zlib = require('zlib');
const brotli = require('brotli'); // npm package
const PORT = 3032;
const BROTLI_QUALITY = 11; // slow, but we're caching so who cares
const STATIC_DIRECTORY = path.resolve(__dirname, '../dist/');
const cache = {};
@radum
radum / error.js
Created September 6, 2018 09:41
Creating Custom Error Objects In Node.js With Error.captureStackTrace()
// Require our core node modules.
var util = require( "util" );
// Export the constructor function.
exports.AppError = AppError;
// Export the factory function for the custom error object. The factory function lets
// the calling context create new AppError instances without calling the [new] keyword.
exports.createAppError = createAppError;
@radum
radum / devtools-monitor.js
Created May 11, 2018 08:58
Devtools protocol monitor in JS
const ws = new WebSocket('http://localhost:9222/json');
ws.on('open', () => {
ws.send(JSON.stringify({
id: 1,
method: 'Runtime.evaluate',
params: {
expression: 'document.title'
}
}));