Skip to content

Instantly share code, notes, and snippets.

View vishwanatharondekar's full-sized avatar

Vishwanath Arondekar vishwanatharondekar

View GitHub Profile
{
"body": {
"results": {
"uri": "https://qa-api.hotstar.com/o/v1/page/2735?offset=0&size=10&tao=0&tas=10",
"pageType": "NAVIGATION_LANDING_PAGE",
"responseType": "TRAY_LIST",
"trays": {
"items": [
{
"title": "news masthead yash",
{
"response": {
"2xx": {
"type": "object",
"properties": {
"statusCode": {
"type": "string"
},
"statusCodeValue": {
"type": "integer"
export const mobileRenderable = function (target, name, descriptor) {
//Do this only on client side
if (canUseDOM) {
console.log('mobileRenderable getting applied client')
const originalRender = target.prototype.render
let mobileRender = target.prototype.renderMobile
//Throw warning if user has used mobileRenderable but have not provided renderMobile
if (!mobileRender) {
console.warn(target, ' is decorated with mobileRenderable but renderMobile function is not provided. Regular render will be used.')
export const mobileRenderable = function (target, name, descriptor) {
const originalRender = target.prototype.render
let mobileRender = target.prototype.renderMobile
//Device identification
let device = deviceIdentification().formFactor || 'desktop'
let functionToCall = null
if (device === 'mobile') {
@mobileRenderable
class MyComponent extends React.Component {
renderMobile(){
return(<div>Aswesome My Component rendered for mobile </div>)
}
render(){
return(<div>Awesome My Component</div>)
}
class MyComponent extends React.Component {
render(){
return(<div>Awesome My Component</div>)
}
}
var dataUpdatePromise = $q.defer();
var params = {
"sportId": 1, //Cricket
"callerId": "scores-tray-caller-id", //TODO : Create constant for this
"onSportsDataLoad": function(data) {
data.matches = prepareMatchesForView(data.matches);
deferred.resolve({
docs: data.matches,
matches: data.matches,
numFound: data.matches.length,
'use strict';
angular.module('hotStar.multisportSDKManager', ['hotStar.utils'])
.factory('MultiSportManager', ['$filter', '$rootScope', 'Utils', 'Configuration', '$location', '$cookies', '$q', 'BaseConfig', function($filter, $rootScope, utils, configuration, $location, $cookies, $q, baseConfig) {
var sdk;
var deferred = $q.defer();
var multisportSDK = {
initSDK: function() {
try {
@vishwanatharondekar
vishwanatharondekar / sum-javascript
Created April 19, 2016 16:36
Sum function in javascript which handles nan and decimal points correctly
function sum(){
var args = Array.prototype.slice.call(arguments);
var total = 0;
var highestDecimalPoints = 0;
var sanitizedArray = [];
args.forEach(function(no){
if(!isNaN(no)){
//If no is decimal
if(no % 1 > 0){
@vishwanatharondekar
vishwanatharondekar / git-aliases.sh
Created October 2, 2015 15:45
Git aliases I use from zsh
gco # git checkout
grhh # git reset --hard
ggpush # git push origin $(current_branch)
gpu # git push upstream