Add the following lines in /etc/environment
:
GTK_IM_MODULE=cedilla
QT_IM_MODULE=cedilla
Reference: https://askubuntu.com/a/370040/1244744
Create a file named .XCompose
const pagination = { | |
list: [], | |
generateListBySize: (size, predicate) => Array.from({ length: size }).map(predicate), | |
generatePageList: (size, range, total) => pagination.generateListBySize(size, (_, i) => range.start + i).filter(page => page <= total), | |
generateMapRange: (totalRange, size) => ( | |
pagination | |
.generateListBySize(totalRange, (_) => ({})) | |
.reduce((acc, _, i) => { | |
const lastItem = acc?.[i - 1]; | |
const index = i + 1; |
// Converts an ArrayBuffer directly to base64, without any intermediate 'convert to string then | |
// use window.btoa' step. According to my tests, this appears to be a faster approach: | |
// http://jsperf.com/encoding-xhr-image-data/5 | |
/* | |
MIT LICENSE | |
Copyright 2011 Jon Leighton | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: |
Add the following lines in /etc/environment
:
GTK_IM_MODULE=cedilla
QT_IM_MODULE=cedilla
Reference: https://askubuntu.com/a/370040/1244744
Create a file named .XCompose
# 1. To check the branch in the local repository | |
# Local: | |
# https://stackoverflow.com/questions/21151178/shell-script-to-check-if-specified-git-branch-exists | |
# test if the branch is in the local repository. | |
# return 1 if the branch exists in the local, or 0 if not. | |
function is_in_local() { | |
local branch=${1} | |
local existed_in_local=$(git branch --list ${branch}) | |
if [[ -z ${existed_in_local} ]]; then |
# put this in your .bash_profile | |
pull_request() { | |
to_branch=$1 | |
if [ -z $to_branch ]; then | |
to_branch="master" | |
fi | |
# try the upstream branch if possible, otherwise origin will do | |
upstream=$(git config --get remote.upstream.url) | |
origin=$(git config --get remote.origin.url) |
// command line args | |
const args = process.argv |
// Reference: https://stackoverflow.com/a/49250525 | |
const promisify = func => (...args) => new Promise((resolve, reject)=> func(...args, (err, res) => err ? reject(err) : resolve(res))); |
const stringToPath = (path) => { | |
const pattern = /\[([0-9]+)\]/g; | |
if (pattern.test(path)) return path.replace(pattern, '.$1').split('.'); | |
return path.split('.'); | |
}; | |
// First Approach: | |
const deepGet = (source, path, defaultValue) => { | |
const props = stringToPath(path); |
/** | |
* @param {string} text - Text with replacement keys identified by #{key} | |
* @param {object} replacements - An object used to replace keys from text | |
* @return {string} string replaced | |
*/ | |
const replace = (text = "", replacements = {}) => { | |
const pattern = /#\{(.*?)\}/g; | |
const keys = text.match(pattern) || []; | |
return keys.reduce((acc, key) => { |
const { promisify } = require('util'); | |
const { exec } = require('child_process'); | |
const run = promisify(exec); | |
const normalizeString = string => (string || '').trim(); | |
function getBranchParent () { | |
return run(`git show-branch | grep '*' | grep -v "$(git rev-parse --abbrev-ref HEAD)" | head -n1`) | |
.then(resp => { | |
const commit = normalizeString(resp.stdout); |