Skip to content

Instantly share code, notes, and snippets.

View pveyes's full-sized avatar
:electron:

Fatih Kalifa pveyes

:electron:
View GitHub Profile
type AppendArgument<Fn, A> = Fn extends (...args: infer Args) => infer R
? (...args: [...Args, A]) => R
: never
@pveyes
pveyes / index.tsx
Last active May 30, 2020 04:19
dark mode for github gist
import React from 'react';
import useDarkMode from './useDarkMode';
const GitHubGist = props => {
const [theme] = useDarkMode();
const darkStyle = theme === 'dark'
? { filter: 'inverse(100%) hue-rotate(180deg)' }
: {}
return <iframe {...props} css={darkStyle} />
@pveyes
pveyes / fake.png
Last active April 11, 2019 15:55
raw.macro
fake.png

Keybase proof

I hereby claim:

  • I am pveyes on github.
  • I am pveyes (https://keybase.io/pveyes) on keybase.
  • I have a public key ASAbOXMD5wF9bbTt74kbWNtIH8Azp9SnZUbaW5t40lfkjQo

To claim this, I am signing this object:

@pveyes
pveyes / eventHandler.js
Last active August 23, 2017 15:33
htmr simple yet powerful custom mapping
import convert from 'htmr';
class Link extends React.Component {
handleClick = e => {
e.preventDefault();
// do something here
alert('It works!');
}
render() {
@pveyes
pveyes / error-handling.js
Created February 23, 2017 17:54
try catch async await
const rejectedPromise = () => new Promise((resolve, reject) => {
setTimeout(() => reject(new Error('cuy')), 1000)
})
const bw = async function () {
try {
await rejectedPromise();
} catch (err) {
console.log('handle', err);
}
document.querySelectorAll('iframe').forEach(ifr => {
// use onload property because we need to get the height
// after all content is fully loaded
ifr.onload = function () {
ifr.style.height = ifr.contentWindow.document.body.scrollHeight + 'px';
};
});
document.write('<link rel="stylesheet" href="https://assets-cdn.github.com/assets/gist-embed-9ec60d02ee0eb30530c9c2d12055b82db581fbb13b64b807fd63df9cd276d21b.css">')
document.write('<div id=\"gist8380521\" class=\"gist\">\n <div class=\"gist-file\">\n <div class=\"gist-data\">\n <div class=\"js-gist-file-update-container js-task-list-container file-box\">\n <div id=\"file-fb-arithmetic-c\" class=\"file\">\n \n\n <div itemprop=\"text\" class=\"blob-wrapper data type-c\">\n <table class=\"highlight tab-size js-file-line-container\" data-tab-size=\"8\">\n <tr>\n <td id=\"file-fb-arithmetic-c-L1\" class=\"blob-num js-line-number\" data-line-number=\"1\"><\/td>\n <td id=\"file-fb-arithmetic-c-LC1\" class=\"blob-code blob-code-inner js-file-line\">#<span class=\"pl-k\">include<\/span> <span class=\"pl-s\"><span class=\"pl-pds\">&lt;<\/span>stdio.h<span class=\"pl-pds\">&gt;<\/span><\/span><\/td>\n <\/tr>\n <tr>\n <td id=\"file-fb-arithmetic-c-L2\" class=\
module.exports = {
parser: 'babel-eslint',
plugins: ['babel', 'react'],
envs: {
es6: true,
node: true
},
ecmaFeatures: {
jsx: true
},
@pveyes
pveyes / remove-quora-modal
Last active August 29, 2015 14:01
Remove Quora Annoying Modal
- Open console (Chrome: Ctrl+Shift+J)
- Type this: document.querySelector('[id*="modal_signup_wrapper"]').remove()
- Press ENTER
- PROFIT