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
server { | |
listen 80; | |
server_name www.example.com; | |
# $scheme will get the http protocol | |
# and 301 is best practice for tablet, phone, desktop and seo | |
# return 301 $scheme://example.com$request_uri; | |
# We want to redirect people to the https site when they come to the http site. | |
return 301 https://example.com$request_uri; | |
} |
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
Knox = Npm.require("knox"); | |
var Future = Npm.require('fibers/future'); | |
var streamBuffers = Npm.require("stream-buffers"); | |
var knox; | |
var S3; | |
Meteor.publish('s3files', function(){ | |
return S3files.find({user: this.userId}) |
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
Template.s3progress.helpers({ | |
progress: function () { | |
var file_name = Session.get('s3-file-name') | |
console.log(file_name); | |
if(file_name != null){ | |
var file = S3files.findOne({file_name: file_name}); | |
if(file){ | |
console.log(file); | |
var percent = file.percent_uploaded | |
if(percent) |
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
put.on('progress',function(progress){ | |
// Update SOMETHING with the progress data | |
Meteor.bindEnvironment(function(){ | |
S3files.update({file_name: file.name}, {$set: {percent_uploaded: progress.percent}}); | |
},function(err){ | |
console.log(err); | |
}); | |
}); |
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
users = new Meteor.Collection('Users'); | |
Meteor.startup -> | |
Iconv = Meteor.require('iconv').Iconv | |
userIds = '53882537:128' | |
userInfo = HTTP.get( | |
'http://search.baihe.com/mystruts/userInfo.action', | |
{ | |
params: {userIds: userIds} | |
headers: {"Content-Type": "application/json; charset=utf-8"} | |
} |
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
{ | |
"iconv":"2.0.7" | |
} |
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
Meteor.startup () -> | |
# Countries collection initialization. | |
countries_csv = Assets.getText('country.csv') | |
csv = Meteor.require('csv') | |
countries_count = Countries.find().count() | |
if countries_count is 0 | |
Future = Npm.require('fibers/future') | |
future = new Future() | |
csv() | |
.from.string(countries_csv, {comment: '#'}) |
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
Meteor.publish('groups', function(group_id) { | |
return Groups.find({_id: group_id}); | |
}); |
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
# Do we have swap? | |
grep swap /etc/fstab -q | |
status=$? | |
if [ $status -ne 0 ]; then | |
dd if=/dev/zero of=/swapfile bs=1024 count=1048576 | |
echo "/swapfile none swap sw 0 0" >> /etc/fstab | |
swapon /swapfile | |
fi |
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
Meteor.startup () -> | |
# Countries collection initialization. | |
countries_csv = Assets.getText('country.csv') | |
csv = Meteor.require('csv') | |
countries_count = Countries.find().count() | |
if countries_count is 0 | |
Future = Npm.require('fibers/future') | |
future = new Future() | |
csv() | |
.from.string(countries_csv, {comment: '#'}) |