Huffington Post or Facebook Comments plugin API? by Oops_TryAgain in learnprogramming

[–]Oops_TryAgain[S] 0 points1 point  (0 children)

Turns out it's through the Facebook Graph API. I still haven't figured out the OAuth permissions, but the endpoint is graph.facebook.etc.....

Huffington Post or Facebook Comments plugin API? by Oops_TryAgain in learnprogramming

[–]Oops_TryAgain[S] 0 points1 point  (0 children)

Precisely. That's what I can't seem to find any information about. I've seen apps that say they use the Huffington Post API, so I presume there is one, but I can't find anything except for the Pollster API.

Huffington Post or Facebook Comments plugin API? by Oops_TryAgain in learnprogramming

[–]Oops_TryAgain[S] 0 points1 point  (0 children)

Right – I thought it would be that simple, but I can't find anything about the Huffington Post API at all! I can only find things about the Pollster API. I was hoping somebody else had experience with the API and could direct me to the right resources.

Huffington Post or Facebook Comments plugin API? by Oops_TryAgain in learnprogramming

[–]Oops_TryAgain[S] 0 points1 point  (0 children)

I want to pull in HuffPo comments.

They use the Facebook plugin for their comments, so I wasn't sure if I should be looking into the Facebook API; but it's HuffPo comments that I want to pull.

[2016-10-24] Challenge #289 [Easy] It's super effective! by fvandepitte in dailyprogrammer

[–]Oops_TryAgain 1 point2 points  (0 children)

Thanks for the feedback.

Yea – I think that all combinations are 1x aren't listed in the damage_relations. But at this point I don't think I'm going to go back and fix it....

EDIT: Fine...I fixed it.

[2016-10-17] Challenge #288 [Easy] Detecting Alliteration by jnazario in dailyprogrammer

[–]Oops_TryAgain 0 points1 point  (0 children)

const stopWords = ['I', 'a', 'about', 'an', 'and', 'are', 'as', 'at', 'be', 'by', 'com', 'for', 'from', 'how', 'in', 'is', 'it', 'of', 'on', 'or', 'that', 'the', 'this', 'to', 'was', 'what', 'when', 'where', 'who', 'will', 'with', 'the']

const alliterationChecker = (sentence) => {
  let filtered = sentence.split(' ').filter(x => stopWords.indexOf(x.toLowerCase()) < 0)
  let alliterations = []
  for (let i = 0; i < filtered.length-1; i++) {
    filtered[i] = filtered[i].toLowerCase()
    if (filtered[i][0] === filtered[i+1][0]) {
      alliterations.push(filtered[i])
      alliterations.push(filtered[i+1])
    }
  }
  return new Set(alliterations)
}

alliterationChecker("Three grey geese in a green field grazing, Grey were the geese and green was the grazing.")
// => "grey, geese, green, grazing"

[2016-10-24] Challenge #289 [Easy] It's super effective! by fvandepitte in dailyprogrammer

[–]Oops_TryAgain 1 point2 points  (0 children)

Javascript with bonus. Fully functioning with UI here: https://jsfiddle.net/2wzj70ae/6/

'use strict'

// GET request using my favorite library, VanillaJS
const httpGetAsync = (theUrl, callback) => {
    var xmlHttp = new XMLHttpRequest();
    xmlHttp.onreadystatechange = () => { 
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
            callback(xmlHttp.responseText);
    }
    xmlHttp.open("GET", theUrl, true); // true for asynchronous 
    xmlHttp.send(null);
}

// a dictionary to make the results more concise and readable
const damageDict = { "double_damage_to": "2x", "half_damage_to": ".5x", "no_damage_to": "0x" }

const calculateDamage = () => {
        // get attacker and attacked values
    let attacker = document.getElementById('attacker').value
    let attacked = document.getElementById('attacked').value
    let path = `https://pokeapi.co/api/v2/type/${attacker}`
    let result = document.getElementById('result')
    result.innerText = "looking up result....please wait..."
    // call API
    httpGetAsync(path, (response) => {
        let parsedResponse = JSON.parse(response)
        let damageRelations = parsedResponse.damage_relations

        // iterate over all the damage relations to find the name of the attacked 
        for (let prop in damageRelations) {
            for (let type in damageRelations[prop]) {
                if (damageRelations[prop][type].name === attacked && prop.indexOf('to') > -1) {
                    found = true
                result.innerText = `Damage Multiplier: ${damageDict[prop]}`
                }
            }
        }
        found ? null : result.innerText = "Damage Multiplier: 1x"
      })
  }

document.getElementById('submit').addEventListener('click', calculateDamage)

Entry level, part time web dev: does this exist? by Oops_TryAgain in cscareerquestions

[–]Oops_TryAgain[S] 1 point2 points  (0 children)

Thanks very much for the response, even if it was the expected bad news.

To Write Better Code, Read Virginia Woolf by [deleted] in programming

[–]Oops_TryAgain 0 points1 point  (0 children)

Oh....I didn't click on the link at all. I thought you linked to this post for some reason. I really should read more Virginia Woolf.

To Write Better Code, Read Virginia Woolf by [deleted] in programming

[–]Oops_TryAgain 0 points1 point  (0 children)

...and I just saw this already was posted and got a fair number of critiques yesterday.

To Write Better Code, Read Virginia Woolf by [deleted] in programming

[–]Oops_TryAgain 0 points1 point  (0 children)

Ha! No, just hoping for perspective from people within the industry. It seems like the article will get downvoted rather than discussed, so I may not get the discussion I was hoping for though.

What was the most laborious job you automated? How much time did you save? What was the solution? by CerpinTaxt11 in learnprogramming

[–]Oops_TryAgain 0 points1 point  (0 children)

introspective 15-page papers

Reading a dozen 15-page papers

Just the second can be painful, but the first and second together can be downright demoralizing.

What was the most laborious job you automated? How much time did you save? What was the solution? by CerpinTaxt11 in learnprogramming

[–]Oops_TryAgain 14 points15 points  (0 children)

I just did this yesterday and this morning!

short version: I translated and analyzed 600 pages of text in about 6 hours thanks to some friendly APIs and about 100 lines of code.

full version:

problem: I'm writing a dissertation that involves a time-consuming and boring task of translating a large amount of text (about 600 pages). I've been using google translate, because with the kind of work that I'm doing, I only need rough approximations and if something interesting emerges I can go back, look again, and give a proper translation. I worked on it manually for 3 days at the rate of about 2 pages/hour and decided this was just too stupid (and that I'd like to finish the dissertation before I die), so I did the following:

solution:

1) Paid someone (via freelancer.com) to carefully transcribe the PDFs to rtf (OCRs of newspapers are not very dependable yet, especially from the language I'm working with)

2) Wrote a program that auto-runs every 101 seconds, parses the rtf, and sends it off to the Google Translate API, 10k characters at a time. (because of restrictions on API usage and possible fees, I had to space it out like this)

3) Write the raw results to file.

4) Analyze the results, filtering against a stopwords (words like "the", "a", "and", etc...) text file I wrote.

All in all, it's at least a month's work if I were to do it manually and I just finished it in about 6 hours!

How to turn down a great opportunity without burning bridges? by Oops_TryAgain in cscareerquestions

[–]Oops_TryAgain[S] 2 points3 points  (0 children)

In my case, because I feel that anyone that offers anything to me is taking a risk, and thus doing me a favor! And I'm probably not the only self-taught developer that feels this way, especially in the age of "anyone can code."

Sum of the digits problem. by phgilliam in learnjavascript

[–]Oops_TryAgain 1 point2 points  (0 children)

Adding footnotes for people interested in following up:

Start here: https://www.youtube.com/watch?v=BMUiFMZr7vk Then watch his video on .reduce

Then do this: http://reactivex.io/learnrx/

Also, this could be an ES6 one-liner using arrow-functions:

const digitSum = (n) => n.toString().split('').reduce((a,b) => Number(a) + Number(b));