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 <[email protected]> | |
* @license MIT | |
*/ | |
import mitt from 'mitt' | |
const emitter = mitt() |
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
<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 | |
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
/** | |
* 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
/** | |
* 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
/** | |
* Binary Tree Exercise | |
* | |
* Given a binary tree, similar to shape as below, write an algorithm | |
* to count the number of times each `value` appears. | |
* | |
* Assumptions: | |
* | |
* 1. each node will have a `value` prop | |
* 2. each node may or may not have a `left` prop |
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
import puppeteer from 'puppeteer' | |
const browser = await puppeteer.launch({ | |
args: [ | |
'--no-sandbox' | |
], | |
timeout: 10000 | |
}) | |
const page = await browser.newPage() | |
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
<?php | |
// theme functions.php | |
add_filter('autoptimize_filter_js_minify_excluded', function ($condition, $url) { | |
if (!$blacklist = get_option('autoptimize_js_exclude', false)) | |
return true; | |
$blacklist = array_filter(array_map('trim', explode( ',', $blacklist))); | |
return count(array_filter($blacklist, function ($match) use ($url) { |
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
node_modules | |
**/node_modules | |
**/*.md | |
**/*.json | |
**/.gitignore | |
**/gulpfile.js | |
**/Gruntfile.js | |
**/package-lock.json | |
**/package.json |
NewerOlder