See
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var list = [8,1,55,34,13,8,5,0,1,3,2,21] | |
func quicksort1(list:[Int]) -> [Int] { | |
if list.count == 0 { | |
return [] | |
} | |
let pivotValue = list[0] | |
let smaller = filter(list, { $0 < pivotValue }) | |
smaller |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// WPTextAttachment.h | |
// ReadArticle | |
// | |
// Created by Moore, Stuart on 12/27/13. | |
// Copyright (c) 2013 The Washington Post. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# check for where the latest version of IDEA is installed | |
IDEA=`ls -1d /Applications/IntelliJ\ * | tail -n1` | |
wd=`pwd` | |
# Setup your working directory. Edit 'work' to your working directory. | |
working_dir=`ls -1d ~/work/$1 | head -n1` | |
# were we given a directory? | |
if [ -d "$1" ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.*; | |
import android.database.Cursor; | |
import android.database.sqlite.SQLiteDatabase; | |
import android.database.sqlite.SQLiteOpenHelper; | |
import android.database.sqlite.SQLiteQueryBuilder; | |
import android.net.Uri; | |
import android.provider.BaseColumns; | |
import android.text.TextUtils; | |
public abstract class BetterContentProvider extends ContentProvider { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
extension Array { | |
func contains<U: Equatable>(object:U) -> Bool { | |
return (self.indexOf(object) != nil); | |
} | |
func indexOf<U: Equatable>(object: U) -> Int? { | |
for (idx, objectToCompare) in self.enumerate() { | |
if let to = objectToCompare as? U { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
struct Regex { | |
var pattern: String { | |
didSet { | |
updateRegex() | |
} | |
} | |
var expressionOptions: NSRegularExpressionOptions { | |
didSet { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# code based on https://en.wikipedia.org/wiki/Mahalanobis_distance | |
set.seed(1) | |
# define a point D | |
x <- matrix(rmnorm(1, c(2,2), matrix(c(1,0.1,0.1,1), 2, 2)), 1, 2) # vector of locations in 2 dimensional space | |
x <- t(x) # transpose | |
# Define a multivariate normal distribution for comparison | |
mu <- matrix(c(0, 0), 1, 2) # vector of bivariate means |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ContentView.swift | |
// SwiftUI Chat | |
// | |
// Created by Nick Halavins on 6/7/19. Updated 10/11/19 | |
// Copyright © 2019 AntiLand. All rights reserved. | |
// | |
import SwiftUI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. Disable centered look & animation: | |
// 1.1. Subclass NSSearchFieldCell and add: | |
- (BOOL)isCenteredLook | |
{ | |
return NO; | |
} | |
// 1.2. Subclass NSSearchField and add: |
OlderNewer