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 / extension.ts
Last active April 10, 2020 18:24
Powershell Notebook
import * as vscode from 'vscode';
class PSNB implements vscode.NotebookProvider {
constructor() {}
async resolveNotebook(editor: vscode.NotebookEditor): Promise<void> {
editor.document.languages = ['powershell'];
const uri = editor.document.uri;
const data = (await vscode.workspace.fs.readFile(uri)).toString();
const lines = data.split(/\r|\n|\r\n/g);
@rebornix
rebornix / content.swift
Created December 22, 2019 06:21
SwiftUI list view selection & navigation
import SwiftUI
struct Task: Codable, Identifiable, Hashable {
var id: Int
var name: String
}
struct ContentView: View {
@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.

#!/bin/sh
pass=true
RED='\033[1;31m'
GREEN='\033[0;32m'
NC='\033[0m'
echo "Running Linters:"
@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>
@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 / 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 / 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 / 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 / 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",