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
<Location /auth/foo/callback> | |
AuthType shibboleth | |
ShibRequireSession On | |
ShibRequestSetting entityID https://foo.shib.idp | |
require valid-user | |
</Location> | |
<Location /auth/bar/callback> | |
AuthType shibboleth | |
ShibRequireSession On |
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 OmniAuth::Strategies | |
class Foo < Shibboleth | |
def name | |
:foo | |
end | |
end | |
class Bar < Shibboleth | |
def name | |
:bar |
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
openssl enc -d -aes256 -a -in <encryptedfile> |base64 --decode > <outputfile> |
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
$scope.onFile = function(files) { | |
//onFile goes through each file inside the files array, encrypts them and | |
//pushes the blobs to an array | |
for (var i = 0; i < files.length; i++) { | |
Crypt.bury(files[i], $scope.key.value, function(blob) { | |
$scope.$apply(function() { | |
$scope.files.push(blob) | |
}); | |
}); | |
} |
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
//This is the service which is injected inside the controller and encrypts each | |
//file in the array generated by the directive | |
services.service('Crypt', [ | |
function() { | |
this.bury = function(file, key, callback) { | |
// we need a new FileReader instance to read the file's content | |
var reader = new FileReader(); | |
//we read the content as array buffer so we can handle binary data | |
//too | |
reader.readAsArrayBuffer(file); |
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
//This directive handles multiple file selection and makes them available | |
// as an array to the onFile() function inside the controller | |
directives.directive('fileselect', ['$parse', | |
function($parse) { | |
return function(scope, elem, attr) { | |
var fn = $parse(attr['fileselect']); | |
elem.bind('change', function(evt) { | |
var files = []; | |
var fileList = evt.target.files; | |
for (var i = 0; i < fileList.length; i++) { |
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
app.post('/file', function(req, res) { | |
//We create a write stream which will save the file to gridfs. | |
//"gridfs-stream" is great at this. | |
var writestream = gfs.createWriteStream({ | |
filename: req.files.file.name | |
}); | |
//fs.createReadStream() will read the file uploaded to tmp directory and | |
//pipe it to the write stream. |
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
directives.directive('twitter', [ | |
function() { | |
return { | |
link: function(scope, element, attr) { | |
setTimeout(function() { | |
twttr.widgets.createShareButton( | |
attr.url, | |
element[0], | |
function(el) {}, { | |
count: 'none', |
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
"use strict"; | |
app.controller('mainCtrl', ['$scope', '$http', | |
function($scope, $http) { | |
$scope.onFileSelect = function(files) { | |
console.log(files); | |
for (var i = 0; i < files.length; i++) { | |
var file = files[i]; | |
$http.uploadFile({ | |
url: 'api/file', |
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
# DOCKER-VERSION 0.5.3 | |
FROM ubuntu:12.10 | |
RUN apt-get update | |
RUN apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config wget -y | |
RUN wget ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz | |
RUN tar xvf ruby-2.0.0-p247.tar.gz | |
RUN cd ruby-2.0.0-p247; ./configure; make install | |
RUN gem update --system | |
RUN gem install bundler | |
ADD . /src |