Skip to content

Instantly share code, notes, and snippets.

View BigNerdCoding's full-sized avatar
🎯
Focusing

Jax Wu BigNerdCoding

🎯
Focusing
View GitHub Profile
#!/bin/bash
STYLE=$(git config --get hooks.clangformat.style)
if [ -n "${STYLE}" ] ; then
STYLEARG="-style=${STYLE}"
else
STYLEARG="-style=file"
fi
format_file() {
@BigNerdCoding
BigNerdCoding / import_minimizer.rb
Created April 27, 2021 08:46 — forked from Orangenhain/import_minimizer.rb
Script that takes a ObjC .m file and tries to find unused (or duplicate) import statements by commenting out each #import line in turn and seeing if the project still compiles. You will have to change BUILD_DIR & BUILD_CMD.
#!/usr/bin/env ruby -w
class String
def starts_with?(prefix)
prefix.respond_to?(:to_str) && self[0, prefix.length] == prefix
end
end
HEADER_REGEX = /^#import\s+["<](.*)[">]/
@BigNerdCoding
BigNerdCoding / CompareTools.plist
Created November 7, 2020 07:06 — forked from igorkulman/CompareTools.plist
Visual Studio Code as a merge tool for Git Tower. Place both files to ~/Library/Application Support/com.fournova.Tower2/CompareTools/ and restart Git Tower
<?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">
<array>
<dict>
<key>ApplicationIdentifier</key>
<string>com.microsoft.VSCode</string>
<key>ApplicationName</key>
<string>Visual Studio Code</string>
// http://basememara.com/enum-based-queue-factory-gcd/
enum Queue: String {
private static var pools = [String: DispatchQueue]()
case database = "io.zamzam.databaseQueue"
case transform = "io.zamzam.transformQueue"
case network = "io.zamzam.networkQueue"
/**
Create dispatch queue.
#! /usr/bin/env python3
import os
import sys
import json
def main() :
#Get Var
input_crash = sys.argv[1]
input_dSYM = sys.argv[2]
output_crash = sys.argv[3]
@BigNerdCoding
BigNerdCoding / DYSMScript
Created May 8, 2018 12:53
Input .Crash & .Dysm to get a parsed crash info.
#! /usr/bin/env python3
import os
import sys
def findFile(path, name) :
for dic_name in os.listdir(path) :
sub_path = os.path.join(path, dic_name)
if os.path.isfile(sub_path) :
if dic_name == name :
@BigNerdCoding
BigNerdCoding / compilation-optimization.md
Created May 2, 2018 02:33 — forked from lsavino/compilation-optimization.md
Compiler Optimizations, Compiling Optimally, and Whole Modules

WIP: Things I've learned about these compiler flags and project settings

Whole Module Compilation Optimizations: Why these terms are sometimes misleading

When you look up how to compile swift faster for debug builds, people very earnestly give advice that seems contradictory: you should "try using the whole module optimization flag," and also "never use whole module optimization for debugging". [^1]

This is confusing because some of us are using these two general words:

compilation: "turning text into an executable program"

@BigNerdCoding
BigNerdCoding / libdispatch-efficiency-tips.md
Created May 2, 2018 02:32 — forked from tclementdev/libdispatch-efficiency-tips.md
Making efficient use of the libdispatch (GCD)

libdispatch efficiency tips

I suspect most developers are using the libdispatch inefficiently due to the way it was presented to us at the time it was introduced and for many years after that, and due to the confusing documentation and API. I realized this after reading the 'concurrency' discussion on the swift-evolution mailing-list, in particular the messages from Pierre Habouzit (who is the libdispatch maintainer at Apple) are quite enlightening (and you can also find some good tweets from him on the subject).

My take-aways are:

  • You should have very few queues that target the global pool. If all these queues are active at once, you will get as many threads running. These queues should be seen as execution contexts in the program (gui, storage, background work, ...) that benefit from executing in parallel. Start with few of them, reuse
@BigNerdCoding
BigNerdCoding / Channel.swift
Created March 8, 2018 01:32 — forked from gokselkoksal/Channel.swift
Channel implementation
public class Channel<Value> {
private class Subscription {
weak var object: AnyObject?
private let notifyBlock: (Value) -> Void
private let queue: DispatchQueue
var isValid: Bool {
return object != nil
@BigNerdCoding
BigNerdCoding / phoenix-and-vue-with-brunch.md
Created January 6, 2018 11:17
Setting up a Basic Phoenix+Vue+Brunch project

Work in Progress: Phoenix + Vue + Brunch

This documents how I integrate Vue 2.0 with Phoenix 1.x using the default brunch pipeline.

The toolchain

Start out by adding the vue-brunch plugin. You will need a version later than 1.2.3 in order to be able to use the extractCSS option (see later). At the time of writing, 1.2.3 was still the version fetched by npm so I suggest just getting the tip of the dev branch for now (this branch is for Vue 2.0 compatibility anyway):

npm install git+https://github.com/nblackburn/vue-brunch.git#dev --save-dev