Skip to content

Instantly share code, notes, and snippets.

View iwill's full-sized avatar
Growing Well 🌱🌱

Míng iwill

Growing Well 🌱🌱
View GitHub Profile
@iwill
iwill / color-legend.sh
Last active September 29, 2022 02:14
color-legend.sh
#!/bin/bash
# http://ss64.com/bash/echo.html
echo -n -e " "
for j in {40..47}; do
echo -n -e " bj-$j "
# Reset text attributes to normal without clear
tput sgr0
done

#The Great Firewall (GFW) Contributors List

注:数据来源为 dblp 和 cndblp, 下面括号中的数字表示 dblp 中显示的跟方滨兴合作论文的数量

###Binxing Fang (方滨兴)

中国工程院院士,北京邮电大学教授,中国科学院计算技术研究所网络方向首席科学家
http://en.wikipedia.org/wiki/Fang_Binxing

Objective-C Coding Convention and Best Practices

Most of these guidelines are to match Apple's documentation and community-accepted best practices. Some are derived some personal preference. This document aims to set a standard way of doing things so everyone can do things the same way. If there is something you are not particularly fond of, it is encouraged to do it anyway to be consistent with everyone else.

This document is mainly targeted toward iOS development, but definitely applies to Mac as well.

Operators

NSString *foo = @"bar";
@iwill
iwill / Masonry+M9Ext.h
Created November 27, 2017 05:04
A Masonry Extension supports iOS 11 safeAreaLayoutGuide, @see https://github.com/SnapKit/Masonry/pull/473
//
// Masonry+M9Ext.h
// M9Dev
//
// Created by MingLQ on 2017-04-05.
// Copyright © 2017 MingLQ <minglq.9@gmail.com>. Released under the MIT license.
//
#import <Masonry/Masonry.h>
@iwill
iwill / brew-perms.sh
Last active April 16, 2018 13:02 — forked from jaibeee/brew-perms.sh
Configure homebrew permissions to allow multiple users on MAC OSX. Any user from the admin group will be able to manage the homebrew and cask installation on the machine.
#!/bin/sh
# Configure homebrew permissions to allow multiple users on MAC OSX.
# Any user from the admin group will be able to manage the homebrew and cask installation on the machine.
# allow admins to manage homebrew's local install directory
chgrp -R admin $(brew --prefix)/*
chmod -R g+w $(brew --prefix)/*
# allow admins to homebrew's local cache of formulae and source files
chgrp -R admin /Library/Caches/Homebrew
@iwill
iwill / typeOf.js
Last active April 11, 2018 07:24
typeOf
/*!
* Javascript library - $class v0.2
* http://github.com/iwill/
*/
/**
* typeOf with Object.prototype.toString + instanceof
* #see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString#Description
*/
function typeOf(obj) {
@iwill
iwill / cocoapods_prepare_commands_paths.sh
Created December 7, 2018 09:41 — forked from niklasberglund/cocoapods_prepare_commands_paths.sh
Example of how you can get project dir and file path in a podspec's prepare_command
# Get project directory path
current_pwd="$PWD"
project_dir=`cd "../../"; pwd`
cd "$current_pwd"
# Get .xcodeproj file path (yes I know it's not a file)
project_file=`find "$project_dir" -maxdepth 1 -name "*.xcodeproj" | tail -1`
@iwill
iwill / POD_NAME.podspec
Created December 8, 2018 06:29 — forked from phatblat/POD_NAME.podspec
POC of a Pod which installs a run script into Xcode (CocoaPods 0.33 or less)
Pod::Spec.new do |s|
s.name = 'POD_NAME'
s.version = '1.0.0'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.summary = 'Example of pod which installs a run script into the Xcode project (first target)'
s.homepage = 'https://github.com/phatblat/POD_NAME'
s.authors = { 'Ben Chatelain' => 'benchatelain@gmail.com' }
s.source = { :git => 'https://github.com/phatblat/POD_NAME.git', :tag => s.version.to_s }
s.ios.deployment_target = '6.0'
@iwill
iwill / staticlibobjcabichecker.rb
Created December 29, 2018 02:26 — forked from dynamicdispatch/staticlibobjcabichecker.rb
Simple ruby script to check that Objective-C static libraries are built with the latest ObjC ABI
#!/usr/bin/env ruby
require 'optparse'
require 'pathname'
require 'open3'
# This tool checks an input path for all static libraries *.a files
# and makes sure they were built with the most modern ObjC ABI version.
# Parse command line options.
@iwill
iwill / iflet.m
Created August 15, 2020 10:32 — forked from CraigSiemens/iflet.m
if-let and guard macros for Objective C
#import <Foundation/Foundation.h>
// VARIABLE must be a variable declaration (NSString *foo)
// VALUE is what you are checking is not nil
// WHERE is an additional BOOL condition
#define iflet(VARIABLE, VALUE) \
ifletwhere(VARIABLE, VALUE, YES)
#define ifletwhere(VARIABLE, VALUE, WHERE) \