Skip to content

Instantly share code, notes, and snippets.

@wilg
wilg / parallel_map.swift
Last active February 9, 2024 20:21 — forked from DougGregor/parallel_map.swift
Swift async/await implementation of a parallel map
import Foundation
// https://gist.github.com/DougGregor/92a2e4f6e11f6d733fb5065e9d1c880f
extension Collection {
func parallelMap<T>(
parallelism requestedParallelism: Int? = nil,
_ transform: @escaping (Element) async throws -> T
) async rethrows -> [T] {
let defaultParallelism = 2
let parallelism = requestedParallelism ?? defaultParallelism
@keith
keith / simctl-commands.txt
Last active December 7, 2022 23:27
All the subcommands of `xcrun simctl` (including ones that aren't listed in `simctl help`) LC_SOURCE_VERSION 776.1 (Xcode 13.0 beta 5)
addmedia
addphoto
addvideo
appinfo
boot
bootstatus
clone
create
darwinup
delete
@dmnsgn
dmnsgn / WebGL-WebGPU-frameworks-libraries.md
Last active April 17, 2024 19:34
A collection of WebGL and WebGPU frameworks and libraries

A non-exhaustive list of WebGL and WebGPU frameworks and libraries. It is mostly for learning purposes as some of the libraries listed are wip/outdated/not maintained anymore.

Engines and libraries ⚙️

Name Stars Last Commit Description
three.js ![GitHub
@koesie10
koesie10 / ApiModule.java
Created October 3, 2015 07:40
Retrofit 1 error handling behaviour in Retrofit 2
// Dagger 1 example
@Module(
complete = false,
library = true
)
public final class ApiModule {
@Provides
@Singleton
Retrofit provideRetrofit(Gson gson, Application app) {
return new Retrofit.Builder()
@berkus
berkus / memoize.swift
Last active April 2, 2017 19:19
A "fast" memoization generic in Swift
Promised speed:
0.1s https://dl.dropboxusercontent.com/s/bpgountdjrbs17n/2014-06-09%20at%2019.00.png
Actual speed:
575s https://dl.dropboxusercontent.com/s/2kbn5p1g4t03fvl/2014-06-09%20at%2019.00%20%281%29.png
With optimizations:
@felHR85
felHR85 / SoftKeyboard.java
Last active February 17, 2024 23:11
A solution to catch show/hide soft keyboard events in Android http://felhr85.net/2014/05/04/catch-soft-keyboard-showhidden-events-in-android/
/*
* Author: Felipe Herranz (felhr85@gmail.com)
* Contributors:Francesco Verheye (verheye.francesco@gmail.com)
* Israel Dominguez (dominguez.israel@gmail.com)
*/
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import android.os.Handler;

CocoaPods + Xcode Continuous Integration

Script:

cd ${SRCROOT}
if [ -e "Pods" ]
then
pod install
else
touch Pods
@tibr
tibr / NSFileManager+DoNotBackup.h
Created March 8, 2012 09:42
Setting the do not backup attribute in different iOS versions
@interface NSFileManager (DoNotBackup)
- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL;
@end
@Pretz
Pretz / RoundedImageView.java
Created January 10, 2012 02:47
Andround Rounded Image View
package com.yelp.android.ui.widgets;
import com.yelp.android.R;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
@natelyman
natelyman / NLCachedImageTableViewCell.h
Created January 9, 2012 10:16
Cached UITableViewCell that loads images from a remote source.
//
// NLCachedImageTableViewCell.h
// niners
//
// Created by Lyman, Nathan(nlyman) on 1/9/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>