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
$(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 |
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
Show hidden characters
{ | |
"presets": ["es2015"], | |
"plugins": [ | |
"add-module-exports" | |
] | |
} |
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://github.com/gigobyte/react-document-title-decorator/blob/master/example/setTitle.jsx | |
import React from 'react' | |
const setTitle = (getTitle) => (WrappedComponent) => { | |
return class extends React.Component { | |
updateTitle = (props) => { | |
const title = getTitle(props) | |
if(title) { | |
document.title = title | |
} |