Skip to content

Instantly share code, notes, and snippets.

View kamil-adam's full-sized avatar

Kamil Adam kamil-adam

View GitHub Profile
@kamil-adam
kamil-adam / typeclassses.md
Created December 5, 2019 13:51 — forked from DarinM223/typeclassses.md
Typeclasses in Haskell, Scala, and Rust

Type classes

Type classes have some advantages over Java style interfaces. One advantage is the ability to implement functions that do not need to take in an instance of the interface.

For example, (FromString v) takes in a String and returns v, and it doesn't have to take v as a parameter.

(function($) {
// Used by dateinput
$.expr = {':': {}};
// Used by bootstrap
$.support = {};
// Used by dateinput
$.fn.clone = function(){
var ret = $();
@kamil-adam
kamil-adam / polecenia_git.md
Created January 15, 2020 20:21 — forked from andypl/polecenia_git.md
Polecenia GIT

Przydatne polecenia GIT

basics

  • git init - inicjalizuje repozytorium GIT w katalogu
  • git clone {adres repozytorium} - klonuje repozytorium do katalogu
  • git status - pokazuje status repozytorium (pokazuje informację o zmodyfikowanych, nowych, usuniętych oraz nie należące do repozytorium plikach)
  • git add {ścierzka do pliku} - dodaje plik do repozytorium (np. git add folder/plik.php)
  • git add -A - dodaje wszystkie nie należące do repozytorium pliki
  • git config --global color.ui auto - włącza koloryzowanie wyników w konsoli
@kamil-adam
kamil-adam / truffle-material.md
Created January 20, 2020 14:24 — forked from smarr/truffle-material.md
Truffle: Languages and Material
@kamil-adam
kamil-adam / gist:e7896b36fe3121798875e9c962200282
Created February 2, 2020 11:17 — forked from murgatroydj/external-link-new-tab.js
Jquery snippet to add target="_blank" to all external links in a documen and force PDFs to open in a new window/tab as well. Replace mydomainname with yours to skip internal links.
<script type="text/javascript">/*<![CDATA[*/
$(document).ready(function(){
// external links to new window
$('a[href^="http://"]').not('a[href*=mydomainname]').attr('target','_blank');
// force PDF Files to open in new window
$('a[href$=".pdf"]').attr('target', '_blank');
@kamil-adam
kamil-adam / gist:f7710406162aa6abd6a0a41452238659
Created February 2, 2020 11:17 — forked from murgatroydj/external-link-new-tab.js
Jquery snippet to add target="_blank" to all external links in a documen and force PDFs to open in a new window/tab as well. Replace mydomainname with yours to skip internal links.
<script type="text/javascript">/*<![CDATA[*/
$(document).ready(function(){
// external links to new window
$('a[href^="http://"]').not('a[href*=mydomainname]').attr('target','_blank');
// force PDF Files to open in new window
$('a[href$=".pdf"]').attr('target', '_blank');
@kamil-adam
kamil-adam / DropwizardAsyncResource.java
Created February 27, 2020 11:46 — forked from sathish316/DropwizardAsyncResource.java
Dropwizard AsyncResponse usage
package com.xyz.dw.resource;
import com.codahale.metrics.annotation.Timed;
import com.google.common.base.Optional;
import com.google.common.util.concurrent.SettableFuture;
import com.xyz.dw.model.Greeting;
import org.glassfish.jersey.server.ManagedAsync;
import rx.Observable;
import rx.schedulers.Schedulers;
@kamil-adam
kamil-adam / JsonPointer.scala
Created March 19, 2020 12:04 — forked from xuwei-k/JsonPointer.scala
Json Pointer Scala
package jsonpointer
import argonaut.Json
import scalaz.{IList, Order}
import scalaz.std.anyVal._
import scalaz.std.string._
import scalaz.std.vector._
sealed abstract class PointerNode{
def asString: String
@kamil-adam
kamil-adam / combine_http_parser.rs
Created April 6, 2020 12:22 — forked from m4rw3r/combine_http_parser.rs
Version of the attoparsec example using the parser combinator Combine.
extern crate combine;
use combine::*;
use std::fs::File;
use std::env;
// Seems like combine does not support any kind of zero-copy parsing
#[derive(Debug, Clone)]
struct Request {
@kamil-adam
kamil-adam / parser.hs
Created April 6, 2020 17:02 — forked from nadult/parser.hs
C-like language parser in Haskell.
module Parser(parseProgram) where
import Text.Parsec.Expr
import Text.ParserCombinators.Parsec
import Text.ParserCombinators.Parsec.Error
import qualified Text.ParserCombinators.Parsec.Token as P
import Text.ParserCombinators.Parsec.Language
import Control.Monad
import Tokens