Skip to content

Instantly share code, notes, and snippets.

@eduardoromero
eduardoromero / gist:da56697d9f0d013657eb
Created July 2, 2015 23:38
Uploadcare Multiplefiles
var widget = uploadcare.Widget('[role=uploadcare-uploader]');
widget.onUploadComplete(function (response) {
if(response) {
uploadcare.loadFileGroup(response.uuid)
.done(function(fileGroup) {
// Group creation completed successfully.
var files = fileGroup.files();
$.each(files, function(i, file) {
// Wait for file uploading.
@chrisjhoughton
chrisjhoughton / remove.liquid
Last active November 11, 2024 20:47
Remove a Shopify cart attribute
{% if cart.attributes.yourCartAttribute %}
<script>
$.ajax({
type: 'POST',
url: '/cart/update.js',
data: 'attributes[yourCartAttribute]=',
dataType: 'json'
});
</script>
{% endif %}
@Marak
Marak / imageResize.js
Last active July 31, 2019 19:04
hook.io example microservice for resizing images
module['exports'] = function imageResize (hook, callback) {
// GraphicsMagick fully supported
var gm = require('gm');
// for a more complete example that supports file uploads and streaming uploads
// see: http://image.resize.hook.io
// grab an image as a url
// no file has been uploaded, fallback to the image "url" parameter
var stream = hook.open('https://hook.io/img/robotcat.png');
hook.res.writeHead(200, { 'Content-Type': 'image/png' });
gm(stream)
@jice-lavocat
jice-lavocat / imageSyncing.js
Last active May 6, 2022 05:18
AWS Lambda - S3 : Thumbnail creation
// dependencies
var async = require('async');
var path = require('path');
var AWS = require('aws-sdk');
var gm = require('gm').subClass({
imageMagick: true
});
var util = require('util');
// get reference to S3 client
var s3 = new AWS.S3();
@gene1wood
gene1wood / all_aws_lambda_modules_python.md
Last active January 28, 2025 09:47
AWS Lambda function to list all available Python modules for Python 2.7 3.6 and 3.7
@zeynepsu
zeynepsu / index.js
Last active March 14, 2018 09:18
Algorithmia NodeJS SDK
/*
* Algorithmia Lambda Sample Code
*/
var AWS = require('aws-sdk');
var apiKey = 'YOUR_API_KEY_HERE'
exports.handler = function (event, context) {
// Specify the target algorithm
var algo = "algo://besirkurtulmus/quadtree_art/0.1.x";
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" type="text/css" href="http://app.englishpatient.org/assets/css/semantic.min.css">
@woloski
woloski / payment.html
Last active October 1, 2020 15:46
Stripe Checkout + webtask
<button class="pay">Pay</button>
<script src="https://checkout.stripe.com/checkout.js">
<script>
var handler = StripeCheckout.configure({
key: window.STRIPE_PUBLICK_KEY,
image: 'https://yourlogo.png',
locale: 'auto',
token: function(token) {
$('.pay').prop("disabled", true);
@sammachin
sammachin / db2s3.py
Created January 27, 2016 10:45
Dropbox to S3 image upload
import dropbox
import tinys3
import tempfile
from string import Template
import random
import string
S3_ACCESS_KEY = ""
S3_SECRET_KEY= ""
@HaNdTriX
HaNdTriX / toDataUrl.js
Last active February 18, 2021 20:02
Example of converting a file to a dataURL in ES6
const toDataURL = url => fetch(url)
.then(response => response.blob())
.then(blob => new Promise((resolve, reject) => {
const reader = new FileReader()
reader.onloadend = () => resolve(reader.result)
reader.onerror = reject
reader.readAsDataURL(blob)
}))