diff --git a/.travis/push.sh b/.travis/push.sh index c0be60223..ac6939000 100755 --- a/.travis/push.sh +++ b/.travis/push.sh @@ -4,14 +4,23 @@ setup_git() { } commit_website_files() { - git checkout master - git add * - git commit --message "Travis build: $TRAVIS_BUILD_NUMBER" + if [ $TRAVIS_EVENT_TYPE != "pull_request" ]; then + if [ $TRAVIS_BRANCH == "master" ]; then + echo "Commiting to master branch..." + git checkout master + git add * + git commit --message "Travis build: $TRAVIS_BUILD_NUMBER [ci skip]" + fi + fi } upload_files() { - echo "https://${GH_TOKEN}@github.com/Chalarangelo/30-seconds-of-code.git" - git push --force "https://${GH_TOKEN}@github.com/Chalarangelo/30-seconds-of-code.git" master > /dev/null 2>&1 + if [ $TRAVIS_EVENT_TYPE != "pull_request" ]; then + if [ $TRAVIS_BRANCH == "master" ]; then + echo "Pushing to master branch..." + git push --force --quiet "https://${GH_TOKEN}@github.com/Chalarangelo/30-seconds-of-code.git" master > /dev/null 2>&1 + fi + fi } setup_git diff --git a/README.md b/README.md index 900a3b462..9cdeb42e2 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,13 @@ - Use Ctrl + F or command + F to search for a snippet. - Contributions welcome, please read the [contribution guide](CONTRIBUTING.md). - Snippets are written in ES6, use the [Babel transpiler](https://babeljs.io/) to ensure backwards-compatibility. +- You can import these snippets into your text editor of choice (VSCode, Atom, Sublime) using the files found in [this repo](https://github.com/Rob-Rychs/30-seconds-of-code-texteditorsnippets). - You can import these snippets into Alfred 3, using [this file](https://github.com/lslvxy/30-seconds-of-code-alfredsnippets). +- You can find a package with all the snippets on [npm](https://www.npmjs.com/package/tsoc). Bear in mind that most of these snippets are not production-ready. ## Table of Contents -### Adapter +### 🔌 Adapter
View contents @@ -27,7 +29,7 @@
-### Array +### 📚 Array
View contents @@ -75,13 +77,14 @@
-### Browser +### 🖥️ Browser
View contents * [`arrayToHtmlList`](#arraytohtmllist) * [`bottomVisible`](#bottomvisible) +* [`copyToClipboard`](#copytoclipboard) * [`currentURL`](#currenturl) * [`detectDeviceType`](#detectdevicetype) * [`elementIsVisibleInViewport`](#elementisvisibleinviewport) @@ -96,12 +99,13 @@ * [`scrollToTop`](#scrolltotop) * [`setStyle`](#setstyle) * [`show`](#show) +* [`speechSynthesis`](#speechsynthesis) * [`toggleClass`](#toggleclass) * [`UUIDGeneratorBrowser`](#uuidgeneratorbrowser)
-### Date +### ⏱️ Date
View contents @@ -113,7 +117,7 @@
-### Function +### 🎛️ Function
View contents @@ -127,7 +131,7 @@
-### Logic +### 🔮 Logic
View contents @@ -136,7 +140,7 @@
-### Math +### ➗ Math
View contents @@ -172,16 +176,7 @@
-### Media - -
-View contents - -* [`speechSynthesis`](#speechsynthesis) - -
- -### Node +### 📦 Node
View contents @@ -192,7 +187,7 @@
-### Object +### 🗃️ Object
View contents @@ -204,11 +199,12 @@ * [`orderBy`](#orderby) * [`select`](#select) * [`shallowClone`](#shallowclone) +* [`size`](#size) * [`truthCheckCollection`](#truthcheckcollection)
-### String +### 📜 String
View contents @@ -235,7 +231,7 @@
-### Utility +### 💎 Utility
View contents @@ -248,6 +244,7 @@ * [`isArray`](#isarray) * [`isBoolean`](#isboolean) * [`isFunction`](#isfunction) +* [`isNull`](#isnull) * [`isNumber`](#isnumber) * [`isString`](#isstring) * [`isSymbol`](#issymbol) @@ -258,10 +255,12 @@ * [`toDecimalMark`](#todecimalmark) * [`toOrdinalSuffix`](#toordinalsuffix) * [`validateNumber`](#validatenumber) +* [`yesNo`](#yesno)
-## Adapter +--- + ## 🔌 Adapter ### call @@ -423,7 +422,8 @@ arrayMax([1, 2, 4]); // 4
[⬆ Back to top](#table-of-contents) -## Array +--- + ## 📚 Array ### chunk @@ -1436,7 +1436,8 @@ zipObject(['a', 'b'], [1, 2, 3]); // {a: 1, b: 2}
[⬆ Back to top](#table-of-contents) -## Browser +--- + ## 🖥️ Browser ### arrayToHtmlList @@ -1485,6 +1486,48 @@ bottomVisible(); // true
[⬆ Back to top](#table-of-contents) +### copyToClipboard + +Copy a string to the clipboard. Only works as a result of user action (i.e. inside a `click` event listener). + +Create a new `