Skip to content

Instantly share code, notes, and snippets.

⚛️
design + code

Mike Skowronek coderitual

⚛️
design + code
Block or report user

Report or block coderitual

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View auth-with-reach-router.jsx
let UserContext = React.createContext();
class App extends React.Component {
state = {
user: null,
setUser: user => {
this.setState({ user });
}
};
View deepin.md

check distro version

cat /etc/issue

check debian version

cat /etc/deb

View react-redirect
// redirect to path if predicate returns true
export default function redirect (path, predicate) {
return Component =>
class Composed extends React.Component {
componentWillMount () {
if (predicate(props))
redirectTo(path)
}
@coderitual
coderitual / app.js
Created Nov 1, 2017 — forked from joshuataylor/app.js
Preact component to notify user when a change has been made, and on route change reload the page.
View app.js
import { h, Component } from 'preact';
import { Router } from 'preact-router';
import Header from './header';
import Home from '../routes/home';
import Profile from '../routes/profile';
import NotifyChange from "./NotifyChange/index";
// import Home from 'async!../routes/home';
// import Profile from 'async!../routes/profile';
@coderitual
coderitual / extension.js
Created Sep 21, 2017 — forked from kdzwinel/extension.js
Quick and dirty implementation of runtime type profiling in Visual Studio Code
View extension.js
const vscode = require('vscode');
const path = require('path');
// puppeteer is great because it's easy to use, but it comes with 30MB headless Chrome that
// we can't use as it doesn't have `Profiler.startTypeProfile` yet. We have to point to a
// locally installed Chrome Canary instead. It's fine for a POC, but puppeteer isn't probably
// a good fit in a long run.
const puppeteer = require('puppeteer');
const PATH_TO_CANARY = '/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary';
View serialize.js
const serialize = uri => decodeURIComponent(uri).split('&').map(uri => ({ [uri.split('=')[0]]: uri.split('=')[1] })).reduce((a,b) => Object.assign(a,b))
console.log(serialize("_id%3D58c43d995cb9191a2f676b25%26index%3D0%26guid%3D798ebd68-22d5-4465-9d34-d4717891901d%26isActive%3Dfalse%26balance%3D%242%2C569.51%26picture%3Dhttp%3A%2F%2Fplacehold.it%2F32x32%26age%3D33%26eyeColor%3Dgreen%26name%3DDesiree%20Cervantes%26gender%3Dfemale%26company%3DSYNKGEN%26email%3Ddesireecervantes%40synkgen.com%26phone%3D%2B1%20(975)%20536-2019%26address%3D855%20Hendrickson%20Street%2C%20Libertytown%2C%20Marshall%20Islands%2C%205292%26about%3DElit%20anim%20occaecat%20proident%20consectetur%20veniam%20et%20deserunt%20irure.%20Sint%20aliquip%20fugiat%20aute%20tempor%20veniam%20eu%20duis%20mollit%20eiusmod%20aliquip%20ipsum%20enim%20do%20in.%20Pariatur%20nisi%20proident%20commodo%20duis%20nisi%20id%20ut%20commodo%20aute%20irure.%20Minim%20ut%20tempor%20in%20tempor%20dolor%20ex%20veniam%20fugiat.%20Sint%20cillum%20non%20qui%20elit%20a
View curry.js
// Tiny, recursive autocurry
const curry = (
f, arr = []
) => (...args) => (
a => a.length === f.length ?
f(...a) :
curry(f, a)
)([...arr, ...args]);
View es6-feature-detection.js
var str = 'class ಠ_ಠ extends Array {constructor(j = "a", ...c) {const q = (({u: e}) => {return { [`s${c}`]: Symbol(j) };})({});super(j, q, ...c);}}' +
'new Promise((f) => {const a = function* (){return "\u{20BB7}".match(/./u)[0].length === 2 || true;};for (let vre of a()) {' +
'const [uw, as, he, re] = [new Set(), new WeakSet(), new Map(), new WeakMap()];break;}f(new Proxy({}, {get: (han, h) => h in han ? han[h] ' +
': "42".repeat(0o10)}));}).then(bi => new ಠ_ಠ(bi.rd));';
try {
eval(str);
} catch(e) {
alert('Your browser does not support ES6!')
}
View style.css
.button {
-webkit-touch-callout:none; /* prevent callout to copy image, etc when tap to hold */
-webkit-text-size-adjust:none; /* prevent webkit from resizing text to fit */
-webkit-tap-highlight-color:rgba(0,0,0,0); /* prevent tap highlight color / shadow */
-webkit-user-select:none; /* prevent copy paste, to allow, change 'none' to 'text' */
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none
}
View Saga event source (channel)
function createSource(url) {
const source = fakeSource(url)
let deferred
source.onmessage = event => {
if(deferred) {
deferred.resolve(JSON.parse(event.data))
deferred = null
}
You can’t perform that action at this time.