Skip to content

Instantly share code, notes, and snippets.

View rogerluo410's full-sized avatar
🏠
telecommuting

Roger Luo rogerluo410

🏠
telecommuting
View GitHub Profile
@rogerluo410
rogerluo410 / Omniauth_Strategy_TQQ.rb
Created February 16, 2016 02:57 — forked from krongk/Omniauth_Strategy_TQQ.rb
Omniauth Strategy TQQ 腾讯QQ Oauth2
#C:\Sites\tm_wed\lib\omniauth\strategies\tqq.rb
# Updated at: 2014-09-04
# Author: [email protected]
require "omniauth-oauth2"
module OmniAuth
module Strategies
class Tqq < OmniAuth::Strategies::OAuth2
@rogerluo410
rogerluo410 / Omniauth_Strategy_Douban.rb
Created February 16, 2016 02:57 — forked from krongk/Omniauth_Strategy_Douban.rb
Omniauth Strategy Douban 豆瓣Oauth2
#C:\Sites\tm_wed\lib\omniauth\strategies\douban.rb
# Updated at: 2014-09-04
# Author: [email protected]
require 'omniauth-oauth2'
module OmniAuth
module Strategies
class Douban < OmniAuth::Strategies::OAuth2
DEFAULT_SCOPE = 'douban_basic_common,shuo_basic_r,shuo_basic_w'
@rogerluo410
rogerluo410 / Omniauth_Strategy_Weibo.rb
Created February 16, 2016 02:56 — forked from krongk/Omniauth_Strategy_Weibo.rb
Omniauth Strategy Weibo 新浪微博Oauth2
#C:\Sites\tm_wed\lib\omniauth\strategies\weibo.rb
# Updated at: 2014-09-04
# Author: [email protected]
require 'omniauth-oauth2'
module OmniAuth
module Strategies
class Weibo < OmniAuth::Strategies::OAuth2
@rogerluo410
rogerluo410 / Locales.yaml
Created January 29, 2016 07:10 — forked from wojtha/Locales.yaml
config.exceptions_app and ExceptionController
# config/locales/en.yml
en:
exception:
show:
not_found:
title: "Not Found"
description: "The page you were looking for does not exists."
internal_server_error:
title: "Internal Server Error"
@rogerluo410
rogerluo410 / cancan_matchers.rb
Created January 28, 2016 07:03 — forked from fotinakis/cancan_matchers.rb
Custom rspec matcher for testing CanCan abilities
# Custom rspec matcher for testing CanCan abilities.
# Originally inspired by https://github.com/ryanb/cancan/wiki/Testing-Abilities
#
# Usage:
# should have_abilities(:create, Post.new)
# should have_abilities([:read, :update], post)
# should have_abilities({manage: false, destroy: true}, post)
# should have_abilities({create: false}, Post.new)
# should not_have_abilities(:update, post)
# should not_have_abilities([:update, :destroy], post)
@rogerluo410
rogerluo410 / Ruby_questions.md
Last active December 6, 2017 15:09 — forked from ryansobol/gist:5252653
Ruby on rails Questions

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

require 'active_record'
ActiveRecord::Base.logger = Logger.new(STDERR)
ActiveRecord::Base.colorize_logging = false
ActiveRecord::Base.establish_connection(
:adapter => "sqlite3",
:database => ":memory:"
)
@rogerluo410
rogerluo410 / gencert.sh
Last active August 29, 2015 14:07 — forked from bradland/gencert.sh
Generate a self-signed SSL cert
#!/bin/bash
# Bash shell script for generating self-signed certs. Run this in a folder, as it
# generates a few files. Large portions of this script were taken from the
# following artcile:
#
# http://usrportage.de/archives/919-Batch-generating-SSL-certificates.html
#
# Additional alterations by: Brad Landers
# Date: 2012-01-27