Skip to content

Instantly share code, notes, and snippets.

@dejanvasic85
dejanvasic85 / deploy.sh
Created April 1, 2018 02:41
Deploy shell script
#!/usr/bin/env bash
set -ex
BUILD_NUMBER=${TRAVIS_BUILD_NUMBER:-45}
DEPLOY_ENV=${TRAVIS_DEPLOY_ENV:-staging}
echo "Starting deployment using terraform, build number: $BUILD_NUMBER, environment: $DEPLOY_ENV"
cd ./ops/terraform
@dejanvasic85
dejanvasic85 / backend.tf
Created April 1, 2018 02:30
Terraform back end config
provider "aws" {
region = "${var.aws_region}"
max_retries = 21
}
terraform {
backend "s3" {
key = "terraform.tfstate" # This is overriden by the backend-config flag when calling deploy.sh
region = "us-east-1" # Todo - i'm not sure where this can come through as a variable
}
before_deploy:
- wget https://releases.hashicorp.com/terraform/0.11.5/terraform_0.11.5_linux_amd64.zip -O /tmp/terraform.zip
- sudo unzip -d /usr/local/bin/ /tmp/terraform.zip
@dejanvasic85
dejanvasic85 / .travis.yml
Last active April 1, 2018 02:56
Travis v1
language: node_js
env:
- TRAVIS_DEPLOY_ENV=staging
APP_VERSION=v$TRAVIS_BUILD_NUMBER
services:
- docker
node_js:
@dejanvasic85
dejanvasic85 / Dockerfile
Created April 1, 2018 01:26
Docker file for node
FROM risingstack/alpine:3.4-v6.9.4-4.2.0
ARG APP_VERSION=local
ENV PORT 3001
ENV APP_VERSION ${APP_VERSION}
EXPOSE 3001
COPY package.json package.json
@dejanvasic85
dejanvasic85 / tsconfig.json
Last active March 31, 2018 11:05
Node with Docker on AWS Fargate
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"outDir": "dist",
"sourceMap": true
},
"files": [
"./node_modules/@types/mocha/index.d.ts",
"./node_modules/@types/node/index.d.ts"
@dejanvasic85
dejanvasic85 / FileUploadController.cs
Last active August 11, 2017 06:49
Asp.net WebForms multiple file upload
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Http;
namespace TestFileUpload
{
public class FileUploadController : ApiController
@dejanvasic85
dejanvasic85 / New.cs
Last active July 31, 2017 11:56
Selenium WebDriver with Google GeoComplete
public BookingEventStep WithLocation(string location)
{
_webdriver.ScrollElementToMiddle(LocationInput);
LocationInput.FillText(location);
var wait = new WebDriverWait(_webdriver, TimeSpan.FromSeconds(10));
wait.Until(ExpectedConditions.ElementToBeClickable(By.ClassName("pac-item")));
LocationInput.SendKeys(Keys.ArrowDown);
LocationInput.SendKeys(Keys.ArrowDown);
@dejanvasic85
dejanvasic85 / LoginPage.cs
Last active September 25, 2016 13:04
Selenium WebElement scrolling so element is in the middle of page
public class LoginPage{
private IWebDriver _webDriver;
public LoginPage(IWebDriver webDriver){
_webDriver = webDriver;
}
[FindsBy(How = How.Name, Using = "username")]
private IWebElement UsernameInputElement {get;set;}
@dejanvasic85
dejanvasic85 / SessionLifetimeManager.cs
Last active July 10, 2016 12:07
Custom Unity lifetime manager
public class SessionLifetimeManager<T> : Microsoft.Practices.Unity.LifetimeManager
{
private string key;
public SessionLifetimeManager()
{
this.key = typeof(T).Name;
}
/// <summary>