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
# i3 config file (v4) | |
# Please see http://i3wm.org/docs/userguide.html for a complete reference! | |
# Set mod key (Mod1=<Alt>, Mod4=<Super>) | |
set $mod Mod1 | |
# set default desktop layout (default is tiling) | |
# workspace_layout tabbed <stacking|tabbed> | |
# Configure border style <normal|1pixel|pixel xx|none|pixel> |
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
# This file has been auto-generated by i3-config-wizard(1). | |
# It will not be overwritten, so edit it as you like. | |
# | |
# Should you change your keyboard layout some time, delete | |
# this file and re-run i3-config-wizard(1). | |
# | |
# i3 config file (v4) | |
# | |
# Please see http://i3wm.org/docs/userguide.html for a complete reference! |
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 is = require('is_js') // require this awesome library | |
const notEmpty = o => | |
is.not.empty(o) && Object.keys(o).map(key => { | |
return is.array(o[key]) | |
? !is.all.empty(o[key]) | |
: is.not.empty(o[key]) | |
}).reduce((a, b) => a && b, true) | |
// empty examples |
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 config = require('./config') | |
const knex = require('knex')(config.db) | |
const QueryBuilder = require('knex/lib/query/builder') | |
QueryBuilder.prototype.paginate = function ({ limit = 10, page = 1 }) { | |
const offset = (page - 1) * limit | |
return Promise.all([ | |
this.clone().count('* as count').first(), | |
this.offset(offset).limit(limit) |
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
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[green]%}" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}!" | |
ZSH_THEME_GIT_PROMPT_CLEAN="" | |
function prompt_char { | |
if [ $UID -eq 0 ]; then echo "%{$fg[red]%}#%{$reset_color%}"; else echo λ; fi | |
} | |
#PROMPT='%{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}%m%{$reset_color%}: %{$fg_bold[blue]%}%~%{$reset_color%}$(git_prompt_info) |
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
# Colors (Nord) | |
# colors: | |
# # Default colors | |
# primary: | |
# background: '0x2E3440' | |
# foreground: '0xD8DEE9' | |
# | |
# # Normal colors | |
# normal: | |
# black: '0x3B4252' |
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 filterWhitelist = ar => key => ar.includes(key) | |
const sliceState = (state, whitelist) => Object.keys(state) | |
.filter(filterWhitelist(whitelist)) | |
.reduce((sliced, key) => ({ ...sliced, [key]: state[key] }), {}) | |
// usage | |
const slicer = paths => state => { | |
const { ui, auth } = state |
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
.background { | |
background-color: #efefef; | |
} | |
.me { | |
background-color: tomato; | |
} | |
.ji { | |
background-color: orange; |
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
" NOTE: change 'input' with tag name | |
" this will insert '/' before closing the tag | |
" e.g <input type="text"> | |
" will become <input type="text"/> | |
%s/\(input.*\)\ze>/\1\/ |
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 | |
function wc_get_categories() { | |
$all_categories = get_categories(array( | |
'taxonomy' => 'product_cat' | |
)); | |
foreach ($all_categories as &$cat) { | |
$thumbnail_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true ); | |
$cat->thumbnail_image = wp_get_attachment_url( $thumbnail_id ); | |
$cat->link = get_term_link( $cat->slug, 'product_cat' ); |