As configured in my dotfiles.
start new:
tmux
start new with session name:
# Habilita o gzip | |
gzip on; | |
gzip_http_version 1.1; | |
gzip_vary on; | |
gzip_comp_level 6; | |
gzip_proxied any; | |
# Mime-types que serão compactados | |
gzip_types text/html text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; |
import unittest | |
from pyramid import testing | |
from paste.deploy.loadwsgi import appconfig | |
from webtest import TestApp | |
from mock import Mock | |
from sqlalchemy import engine_from_config | |
from sqlalchemy.orm import sessionmaker | |
from app.db import Session |
$(document).ready(function() { | |
// Support for AJAX loaded modal window. | |
// Focuses on first input textbox after it loads the window. | |
$('[data-toggle="modal"]').click(function(e) { | |
e.preventDefault(); | |
var url = $(this).attr('href'); | |
if (url.indexOf('#') == 0) { | |
$(url).modal('open'); | |
} else { |
#! /bin/bash | |
### BEGIN INIT INFO | |
# Provides: unicorn | |
# Required-Start: $local_fs $remote_fs $network $syslog | |
# Required-Stop: $local_fs $remote_fs $network $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the unicorn web server | |
# Description: starts unicorn |
As configured in my dotfiles.
start new:
tmux
start new with session name:
import os | |
import pymongo | |
MONGO_URL = os.environ.get('MONGOHQ_URL') | |
if MONGO_URL: | |
# Get a connection | |
conn = pymongo.Connection(MONGO_URL) | |
# Get the database |
foo = (f1, f2) -> | |
f1() | |
f2() | |
# Doesn't work -- syntax error | |
# foo(-> console.log("hi from f1"), -> console.log("hi from f2")) | |
# Simplest way I've found to do it -- newlines added for clarity | |
foo( | |
(-> console.log("hi from f1")), |
# video.rb | |
class Video < ActiveRecord::Base | |
has_many :categorizations | |
has_many :categories, through: :categorizations | |
end | |
# category.rb | |
class Category < ActiveRecord::Base | |
has_many :categorizations | |
has_many :videos, through: :categorizations |
#!/bin/bash | |
# Compile Main for Java bytecode | |
gcj -C Main.java | |
# Compile Main for native | |
gcj -findirect-dispatch -fno-indirect-classes -fpic -c Main.class -o java.o | |
# Generate header file | |
gcjh -cp . Main |
Porting an application across platforms is never particularly easy, nor very interesting. In fact, it's usually a terrible idea: in general, if it ain't broke, don't fix it. But sometimes you have to do it. Maybe a new platform has a feature you believe you can't live without, or the project scope is expanding in directions that make you feel like your original platform choice might not have been the best, or maybe it's just necessary to port for political reasons. Whatever.