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
// MyViewTickler.h | |
#import <Cocoa/Cocoa.h> | |
@interface MyViewTickler : NSObject | |
{ | |
} | |
+ (id)sharedInstance; |
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
<html> | |
<head> | |
<meta http-equiv=Content-Type content="text/html; charset=macintosh"> | |
<meta name=ProgId content=Excel.Sheet> | |
<meta name=Generator content="Microsoft Excel 14"> | |
<link rel=File-List href="gap-stores-autism-discount_files/filelist.xml"> | |
<style> | |
<!--table | |
{mso-displayed-decimal-separator:"\."; |
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
// | |
// NSApplication+MarkdownCredits.h | |
// ALUtilities | |
// | |
// Copyright (c) 2013 Andy Lee | |
// | |
// 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 |
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
// | |
// RVNReceiptValidation.m | |
// | |
// Created by Satoshi Numata on 12/06/30. | |
// Copyright (c) 2012 Sazameki and Satoshi Numata, Ph.D. All rights reserved. | |
// | |
// This sample shows how to write the Mac App Store receipt validation code. | |
// Replace kRVNBundleID and kRVNBundleVersion with your own ones. | |
// | |
// This sample is provided because the coding sample found in "Validating Mac App Store Receipts" |
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
func ==(lhs: Node, rhs: Node) -> Bool { | |
return lhs === rhs | |
} | |
class Node: Equatable { | |
var value: String | |
var children: [Node] = [] | |
init(_ value: String) { | |
self.value = value |
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
#!/usr/bin/python | |
""" | |
https://www.hackerrank.com/challenges/cut-the-tree | |
""" | |
class Node(object): | |
def __init__(self, weight): | |
self.weight = weight | |
self.adjacent_nodes = [] |
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 | |
// Expects i and j to be 1-based row and column indexes, respectively. | |
func f(_ i: Int, _ j: Int) -> Int { | |
return ((i+j-1) * (i+j))/2 - (((i+j-1) & 1 == 0) ? i : j) + 1 | |
} | |
// Test: use f() to generate matrix and visually inspect it | |
// to see that the numbers are correct. | |
for i in 1...10 { |
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
# Expects i and j to be 1-based row and column indexes, respectively. | |
def f(i, j): | |
return (((i+j-1) * (i+j))/2) - (i if ((i+j-1) & 1 == 0) else j) + 1 | |
# Test: use f() to generate matrix and visually inspect it | |
# to see that the numbers are correct. | |
for i in range(10): | |
line = "" | |
for j in range(10): | |
line += "%5d" % (f(i+1, j+1)) |
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/Foundation.h> | |
// Two things to know about NSSet: | |
// | |
// - NSSet assumes its elements will never mutate. It breaks if they do. | |
// - Unlike NSDictionary, NSSet does not copy its unique objects. It stores | |
// the original pointers. | |
// | |
// Bottom line: DO NOT MUTATE OBJECTS THAT ARE ELEMENTS OF AN NSSET. The | |
// code below demonstrates the kind of bugs you could run into if you |
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 | |
let commandURL = URL(fileURLWithPath: CommandLine.arguments[0]) | |
let inputFileURL = commandURL.deletingLastPathComponent().appendingPathComponent("input.txt") | |
let inputText = try! String(contentsOf: inputFileURL, encoding: .utf8).trimmingCharacters(in: .whitespacesAndNewlines) | |
let inputLines = inputText.split(separator: "\n") | |
// I will call the input coordinates "pins", as in pins on a map (is clearer to my mind than "coordinates"). | |
// I will call the index of a pin in allPins its "pinID". |
OlderNewer