Skip to content

Instantly share code, notes, and snippets.

View dhargitai's full-sized avatar
💭
Everything is awesome 😎

David Hargitai dhargitai

💭
Everything is awesome 😎
View GitHub Profile
@dhargitai
dhargitai / LoadNodeVersionBasedOnNvmRcFile.sh
Created February 16, 2021 09:45
Put this at the end of .zshrc
autoload -U add-zsh-hook
load-nvmrc() {
local node_version="$(nvm version)"
local nvmrc_path="$(nvm_find_nvmrc)"
if [ -n "$nvmrc_path" ]; then
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
if [ "$nvmrc_node_version" = "N/A" ]; then
nvm install
mongoexport --uri="mongodb://username:pass@0.0.0.0:27017/strapi" --authenticationDatabase=admin --authenticationMechanism=SCRAM-SHA-256 --collection=products --out=/bckp/products.json
@dhargitai
dhargitai / machine.js
Last active November 16, 2020 07:57
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@dhargitai
dhargitai / machine.js
Last active October 16, 2020 11:40
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@dhargitai
dhargitai / vscode-keyboard-shortcuts.json
Created October 7, 2020 15:49
My VSCode keyboard shortcuts
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "alt+cmd+l",
"command": "editor.action.formatDocument",
"when": "editorHasDocumentFormattingProvider && editorTextFocus && !editorReadonly"
},
{
"key": "shift+alt+f",
"command": "-editor.action.formatDocument",
@dhargitai
dhargitai / vscode-settings.json
Created October 7, 2020 15:43
My VSCode settings
{
"editor.snippetSuggestions": "top",
"editor.formatOnPaste": true,
"editor.fontSize": 14,
"files.autoSave": "onWindowChange",
"editor.rulers": [
100
],
"editor.scrollBeyondLastLine": false,
"[yaml]": {
@dhargitai
dhargitai / machine.js
Created October 7, 2020 14:19
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
alias gitpurge='git branch --merged | egrep -v "(^\*|master|develop)" | xargs -n 1 git branch -d'
alias mirror='wget -p -k -e robots=off -H'
let generateCode = (givenOptions = {}) => {
const {pool, length} = {
...{length: 3, pool: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'.split('')},
...givenOptions
};
let code = '';
while (code.length < length) {
code += pool[Math.floor(Math.random() * pool.length)];
}
return code;
<tbody>
<tr>
<?php foreach ( $attributes as $attribute_name => $options ) : ?>
<td class="label" style="width: 50%;"><label for="<?php echo esc_attr( sanitize_title( $attribute_name ) ); ?>"><?php echo wc_attribute_label( $attribute_name ); // WPCS: XSS ok. ?></label></td>
<?php endforeach; ?>
</tr>
<tr>
<?php foreach ( $attributes as $attribute_name => $options ) : ?>
<td class="value">
<?php