Skip to content

Instantly share code, notes, and snippets.

View yao2030's full-sized avatar

yao2030 yao2030

  • Shanghai, China
View GitHub Profile
@digerata
digerata / RoundedRectLabel.h
Created July 30, 2010 16:12
Create a UILabel with a rounded rect background like in the iPhone Mail app. (Much faster than using UILabel.layer.cornerRadius)
//
// RoundedRectLabel.h
//
#import <UIKit/UIKit.h>
@interface CountLabel : UILabel {
NSInteger cornerRadius;
UIColor *rectColor;
}
@yao2030
yao2030 / book.txt
Last active December 9, 2015 19:38
1. Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp
2. Code: The Hidden Language of Computer Hardware and Software
3. An introduction to algorithms
4. Artificial Intelligence: a modern approach
5. ON LISP
6. ANSI COMMON LISP
7. LISP IN SMALL PIECES
8. THE LITTLE LISPER
9. THE SEASONED SCHEMER
;; capitalize
M-c
M-- M-c
;; Upper case
M-u
M-- M-u
;; lower case
M-l
M-- M-l
;; quit message
(fset 'yes-or-no-p 'y-or-n-p)
;;把缺省的 major mode 设置为 text-mode, 而不是几乎什么功能也
;;没有的 fundamental-mode.
(setq default-major-mode 'text-mode)
(setq initial-major-mode 'text-mode)
;;光标靠近鼠标指针时,让鼠标指针自动让开,别挡住视线。
(mouse-avoidance-mode 'animate)
;;显示列号
(setq column-number-mode t)
@creaktive
creaktive / mojo-crawler.pl
Last active November 28, 2020 13:15
Simple web crawler/scraper implemented using Mojolicious
#!/usr/bin/env perl
use 5.010;
use open qw(:locale);
use strict;
use utf8;
use warnings qw(all);
use Mojo::UserAgent;
# FIFO queue
@markd2
markd2 / runtime.m
Created July 9, 2013 20:55
Objective-C runtime metadata dumper.
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
#import "typestring.h"
// clang -g -fobjc-arc -Wall -framework Foundation -o runtime typestring.m runtime.m
// Runtime reference, at least until Apple breaks the link
// http://developer.apple.com/library/ios/#documentation/Cocoa/Reference/ObjCRuntimeRef/Reference/reference.html
@neonichu
neonichu / update_xcode_plugins
Last active September 18, 2019 14:09
Update DVTPlugInCompatibilityUUIDs for installed plugins from Xcode 5.1 beta to final
#!/bin/sh
#ID='A16FF353-8441-459E-A50C-B071F53F51B7' # Xcode 6.2
ID='992275C1-432A-4CF7-B659-D84ED6D42D3F' # Xcode 6.3
PLIST_BUDDY=/usr/libexec/PlistBuddy
function add_compatibility() {
"$PLIST_BUDDY" -c "Add DVTPlugInCompatibilityUUIDs:10 string $2" \
"$1/Contents/Info.plist"
@correia
correia / swift-kvo-example.swift
Last active April 16, 2023 02:38
A quick example for how to use Foundation style KVO from Swift. (Official documentation from Apple is forthcoming.)
//
// Swift-KVO
//
// Created by Jim Correia on 6/5/14.
// Copyright (c) 2014-2015 Jim Correia. All rights reserved.
//
// Update: 6/17/2014
//
// KVOContext has gone away; use the same idiom you'd use from Objective-C for the context
//
@james-b-kelly
james-b-kelly / CollectionViewLabelCell
Last active August 29, 2015 14:07
Multi-line UIlLabel in full-width UICollectionViewCell.
//In your UIViewController (containing the UICollectionView).
//In @interface
@property (nonatomic, strong) MyCollectionViewCellSubclass *prototypeCell;
//In viewDidLoad
//Register your subclassed cell, and load your prototype cell.
UINib *cellNib = [UINib nibWithNibName:@"MyCollectionViewCellSubclass" bundle:nil];
[collectionView registerNib:cellNib forCellWithReuseIdentifier:@"MyCollectionViewCellSubclassID"];
self.prototypeCell = [cellNib instantiateWithOwner:nil options:nil][0];
@SheffieldKevin
SheffieldKevin / movietransitions.swift
Last active June 25, 2021 16:58
Make a movie with transitions with AVFoundation and swift
//
// main.swift
// mutablecomposition
//
// Created by Kevin Meaney on 24/08/2015.
// Copyright (c) 2015 Kevin Meaney. All rights reserved.
//
import Foundation