Total Pageviews

Wednesday, August 2, 2017

Bulk unfollow people on LinkedIn

If you are using chrome go the page that shows who you are following (LinkedIn) and run this code in the chrome developer console. It will go and click the unfollow button for you. I had to scroll down on the page first so all the profiles would load before I ran the script.
  1. var buttons = $("button"),
  2. interval = setInterval(function(){
  3. var btn = $('.is-following');
  4. console.log("Clicking:", btn);
  5. btn.click();
  6. if (buttons.length === 0) {
  7. clearInterval(interval);
  8. }
  9. }, 1000);

Sunday, July 23, 2017

http URL not calling in Angular


Http uses rxjs and is a cold/lazy observable, meaning that you should subscribe to it to make it work.
  this.http.get(`http://swapi.co/api/people/1`).map((response:Response) => {
                console.log(response.json());
                response.json();
            }).subscribe();
Or if you want to subscribe from somewhere else , you should return the http.get method like this : :
 getAllPersons():Observable<any>{
    console.log("Here");
       return this.http.get(`http://swapi.co/api/people/1`).map((response:Response) => {
        console.log(response.json());
        response.json();
    });
    } 
and then :
   getAllPersons().subscribe();

building and Deploying Google Firebase cloud functions

https://firebase.google.com/docs/functions/get-started

$ firebase deploy --only functions
$ firebase deploy --only functions:addMessage

Tuesday, July 18, 2017

Cannot set variable of undefined

https://stackoverflow.com/questions/38807643/error-uncaught-in-promise-typeerror-cannot-set-property-isadmin-of-null

when variable not set in function "then" block, this doesnt work, need to a copy of "this" reference with in the calling function.



down voteaccepted
Either you can use arrow function
firebase.database().ref('/userProfile/' + user.uid).once('value')
.then((snapshot) => {
or use
var self = this;

firebase.database().ref('/userProfile/' + user.uid).once('value')
.then(function(snapshot) {
   self.isAdmin = true;
otherwise this doesn't point to the current function when it's called.

Monday, July 17, 2017

promise-polyfill error while using Firebase in Angular


ERROR in ./~/firebase/app/shared_promise.js

Module not found: Error: Can't resolve 'promise-polyfill'

Solution: 
npm install promise-polyfill --save-exact

Friday, July 14, 2017

continuous integration | angular cli + firebase + travis ci

https://houssein.me/continuous-integration-angular-firebase-travisci

Angular project with gitHub

http://developer.telerik.com/featured/quick-angular-2-hosting-angular-cli-github-pages/

Tuesday, July 11, 2017

Udemy course videos download


CourtesyPankaj Barnwal, Quora ( https://www.quora.com/How-do-I-download-videos-from-Udemy)

How to Download your subscribed course videos from Udemy:

If you don't mind getting your hand dirty in coding, may i suggest you a python script 'python-dl' which is best to download videos from the mentioned course site.
Step-by-step Guide -
if you dont have pip installer, have it installed via following command-
  1. sudo apt install python-pip
Now download python script "python-dl" through pip install-
  1. sudo pip install udemy-dl
Below is the command to download entire udemy course using this script
  1. udemy-dl course-link
Next type your username & password and you will be good to go, or you can type them in the same sentence like this
  1. udemy-dl -u username -p password course link
Advance Usage - This is where it gets fun. if you want to download specific video from the list, use following command -
  1. udemy-dl -u username -p password --lecture-start lecture No where you want download to start --lecture-end end point
For Example -
  1. udemy-dl -u abcd@xyz.com -p HND$#$5 --lecture-start 52 --lecture-end 58 https://www.udemy.com/COURSE_NAME
Note - This script does not pull written docs but it works great for videos.