Skip to content

Instantly share code, notes, and snippets.

View avtaniket's full-sized avatar

aniket takarkhede avtaniket

  • India
View GitHub Profile
@avtaniket
avtaniket / localhost to custom domain in ubuntu.txt
Created August 29, 2016 13:30
localhost to custom domain in ubuntu
Step 1: Add domain entry in hosts file (vim /etc/hosts)
127.0.0.1 dev.mywebsite.com
Step 2: Add redirection policy in IP-Tables
sudo iptables -t nat -A OUTPUT -o lo -p tcp --dport 80 -j REDIRECT --to-port 8888
@avtaniket
avtaniket / nodemailer_gmail.js
Created August 27, 2016 05:45
Send mail using Nodemailer Gmail SMTP
const gmailSMTP = {
"service": "Gmail",
"username": "usersdn@gmail.com",
"password": "22342@test",
"emailTo": "test.sdn@gmail.com"
};
var nodemailer = require('nodemailer');
var transporter = nodemailer.createTransport({
service: gmailSMTP.service,
@avtaniket
avtaniket / Swagger - URL & path parameters integration with AWS gateway.txt
Last active May 11, 2016 12:29
Swagger - URL & path parameters integration with AWS gateway
Swagger file need to update for URL & path parameters integration
Here
httpMethod - GET/POST/PUT/DELETE
uri - SWAGGER url
requestParameters - is optional if url contains param like {user_id}
x-amazon-apigateway-integration:
httpMethod: "POST"
uri: "http://54.193.106.251:10010/count/{user_id}"
type: "http"
responses:
@avtaniket
avtaniket / AWS Swagger importer.txt
Last active May 11, 2016 12:57
AWS Swagger importer
$ git clone https://github.com/awslabs/aws-apigateway-swagger-importer.git
$ cd aws-apigateway-swagger-importer
$ mvn assembly:assembly
Create
$ ./aws-api-import.sh -c <path-to-local-swagger-json>
Update
$ ./aws-api-import.sh -u ze3xxxx9 /myappservices/api/swagger/swagger.yaml
@avtaniket
avtaniket / Installing Apache Maven.txt
Created May 10, 2016 05:53
Installing Apache Maven
Download bin, extract archive and add bin folder to the PATH
$ wget http://mirror.fibergrid.in/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.zip
$ unzip apache-maven-3.3.9-bin.zip
$ export PATH=$PATH:/opt/apache-maven-3.3.9/bin
$ mvn -v
For more info, visit http://maven.apache.org/install.html
@avtaniket
avtaniket / cors.php
Last active August 1, 2025 06:32
Handle CORS in PHP
<?php
/* Handle CORS */
// Specify domains from which requests are allowed
header('Access-Control-Allow-Origin: *');
// Specify which request methods are allowed
header('Access-Control-Allow-Methods: PUT, GET, POST, DELETE, OPTIONS');
@avtaniket
avtaniket / app.js
Created September 2, 2015 06:39
JQuery datepicker on dynamic elements
$(function() {
//input calender
$(".app_datepicker").on('focus', function(){
var $this = $(this);
if(!$this.data('datepicker')) {
$this.removeClass("hasDatepicker");
$this.datepicker();
$this.datepicker("show");
}
});
@avtaniket
avtaniket / checkbox-checked-all-none-toggle.html
Last active August 29, 2015 14:25
Checkbox Checked-all-none-toggle
<form action="" method="POST" name="tenants">
<table class="list">
<caption>Users</caption>
<thead>
<tr>
<th>&nbsp;</th>
<th>Name</th>
</tr>
</thead>
<tbody>
@avtaniket
avtaniket / OSTicketsForAccountsLink.php
Created July 6, 2015 08:09
Sugar 7 : Modify the Relationship Behavior
@avtaniket
avtaniket / accounts_ost__tickets_1_Accounts.php
Created July 6, 2015 08:02
Sugar 7 : Customize the Relationship’s Behavior
<?php
$dictionary["Account"]["fields"]["accounts_ost__tickets_1"] = array (
'name' => 'accounts_ost__tickets_1',
'type' => 'link',
// 'relationship' => 'accounts_ost__tickets_1',
'source' => 'non-db',
'module' => 'OST__Tickets',
'bean_name' => 'OST__Tickets',
'vname' => 'LBL_ACCOUNTS_OST__TICKETS_1_FROM_OST__TICKETS_TITLE',