Skip to content

Instantly share code, notes, and snippets.

View mishak87's full-sized avatar

Michal Gebauer mishak87

View GitHub Profile
case class Segment(hash: Int, str: String)
sealed trait DiffGroup
case class NewLine(str: String) extends DiffGroup
case class Diffs(diffs: Seq[Diff]) extends DiffGroup
sealed trait Diff { def pos: Int }
case class Addition(pos: Int, str: String) extends Diff
case class Deletion(pos: Int, len: Int) extends Diff
@mishak87
mishak87 / copy-repo.sh
Last active October 20, 2015 09:29
Copy repository ie. from gitosis to gitlab
#!/bin/bash
dir=$(mktemp -d)
old=$1
new=$2
git clone "$old" "$dir"
cd "$dir"
git remote add new "$new"
git push -u new master
@paulirish
paulirish / what-forces-layout.md
Last active June 19, 2024 15:52
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@mishak87
mishak87 / README.md
Last active April 20, 2016 11:56
Docker Daily

Tools and tips that make my day better.

Holy Trinity for debugging

export TERM=xterm
apt-get update -yq && apt-get install -yq mc vim htop

DVC all the way

@mishak87
mishak87 / IDEA.md
Last active August 29, 2015 14:17
Building multiple versions docker-library/<project> using Makefile

Simple tool for building/uploading multiple versions of docker-library/ like projects

Default directory structure

[docker/]<main.minor>[/<optional>]/Dockerfile

1.) Collect tags

foreach <main>.<minor>
    if -f <main>.<minor>/Dockerfile
 tags[.]=.
@staltz
staltz / introrx.md
Last active June 21, 2024 12:27
The introduction to Reactive Programming you've been missing
@mishak87
mishak87 / DbalBatchFile.php
Created June 18, 2014 22:43
With <3 for Hosiplan
<?php
namespace Kdyby\Doctrine\Console;
use Kdyby;
use Kdyby\Doctrine\BatchImportException;
use Kdyby\Doctrine\Helpers;
use Rixxi;
use Symfony;
@mishak87
mishak87 / deploy.sh
Last active August 29, 2015 14:02
Simple deploy script for demo/sandbox server - supports changed file
#!/bin/bash
echo "Deploy launched."
# fetch new version
git fetch origin
# check for changes
CHANGES=$(git status -s)
<?php
namespace App\Listeners;
use Kdyby\Events\Annotations as Event;
/**
* @Event\Subscriber([<class>])
* <class> is set as default for all handlers
@felixrabe
felixrabe / string-utils.coffee
Last active September 29, 2023 16:39
CoffeeScript: String.startsWith() and String.endsWith()
# http://stackoverflow.com/a/646643
String::startsWith ?= (s) -> @slice(0, s.length) == s
String::endsWith ?= (s) -> s == '' or @slice(-s.length) == s