Skip to content

Instantly share code, notes, and snippets.

View AshikNesin's full-sized avatar

Ashik Nesin AshikNesin

View GitHub Profile
@AshikNesin
AshikNesin / model-stop-video.js
Created June 16, 2017 06:50
Stop video if the model is closed
$(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);
});
@AshikNesin
AshikNesin / esnextbin.md
Created June 15, 2017 07:06
esnextbin sketch
@AshikNesin
AshikNesin / validateEmail.js
Created May 27, 2017 06:38 — forked from oscarmorrison/validateEmail.js
ES6 email validation
// 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;
@AshikNesin
AshikNesin / async-await-playground.js
Created May 4, 2017 13:00
[Playground] Asynchronous JavaScript with async/await course
// 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)
@AshikNesin
AshikNesin / esnextbin.md
Created April 19, 2017 10:35
esnextbin sketch

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

<VirtualHost *:80>
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [NC,R=308,L]
</VirtualHost>
git push origin --delete
@AshikNesin
AshikNesin / .babelrc
Last active March 5, 2017 08:28
Kickstart a Node Project (with ES6 Import)
{
"presets": ["es2015"],
"plugins": [
"add-module-exports"
]
}
@AshikNesin
AshikNesin / setTitle.js
Created March 5, 2017 06:00
React Components
// 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
}