Skip to content

Instantly share code, notes, and snippets.

View amitkhare's full-sized avatar
🤔
Brainstorming

Amit Kumar Khare amitkhare

🤔
Brainstorming
View GitHub Profile
// ##################################################
// Tutorial available at https://youtu.be/jzYvZkP_vUs
// ##################################################
// clock start time HH:MM:SS
var clockStartAt = "06:00:10";
//Count Up/ Down rate
var rate = -1;
#!/bin/sh
dirbase="/var/www/"
# cd $dirbase
read -p "Current Directory as base? (y/N) " isCurrDir
if [ "$isCurrDir" = "Y" ] || [ "$isCurrDir" = "y" ]; then
dirpath=$(pwd)
'use strict'
// Template version: 1.2.5
// see http://vuejs-templates.github.io/webpack for documentation.
const path = require('path')
module.exports = {
dev: {
// Paths
@amitkhare
amitkhare / Cloud9 Dark ace theme - Monokai Improved
Last active December 6, 2017 12:36
Cloud9 > Your Style sheet
.ace_gutter {
}
.ace_print-margin {
}
.ace_support{
@amitkhare
amitkhare / Apache server site configuration with SSL
Created December 9, 2017 16:46
$ /etc/apache2/sites-available/site.tld.conf
#### http://www.site.tld
<VirtualHost *:80>
ServerName site.tld
ServerAlias www.site.tld
DocumentRoot /var/www/site.tld/public
<Directory /var/www/site.tld>
Options Indexes FollowSymLinks MultiViews
<?php
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Credentials: true");
header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');
header('Access-Control-Max-Age: 1000');
header('Access-Control-Allow-Headers: Origin, Content-Type, X-Auth-Token , Authorization');
RewriteEngine On
# Some hosts may require you to use the `RewriteBase` directive.
# If you need to use the `RewriteBase` directive, it should be the
# absolute physical path to the directory that contains this htaccess file.
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Headers "Content-Type"
Header set Access-Control-Allow-Methods "GET"
</IfModule>
<?php
// Application middleware
// e.g: $app->add(new \Slim\Csrf\Guard);
// A middleware for enabling CORS
$app->add(function ($req, $res, $next) {
$response = $next($req, $res);
return $response
// CORS middleware
app.use((req, res, next)=>{
res.header('Access-Control-Allow-Origin','*')
res.header('Access-Control-Allow-Credentials','true')
res.header('Access-Control-Allow-Headers','X-Requested-With, Origin, Content-Type, X-Auth-Token , Authorization')
if(req.method === "OPTIONS"){
res.header('Access-Control-Allow-Methods','GET, PUT, POST, PATCH, DELETE, OPTIONS')
return res.status(200).json({});