Skip to content

Instantly share code, notes, and snippets.

@arathunku
arathunku / progress-bar.cljs
Last active August 29, 2015 14:27
Simple progress bar. #ClojureScript #React #Reframe #Reagent
(ns xxx.components.progress-bar
(:require [re-frame.core :refer [subscribe dispatch]]))
(def COLOR "rgb(178, 34, 34)")
(def VISIBLE-STYLE {:height 2 :opacity 1 :color COLOR :background-color COLOR })
(def PRGORESS-BAR-CONTAINER-STYLE {:position "fixed"
:margin 0
:padding 0
:top 0
:left 0
@arathunku
arathunku / git-aliases
Created August 26, 2015 19:31
git aliases
#/bin/bash
echo 'alias g=git' >> ~/.zshrc
g config --global alias.ca 'commit --amend --reuse-message=HEAD'
g config --global alias.ci commit
g config --global alias.cp cherry-pick
g config --global alias.cl clone
g config --global alias.co checkout
g config --global alias.f fetch
g config --global alias.b branch
g config --global alias.s status
  • README needs to tell what to edit before we connect to DB
@arathunku
arathunku / The Technical Interview Cheat Sheet.md
Created September 22, 2015 22:34 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@arathunku
arathunku / rdp.clj
Last active March 10, 2026 13:31
Simple Ramer-Douglas-Peucker algorithm in clojure
(ns rdp.core)
; Ramer-Douglas-Peucker algorithm based on http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm
(defn- dist [point start end]
(let [num (- (* (- (first end) (first start))
(- (last start) (last point)))
(* (- (first start) (first point))
(- (last end) (last start))))
var result =
Array.prototype.slice.call(document.querySelectorAll('.semester .data')).
map(function(t) {
var td = t.querySelectorAll('td');
return[t.querySelector('[data-title="nazwaKursu"]').innerText,
parseFloat(t.querySelector('[title="ocena"]').innerText, 10),
parseFloat(td[td.length -1 ].innerText, 10)
];
}).reduce(function(r, t) {
return [r[0] + (t[1] * t[2]), r[1] + t[2]]
@arathunku
arathunku / keys.md
Last active January 30, 2016 08:09
  • install xcape
  • run: xcape -e 'Shift_L=Escape;Control_L=Control_L|G;Caps_Lock=Control_L|G'

Holding SHIFT/CTRL/CAPS keys will work as usual, simple press will work as ESC(Shift)/CTRL+G(ctrl/caps)

@arathunku
arathunku / wat.md
Last active February 3, 2016 07:33
def self.fetch_by_tracking_code(tracking_code)
  Domain.where(tracking_code: tracking_code).take
end

gives: (no default scopes)

"SELECT "domains".* FROM "domains" WHERE 
@arathunku
arathunku / problem.js
Last active February 4, 2016 14:26
https://youtu.be/605C8l_g5fo | After expanding the list, scrolling down and clicking on an element to close the list, the height of the ScrollView is not recalculated and there's a blank screen.
'use strict';
import React, {
AppRegistry,
Component,
StyleSheet,
Text,
View,
ScrollView,
TouchableOpacity
} from 'react-native';
@arathunku
arathunku / config.ex
Created April 21, 2017 07:32 — forked from jmglov/config.ex
Elixir: override Mix config with environment variables
defmodule Config do
defmacro __using__(_) do
quote do
import unquote(__MODULE__), only: :macros
end
end
defmacro cfg(key, type \\ :string) do
quote do
defp unquote(key)() do