- Define and group Angular things (dependency injection stuff) in modules.
- Share data and wrap web server interaction in services.
- Extend HTML and do DOM manipulation in directives.
- make Controllers as "thin" as possible.
Using Controllers Correctly
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl https://www.npmjs.org/install.sh | sh |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Security; | |
using System.Web; | |
using System.Web.Hosting; | |
namespace PdfGenerator | |
{ | |
public class PdfGenerator |
====================================== | |
Setting up Nginx, uWSGI and Python3 | |
====================================== | |
First off, I'm traditionally a PHP developer, but am looking at moving across to Python. I really struggled to find decent documentation on how to get a server up and running for deploying Python web applications from the point of view of someone coming from PHP. The main problems I came across with documentation were: | |
1) Only showed you how to run the server for a single web application. | |
2) Only showed you how to configure the app, not the server it was running on. | |
My preferred workflow for development is by setting up a new VM in VMware Fusion and then forwarding through all requests to that VM via /etc/hosts. This might not be the optimal way to get things up and running, but it works for me. |
<?php | |
$files = array_slice($argv, 1); | |
foreach ($files as $file) { | |
$picture = file_get_contents($file); | |
$size = getimagesize($file); | |
// base64 encode the binary data, then break it into chunks according to RFC 2045 semantics | |
$base64 = chunk_split(base64_encode($picture)); |
// All calls reponses are converted into model instances or attributes are applied to current instance | |
var Api = can.Model('Api', { | |
callEndpoint: function(url) { | |
var ajax = this._ajax({}, url).call(this), | |
def = new can.Deferred(), | |
promise = def.promise(), | |
self = this; | |
promise.abort = ajax.abort |
@implementation NSURLRequest (ServiceClient) | |
+ (BOOL) allowsAnyHTTPSCertificateForHost:(NSString *) host | |
{ | |
return YES; | |
} | |
@end |
[mergetool] | |
prompt = false | |
keepBackup = false | |
keepTemporaries = false | |
[merge] | |
tool = winmerge | |
[mergetool "winmerge"] | |
name = WinMerge |
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
<link rel="stylesheet" href="css/bootstrap.min.css"> | |
</head> | |
<body> | |
<div class="container"> | |
<ul class="nav nav-tabs" id="myTab"> |
<?php | |
namespace Controllers; | |
use OAuth\Common\Service\AbstractService; | |
use OAuth\Common\Storage\Session as OAuthSession; | |
class AuthController extends ControllerBase { | |
// everytime we enter the controller, then we check for login, if yes, then we dont have to access here (except logout) |