Skip to content

Instantly share code, notes, and snippets.

View simonqian's full-sized avatar

simonqian simonqian

View GitHub Profile
@simonqian
simonqian / base64_to_file.rb
Created April 14, 2017 09:15
base64 to file in rails
module Base64ToFile
extend ActiveSupport::Concern
def base64_to_file(base64_data, filename=nil)
return base64_data unless base64_data.is_a? String
start_regex = /data:image\/[a-z]{3,4};base64,/
filename ||= SecureRandom.hex
regex_result = start_regex.match(base64_data)
@simonqian
simonqian / wine_fontsmoothing.reg
Created February 24, 2018 06:46 — forked from cdfmr/wine_fontsmoothing.reg
Enable font smoothing in wine
REGEDIT4
[HKEY_CURRENT_USER\Control Panel\Desktop]
"FontSmoothing"="2"
"FontSmoothingType"=dword:00000002
"FontSmoothingGamma"=dword:00000578
"FontSmoothingOrientation"=dword:00000001
@simonqian
simonqian / docker-compose.yml
Last active July 20, 2022 06:46
JanusGraph Dynamic Graphs Docker Config: use cassandra and es
version: "3"
services:
jce-janusgraph:
image: janusgraph/janusgraph:0.5
container_name: jce-janusgraph
environment:
JANUS_PROPS_TEMPLATE: cql-es
janusgraph.storage.hostname: 192.168.0.1
janusgraph.storage.port: 9042
@simonqian
simonqian / classnotfoundexception-after-include-local-jar-to-maven-project.md
Created November 1, 2018 09:36
classnotfoundexception-after-include-local-jar-to-maven-project

error info:

➜  hh (develop-hh) ✔ gem install libv8 -v '3.16.14.11'
Building native extensions.  This could take a while...
ERROR:  Error installing libv8:
	ERROR: Failed to build gem native extension.

    current directory: /Users/simonqian/.rvm/gems/ruby-2.2.2/gems/libv8-3.16.14.11/ext/libv8
/Users/simonqian/.rvm/rubies/ruby-2.2.2/bin/ruby -r ./siteconf20170410-48026-19k49a7.rb extconf.rb
creating Makefile
电信号码
1[3578][01379]\d{8}
联通号码
1[34578][01256]\d{8}
移动号码
134[012345678]\d{7}或1[34578][012356789]\d{8}
全部号码
1[34578][012356789]\d{8}|134[012345678]\d{7}
  window.addEventListener('resize', resizeWidth)
 
  function resizeWidth() {
    console.log('resize')
    const body = document.getElementsByTagName('body')[0]
    var heRatio = window.innerHeight / 1080
    var widRatio = window.innerWidth / 1920
    var ratio = widRatio + ',' + heRatio
 body.style.transform = 'scale(' + ratio + ')'
@simonqian
simonqian / idea-run-dashboard.md
Created December 7, 2018 03:07
open idea run dashboard
  1. open the .idea/workspace.xml
  2. find RunDashboard
  3. add new option
<option name="configurationTypes">
  <set>
    <option value="SpringBootApplicationConfigurationType" />
  </set>
</option>

To export

If it's an entire DB, then:

$ mysqldump -u [uname] -p[pass] db_name > db_backup.sql

If it's all DBs, then:

$ mysqldump -u [uname] -p[pass] --all-databases > all_db_backup.sql
@simonqian
simonqian / dynamic-specifications-with-jquery.html
Last active April 20, 2018 03:44
动态规格生成表格
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>规格选择</title>
<style>
*,
html,
body,