Skip to content

Instantly share code, notes, and snippets.

@didi0613
didi0613 / switch-to-oss-app-archeype.md
Last active November 14, 2018 21:37
Switch to OSS app archetype

Switch to OSS app archetype

Changes Required

  • Update your dependencies inside package.json

    Switch internal app archetype

    @walmart/electrode-archetype-react-app
    @walmart/electrode-archetype-react-app-dev
    
@tony-gutierrez
tony-gutierrez / AWS_Single_LetsEncrypt.yaml
Last active March 7, 2024 11:29
AWS Elastic Beanstalk .ebextensions config for single instance free SSL using letsencrypt certbot and nginx. http://bluefletch.com/blog/domain-agnostic-letsencrypt-ssl-config-for-elastic-beanstalk-single-instances/
# Dont forget to set the env variable "certdomain", and either fill in your email below or use an env variable for that too.
# Also note that this config is using the LetsEncrypt staging server, remove the flag when ready!
Resources:
sslSecurityGroupIngress:
Type: AWS::EC2::SecurityGroupIngress
Properties:
GroupId: {"Fn::GetAtt" : ["AWSEBSecurityGroup", "GroupId"]}
IpProtocol: tcp
ToPort: 443
// Cartesian product of arrays
// @takes N arrays -- arguments *must* be arrays
// @returns an array of X arrays of N elements, X being the product of the input arrays' lengths.
function cartesianProduct(...arrays) {
function _inner(...args) {
if (arguments.length > 1) {
let arr2 = args.pop(); // arr of arrs of elems
let arr1 = args.pop(); // arr of elems
return _inner(...args,
@tansongyang
tansongyang / cartesian-product-lodash-fp.js
Last active October 8, 2023 23:45
An implementation of Cartesian product using lodash/fp
// Based on this gist: https://gist.github.com/ChrisJefferson/cb8db2a4c67a9506c56c
// JS Bin: https://jsbin.com/cefopi/edit?js,console
const cartesianProduct = (...rest) =>
_.reduce((a, b) =>
_.flatMap(x =>
_.map(y =>
x.concat([y])
)(b)
)(a)
)([[]])(rest);
@FuYaoDe
FuYaoDe / pre-commit
Created December 2, 2015 12:21
Run Check .only before commit, prevent mocha test prevent .
#!/bin/sh
#
# Run Check Only before commit.
RED='\033[0;31m'
if [ "$(git diff --cached | grep "+" | grep ".only")" != "" ]; then
echo ""
echo "${RED}COMMIT FAILED:"
echo "${RED}Some spec files have .only. Please remove only and try committing again."
@squarepegsys
squarepegsys / profile.ps1
Last active October 18, 2021 16:44
Powershell setup
# install Github Desktop to get their config
# then you can do this
# https://desktop.github.com/
. (Resolve-Path "$env:LOCALAPPDATA\GitHub\shell.ps1")
# then install psget and install modules
# before putting these lines in here
# see https://github.com/psget/psget
Import-Module PowerLs
@squarepegsys
squarepegsys / build.gradle
Created December 2, 2014 19:12
Gradle and Groovy
sourceSets {
main {
groovy {
// override the default locations, rather than adding additional ones
srcDirs = ['src/main/groovy', 'src/main/java']
}
java {
srcDirs = [] // don't compile Java code twice
}
}
@mrkelly
mrkelly / event.builder.js
Created August 6, 2014 19:44
Angular Logstash
angular.module('hf.events.builder', [
'app.resources',
'app.values'
])
.factory('EventBuilder', function ($injector, $window, apiUrl) {
var EventBuilder = function EventBuilder(message) {
this['@timestamp'] = new Date();
this['@message'] = message || '';
return this;
};
@samgiles
samgiles / flatMap.js
Created June 20, 2014 11:32
Javascript flatMap implementation
// [B](f: (A) ⇒ [B]): [B] ; Although the types in the arrays aren't strict (:
Array.prototype.flatMap = function(lambda) {
return Array.prototype.concat.apply([], this.map(lambda));
};
@domix
domix / setjava.sh
Created January 6, 2014 18:26
Handy bash function to switch quickly between your Java SDKs in OSx
function setjava() {
export JAVA_HOME=$(/usr/libexec/java_home -v $1)
}