Skip to content

Instantly share code, notes, and snippets.

View domderen's full-sized avatar

Dominik Deren domderen

  • Hyperion Gray
  • Poland
View GitHub Profile
const fun = ({param1 = 'some default value', param2 = 'other default value'} = {}) => {
console.log(param1);
console.log(param2);
console.log(options); // Can I somehow get access to the object that has param1 and param2 inside?
console.log(arguments[0]); // Is this the only way?
};
function getValues () {
return {
a: 1,
b: 2
};
}
let {a, b} = getValues();
console.log(a, b);
function * getResponses(urls) {
const responses = urls.map(url => yield getServerResponse(url));
return responses;
}
# dockerhub - A repository for various dockerfiles
# For more information; http://github.com/cmfatih/dockerhub
#
# SlimerJS
#
# Test
# sudo docker run fentas/slimerjs /usr/bin/slimerjs -v
# sudo docker run fentas/slimerjs /usr/bin/casperjs | head -n 1
# sudo docker run -v `pwd`:/mnt/test fentas/slimerjs /usr/bin/slimerjs /mnt/test/test.js
usr/bin/slimerjs -v
usr/bin/slimerjs --webdriver `hostname -I | awk '{print $1}'`:8080 ${PHANTOMJS_OPTS} --webdriver-selenium-grid-hub http://hub:4444 --webdriver-logfile /tmp/webdriver.log --webdriver-loglevel DEBUG
#!/usr/bin/env bash
JS_FILES_LOCATION_PATTERN=$1
VERSION=$2
ATATUS_API_KEY=$3
URL=$4
ATATUS_CORRECT_RESPONSE="Upload successful!"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
// This is a simple approach to downloading the data from our API
// and processing it as JSON Object. This method is only sufficient for
// small API responses (should work for responses below 100k results).
// If your response contains more results, try having a look at this Stack Overflow QA:
// http://stackoverflow.com/questions/15121584/how-to-parse-a-large-newline-delimited-json-file-by-jsonstream-module-in-node-j
// We start by getting data from our API:
let extractorRunId = "00000000-0000-0000-0000-000000000000";
let jsonFieldId = "00000000-0000-0000-0000-000000000001"; // You can get this value, by displaying https://store.import.io/store/crawlrun/${extractorRunId} in the browser, and getting the value from `json` field.
let apiKey = "YOUR_API_KEY"; // You can get it here https://import.io/data/account/
@domderen
domderen / README.md
Created December 3, 2016 12:41
Returns the contents of a single file from a GitHub repository, relying on standard Git authentication method.

GitHub repositories don't support git archive command, which allows getting content of a single file. A different method of getting file contents from GitHub is to use GitHub API with an access token, but this requires a different authentication method, and would require creating a special account in an org that could be used for example in CI systems. I wanted a method that relies on the same auth method as git clone for example, and still just gets the content of a single file.

Example usage:

./get_github_file.sh facebook react docs/README.md
￿
module.exports = {
topic: 'SomeTopic4'
}