Skip to content

Instantly share code, notes, and snippets.

View RafalSladek's full-sized avatar

Rafal Sladek RafalSladek

View GitHub Profile
@RafalSladek
RafalSladek / .gitlab-ci.yml
Last active July 18, 2021 11:59
gitlab ci file for gulp build pipeline with the latest nodejs
image: node:latest
cache:
paths:
- node_modules/
before_script:
- npm install
stages:
@RafalSladek
RafalSladek / prime_factors.scala
Created April 5, 2016 11:37
this recurisve function returns prime factors of given number
def getPrimeFactors(
yourNumber: Int,
primeFactors: List[Int]): List[Int] = {
for (i <- 2 to yourNumber if (yourNumber % i == 0)) {
return getPrimeFactors(yourNumber / 2, primeFactors :+ i)
}
primeFactors
}
getPrimeFactors(36, List())
@RafalSladek
RafalSladek / pureCss_less_more.html
Last active April 6, 2016 09:16
pure css solution for toggle show and hide of elements
<body>
<style>
.more {
display: none; #more is at the begin hidden
}
a.less:focus ~ ul.list {
display: none; #by click on less, list will be hidden
}
@RafalSladek
RafalSladek / pureCss_gradient_over_text.html
Last active April 6, 2016 13:16
pure css solution to create gradient over text at the bottom
<body>
<style>
.list {
margin-bottom: 0;
}
.gradient {
position: relative;
bottom: 30px;
height: 30px;
background: linear-gradient(to bottom, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 100%); <!-- support for W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+, for older browser please have a look at this page http://www.colorzilla.com/gradient-editor/ -->
@RafalSladek
RafalSladek / madeNodeListBetter.js
Created April 6, 2016 15:52
added forEach to node list
NodeList.prototype.forEach = Array.prototype.forEach;
#!/bin/sh
echo "Installing IntelliJ IDEA..."
# We need root to install
[ $(id -u) != "0" ] && exec sudo "$0" "$@"
# Attempt to install a JDK
# apt-get install openjdk-8-jdk
add-apt-repository ppa:webupd8team/java && apt-get update && apt-get install oracle-java8-installer
@RafalSladek
RafalSladek / arch-install-laptop.md
Created May 10, 2016 19:21
Arch Linux Laptop Install - E6430

Arch Install

Boot from Archlinux ISO on USB

  1. IF Wireless # wifi-menu
  2. timedatectl set-ntp true
  3. parted /dev/sda
  4. mklabel gpt - YES
  5. mkpart efi fat32 1MiB 1025MiB
  6. mkpart root ext4 1025MiB 31GiB
@RafalSladek
RafalSladek / .gitconfig
Created July 26, 2016 15:37
git config with git aliases
[user]
name = Rafal
email = [email protected]
[push]
default = matching
[ui]
color = auto
[alias]
st = status
pl = log --graph --pretty=\"%Cgreen%h%Creset – %ai – %s (%Cblueby %cn%Creset)\"
@RafalSladek
RafalSladek / tailRecursion.scala
Last active July 26, 2016 17:36
tail recursion with higher functions, final example a mapReduce
def product(f: Int => Int)(a: Int, b: Int): Int = {
if (a > b) 1
else f(a) * product(f)(a + 1, b)
}
product(x => x * x)(3, 4)
def fact(n: Int) = product(x => x)(1, n)
fact(5)
import math.abs
val tolerance = 0.0001
def isCloseEnough(x: Double, y: Double) =
abs((x - y) / x) / x < tolerance
def fixedPoint(f: Double => Double)(firstGuess: Double) = {
def iterate(guess: Double): Double = {
val next = f(guess)
if (isCloseEnough(guess, next)) next