Skip to content

Instantly share code, notes, and snippets.

View odemolliens's full-sized avatar

@odemolliens odemolliens

View GitHub Profile
@odemolliens
odemolliens / .swift
Created October 5, 2016 11:37
iOS Swift dashed lines extension
public let kShapeDashed : String = "kShapeDashed"
extension UIView {
func removeDashedBorder(_ view: UIView) {
view.layer.sublayers?.forEach {
if kShapeDashed == $0.name {
$0.removeFromSuperlayer()
}
}
@jaumevn
jaumevn / compression.swift
Last active May 17, 2021 16:57
Video Compression in Swift
func compress(videoPath : String, exportVideoPath : String, renderSize : CGSize, completion : (Bool) -> ()) {
let videoUrl = NSURL(fileURLWithPath: videoPath)
if (!existsFileAtUrl(videoUrl)) {
completion(false)
return
}
let videoAssetUrl = AVURLAsset(URL: videoUrl, options: nil)
@tianjianchn
tianjianchn / error-report.js
Last active July 17, 2023 10:15
Error report util with fabric/crashlytics in react-native
/*global __DEV__*/
import StackTrace from 'stacktrace-js';
const Fabric = require('react-native-fabric');
const { Crashlytics } = Fabric;
//call this to start capturing any no-handled errors
exports.init = function(captrueOnDebugMode){
if (__DEV__ && !captrueOnDebugMode) {
return;
@alphamu
alphamu / KeyStoreHelper.java
Last active December 28, 2023 18:22
Using Android KeyStore to generate a password. The code create a public/private key pair and uses the base64 encoded form of the certificate to as the password. The code modified the KeystoreHelper class from AOSP demo projects.
/*
* Copyright 2013 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
@mmazzarolo
mmazzarolo / Appfile
Created May 17, 2016 11:27
Simple Fastlane setup for React-Native (Android - iOS)
# iOS
app_identifier "com.myapp.app" # The bundle identifier of your app
apple_id "[email protected]" # Your Apple email address
team_id "1234ABCD" # Developer Portal Team ID
# Android
json_key_file "./google-play-api-secret.json" # Path to the json secret file - Follow https://github.com/fastlane/supply#setup to get one
package_name "com.myapp.app" # Your Android app package
@acrookston
acrookston / README.md
Last active January 26, 2022 11:05
Xcode pre-action to build custom Info.plist

Automatic build versions from git in Xcode (and other goodies)

Installation procedure for pre-build actions to automatically populate Xcode Info.plist with dynamic data.

1. Xcode Scheme pre-action

Edit Xcode Scheme and add a pre-action script. Copy the contents of preaction.sh into the pre-action script box.

@viperwarp
viperwarp / ReactNativeJson.java
Created February 24, 2016 03:02
React-Native Module, ReadableMap/Array to Java JSON objects
private static WritableMap convertJsonToMap(JSONObject jsonObject) throws JSONException {
WritableMap map = new WritableNativeMap();
Iterator<String> iterator = jsonObject.keys();
while (iterator.hasNext()) {
String key = iterator.next();
Object value = jsonObject.get(key);
if (value instanceof JSONObject) {
map.putMap(key, convertJsonToMap((JSONObject) value));
} else if (value instanceof JSONArray) {
@brunobar79
brunobar79 / AppDelegate.m
Created January 23, 2016 02:04
Using CLS_LOG in React Native Logs
RCTLogFunction CrashlyticsReactLogFunction = ^(
RCTLogLevel level,
__unused RCTLogSource source,
NSString *fileName,
NSNumber *lineNumber,
NSString *message
)
{
NSString *log = RCTFormatLog([NSDate date], level, fileName, lineNumber, message);
@z3ntu
z3ntu / README.md
Last active December 5, 2018 12:57
Compile applications for Android
  1. Set your PATH so the Android NDK tools (arm-linux-androideabi-cpp, arm-linux-androideabi-gcc, and friends) are on PATH:
  $ echo $PATH
/opt/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86_64/bin:
  /opt/android-sdk-macosx/tools/:/opt/android-sdk-macosx/platform-tools/:
  /opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:
  /opt/X11/bin:/usr/local/MacGPG2/bin
  1. Ensure ANDROID_NDK_ROOT is set (this is an Android requirement, see
anonymous
anonymous / gpu.csv
Created November 1, 2015 14:24
Log mining rigs temperatures and auto-adjust
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
DATE;DEVICE0;DEVICE1;TEMP0;TEMP1;FAN0;FAN1
1446127512;R9-390X-0;R9-390X-1;77;66;55;50
1446127527;R9-390X-0;R9-390X-1;67;54;45;40
1446127542;R9-390X-0;R9-390X-1;74;63;55;50
1446127557;R9-390X-0;R9-390X-1;74;63;55;50
1446127572;R9-390X-0;R9-390X-1;74;63;55;50
1446127587;R9-390X-0;R9-390X-1;72;62;55;50
1446127602;R9-390X-0;R9-390X-1;73;63;55;50
1446127617;R9-390X-0;R9-390X-1;73;63;55;50
1446127632;R9-390X-0;R9-390X-1;73;63;55;50