Skip to content

Instantly share code, notes, and snippets.

View lxynox's full-sized avatar
🌴
On vacation

⦇⦀∙ˇ∎ˇ∙⦀⦈ lxynox

🌴
On vacation
View GitHub Profile
@lxynox
lxynox / Hoax.md
Created November 24, 2016 22:56
Annoying 4/6 digits confirm code😡

Micro service sending someone spam messages/emails

  1. Register acct where phone/email confirmation is req.
  2. Loop it N times😈
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.16/vue.js"></script>
<script src="https://fb.me/react-15.1.0.js"></script>
@lxynox
lxynox / lexical-scope-in-js.md
Created March 12, 2017 19:48
test JS lexical scope (`fat arrow` vs `function scope`)

Definition

Lexical Scoping defines how variable names are resolved in nested functions: inner functions contain the scope of parent functions even if the parent function has returned.

test function:

function testScope () {
  'use strict'
  console.log('outer [scope]', this)
  
 return function () {
@lxynox
lxynox / use-system-clipboard-with-caution.md
Last active April 18, 2017 01:42
Caveats about the System Clipboard

System Clipboard

What's System Clipboard? Wiki

The clipboard is a software facility used for short-term data storage and/or data transfer between documents or applications, via copy and paste operations.

It is most commonly a part of a GUI environment and is usually implemented as an anonymous, temporary data buffer, sometimes called the paste buffer, that can be accessed from most or all programs within the environment via defined programming interfaces. A typical application accesses clipboard functionality by mapping user input (keybindings, menu selections, etc.) to these interfaces.

Use Cases & Problems

@lxynox
lxynox / gist:bf934a7234f0a8e9a6fa876977450789
Created April 16, 2018 01:46 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
const COLORS = {
blue: ['#1E88E5', '#90CAF9'],
brown: ['#6D4C41', '#D7CCC8'],
gray: ['#212121', '#BDBDBD'],
green: ['#388E3C', '#A5D6A7'],
red: ['#E53935', '#EF9A9A'],
orange: ['#F4511E', '#FFAB91'],
purple: ['#8E24AA', '#E1BEE7'],
yellow: ['#FFD600', '#FFF59D'],
}
@lxynox
lxynox / lodashify.js
Created August 5, 2018 17:07 — forked from khalilovcmd/lodashify.js
to import lodash into chrome dev tools console
var el = document.createElement('script');
el.src = "https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.10/lodash.core.min.js";
el.type = "text/javascript";
document.head.appendChild(el)
@lxynox
lxynox / log.js
Created November 5, 2018 16:43
life hack: console log function that auto-indents based on the depth of your call stack
//////////// https://twitter.com/sophiebits/status/1058448900460138497
// alternative use `console.group`, `console.groupEnd`, pen: https://codepen.io/zzzzBov/pen/yQLyyG/
function log(format, ...args) {
let indent = ' '.repeat(new Error().stack.match(/\n/g).length - 2);
if (typeof format === 'string') {
console.log(indent + format, ...args);
} else {
console.log(indent, format, ...args);
}
@lxynox
lxynox / Composition.md
Last active June 22, 2019 08:50
React Children, React.cloneElement etc

In fact, React.cloneElement is not strictly associated with this.props.children. It's useful whenever you need to clone react elements(PropTypes.elements) to add/override props(such as attaching event handlers or assigning key/ref attributes) as react elements are immutable.

React.cloneElement( element, [props], [...children] ) is almost equivalent to: <element.type {...element.props} {...props}>{children}</element.type>

However, children prop in react, is specially used for containment(aka composition) of other components, e.g,