Skip to content

Instantly share code, notes, and snippets.

View delor's full-sized avatar
🏠
Working from home

Bartłomiej Piech delor

🏠
Working from home
View GitHub Profile
@delor
delor / dna-vacabulary.md
Last active September 26, 2019 09:21
DNA vacabulary

DNA vacabulary

ENG PLN
invariant niezmiennik
@delor
delor / Example.java
Created May 26, 2017 09:53
You don't need to use new keyword anymore. ;)
package example;
public class Example {
private final int a;
private Example(int a) {
this.a = a;
}
public static Example Example(int a) {
@delor
delor / BindableAdapter.java
Last active August 29, 2015 14:15
An implementation of BaseAdapter which uses the new/bind pattern for its views.
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
/**
* An implementation of {@link BaseAdapter} which uses the new/bind pattern for its views.
*/
public abstract class BindableAdapter<T> extends BaseAdapter {
@delor
delor / build.gradle
Created November 21, 2014 20:57
Gradle task for generating Maven's POM file for Android AAR
task createPom {
apply plugin: 'maven'
description "Generates pom.xml"
pom {
project {
groupId 'com.example'
artifactId 'example'
version '0.0.1-SNAPSHOT'
packaging 'aar'
}
@delor
delor / OAuthTokenRequestSpec.groovy
Created August 12, 2014 20:44
Testing RoboSpice with mocked MockWebServer
import com.squareup.okhttp.OkHttpClient
import com.squareup.okhttp.mockwebserver.MockResponse
import com.squareup.okhttp.mockwebserver.MockWebServer
import com.squareup.okhttp.mockwebserver.RecordedRequest
import spock.lang.Specification
class OAuthTokenRequestSpec extends Specification {
def POST = "POST"
def anyClient = "123"
@delor
delor / pom.xml
Created February 2, 2014 22:56
basic spock framework maven setup
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>code</groupId>
<artifactId>code</artifactId>
<version>1.0-SNAPSHOT</version>
@delor
delor / git_cheat_sheet.md
Last active August 29, 2015 13:55
list of rarely used commands in git

add changes without whitespace

git diff -w --no-color | git apply --cached --ignore-whitespace

find deleted file

$ git log -- /path/to/file

display deleted file

@delor
delor / named_arguments.scala
Created August 20, 2013 13:41
Watch out when overwriting methods and changing parameter name in Scala.
scala> trait Person { def grade(years: Int): String }
defined trait Person
scala> class SalesPerson extends Person { def grade(yrs: Int) = "Senior" }
defined class SalesPerson
scala> val s = new SalesPerson
s: SalesPerson = SalesPerson@3ce89cd5
scala> s.grade(yrs=1)
@delor
delor / mvn-output
Last active February 7, 2018 09:41
Minimal Maven configuration separating unit and integration tests.
$ mvn verify
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building maven-tests-config 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ maven-tests-config ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
/**
* @file palindrome.c
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <cs50.h>
bool isPalindrome(char* text);