Skip to content

Instantly share code, notes, and snippets.

View lior-amsalem's full-sized avatar

Lior Amsalem lior-amsalem

View GitHub Profile
@lior-amsalem
lior-amsalem / bucket_handler.js
Last active March 6, 2017 11:50
AWS Mock S3 service for tests in Mocha
'use strict';
const BUCKET_NAME = 'bucket-assets';
class BucketHandler {
constructor(awsModule) {
let AWS = require('aws-sdk');
this.s3 = new AWS.S3();
}
@lior-amsalem
lior-amsalem / config.yml
Created August 24, 2019 20:07
Basic Circle Configuration
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
version: 2.1
jobs:
# Job #1
build:
# The primary container is an instance of the first image listed. The job's commands run in this container.
docker:
# specify the version you desire here
- image: circleci/node:11.10
@lior-amsalem
lior-amsalem / config.yml
Created August 24, 2019 20:10
Basic workflows configuration
// … few jobs
workflows:
version: 2.1
build-test-and-deploy:
jobs:
- build: # job #1 - here we build and prepare everything we need
context: dev
- test: # job #2 - is where we run our tests, linting, code coverage etc.
context: dev # for each job we can define “context” with environment variables (and define those in CircleCI dashboard as admin)
@lior-amsalem
lior-amsalem / config.yml
Created August 24, 2019 20:10
Basic workflows configuration
// … few jobs
workflows:
version: 2.1
build-test-and-deploy:
jobs:
- build: # job #1 - here we build and prepare everything we need
context: dev
- test: # job #2 - is where we run our tests, linting, code coverage etc.
context: dev # for each job we can define “context” with environment variables (and define those in CircleCI dashboard as admin)
@lior-amsalem
lior-amsalem / config.yml
Created August 24, 2019 20:11
CircleCI with NPM token
// … few jobs
workflows:
version: 2.1
build-test-and-deploy:
jobs:
- build: # job #1 - here we build and prepare everything we need
context: dev
- test: # job #2 - is where we run our tests, linting, code coverage etc.
context: dev # for each job we can define “context” with environment variables (and define those in CircleCI dashboard as admin)
@lior-amsalem
lior-amsalem / config.yml
Created August 24, 2019 20:12
Understanding "Persist to Workspace"
- persist_to_workspace:
# Must be an absolute path, or relative path from working_directory. This is a directory on the container which is
# taken to be the root directory of the workspace.
root: ~/app
# “Paths” Must be relative path from root
paths:
- node_modules # folder we want to keep for the next job
- packages/my_project/build # another folder
@lior-amsalem
lior-amsalem / config.yml
Created August 24, 2019 20:13
How to use circleCI Orbs
version: 2.1
orbs:
aws-s3: circleci/aws-s3@1.0.11 # allows easy integration with AWS s3, require ENV var with AWS_ACCESS_KEY_ID & AWS_SECRET_ACCESS_KEY
slack: circleci/slack@3.3.0 # allows easy integration with slack, require SLACK_WEBHOOK (url provided by slack)
jobs:
# Job #1
build:
@lior-amsalem
lior-amsalem / config.yml
Created August 24, 2019 20:14
The process/jobs
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
version: 2.1
orbs:
aws-s3: circleci/aws-s3@1.0.11
slack: circleci/slack@3.3.0
jobs:
# Job #1
build:
@lior-amsalem
lior-amsalem / catList.jsx
Last active January 25, 2020 20:47
Initial File of our dynamically generated inputs - part 1
import React from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faMinusCircle } from '@fortawesome/free-solid-svg-icons'
import './cat-list.css';
class CatList extends React.Component {
renderList() {
return null
}
render() {
@lior-amsalem
lior-amsalem / catList.jsx
Created January 18, 2020 14:12
Dynamically generated inputs - part 2
handleChangeOfCatDataFactory = (type, itemIndex, generateKey) => (event) => {
const catData = event.target.value;
this.setState((prevState) => {
const newCatList = [...prevState.catList];
newCatList[itemIndex] = {
...prevState.catList[itemIndex],
generateKey: generateKey,
[type]: catData,