Skip to content

Instantly share code, notes, and snippets.

# gzip html, css and js
AddOutputFilterByType DEFLATE text/html text/css application/x-javascript application/javascript
# far future expires headers
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
ExpiresDefault "access plus 10 years"
</FilesMatch>
# == Schema Information
#
# Table name: experiences
#
# id :integer(4) not null, primary key
# doctor_id :integer(4)
# place_of_practice :string(255)
# year_start :integer(4)
# year_end :integer(4)
# created_at :datetime
@rociiu
rociiu / gemspec
Created May 14, 2010 01:21 — forked from defunkt/gemspec
#!/usr/bin/env ruby
# Usage: gemspec [-s] GEMNAME
#
# Prints a basic gemspec for GEMNAME based on your git-config info.
# If -s is passed, saves it as a GEMNAME.gemspec in the current
# directory. Otherwise prints to standard output.
#
# Once you check this gemspec into your project, releasing a new gem
# is dead simple:
#
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Demo Everywhere</title>
</head>
<body>
<h1>hello world</h1>
<ul>
{% for msg in messages%}
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
1: there is some hard code in the project like:
<% if false %>
Provided by <a href="http://recaptcha.net/" target="_blank">Recaptcha</a>
<% end %>
since the code wrap in the condition will never be execute, why not remove it .
2: maybe we can add fields into users for methods like "pending_count", so every time we load the information of user we don't need to join the friendships table.
3: we can move some big mail deliveries using background job (delayed_job etc.) , like InvitationMailer.deliver_invitations(@user, emails), since it will send couples of email out, it will lower the user experience to wait.
class Dragon; end
# 使用 def 定義 class method
Dragon.instance_eval do
def foo
puts "bar"
end
end
Dragon.foo # bar
def hello():
print "hello"
def hello2():
print "hello2"
hello()
hello2()
@rociiu
rociiu / app.yaml
Created April 11, 2010 08:00 — forked from Arachnid/app.yaml
application: filehangar
version: live
runtime: python
api_version: 1
handlers:
- url: /remote_api
script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py
login: admin
@rociiu
rociiu / ghi.rb
Created April 9, 2010 15:37 — forked from macournoyer/ghi.rb
#!/usr/bin/env ruby
require "rubygems"
require "mutter"
require "httparty"
REMOTE = "origin"
REPO = `git config --get remote.#{REMOTE}.url`.chomp[/github\.com[\/\:](\w+\/\w+)\.git/, 1]
USER = `git config --get github.user`.chomp
TOKEN = `git config --get github.token`.chomp