Skip to content

Instantly share code, notes, and snippets.

View jyotiarora2610's full-sized avatar

Jyoti Arora jyotiarora2610

View GitHub Profile
@jyotiarora2610
jyotiarora2610 / gist:cbd0c1c7d10d1d2d2522d0fab316d922
Created October 31, 2017 06:10
Camera integration through web
import React, { Component } from 'react'
import { Card, Flex } from 'antd-mobile'
import { Text, View, StyleSheet, Image } from 'react-native'
import * as routePaths from '../routes/web/routeConstants'
import order from '../images/odrMdcn@2x.png'
import reOrder from '../images/rflMdcn@2x.png'
window.addEventListener('mousemove', debounce(eventHandler, 2000));
function debounce (cb, wait) {
var timeoutID
return function (...args) {
clearTimeout(timeoutID)
timeoutID = setTimeout(() => cb.apply(this, args), wait)
}
}
var movieLists = [{
name: "New Releases",
videos: [{
"id": 70111470,
"title": "Die Hard",
"rating": 4.0
}, {
"id": 654356453,
"title": "Bad Boys",
"rating": 5.0
var arr = [1, 2, 3, 4, 5, 1, 2, 3, 4, 7, 8, 7, 1, 2, 3]
var finalArr = []
arr.forEach(function (element, index) {
if(arr.indexOf(element, index + 1) > -1) {
finalArr.push(element)
}
})
function timer(interval) {
setTimeout(function() {
console.log('hello')
timer(interval)
}, interval)
}
timer(2000)
function foo () {
var bar = 'bar'
function baz () {
console.log(bar)
}
bam(baz)
}
var str = 'the quick brown fox jumps then quickly blow air'
var arr = []
for(let i=0; i<=str.length; i++) {
if (arr[str[i]]) {
arr[str[i]]++
} else {
arr[str[i]] = 1
}
var person = function (firstName, age) {
this.name = firstName
this.age = age
}
person.prototype.getInfo = function () {
console.log(this.name + ' is ' + this.age + ' years old!')
}
var employee = function (firstName, age, salary) {
function deepClone(object){
var newObject = {};
for(var key in object){
if(typeof object[key] === 'object'){
newObject[key] = deepClone(object[key]);
}else{
newObject[key] = object[key];
}
}
return newObject;
function candies(n, arr) {
var ans = 0
var values = []
values[0] = 1
for (let i=1; i< n; i++) {
if (arr[i-1] < arr[i]) {
values[i] = values[i-1] +1
} else {
values[i] = 1
}