Skip to content

Instantly share code, notes, and snippets.

View chodorowicz's full-sized avatar

Jakub Chodorowicz chodorowicz

View GitHub Profile
@chodorowicz
chodorowicz / acf-options.php
Created June 21, 2016 22:19
ACF register options page WordPress #Wordpress
<?php
/** simple */
acf_add_options_page("Site Options");
/** complex */
if( function_exists('acf_add_options_page') ) {
acf_add_options_page(array(
'page_title' => 'Theme General Settings',
'menu_title' => 'Theme Settings',
@chodorowicz
chodorowicz / repeater.php
Created June 21, 2016 22:17
ACF WordPress repeater field #WordPress
<?php if(get_field('gallery_images')): ?>
<?php while(the_repeater_field('gallery_images')): ?>
<img src="<?php the_sub_field('image'); ?>" alt="<?php the_sub_field('alt'); ?>" />
<?php endwhile; ?>
<?php endif; ?>
@chodorowicz
chodorowicz / .stylintrc
Created June 21, 2016 09:36
[debug] stylint issues
{
"blocks": false,
"brackets": "never",
"colons": "always",
"colors": "always",
"commaSpace": "always",
"commentSpace": "always",
"cssLiteral": "never",
"depthLimit": false,
"duplicates": true,
@chodorowicz
chodorowicz / create.sh
Created June 17, 2016 11:15
create ssh certificate
#!/bin/sh
# ./make-ssl-keys.sh hello.dev
#
# https://gist.github.com/jed/6147872
# https://gist.github.com/jimothyGator/5436538
#
# put hello.dev.crt and hello.dev.key in etc/nginx
# add to nginx server conf for hello.dev 443
# ssl on;
@chodorowicz
chodorowicz / isotope.js
Created June 16, 2016 09:21
isotope fitRows example
/**
* 20px gutter between columns
* using imagesLoaded
**/
const $grid = $('.js-features');
$grid.imagesLoaded(() => {
$grid.isotope({
filter: '.b2b',
itemSelector: '.js-featuresItem',
@chodorowicz
chodorowicz / vertical.scss
Last active June 16, 2016 08:08
some fonts when all caps are difficult to center since height of the line takes has descenders included (even when they're not there) / CSS
@mixin addTopOffsetToVisuallyCenter() {
/** all caps don't look vertically centered, becase height of span (for Lasiver font at least) takes into accoutn descenders, even if they're not used
** so, that 'top' should counter that
*/
position: relative; top: 0.15em;
}
@chodorowicz
chodorowicz / get_ultimate_parent.php
Last active June 16, 2016 07:13
get term ultimate parent / WordPress
<?php
function get_term_ultimate_parent($id, $taxonomy) {
$ancestors = get_ancestors($id, $taxonomy);
return get_term(end($ancestors), $taxonomy);
}
@chodorowicz
chodorowicz / get_term_level.php
Last active October 1, 2023 01:38
get depth level of current term on taxonomy archive page
<?php
// http://stackoverflow.com/questions/22307013/wordpress-get-current-level-of-taxonomy-in-an-archive-page
function get_tax_level($id, $tax) {
$ancestors = get_ancestors($id, $tax);
return count($ancestors) + 1;
}
$current_term_level = get_tax_level(get_queried_object()->term_id, get_queried_object()->taxonomy);
@chodorowicz
chodorowicz / smtp-sender.js
Created June 15, 2016 15:58
send emails using email.js
require('dotenv').config();
const email = require('emailjs');
const _ = require('lodash');
const smtpUser = process.env.SMTP_USER;
const smtpPassword = process.env.SMTP_PASSWORD;
const smtpHost = process.env.SMTP_HOST;
const smtpFrom = process.env.SMTP_FROM;
const smtpToSales = process.env.SMTP_TO_SALES;
@chodorowicz
chodorowicz / gulpfile.js
Created June 15, 2016 14:47
assets versioning with gulp-rev, gulp-rev-replace, run-sequence (single folder for both dev and prod)
gulp.task('sass', function () {});
gulp.task('browserify', function () {});
// other tasks...
const paths = {
web: './web/',
webAssets: './web/assets/',
webImages: './web/images/',
};