- version 3.6
Kind of continue from the other gist how to install LAMP on an Amazon AMI
##Install git
sudo yum install git-core
##Create ssh directory since it doesn't exists by default on the Amazon AMI
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
// | |
// CRUD API for RESTful services with URLs similar 'http://services.mysite.com/classes/Book'. | |
// | |
// e.g. parse.get( | |
// "Book", | |
// 123, | |
// function(response){ console.log(response.toString());} | |
// ); | |
// | |
services.factory('parse', function($rootScope, $http) { |
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
//Define a function scope, variables used inside it will NOT be globally visible. | |
(function () { | |
var | |
//the HTTP headers to be used by all requests | |
httpHeaders, | |
//the message to be shown to the user | |
message, |
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 parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
Please check this draft: https://medium.com/software-craftsmanship/9e8f0b85e9?kme=collabEmail.clicked&km_postIds=9e8f0b85e9
You should read about hypermedia APIs, if only to challenge your thinking. It helped me a lot to do just that.
- How to GET a cup of coffee http://www.infoq.com/articles/webber-rest-workflow
- My Week With The Hypermedia Cowboys: http://wekeroad.com/2012/03/13/my-week-with-the-hypermedia-cowboy, http://wekeroad.com/2012/03/18/alt-tekpub-consuming-the-api, http://wekeroad.com/2012/03/22/alt-tekpub-working-more-with-the-hypermedia-style-api, http://wekeroad.com/2012/03/26/loading-data-from-the-api-how-much-is-too-much
- How much rest should your web api get http://blog.restlet.com/2013/05/02/how-much-rest-should-your-web-api-get/
- How I learned to stop worrying and love REST http://mikemayo.org/2012/how-i-learned-to-stop-worrying-and-love-rest/
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
#!/bin/bash | |
# | |
# A quickndirty bash-utility to generate REST-documentation from sourcecode comments. | |
# (initially aimed at php-files, but js should also work) | |
# Basically its a c-style comment -> markdown -> html converter | |
# Dependancies: | |
# - awk | |
# - sed | |
# - bash | |
# - php |
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.directive('ngFocus', ['$parse', function($parse) { | |
return function(scope, element, attr) { | |
var fn = $parse(attr['ngFocus']); | |
element.bind('focus', function(event) { | |
scope.$apply(function() { | |
fn(scope, {$event:event}); | |
}); | |
}); | |
} | |
}]); |
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
// node.js proxy server example for adding CORS headers to any existing http services. | |
// yes, i know this is super basic, that's why it's here. use this to help understand how http-proxy works with express if you need future routing capabilities | |
var httpProxy = require('http-proxy'), | |
express = require('express'); | |
var proxy = new httpProxy.RoutingProxy(); | |
var proxyOptions = { | |
host: '192.168.3.11', |
You can import data as follows:
# Import a JSON document into table `users` in database `my_db`
$ rethinkdb import -c HOST:PORT -f user_data.json --table my_db.users
# Import a CSV document
$ rethinkdb import -c HOST:PORT -f user_data.csv --format csv --table my_db.users