This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
var fruits = ['apple', 'orange', 'banana', 'pear'], | |
middleJoiner = ', ', | |
endJoiner = ' and ', | |
result = listJoiner(fruits, middleJoiner, endJoiner); | |
*/ | |
// result will be this string: 'apple, orange, banana and pear' | |
//Iterative way | |
function listJoinerIter(elems, middleJoiner, endJoiner) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Prompts to choose a file from filesystem, converts to base64 (in background), and returns base64 when conversion ends. | |
* @param {number} maxFileSize Maximum size of file. | |
* @param {boolean} multiple Indicates whether to accept one or more files. | |
* @param {string} contentType MIME type of media to require from filesystem (can be 'image/*', etc). | |
* @param {string} source (For mobile devices only) If set to 'camera', tells device to capture image from camera. | |
* @returns {Promise} A Promise that resolves when files are read; rejects with error text if files are heavier than allowed. | |
*/ | |
onClickSendMedia(maxFileSize, multiple = false, contentType = '*/*', source) { | |
return new Promise((resolve, reject) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
limitLines { | |
overflow: hidden, | |
display: -webkit-box, | |
-webkit-line-clamp: 2, | |
-webkit-box-orient: vertical | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Resizes a picture to a maximum length/width (based on largest dimension) | |
* @param {string} original Base64 representation of image to be resized. | |
* @param {number} maxSize Amount of pixels that largest dimention (whether width or length) should have. | |
* @param {string} finalMimeType Mime type of the resulting resized image. | |
* @returns {Promise} A Promise that resolves with resized picture. | |
*/ | |
resizeImage(original, maxSize, finalMimeType = 'image/jpeg') { | |
return new Promise(resolve => { | |
const image = new Image(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Prompts to choose a file from filesystem, converts to base64 (in background), and returns base64 when conversion ends. | |
* @param {number} maxFileSize Maximum size of file. | |
* @param {boolean} multiple Indicates whether to accept one or more files. | |
* @param {string} contentType MIME type of media to require from filesystem (can be 'image/*', etc). | |
* @param {number} maxSize Maximum size (in pixels) that images' largest dimention (width or length) should have, or 0 to ignore. | |
* @param {string} finalMimeType Mime type of the resulting resized image. | |
* @param {string} source (For mobile devices only) If set to 'camera', tells device to capture image from camera. | |
* @returns {Promise} A Promise that resolves when files are read; rejects with error if files are heavier than allowed. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Clone repository with submodules automatically: | |
git clone --recursive [email protected]:name/repo.git | |
// Initialize submodules after regular cloning: | |
git submodule update --init | |
// Make submodules to track their respective remote branches (instead of being in detached HEAD state): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm i github:jagomf/project-name#semver:^3.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
{ path: 'wall', component: WallHandlerComponent, canActivate: [LoggedGuard], | |
children: [ | |
{ path: '', redirectTo: 'recent', pathMatch: 'full' }, | |
{ path: 'recent', component: RecentEventsComponent }, | |
{ path: 'ranking', component: RankingUsersComponent } | |
] }, | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Look for an ELAN device ID | |
$ xinput list | |
## Use ELAN device ID (in this case 14) | |
$ xinput map-to-output 14 eDP-1 | |
## Kill React Native script that prevents deleting node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const arr = ['a', 'b', 'c', 'd', 'e']; | |
const postToReplace = 2; // position 2 points to letter 'c' in the array | |
const newArr = Object.assign([...arr], {[postToReplace]: 'J'}); | |
console.log(newArr); | |
// ['a', 'b', 'J', 'd', 'e'] |
OlderNewer