This file contains hidden or 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
package tools | |
import ( | |
"net/http" | |
"github.com/gin-gonic/gin" | |
) | |
type HttpErr struct { | |
Err error |
This file contains hidden or 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
# with color prompt | |
PS1="\[\033[95m\]\u@\h \[\033[32m\]\W\[\033[33m\] [\$(git symbolic-ref --short HEAD 2>/dev/null)]\[\033[00m\]\$ " | |
# without | |
PS1="\u@\h \W [\$(git symbolic-ref --short HEAD 2>/dev/null)]\$ " |
This file contains hidden or 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 | |
/* | |
Plugin Name: LI Woo Shortcode | |
Plugin URI: http://li.last.nl | |
Description: Add Product Price in WooCommerce as a Shortcode | |
Version: 1.0 | |
Author: Lucian I. Last | |
Author URI: https://li.last.nl | |
License: GPL2 |
This file contains hidden or 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 | |
/* | |
Plugin Name: LI Sitemap | |
Plugin URI: http://li.last.nl | |
Description: A very basic sitemap plugin | |
Version: 1.0 | |
Author: Lucian I. Last | |
Author URI: https://li.last.nl | |
License: GPL2 |
This file contains hidden or 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 | |
dirs=("api" "api2") | |
for d in "${dirs[@]}" | |
do | |
pushd $d | |
git pull | |
popd | |
done |
This file contains hidden or 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 VueI18n, { | |
Path, Values, Locale, | |
} from 'vue-i18n/types' | |
/** | |
* Overloads VueI18n interface to avoid needing to cast return value to string. | |
* @see https://github.com/kazupon/vue-i18n/issues/410 | |
*/ | |
declare module 'vue-i18n/types' { | |
export default class VueI18n { |
This file contains hidden or 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
/** | |
* https://dirask.com/posts/TypeScript-convert-enum-to-array-ZDN4nj | |
*/ | |
class EnumReflection { | |
private static REGEXP : RegExp = /^[0-9]+$/g; | |
private static isString<T>(name : string) : boolean { | |
if(name.match(this.REGEXP)) | |
return false; |
This file contains hidden or 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
export function getObj<V>(getObj: () => V): V | undefined { | |
let value: undefined | V; | |
let shouldReturnUndefined: boolean = false; | |
try { | |
value = getObj(); | |
} catch (e) { | |
if (e instanceof TypeError) { | |
shouldReturnUndefined = true; | |
} | |
} |
This file contains hidden or 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 | |
for file in $(find . -path ./node_modules -prune -false -o -name "*.scss") | |
do npx sass ${file}:${file%.scss}.css; | |
echo $file | |
done |
This file contains hidden or 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 copyToClipboard = str => { | |
const el = document.createElement('textarea'); | |
el.value = str; | |
el.setAttribute('readonly', ''); | |
el.style.position = 'absolute'; | |
el.style.left = '-9999px'; | |
document.body.appendChild(el); | |
el.select(); | |
document.execCommand('copy'); | |
document.body.removeChild(el); |