Skip to content

Instantly share code, notes, and snippets.

View hiroshihorie's full-sized avatar
🤯
The best things happen unexpectedly.

Hiroshi Horie hiroshihorie

🤯
The best things happen unexpectedly.
View GitHub Profile
@sekati
sekati / xcode-build-bump.sh
Created July 24, 2012 20:44
Xcode Auto-increment Build & Version Numbers
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
@steipete
steipete / DevelopmentEnviromentDetector.m
Last active October 30, 2019 03:49
Detect if you're currently running a development version or an App Store/Ad Hoc version.
static BOOL PSPDFIsDevelopmentBuild(void) {
#if TARGET_IPHONE_SIMULATOR
return YES;
#else
static BOOL isDevelopment = NO;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
// There is no provisioning profile in AppStore Apps.
NSData *data = [NSData dataWithContentsOfFile:[NSBundle.mainBundle pathForResource:@"embedded" ofType:@"mobileprovision"]];
if (data) {
@shalyf
shalyf / yuv2rgb.mm
Last active October 12, 2023 18:33
create rgb image from yuv color space
#define clamp(a) (a>255?255:(a<0?0:a))
+ (UIImage *)imageFromSampleBuffer:(CMSampleBufferRef)sampleBuffer {
CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);
CVPixelBufferLockBaseAddress(imageBuffer, 0);
if (CVPixelBufferGetPlaneCount(imageBuffer) < 2) {
CVPixelBufferUnlockBaseAddress(imageBuffer, 0);
return nil;
}
@debuggerx01
debuggerx01 / visible_items_of_listview.dart
Last active July 2, 2024 08:03
Visible Items of ListView Demo
import 'package:flutter/material.dart';
import 'package:rect_getter/rect_getter.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Visible Demo',
@gaetschwartz
gaetschwartz / settings.json
Last active May 9, 2024 07:21
Nest files in Flutter projects on VSCode, inspired from https://github.com/antfu/vscode-file-nesting-config
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.expand": false,
"explorer.fileNesting.patterns": {
"pubspec.yaml": ".flutter-plugins, .packages, .dart_tool, .flutter-plugins-dependencies, .metadata, .packages, pubspec.lock, build.yaml, analysis_options.yaml, all_lint_rules.yaml",
".gitignore": ".gitattributes, .gitmodules, .gitmessage, .mailmap, .git-blame*",
"readme.*": "authors, backers.md, changelog*, citation*, code_of_conduct.md, codeowners, contributing.md, contributors, copying, credits, governance.md, history.md, license*, maintainers, readme*, security.md, sponsors.md",
"*.dart": "$(capture).g.dart, $(capture).freezed.dart",
},
@JBergsee
JBergsee / Codable+Array and Dictionary.swift
Last active May 20, 2023 22:19
Extensions to encode/decode Arrays and Dictionaries that are members in structs/classes
// All credits to initial authors!
// https://gist.github.com/loudmouth/332e8d89d8de2c1eaf81875cfcd22e24 and
// https://gist.github.com/oteronavarretericardo/7da7bdeadf3829b1cadf5a2a10e83d85
//
// With some help from Quinn the Eskimo to solve problem with 0/1 and Booleans...
// https://forums.swift.org/t/jsonserialization-turns-bool-value-to-nsnumber/31909/2
import Foundation
actor SerialTasksIgnoresAnyError<Success: Sendable> {
private var previousTask: Task<Success, Error>?
private let priority: TaskPriority?
init(priority: TaskPriority? = nil) {
self.priority = priority
}
func add(block: @Sendable @escaping () async throws -> Success) async throws -> Success {
let task = Task(priority: priority) { [previousTask] in