Skip to content

Instantly share code, notes, and snippets.

@suclike
suclike / things-i-believe.md
Created March 6, 2020 14:29 — forked from stettix/things-i-believe.md
Things I believe

Things I believe

This is a collection of the things I believe about software development. I have worked for years building backend and data processing systems, so read the below within that context.

Agree? Disagree? Feel free to let me know at @JanStette. See also my blog at www.janvsmachine.net.

Fundamentals

Keep it simple, stupid. You ain't gonna need it.

@suclike
suclike / DpToPxAndPxToDp
Created April 1, 2019 14:47 — forked from laaptu/DpToPxAndPxToDp
Android convert dp to px and vice versa
public static float convertPixelsToDp(float px){
DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
float dp = px / (metrics.densityDpi / 160f);
return Math.round(dp);
}
public static float convertDpToPixel(float dp){
DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
float px = dp * (metrics.densityDpi / 160f);
return Math.round(px);
@suclike
suclike / bottom_sheet.dart
Created March 20, 2019 23:10 — forked from andrelsmoraes/bottom_sheet.dart
Modal Bottom Sheet with Input Fields fix for Flutter (Fix issue with overlap with keyboard and fix for tapping to dismiss) - Flutter Version: Channel beta, v0.5.1
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
@suclike
suclike / .gitconfig.alias
Created December 20, 2018 11:44 — forked from michaelpomogajko/.gitconfig.alias
[git aliases] git aliases #git #alias #workflow
[alias]
#current branch
me = !git rev-parse --abbrev-ref HEAD
st = status
sta = !git status && git add . --all && git status && echo 'Staged all changes, if any.'
unsta = !git status && git reset HEAD && git status && echo 'Unstaged all changes, if any.'
stachbst = !git status && git add . --all && echo 'Staged all changes, if any.' && git checkout -b $branchname && git status
@suclike
suclike / build.gradle
Created December 10, 2018 18:17 — forked from albinmathew/build.gradle
An example configuration for proguard-rules.pro
android {
compileSdkVersion 22
buildToolsVersion "22.0.0"
defaultConfig {
applicationId "com.abc.example"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
@suclike
suclike / README.md
Created December 10, 2018 14:15 — forked from gabrielemariotti/README.md
How to manage the support libraries in a multi-module projects. Thanks to Fernando Cejas (http://fernandocejas.com/)

Centralize the support libraries dependencies in gradle

Working with multi-modules project, it is very useful to centralize the dependencies, especially the support libraries.

A very good way is to separate gradle build files, defining something like:

root
  --gradleScript
 ----dependencies.gradle
@suclike
suclike / symbols-naming.md
Created September 18, 2018 10:23 — forked from barbietunnie/symbols-naming.md
Symbols naming

Symbols Naming

! - Exclamation point
@ - "At" sign
# - Number sign or Pound sign, depending upon context
& - Technically called "ampersand," most folks refer to it as "the 'and' sign"
() - Parentheses
[] - Brackets
{} - Braces
@suclike
suclike / git-tag-delete-local-and-remote.sh
Created August 31, 2018 12:15 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@suclike
suclike / LifecycleJob.kt
Created August 15, 2018 21:47 — forked from LouisCAD/LifecycleCoroutines.kt
A job that automatically gets cancelled when the lifecycle is destroyed. Meant to be used as a parent to your coroutines in lifecycle aware components.
import android.arch.lifecycle.GenericLifecycleObserver
import android.arch.lifecycle.Lifecycle
import android.arch.lifecycle.Lifecycle.Event.ON_DESTROY
import android.arch.lifecycle.LifecycleOwner
import kotlinx.coroutines.experimental.Job
fun Lifecycle.createJob(cancelEvent: Lifecycle.Event = ON_DESTROY): Job = Job().also { job ->
addObserver(object : GenericLifecycleObserver {
override fun onStateChanged(source: LifecycleOwner?, event: Lifecycle.Event) {
if (event == cancelEvent) {
@suclike
suclike / http.md
Created August 15, 2018 21:44 — forked from arpit/http.md
HTTP basics

Basic HTTP

The Client Server Model

The core working of the internet is based on the idea of client / server communication. The client is anything close to the user (a web browser, an app, a terminal with ssh) and a server that can respond to client queries.

Clients can talk to servers via a variety of protocols. The protocols are just a way for the client and server to agree on how to send data back and forth. Its like you and I talking. We can agree that we use English and with a friend of mine I can use Hindi.

Different Client / Server protocols include:

  • HTTP