Skip to content

Instantly share code, notes, and snippets.

View monsterooo's full-sized avatar
👋

monsterooo monsterooo

👋
View GitHub Profile
@monsterooo
monsterooo / dabblet.css
Created October 14, 2016 09:48
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
@monsterooo
monsterooo / dabblet.css
Last active October 14, 2016 09:54
Untitled
.container {
display: flex;
}
.container div {
width: 50px;
background: gold;
text-align: center;
line-height: 50px;
}
@monsterooo
monsterooo / dabblet.css
Last active October 17, 2016 09:58
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
html,body {
padding: 0;
margin: 0;
}
.panel {
transform: translateX(-100%);
transition: transform 0.3s ease-out;
@monsterooo
monsterooo / dabblet.css
Last active October 17, 2016 18:29
Untitled
.item {
display: box;
height: 300px;
/*设置伸缩盒对象的子元素从上到下纵向排列*/
/*box-orient: vertical;*/ /*简单说就是垂直排列*/
/*设置伸缩盒对象的子元素从左到右水平排列*/
/*box-orient: horizontal;*/ /*简单说就是水平排列*/
}
.list {
background-color: gold;
@monsterooo
monsterooo / dabblet.css
Last active October 17, 2016 19:01
Untitled
.item {
display: box;
height: 300px;
/*设置伸缩盒对象的子元素从上到下纵向排列*/
/*box-orient: vertical;*/
/*简单说就是垂直排列*/
/*设置伸缩盒对象的子元素从左到右水平排列*/
box-orient: horizontal; /*简单说就是水平排列*/
/*子元素从开始位置对齐*/
@monsterooo
monsterooo / shuffle.md
Last active May 3, 2018 15:40
洗牌算法

Fisher–Yates洗牌算法,它可是最优洗牌算法它不仅是无偏的,而且时间复杂度是O(n),空间复杂度是O(1),同时也非常容易实现,代码如下

function shuffle(array) {
  var n = array.length, t, i;
  while (n) {
    i = Math.random() * n-- | 0; // 0 ≤ i < n
    t = array[n];
    array[n] = array[i];
 array[i] = t;
const pick = (obj, keys) => {
return keys.filter(key => obj.hasOwnProperty(key)).reduce((preValue, key) => {
preValue[key] = obj[key];
return preValue;
}, {});
};
// var o = {
// a: 1,
// b: 2,
@monsterooo
monsterooo / rm_mysql.md
Created October 12, 2018 06:09 — forked from vitorbritto/rm_mysql.md
Remove MySQL completely from Mac OSX

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

brew remove mysql

@monsterooo
monsterooo / gist:9752eb2b607e8033f3fb1461264b7696
Created January 2, 2019 09:14
获取浏览器滚动元素
function getBodyScrollTop () { const el = document.scrollingElement || document.documentElement return el.scrollTop }
@monsterooo
monsterooo / gist:f5a90092ed28bd0a1061794c807e6f39
Last active February 13, 2019 13:53
算法练习-回文字符串判断
/**
* 回文字符串判断
*/
function isPalindrome(s) {
if (!s) return true;
var i = 0, j = s.length - 1;
for (; i < j; ++i, --j ) {
while (i < j && !isAlphaNumber(s[i])) ++i;
while(i < j && !isAlphaNumber(s[j])) --j;