Skip to content

Instantly share code, notes, and snippets.

@willmendesneto
willmendesneto / copy-config.sh
Created May 2, 2016 09:13
Copy the `configuration.js` file by environment
#
# Copy the `configuration.js` file by environment
#
# How to use
#
# $ cd <your-sunbets-project>
# $ copy-config (-p|--password) (--user) (-u--url) <(-au|--au)=true (-eu|--eu)=true (-uat|--uat)=true> (-d|--dir=www-sunbets-folder)
#
# Examples:
# copy-config --user="my-user" -p="my-password" -uat=true
@willmendesneto
willmendesneto / e2e-scripts.sh
Last active April 18, 2016 01:16
Scripts for validate the `web-parts` branch in some environments
#
# Run the e2e tests for tab
#
# How to use
#
# $ cd <your-tab-project>
# $ e2e-tab (-n|--no-link) (-w|--web-parts=web-parts-folder) (-d|--dir=www-tab-folder)
#
# Optional values
#
@willmendesneto
willmendesneto / read-files-in-dir.sh
Created March 23, 2016 11:02
Shell: reading files in a specific directory
# Load ".cli" folder content
if [ -d ~/.cli ]; then
CLI_FILES=$(find ~/.cli -maxdepth 2 -type f)
while read -r line; do
source $line
done <<< "$CLI_FILES"
fi
@willmendesneto
willmendesneto / index.js
Last active November 1, 2015 05:35
Build checker: Application using Arduino + Johnny Five + NodeJS for to monitor build/deploy status in your Continuos Integration server
var request = require('request');
var five = require('johnny-five');
var board = new five.Board();
var CONFIG = {
LED: {
SUCCESS: 12,
ERROR: 10
},
CI_CCTRACKER_URL: 'https://snap-ci.com/willmendesneto/generator-reactor/branch/master/cctray.xml',
@willmendesneto
willmendesneto / basic-auth-multiple-credentials.js
Last active September 7, 2015 15:46
Multiple credentials check with Basic Auth node package
'use strict';
/**
* Multiple credentials check with Basic Auth node package
*
* How to use (ExpresJS example):
*
* var BASIC_AUTH = [
* {
* name: process.env.BASIC_AUTH_USERNAME,
@willmendesneto
willmendesneto / protractor.conf.js
Created June 21, 2015 15:43
Protractor snapshot UI tests configuration using Jasmine
'use strict';
var ScreenshotReporter = require('./screenshots.js');
var path = require('path');
exports.config = {
seleniumAddress: 'http://0.0.0.0:4444/wd/hub',
// Do not start a Selenium Standalone sever - only run this using chrome.
chromeOnly: true,
chromeDriver: '../../node_modules/protractor/selenium/chromedriver',
@willmendesneto
willmendesneto / gist:342d4f286bacaa541934
Last active August 29, 2015 14:19
Angular Modules Third-Party

Angular Modules Third-party

A list of angular modules (work in progress EVER)

Forms

Masks

Tags

@willmendesneto
willmendesneto / gist:196f84c884cf501dfced
Created March 19, 2015 17:58
AngularJS: testing form validation
// In your controller

this.item = {
    userType: ''
};
<!-- In your html template -->
@willmendesneto
willmendesneto / protractor_conf.js
Created February 15, 2015 12:26
An example of protractor configuration
// An example configuration file.
exports.config = {
// Do not start a Selenium Standalone sever - only run this using chrome.
chromeOnly: true,
chromeDriver: './node_modules/protractor/selenium/chromedriver',
seleniumAddress: 'http://0.0.0.0:4444/wd/hub',
baseUrl: 'http://0.0.0.0:9000',
// Capabilities to be passed to the webdriver instance.
@willmendesneto
willmendesneto / .functions
Last active August 29, 2015 14:15
.functions
# Simple calculator
function calc() {
local result="";
result="$(printf "scale=10;$*\n" | bc --mathlib | tr -d '\\\n')";
# └─ default (when `--mathlib` is used) is 20
#
if [[ "$result" == *.* ]]; then
# improve the output for decimal numbers
printf "$result" |
sed -e 's/^\./0./' `# add "0" for cases like ".5"` \