made with esnextbin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const base64 = 'data:image/png;base64,....' // Place your base64 url here. | |
| fetch(base64) | |
| .then(res => res.blob()) | |
| .then(blob => { | |
| const fd = new FormData(); | |
| const file = new File([blob], "filename.jpeg"); | |
| fd.append('image', file) | |
| // Let's upload the file | |
| // Don't set contentType manually → https://github.com/github/fetch/issues/505#issuecomment-293064470 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| chrome.tabs.query({ active: true, currentWindow: true }, tabs => { | |
| chrome.tabs.remove(tabs[0].id); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(document).ready(function(){ | |
| $('.modal').each(function(){ | |
| var src = $(this).find('iframe').attr('src'); | |
| $(this).on('click', function(){ | |
| $(this).find('iframe').attr('src', ''); | |
| $(this).find('iframe').attr('src', src); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // regex from http://stackoverflow.com/questions/46155/validate-email-address-in-javascript | |
| const EMAIL_REGEX = /^[-!#$%&'*+\/0-9=?A-Z^_a-z{|}~](\.?[-!#$%&'*+\/0-9=?A-Z^_a-z`{|}~])*@[a-zA-Z0-9](-?\.?[a-zA-Z0-9])*\.[a-zA-Z](-?[a-zA-Z0-9])+$/; | |
| const validateEmail = email => { | |
| return email | |
| && email.length < 255 | |
| && EMAIL_REGEX.test(email); | |
| }; | |
| export default validateEmail; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://egghead.io/courses/asynchronous-javascript-with-async-await | |
| const fetch = require('node-fetch') | |
| const fetchGitHubUser = async (handle) => { | |
| const url = `https://api.github.com/users/${handle}` | |
| const response = await fetch(url) | |
| const body = await response.json() | |
| if (response.status !== 200){ | |
| throw Error(body.message) |
made with esnextbin
As configured in my dotfiles.
start new:
tmux
start new with session name:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <VirtualHost *:80> | |
| RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [NC,R=308,L] | |
| </VirtualHost> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git push origin --delete |