Skip to content

Instantly share code, notes, and snippets.

View romainbriche's full-sized avatar

Romain Briche romainbriche

View GitHub Profile
@romainbriche
romainbriche / build_opencv_ios.sh
Created October 25, 2017 08:43 — forked from benjohnde/build_opencv_ios.sh
Compilation error of dynamic framework for iOS (OpenCV 3.3.0)
#!/bin/bash
git clone git@github.com:opencv/opencv.git
cd opencv
git checkout 3.3.0
python platforms/ios/build_framework.py ios \
--dynamic \
--without imgcodec --without videoio --without video --without calib3d --without features2d \
--without objdetect --without dnn --without ml --without flann --without photo --without stitching \
--without cudaarithm --without cudabgsegm --without cudacodec --without cudafeatures2d \
--without cudafilters --without cudaimgproc --without cudalegacy --without cudaobjdetect \
@romainbriche
romainbriche / UIColorExtension.md
Created October 26, 2017 06:18 — forked from bhrott/UIColorExtension.md
Swift 3: Hex UIColor

Extension:

import Foundation
import UIKit

extension UIColor {
    convenience init(hexString: String) {
        let hex = hexString.trimmingCharacters(in: CharacterSet.alphanumerics.inverted)
        var int = UInt32()
 Scanner(string: hex).scanHexInt32(&int)
@romainbriche
romainbriche / generateRandomColor.swift
Created October 31, 2017 13:49 — forked from asarode/generateRandomColor.swift
Generating random UIColor in Swift
func generateRandomColor() -> UIColor {
let hue : CGFloat = CGFloat(arc4random() % 256) / 256 // use 256 to get full range from 0.0 to 1.0
let saturation : CGFloat = CGFloat(arc4random() % 128) / 256 + 0.5 // from 0.5 to 1.0 to stay away from white
let brightness : CGFloat = CGFloat(arc4random() % 128) / 256 + 0.5 // from 0.5 to 1.0 to stay away from black
return UIColor(hue: hue, saturation: saturation, brightness: brightness, alpha: 1)
}
@romainbriche
romainbriche / NSNotificationCenterExtensions.swift
Created November 3, 2017 21:50 — forked from Rich86man/NSNotificationCenterExtensions.swift
NSNotificationCenter extension for safe Swift instance method support
/*
Copyright (c) 2011-present, NimbusKit. All rights reserved.
This source code is licensed under the BSD-style license found at http://nimbuskit.info/license
Extracted from NimbusKit: Swift Edition at https://github.com/nimbuskit/swift
*/
extension NSNotificationCenter {
/**
@romainbriche
romainbriche / shopify.md
Created November 29, 2017 13:22 — forked from lambtron/shopify.md
segment event tracking for shopify
title sidebar
Segment Event Tracking for Shopify
Shopify

Segment makes it simple for Shopify merchants to integrate analytics, email marketing, advertising and optimization tools. Rather than installing all your tools individually, you just install Segment once. We collect your data, translate it, and route it to any tool you want to use with the flick of a switch. Using Segment as the single platform to manage and install your third-party services will save you time and money.

The guide below explains how to install Segment in your Shopify store. All you need to get up and running is copy and paste a few snippets of code into your theme editor. (You don't have to edit the code or be versed in JavaScript.) The following guide will show you how, step by step.


@romainbriche
romainbriche / POD_NAME.podspec
Created December 14, 2017 06:59 — forked from phatblat/POD_NAME.podspec
POC of a Pod which installs a run script into Xcode (CocoaPods 0.33 or less)
Pod::Spec.new do |s|
s.name = 'POD_NAME'
s.version = '1.0.0'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.summary = 'Example of pod which installs a run script into the Xcode project (first target)'
s.homepage = 'https://github.com/phatblat/POD_NAME'
s.authors = { 'Ben Chatelain' => 'benchatelain@gmail.com' }
s.source = { :git => 'https://github.com/phatblat/POD_NAME.git', :tag => s.version.to_s }
s.ios.deployment_target = '6.0'
@romainbriche
romainbriche / Android Screenshot.bat
Created December 18, 2017 10:29 — forked from leighmcculloch/Android Screenshot.bat
This batch script will take a screenshot on an Android device using ADB, download the screenshot to the directory this script to the current directory and then remove the screenshot file from the device. Screenshots are saved with filename: screenshot-YYYYMMDD-HHMMSS.png. ADB must be connected to a device already.
@echo off
rem configurable parameters
set SCREENCAP_FILE_PREFIX=screenshot
rem the dir on the device where the screenshot will be stored temporarily
set SCREENCAP_WORKING_DIR=/sdcard/
rem adb path, leave blank if adb is already on the user or system path
set SCREENCAP_ADB_PATH=
@romainbriche
romainbriche / s3get.sh
Created January 7, 2018 19:42 — forked from jpillora/s3get.sh
S3 signed GET in plain bash (Requires openssl and curl)
#!/bin/bash
#set these in your environment/profile (NOT HERE)
AWS_ACCESS_KEY=""
AWS_SECRET_KEY=""
function s3get {
#helper functions
function fail { echo "$1" > /dev/stderr; exit 1; }
#dependency check
@romainbriche
romainbriche / s3.sh
Created January 7, 2018 19:42 — forked from chrismdp/s3.sh
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
@romainbriche
romainbriche / build-environment.py
Created February 20, 2018 06:26
A kinda hacky script to set up iOS env config for RN, Objective-C, and preprocessor defines.
#!/usr/bin/python
from plistlib import readPlist as read_plist
from subprocess import check_output
import socket
import json
from datetime import datetime
import os
# Export your version of these for testing the script from the console directly: