Skip to content

Instantly share code, notes, and snippets.

@dandjelkovic
dandjelkovic / AFError.errorCodes.txt
Last active January 20, 2023 05:01
AlamoFire AFError error codes and their enum case. Helpful for mapping e.g. Crashlytics Issues.
AFError.errorCode 0:
createUploadableFailed(error: Error)
AFError.errorCode 1:
createURLRequestFailed(error: Error)
AFError.errorCode 2:
downloadedFileMoveFailed(error: Error, source: URL, destination: URL)
AFError.errorCode 3:
@mluisbrown
mluisbrown / Rx2Ras-Cheatsheet.md
Last active May 19, 2024 10:47
An RxSwift to ReactiveSwift cheatsheet
@linakis
linakis / generate-ios-screenshots.sh
Created April 15, 2016 11:50
Imagemagick bash script to generate portrait iOS app store screenshots from 6+ input
#!/bin/sh
# Generate iPhone Portrait Screenshots from 6+ for app store submission.
# From folder containing 6+ screenshots do:
# ./generate-ios-screenshots.sh *.png
mkdir -p 3.5
mkdir -p 4.0
mkdir -p 4.7
mkdir -p 5.5
@keyboardr
keyboardr / HeadlessFragment.java
Last active December 31, 2021 01:05
A file template for creating a headless Fragment. The attach() methods add the fragment to the parent if it doesn't already exist and returns the attached fragment. The methods ensure that the parent implements the parent interface. If needed, parameters may be added to the attach() methods to supply fragment arguments.
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
#parse("File Header.java")
public class ${NAME} extends Fragment {
private static final String FRAG_TAG = ${NAME}.class.getCanonicalName();
@dlew
dlew / themes-debug.xml
Last active March 1, 2024 15:46
With the new theming in AppCompat, a lot of assets are tinted automatically for you via theme attributes. That has often led me to wonder "where the hell did this color come from?" You can replace your normal theme with this debug theme to help figure out the source of that color.
<!-- You can change the parent around to whatever you normally use -->
<style name="DebugColors" parent="Theme.AppCompat">
<!-- System colors -->
<item name="android:windowBackground">@color/__debugWindowBackground</item>
<item name="android:colorPressedHighlight">#FF4400</item>
<item name="android:colorLongPressedHighlight">#FF0044</item>
<item name="android:colorFocusedHighlight">#44FF00</item>
<item name="android:colorActivatedHighlight">#00FF44</item>
@chrisbanes
chrisbanes / SystemUiHelper.java
Last active September 4, 2024 05:58
SystemUiHelper
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@fiveisprime
fiveisprime / transform.js
Last active November 29, 2017 10:40
Replace `_id` with string `id` and remove `__v` when calling `toObject()` in Mongoose.
if (!MySchema.options.toObject) {
PlanSchema.options.toObject = {};
}
MySchema.options.toObject.transform = function(doc, ret) {
// Set the id from the retrun object value which will be a string.
ret.id = ret._id;
delete ret._id;
delete ret.__v;
@chrisbanes
chrisbanes / ForegroundLinearLayout.java
Created February 19, 2014 13:16
ForegroundLinearLayout
/*
* Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@romannurik
romannurik / DrawInsetsFrameLayout.java
Created February 10, 2014 16:28
DrawInsetsFrameLayout — adding additional background protection for system UI chrome when using KitKat’s translucent decor flags.
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@fiveisprime
fiveisprime / app.js
Last active January 3, 2016 05:59
Cloud storage.
var express = require('express')
, formidable = require('formidable')
, fs = require('fs')
, path = require('path')
, app = express()
, storedFiles = [];
//
// Serve the cloud storage contents.
//