Skip to content

Instantly share code, notes, and snippets.

View AshikNesin's full-sized avatar

Ashik Nesin AshikNesin

View GitHub Profile
@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
}
@AshikNesin
AshikNesin / jquery-form-submit.js
Last active February 22, 2017 07:14
[jQuery] Ajax form Submit
$(document).ready(function() {
$.validate();
// Object as Array
$.fn.serializeObject = function() {
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
@AshikNesin
AshikNesin / node-ubuntu.sh
Created February 8, 2017 14:20
Node Ubuntu
wget -qO- https://deb.nodesource.com/setup_7.x | sudo bash -
sudo apt-get install -y nodejs
a2enmod rewrite
@AshikNesin
AshikNesin / auto-depoy.sh
Created February 7, 2017 01:29
Auto Deployment using BitBucket Pipelines
# Test it in docker
docker run -it --volume=/Users/AshikNesin/Code/sandbox/auto-deploy-pipelines:/auto-deploy-pipelines --workdir="/auto-deploy-pipelines" --memory=4g --entrypoint=/bin/bash node:7.0.0