Skip to content

Instantly share code, notes, and snippets.

View sohelamin's full-sized avatar
🎯
Focusing

Sohel Amin sohelamin

🎯
Focusing
View GitHub Profile
@sohelamin
sohelamin / cloudformation-ec2.yml
Created June 24, 2020 15:26
AWS CloudFormation EC2
Resources:
MyEC2Instance:
Type: AWS::EC2::Instance
Properties:
AvailabilityZone: us-east-1a
ImageId: ami-068663a3c619dd892 # Ubuntu Server 20.04 LTS
InstanceType: t2.micro
KeyName: my-test-key # Existing key pair
SecurityGroups:
- !Ref MyEC2SecurityGroup
@sohelamin
sohelamin / functions.php
Created April 3, 2019 19:47
WordPress custom post type taxonomy (book/taxonomy-name/page/2)
<?php
add_action( 'init', 'codex_book_init' );
function codex_book_init() {
$labels = array(
'name' => _x( 'Books', 'post type general name', 'your-plugin-textdomain' ),
'singular_name' => _x( 'Book', 'post type singular name', 'your-plugin-textdomain' ),
'menu_name' => _x( 'Books', 'admin menu', 'your-plugin-textdomain' ),
'name_admin_bar' => _x( 'Book', 'add new on admin bar', 'your-plugin-textdomain' ),
@sohelamin
sohelamin / structure.md
Created December 22, 2017 10:17
Node.js Application Structure
.
├── bin
│   ├── www
│   └── deploy.sh
├── config
│   ├── env
│   ├── index.js
│   └── passport.js
├── controllers
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDbHyitKvdYvS+sSKrprTbjasadLMPRfgsdibJBV1/fhXXx78b15eK/8MJY+PnjzwcFNRJ6lacCERPun1o7RqzSEbi+YVTs5tn0GnhsKETKq0UqJYEHawNX3jhx+FZXEn1/CdK7U4okPCFI4JthvUIyuu4PyJZ/rSfrUVz8X1gVY05SMgRM8Gfznjt6ntXEESxNp7GZ5OCP+YN/0cbZE6lQoOb1LskLXfxWAVFL6OdICSMK2IsqZYR8T5CShK7pLs0JkqQitSO4IS7Zjh/PnioD2z9ntjD/m1GSW6/9M0P6QoHy+nJnMNDv/xE3Eh+mWpNnkjZY4a//8RKzvxyI8xO5 sohelamin@Sohels-MacBook-Pro.local
@sohelamin
sohelamin / php-cli.md
Created May 8, 2017 08:22
PHP CLI version change
sudo rm /usr/bin/php

sudo ln -s /usr/bin/php5.6 /usr/bin/php
@sohelamin
sohelamin / socket.io-cheatsheet.md
Last active July 4, 2023 21:22
Socket.io Cheatsheet

sending to sender-client only

socket.emit('message', "this is a test");

sending to all clients, include sender

io.emit('message', "this is a test");
@sohelamin
sohelamin / socket.io.js
Created April 22, 2017 18:00
Socket.io
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
var port = process.env.PORT || 3000;
app.get('/', function(req, res){
res.sendFile(__dirname + '/index.html');
});
app.get('/chat', function(req, res){
@sohelamin
sohelamin / Crudify.vue
Last active December 31, 2016 07:01
Vue Crudify Component
<script>
export default {
props: ['label', 'url', 'fields', 'columns'],
data() {
return {
defaultForm: {},
form: {
editMode: false
},
errors: [],
@sohelamin
sohelamin / LoginController.php
Created November 1, 2016 16:52
Laravel Custom Authentication
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class LoginController extends Controller
@sohelamin
sohelamin / velement.html
Created October 16, 2016 14:47
Dynamically generate html element by Vue.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Vue.js Simple Example</title>
</head>
<style>
body {
font : 100% Helvetica, sans-serif;
color: #ecf0f1;