Skip to content

Instantly share code, notes, and snippets.

View zhishaofei3's full-sized avatar
🎯
Focusing

zhishaofei zhishaofei3

🎯
Focusing
View GitHub Profile
@kus
kus / fixIOSAudioContext.js
Last active May 22, 2025 16:45
Fix iOS AudioContext on Safari not playing any audio. It needs to be "warmed up" from a user interaction, then you can play audio with it as normal throughout the rest of the life cycle of the page.
// Fix iOS Audio Context by Blake Kus https://gist.github.com/kus/3f01d60569eeadefe3a1
// MIT license
(function() {
window.AudioContext = window.AudioContext || window.webkitAudioContext;
if (window.AudioContext) {
window.audioContext = new window.AudioContext();
}
var fixAudioContext = function (e) {
if (window.audioContext) {
// Create empty buffer
@laziel
laziel / unlock.js
Created September 18, 2015 09:02
Unlock Web Audio in iOS 9 Safari
var ctx = null, usingWebAudio = true;
try {
if (typeof AudioContext !== 'undefined') {
ctx = new AudioContext();
} else if (typeof webkitAudioContext !== 'undefined') {
ctx = new webkitAudioContext();
} else {
usingWebAudio = false;
}
@jikeytang
jikeytang / [ Javascript ] - 20140618-题目1
Last active August 29, 2015 14:02
[ Javascript ] - 20140618-题目1
如何把一个字符串,用特定的符号有序的连接,列出所有连接可能。
如:'ab' -> a-b,
'abc' -> a-bc, a-b-c, ab-c,
'abcd' -> a-bcd, ab-cd, abc-d,a-b-cd, ab-c-d,a-bc-d,a-b-c-d
PS:
1. 回复时注意加上下面这句话,才会有语法高亮或格式缩进。
```javascript
// you code
```