Skip to content

Instantly share code, notes, and snippets.

View rebornix's full-sized avatar
📓
Working from home

Peng Lyu rebornix

📓
Working from home
View GitHub Profile
@rebornix
rebornix / badgeFactory
Created April 24, 2015 02:21
Draw badge(png)
public Bitmap Draw(Color subjectCol, string subjectStr, Color statusCol, string statusStr) {
var fullHeight = 0;
var fullWidth = 0;
var padding = 8;
var shadowOffset = 5;
var font = new Font("Segoe UI", 100, GraphicsUnit.Pixel);
var maxWidth = (subjectStr.Length + statusStr.Length) * 100 + 4 * padding;
Bitmap bitmap = new Bitmap(maxWidth, 200);
using (Graphics g = Graphics.FromImage(bitmap))
@rebornix
rebornix / index
Created June 2, 2015 13:22
Download Trend
<!DOCTYPE html>
<html>
<head>
<title>d3.tip.js - Tooltips for D3</title>
<meta charset="utf-8" />
<title>Bar Chart</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js" charset="utf-8"></script>
<script type="text/javascript" src="../index.js"></script>
<script type="text/javascript">
data = [{"total":1225, "date": "5.1"},{"total":279, "date": "5.2"},{"total":212, "date": "5.3"},{"total":335, "date": "5.4"},{"total":329, "date": "5.5"},{"total":234, "date": "5.6"},{"total":175, "date": "5.7"}, {"total":1225, "date": "5.1"},{"total":279, "date": "5.2"},{"total":212, "date": "5.3"},{"total":335, "date": "5.4"},{"total":329, "date": "5.5"},{"total":234, "date": "5.6"},{"total":175, "date": "5.7"}, {"total":1225, "date": "5.1"},{"total":279, "date": "5.2"},{"total":212, "date": "5.3"},{"total":335, "date": "5.4"},{"total":329, "date": "5.5"},{"total":234, "date": "5.6"},{"total":175, "date": "5.7"}, {"total":1225, "date": "5.1"},{"total":279, "date": "5.2"},{"total":212,
@rebornix
rebornix / soparser.js
Last active August 29, 2015 14:23
Extract information from Stack Overflow question with Noodlejs
var query = {
url: 'http://stackoverflow.com/questions/31095166/angular-mocha-tests-fail-when-i-add-multiple-controllers-to-the-same-module',
type: 'html',
map: {
title: {
selector: "#question-header h1 a",
extract: "text"
},
description: {
selector: ".question .postcell .post-text",
@rebornix
rebornix / q.ts
Created August 4, 2015 07:02
Angular $q written in typescript (draft)
interface PromiseState {
status: number;
}
class Promise {
$$state: PromiseState;
constructor() {
this.$$state = { status : 0 };
}
then(onFulfilled, onRejected, progressBack) {
var result = new Deferred();
@rebornix
rebornix / threecastinandroid.md
Last active October 26, 2015 03:42
How to subscribe Three Cast Podcast in Android

这里我们拿 Android 上一款开源的播客播放器 AntennaPod 举例。

首先打开客户端,点击左上角的菜单按钮,选择 添加博客 step 1

然后在添加播客URL处,填入我们的地址http://three.sh/feed.xml,点击确定 step 2

最后进入到三人行播客的介绍页面,点击订阅就可以收听我们的播客啦! step 3

@rebornix
rebornix / logstash.conf
Created January 15, 2016 05:58
Logstash configuration for IIS log.
input {
file {
type => "IISLog"
path => "C:/inetpub/logs/LogFiles/W3SVC*/*.log"
start_position => "beginning"
}
}
filter {
@rebornix
rebornix / app.js
Created May 26, 2016 20:10
json content breaks vs code
var test = `
{"results":[{"extensions":[{"publisher":{"publisherId":"a5c25faf-bf60-4941-81b9-9a852b96c5fb","publisherName":"ms-vscode","displayName":"ms-vscode","flags":"none"},"extensionId":"c3c225bf-758d-4db6-9341-00952baff6dd","extensionName":"node-debug","displayName":"Node Debug","flags":"validated, public","lastUpdated":"2016-04-26T16:14:04.087Z","publishedDate":"2015-11-22T07:57:09.457Z","shortDescription":"%extension.description%","versions":[{"version":"0.0.2","flags":"validated","lastUpdated":"2016-04-26T16:14:04.557Z","assetUri":""},{"version":"0.0.1","flags":"validated","lastUpdated":"2015-11-22T07:57:09.79Z","assetUri":""}],"categories":["Debuggers"],"tags":["vscode"],"statistics":[{"statisticName":"install","value":1574},{"statisticName":"trendingdaily","value":7.013358778625954},{"statisticName":"trendingmonthly","value":90.17175572519083},{"statisticName":"trendingweekly","value":38.57347328244275}]},{"publisher":{"publisherId":"a5c25faf-bf60-4941-81b9-9a852b96c5fb","publisherName":"rebornix",
@rebornix
rebornix / private.xml
Created July 8, 2016 01:13 — forked from Eric-Guo/private.xml
Karabiner private.xml for Topre REALFORCE 87U on rMBP
<?xml version="1.0"?>
<root>
<item>
<name>For Topre REALFORCE 87u Users</name>
<devicevendordef>
<vendorname>TopreCorporation</vendorname>
<vendorid>0x0853</vendorid>
</devicevendordef>
<item>
<name>Fix FN + F1..F12 and functional keys</name>
#!/bin/sh
pass=true
RED='\033[1;31m'
GREEN='\033[0;32m'
NC='\033[0m'
echo "Running Linters:"
@rebornix
rebornix / selection.md
Last active October 18, 2016 17:57
Manual Test: Selection

Go to definition

Open a TypeScript project, or whatever project whose language supports it. Move cursor to a symbol which is defined elsewhere, press F12, move hjkl to see if the cursor is positioned correctly.

Windows/Tabs

  1. Open the same file in two Group Editors by clicking Split Editor button. Switching between these two windows by pressing <C-w> hl or using Mouse. After switching window, press hjkl to see the cursor position is updated correctly.
  2. Open different files in two Group Editors. Other steps are the same as above.

Visual selection

Make sure visual selection still works by pressing "go to matching brace" % command.