Skip to content

Instantly share code, notes, and snippets.

View vemuruadi's full-sized avatar

Adi Vemuru vemuruadi

View GitHub Profile
// create and start containers
docker-compose up
// start services with detached mode
docker-compose -d up
// start specific service
docker-compose up <service-name>
// list images
docker-compose images
// list containers
docker-compose ps
docker container id - 8c37a950839a
# 1. Copy Mongo dump to container folder
(Local System)$ docker cp dump/reaction 8c37a950839a:/var/backups/reaction
# 2. Connect to mongodb docker container
(Local System)$ docker exec -it 8c37a950839a /bin/bash
# 3. Check if backup is copied to docker container
@vemuruadi
vemuruadi / catalogItems.graphql
Created August 8, 2019 06:07
Reaction Commerce Storefront Catalog Query
query catalogItemsQuery($shopId: ID!, $tagIds: [ID], $first: ConnectionLimitInt, $last: ConnectionLimitInt, $before: ConnectionCursor, $after: ConnectionCursor, $sortBy: CatalogItemSortByField, $sortByPriceCurrencyCode: String, $sortOrder: SortOrder) {
catalogItems(shopIds: [$shopId], tagIds: $tagIds, first: $first, last: $last, before: $before, after: $after, sortBy: $sortBy, sortByPriceCurrencyCode: $sortByPriceCurrencyCode, sortOrder: $sortOrder) {
totalCount
pageInfo {
endCursor
startCursor
hasNextPage
hasPreviousPage
__typename
}
@vemuruadi
vemuruadi / curl.sh
Last active July 2, 2019 06:16
Command Line #Curl #Basics
curl is an easy to use command line tool to send & receive files, it supports almost most major protocols like FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, SMTP, TELNET in popular use.
Note: curl is actually 'see URL'
# Authentication
$ curl -u username:password http://example.com
# POST
$ curl --data "year=1979&month=march" http://example.com/wish
FROM — specifies the base (parent) image.
LABEL —provides metadata. Good place to include maintainer info.
ENV — sets a persistent environment variable.
RUN —runs a command and creates an image layer. Used to install packages into containers.
## Build image ##
docker build -t image_name .
### Build image with version tag ###
docker build -t image_name:version_tag . (To build particular version)
### Run image ###
docker run image_name -it bash
### Pull image from repository ###
@vemuruadi
vemuruadi / datetime-formatting-moment.js
Last active August 10, 2016 13:13
Handling datetime formatting with moment.js
var moment = require('moment')
/***********************************************************************************************
Code snippet to for new date time by merging date from one datetime, time from another datetime.
***********************************************************************************************/
var date = moment.utc('2016-08-10T11:15:01+00:00')
var time = moment.utc('2016-09-12T12:00:01+00:00')
//format for date only
@vemuruadi
vemuruadi / webhooks-with-hapi.js
Created July 26, 2016 11:51
Webhook receiver with hapi.js
/*
Webhook receivers should accept a request and immediately respond with HTTP 204 No Content before processing the request. Here's how to do this with hapi.js.
Start this server:
`node webhooks-with-hapi.js`
Then make a request:
`curl http://localhost:8000/webhook-receiver -v`
Note the correct behavior: HTTP response will be sent and connection closed before the webhook processing starts.
@vemuruadi
vemuruadi / 0_reuse_code.js
Created February 3, 2014 13:55
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Testing Pie Chart</title>
<!--<script type="text/javascript" src="d3/d3.v2.js"></script>-->
<script src="http://d3js.org/d3.v2.js"></script>
<!-- Note: I made good use of the sample code provided by the D3JS community and extended it to fit my needs to create this simple dashboard -->
<style type="text/css">