Skip to content

Instantly share code, notes, and snippets.

@justqyx
justqyx / puma_example.rb
Last active May 18, 2017 08:27
workers by cpu count
#!/usr/bin/env puma
# Ruby 2.2.0+ required
require 'etc'
current_path = 'CURRENT_PATH'
shared_path = 'SHARED_PATH'
directory current_path
<template>
<div class="weui-dialog-confirm hidden" v-bind:class="{ 'hidden': hidden }">
<div class="weui-mask"></div>
<div class="weui-dialog">
<div class="weui-dialog-bd">
</div>
</div>
</div>
</template>
@justqyx
justqyx / manage-etc-hosts.sh
Last active August 10, 2021 16:50 — forked from irazasyed/manage-etc-hosts.sh
Bash Script to Manage /etc/hosts file for adding/removing hostnames.
#!/bin/sh
# PATH TO YOUR HOSTS FILE
ETC_HOSTS=/etc/hosts
# DEFAULT IP FOR HOSTNAME
IP="127.0.0.1"
# Hostname to add/remove.
HOSTLINE=$2
(function(){
window.requestAnimFrame = (function(){
return function( callback ){
window.setTimeout(callback, 1000 / 25);
};
})();
//判断是否支持canvas
var isCanvas=function(){
try{
document.createElement('canvas').getContext('2d');
@justqyx
justqyx / gist:9a100165a8cb05b8b95140ef2fbf06d7
Created July 13, 2016 12:54 — forked from jugyo/gist:3882497
nginx + ngx_lua on Mac
http://pdf.th7.cn/down/files/1312/refactoring_ruby_edition.pdf

中国大陆手机号码,目前支持的号码段

  • 中国移动:134/135/136/137/138/139/150/151/152/157/159/187/188
  • 中国联通:130/131/132/155/156/186/185
  • 中国电信:133/153/189/180
/^(130|131|132|133|134|135|136|137|138|139|150|151|152|153|155|156|157|158|159|180|186|187|188|189)/d{8}$/

性能数据收集

I, [2016-06-04T15:31:39.244351 #19896]  INFO -- : GET Rails::WelcomeController#index html 200 6.783 6.53 0
I, [2016-06-04T15:31:42.075029 #19896]  INFO -- : GET Rails::WelcomeController#index html 200 0.88 0.6859999999999999 0
I, [2016-06-04T15:31:44.011523 #19896]  INFO -- : GET Rails::WelcomeController#index html 200 0.8310000000000001 0.638 0
I, [2016-06-04T15:31:45.531931 #19896]  INFO -- : GET Rails::WelcomeController#index html 200 0.728 0.5900000000000001 0

提取数据的正则表达式

FactoryGirl.define do
sequence(:mock_image) do |n|
{
tempfile: StringIO.new('{・㉨・}'),
filename: "#{n}.png",
original_filename: "#{n}.png",
content_type: 'image/png'
}
end
end
@justqyx
justqyx / microsoft_office_2016_for_mac.txt
Created March 22, 2016 03:42
microsoft_office_2016_for_mac
http://news.mydrivers.com/1/438/438769.htm