Skip to content

Instantly share code, notes, and snippets.

View mig82's full-sized avatar
🏠
Working from home

Miguelángel Fernández mig82

🏠
Working from home
View GitHub Profile
@mig82
mig82 / gitignore-cached.sh
Last active April 17, 2018 14:37 — forked from ainsofs/gist:2b80771a5582b7528d9e
Clear .gitignore cache
# remove specific file from git cache
git rm --cached filename
# remove all files from git cache
git rm -r --cached .
git add .
git commit -m ".gitignore is now working"
@mig82
mig82 / kony_sdk_i18n_patch.js
Last active November 28, 2018 06:59
A seminal idea on how to enhance kony.i18n.getLocalizedString with var substitution.
kony.i18n._getLocalizedString = kony.i18n.getLocalizedString;
kony.i18n.getLocalizedString = (key, scope) => {
var s = kony.i18n._getLocalizedString(key);
if(!s) return key;
for (var property in scope) {
if (scope.hasOwnProperty(property)) {
s = s.replace("${" + property + "}", scope[property]);
}
@mig82
mig82 / .bashrc
Created December 14, 2018 10:25
Usefull aliases for my comand line
alias fontnames='for file in "$arg"*.{ttf,otf}; do
postscriptname=$(fc-scan --format "%{postscriptname}\n" $file);
printf "\033[36m PostScript Name:\033[0m %s \e[90m(%s)\033[0m\n" "$postscriptname" "$file";
done'
alias vis='open -a /Applications/kony/KonyVisualizerEnterprise8/Kony\ Visualizer\ Enterprise.app'
alias vislog='cat ~/Kony\ Visualizer/vizdata/logs/konyvizenterprise.log'
alias vislogs='open ~/Kony\ Visualizer/vizdata/logs/'
#alias shorten_my_promt="PS1='\u:\W\$ '"
@mig82
mig82 / extract-ombud-headers.js
Created February 15, 2019 13:13
Extracting links to headers from an Ombud web preview.
var baseURL = "https://app.ombud.com/v1/rx/AWQDn7ewgLe6Qjc33rXM/documents/AWjw3gjm4XgXoZ-r27ON/webview_preview";
var entries= document.getElementsByClassName("entry");
var count = entries.length;
console.log("Total %d", count);
var index = [];
for (var i = 0; i < count; i++) {
var entry = entries[i];
var question = entry.getElementsByClassName("question")[0].innerText;
index.push({
index: i+1,
initGettersSetters: function() {
//Field foo
defineGetter(this, "foo", () => {return this._foo;});
defineSetter(this, "foo", (foo) => {this._foo = foo;});
//Field bar
defineGetter(this, "bar", () => {return this._bar;});
defineSetter(this, "bar", (bar) => {this._bar = bar;});
}
@mig82
mig82 / lintconfig.js
Last active November 27, 2020 10:38
EsLint config for Vis Quantum
/* AUTO GENERATED CONTENT */
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
module.exports = mod();
else if (typeof define == "function" && define.amd) // AMD
return define([], mod);
else // Plain browser env
return mod();
})(function() {
@mig82
mig82 / mapToArray.js
Last active February 5, 2020 10:08
A Javascript post-processor for Fabric which converts a property from an object into an array of objects.
/*
* Convert something like mymap: {foo: 0, bar: 1, qux:2} into
* myarr: [{foo: 0}, {bar: 1}, {qux:2}] */
function mapToArray(propName){
var res = resultToJSON(result);
var map = res[propName];
var array = [];
for(r in map){
var obj = {};
obj[r] = map[r];
@mig82
mig82 / sampleFormController.js
Last active September 10, 2021 16:46
A sample form controller for Vis Quantum projects
define(["util/doBar", "util/getQux"], function(doBar, getQux){
const PI = 3.1416
let count = 0
function doFoo(){ //This is a static function.
//TODO
}
return{
@mig82
mig82 / FooComponentController.js
Last active February 1, 2021 16:58
A sample controller for a Visualizer component.
//Break component code into separate modules and load them as dependencies.
define(["./animateIn, ./validateSomething"], function(animateIn, validateSomething) {
// Static constant. Shared across instances of this component. Can't be changed.
const SOME_CONSTANT = 3.14159;
// Static variable. Shared across instances of this component. Can be changed by any instance.
var count = 0;
// Static function. Shared by all instances of this component. Can't be changed.
@mig82
mig82 / .bash_profile
Created December 2, 2020 10:05
Show current folder and git branch in prompt
alias gitify_my_prompt="PS1='\[\033[96m\]\W\[\033[95m\] [\$(git symbolic-ref --short HEAD 2>/dev/null)]\[\033[00m\]\$' "
gitify_my_prompt