Skip to content

Instantly share code, notes, and snippets.

@linpc
linpc / gist:2389778
Created April 15, 2012 03:43
#osdc.tw 2012 irc log
--- 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
.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)" }
@linpc
linpc / gist:2731159
Created May 19, 2012 15:04
JSDC.tw 2012 irc log
--- 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~
@mckamey
mckamey / bezier.js
Created September 25, 2012 16:35
JavaScript port of Webkit CSS cubic-bezier(p1x.p1y,p2x,p2y) and various approximations
/*
* 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
@ethanhuang13
ethanhuang13 / xcode-beta-slink.sh
Last active February 3, 2023 20:21
Symbolic link from Xcode.app to Xcode-beta.app (Xcode 11.2)
@skeeet
skeeet / xcode_ramdisk.sh
Created April 12, 2012 13:35 — forked from MaximKeegan/xcode_ramdisk.sh
Create a RAM disk for using with XCode
#!/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"
@NSProgrammer
NSProgrammer / Overview.md
Last active March 7, 2023 08:06
Comparing modern vs legacy graphics context rendering on iOS

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 August 19, 2023 15:24
XCode Linkmap Parser
var readline = require('readline'),
fs = require('fs');
var LinkMap = function(filePath) {
this.files = []
this.filePath = filePath
}
LinkMap.prototype = {
start: function(cb) {
@nicklockwood
nicklockwood / CodableVersioning.swift
Last active January 29, 2024 11:31
Example demonstrating how to use versioning for Codable structs
// This gist demonstrates how you can implement versioning for a Codable struct to support loading
// old serialized data after changing the structure. Notable features of this solution:
//
// * No need to make new properties optional, or to perform post-processing on the struct after
// loading in ordeer to populate missing values
// * No need to change the call site - from the outside this struct behaves just the same
// as if we had implemented codable directly in the normal way.
// * Versioning can be applied individually to parents or leaves in a larger tree of
// structs without affecting the other elements
// * This approach will work even if the original struct was not designed with versioning in mind
@steipete
steipete / PSPDFUIKitMainThreadGuard.m
Last active March 10, 2024 19:23
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…
// 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>