Skip to content

Instantly share code, notes, and snippets.

View Fosna's full-sized avatar

Vedran Marsic Fosna

View GitHub Profile
#!/bin/bash
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
# git lg-- show log as a tree for current branch ONLY
git config --global alias.lga "log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %
an%C(reset)%C(bold yellow)%d%C(reset)' --all"
[merge]
tool = kdiff3
[mergetool "kdiff3"]
path = /usr/local/bin/kdiff3
trustExitCode = false
[diff]
guitool = kdiff3
[difftool "kdiff3"]
path = /usr/local/bin/kdiff3
trustExitCode = false
// Place your key bindings in this file to override the defaultsauto[]
[
{
"key": "ctrl+alt+down",
"command": "merge-conflict.next"
},
{
"key": "ctrl+alt+up",
"command": "merge-conflict.previous"
},
@Fosna
Fosna / redirectToHttps.ts
Last active January 26, 2018 11:28
AWS Elastic Beanstalk: Redirect HTTP traffic to HTTPS in load balancing scenario. However, this breaks POST requests. It's not relevant for my scenario, but it might be relevant for yours.
import { Request, Response, NextFunction } from 'express';
import { logger } from '../../configuration/logger.config';
/*
Redirect HTTP traffic to HTTPS in load balancing scenario.
Load balancer accepts HTTP request and forwards it to web instances.
Web instance receives it and issues redirect to HTTPS.
Web instance can't check if request was sent using secure connection
because load balancer strips HTTPS traffic and sends it via HTTP to web instances.
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="content-type" content="text/html; charset=UTF8">
<link rel="stylesheet" href="http://www.joelotter.com/kajero/dist/main.css">
</head>
<body>
@Fosna
Fosna / README.md
Created November 12, 2017 09:04
workshop-requirements readme

Install Git

We'll cover three major OS platforms:

Command line clients

Linux

We'll use our distro's package system and follow instrcutions from official Git website

-- Recreate
DROP TABLE IF EXISTS product_category;
DROP TABLE IF EXISTS product_category_history;
CREATE TABLE product_category(
product_category_id int NOT NULL,
parent_product_category_id int NULL,
name varchar(255) NOT NULL,
--run on shed.database.windows.net, Ant
-- 2Pm
-- goto ln 95
/***************************************************
Recreate schema
****************************************************/
if exists (
select t.name
@Fosna
Fosna / fizzBuzz.txt
Created September 25, 2017 13:57
FizzBuzz Kata in Clojure
; https://repl.it/languages/clojure
; https://learnxinyminutes.com/docs/clojure/
(ns fizzBuzzKata)
(defn assertAreEqual
(
[expected, actual]
(if (= expected actual)
(println "pass")
@Fosna
Fosna / fizzBuzz.js
Created September 25, 2017 13:45
FizzBuzz Kata in Chrome Dev Tools
/*
If the value is a multiple of 3: use the value 'Fizz' instead
If the value is a multiple of 5: use the value 'Buzz' instead
If the value is a multiple of 3 & 5: use the value 'FizzBuzz' instead
fizzBuzz(num); // => "Fizz"
*/
clear();
function test(expected, actual, errMsg) {