Skip to content

Instantly share code, notes, and snippets.

View mrosata's full-sized avatar
🐣

Michael Rosata mrosata

🐣
  • Quincy, MA USA
View GitHub Profile
@mrosata
mrosata / denode-aws-service-code.js
Last active January 8, 2018 17:11
Generates code to wrap entire AWS service apis as functions or methods returning Promises. Setup: `yarn add ramda yargs`
#!/usr/bin/node
////////////////////////////////////////////////////////////////////////////////
//// Create AWS Service Promisified Functions
//// @author Michael Rosata
////
//// @dependencies ramda, yargs
////
//// @desc
//// Returns the code that would wrap every method from one AWS Service into
//// functions that return Promises rather than those returning Node style
@sapessi
sapessi / README.md
Last active October 26, 2021 10:48
Continuous deployment of React websites to Amazon S3

Continuous deployment of React websites to Amazon S3

This sample includes a continuous deployment pipiline for websites built with React. We use AWS CodePipeline, CodeBuild, and SAM to deploy the application. To deploy the application to S3 using SAM we use a custom CloudFormation resource.

Files included

  • buildspec.yml: YAML configuration for CodeBuild, this file should be in the root of your code repository
  • configure.js: Script executed in the build step to generate a config.json file for the application, this is used to include values exported by other CloudFormation stacks (separate services of the same application).
  • index.js: Custom CloudFormation resource that publishes the website to an S3 bucket. As you can see from the buildspec and SAM template, this function is located in a s3-deployment-custom-resource sub-folder of the repo
  • app-sam.yaml: Serverless Application model YAML file. This configures the S3 bucket and the cu
@mrosata
mrosata / jsbin-functional-program.js
Created November 16, 2016 04:50
Functional Programming with IO, Maybe, Just, Nothing -- Touch of Reactive
console.clear()
// The Ramda Library functions you need to breathe.
const Maybe = iJustMetYouThisIsCrazyImAMonadSoCallMeMaybe()
const {
map, chain, compose, reduce, filter, prop, curry
} = R
// fromEvent :: Str -> Elem -> Obs
const fromEvent = curry((eventType, elem) => {
return Rx.Observable.fromEvent(elem, eventType)
@soundyogi
soundyogi / 2018_chrome_snippet_gui_import_export.js
Last active December 24, 2023 22:09
A snippet to export and import your chrome snippets
void function() { "use strict"
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WIP DO NOT USE WIP !!!!!!!!!!!!!!!!!!!!!
DO NOT USE THIS YET.
USE THE 2016 VERSION BELOW PLEASE.
WWWWWWWW WWWWWWWWIIIIIIIIIIPPPPPPPPPPPPPPPPP
W::::::W W::::::WI::::::::IP::::::::::::::::P
W::::::W W::::::WI::::::::IP::::::PPPPPP:::::P
@mrozema
mrozema / content-for-group.js
Last active August 2, 2016 03:37
Ember 2.0 compatible select box
import Ember from "ember";
export default Ember.Helper.helper(function([content, group, contentGroupKey]) {
return content.filterBy(contentGroupKey, group);
});
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@mrosata
mrosata / animation-queue.js
Last active August 29, 2015 14:16
Animate multiple elements with different positions and timing using an object to manage each frame with a queue
/* Animation Queue Object using vanilla JavaScript
* by: Michael Rosata
* https://jsfiddle.net/mrosata/gb96gcme/2/
*/
function AnimeQ (int) {
this.intv = parseInt(int,10) || 10;
this.queue = [];
}
AnimeQ.prototype.addToQueue = function (item) {
item.animating = true;
@NuckChorris
NuckChorris / array.js
Last active February 12, 2018 19:47 — forked from pixelhandler/transforms.js
In Ember-CLI, transforms are located in app/transforms/name.js
// app/transforms/array.js
import Ember from 'ember';
import DS from 'ember-data';
export default DS.Transform.extend({
deserialize: function(value) {
if (Ember.isArray(value)) {
return Ember.A(value);
} else {
return Ember.A();
@dehuszar
dehuszar / .htaccess
Created November 13, 2014 19:55
.htaccess for Ember-CLI builds
# place in [app]/public so it gets compiled into the dist folder
Options FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
@akorn
akorn / rsync_parallel.sh
Last active September 13, 2024 17:04 — forked from rcoup/rsync_parallel.sh
This script can transfer large directory structures with parallel rsync workers. Example command line: `rsync_parallel . -- -aHSAX --exclude '*13' . /tmp/2/.`
#!/bin/zsh
#
# Copyright (c) 2014, 2020 by Dr. András Korn. Implements the basic idea of a similar script by Robert Coup (2013).
# License: GPLv3
function usage() {
echo 'Usage:
rsync_parallel [--parallel=N] <args to find(1) to generate list of stuff to transfer> -- <args to rsync>