Jakub Chodorowicz
Young/Skilled
@chodorowicz
github.com/chodorowicz
This file contains 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 | |
if (!function_exists('get_translated_media_or_original')) { | |
function get_translated_media_or_original($media_file_id) { | |
global $wpdb; | |
// check language of media file | |
$custom_query = "SELECT * FROM ".$wpdb->postmeta." WHERE meta_key='wpml_media_lang' AND post_id=".$wpdb->escape($media_file_id); | |
$meta = $wpdb->get_results( $custom_query ); | |
$media_file_language = $meta[0]->meta_value; | |
// if language of media file equals current language, return that id | |
if($media_file_language == ICL_LANGUAGE_CODE) { |
This file contains 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
root = true | |
[*] | |
end_of_line = lf | |
insert_final_newline = true | |
indent_style = space | |
indent_size = 2 | |
charset = utf-8 | |
trim_trailing_whitespace = true |
This file contains 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
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'; |
This file contains 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
# find files in several folders | |
find foo bar baz -name "*.py" | |
# find | |
find . -name "__tests__" | |
# used with Mocha → find spec files in app and test folders | |
mocha $(find test app -path *.spec.js) | |
# find recursivelly all symlinks |
This file contains 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
// count elements | |
// http://webdriver.io/api/protocol/elements.html | |
browser.elements('.OrdersList .Row') | |
.then(elements => { | |
assert.equal(elements.value.length, 999); | |
}) |
This file contains 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
o/ o/ \ / | |
| | | | |
/ \ / \ /o\ | |
L(・o・)」 |
Proposal for a lightning talk at the Reactive 2016 conference → https://reactiveconf.com
Star ⭐ the Gist to vote on this talk.
Redux saga is side effects middleware which allows us to orchestrate even very complex logical flows - think multiple AJAX request which depending on the responses, writing state to localstorage etc. More over it's output are descriptions of actions which can be later processed by middleware, which makes it pure and easily testable. This talk would be a short intro to redux-saga, which would hightlight benefits of concentrating all of side effect in one place and making both actions creators and sagas pure and easily testable.
This file contains 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
# run your usual build scripts e.g. | |
# npm install | |
# npm run build | |
# download selenium standalone jar | |
wget http://selenium-release.storage.googleapis.com/2.53/selenium-server-standalone-2.53.0.jar | |
# run selenium using xvfb | |
# set web driver path | |
# get path to chrome.driver ➡️ which chromedriver |
This file contains 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
/** 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!')}, |