Skip to content

Instantly share code, notes, and snippets.


Shawn Wang iShawnWang

View GitHub Profile
iShawnWang / enum_demo.ts
Created Nov 25, 2019
Typescript 枚举 扩展
View enum_demo.ts
interface Enum {
[id: number]: string
const getEnumKeys = (e: Enum) => {
return Object.keys(e)
.map(key => e[key])
.filter(value => typeof value === 'string') as string[]
iShawnWang / useRouter.ts
Last active Jul 27, 2019
react-router backward hooks, support react-router 4.x | 5.x
View useRouter.ts
import { __RouterContext as RouterContext, RouteComponentProps } from 'react-router'
import { useContext, useMemo, useCallback } from 'react'
import qs from 'qs'
import { Location } from 'history'
interface ParsedQuery {
[whatever: string]: any
export const useRouter = <T>(): RouteComponentProps<T> =>

Keybase proof

I hereby claim:

  • I am ishawnwang on github.
  • I am ishawnwang ( on keybase.
  • I have a public key ASCgW2WZPG5ADfgS4QaCjUoKqXYhhAXgfpWFXWEpO634hAo

To claim this, I am signing this object:

iShawnWang / Log+Extension.swift
Last active Aug 22, 2017
Custom CleanroomLogger Channel demo
View Log+Extension.swift
Original issues : [CleanroomLogger/issues/37](
extension Log {
static func setup() {
Log.enable(debugMode: true)
Log.sqlite = MyLogChannel(prefix: "Sqlite") // enable your channel or using Xcode console filter
iShawnWang / LOL
Last active Oct 14, 2016
Detect Ad Hoc Build Configuration in code at runtime
View LOL
//AdHoc detect with following 2 conditions :
//1.`embedded.mobileprovision` contains field `ProvisionedDevices` (Debug and Ad Hoc Build contains this field ,Release not)
// is not DEBUG Build , we can use `#ifdef DEBUG` to decide it
BOOL isAdHoc = NO;
BOOL isDebug;
#ifdef DEBUG
View url-schemes-settings-ios.mkd

###Note Apple will reject apps that are using private url schemes (Ugh, Apple....) if they are pretty much obvius. Some apps are rejected and others are not, so, be aware of this issue before implementing any of those URL's in your app as a feature.

###[UPDATE : Not yet tested in iOS 10. It will fail because of policies changes in URL scheme handling.]

###[UPDATE 2:The openURL() method of UIApplication is now deprecated. You should use application(_:open:options:) instead]

##[UPDATE 3: For now you just can use url schemes to open your apps's settings with Swift 3.0 (Xcode 8). I'll keep you informed when OS preferences can be reached]

iShawnWang /
Last active Jul 5, 2016
Mac :Setup Avatar for SourceTree App ,为 SourceTree App 设置 Commit 时的头像
  1. Close SourceTree App
  2. Launch Finder,
    Command + Shift + G go to ~/Library/Application Support/SourceTree/ SourceTree Preference and Cache Directory,
  3. Delete Directory ImageCache
  4. Go to Gavatar with your account the same as you login in the SourceTree App
  5. Setup Avatar
  6. Launch SourceTree ,it will fetch avatar from Gavatar with account you login
  7. Done :)
You can’t perform that action at this time.