Skip to content

Instantly share code, notes, and snippets.

Grey Lee bcse

Block or report user

Report or block bcse

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
@tclementdev
tclementdev / libdispatch-efficiency-tips.md
Last active Aug 22, 2019
Making efficient use of the libdispatch (GCD)
View libdispatch-efficiency-tips.md

libdispatch efficiency tips

I suspect most developers are using the libdispatch inefficiently due to the way it was presented to us at the time it was introduced and for many years after that, and due to the confusing documentation and API. I realized this after reading the 'concurrency' discussion on the swift-evolution mailing-list, in particular the messages from Pierre Habouzit (who is the libdispatch maintainer at Apple) are quite enlightening (and you can also find many tweets from him on the subject).

My take-aways are:

@NSProgrammer
NSProgrammer / Overview.md
Last active May 15, 2019
Comparing modern vs legacy graphics context rendering on iOS
View Overview.md

legacy = UIGraphicsBeginImageContextWithOptions + UIGraphicsEndImageContext

modern = UIGraphicsImageRendererFormat + UIGraphicsImageRenderer

Take aways:

  • "modern" w/ prefersExtendedRange = NO
    • basically the same perf as "legacy"
    • probably a good idea to adopt since optimizations will likely be in "modern" first
  • "modern" w/ prefersExtendedRange = YES
@bang590
bang590 / linkmap.js
Last active Jul 25, 2019
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) {
@steipete
steipete / PSPDFUIKitMainThreadGuard.m
Last active Aug 12, 2019
This is a guard that tracks down UIKit access on threads other than main. This snippet is taken from the commercial iOS PDF framework http://pspdfkit.com, 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 http://pspdfkit.com.
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
// Licensed under MIT (http://opensource.org/licenses/MIT)
//
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it.
// PLEASE DUPE rdar://27192338 (https://openradar.appspot.com/27192338) if you would like to see this in UIKit.
#import <objc/runtime.h>
#import <objc/message.h>
View picturefill.haml
.pf{ "data-alt" => "", "data-picture" => "" }
%div{ "data-src" => fakeimg(300) }
%div{ "data-src" => fakeimg(300, :retina => 1), "data-media" => "(min-device-pixel-ratio: 1.5)" }
%div{ "data-src" => fakeimg(600 ), "data-media" => "(min-width: 320px)" }
%div{ "data-src" => fakeimg(600, :retina => 1), "data-media" => "(min-width: 320px) and (min-device-pixel-ratio: 1.5)" }
%div{ "data-src" => fakeimg(1200), "data-media" => "(min-width: 768px)" }
%div{ "data-src" => fakeimg(1200, :retina => 1), "data-media" => "(min-width: 768px) and (min-device-pixel-ratio: 1.5)" }
@mckamey
mckamey / bezier.js
Created Sep 25, 2012
JavaScript port of Webkit CSS cubic-bezier(p1x.p1y,p2x,p2y) and various approximations
View bezier.js
/*
* Copyright (C) 2008 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
@linpc
linpc / gist:2731159
Created May 19, 2012
JSDC.tw 2012 irc log
View gist:2731159
--- Day changed 六 5月 19 2012
01:23 Robin is now known as Guest3202
01:24 Guest3202 is now known as Pymaster
01:25 Pymaster is now known as pc035860
08:40 JSDC-Kay_ is now known as JSDC-Kay
08:49 < JSDC-Kay> 大家好!我是今天負責為各位進行實況轉播的 Kay!
08:50 < JSDC-df1> 大家好!我是今天負責為各位進行實況轉播的 df1!
08:51 < Kande_> 真是太好了^^
08:51 salagadool is now known as salagadoola_
08:55 < ericsk> Good morning~
@linpc
linpc / gist:2389778
Created Apr 15, 2012
#osdc.tw 2012 irc log
View gist:2389778
--- Day changed 六 4月 14 2012
00:00 < hcchien> 算了,洗澡睡覺去。明天看緣份了 :D
00:18 < cls_bsd> ....
00:34 < jnlin> hcchien: 我有...
07:37 < darkx> 大家早安
08:36 < miyagawa> which building is the venue? http://www.sinica.edu.tw/as/map/asmap_c.html
08:39 < clkao_> miyagawa: 24
08:39 < miyagawa> thanks
08:39 < clkao_> hcchien: 為什麼我的 abstract 沒有出現
08:57 clkao_ is now known as clkao
@skeeet
skeeet / xcode_ramdisk.sh
Created Apr 12, 2012 — forked from MaximKeegan/xcode_ramdisk.sh
Create a RAM disk for using with XCode
View xcode_ramdisk.sh
#!/bin/sh
# Create a RAM disk with same perms as mountpoint
# Script based on http://itux.idev.pro/2012/04/iservice-speed-up-your-xcode-%D0%BD%D0%B5%D0%BA%D0%BE%D1%82%D0%BE%D1%80%D1%8B%D0%B5-%D1%81%D0%BF%D0%BE%D1%81%D0%BE%D0%B1%D1%8B/ with some additions
# Usage: sudo ./xcode_ramdisk.sh start
USERNAME=$(logname)
TMP_DIR="/private/tmp"
RUN_DIR="/var/run"
SYS_CACHES_DIR="/Library/Caches"
You can’t perform that action at this time.