Skip to content

Instantly share code, notes, and snippets.

View acalism's full-sized avatar
🏠
Working from home

Dawn Song acalism

🏠
Working from home
  • Tencent, Alibaba
  • Shenzhen City, Guangdong Province, China
View GitHub Profile
@lattner
lattner / TaskConcurrencyManifesto.md
Last active May 3, 2024 08:18
Swift Concurrency Manifesto
@stephenhardy
stephenhardy / git-clearHistory
Created April 26, 2013 22:14
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
@skabber
skabber / exportOptions.plist
Last active April 14, 2024 20:47
Export Options Plist Example
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>app-store</string>
<key>teamID</key>
<string>XXXXXXXXXX</string>
<key>uploadBitcode</key>
<true/>
@rarylson
rarylson / automator_new_file.scpt
Last active March 1, 2024 01:03
AppleScript to create a new file in Finder (to be used in Automator)
-- AppleScript to create a new file in Finder
--
-- Use it in Automator, with the following configuration:
-- - Service receives: no input
-- - In: Finder.app
--
-- References:
-- - http://apple.stackexchange.com/a/129702
-- - http://stackoverflow.com/a/6125252/2530295
-- - http://www.russellbeattie.com/blog/fun-with-the-os-x-finder-and-applescript
@benschw
benschw / git-origins.md
Last active September 20, 2023 08:54
fork a repo manually (set source as upstream origin) rather than with the "fork" button. e.g. for in github when you want to fork a project twice.

Ripped off from adrianshort.org

List curent remotes

$ git remote -v

origin  https://github.com/hakimel/reveal.js.git (fetch)
origin  https://github.com/hakimel/reveal.js.git (push)

Rename origin to upstream and add our new empty repo as the origin.

@kennwhite
kennwhite / reset_osx_attributes.sh
Created September 1, 2013 03:10
Remove all extended attributes recursively on an OSX directory & files and fix "chown: ... Operation not permitted" and "chmod: ... Operation not permitted"
# This is the nuclear option. Use with extreme care
# Works up to and including Mountain Lion (10.8.x)
# Show all extended attributes
ls -lOe ~/dir-to-fix
# Remove no-change attributes
sudo chflags nouchg ~/dir-to-fix
# Recursively clear all entended attributes
@JadenGeller
JadenGeller / Unsafe Bit Cast.swift
Last active January 26, 2023 22:09
A Quick Overview of Unsafe Bit Cast
// Let's declare two structs that with different variables and different boolean values:
struct A {
let x = true
}
struct B {
let y = false
}
@DaveWoodCom
DaveWoodCom / set_swift_version.post_install.ruby
Created October 4, 2017 05:18
`post_install` hook to set the Swift version of pods (add to the end of your project's podfile)
post_install do |installer|
print "Setting the default SWIFT_VERSION to 4.0\n"
installer.pods_project.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.0'
end
installer.pods_project.targets.each do |target|
if ['SomeTarget-iOS', 'SomeTarget-watchOS'].include? "#{target}"
print "Setting #{target}'s SWIFT_VERSION to 3.0\n"
target.build_configurations.each do |config|
@martinnormark
martinnormark / updateConstraints.swift
Last active September 23, 2020 08:56
Example of updateConstraints using PureLayout
private var didUpdateConstraints: Bool = false
override func updateConstraints() {
if (!didUpdateConstraints) {
self.buildStatusIndicatorView.autoPinEdgesToSuperviewEdgesWithInsets(UIEdgeInsetsZero, excludingEdge: ALEdge.Trailing)
self.buildStatusIndicatorView.autoSetDimension(ALDimension.Width, toSize: 10)
self.buildNumberLabel.autoPinEdgesToSuperviewEdgesWithInsets(UIEdgeInsets(top: 5, left: 15, bottom: 5, right: 5), excludingEdge: ALEdge.Bottom)
self.buildNumberLabel.autoSetDimension(ALDimension.Height, toSize: 23)
@JScott
JScott / unxip.scpt
Created September 16, 2016 16:41
For unarchiving Apple's bad decisions
-- http://stackoverflow.com/questions/37812664/end-of-central-directory-signature-not-found-when-installing-xcode-8-beta-xip/37857162#37857162
on run argv
tell application "Archive Utility" to open POSIX path of (item 1 of argv)
repeat
delay 5
if application "Archive Utility" is not running then exit repeat
end repeat
end run