node findEmbed.js {filename.csv}
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
var fs = require('fs'); | |
var file = __dirname + process.argv[2]; | |
fs.readFile(file, 'utf8', function (err, data) { | |
if (err) { | |
console.log('Error: ' + err); | |
return; | |
} | |
var contents = JSON.parse(data); | |
console.log(contents); |
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
exports.search = function(query,cb){ | |
var request = require('request'), | |
clientid = "dd", | |
secret = "dd", | |
sc_redirect_uri = "dd", | |
sc = require('soundclouder'); | |
var search = query.split(" ").join("+") | |
//this is working |
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
module.exports = function(grunt){ | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
connect: { | |
server: { | |
options: {}, | |
} | |
}, | |
watch: { |
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
$.ajax({ | |
url: '/fileUpload', | |
type: 'POST', | |
data: formData, | |
xhr: function(){ | |
var xhr = new window.XMLHttpRequest(); | |
//Upload progress | |
xhr.upload.addEventListener("progress", function(evt){ | |
if (evt.lengthComputable) { | |
var percentComplete = evt.loaded / evt.total *100; |
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
grunt.registerTask('boxy', function(){ | |
grunt.util.spawn({ | |
cmd: 'jade', | |
args: ['public/app/main/main.jade', '--out public/app/main/'] | |
}) | |
}) |
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
Front-end | |
--------- | |
$('<form action="'+ "/templatedl" +'" method="'+ ('post') +'">'+'<input type="hidden" name="file" value="'+filename+'"'+'/></form>').appendTo('body').submit().remove(); | |
Back-end | |
--------- | |
app.post('/templatedl',function(req,res){ | |
res.download(__dirname +'/'+ name+'.extension', function(err){ | |
if(err){console.log(err)} |
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
//THE REASON THAT I UNCLUDED OLD CODE COMMENTED OUT IS TO SHOW THE DISTINCTION BETWEEN MY OLD METHOD AND THE NEW OO WAY. | |
//DEVELOPED AFTER READING https://developer.mozilla.org/en-US/docs/Web/JavaScript/Introduction_to_Object-Oriented_JavaScript | |
var csv = require("ya-csv") | |
exports.check = function(filename,cb){ | |
//in the check | |
var pusher = function(filename){ | |
this.filename = filename; |
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
setTimeout ( -> woo()), 5000 |
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
var cors = require('cors') | |
var whitelist = ['http://localhost:4000','http://someotherserver.com']; | |
var corsOptions = { | |
origin: function(origin, callback){ | |
var originIsWhitelisted = whitelist.indexOf(origin) !== -1; | |
callback(null, originIsWhitelisted); | |
} | |
}; |
OlderNewer