Skip to content

Instantly share code, notes, and snippets.

View kelby's full-sized avatar
💭
lalala...

kelby

💭
lalala...
View GitHub Profile
@kelby
kelby / authentications_controller.rb
Last active October 18, 2017 22:28
使用omniauth时的controller,这与devise里的omniauthable模块差不多。但实现手法又有一点不同,选择哪个,看情况吧。
class AuthenticationsController < Devise::OmniauthCallbacksController
before_action :create
def github
end
def create
puts "=== omniauth is: #{request.env["omniauth"]} ==="
puts "=== omniauth.auth is: #{request.env["omniauth.auth"]} ==="
zh-CN:
admin:
js:
true: 是的
false: 不是
is_present: 已经存在
is_blank: 不存在
date: 日期 ...
between_and_: 从 ... 到 ...
today: 今天
@kelby
kelby / gist:42ad168ed948d966f3e1
Last active August 29, 2015 14:22
安装rvm, ruby, rails

对于新手来说,安装 rails 有时确实是一件痛苦的事。这也不懂,那也不懂。尽管网上这教程一搜一大把,但如何‘选择’又是另一个大问题。
网上教你如何安装 rails 的教程可以说数不胜数,这也只是其中这一,作者希望能够对你有帮助~~~

首先说明,这教程不适用于windows,作者本人在多个 Ubuntu 版本多次安装成功过,在 Mac 下更改部分命令仍然可用,其它 *inux ‘大同小异’。

第一步,打开终端 Ctrl+Alt+T。 然后升级一下源,执行:

sudo apt-get update 
@kelby
kelby / How to use Backbone.js.md
Last active September 3, 2015 12:02 — forked from nightire/How to use Backbone.js.md
How to use Backbone.js

Simple Starting Point

创建 Model

var Person = Backbone.Model.extend();
@kelby
kelby / backup_postgres.sh
Last active October 29, 2015 04:41 — forked from skyebook/backup_postgres.sh
Backup OpenShift PostgreSQL Database
#!/bin/bash
# Backs up the OpenShift PostgreSQL database for this application
# by Skye Book <[email protected]>
# Local
rhc ssh
# Seiver
NOW="$(date +"%Y-%m-%d")"
FILENAME="$OPENSHIFT_DATA_DIR/$OPENSHIFT_APP_NAME.$NOW.backup.sql.gz"
db:
image: mysql
ports:
- "3306"
rails:
image: rails
node:
image: node
@kelby
kelby / Dockerfile
Last active January 4, 2017 09:12
sx docker 初步
FROM ruby:2.3.0
RUN cp /etc/apt/sources.list /etc/apt/sources.list.backup
RUN sed -i -e "s/archive\.ubuntu\.com/mirrors\.163\.com/g" /etc/apt/sources.list
RUN apt-get update
sudo add-apt-repository ppa:ubuntu-mozilla-daily/firefox-aurora
sudo apt-get update
sudo apt-get install firefox
@kelby
kelby / convert_to_utf8mb4
Last active March 6, 2017 03:49
rake database:convert_to_utf8mb4
desc "Database related tasks"
namespace :database do
desc "Convert to utf8mb4"
task convert_to_utf8mb4: :environment do
connection = ActiveRecord::Base.connection
database = connection.current_database
connection.execute "ALTER DATABASE `#{database}` CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;"
puts "Converted #{database} character set"
@kelby
kelby / REAME.md
Last active December 2, 2017 05:59
一个IP,多应用配置HTTPS

说明

有两个应用,一个是普通的 Rails 网站,另外一个是 C++ 写的应用。
前者所在目录 /var/www/monero-xmr 具体访问路径 /var/www/monero-xmr/current/public 后者所在目录 /home/deployer/onion-monero-blockchain-explorer 具体访问路径 /home/deployer/onion-monero-blockchain-explorer/build/templates

前者配置相关域名

-d www.monero-xmr.org -d monero-xmr.org -d assets.monero-xmr.org -d cdn.monero-xmr.org