Skip to content

Instantly share code, notes, and snippets.

View chodorowicz's full-sized avatar

Jakub Chodorowicz chodorowicz

View GitHub Profile
@chodorowicz
chodorowicz / dropdown.php
Created June 15, 2016 01:06
sample config for wp_dropdown_categories
<?php
wp_dropdown_categories(array(
show_option_none => "Choose city",
show_count => 0,
orderby => "name",
taxonomy => "city",
name => "city",
selected => $city
));
@chodorowicz
chodorowicz / taxonomy.php
Last active June 15, 2016 00:42
get direct children of term on taxonomy archive page
<?php
$taxonomy_name = 'course-category';
$term_object = $wp_query->queried_object;
$get_terms_args = array(
'taxonomy' => $taxonomy_name,
'parent' => $term_object->term_id,
'hide_empty' => false
);
$term_children = get_terms($get_terms_args);
?>
@chodorowicz
chodorowicz / serialize.js
Created June 14, 2016 11:39
jQuery serialize form using serializeArray
function serializeForm($form) {
return $form.serializeArray().reduce( (result, input) => {
result[input.name] = input.value;
return result;
}, {}
);
}
@chodorowicz
chodorowicz / config.cson
Created June 9, 2016 15:10
atom expand regions config
".text.html.nunjucks":
"expand-region":
commands: [
{
command: 'expand-region:select-word-include-dash-and-dot',
recursive: false
},
{
command: 'expand-region:select-inside-double-quotes'
recursive: false
@chodorowicz
chodorowicz / watch.sh
Created June 2, 2016 20:40
fswatch + xargs + duck + export variables to environment to go around xargs 255 bytes limit when expanding command
export syncpath="/path/to/folder/"
export remotepath="sftp://aaa@000.000.000.000:2222/remote/path/"
export duckParameters="-y -existing overwrite -p PASSWORD --upload";
fswatch -0 ${syncpath} | xargs -0 -I % -t bash -c 'f="%"; rel=${f#"${syncpath}"}; duck ${duckParameters} ${remotepath}${rel} "${f}"; echo ${rel};'
@chodorowicz
chodorowicz / gulpfile.js
Created May 27, 2016 14:24
Lost PostCSS Sass + Gulp setup
var gulp = require('gulp');
var sass = require('gulp-sass');
var postcss = require('gulp-postcss');
var autoprefixer = require('autoprefixer');
var browserSync = require('browser-sync');
var lost = require('lost');
gulp.task('sass', function () {
gulp.src('./frontend/sass/main.scss')
.pipe(sass().on('error', sass.logError))
@chodorowicz
chodorowicz / browsersync.js
Last active September 1, 2018 14:27
BrowserSync custom host domain + snippet options
const browserSync = require('browser-sync').create();
const port = process.env.PORT || 8080;
const customDomain = environment.DEV_DOMAIN ? `${environment.DEV_DOMAIN}` : 'localhost';
browserSync.init('**/*.css', {
logPrefix: 'Showroom:',
proxy: `localhost:${port}`,
open: false,
host: customDomain,
port: 3000,
ghostMode: false, /* don't mirror interactions in other browsers */
@chodorowicz
chodorowicz / main.js
Last active June 29, 2016 18:13
Load HTML using pjax with CSS fade in / out transition
var $pjaxContainer = $('.js-pjaxContainer');
function pjaxLoad(target) {
$.pjax({
url: target,
container: '.js-pjaxContainer',
fragment: '.js-pjaxContainer',
});
}
@chodorowicz
chodorowicz / webpack.config.js
Created April 28, 2016 08:34
wepback exports sample config
var config = {
resolve: {
alias: {
waypoints: 'waypoints/lib/noframework.waypoints',
},
},
module: {
loaders: [
{
test: /node_modules\/waypoints\/lib\/noframework\.waypoints\.js$/,
@chodorowicz
chodorowicz / redux-ecosystem.md
Last active February 9, 2017 00:41
From Alt to Redux ecosystem (redux-actions, redux-thunk, react-redux, redux-saga)

From Alt to Redux ecosystem (redux-actions, redux-thunk, react-redux, redux-saga)

Jakub Chodorowicz

Young/Skilled

@chodorowicz
github.com/chodorowicz