Skip to content

Instantly share code, notes, and snippets.

View LukasRychtecky's full-sized avatar

Lukáš Rychtecký LukasRychtecky

View GitHub Profile
@LukasRychtecky
LukasRychtecky / chcommiter.sh
Created June 29, 2013 07:21
Changes a commiter's email address
git filter-branch --commit-filter '
if [ "$GIT_AUTHOR_EMAIL" = "foo" ];
then
GIT_AUTHOR_EMAIL="bar";
git commit-tree "$@";
else
git commit-tree "$@";
fi' HEAD
@LukasRychtecky
LukasRychtecky / allcommitters.sh
Last active December 19, 2015 03:29
Filtrates all project's committers
git log --raw | grep -e "^Author: " -e "^Commit: " | sort | uniq -c
@LukasRychtecky
LukasRychtecky / clean_public.sh
Created December 12, 2013 18:42
Removes all merged branches into next in a public repo.
git branch -a --merged remotes/origin/next | grep -v -E "master|next|release" | grep "public" | cut -d "/" -f 3 | xargs -n 1 git push --delete public
@LukasRychtecky
LukasRychtecky / controller.php
Created January 9, 2014 10:26
Best practice - i tohle jsou studenti schopni mi odevzdat
<?php
class indexController extends Controller {
public $head = 1;
var $name = "Vytvoření účtu";
/**
* Automatický text pro template - titulek (TITLE)
*/
@LukasRychtecky
LukasRychtecky / .vimrc
Created October 19, 2014 09:34
.vimrc
set nocompatible
" Use pathogen to easily modify the runtime path to include all
" plugins under the ~/.vim/bundle directory
call pathogen#helptags()
call pathogen#infect()
" change the mapleader from \ to ,
let mapleader=","
@LukasRychtecky
LukasRychtecky / postgresq_move_data.sh
Created August 15, 2015 14:23
Moves PostgreSQL's data directory into new direction
sudo su - postgres
service postgresql stop
mv /var/lib/postgresql /srv/postgresql
sudo chown -R postgres:postgres /srv/postgres/
ln -s /srv/postgresql /var/lib/postgresql
chown -R postgres:postgres /var/lib/postgresql
service postgresql start
@LukasRychtecky
LukasRychtecky / freeup.sh
Created January 3, 2016 09:14
Free up a memory on Ubuntu
echo 1 > /proc/sys/vm/drop_caches
echo 2 > /proc/sys/vm/drop_caches
echo 3 > /proc/sys/vm/drop_caches
sync
@LukasRychtecky
LukasRychtecky / destructuring.clj
Created May 25, 2017 06:41
Over-using destructuring in Clojure
(defn render
[{{poster :poster} :data :as notification}]
...)
vs.
(defn render
[notification]
(let [poster (-> notification :data :poster)]
...)
;; VERSION 0
(defn- validate-request=
[input]
(if (valid? ...)
(rop/succeed input)
(rop/fail {:status 400})))
(defn- create-user!
[{:keys [conf request] :as input}]
(ns datetime
(:require [cljs-time.format :refer [formatter unparse parse formatters]]
[clojure.string :as string]))
(def human-date-fmt (formatter "dd. MM. yyyy"))
(defn fmt
"Formats a given `datetime` by a given `fmt` or a default formatter."
([datetime fmt]
(when-not (string/blank? datetime)