Skip to content

Instantly share code, notes, and snippets.

Avatar

Martín Conte Mac Donell Reflejo

  • Lyft
  • San Francisco
View GitHub Profile
View fileprivate_regex.py
import argparse
import fnmatch
import json
import os
import re
import sys
from collections import namedtuple
View si.py
import bisect
from operator import itemgetter
units = [
(1e-24, 'y'),
(1e-21, 'z'),
(1e-18, 'a'),
(1e-15, 'f'),
(1e-12, 'p'),
View guess_colors.py
import cv2
import json
import numpy
import re
import sys
from operator import itemgetter, attrgetter
from colormath.color_objects import sRGBColor, LabColor
from colormath.color_conversions import convert_color
from colormath.color_diff import delta_e_cie2000
View stitchPanorama.cpp
#include <iostream>
#include <fstream>
#include <string>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/opencv_modules.hpp>
#include <opencv2/stitching.hpp>
#include <opencv2/stitching/detail/warpers.hpp>
using namespace std;
View BrokenGIF.swift
import Foundation
let pixels: [[UInt8]] = [
[
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
View bug.swift
protocol SomeProtocol {
var a: Int { get }
}
struct SomeStruct: SomeProtocol {
var a = 0
}
class SomeClass {
var value: SomeProtocol = SomeStruct() {
View gist:8bc5b0fb39e8b52b02fa
func test<T>(#something: T) -> T {
return ("abc" as? T) ?? something
}
let str: String? = "abc"
println(test(something: "") == str) // false
println(test(something: "")) // "abc"
View gist:0f43f7e84102760056f0
$ xcodebuild -workspace 'Test.xcworkspace' -scheme 'Test' -configuration 'Debug' -sdk iphonesimulator -destination 'name=iPhone 6' build
Build settings from command line:
SDKROOT = iphonesimulator8.3
2015-02-10 09:54:05.827 xcodebuild[42416:3126221] DVTAssertions: Warning in /SourceCache/DVTiOSFrameworks/DVTiOSFrameworks-7514.1/DTDeviceKitBase/DTDKRemoteDeviceDataListener.m:79
Details: Running against an old version of MobileDevice; some interaction with proxied devices may be unavailable.
Object: <DTDKRemoteDeviceDataListener: 0x7fcf5cf10c90>
Method: -listenerThreadImplementation
Thread: <NSThread: 0x7fcf5cf09990>{number = 2, name = (null)}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
@Reflejo
Reflejo / gist:1f3c553363c712a8e480
Created Feb 9, 2015
UIImagePickerController view hierarchy
View gist:1f3c553363c712a8e480
PLCameraView
PLPreviewView
PLCameraFocusView
UIImageView
PLCropOverlay
OverlayView
PLCropOverlayBottomBar
UIImageView
PLCropOverlayBottomBarButton
UIImageView
@Reflejo
Reflejo / gist:63c1c9e7ad4b0916ca7a
Last active Aug 29, 2015
NSUserDefaults abstraction
View gist:63c1c9e7ad4b0916ca7a
//
// Storage.swift
//
// Created by Martin Conte Mac Donell (Reflejo@gmail.com)
//
import Foundation
/**
This struct is the base for Storage Keys. This way we enforce all keys to be in a container to avoid typos