Skip to content

Instantly share code, notes, and snippets.

View mmurray's full-sized avatar

Michael Murray mmurray

View GitHub Profile
# /app/models/profile.erb
class Profile < ActiveRecord::Base
belongs_to :user
# Paperclip
has_attached_file :avatar,
class Profile < ActiveRecord::Base
belongs_to :user
attr_accessible :avatar, :user
# Paperclip
has_attached_file :avatar,
:styles => {
:thumb => "45x45#",
:small => "100x100#"
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable, :lockable and :timeoutable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable, :confirmable, :token_authenticatable,
:oauthable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me, :username, :has_username, :is_admin, :profile
class Game < ActiveRecord::Base
belongs_to :league
has_and_belongs_to_many :my_players, :class_name=>"Player"
has_and_belongs_to_many :their_players, :class_name=>"Player"
end
// Application.java
public class Application extends Controller {
protected static void respondWith(Object... args){
try {
render(args);
}catch(TemplateNotFoundException e) {
if(request.format == "json") {
renderJSON(args);
public class Articles extends Application {
public static void index() {
render();
}
public static void create() {
}
package controllers;
import java.io.Serializable;
import java.util.*;
import play.Logger;
import play.classloading.enhancers.ControllersEnhancer.ControllerSupport;
import play.classloading.enhancers.LocalvariablesNamesEnhancer.LocalVariablesNamesTracer;
import play.classloading.enhancers.LocalvariablesNamesEnhancer.LocalVariablesSupport;
import play.exceptions.TemplateNotFoundException;
package controllers;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import play.Logger;
import play.classloading.enhancers.ControllersEnhancer.ControllerSupport;
import play.classloading.enhancers.LocalvariablesNamesEnhancer.LocalVariablesNamesTracer;
import play.classloading.enhancers.LocalvariablesNamesEnhancer.LocalVariablesSupport;
String test = "one.two.three";
String[] split = test.split(".");
Logger.info(java.util.Arrays.toString(split)); // prints: []
server {
listen 80;
root /var/vine/public;
location / {
proxy_pass http://localhost:9000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
}
}