This script enables you to launch your Rails application in production environment (port:80) with Nginx and Unicorn.
Please make sure that your Gemfile in your rails application includes unicorn.
#-*-coding: utf-8 -*- | |
#!/usr/bin/python | |
import requests | |
def sendMsg(msg): | |
url_space_login = 'http://f.10086.cn/huc/user/space/login.do?m=submit&fr=space' | |
url_login = 'http://f.10086.cn/im/login/cklogin.action' | |
url_sendmsg = 'http://f.10086.cn/im/user/sendMsgToMyselfs.action' | |
parameter= { 'mobilenum':'yourmobile', 'password':'yourpassword'} |
html, body { | |
background-color: black; | |
width: 100%; | |
height: 100%; | |
margin: 0; | |
} | |
canvas { | |
display: block; | |
margin: 0; |
#!/usr/bin/env ruby | |
require 'csv' | |
require 'net/smtp' | |
require 'resolv' | |
# We need a specific version of eventmachine due to apply a patch. | |
gem 'eventmachine', '0.12.10' | |
require 'eventmachine' |
class PostsController < ActionController::Base | |
def create | |
Post.create(post_params) | |
end | |
def update | |
Post.find(params[:id]).update_attributes!(post_params) | |
end | |
private |
#!/usr/bin/ruby | |
require 'rss' | |
# Usage | |
# $ ./railscasts.rb http://railscasts.com/subscriptions/YOURRAILSCASTRSS/\/ | |
# episodes.rss | |
# OR | |
# $ ./railscasts.rb | |
p 'Downloading rss index' |
class Api::RegistrationsController < Api::BaseController | |
respond_to :json | |
def create | |
user = User.new(params[:user]) | |
if user.save | |
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201 | |
return | |
else |
import sublime, sublime_plugin | |
import os.path, string | |
VALID_FILENAME_CHARS = "-_.() %s%s%s" % (string.ascii_letters, string.digits, "/:\\") | |
# { "keys": ["alt+o"], "command": "open_filename_under_cursor" } | |
# https://gist.github.com/1186126 | |
class OpenFilenameUnderCursor(sublime_plugin.TextCommand): | |
def run(self, edit): | |
for region in self.view.sel(): |
gem 'pg' | |
group :development do | |
gem 'ruby-debug' | |
end | |
gem 'rake', '~> 0.8.7' | |
gem 'devise' | |
gem 'oa-oauth', :require => 'omniauth/oauth' | |
gem 'omniauth' | |
gem 'haml' | |
gem 'dynamic_form' |
#!/bin/sh | |
# Install Nginx and config Google ghs proxy, tested on Amazon EC2 Linux | |
# You need first to add a domain A record point ghs to the server which runs Nginx | |
# and then alias sub-domain to ghs.your_domain_name | |
# Author: Yuan XU | |
# Version: 0.1 | |
# URL: blog.xuyuan.me | |
if [ -z $1 ]; then | |
echo "Usage: nginx.sh [domain_name]" |