Skip to content

Instantly share code, notes, and snippets.

View bibekg's full-sized avatar

Bibek Ghimire bibekg

View GitHub Profile
@bibekg
bibekg / dabblet.css
Created July 28, 2020 04:12 — forked from Daniel-Hug/dabblet.css
Pure CSS aspect ratio with no spacer images or js! :)
/*
* Pure CSS aspect ratio with no spacer images or js! :)
*/
body {
width: 36%;
margin: 8px auto;
}
div.stretchy-wrapper {
@bibekg
bibekg / json-transformer.ts
Created August 21, 2019 22:01
A simple tool for making local modifications to JSON objects based on a predicate-transformer paradigm
import { clone } from "lodash";
type KVTransformer<T> = (path: string, value: T) => T;
export interface TransformerOptions {
keyHandler: HandlerConfig;
valueHandlers: HandlerConfig[];
}
export interface HandlerConfig {
import ScheduleSelector from 'react-schedule-selector'
class App extends React.Component {
state = { schedule = [] }
handleChange = newSchedule => {
this.setState({ schedule: newSchedule })
}
renderCustomDateCell = (time, selected, innerRef) => (
import ScheduleSelector from 'react-schedule-selector'
class App extends React.Component {
state = { schedule = [] }
handleChange = newSchedule => {
this.setState({ schedule: newSchedule })
}
render() {
@bibekg
bibekg / config.yml
Last active August 22, 2018 04:28
elasticbeanstalk config file
branch-defaults:
production:
environment: mywebapp-api-production
# (optional) Other branch-specific settings
# (e.g. if you want a staging environment)
master:
environment: mywebapp-api-staging
global:
application_name: mywebapp-api
default_ec2_keyname: null
@bibekg
bibekg / Dockerfile
Last active September 16, 2018 17:47
Dockerfile for deployment of back-end app
# Load the alpine base image
FROM alpine:3.7
# Install depedencies
RUN apk update && apk add -U nodejs yarn
RUN node --version
RUN yarn --version
# Create the working directory
RUN mkdir -p /var/www/api
@bibekg
bibekg / deploy.sh
Last active July 29, 2018 17:39
Deploy script for ElasticBeanstalk deployment
#!/bin/bash
EB_APP="mywebapp-api"
STAGING_BRANCH="master"
PRODUCTION_BRANCH="production"
# Determine the environment to deploy to based on which branch this commit is on
NODE_ENV=''
if [[ $TRAVIS_BRANCH == $STAGING_BRANCH ]]; then
NODE_ENV="staging"
@bibekg
bibekg / .travis.yml
Created July 29, 2018 17:36
Travis config for back-end deployment
sudo: required
language: node_js
node_js:
- node
after_success:
- chmod +x ./deploy.sh
- "./deploy.sh"
@bibekg
bibekg / deploy.sh
Last active September 16, 2018 17:34
Frontend web app deploy script
#!/bin/bash
AWS_S3_REGION="us-west-2"
STAGING_BRANCH="master"
PRODUCTION_BRANCH="production"
# Determine the environment to deploy to based on the branch
# From that, we'll know:
# - the S3 bucket to sync assets with
# - the CloudFront distribution for which to create an invalidation
@bibekg
bibekg / .travis.yml
Last active July 29, 2018 17:12
Travis configuration for a front-end web app
sudo: required
language: node_js
node_js:
- node
after_success:
- chmod +x deploy.sh
- "./deploy.sh"