Skip to content

Instantly share code, notes, and snippets.

View qinyu's full-sized avatar
💭
I may be slow to respond.

Qin Yu qinyu

💭
I may be slow to respond.
  • Thoughtworks
  • Chengdu
View GitHub Profile
@qinyu
qinyu / introrx.md
Last active August 29, 2015 14:18 — forked from staltz/introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

@qinyu
qinyu / rerun.sh
Created August 28, 2016 23:08
RF失败测试用例重试三次
#!/bin/sh
retry_count=3
rm out/*.xml out/*.html
robot --log none --report none --outputdir out --output output.xml .
result=$?
@qinyu
qinyu / release-resolution-strategy.gradle
Created November 23, 2016 23:22
使用依赖的dynamic version时忽略snapshot
configurations.all { configuration ->
configuration.resolutionStrategy { ResolutionStrategy componentSelection ->
componentSelection.componentSelection { rules ->
rules.all { ComponentSelection selection, ComponentMetadata metadata ->
boolean accepted = metadata.status == 'release'
if (!accepted) {
selection.reject("Component status ${metadata.status} rejected by release")
}
}
}
@qinyu
qinyu / eclipse-junit-code-templates.xml
Created August 28, 2017 06:08
junit-guidelines-snippets
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<templates>
<template autoinsert="true" context="java-statements" deleted="false" description="assertThat(actual, is(expected));" enabled="true" name="atis">${import:importStatic('org.junit.Assert.*', 'org.hamcrest.Matchers.*')}
assertThat(${actual}, is(${expected}));</template>
<template autoinsert="true" context="java-members" deleted="false" description="Simple should" enabled="true" name="sho">@${testType:newType(org.junit.Test)}
public void should_${testName}() throws Exception {
}</template>
<template autoinsert="true" context="java-members" deleted="false" description="Should and GivenWhenThan" enabled="true" name="shogwt">@${testType:newType(org.junit.Test)}
public void should_${testName}() throws Exception {
// Given
@qinyu
qinyu / eclipse-junit-code-templates.xml
Created August 28, 2017 06:08
junit-guidelines-snippets
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<templates>
<template autoinsert="true" context="java-statements" deleted="false" description="assertThat(actual, is(expected));" enabled="true" name="atis">${import:importStatic('org.junit.Assert.*', 'org.hamcrest.Matchers.*')}
assertThat(${actual}, is(${expected}));</template>
<template autoinsert="true" context="java-members" deleted="false" description="Simple should" enabled="true" name="sho">@${testType:newType(org.junit.Test)}
public void should_${testName}() throws Exception {
}</template>
<template autoinsert="true" context="java-members" deleted="false" description="Should and GivenWhenThan" enabled="true" name="shogwt">@${testType:newType(org.junit.Test)}
public void should_${testName}() throws Exception {
// Given
@qinyu
qinyu / all_code.txt
Last active December 26, 2023 10:02
Code Quality Spike
// 业务A
@Transactional
public void doTransactionA(Some some) {
Data data = queryData();
data.some(some);
save(data);
saveLogA(data);
}
//业务B
@qinyu
qinyu / lint_issues_analysis.py
Last active May 17, 2024 09:27
Count lint issues in multiple apps and present a bar chart
import requests
import re
import os
import xml.etree.ElementTree as ET
import matplotlib.pyplot as plt
def fetch_lint_rules() -> tuple[dict[str, tuple[str, int]], list[tuple[str, int]]]:
"""
Fetch the lint rules and severities from the android lint sample website: