This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Created by gil_birman on 11/22/19. | |
import Combine | |
import FirebaseFirestore | |
import FirebaseStorage | |
import Foundation | |
enum FirebaseCombineError: Error { | |
case encodeImageFailed | |
case nilResultError |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ImageUtils { | |
static func copiedImage(_ image: UIImage) -> UIImage? { | |
UIGraphicsBeginImageContext(image.size) | |
image.draw(in: CGRect(x: 0, y: 0, width: image.size.width, height: image.size.height)) | |
guard let copy = UIGraphicsGetImageFromCurrentImageContext() else { return nil } | |
UIGraphicsEndImageContext() | |
return copy | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Verifying my Blockstack ID is secured with the address 1HUSxH3NLAtpGWFqKKZJSLCeNQTWSB7aL6 https://explorer.blockstack.org/address/1HUSxH3NLAtpGWFqKKZJSLCeNQTWSB7aL6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// cache an immutable list | |
// Ie: if an item changes, it's cacheKey *must* change as well | |
const cache = {}; | |
function cacheMap(objectKey, mapFn) { | |
const objectCache = cache[objectKey] || {}; | |
const nextObjectCache = cache[objectKey] = {}; | |
return this.map(item => | |
nextObjectCache[item.cacheKey] = | |
objectCache[item.cacheKey] || mapFn(item) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const renderer = new THREE.WebGLRenderer( {canvas: document.getElementById('canvas')} ); | |
renderer.setSize( window.innerWidth, window.innerHeight ); | |
renderer.autoClear = false; | |
const scene = new THREE.Scene(); | |
const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 ); | |
const geometry = new THREE.BoxGeometry( 1, 1, 1 ); | |
const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const identity = x => x; | |
const topTop = containerRect => rect => | |
~~(rect.top - containerRect.top); | |
const translate3dFormatter = value => `translate3d(${value.join('px,')}px)`; | |
const translate3d = (...args) => ({ | |
value: args, | |
formatter: translate3dFormatter, | |
factory: translate3d | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const React = require('react'); | |
const {Component} = React; | |
const {elegant, subedit} = require('elegant-react/classy')({debug: true}); | |
const {fromJS} = require('immutable'); | |
const initialState = fromJS({ | |
phone: '6665552222' | |
}); | |
const parsePhone = v => v.replace(/\D/g, '').substr(0,10); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {shouldComponentUpdate} from '../component-render-mixin'; | |
import {componentWillMount, componentWillReceiveProps} from '../statics-mixin'; | |
function elegant(DecoratedComponent) { | |
return class ElegantDecorator extends React.Component { | |
static displayName = `Elegant(${getDisplayName(DecoratedComponent)})`; | |
static DecoratedComponent = DecoratedComponent; | |
shouldComponentUpdate(nextProps, nextState) { | |
return shouldComponentUpdate.call(this, nextProps, nextState); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @param additionalMixins? {Array|Object} | |
// @param renderFn {Function} | |
// @returns Component | |
function component(additionalMixins, renderFn) { | |
renderFn = renderFn || additionalMixins; | |
additionalMixins = (additionalMixins instanceof Function) ? [] : [].concat(additionalMixins); | |
const mixins = [ComponentRenderMixin, | |
staticFunctionsMixin] | |
.concat(additionalMixins); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@elegant | |
class Hello extends Component { | |
render() { | |
const {name} = this.props; | |
return <div>Hello, {name}!</div> | |
} | |
} |
NewerOlder