This file contains 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
//assuming array look like this. | |
var arr = [ | |
["Status", "Name", "Marks", "Position"], | |
["active", Sarfaraz, 10.0, "Front-end-dev"], | |
["active", John, 10.0, "Front-end-dev"], | |
["deactive", Raganar, 10.0, "UI designer"], | |
]; | |
console.log (arrToObject(arr)); |
This file contains 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
export function SimpleGithubUser ($http) { | |
'ngInject'; | |
var apiUrl = 'https://api.github.com/'; | |
// instantiate our initial object | |
var SimpleGithubUser = function(username) { | |
this.username = username; | |
this.profile = this.getProfile(); | |
}; |
This file contains 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
var arr1 = [ | |
['A', 'B', 'C'], | |
['D', 'E', 'F'] | |
]; | |
var arr2 = [ | |
['A', 'B', 'C'], | |
[] | |
]; |
This file contains 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
export class HomeService { | |
constructor($log, $window, $rootScope, $http, $resource) { | |
'ngInject'; | |
this.$log = $log; | |
this.$http = $http; | |
this.$window = $window; | |
this.$rootScope = $rootScope; | |
This file contains 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
function isVisibleInViewport(id) { | |
var element = document.getElementById(id); | |
var rect = element.getBoundingClientRect(); | |
return ( | |
rect.top >= 0 && | |
rect.left >= 0 && | |
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && | |
rect.right <= (window.innerWidth || document.documentElement.clientWidth) | |
); | |
} |
This file contains 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
var options = { | |
height: 684, // sets the height in pixels of the window. | |
width: 585, // sets the width in pixels of the window. | |
toolbar: 0, // determines whether a toolbar (includes the forward and back buttons) is displayed {1 (YES) or 0 (NO)}. | |
scrollbars: 0, // determines whether scrollbars appear on the window {1 (YES) or 0 (NO)}. | |
status: 0, // whether a status line appears at the bottom of the window {1 (YES) or 0 (NO)}. | |
resizable: 0, // whether the window can be resized {1 (YES) or 0 (NO)}. Can also be overloaded using resizable. | |
left: 0, // left position when the window appears. | |
top: 0, // top position when the window appears. |
This file contains 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
/** | |
* we are going to upload file to s3 via node js by using | |
* aws-sdk - required | |
* busboy - required | |
* uuid - optional - for image renaming purpose | |
* with this library you can upload any kind of file to s3 via node js. | |
*/ | |
const AWS = require('aws-sdk'); | |
const UUID = require('uuid/v4'); |
This file contains 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
let url = `${YOUR_URL}`; | |
let promise = new Promise((resolve: any, reject) => { | |
this._httpClient.get(url).toPromise() | |
.then( | |
(res: any) => { | |
resolve(res); | |
}, | |
err => { | |
reject(err); |
This file contains 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
public moveArrayPosition(arr: any[], oldPosition: number, newPosition: number) { | |
if (newPosition >= arr.length) { | |
let k = newPosition - arr.length + 1; | |
while (k--) { | |
arr.push(undefined); | |
} | |
} | |
arr.splice(newPosition, 0, arr.splice(oldPosition, 1)[0]); | |
return arr; | |
} |
This file contains 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
/** | |
* author: [email protected] | |
* purpose: show native notifications accroding to os | |
*/ | |
import { ipcMain, BrowserWindow } from 'electron'; | |
import * as notifier from 'node-notifier'; | |
import * as path from 'path'; | |
import * as elog from 'electron-log'; |
OlderNewer