Skip to content

Instantly share code, notes, and snippets.

View cmfsotelo's full-sized avatar

Carlos Sotelo cmfsotelo

View GitHub Profile
@cmfsotelo
cmfsotelo / VSCode debug install cordova plugin
Created March 7, 2019 17:22 — 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.
{
// 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",
@cmfsotelo
cmfsotelo / gradleDependencies.md
Created May 6, 2019 08:20 — forked from dmytrodanylyk/description.md
Where this dependency comes from?

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-build-settings-ios.js
Created May 6, 2019 09:00
Cordova hook to add build settings to ios platform to use with plugins
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 / cordova-hooks-embed_framework_hook.js
Last active May 6, 2019 09:01
Cordova hook for ios platform that adds a custom framework as dependency
// 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 / launch.json
Last active November 11, 2019 11:12
VSCode Mocha 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 / global-gitignore.md
Last active December 2, 2019 09:51 — forked from subfuzion/global-gitignore.md
Global gitignore

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 / createuser.sh
Last active March 6, 2020 17:56 — forked from jhbush/createadminuser.sh
Create User Script
#!/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"
}
@cmfsotelo
cmfsotelo / GitHub curl.sh
Created May 14, 2020 21:58 — 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
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 / updateBulkWithMap
Created May 24, 2020 23:32
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.
'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 / replaceOnFiles.js
Last active May 25, 2020 14:53
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
'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');