Skip to content

Instantly share code, notes, and snippets.

View ntd251's full-sized avatar
🎯
Focusing

Duong Nguyen ntd251

🎯
Focusing
  • Viki Inc.
  • Singapore
View GitHub Profile
@ntd251
ntd251 / retry_promise.js
Last active April 19, 2017 02:06
Retry a promise until succeed or reach max retry count
/**
* Retry a promise until succeed or reach max retry count.
*
* Options includes:
* - maxRetryCount:
* If -1 -> retry until success. Terminate if exceed max count.
* If 0 -> No retry
* Default: -1
*
* - retryPeriod: Timer period. Default: 3 seconds;
@ntd251
ntd251 / json_snake_keys_to_camel_keys.js
Last active January 10, 2023 09:55
Convert JSON snake-case (underscore) keys to camel-case keys
/**
* @author ntd251
* @dependency underscore.js
* @example
*
* input = {
* arrayItems: [
* numericKey: 10,
* jsonKey: {
MOVIE_TYPE = 493
EPISODE_TYPE = 494
SERIES_TYPE = 496
# Suits series id
channel_id = '310401'
filter = Kaltura::KalturaSearchAssetFilter.new
# Comma separated list of EPG channel ids to search within.
filter.id_in = channel_id
require 'kaltura'
# Kindly replace partnerID, email, and pwd with corresponding values
#
KALTURA_PARTNER_ID = 'partnerID'
KALTURA_USERNAME = 'email'
KALTURA_PASSWORD = 'pwd'
KALTURA_SERVICE_URL = 'http://console-sgs1.ott.kaltura.com/restful'
config = Kaltura::KalturaConfiguration.new