Welcome to 扒拉小记!

ubuntu16.04 不能拓展双屏的解决办法

Ubuntu 16.04LTS extended display not working The issue was with the nvidia graphics driver.This can be fixed by following the steps below : 1.Run sudo apt-get purge nvidia-* 2.Run sudo...

ubuntu彻底删除mysql然后重装mysql

sudo apt autoremove --purge mysql-server-5.0 sudo apt remove mysql-server sudo apt autoremove mysql-server sudo apt remove mysql-common #这个很重要 上面的其实有一些是多余的。 清理残留数据 dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P...

开发gem

1.创建gem bundle gem mygem 2.生成gem $ rake build mygem 0.0.1 built to pkg/mygem-0.0.1.gem. 3.第一个gem诞生了。它就在当前目录的pkg下:mygem-0.0.1.gem。如何使用呢?不考虑bundler的情况下,如果你开起了一个irb或者pry的session时,一般都会这样写:require “mygem”,如果你现在这样做,那肯定不行,因为它还没有被安装到ruby的load path中,那就把它安装上。 $ rake install mygem 0.0.1 built to pkg/mygem-0.0.1.gem. mygem (0.0.1) installed. 4.安装好了,那就来使用一下,打开irb: require "mygem"...

概率抽奖

# 概率抽奖 def lucky_draw point_lotteries = [ {id:1,percent:10}, {id:2,percent:10}, {id:3,percent:10}, {id:4,percent:30}, {id:5,percent:20}, {id:6,percent:20} ] #中奖概率基数 num = 100 point_lotteries.each do |pl| lottery_num = rand(1..num) if lottery_num <= pl.percent point_lottery =...