Skip to content

Instantly share code, notes, and snippets.

View jay16's full-sized avatar

俊杰.li jay16

View GitHub Profile
@jay16
jay16 / bundle
Last active February 28, 2023 12:03
bundle install --path vendor/bundle
bundle install --path vendor/bundle
gem install rails -v 版本号
@jay16
jay16 / my_db.rake
Last active February 8, 2023 09:27 — forked from rantoniuk/backup.rake
rails backup DB
#encoding: utf-8
require "fileutils"
namespace :my_db do desc "Backup project database. Options: DIR=backups RAILS_ENV=production MAX=7"
desc "usage - bundle exec rake my_db:backup RAILS_ENV=production MAX=15 DIR=db/db.bak"
task :backup => [:environment] do
# config base dir
datestamp = Time.now.strftime("%Y%m%d%H%M")
base_path = Rails.root
backup_folder = File.join(base_path, ENV["DIR"] || "backups")
FileUtils.mkdir_p(backup_folder) unless File.exist?(backup_folder)
@jay16
jay16 / wav2mp3.sh
Created October 19, 2016 10:08
convert wav to mp3 file with ffmep on mac
#!/usr/bin/env bash
##
##############################################################################
##
## Script convert wav to mp3 for UN*X
##
## Dependence:
## - [ffmpeg](https://ffmpeg.org/)
##
## Script File:
# encoding: utf-8
#
# - [HTTP协议及签名](https://help.aliyun.com/document_detail/56189.html)
# - [OpenSSL::HMAC](https://ruby-doc.org/stdlib-2.1.0/libdoc/openssl/rdoc/OpenSSL/HMAC.html)
#
require 'uri'
require 'cgi'
require 'base64'
require 'openssl'
require 'httparty'
# encoding: utf-8
#
# - [HTTP协议及签名](https://help.aliyun.com/document_detail/56189.html)
# - [OpenSSL::HMAC](https://ruby-doc.org/stdlib-2.1.0/libdoc/openssl/rdoc/OpenSSL/HMAC.html)
#
require 'uri'
require 'cgi'
require 'base64'
require 'openssl'
require 'httparty'
@jay16
jay16 / redis-backup.sh
Created October 8, 2016 13:56 — forked from acenqiu/redis-backup.sh
redis rdb backup script
#!/bin/bash
#
## redis backup script
## usage
## redis-backup.sh port backup.dir
port=${1:-6379}
backup_dir=${2:-"/data/backup/redis"}
cli="/usr/local/bin/redis-cli -p $port"
@jay16
jay16 / gist:280b67d7cbd8603806b7
Last active April 12, 2016 23:26 — forked from anonymous/gist:c6b2b4c7f9673c60108c
qlikview marco export EXCEL
Sub ExcelPrint
Call exportToExcel_ALL()
End Sub
Public Function exportToExcel_ALL()
Dim aryExport(14,3)
aryExport(0,0) = "CH57"
aryExport(0,1) = "直营业绩周报表"
aryExport(0,2) = "A1"
aryExport(0,3) = "data"
<!--
监视input输入为手机号
即输入内容为11位数字
-->
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<input type="text" id="number">
<script>
function chk_phone_number(input) {
if(input.val().toString().match(/^[-]?[0-9]+[\.]?[0-9]*$/)==null ||
ctrl+a 跳到行首
ctrl+e 跳到末尾
ctrl+d 删除光标后1个字符
ctrl+h 删除光标前1个字符
ctrl+u 清除至行首
ctrl+k 清除至行尾
ctrl+f 光标后移1个字符
<div id="picture_show" style="position: absolute; display: none; background: none repeat scroll 0% 0% rgb(211, 211, 211); border-radius: 5px;z-index: 10000; ">
<img>
</div>
//picture show orginal size
$("#picture_list img").each(function(){
$img = $(this);
$tooltip = $("#picture_show");
$img.hover(