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
const path = require('path'); | |
const fs = require('fs'); | |
const _ = require('lodash'); | |
// | |
// salesMap : categoryMap = { category: [ price1, price2 ] } | |
// salesMap = { category: [ avgSalesPrice ] } | |
// | |
/** | |
* @param {Array} categoriesRawData input array of categories [ { item: name, category: cat } ] |
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
import axios from 'axios'; | |
import AWS from "aws-sdk"; | |
/** Steps to use this: | |
* Refer to this doc from AWS on how to create S3 supporting Identity to use in this component. https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/s3-example-photo-album.html | |
* (1) Create Cognito identity pool (see this) and grab the ID of the pool | |
* (2) Ensure the IAM created by cognito has access to your S3 bucket | |
* (3) Use this vue component as a uploader component to upload one image. We can rewrite it to support multi images easily. | |
* | |
* Once done through with the Prerequisite tasks part of the above, just grab the cognito Identity pool id and come here. |
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
0xA7aA4C344e38ab5d57687608E198cEAC09027ea4 |
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
# If you use Rails, just add a lib/tasks/tweets.rb or something and paste this code there, then run rake tweets:tweet1 to run it | |
# This stops after 50 tweets but you don't have to! Now sit back and watch your custom twitter feed live on your console! | |
require 'tweetstream' | |
require 'awesome_print' | |
namespace :tweets do | |
desc "Tracks tweets with specified strings and stores them in db" | |
task tweet1: :environment do |
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
// An attempt to solve the sum of primes problems posted at http://projecteuler.net/problem=10 | |
// References: http://stackoverflow.com/questions/15750574/js-prime-numbers-script-explanation | |
// Runs in about 89.4s on my Windows dual-core laptop, Win 7, Intel Core 2 Duo (x2GHz), 4GB RAM, using nodejs | |
// My output: | |
// 142913828922 | |
// primes found 148933 | |
// [Finished in 89.4s] | |
// Verified against answer on projecteuler.net |