Skip to content

Instantly share code, notes, and snippets.

View Cee's full-sized avatar
🎀
ハネだ (<ゝω·)☆

Tianyu Wang Cee

🎀
ハネだ (<ゝω·)☆
View GitHub Profile
@Cee
Cee / captive.sh
Created December 23, 2016 06:16
Remove captive letter
# Before Android 7.1.1
adb shell "settings put global captive_portal_server www.google.cn";
# After Android 7.1.1
adb shell "settings put global captive_portal_https_url https://www.google.cn";
@Cee
Cee / snippet.m
Created December 6, 2016 02:39
<input/> tag in a WKWebView
- (void)dismissViewControllerAnimated:(BOOL)flag completion:(void (^)(void))completion {
if (self.presentedViewController) {
[super dismissViewControllerAnimated:flag completion:completion];
}
}
@Cee
Cee / sort-Xcode-project-file.perl
Created November 24, 2016 06:51
sort-Xcode-project-file
#!/usr/bin/perl -w
# Copyright (C) 2007, 2008, 2009, 2010 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.
@Cee
Cee / IsNotEmpty.swift
Created November 23, 2016 06:52
Value Transformer
class IsNotEmpty: ValueTransformer {
override class func transformedValueClass() -> Swift.AnyClass {
return Int.self as! AnyClass
}
override class func allowsReverseTransformation() -> Bool {
return false
}
@Cee
Cee / NSView+Extension.swift
Created October 31, 2016 06:21
Add a background color to NSView
extension NSView {
var backgroundColor: NSColor? {
get {
if let colorRef = layer?.backgroundColor {
return NSColor(cgColor: colorRef)
} else {
return nil
}
}
set {
@Cee
Cee / 1.md
Created October 16, 2016 02:36

项目需要解决的问题

我们的组内成员都是有多年竞赛与竞赛教学经验,并且想一直试图用技术去普及编程教学。

在出发来上海的前一天,某组员在杭州某初中教竞赛。在 3 小时的教学中,居然消耗了一多半的时间教授学生们如何搭建运行环境,安装 python,安装 ide。

在我们看来,让小朋友们过早的接触繁杂的运行环境安装是可以用技术避免的。在学习编程的初期阶段,我们希望通过一些前沿的技术去屏蔽掉一些技术细节。让小朋友们更快乐,更快捷高效的去入门编程。避免产生为难情绪。

我们做了什么

@Cee
Cee / add_version_number.sh
Created October 13, 2016 04:29
Add Version Number
#!/bin/bash
git=$(sh /etc/profile; which git)
number_of_commits=$("$git" rev-list HEAD --count)
git_release_version=$("$git" describe --tags --always --abbrev=0)
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${git_release_version#*v}" "${PROJECT_DIR}/${INFOPLIST_FILE}"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $number_of_commits" "${PROJECT_DIR}/${INFOPLIST_FILE}"
// Atom
@Cee
Cee / .gitconfig
Created August 4, 2016 10:01
Fuck
[alias]
fuck = !"git add -A; git commit -am \"Fuck\"; git push"
@Cee
Cee / xcode-build-bump.sh
Created November 28, 2015 15:36 — forked from sekati/xcode-build-bump.sh
Xcode Auto-increment Build & Version Numbers
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)