Skip to content

Instantly share code, notes, and snippets.

Xi Lin xilin

Block or report user

Report or block xilin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
xilin /
Created Nov 4, 2019 — forked from idiomatic/
Fetch WWDC videos, slides, and sample code.
# usage: get [ RESOLUTION [ YEAR [ IDS... ] ] ]
RESOLUTION=$(echo $resolution | tr '[:lower:]' '[:upper:]')
xilin / lc.js
Last active Dec 7, 2019
copy desc in leetcode for notion
View lc.js
var l = getEventListeners(document).copy[0];
document.removeEventListener('copy', l.listener, l.useCapture);
// change format so that codes inside `PRE` tag can show correctly in notion
for (let strong of [...document.getElementsByTagName('code')].filter(i => i.parentNode.tagName === 'PRE')) {
const textNode = document.createElement('span');
textNode.innerHTML = strong.innerHTML;
strong.parentNode.replaceChild(textNode, strong);
for (let strong of [...document.getElementsByTagName('strong')].filter(i => i.parentNode.tagName === 'PRE')) {
const textNode = document.createElement('span');
xilin / NSObject+Debounce.h
Created Mar 10, 2018 — forked from berzniz/NSObject+Debounce.h
Debounce method for Objective C
View NSObject+Debounce.h
@interface NSObject (Debounce)
- (void)debounce:(SEL)action delay:(NSTimeInterval)delay;
xilin / reload-table.m
Last active May 9, 2017
Reload table with a snapshot transition
View reload-table.m
// From
- (void)reloadData
UIView *snapshot = [_tableView snapshotViewAfterScreenUpdates:NO];
[self.view insertSubview:snapshot aboveSubview:_tableView];
[_tableView beginUpdates];
[_tableView reloadData];
[_tableView endUpdatesAnimated:NO completion:^(BOOL completed) {
xilin / font-boosting.css
Created Apr 19, 2017 — forked from mojoaxel/font-boosting.css
Disable font boosting on mobile browsers
View font-boosting.css
/* disable font boosting on mobile browsers */
body * {
max-height: 1000000em; /* Chrome for Android */
-moz-text-size-adjust: none; /* Firefox Mobile */
-webkit-text-size-adjust: 100%; /* Safari */
View gist:2c2040cfc8f306850222b73eb8218b3c
// The trick is to link the DeviceSupport folder from the beta to the stable version.
// Updated on Jan 24th, 2017 for Xcode 8.3b1
ln -s /Applications/\ \(14E5230d\)/ /Applications/
// Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions
// sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)
View gist:8d3aed526fdbe6c5ecd34462e25fb0aa
→ curl -iI -v -A " " ""
* About to connect() to port 80 (#0)
* Trying connected
* Connected to ( port 80 (#0)
> HEAD / HTTP/1.1
> User-Agent:
> Host:
> Accept: */*
< HTTP/1.1 200 OK
xilin /
Created Aug 9, 2016 — forked from jimothyGator/
Nginx configuration for Mac OS X with Homebrew, using sites-enabled directory.
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}
cd /usr/local/etc/nginx/sites-enabled
ln -s ../sites-available/default.conf
ln -s ../sites-available/default-ssl.conf

File locations:

  • nginx.conf to /usr/local/etc/nginx/
  • default.conf and default-ssl.conf to /usr/local/etc/nginx/sites-available
  • homebrew.mxcl.nginx.plist to /Library/LaunchDaemons/
xilin / PSPDFUIKitMainThreadGuard.m
Created Jan 7, 2016 — forked from steipete/PSPDFUIKitMainThreadGuard.m
This is a guard that tracks down UIKit access on threads other than main. This snippet is taken from the commercial iOS PDF framework, but relicensed under MIT. Works because a lot of calls internally call setNeedsDisplay or setNeedsLayout. Won't catch everything, but it's very lightweight and usually does the job.You might n…
View PSPDFUIKitMainThreadGuard.m
// Taken from the commercial iOS PDF framework
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
// Licensed under MIT (
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it.
#import <objc/runtime.h>
#import <objc/message.h>
// Compile-time selector checks.
xilin / linkmap.js
Created Dec 7, 2015 — forked from bang590/linkmap.js
XCode Linkmap Parser
View linkmap.js
var readline = require('readline'),
fs = require('fs');
var LinkMap = function(filePath) {
this.files = []
this.filePath = filePath
LinkMap.prototype = {
start: function(cb) {
You can’t perform that action at this time.