Skip to content

Instantly share code, notes, and snippets.

Avatar

Simform simform-solutions

View GitHub Profile
View GetDateFormatExtension.kt
/**
* get the date format by using the date as a string.
* This Extension function returns date format, if it matches with any format else it will return null
*/
fun String.getDateFormat(): String? {
val dateFormats = arrayOf(
"yyyy-MM-dd'T'HH:mm:ss.SSSXXX",
"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'",
"yyyy-MM-dd'T'HH:mm:ss.SSSZ",
"yyyy-MM-dd'T'HH:mm:ss'Z'",
View AVImageDetection.swift
func renderer(_ renderer: SCNSceneRenderer, nodeFor anchor: ARAnchor) -> SCNNode? {
let node = SCNNode()
if let imageAnchor = anchor as? ARImageAnchor {
let plane = SCNPlane(width: imageAnchor.referenceImage.physicalSize.width, height: imageAnchor.referenceImage.physicalSize.height)
plane.firstMaterial?.diffuse.contents = UIColor(white: 1, alpha: 0.8)
let material = SCNMaterial()
material.diffuse.contents = viewObj
plane.materials = [material]
let planeNode = SCNNode(geometry: plane)
planeNode.eulerAngles.x = -.pi / 2
@simform-solutions
simform-solutions / DataTabe.js
Created Jun 20, 2018
Material DataTable component with Dynamic data and Event Handlers
View DataTabe.js
import React from 'react';
import classNames from 'classnames';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
import Table from '@material-ui/core/Table';
import TableBody from '@material-ui/core/TableBody';
import TableCell from '@material-ui/core/TableCell';
import TableHead from '@material-ui/core/TableHead';
import TablePagination from '@material-ui/core/TablePagination';
import TableRow from '@material-ui/core/TableRow';
@simform-solutions
simform-solutions / Login.component.js
Created Jun 20, 2018
Auth module with Redux and Saga Integration
View Login.component.js
import React, { Fragment } from 'react'
import cx from 'classnames'
import { connect } from 'react-redux'
import { Icon } from 'antd'
import { Helmet } from 'react-helmet'
import { FormattedMessage } from 'react-intl'
import { withRouter } from 'react-router-dom'
import { truncatePhoneNumber } from 'config/utils'
import { required, phoneConstraints } from 'config/validators'
import { actions } from 'rdx/auth'
View AVReadARObjectVC.swift
func renderer(_ renderer: SCNSceneRenderer, nodeFor anchor: ARAnchor) -> SCNNode?
View AVReadARObjectVC.swift
let configuration = ARWorldTrackingConfiguration()
// ARReferenceObject(archiveURL :... this method used when we have ARReferenceObject Store in local Document Directory
configuration.detectionObjects = Set([try ARReferenceObject(archiveURL: objectURL!)])
// ARReferenceObject.referenceObjects(inGroupNamed... this method used when we have ARReferenceObject Store in Assest Folder
configuration.detectionObjects = ARReferenceObject.referenceObjects(inGroupNamed: "", bundle: .main)!
sceneView.session.run(configuration)
View AVSharingWorldMapVC.swift
func receivedData(_ data: Data, from peer: MCPeerID) {
if let unarchived = try? NSKeyedUnarchiver.unarchivedObject(of: ARWorldMap.classForKeyedArchiver()!, from: data), let worldMap = unarchived as? ARWorldMap {
// Run the session with the received world map.
let configuration = ARWorldTrackingConfiguration()
configuration.planeDetection = .horizontal
configuration.initialWorldMap = worldMap
sceneView.session.run(configuration, options: [.resetTracking, .removeExistingAnchors])
mapProvider = peer
}
}
View AVSharingWorldMapVC.swift
sceneView.session.getCurrentWorldMap { worldMap, error in
guard let map = worldMap
else { print("Error: \(error!.localizedDescription)"); return }
guard let data = try? NSKeyedArchiver.archivedData(withRootObject: map, requiringSecureCoding: true)
else { fatalError("can't encode map") }
self.multipeerSession.sendToAllPeers(data)
}
View AVImageDetection.swift
func renderer(_ renderer: SCNSceneRenderer, nodeFor anchor: ARAnchor) -> SCNNode? {
let node = SCNNode()
if let imageAnchor = anchor as? ARImageAnchor {
let plane = SCNPlane(width: imageAnchor.referenceImage.physicalSize.width, height: imageAnchor.referenceImage.physicalSize.height)
plane.firstMaterial?.diffuse.contents = UIColor(white: 1, alpha: 0.8)
let material = SCNMaterial()
material.diffuse.contents = viewObj
plane.materials = [material]
let planeNode = SCNNode(geometry: plane)
planeNode.eulerAngles.x = -.pi / 2
View AVImageDetection.swift
let configuration = ARImageTrackingConfiguration()
let warrior = ARReferenceImage(UIImage(named: "DD")!.cgImage!,orientation: CGImagePropertyOrientation.up,physicalWidth: 0.90)
configuration.trackingImages = [warrior]
configuration.maximumNumberOfTrackedImages = 1