Skip to content

Instantly share code, notes, and snippets.

@fanix
fanix / application.html.erb
Created August 13, 2012 14:42
【Template sass】A Template for app/views/layouts/application.html.erb
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title><%=Setting.app_name%></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="Fanix">
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
@fanix
fanix / Gemfile
Created August 11, 2012 04:59
Gemfile for bootstrap less edition
source 'http://ruby.taobao.org'
# Rails
gem 'rails', '3.2.2'
gem "rails-i18n"
gem "jquery-rails", "2.0.1"
gem "rails_autolink", ">= 1.0.4"
# Postgresql
gem "pg", "0.14.0"
@fanix
fanix / rails_template.rb
Created August 11, 2012 04:54
Rails Template -bootstrap less edition
# coding: utf-8
# This is a Rails init template
# Usage
#
# $ rails new app_name -d postgresql -m https://raw.github.com/gist/3321163 --skip-bundle
#
# remove files
run "rm README.rdoc"
run "touch README.md"
@fanix
fanix / sessions_controller.rb
Created August 9, 2012 13:51
Authentication controller for Rails template.
class SessionsController < ApplicationController
def create
auth = request.env["omniauth.auth"]
user = User.find_by_uid(auth["uid"].to_s) || User.create_with_omniauth(auth)
user.token = auth["credentials"]["token"]
if user.save
session[:user_id] = user.id
redirect_to root_url, :notice => "Signed in!"
else
@fanix
fanix / .gitignore
Created August 9, 2012 13:15
【Template sass】Gitignore file for Rails template.
.bundle
tmp/
log/
.sass-cache/
coverage/
bin/
solr/data/
solr/pids/
db/*.sqlite3
public/assets/**/*
@fanix
fanix / Gemfile
Last active October 8, 2015 08:17
【Template sass】A Gemfile file for Rails template.
source 'http://ruby.taobao.org'
# Rails
gem 'rails', '3.2.13'
gem "rails-i18n"
gem "jquery-rails", "2.2.1"
#gem "rails_autolink", ">= 1.0.4"
# Postgresql
gem "pg", "0.14.0"
@fanix
fanix / template.rb
Created August 9, 2012 12:54
【Template sass】Fanix' Rails Template
# coding: utf-8
# This is a Rails init template
# Usage
#
# $ rails new app_name -d postgresql -m https://raw.github.com/gist/3303948 --skip-bundle
#
# remove files
run "rm README.rdoc"
run "touch README.md"
def pp?(role_item_id, permission, entity_type, entity_id=nil)
if do?(current_user, role_item_id, permission, entity_type, entity_id)
return true
else
return false
end
end