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
/** | |
* Making Change Exercise | |
* | |
* Given an amount of money in USD, calculate the least number of | |
* coins needed to create the given amount of money. | |
* | |
* Example: | |
* | |
* Input: $1.67 | |
* |
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
/** | |
* Create a function that moves all capital letters to the front of | |
* a string/word. Keep the original relative | |
* order of all letters the same. | |
* | |
* Example: | |
* | |
* "hApPy" ➞ "APhpy" | |
*/ |
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
// for browser using, this code requires javascript 1.7+ | |
var arr = [ | |
{ foo: 'bar', lorem: 'ipsum' }, | |
{ foo: 'bar', lorem: 'ipsum' }, | |
{ foo: 'bar', lorem: 'ipsum dolor sit amet' } | |
]; | |
arr = arr.map(JSON.stringify).reverse() // convert to JSON string the array content, then reverse it (to check from end to begining) | |
.filter(function(item, index, arr){ return arr.indexOf(item, index + 1) === -1; }) // check if there is any occurence of the item in whole array |
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
#!/bin/bash | |
set -e | |
GIT_EXCLUDE_FILE="./.git/info/exclude" | |
[ "$#" -lt 1 ] && echo -e "Please give at least one argument" && exit 1 | |
[ ! -d "./.git" ] && echo -e "It seems this directory is not a root dir of a git repo. Aborting." && exit 1 |
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
<template> | |
<div class="${TM_FILENAME_BASE/(^[A-Z])|([A-Z])/${2:+-}${2:/downcase}${1:/downcase}/g}"></div> | |
</template> | |
<script> | |
export default { | |
name: '${TM_FILENAME_BASE}', | |
components: {}, | |
props: {}, | |
data() { |
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
#!/bin/bash | |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | |
NVM_NODE_VERSION="" | |
NODE_VERSION=$(node --version) | |
IS_WSL=0 | |
SKIP_NVM=0 | |
if grep -q microsoft /proc/version >/dev/null 2>&1; then |
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
/** | |
* Vue 2 Plugin to add event bus support, using mitt library | |
* @see https://github.com/developit/mitt | |
* | |
* @author Julio Vedovartto <juliovedovatto@gmail.com> | |
* @license MIT | |
*/ | |
import mitt from 'mitt' | |
const emitter = mitt() |
OlderNewer