Skip to content

Instantly share code, notes, and snippets.

View AshikNesin's full-sized avatar

Ashik Nesin AshikNesin

View GitHub Profile
@AshikNesin
AshikNesin / react-file-upload.js
Created February 2, 2017 06:46
Simple React File Upload
import React from 'react'
import axios, { post } from 'axios';
class SimpleReactFileUpload extends React.Component {
constructor(props) {
super(props);
this.state ={
file:null
}
@AshikNesin
AshikNesin / array-filter-map.js
Created February 1, 2017 07:03
Insert/Update Items - Filter & Map Array
let jobs = [{id:44,selected:false},{id:12,selected:true}]
const handleChange = (item) =>{
let existItemIndex;
jobs.map((job,index)=>{
(job.id === item.id) && (existItemIndex = index)
})
if(!existItemIndex){
jobs = jobs.concat(item)
}

Direct Messaging

Hello there, good folks! Today I created direct messaging screen with bubbles, nice smooth animation, and some cool dynamics, with pure css3 and html5 with almost no jQuery. How do you like it? :)

A Pen by Momcilo Popov on CodePen.

License.

@AshikNesin
AshikNesin / airtable-proxy.js
Created December 25, 2016 11:45 — forked from benoror/airtable-proxy.js
Node.js Airtable API Proxy
var express = require('express');
var proxy = require('http-proxy-middleware');
var options = {
logLevel: 'debug',
target: 'https://api.airtable.com/v0/' + process.env.APP_ID,
changeOrigin: true,
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer ' + process.env.API_KEY
},
@AshikNesin
AshikNesin / setup-lamp-ubuntu.sh
Last active April 2, 2019 03:01
Setup LAMP Stack Ubuntu 16
# Install Apache
sudo apt-get update
sudo apt-get install apache2 -y
# Install PHP7
sudo apt-get -y install php7.0 libapache2-mod-php7.0
sudo apt-get install php7.0-cli php7.0-common libapache2-mod-php7.0 php7.0 php7.0-mysql php7.0-fpm -y
# Other packages which might be useful
@AshikNesin
AshikNesin / statuses.md
Created December 4, 2016 11:26 — forked from vkostyukov/statuses.md
HTTP status codes used by world-famous APIs
API Status Codes
[Twitter][tw] 200, 304, 400, 401, 403, 404, 406, 410, 420, 422, 429, 500, 502, 503, 504
[Stripe][stripe] 200, 400, 401, 402, 404, 429, 500, 502, 503, 504
[Github][gh] 200, 400, 422, 301, 302, 304, 307, 401, 403
[Pagerduty][pd] 200, 201, 204, 400, 401, 403, 404, 408, 500
[NewRelic Plugins][nr] 200, 400, 403, 404, 405, 413, 500, 502, 503, 503
[Etsy][etsy] 200, 201, 400, 403, 404, 500, 503
[Dropbox][db] 200, 400, 401, 403, 404, 405, 429, 503, 507
@AshikNesin
AshikNesin / simple-counter.js
Last active November 13, 2016 07:40
Very simple counter using React + Redux
const counter = (state=0,action) => {
switch(action.type){
case 'INCREMENT':
return state+1;
case 'DECREMENT':
return state -1;
default:
return state;
}
}
@AshikNesin
AshikNesin / serializeObject.js
Created November 8, 2016 07:52
Serialize Object using jQuery
$.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]];
}
o[this.name].push(this.value || '');
} else {
@AshikNesin
AshikNesin / unhandled-exceptions.js
Created November 6, 2016 18:59 — forked from ericelliott/unhandled-exceptions.js
Capturing Unhandled Exceptions
window.onerror = function(message, file, line, column, error) {
error = error || {};
$.ajax({
method: 'POST',
url: 'https://yourapp.com/path/to/error/log',
data: JSON.stringify({
message: message,
file: file,
line: line,
column: column,
@AshikNesin
AshikNesin / default-ssl.conf
Last active October 27, 2016 13:11
Apache SSL Config
<VirtualHost *:443>
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/__optacredit_com.crt
SSLCertificateKeyFile /etc/apache2/ssl/optacredit.com.key
SSLCACertificateFile /etc/apache2/ssl/__optacredit_com.ca-bundle
ServerAdmin admin@yourdomain.com
ServerName optacredit.com
DocumentRoot /var/www/html/
#ErrorLog /var/www/yourdomain.com/logs/error.log
#CustomLog /var/www/yourdomain.com/logs/access.log combined