Skip to content

Instantly share code, notes, and snippets.

View wodCZ's full-sized avatar

Martin Janeček wodCZ

View GitHub Profile
@wodCZ
wodCZ / Dockerfile
Created March 20, 2018 13:39
production ready react docker multi-stage build with proper service-worker nginx configuration
FROM node:9.8.0-alpine as build
WORKDIR /usr/src/app
COPY package.json yarn.lock ./
RUN yarn
COPY . ./
RUN yarn build
FROM nginx:1.13.9-alpine
COPY ./nginx.conf /etc/nginx/nginx.conf
COPY --from=build /usr/src/app/build /usr/share/nginx/html
@wodCZ
wodCZ / example.js
Created February 21, 2018 15:34
react native least PITA video
return (<WebView
style={{
width: '100%',
aspectRatio: this.state.videoConfig.aspectRatio,
}}
onError={() => this.setState({offline: true})}
source={{
html: `
<head>
@wodCZ
wodCZ / Dockerfile
Created February 4, 2018 14:38
django, postgres, redis, celery, nginx, uwsgi docker setup
FROM python:latest
ADD requirements.txt /requirements.txt
RUN python3.6 -m venv /venv \
&& /venv/bin/pip install -U pip \
&& LIBRARY_PATH=/lib:/usr/lib /bin/sh -c "/venv/bin/pip install --no-cache-dir -r /requirements.txt"
ENV PYTHONUNBUFFERED 1
# Copy your application code to the container (make sure you create a .dockerignore file if any large files or directories should be excluded)
RUN mkdir /code/

Keybase proof

I hereby claim:

  • I am wodcz on github.
  • I am wodcz (https://keybase.io/wodcz) on keybase.
  • I have a public key ASCttfDh5fWqmFvK8uLMo-lA1SqBz_qQojGYDnpLOa7mAAo

To claim this, I am signing this object:

<?php
/**
* Simple message queue implementation.
*/
class Extra_MessageQueue
{
private $maxRunTime;
private $startTime;
private $queue;
@wodCZ
wodCZ / Dockerfile
Created August 15, 2017 14:16
cron container
FROM openjdk:alpine
WORKDIR /usr/src/app
COPY build /usr/src/app
CMD ["/usr/src/app/job.sh"]
<?php
/**
* This is project's console commands configuration for Robo task runner.
*
* @see http://robo.li/
*/
class RoboFile extends \Robo\Tasks
{
const CONFIG_PATH = __DIR__ . '/app/config/config.local.neon';
@wodCZ
wodCZ / getChange.php
Last active September 17, 2016 18:42 — forked from algb12/getChange.php
<?php
// This function takes an array of denominators for a currency and a sum, and returns an array describing the most efficient way to express the sum in terms of denominations.
// E.g. A sum, such as 200 EUR can be expressed in terms of 100x2, which is inefficient, as there is the denomination 200 for this job.
// The function will return the most efficient way to express the sum, not 100x2, but 200x1.
// Recommended to round both, the expected and actual value to 2 decimal places.
// FUNCTION
// getChange function
function getChange($sum, $denominations) {
@wodCZ
wodCZ / example.php
Last active August 31, 2016 13:30
example article component and usage
<?php
// presenter
class ArticlePresenter extends Presenter {
/** @var \App\Components\IArticleControl @inject */
public $articleControlFactory;
/** @var \App\Model\Articles @inject */
@wodCZ
wodCZ / CartPreviewComponent.php
Created July 25, 2016 20:26
Component example
<?php
class CartPreviewComponent {
public function __construct(CartModel $cartModel, $userId){
$this->cartModel = $cartModel;
$this->userId = $userId;
}
public function render(){