Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Marcin Kitowicz kitek

🏠
Working from home
View GitHub Profile
@kitek
kitek / SwipeToDeleteCallback.kt
Created Jan 24, 2018
Example demonstrating how to disable swipe to delete for the particular item.
View SwipeToDeleteCallback.kt
package pl.kitek.rvswipetodelete
import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.support.v4.content.ContextCompat
import android.support.v7.widget.RecyclerView
import android.support.v7.widget.helper.ItemTouchHelper
View TriangleShapeView.kt
package your.package.name
import android.content.Context
import android.graphics.*
import android.util.AttributeSet
import android.view.View
class TriangleShapeView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
@kitek
kitek / CircleTransform.kt
Last active Apr 29, 2020 — forked from julianshen/CircleTransform.java
CircleTransform for Picasso in Kotlin
View CircleTransform.kt
/*
* Copyright 2014 Julian Shen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@kitek
kitek / DbHelper.kt
Created Jun 21, 2016
Kotlin DbHelper
View DbHelper.kt
import android.content.Context
import android.database.sqlite.SQLiteDatabase
import android.database.sqlite.SQLiteOpenHelper
class DbHelper(context: Context) : SQLiteOpenHelper(context, "some.db", null, 1) {
override fun onUpgrade(db: SQLiteDatabase?, oldVersion: Int, newVersion: Int) {
}
View Lista ToDo.md

Moja lista:

  • zadanie pierwsze
  • zadanie drugie
View gist:8150873
git log --after=2011-01-01 --before=2011-01-31 --format=format: --shortstat master
@kitek
kitek / vb.sh
Created Nov 25, 2013
Load&unload virtual box modules for os x
View vb.sh
#!/bin/bash
unload() {
echo -ne "unloading VB modules..."
kextstat | grep "org.virtualbox.kext.VBoxUSB" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxUSB
kextstat | grep "org.virtualbox.kext.VBoxNetFlt" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxNetFlt
kextstat | grep "org.virtualbox.kext.VBoxNetAdp" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxNetAdp
kextstat | grep "org.virtualbox.kext.VBoxDrv" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxDrv
}
@kitek
kitek / Table.java
Created Oct 6, 2013
Dynamic TableLayout
View Table.java
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
LinearLayout linearLayout = new LinearLayout(getActivity());
linearLayout.setOrientation(LinearLayout.HORIZONTAL);
linearLayout.setLayoutParams(new LinearLayout.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT, AbsListView.LayoutParams.WRAP_CONTENT));
TableLayout table = new TableLayout(getActivity());
table.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT));
for (int i = 0; i < 10; i++) {
@kitek
kitek / redrawPage.js
Created Jul 19, 2013
Funkcja wykorzystywana do force re-renderingu (bug@4.2.2 z pustymi stronami)
View redrawPage.js
// Funkcja wykorzystywana do force re-renderingu (bug@4.2.2 z pustymi stronami)
function redrawPage(top) {
document.body.scrollTop = 1;
document.body.scrollTop = 0;
$(function() {
document.body.scrollTop = top + 1;
document.body.scrollTop = top;
});
}
@kitek
kitek / 9patchReplace.java
Created Jun 21, 2013
Replace 9patch background with padding
View 9patchReplace.java
NinePatchDrawable bg = (NinePatchDrawable) getResources().getDrawable(R.drawable.button_new_light);
int pL = btnLike.getPaddingLeft();
int pR = btnLike.getPaddingRight();
int pT = btnLike.getPaddingTop();
int pB = btnLike.getPaddingBottom();
if(Build.VERSION.SDK_INT >= 16) {
btnLike.setBackground(bg);
} else {
btnLike.setBackgroundDrawable(bg);
You can’t perform that action at this time.