- Install plugin
Custom CSS and JS Loader
- Open
setting.json
add lines below"vscode_custom_css.imports": ["file:///Users/Don/Documents/vscode/customtheme/vscode-vibrancy.css", "file:///Users/Don/Documents/vscode/customtheme/vscode-vibrancy.js"], "vscode_custom_css.policy": true, "terminal.integrated.rendererType": "dom"
- CMD + Shift + p, reload custom css and js
- Restart VSCode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 添加通知 | |
[[UIDevice currentDevice] setProximityMonitoringEnabled:YES]; | |
if ([UIDevice currentDevice].proximityMonitoringEnabled == YES) | |
[[NSNotificationCenter defaultCenter] addObserver:self | |
selector:@selector(proximitySensorChange:) | |
name:UIDeviceProximityStateDidChangeNotification | |
object:nil]; | |
// 移除通知 | |
if ([UIDevice currentDevice].proximityMonitoringEnabled == YES) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma mark - | |
- (void)drawTestLine | |
{ | |
// test code : draw line between Beijing and Hangzhou | |
CLLocation *location0 = [[CLLocation alloc] initWithLatitude:39.954245 longitude:116.312455]; | |
CLLocation *location1 = [[CLLocation alloc] initWithLatitude:30.247871 longitude:120.127683]; | |
NSArray *array = [NSArray arrayWithObjects:location0, location1, nil]; | |
[self drawLineWithLocationArray:array]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# default.custom.yaml | |
# save it to: | |
# ~/.config/ibus/rime (linux) | |
# ~/Library/Rime (macos) | |
# %APPDATA%\Rime (windows) | |
patch: | |
schema_list: | |
- schema: luna_pinyin # 朙月拼音 | |
- schema: luna_pinyin_simp # 朙月拼音 简化字模式 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main(int argc, const char * argv[]) { | |
/* 指针、引用和取值 | |
int *ptr; // 声明一个 int 指针 | |
int val = 1; // 声明一个 int 值 | |
ptr = &val; // 为指针分配一个 int 值的引用 | |
int deref = *ptr; // 对指针进行取值 | |
int nullVal; // 默认值是 0 | |
int *nullPtr = &nullVal; | |
printf("Hello, World!\n%p=%d\n%p=%d\n", ptr, deref, nullPtr, nullVal); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import Foundation | |
var str = "Hello" | |
let data1 = str.data(using: String.Encoding.utf8)! | |
data1.withUnsafeBytes { (bytes: UnsafePointer<CChar>) -> Void in | |
print(bytes.pointee) | |
let arr = UnsafeBufferPointer(start: bytes, count: 5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf8 -*- | |
if __name__ == "__main__": | |
import glob, os, datetime, fileinput | |
cwd = os.getcwd() | |
files = [f for f in glob.glob(cwd + os.path.sep + "**/*.rst", recursive=True)] | |
for f in files: | |
modifieddate = datetime.datetime.fromtimestamp(os.path.getmtime(f)) | |
if not ':date:' in open(f).read(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum Rank: Int, CustomStringConvertible { | |
case ace = 1 | |
case two, three, four, five, six, seven, eight, nine, ten | |
case jack, queen, king | |
func simpleDescription() -> String { | |
switch self { | |
case .ace: | |
return "ace" | |
case .jack: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
let names = ["Dong", "Chris", "Alex", "Ewa", "Barry", "Baniella"] | |
// 1.Origin | |
func forward(_ s1: String, _ s2: String) -> Bool { return s1 < s2 } | |
var orderNames = names.sorted(by: forward) | |
// 2.Closure writen as entired format | |
var reverseNames = names.sorted (by: { (s1: String, s2: String) -> Bool in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define BUZZER D6 | |
void setup() { | |
Serial.begin(115200); | |
Serial.println("setup"); | |
pinMode(BUZZER, OUTPUT); | |
digitalWrite(BUZZER,HIGH); | |
} |