Skip to content

Instantly share code, notes, and snippets.

View alanf's full-sized avatar

Alan Fineberg alanf

View GitHub Profile
@alanf
alanf / .vimrc
Created June 17, 2015 18:00
vimrc
set nocompatible
filetype off
" filetype indent plugin on
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'surround.vim'
Plugin 'fatih/vim-go'
// Magic! Just specify the type and the function on the right hand side will magically get you the correct view from the xib.
let noteView: AlterationReceiptNoteView = ViewUtil.viewFromNib(.JPAlterations)
public enum XIBFileName : String {
case Receipt = "ReceiptViewController"
case USAlterations = "AlterationReceiptUSView"
case JPAlterations = "AlterationReceiptsJapanView"
}
public class func viewFromNib<T>(nibName: XIBFileName) -> T {
@alanf
alanf / ViewController.swift
Created August 2, 2015 18:14
Simple Quantizer
//
// ViewController.swift
// quant
//
import Foundation
import UIKit
@objc class ViewController : UIViewController {
//
// CCParticleSystemAnimation.m
// TapZoo
//
// Created by alan fineberg on 4/20/11.
// Copyright 2011 Streetview Labs. All rights reserved.
//
#import "CCParticleSystemAnimation.h"
@implementation CCParticleSystemAnimation
@alanf
alanf / experiment_simulation.py
Created April 24, 2011 00:41
use to test concurrent a/b tests
"""
Run a simulation of multiple concurrent A/B tests acting on a number of users.
Reports on the expected vs. the actual results, and raises a warning if the actual results would lead to the wrong conclusion.
Values of interest:
-- number_of_users : active users who may be part of an A/B test
-- number_of_concurrent_experiments: how many random concurrent experiments to generate
-- values in construct_random_experiments(): define a range and distribution for utility and B cohort percentage for each experiment
"""
import random
- (void)reloadInterfaceFromTextField;
{
self.keyboardAttributes = [(id)self.textField performSelectorIfResponds:SDProtocolSelector(SQCustomKeyboardTextField, keyboardAttributes)] ?: [self defaultKeyboardAttributes];
NSString *returnKeyTitle = [self _returnKeyTitle];
[self.currentContentView.returnButton setTitle:returnKeyTitle forState:UIControlStateNormal];
if (returnKeyTitle.length) {
// Sometimes the title will be cleared for visual effect, in which case we won't want to delete the accessibility hint from the xib.
self.currentContentView.returnButton.accessibilityLabel = returnKeyTitle;
}
cd ${SRCROOT}
rm compile_commands.json
/Users/af/Development/xctool/xctool.sh -scheme lintapp -project lintapp.xcodeproj -reporter json-compilation-database:compile_commands.json clean
/Users/af/Development/xctool/xctool.sh -scheme lintapp -project lintapp.xcodeproj -reporter json-compilation-database:compile_commands.json build
oclint-json-compilation-database | sed 's/\(.*\.\m\{1,2\}:[0-9]*:[0-9]*:\)/\1 warning:/'
[
{
"command" : "\/Applications\/Xcode.app\/Contents\/Developer\/Toolchains\/XcodeDefault.xctoolchain\/usr\/bin\/clang -x objective-c -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -fmodules -fmodules-cache-path=\/Users\/af\/Library\/Developer\/Xcode\/DerivedData\/ModuleCache -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-receiver-is-weak -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-sel
[
{
"directory": "/Users/af/Development/lintapp",
"command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -fmodules -fmodules-cache-path=/Users/af/Library/Developer/Xcode/DerivedData/ModuleCache -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-receiver-is-weak -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -
cd ${SRCROOT}
rm compile_commands.json
/Users/af/Development/xctool/xctool.sh -scheme lintapp -project lintapp.xcodeproj clean
/Users/af/Development/xctool/xctool.sh -scheme lintapp -project lintapp.xcodeproj -reporter json-compilation-database:compile_commands.json build
oclint-json-compilation-database | sed 's/\(.*\.\m\{1,2\}:[0-9]*:[0-9]*:\)/\1 warning:/'