Skip to content

Instantly share code, notes, and snippets.

View unel's full-sized avatar
🦄
Write the code as if it would be watched by a little girl

Peter Jah unel

🦄
Write the code as if it would be watched by a little girl
  • 02:47 (UTC +03:00)
View GitHub Profile
@unel
unel / contains.js
Created April 20, 2023 07:28
contains.js
const contains = (s1, s2) => (
((letn) => (
letn(
[
[...s1],
[...s2],
],
(a1, a2) => Boolean(
a1.reduce((a, c, i) => (
(a)
function cleanup(node) {
const removeMe =
node instanceof Image
|| node instanceof Text
|| node instanceof Comment
|| node.tagName === 'svg'
|| node.tagName === 'iframe';
const ignoreChilds =
node.tagName === 'svg'
@unel
unel / App.tsx
Created November 28, 2018 20:51
portals
import * as React from 'react';
class App extends React.Component{
portals = createPortals();
render() {
const {PortalIn, PortalOut} = this.portals;
return (
export default function asyncReducer(state = isLoading, { type, payload }) {
switch (type) {
case AJAX_CALL_BEGIN:
return { ...state, [payload]: 1};
case AJAX_CALL_SUCCESS:
return { ...state, [payload]: 0};
case AJAX_CALL_ERROR:
return { ...state, [payload.target]: 0, error: payload.error };
export default function asyncReducer(state = isLoading, { type, payload }) {
switch (type) {
case AJAX_CALL_BEGIN:
if (payload === 'comments') {
return { ...state, comments: 1 };
}
return { ...state, product: 1 };
case AJAX_CALL_SUCCESS:
if (payload === 'comments') {
@unel
unel / ok.py
Created September 26, 2017 14:54
// this:
if (access_granted):
send_declaration_of_war()
launch_nuclear_missiles()
// or this:
if (access_granted):
send_declaration_of_war()
launch_nuclear_missiles()
if (access_granted)
send_declaration_of_war()
launch_nuclear_missiles()