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
import multer from 'multer'; | |
import cloudinary from 'cloudinary'; | |
import fileUploadMiddleware from './fileUploadMiddleware'; | |
/* your servrer init and express code here */ | |
cloudinary.config({ | |
cloud_name: 'xxx', | |
api_key: 'xxxx', | |
api_secret: 'xxxxx', |
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
import axios from 'axios'; | |
import cloudinary from 'cloudinary'; | |
export default function fileUploadMiddleware(req, res) { | |
cloudinary.uploader.upload_stream((result) => { | |
axios({ | |
url: '/api/upload', //API endpoint that needs file URL from CDN | |
method: 'post', | |
data: { | |
url: result.secure_url, |
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
import Ember from 'ember'; | |
// because it's loading through browserify, we're preficing it with npm: | |
import AWS from 'npm:aws-sdk' | |
// It's recommended to keep all your API keys in the environment.js file | |
// and pass them through environment variables | |
import config from '../config/environment'; | |
const ses = new AWS.SES({ | |
apiVersion: '2010-12-01', | |
accessKeyId: config.aws.accessKeyId, |
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
actions: { | |
sendContactForm() { | |
// Getting input values. | |
// TODO: add validation before trying to save the values. | |
const submittedForm = { | |
name: this.get('name'), | |
email: this.get('email'), | |
company: this.get('company'), | |
phone: this.get('phone'), | |
message: this.get('message'), |
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
import express from 'express'; | |
import axios from 'axios'; | |
import multer from 'multer'; | |
const app = express(); | |
/** | |
... express.js boilerplate | |
routes, middlewares, helpers, loggers, etc | |
**/ |
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
// Redux action | |
export function uploadSuccess({ data }) { | |
return { | |
type: 'UPLOAD_DOCUMENT_SUCCESS', | |
data, | |
}; | |
} | |
export function uploadFail(error) { | |
return { |
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
function add (a,b) { | |
return a+b; | |
} |
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
<?php | |
/* | |
Plugin Name: NDM metaboxes | |
Description: portfolio metaboxes for NDM | |
Version: 0.11 | |
Author: Alex Bachuk | |
Author URI: http://alexbachuk.com | |
License: GPL2 | |
*/ | |
?> |
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
// The actual grunt server settings | |
connect: { | |
options: { | |
port: 9000, | |
hostname: 'localhost', | |
livereload: 35729 | |
}, | |
proxies: [{ | |
context: '/api', // the context of the data service | |
host: 'mydomain.com/apis/', // wherever the data service is running |
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
$.fn.swipeEvents = function() { | |
return this.each(function() { | |
var startX, | |
startY, | |
$this = $(this); | |
$this.bind('touchstart', touchstart); |