Skip to content

Instantly share code, notes, and snippets.

View yuanoook's full-sized avatar

Undefined yuanoook

View GitHub Profile
@yuanoook
yuanoook / urlparser.js
Last active August 29, 2015 14:17 — forked from sofish/urlparser.js
var parser = function(url) {
var a = document.createElement('a');
a.href = url;
var search = function(search) {
if(!search) return {};
var ret = {};
search = search.slice(1).split('&');
for(var i = 0, arr; i < search.length; i++) {
/**
* TextAreaExpander plugin for jQuery
* v1.0
* Expands or contracts a textarea height depending on the
* quatity of content entered by the user in the box.
*
* By Craig Buckler, Optimalworks.net
*
* As featured on SitePoint.com:
* http://www.sitepoint.com/blogs/2009/07/29/build-auto-expanding-textarea-1/
@yuanoook
yuanoook / README.md
Last active August 29, 2015 14:21 — forked from addyosmani/README.md

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@yuanoook
yuanoook / array-flatten
Created October 10, 2016 04:34
Array flatten
/*
Flatten an array of arbitrarily nested arrays of integers into a flat array of integers
[[1,2,[3]],4] -> [1,2,3,4]
<object Array> arrayFlatten(<object Array>);
*/
function arrayFlatten ( ary, ret ) {
ret = ret === undefined ? [] : ret;
for (var i = 0; i < ary.length; i++) {
if (Array.isArray(ary[i])) {
arrayFlatten(ary[i], ret);
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<style>
.app__layout {
position: absolute;
width: 100%;
height: 100%;
var sroll_interval = setInterval(() => {
window.scrollTo(0,100000000);
if (document.querySelectorAll('.soundList__item').length == 200) {
clearInterval(sroll_interval);
document.querySelectorAll('.soundList__item .sc-button-more').forEach((a,i) => {
setTimeout(() => {
a.click();
console.log(i);
setTimeout(() => {
var d = document.querySelector('.sc-button-download');
#!/usr/bin/env node
var fs = require('fs');
var request = require('request');
var cheerio = require('cheerio');
var _ = require('lodash');
var combo = '';
var res_count = 0;
saveCombo().then(combo => {
window.copy = copy;
(function(console){
console.save = function(data, filename){
if(!data) {
console.error('Console.save: No data')
return;
}
#!/usr/bin/env node
var fs = require('fs');
var $ = require('cheerio');
var sh = require('child_process').execSync;
var indexs = [];
for(let i=1; i<=221; i++) indexs.push(i);
var combo_body = indexs.reduce((prev, index) => {
@yuanoook
yuanoook / inbrowser.download.js
Created June 17, 2017 16:49
inbrowser.download.js
function download(url) {
var a = document.createElement('a');
a.setAttribute('href', url);
a.setAttribute('download', '');
a.click();
}