Skip to content

Instantly share code, notes, and snippets.

View DotHide's full-sized avatar

Martin_nett DotHide

  • Shanghai, China
View GitHub Profile
@DotHide
DotHide / autoplay-audio-ios.html
Created August 17, 2016 08:21 — forked from ufologist/autoplay-audio-ios.html
在 iOS 微信浏览器中自动播放 HTML5 audio(音乐) 的正确方式
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<title>Auto play html audio in iOS WeChat InAppBrowser the right way</title>
</head>
<body>
<h1>在 iOS 微信浏览器中自动播放 HTML5 audio(音乐) 的正确方式</h1>
<p>核心原理: 在微信的JS-API 中 play 一下 audio 即可达到自动播放的目的(应该是微信自己做了处理)</p>
@DotHide
DotHide / rails-api-template.rb
Last active April 16, 2019 14:56
Rails 5 API Application Template
require 'erb'
require 'ostruct'
# ====================
# 0. Helper
# ====================
def render_file(text, variables)
struct = OpenStruct.new(variables)
rendered_file = ERB.new(text).result(struct.instance_eval { binding })