Skip to content

Instantly share code, notes, and snippets.

🌍
Working on Trisbee

Michal Landsman landsman

View GitHub Profile
@landsman
landsman / DevTools.java
Last active Mar 26, 2019
dump whatever object type you want to console output, inspired by https://dzone.com/articles/introduction-to-json-with-java
View DevTools.java
package helper;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
public final class DevTools
{
public static String dump(Object stuff) throws JsonProcessingException {
System.out.println(convertObject(stuff));
return null;
View RouterFactory.php
<?php
namespace App;
use Nette;
use Nette\Application\Routers\RouteList;
use Nette\Application\Routers\Route;
use Kdyby\Doctrine\EntityManager;
use App\Model\CatalogModel;
use App\Model\PageModel;
@landsman
landsman / fix_airbank_ib.js
Created Feb 4, 2019
Dear Airbank, this is tutorial how to fix your Internet Banking. Leave me there email where can I send invoice. Thanks.
View fix_airbank_ib.js
let popHandler = () => {
document.getElementById("id22a").click(); // click on your stupid fake go back button
}
window.addEventListener('popstate', popHandler, {once: true})
window.history.pushState(null,null,null)
@landsman
landsman / docker_dev.sh
Last active Feb 25, 2019
Pass variables for each docker-compose file - two environments
View docker_dev.sh
#!/bin/bash
echo "Starting fresh containers for DEVELOPMENT"
docker/variables.sh dev.env
docker-compose -f docker/dev/docker-compose.yml up --build --remove-orphans
@landsman
landsman / UTF8Control.java
Created Jan 2, 2019 — forked from DemkaAge/UTF8Control.java
ResourceBundle UTF-8 Control class
View UTF8Control.java
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.Locale;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
@landsman
landsman / .htaccess
Created Dec 9, 2018
webp pres htacesss - drupal coloseum
View .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
# Check if browser support WebP images
RewriteCond %{HTTP_ACCEPT} image/webp
# Check if WebP replacement image exists
RewriteCond %{DOCUMENT_ROOT}/$1.$2.webp -f
# Serve WebP image instead
RewriteRule (.+)\.(jpe?g|png)$ $1.$2.webp [T=image/webp,E=accept:1]
</IfModule>
<IfModule mod_headers.c>
View ec2-root-resize.sh
#!/bin/bash -e
if [ $# -ne 2 ]; then
echo "Usage: $0 <instance-id> <volume-size-gb> [PARITION_NAME=/dev/xvda2]"
exit 2
fi
sudo apt-get install jq -y
@landsman
landsman / .gitlab-ci.yml
Created Oct 11, 2018
Pristupy v settings projektu nastavit jako secured value
View .gitlab-ci.yml
stages:
- deploy
build:
stage: deploy
environment:
name: production
image: mwienk/docker-lftp:latest
script:
- mv .htaccess-dist .htaccess
View dump.sql
-- Adminer 4.6.3 PostgreSQL dump
DROP TABLE IF EXISTS "venues";
DROP SEQUENCE IF EXISTS venues_id_seq;
CREATE SEQUENCE venues_id_seq INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1;
CREATE TABLE "public"."venues" (
"id" integer DEFAULT nextval('venues_id_seq') NOT NULL,
"phone_number" text NOT NULL,
"name" text NOT NULL,
View .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
# fix one domain name with HTTPS
#
RewriteCond %{HTTP_HOST} ^studioartcz.cz [NC]
RewriteRule ^(.*)$ https://www.studioart.cz/$1 [L,R=301]
# fix for poor hosting without www_root setup
#
You can’t perform that action at this time.