Skip to content

Instantly share code, notes, and snippets.

Jakub Chodorowicz chodorowicz

Block or report user

Report or block chodorowicz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@chodorowicz
chodorowicz / analytics-00.js
Last active Jul 30, 2018
TypeScript + Google Analytics = ❤️
View analytics-00.js
function initAnalytics() {
(function(i,s,o,g,r,a,m) {i["GoogleAnalyticsObject"]=r;i[r]=i[r]||function() {
(i[r].q=i[r].q ||[]).push(arguments);},i[r].l= 1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m);
})(window, document, "script", "//www.google-analytics.com/analytics.js", "ga");
ga("create", "UA-XXXXXXXX-X", "auto");
ga("send", "pageview");
}
@chodorowicz
chodorowicz / walker.php
Created Feb 21, 2017
remove li from wp_nav_menu, preserve classes, custom walker
View walker.php
<?php
// based on, fixed warnings http://www.designtoday.info/removing-li-menu-from-wordpress/
class Description_Walker extends Walker_Nav_Menu {
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {
$classes = empty($item->classes) ? array () : (array) $item->classes;
$class_names = join(' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
!empty ( $class_names ) and $class_names = ' class="'. esc_attr( $class_names ) . '"';
$output .= "";
$attributes = '';
@chodorowicz
chodorowicz / .zshrc
Last active Feb 27, 2018
zplug .zshrc
View .zshrc
source ~/.zplug/init.zsh
export HISTFILE=~/.zsh_history # Where it gets saved
export HISTSIZE=10000
export SAVEHIST=10000
setopt append_history # Don't overwrite, append!
setopt INC_APPEND_HISTORY # Write after each command
setopt hist_expire_dups_first # Expire duplicate entries first when trimming history.
setopt hist_fcntl_lock # use OS file locking
setopt hist_ignore_all_dups # Delete old recorded entry if new entry is a duplicate.
View ascii.txt
o/ o/ \ /
| | |
/ \ / \ /o\
L(・o・)」
@chodorowicz
chodorowicz / config.js
Last active Aug 17, 2018
react-storybook samples
View config.js
/**
* dynamically loading all stories with .stories.js extension
*/
import { configure } from '@kadira/storybook';
require('es6-promise').polyfill();
import 'babel-polyfill';
const stories = require.context('../app/js/components', true, /.stories.js$/);
function loadStories() {
View express-nunjucks.js
require('dotenv').config({ silent: true });
var express = require('express');
var app = express();
var port = process.env.PORT || 3002;
var smptSender = require('./smtp-sender');
var bodyParser = require('body-parser')
const compress = require('compression');
const nunjucks = require('nunjucks');
const isDeveloping = process.env.NODE_ENV !== 'production';
View assertions.js
// count elements
// http://webdriver.io/api/protocol/elements.html
browser.elements('.OrdersList .Row')
.then(elements => {
assert.equal(elements.value.length, 999);
})
@chodorowicz
chodorowicz / events.js
Last active Aug 3, 2016
JavaScript DOM events
View events.js
/** attach event diretly to DOM element */
var myelement = document.getElementById('my-div');
myelement.onclick = function() {
alert('Ouch!');
}
/** add event listener */
var mypara = document.getElementById('my-div');
mypara.addEventListener('click',
function() {alert('Boo!')},
View server.js
const express = require('express');
const nunjucks = require('nunjucks');
const app = express();
const nunjucksConfig = {
autoescape: true,
express: app
};
You can’t perform that action at this time.