Skip to content

Instantly share code, notes, and snippets.

@Orgmir
Orgmir / PagingDataExt.kt
Created Aug 26, 2020
Extract list of data from a androidx.paging.PagingData object
View PagingDataExt.kt
/**
* Extracts the list of data from a PagingData object.
* Useful for testing transformations on PagingData.
*
* flowOf(PagingData.from(listOf(model)).toList() == listOf(model)
*
* When nothing else is left, Java reflection will always be there to help us out.
*/
@Suppress("UNCHECKED_CAST")
private suspend fun <T : Any> PagingData<T>.toList(): List<T> {
@Orgmir
Orgmir / .gitlab-ci.yml
Created Nov 4, 2019
Gitlab CI pipeline setup to build android apps.
View .gitlab-ci.yml
image: registry.gitlab.com/username/project_name:latest
stages:
- build
before_script:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- chmod +x ./gradlew
cache:
View keybase.md

Keybase proof

I hereby claim:

  • I am orgmir on github.
  • I am lramos (https://keybase.io/lramos) on keybase.
  • I have a public key ASBY4pjTWnUu70FTs-ffcf8CY0WafZx-8ZoH6Oud-ya4Hgo

To claim this, I am signing this object:

View Timber+Android.kt
actual inline fun <R> sync(lock: Any, block: () -> R): R = synchronized(lock, block)
actual object Timber {
actual val forestList = mutableListOf<Tree>()
actual var forestArray: Array<Tree> = emptyArray()
}
@Orgmir
Orgmir / main.swift
Created Aug 21, 2018
Disable the AppDelegate when initializing a NSApplication for testing
View main.swift
import AppKit
private func isTestRun() -> Bool {
return NSClassFromString("XCTestCase") != nil
}
if isTestRun() {
// This skipping setting up the app delegate
NSApplication.shared.run()
} else {
@Orgmir
Orgmir / UIView+Extensions.swift
Created May 21, 2018
Extensions for UIView that help out when building layouts manually!
View UIView+Extensions.swift
//
// UIView+Extensions.swift
//
// Created by Luis Ramos on 17/5/18.
//
import UIKit
extension UIView {
@Orgmir
Orgmir / Microsoft.PowerShell_profile.ps1
Created Apr 16, 2018
Prompt for powershell that imitates robbierussel oh-my-zsh theme, including basic git branch support.
View Microsoft.PowerShell_profile.ps1
function prompt {
$ESC = [char]27
$p = Split-Path -leaf -path (Get-Location)
$branch = $(git symbolic-ref -q HEAD) -replace "refs/heads/"
if ($branch) {
$branch = "$ESC[34mgit:($ESC[0m$ESC[31m$branch$ESC[0m$ESC[34m)$ESC[0m "
}
"$ESC[1m$ESC[32m$([char]0x279C)$ESC[0m $ESC[36m$p$ESC[0m $branch$ESC[0m"
@Orgmir
Orgmir / UIView+AutoLayout.swift
Last active Nov 8, 2019
UIView extension with AutoLayout helpers to simplify your code layout creation
View UIView+AutoLayout.swift
//
// UIView+AutoLayout.swift
//
// Created by Luis Ramos on 21/6/17.
// Copyright © 2017 All rights reserved.
//
import UIKit
extension UIView {
View BuildNumber.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleVersion</key>
<string>31</string>
</dict>
</plist>
@Orgmir
Orgmir / increment_build_number.sh
Created Feb 16, 2017
Increment Build Number Run Scrip
View increment_build_number.sh
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/${INFOPLIST_FILE}"