Skip to content

Instantly share code, notes, and snippets.

View r17x's full-sized avatar
🤘
REconciling...

RiN r17x

🤘
REconciling...
View GitHub Profile
@r17x
r17x / buildLogo.js
Created March 24, 2019 15:25
Snippet for generate image size using sharp
#!/usr/bin/env node
const sharp = require('sharp')
const listSize = [500, 192, 150, 64]
const original = sharp('./public/logo.png')
listSize.forEach(imgSize => {
original
.resize(imgSize, imgSize)
.toFile(`./public/logo${imgSize}.png`)
.then(res => {
@r17x
r17x / Injector.js
Created March 14, 2019 13:36
Dependency Injection Javascript
/**
* @link {https://stackoverflow.com/questions/20058391/javascript-dependency-injection}
*/
var Injector = {
dependencies: {},
add : function(qualifier, obj){
this.dependencies[qualifier] = obj;
},
get : function(func){
var obj = new func;
@r17x
r17x / ic_logo.xml
Created March 14, 2019 10:14 — forked from Buom01/ic_logo.xml
TWA splashscreen
<!-- import here your svg logo (in drawables)
See https://stackoverflow.com/questions/30923205/easiest-way-to-use-svg-in-android/39266840#39266840
-->
@r17x
r17x / ComponentFlyHigh.js
Last active December 2, 2022 22:13
HOF (High order fly => Function) x HOC (High Order Component)
import YourComponent from 'your/path/Component'
/**
* @name ComponentFly
* @param {ReactElement} Component
* @param {function} reduceParam
* @return {ReactElement}
* @example
* const ComponentFlying = ComponentFly(YourComponent)(reduceParam)
* Array.map(ComponentFlying)
*/
@r17x
r17x / JavaScriptObject.js
Last active March 14, 2019 00:42
Learning How Object is Work for your Own State Management
/**
* @description Learning How Object is Work for your Own State Management
* @author ri7nz <[email protected]>
* @link {github.com/ri7nz}
* Just For Fun In Javascript 🤟
*/
class CreateYourOwnState {
#state
#stateNameInWindow
constructor() {
/*
 * @description Fly High With Image Handle
 * @ri7nz - Hello :D
 
 */

const FileOrBlob = new File([
  ArrayBuffer 
 || ArrayBufferView

4 March 2019

Github Connect by Default use port 22;

// Checking

$ ssh -vT [email protected]

// output
// debug1: Reading configuration data /etc/ssh/ssh_config
// shim layer for requestAnimationFrame with setTimeout fallback
// from http://paulirish.com/2011/requestanimationframe-for-smart-animating/
var requestAnimFrame = (function(){
  return window.requestAnimationFrame       || 
         window.webkitRequestAnimationFrame || 
         window.mozRequestAnimationFrame    || 
         window.oRequestAnimationFrame      || 
         window.msRequestAnimationFrame     || 
 function( callback ){
/**
* @description
* this script for replace environment variable from public directory
* of Create-React-App.
*
* Problem
* create-react-app can't work with ENV_VAR for all javascript files
* in public directory
* on running build script.
*

How to check service worker has installed in your browser

const z = await navigator.serviceWorker.getRegistrations() // return array Of [ServiceWorkerRegistration]
/***
[{
active: ServiceWorker {scriptURL: "http://localhost:5000/service-worker.js", state: "activated", onerror: null, onstatechange: ƒ}
installing: null
navigationPreload: NavigationPreloadManager {}
onupdatefound: ƒ ()
paymentManager: PaymentManager {instruments: PaymentInstruments, userHint: ""}