Skip to content

Instantly share code, notes, and snippets.

View yeyuguo's full-sized avatar
🎯
Focusing

Struggling Youth yeyuguo

🎯
Focusing
  • ...
  • China-BeiJing(Now)
View GitHub Profile

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

<html>
<head>
<title>Core Interaction</title>
<link rel="stylesheet" href="assets/css/global.css">
</head>
<body>
<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<style type="text/css">
#halfCircleBlack{
height:30px;
width:60px;
border-radius: 60px 60px 0 0;
-moz-border-radius: 60px 60px 0 0;
-webkit-border-radius: 60px 60px 0 0;
<!DOCTYPE html>
<html>
<body style= "background-color:#ccc;")>
<button onclick="myFunction()"> Plenty of Fish in the Sea</button> <br>
<button onclick="myFunction()"> Click FISH to FISH</button>
<div align= "center">
,'._,`. PYTHON SUCKS
(-.___.-) EVEN SANDNIGGERS CAN MASTER IT
(-.___.-) DESPITE THE FACT THAT THIS IS OBVIOUSLY A COBRA
`-.___.-'
(( @ @| . __
\ ` | ,\ |`. @| | | _.-._
__`.`=-=mm===mm:: | | |`. | | | ,'=` '=`.
( `-'|:/ /:/ `/ @| | | |, @| @| /---)W(---\
\ \ / / / / @| | ' (----| |----) ,~
|\ \ / /| / / @| \---| |---/ |
# coding: utf-8
# author: haofly
#
# fun: 生成随机姓名、随机电话号码、随机字符串,目前仅支持Python2
import random
def generateName(first_len=0, last_len=0):
surnames = [
from time import time
t = time()
lista = [1,2,3,4,5,6,7,8,9,10]
listb =[0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,0.01]
len1=len(lista)
len2=len(listb)
for i in xrange (1000000):
for a in xrange(len1):
temp=lista[a]
for b in xrange(len2):
@yeyuguo
yeyuguo / bad.js
Created April 8, 2017 09:04 — forked from evantahler/bad.js
pg-action.js
exports.randomRow = {
name: 'randomFirstName',
description: 'I will return a random first name from the users table',
outputExample: {},
run: function(api, data, next){
pg.connect(api.config.pg.url, function(error, client, done){
if(error){ return next(error); }
var query = 'select * from usersorer by random() limit 1';
client.query(query, function(error, results){
本文曾在“架构师之路”上发布过,近期支援Qcon-AS大会,在微信群里分享了该话题,故对原文进行重新整理与发布。
一、秒杀业务为什么难做
1)im系统,例如qq或者微博,每个人都读自己的数据(好友列表、群列表、个人信息);
2)微博系统,每个人读你关注的人的数据,一个人读多个人的数据;
3)秒杀系统,库存只有一份,所有人会在集中的时间读和写这些数据,多个人读一个数据。
例如:小米手机每周二的秒杀,可能手机只有1万部,但瞬时进入的流量可能是几百几千万。
又例如:12306抢票,票是有限的,库存一份,瞬时流量非常多,都读相同的库存。读写冲突,锁非常严重,这是秒杀业务难的地方。那我们怎么优化秒杀业务的架构呢?