Oct 16 2010
- 04/10/2011 - Updated application.js and application.rb thanks to @rebo's comments
In this article, I will walk through some simple steps to get a [demo app][2] up and running with [Backbone.js][3] and [Sinatra][4] on [Heroku][5].
<?php // src/Application/UserBundle/Controller/SecurityController.php | |
namespace Application\UserBundle\Controller; | |
use Symfony\Bundle\FrameworkBundle\Controller\Controller, | |
Symfony\Component\Security\SecurityContext; | |
class SecurityController extends Controller | |
{ | |
public function loginAction() |
// All navigation that is relative should be passed through the navigate | |
// method, to be processed by the router. If the link has a `data-bypass` | |
// attribute, bypass the delegation completely. | |
$(document).on("click", "a[href]:not([data-bypass])", function(evt) { | |
// Get the absolute anchor href. | |
var href = { prop: $(this).prop("href"), attr: $(this).attr("href") }; | |
// Get the absolute root. | |
var root = location.protocol + "//" + location.host + Application.root; | |
// Ensure the root is part of the anchor href, meaning it's relative. |
# Update, upgrade and install development tools: | |
apt-get update | |
apt-get -y upgrade | |
apt-get -y install build-essential | |
apt-get -y install git-core | |
# Install rbenv | |
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv | |
# Add rbenv to the path: |
moved to github --> https://github.com/bill-auger/git-branch-status/ |
require 'formula' | |
class Varnish3 <Formula | |
url 'http://repo.varnish-cache.org/source/varnish-3.0.2.tar.gz' | |
homepage 'http://www.varnish-cache.org/' | |
md5 'c8eae0aabbe66b6daabdf3a1f58cd47a' | |
depends_on 'pkg-config' => :build | |
depends_on 'pcre' => :build |
server { | |
listen 80; | |
server_name trials.dailyemerald.com; | |
access_log /srv/www/trials.dailyemerald.com/access.log; | |
gzip on; | |
location / { | |
root /srv/www/trials.dailyemerald.com/public_html; | |
try_files $uri /index.html; | |
} |
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
// Use absolute URLs to navigate to anything not in your Router. | |
var openLinkInTab = false; | |
// Only need this for pushState enabled browsers | |
if (Backbone.history && Backbone.history._hasPushState) { | |
$(document).keydown(function(event) { | |
if (event.ctrlKey || event.keyCode === 91) { | |
openLinkInTab = true; |
import { Component } from "React"; | |
export var Enhance = ComposedComponent => class extends Component { | |
constructor() { | |
this.state = { data: null }; | |
} | |
componentDidMount() { | |
this.setState({ data: 'Hello' }); | |
} | |
render() { |