Skip to content

Instantly share code, notes, and snippets.

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

Rodrigo Martins policante

🏠
Working from home
View GitHub Profile
@antoniopresto
antoniopresto / banco_codigo.json
Last active March 1, 2024 13:11
JSON bancos do brasil com código
[
{
"value": "001",
"label": "Banco do Brasil S.A."
},
{
"value": "003",
"label": "Banco da Amazônia S.A."
},
{
@smswz
smswz / GridLayout.swift
Last active July 3, 2023 15:51
A simple custom grid UICollectionViewLayout
// MIT License
//
// Copyright (c) 2016 stable|kernel
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@kishikawakatsumi
kishikawakatsumi / ReorderingRealmResultsInTableView.swift
Created July 27, 2016 04:51
Reorder Realm Results in UITableView
import UIKit
import RealmSwift
class Data: Object {
dynamic var name = ""
...
dynamic var order = 0 // 並べ替えのためのカラムが必要
}
@gonzalezreal
gonzalezreal / ios-cell-registration-swift.md
Last active March 13, 2024 15:18
iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

A common task when developing iOS apps is to register custom cell subclasses for both UITableView and UICollectionView. Well, that is if you don’t use Storyboards, of course.

Both UITableView and UICollectionView offer a similar API to register custom cell classes:

public func registerClass(cellClass: AnyClass?, forCellWithReuseIdentifier identifier: String)
public func registerNib(nib: UINib?, forCellWithReuseIdentifier identifier: String)
@zacwest
zacwest / ios-font-sizes.swift
Last active March 27, 2024 07:16
iOS default font sizes - also available on https://www.iosfontsizes.com
let styles: [UIFont.TextStyle] = [
// iOS 17
.extraLargeTitle, .extraLargeTitle2,
// iOS 11
.largeTitle,
// iOS 9
.title1, .title2, .title3, .callout,
// iOS 7
.headline, .subheadline, .body, .footnote, .caption1, .caption2,
]
@qinshulei
qinshulei / ConvertAndroidVectorDrawable2png.md
Last active September 20, 2022 07:29
Convert Android VectorDrawable to png

转换方法:

  1. Convert Android VectorDrawable to SVG:

使用附件中的java程序。命令如下:

cp Vector2Svg.java path/to/xml_dir
javac Vector2Svg.java
java Vector2Svg ./*.xml
mkdir svg_dir
@voghDev
voghDev / LogJsonInterceptor.java
Created October 29, 2015 12:51
retrofit2 interceptor that logs the raw JSON response from API. After that it clones it and returns a sane copy that other classes can consume.
import android.util.Log;
import com.appandweb.prjtestdrivendev.BuildConfig;
import com.squareup.okhttp.Interceptor;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import com.squareup.okhttp.ResponseBody;
import java.io.IOException;
@tahmidsadik
tahmidsadik / purgeAndroid.txt
Created September 19, 2015 18:47
How to completely remove Android Studio from Mac OS X
How to Completely Remove Android Studio
Execute these commands from the terminal
rm -Rf /Applications/Android\ Studio.app
rm -Rf ~/Library/Preferences/AndroidStudio*
rm ~/Library/Preferences/com.google.android.studio.plist
rm -Rf ~/Library/Application\ Support/AndroidStudio*
rm -Rf ~/Library/Logs/AndroidStudio*
@quellish
quellish / xcci.md
Created October 28, 2014 03:03
Xcode CI script variables

Variable

Type

@BrandonSmith
BrandonSmith / AndroidManifest.xml
Last active July 19, 2023 19:11
Quick example of how to schedule a notification in the future using AlarmManager
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cards.notification">
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"