Skip to content

Instantly share code, notes, and snippets.

View shams-ali's full-sized avatar

Shams Ali shams-ali

  • San Francisco, CA
View GitHub Profile
@shams-ali
shams-ali / package.json
Created June 25, 2016 04:24
package.json react-redux es6
{
"name": "react-redux",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "webpack",
"start": "nodemon server.js",
"test": "echo \"Error: no test specified\" && exit 1",
"watch": "webpack --watch"
@shams-ali
shams-ali / webpack.config.js
Created June 25, 2016 04:23
webpack config es6
odule.exports = {
entry: './client.js',
output: {
filename: 'bundle.js'
},
devtool: 'source-map',
module: {
loaders: [
{
test: /.jsx?$/,
@shams-ali
shams-ali / expressProxy.js
Created June 25, 2016 04:21
Express Proxy Server
var app = require('express')();
var requestProxy = require('express-request-proxy');
app.get('/', function(req, res) {
res.sendFile(__dirname + '/index.html');
});
app.post('/api/webhooks/:channel', requestProxy({
url: 'http://google.mvargeson.ultrahook.com/api/webhooks/:channel'
}));
@shams-ali
shams-ali / sqsSendToQueue.js
Created June 25, 2016 04:20
sqs send to queue
sqs.createQueue({QueueName: 'gmail-channel-webhooks'}, function (err, data) {
if (err) return console.log(err);
var url = data.QueueUrl; // use this queue URL to operate on the queue
// Sending a message
// The following example sends a message to the queue created in the previous example.
var queue = new AWS.SQS({params: {QueueUrl: url}});
var body = JSON.stringify({ email: '[email protected]', 'historyId': '127f90a30t' });
queue.sendMessage({ MessageBody: body }, function (err, data) {
@shams-ali
shams-ali / docker-compose-wait-for-db.sh
Last active November 1, 2022 19:03 — forked from mvargeson/docker-compose-wait-for-db.sh
wait for db container to be available before starting server
#!/bin/bash THIS WORKED
bash -c 'while ! </dev/tcp/db/5432; do sleep 1; done; nodal db:bootstrap && nodal s;'
#THIS WORKS ONLY IF NETSTST INSTALLED
while ! nc -w 1 -z db 5432; do sleep 0.1; done
#ANOTHER WAY
until nc -z postgres 5432; do
echo "$(date) - waiting for postgres..."
@shams-ali
shams-ali / initialize-postgress.sh
Created June 25, 2016 04:16
initialize postgres db
postgres -D /usr/local/var/postgres