Skip to content

Instantly share code, notes, and snippets.

View andrepadez's full-sized avatar

André Alçada Padez andrepadez

View GitHub Profile
//READER Directive
var initNotes = function($scope, Note, element, $compile){
Note.find({
user: $scope.global.user._id,
module: $scope.module._id
}).then(function(response) {
$scope.notes = response;
angular.forEach($scope.notes, function(note){
var highlighted = element.find('span.phrase:contains("'+note.selectedText+'")');
var html = '<oowli-note _id="'+note._id+'" content="'+note.content+'"></oowli-note>';
@andrepadez
andrepadez / gist:9068119
Created February 18, 2014 10:16
Node.js File upload to Amazon S3
fs.readFile(file.path, function(err, buff){
completed++;
if(err){ return; }
var headers = {
'Content-Length': buff.length,
'Content-Type': 'text/plain'
};
var push = client.put(file.name, headers);
push.on('response', function(res){
(function setupGoogleMaps(){
if(typeof google === 'undefined'){ return; }
//Instantiate map object and set core options
var map = new google.maps.Map(document.getElementById("map"), {
center: new google.maps.LatLng(52.37022, 4.89517),
zoom: 6,
disableDefaultUI: true
});
//Instaniate infoWindow and marker image objects
@andrepadez
andrepadez / Git Submodules
Last active August 29, 2015 14:09
Submodules (this is very specific, don't follow this unless you're me)
FIRST TIME
JS-Calendar
git subtree split -P libs/bundles/albumprinter -b ap-transition
online-editor
git init
do one commit first
git remote add calendar ../js-calendar/
git subtree add --prefix=src calendar ap-transition
@andrepadez
andrepadez / git-post-receive
Created November 21, 2014 09:33
git post-receive hook for deployment by branch
#!/bin/bash
echo "Running Post-Receive hook"
while read oldrev newrev ref ; do
if [ "$ref" == "refs/heads/master" ]; then
GIT_WORK_TREE=/home/josh/production/sonimcampaign git checkout -f
echo 'branch master deployed to live'
elif [ "$ref" == "refs/heads/staging" ]; then
git symbolic-ref HEAD refs/heads/staging
GIT_WORK_TREE=/home/josh/staging/sonimcampaign git checkout -f
git symbolic-ref HEAD refs/heads/master
@andrepadez
andrepadez / tests - old and new
Created January 5, 2015 15:17
tests - old and new
var Dog = function(name, age){
if(!name || !age){
throw new Error('not enough params');
}
this.name = name;
this.age = age;
}
@andrepadez
andrepadez / gist:17b57d72898327161911
Created February 25, 2015 17:51
OpenShift setup
sudo gem install rhc
rhc setup
rhc tail -A maria
var ipaddress = process.env.OPENSHIFT_NODEJS_IP || "127.0.0.1";
var port = process.env.OPENSHIFT_NODEJS_PORT || 3000;
app.listen( port, ipaddress, function() {
console.log('listening on port ', port);
});
andrepadez in ~/develop/vigour-io/gaston on new-gaston*
⚡ rm -rf node_modules/
andrepadez in ~/develop/vigour-io/gaston on new-gaston*
⚡ cat package.json | grep nodegit
"nodegit": "nodegit/nodegit#master",
andrepadez in ~/develop/vigour-io/gaston on new-gaston*
⚡ clear
andrepadez in ~/develop/vigour-io/gaston on new-gaston*
⚡ npm i
andrepadez in ~/develop/vigour-io/directv-fl on master*
⚡ nodemon ../gaston/bin/gaston.js -w ../gaston/lib/
13 May 20:27:21 - [nodemon] v1.3.7
13 May 20:27:21 - [nodemon] to restart at any time, enter `rs`
13 May 20:27:21 - [nodemon] watching: /Users/andrepadez/develop/vigour-io/gaston/lib/**/*
13 May 20:27:21 - [nodemon] starting `node ../gaston/bin/gaston.js`
module.js:338
throw err;
^
Error: Cannot find module 'nodegit'