Skip to content

Instantly share code, notes, and snippets.

View orgmir's full-sized avatar

Luis Ramos orgmir

View GitHub Profile
@orgmir
orgmir / PagingDataExt.kt
Created August 26, 2020 08:19
Extract list of data from a androidx.paging.PagingData object
/**
* 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 / UIView+AutoLayout.swift
Last active March 19, 2024 08:16
UIView extension with AutoLayout helpers to simplify your code layout creation
//
// UIView+AutoLayout.swift
//
// Created by Luis Ramos on 21/6/17.
// Copyright © 2017 All rights reserved.
//
import UIKit
extension UIView {
@orgmir
orgmir / HiResScreenShots.cs
Created January 23, 2017 11:07
Script to take a high resolution screenshot
using UnityEngine;
using System.Collections;
using System.IO;
// This was taken from https://www.reddit.com/r/Unity3D/wiki/screenshots
public class HiResScreenShots : MonoBehaviour
{
public int resWidth = 1920; public int resHeight = 1080;
@orgmir
orgmir / HotKeyTextField.swift
Last active September 1, 2021 03:14
SwiftUI DDHotKeyTextField wrapper, so you can set hotkeys using https://github.com/davedelong/DDHotKey
import Combine
import SwiftUI
// Don't forget to add https://github.com/davedelong/DDHotKey to your project
struct HotKeyTextField: View {
@Binding var keyCode: Int
@Binding var modifierFlags: Int
var body: some View {
DDHotKeyTextFieldWrapper(keyCode: $keyCode, modifierFlags: $modifierFlags)
@orgmir
orgmir / .gitlab-ci.yml
Created November 4, 2019 00:44
Gitlab CI pipeline setup to build android apps.
image: registry.gitlab.com/username/project_name:latest
stages:
- build
before_script:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- chmod +x ./gradlew
cache:

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:

@orgmir
orgmir / UIView+Extensions.swift
Created May 21, 2018 05:32
Extensions for UIView that help out when building layouts manually!
//
// UIView+Extensions.swift
//
// Created by Luis Ramos on 17/5/18.
//
import UIKit
extension UIView {
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 August 21, 2018 02:08
Disable the AppDelegate when initializing a NSApplication for testing
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 / Microsoft.PowerShell_profile.ps1
Created April 16, 2018 13:30
Prompt for powershell that imitates robbierussel oh-my-zsh theme, including basic git branch support.
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"