Skip to content

Instantly share code, notes, and snippets.

@apeque
apeque / convert-s3-image.js
Last active August 13, 2017 14:51
Image Conversion / S3 Upload Test
var config = require("../config.js");
var gm = require("gm"), imageMagick = gm.subClass({ imageMagick: true });
var httpg = require("http-get");
var imgSize = require("image-size");
var Q = require('Q');
var s3 = require('knox');
var _ = require("underscore");
var image = 'tmp/test.jpeg';
@blitline-dev
blitline-dev / scale_to_fit_example.js
Created August 1, 2014 23:50
scale_to_fit_example
{
"application_id": "YOUR_APP_ID",
"src": "http://cdn.blitline.com/filters/boys.jpeg",
"functions": [
{
"name": "composite",
"params": {
"src": "https://s3.amazonaws.com/img.blitline/my_logo.png",
"gravity": "SouthWestGravity",
"scale_to_fit": {
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<script>
UPLOADCARE_PUBLIC_KEY = 'demopublickey';
</script>
<script charset="utf-8" src="https://ucarecdn.com/widget/1.4.0/uploadcare/uploadcare-1.4.0.min.js"></script>
</head>
@bpceee
bpceee / awsFile.js
Last active August 12, 2017 23:54
aws ec2 nodejs
var AWS = require('aws-sdk');
AWS.config.loadFromPath('./config.json');
AWS.config.region = 'ap-southeast-1';
//1. download
// var s3 = new AWS.S3();
// var file = require('fs').createWriteStream('./docConv.html');
// var params = {Bucket: 'bpctest', Key: 'docConv.html'};
@madhums
madhums / base64-image-upload.js
Created September 14, 2014 17:37
save base64 encoded image
/*
* Taken from http://stackoverflow.com/questions/5867534/how-to-save-canvas-data-to-file/5971674#5971674
*/
var fs = require('fs');
// string generated by canvas.toDataURL()
var img = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0"
+ "NAAAAKElEQVQ4jWNgYGD4Twzu6FhFFGYYNXDUwGFpIAk2E4dHDRw1cDgaCAASFOffhEIO"
+ "3gAAAABJRU5ErkJggg==";
// strip off the data: url prefix to get just the base64-encoded bytes
@d-smith
d-smith / node-upload.js
Created October 31, 2014 15:40
Upload to S3
"use strict";
var AWS = require('aws-sdk');
var fs = require('fs');
AWS.config.update({region: 'us-east-1'});
AWS.config.loadFromPath('../config.json');
var httpProxy = process.env.http_proxy;
@pbogden
pbogden / README.md
Last active February 12, 2018 18:13
cors-enabled gsheet

##Google spreadsheet as a data source (CORS)

This demo retrieves data as CSV from the Google spreadsheet at this URL.

To adapt this demo to another spreadsheet:

  • You must share the spreadsheet so that "Anyone with the link can view" it.
  • You need a unique spreadsheet key (the long string 1Cj1...ieYo in the URL above). You can get it from the "shareable link", or from the address bar when you edit the spreadsheet in a browser.
@elliotbonneville
elliotbonneville / topkeywords.js
Last active April 5, 2025 00:41
Find top keywords associated with a Google search with this Node.js application.
var request = require("request"),
cheerio = require("cheerio"),
url = "https://www.google.com/search?q=data+mining",
corpus = {},
totalResults = 0,
resultsDownloaded = 0;
function callback () {
resultsDownloaded++;
@Xatpy
Xatpy / index.html
Last active October 19, 2024 10:49
CartoDB basemaps list
<!DOCTYPE html>
<html>
<head>
<title>Basemaps | CartoDB.js</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
<style>
html, body, .map {
height: 200px;
@ifraixedes
ifraixedes / LICENSE
Last active May 6, 2018 06:44
AWS lambda handler which download images from S3, resizes them and upload the new ones to S3; tested with mocha, chai, sinon and proxyquire
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004
(http://www.wtfpl.net/about/)
Copyright (C) 2015 Mario Mendes (@hyprstack)
Copyright (C) 2015 Ivan Fraixedes (https://ivan.fraixed.es)
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.