Skip to content

Instantly share code, notes, and snippets.

Bartosz Kosarzycki kosiara

Block or report user

Report or block kosiara

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kosiara
kosiara / main.dart
Created Sep 2, 2018
Flutter portrait only
View main.dart
void main() {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
.then((_) {
runApp(new MyApp());
});
}
@kosiara
kosiara / proguard-rules.pro
Last active Sep 1, 2018
proguard rules for Twitter UI
View proguard-rules.pro
# Twitter core rules
-keepattributes *Annotation* #GSON
-dontwarn java.nio.file.** #Okio
-dontwarn org.codehaus.mojo.animal_sniffer.** #Okio
-dontwarn javax.annotation.* #Okio
-dontwarn javax.annotation.concurrent.* #Okio
-dontnote retrofit2.Platform #Retrofit 2
-dontnote retrofit2.Platform$IOS$MainThreadExecutor #Retrofit 2
-dontwarn retrofit2.Platform$Java8 #Retrofit 2
-keepattributes Signature #Retrofit 2
@kosiara
kosiara / TwitterViewComponent.kt
Last active Aug 30, 2018
Custom Twitter TweetView Style
View TwitterViewComponent.kt
override fun success(result: Result<Tweet>?) {
val tweet = result!!.data
componentInstance.addView(TweetView(componentInstance.context, tweet, R.style.CustomTwitterStyle))
invalidate()
}
@kosiara
kosiara / TweetViewUtil.kt
Last active Aug 30, 2018
Reformat Twitter date
View TweetViewUtil.kt
/**
* Reformat Twitter date to a new pattern
*/
fun TweetView.reformatDate(newDatePattern: String) {
val twitterDatePattern = "EEE MMM dd HH:mm:ss Z yyyy" // Mon Apr 21 04:08:37 +0000 2018
val dateTextView = findViewById<AppCompatTextView>(R.id.tw__tweet_timestamp)
dateTextView.text = parseDate(tweet.createdAt, twitterDatePattern).format(newDatePattern)
}
/**
View item_list_twitter_comment.xml
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="tweetId"
type="com.bk.sample.android.util.databinding.ObservableString" />
</data>
@kosiara
kosiara / TwitterViewComponent.kt
Created Aug 30, 2018
TwitterViewComponent - simple
View TwitterViewComponent.kt
package com.bk.sample.android.component
[...]
import com.bk.sample.android.util.databinding.ObservableString
import com.twitter.sdk.android.core.Callback
import com.twitter.sdk.android.core.Result
import com.twitter.sdk.android.core.TwitterException
import com.twitter.sdk.android.core.models.Tweet
import com.twitter.sdk.android.tweetui.TweetUtils
import com.twitter.sdk.android.tweetui.TweetView
@kosiara
kosiara / python3_http_simple_server.py
Created Sep 21, 2017
Simple Python3 HTTP Server; one-line python GET method
View python3_http_simple_server.py
from http.server import BaseHTTPRequestHandler, HTTPServer
from urllib.parse import urlparse
import subprocess
class GetHandler(BaseHTTPRequestHandler):
ls_l_cmd = ['ls','-l']
def do_GET(self):
parsed_path = urlparse(self.path)
@kosiara
kosiara / app build.gradle
Last active Apr 21, 2017
@ParametersAreNonnullByDefault for all subpackages includes src, test and androidTest
View app build.gradle
apply plugin: 'com.android.application'
apply from: 'nonnull.gradle'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
[...]
}
@kosiara
kosiara / nonnull.gradle
Last active Feb 11, 2018
@ParametersAreNonnullByDefault for all subpackages
View nonnull.gradle
/**
* File: nonnull.gradle
*
* Generates package-info.java for appropriate packages
* inside src/main/java folder.
*
* This is a workaround to define @ParametersAreNonnullByDefault for all Java classes in a package
* i.e. including all subpackages (note: edit line no. 19).
*/
task generateNonNullJavaFiles(dependsOn: "assembleDebug", type: Copy) {
@kosiara
kosiara / karabiner.json
Created Sep 29, 2016
Karabiner-Elements-PL-right-command-alt-cmd-alt-swap
View karabiner.json
#save this file under: ~/.karabiner.d/configuration/karabiner.json
{
"profiles": [
{
"name": "Default profile",
"selected": true,
"simple_modifications": {
"right_command": "right_option",
"right_option": "right_command"
You can’t perform that action at this time.