Skip to content

Instantly share code, notes, and snippets.

View daniel-beard's full-sized avatar

Daniel Beard daniel-beard

View GitHub Profile
@daniel-beard
daniel-beard / gist:4516490
Created January 12, 2013 06:56
Background / Foreground async dispatches ios objective-c
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//background processing goes here
dispatch_async(dispatch_get_main_queue(), ^{
//update UI here
});
});
#include "oclint/AbstractASTMatcherRule.h"
#include "oclint/RuleSet.h"
using namespace std;
using namespace clang;
using namespace clang::ast_matchers;
using namespace oclint;
class AllIfStatementsRule : public AbstractASTMatcherRule
{
SEL selector = NSSelectorFromString(@"setAuthorizationStatus:forBundleIdentifier:");
NSMethodSignature *methodSignature = [CLLocationManager methodSignatureForSelector:selector];
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:methodSignature];
invocation.selector = selector;
CLAuthorizationStatus status = kCLAuthorizationStatusAuthorizedAlways;
NSString *identifier = @"com.test.testapp";
[invocation setArgument:&status atIndex:2];
[invocation setArgument:&identifier atIndex:3];
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
#
#!/usr/bin/env ruby
require 'optparse'
require 'pathname'
require 'json'
require 'git_diff_parser'
# This script takes an input .json file in the standard lint format
# and culls violations that do not occur on changed lines for a given diff file.
# Parse command line options.
@daniel-beard
daniel-beard / brancher.sh
Last active November 17, 2016 18:47
Interactively delete git remote branches
#!/bin/bash
# The MIT License (MIT)
# Copyright (c) 2016 Daniel Beard
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT O
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendAction.h"
#include "clang/Tooling/CommonOptionsParser.h"
#include "llvm/Support/CommandLine.h"
#include "clang/Tooling/Tooling.h"
#include <iostream>
using namespace clang::tooling;
#!/usr/bin/env ruby
require 'optparse'
require 'pathname'
require 'json'
# http://danielbeard.io/2016/08/17/swift-file-compile-times.html
# Helper function to parse filename
def parse(input)
result = ""
# Uncrustify 0.64_d
align_oc_msg_colon_span = 1
# option(s) with 'not default' value: 1
#
# -=====-
# Line Tag Parent Columns Br/Lvl/pp Flag Nl Text
# 1> NEWLINE[ NONE][ 1/ 1/ 1/ 0][0/0/0][ 0][1-0]
# 2> OC_SCOPE[ OC_MSG_DECL][ 1/ 1/ 2/ 0][0/0/0][ 100060000][0-0] -
# 2> PAREN_OPEN[ OC_MSG_DECL][ 3/ 3/ 4/ 1][0/0/0][2100040000][0-0] (
# 2> TYPE[ NONE][ 4/ 4/ 8/ 0][0/1/0][2000040000][0-0] void

Keybase proof

I hereby claim:

  • I am daniel-beard on github.
  • I am danielbeard (https://keybase.io/danielbeard) on keybase.
  • I have a public key ASCfzz_hkm_UsgUzOhyRsT2u77fvk91Z3xCDzbpzsakTNAo

To claim this, I am signing this object: