Skip to content

Instantly share code, notes, and snippets.

View sundevilyang's full-sized avatar
😃

Yang Wen sundevilyang

😃
  • ByteDance
  • Beijing
View GitHub Profile
@sundevilyang
sundevilyang / pair.rb
Created September 3, 2019 13:51 — forked from cantin/pair.rb
GuangZhou RailsGirs Pair
tutors = ["***", "***", "***"]
girls = ["***", "***", "***"]
number = "To be defined"
tutors = tutors.shuffle(random: Random.new(number))
girls = girls.shuffle(random: Random.new(number))
result = Hash.new { |hash, key| hash[key] = [] }
tutors.cycle(3).each_with_index do |tutor, i|
result[tutor] << (girls[i] || "未配对")
@sundevilyang
sundevilyang / capybara cheat sheet
Created June 4, 2019 05:28 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@sundevilyang
sundevilyang / wxpy_group.py
Created April 18, 2017 03:00 — forked from youfou/ad_urls.json
响应好友请求 / 自动聊天 / 限制频率 / 邀请入群 / 远程群管理 / 新人欢迎消息 / 关键词问答 / 发心跳 / 远程命令 / 远程执行代码
#!/usr/bin/env python3
# coding: utf-8
import datetime
import logging
import os
import re
import subprocess
import time
from functools import wraps
@sundevilyang
sundevilyang / devise.zh-CN.yml
Created July 7, 2016 15:13 — forked from Kenrick-Zhou/devise.zh-CN.yml
rails devise 3.5.2 I18n translations zh-CN
# Chinese (China) translations for Devise(3.5.2)
# by Kenrick-Zhou (https://github.com/Kenrick-Zhou)
# https://gist.github.com/Kenrick-Zhou/7909822
zh-CN:
devise:
confirmations:
confirmed: "您的帐号已经确认,您现在已登录。"
send_instructions: "几分钟后,您将收到确认帐号的电子邮件。"
send_paranoid_instructions: "如果您的邮箱存在于我们的数据库中,您将收到一封确认账号的邮件。"
@sundevilyang
sundevilyang / index.md
Last active August 29, 2015 14:13 — forked from rstacruz/index.md

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

规范:
1、标点符号使用全角
2、保留原文中一切标记如<span>,只翻译文字部分
3、必要时在括号中引用原文术语,如"方法(methods)"
字典:
calling: 调用
introduction: 介绍
object, objects: 对象
primer: 初学者
规范:
1、标点符号使用全角
2、保留原文中一切标记如<span>,只翻译文字部分
3、必要时在括号中引用原文术语,如"方法(methods)"
字典:
calling: 调用
introduction: 介绍
object, objects: 对象
primer: 初学者

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
# == Active Model North American Telephone Number Validator
# http://en.wikipedia.org/wiki/North_American_Numbering_Plan#Current_system
# [Author] Roger Rohrbach ([email protected])
class NanpValidator < ActiveModel::EachValidator
def self.matcher(require_area_code) # :nodoc:
%r{
(?<country_code> \+1 ){0}
(?<trunk_prefix> 1 ){0}
(?<delimiter> ([-\.]|\ +) ){0}
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8