Skip to content

Instantly share code, notes, and snippets.

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

Marcin Kitowicz kitek

🏠
Working from home
View GitHub Profile
@kitek
kitek / list_selector.xml
Last active January 3, 2016 15:31
Custom ListView selector drawable/list_selector.xml android:listSelector="@drawable/selector"
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" android:constantSize="true">
<item android:state_focused="false" android:state_pressed="false">
<shape android:shape="rectangle">
<solid android:color="@android:color/transparent" />
<stroke android:width="0dp" android:color="@android:color/transparent" />
<padding android:bottom="1dp" android:left="1dp" android:right="1dp" android:top="1dp" />
@kitek
kitek / SquareView.java
Created May 29, 2013 13:46
Example of square gridview items
package pl.garnek;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
public class SquareView extends ViewGroup {
public SquareView(Context context) {
@kitek
kitek / getFirstVisiblePosition.java
Created May 29, 2013 13:43
PullToRefreshGridView getFirstVisiblePosition()
PullToRefreshGridView gridView = (PullToRefreshGridView) findViewById(R.id.gridview);
int firstVisiblePosition = gridView.getRefreshableView().getFirstVisiblePosition();
@kitek
kitek / gist:5379320
Last active December 16, 2015 04:48
OSX shortcuts

Netbeans

Switch between files tabs:

ctrl + tab & ctrl + shift + tab

@kitek
kitek / gist:5343429
Last active December 15, 2015 23:49
Git ściągawka
# Hard reset to remote master
git fetch origin
git reset --hard origin/master
# Switch to another branch
git checkout better_branch
@kitek
kitek / FetchImage
Created February 8, 2013 21:00
Prosta klasa oparta o asyncTask'a pobierająca obrazek z podanego adresu URL i wstawiająca go do określonego ImageView
package pl.kitek.asyncloadimg;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.widget.ImageView;
@kitek
kitek / simple ImageAdapter
Created February 8, 2013 20:09
Prosty adapter dla gridView ładujący kolejne obrazki z drawable
package pl.kitek.asyncloadimg;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;
public class ImageAdapter extends BaseAdapter {
@kitek
kitek / Makefile
Created February 11, 2012 12:05
Skrypt make dla AVR i programatora usbasp na macOS
TARGET = main
CC = /usr/local/CrossPack-AVR/bin/avr-gcc
OBJCOPY = /usr/local/CrossPack-AVR/bin/avr-objcopy
MCU = atmega8
F_CPU = 1000000
CFLAGS = -mmcu=$(MCU) -gdwarf-2 -DF_CPU=$(F_CPU)UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
CFLAGS += -Wall -Wstrict-prototypes -I./lib -std=gnu99
OBJECTS =
@kitek
kitek / gist:1668972
Created January 24, 2012 08:55
VBoxHeadless
dim strScript
strScript = chr(34) & "C:\Program Files\Oracle\VirtualBox\VBoxHeadless.exe" & chr(34) & " -startvm Devel -e TCP/Ports=8000"
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run strScript, 0
Set WshShell = Nothing
@kitek
kitek / gist:1585142
Created January 9, 2012 21:50
Samba simple public & private config
[global]
netbios name = HP
workgroup = WORKGROUP
server string = HP
log file = /var/log/samba/log.%m
security = user
create mask = 0666
force create mode = 0666
force directory mode = 0777
follow symlinks = yes