This file contains hidden or 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
async in lambda | |
var async = require('async'); | |
var AWS = require('aws-sdk'); | |
var fs = require('fs'); | |
//Read config values from a JSON file. | |
var config = fs.readFileSync('./app_config.json', 'utf8'); | |
config = JSON.parse(config); |
This file contains hidden or 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 AWS = require('aws-sdk'); | |
AWS.config.update({accessKeyId: "ACCESS_KEY",secretAccessKey: 'SECRET_KEY'}); | |
var bucket = "arn:aws:s3:::nm3sys-tmp" | |
//put for small objects | |
function putObjectToS3(bucket, key, data){ | |
var s3 = new AWS.S3(); | |
var params = { | |
Bucket : bucket, | |
Key : key, |
This file contains hidden or 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 AWS = require('aws-sdk'); | |
//Policies | |
//AWSLambdaFullAccess | |
//CloudWatchFullAccess | |
//CloudWatchLogsFullAccess | |
//AWSIoTDataAccess | |
var iotdata = new AWS.IotData({endpoint: '?????.iot.us-west-2.amazonaws.com'}); | |
exports.handler = (event, context, callback) => { |
This file contains hidden or 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 fs = require('fs'); | |
//Read config values from a JSON file. | |
var config = fs.readFileSync('./app_config.json', 'utf8'); | |
config = JSON.parse(config); | |
This file contains hidden or 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
//make sure doc loads before we try to manipuate it | |
$(document).ready(function(){ | |
//all Jquery code | |
document.write("hello"); | |
}); | |
//manipuate objects | |
$("div").addClass("myClass"); //select all div tags | |
$("#myDiv").css("color","red"); //with the id, set the colr |
This file contains hidden or 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
// Load the http module to create an http server. | |
var http = require('http'); | |
// Configure our HTTP server to respond with Hello World to all requests. | |
var server = http.createServer(function (request, response) { | |
response.writeHead(200, {"Content-Type": "text/plain"}); | |
response.end("Hello World\n"); | |
}); | |
// Listen on port 8000, IP defaults to 127.0.0.1 |
This file contains hidden or 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
// Call the console.log function. | |
console.log("Hello World"); |
This file contains hidden or 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
//http://www.mojavelinux.com/articles/javascript_hashes.html | |
//examples | |
//var h = new HashTable({one: 1, two: 2, three: 3, "i'm no 4": 4}); | |
//alert('original length: ' + h.length); | |
//alert('value of key "one": ' + h.getItem('one')); | |
//alert('has key "foo"? ' + h.hasItem('foo')); | |
//alert('previous value of key "foo": ' + h.setItem('foo', 'bar')); | |
//alert('length after setItem: ' + h.length); | |
//alert('value of key "foo": ' + h.getItem('foo')); |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head><title>blank</title></head> | |
<body> | |
<script> | |
var x = document.getElementById("demo"); | |
function getLocation() { | |
if (navigator.geolocation) { | |
navigator.geolocation.getCurrentPosition(showPosition); | |
} else { |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head><title>blank</title></head> | |
<body> | |
<script> | |
var x = document.getElementById("demo"); | |
function getLocation() { | |
if (navigator.geolocation) { | |
navigator.geolocation.getCurrentPosition(showPosition); | |
} else { |