Skip to content

Instantly share code, notes, and snippets.

PG Herveou pgherveou

Block or report user

Report or block pgherveou

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View dabblet.css
// Hello
// test
background: #f06;background: linear-gradient(45deg, #f06, yellow);min-height: 100%;
@pgherveou
pgherveou / dabblet.css
Created Feb 23, 2018 — forked from anonymous/dabblet.css
The first commented line is your dabblet’s title
View dabblet.css
/**
* The first commented line is your dabblet’s title
*/
background: #f07;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
@pgherveou
pgherveou / iPhone Model Mapping.txt
Last active Jul 27, 2018
iPhone Model Mapping.txt
View iPhone Model Mapping.txt
Source https://stackoverflow.com/questions/11197509/how-to-get-device-make-and-model-on-ios
@"iPhone1,1" on iPhone
@"iPhone1,2" on iPhone 3G
@"iPhone2,1" on iPhone 3GS
@"iPhone3,1" on iPhone 4 (GSM)
@"iPhone3,3" on iPhone 4 (CDMA/Verizon/Sprint)
@"iPhone4,1" on iPhone 4S
@"iPhone5,1" on iPhone 5 (model A1428, AT&T/Canada)
@"iPhone5,2" on iPhone 5 (model A1429, everything else)
@pgherveou
pgherveou / async-operation.swift
Last active Aug 4, 2017
Async operationQueue
View async-operation.swift
import Foundation
/// List of states that can be used to update an asynchronous operation state.
public enum AsyncOperationState {
case ready
case executing
case finished
fileprivate var keyPath: String {
switch self {
@pgherveou
pgherveou / yield-to-async.js
Created Oct 5, 2016
convert co/yield to to async/await
View yield-to-async.js
// http://astexplorer.net/#/BICnPGGYdU/4
export default function ({types: t}) {
return {
visitor: {
FunctionDeclaration(path) {
if (path.node.generator) {
path.node.async = true
path.node.generator = false
}
View reuse-shared-observable.swift
import Foundation
import PlaygroundSupport
import RxSwift
PlaygroundPage.current.needsIndefiniteExecution = true
/// dictionary of (id: shared Observable)
var store: [String: Any] = [:]
/// makeSequence return an existing shared sequence identified by `id`
@pgherveou
pgherveou / firstDifferenceBetweenStrings.swift
Created Sep 29, 2016 — forked from kristopherjohnson/firstDifferenceBetweenStrings.swift
Swift code to find differences between strings and display them in a readable way, useful for displaying unit test results
View firstDifferenceBetweenStrings.swift
//: Playground - noun: a place where people can play
import Foundation
/// Find first differing character between two strings
///
/// :param: s1 First String
/// :param: s2 Second String
///
/// :returns: .DifferenceAtIndex(i) or .NoDifference
View RxSyncSequence.swift
import PlaygroundSupport
import RxSwift
PlaygroundPage.current.needsIndefiniteExecution = true
extension ObservableType where E: Sequence {
typealias T = E.Iterator.Element
/// Create an observable which is an Array of the projected values
@pgherveou
pgherveou / concatMap.swift
Last active Dec 20, 2017
RxSwift + concatMap
View concatMap.swift
import PlaygroundSupport
import RxSwift
PlaygroundPage.current.needsIndefiniteExecution = true
/// ConcatMap Operator
/// Runs all observable sequences in parallel and concat their elements.
extension ObservableType {
func concatMap<T>(project: @escaping (E) -> Observable<T>) -> Observable<T> {
return self.map { (element) -> Observable<T> in
View generator.swift
import Foundation
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
/// define an operation success or error result
enum Result<T> {
case error(Error)
case success(T)
}
You can’t perform that action at this time.