Skip to content

Instantly share code, notes, and snippets.

@cmfsotelo
cmfsotelo / replaceOnFiles.js
Last active May 25, 2020
This simple script receives a pattern and a csv file with key,value lines and replaces all keys in all files with the respective values. Intended to aid androidX migration using the scripts from
View replaceOnFiles.js
'use strict';
/**
* AndroidX class mapping: https://developer.android.com/topic/libraries/support-library/downloads/androidx-class-mapping.csv
* AndroidX artifact mapping: https://developer.android.com/topic/libraries/support-library/downloads/androidx-artifact-mapping.csv
**/
var fs = require('fs'),
lineReader = require('n-readlines'),
glob = require('glob');
@cmfsotelo
cmfsotelo / updateBulkWithMap
Created May 24, 2020
This simple script receives a pattern and a csv file with key,value lines and replaces all keys in all files with the respective values.
View updateBulkWithMap
'use strict';
var fs = require('fs'),
lineReader = require('n-readlines'),
glob = require('glob');
/**
* Expects a csv with 2 columns in the format key,value on each line.
* @param csvFile
* @returns Returns an object with properties keys and values value
*/
@cmfsotelo
cmfsotelo / GitHub curl.sh
Created May 14, 2020 — forked from Integralist/GitHub curl.sh
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
View GitHub curl.sh
curl --header 'Authorization: token INSERTACCESSTOKENHERE' \
--header 'Accept: application/vnd.github.v3.raw' \
--remote-name \
--location https://api.github.com/repos/owner/repo/contents/path
# Example...
TOKEN="INSERTACCESSTOKENHERE"
OWNER="BBC-News"
REPO="responsive-news"
@cmfsotelo
cmfsotelo / createuser.sh
Last active Mar 6, 2020 — forked from jhbush/createadminuser.sh
Create User Script
View createuser.sh
#!/bin/bash
# This script creates a user account under Mac OS X
usage() {
echo " Synopsis"
echo ' create-user userName userFullName userPassword groupId'
echo ""
echo ""
echo " Description"
echo " Creates a new user with the given params and attributes to the desired group"
}
View global-gitignore.md

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file. Create a file called .gitignore in your home directory and add anything you want to ignore. You then need to tell git where your global gitignore file is.

Mac

git config --global core.excludesfile ~/.gitignore

Windows

git config --global core.excludesfile %USERPROFILE%\.gitignore
@cmfsotelo
cmfsotelo / launch.json
Last active Nov 11, 2019
VSCode Mocha Launch.json
View launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{ // To run on a selected spec.ts file
"type": "node",
"request": "launch",
"name": "File Mocha Typescript File",
@cmfsotelo
cmfsotelo / cordova-hooks-build-settings-ios.js
Created May 6, 2019
Cordova hook to add build settings to ios platform to use with plugins
View cordova-hooks-build-settings-ios.js
module.exports = function (ctx) {
var fs = ctx.requireCordovaModule("fs");
var path = ctx.requireCordovaModule("path");
var xcode = ctx.requireCordovaModule("xcode");
var deferral = ctx.requireCordovaModule('q').defer();
/**
* Recursively search for file with the tiven filter starting on startPath
*/
@cmfsotelo
cmfsotelo / gradleDependencies.md
Created May 6, 2019 — forked from dmytrodanylyk/description.md
Where this dependency comes from?
View gradleDependencies.md

Did you ever have android build failed​ issue because of dependency resolution?

… or you were curious where all these old rxjava dependencies come from?

You can pretty easy track the module causing issues via following gradle command.

gradlew :root-module:dependencyInsight \
--configuration debugRuntimeClasspath \ // or debugCompileClasspath
--dependency io.reactivex:rxjava:1.1.0 > dependencies.txt // saves result to 'dependencies.txt' file
@cmfsotelo
cmfsotelo / cordova-hooks-embed_framework_hook.js
Last active May 6, 2019
Cordova hook for ios platform that adds a custom framework as dependency
View cordova-hooks-embed_framework_hook.js
// This hook expects that the framework dependency is defined on plugin.xml.
// Example:
// <platform name="ios">
// <!-- .... -->
// <framework src="path/to/FRAMEWORK_NAME.framework" custom="true" embed="true" />
// </platform>
// For the OutSystems platform it is better to add this hook on both events. As so:
// <platform name="ios">
// <!-- .... -->
// <hook type="after_plugin_install" src="path/to/thishook/embed_framework_hook.js" />
@cmfsotelo
cmfsotelo / VSCode debug install cordova plugin
Created Mar 7, 2019 — forked from Chuckytuh/VSCode debug install cordova plugin
This launch.json configuration is helpful for cordova hook development. It allows to launch cordova cli with VSCode debugger attached so we can place breakpoints on our hook scripts.
View VSCode debug install cordova plugin
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",