- Read every row in the table
- No reading of index. Reading from indexes is also expensive.
import Swift | |
import Cocoa | |
// Properties you need as an enum - problem of key value coding is it allows you to type *anything*, typos compile fine. | |
enum SyncObjectPropertyName { | |
case Archived | |
case Title | |
} | |
// Protocol shared both for local and server |
func arc4random_uniform<T: SignedIntegerType>(max: T) -> T { | |
let max32: Int32 = numericCast(max) | |
return T(Int64(arc4random_uniform(UInt32(max32)))) | |
} | |
func arc4random_uniform<T: UnsignedIntegerType>(max: T) -> T { | |
let max32: UInt32 = numericCast(max) | |
return T(UInt64(arc4random_uniform(max32))) | |
} |
#!/usr/bin/env python | |
# How to post code snippets (especially Python) into comment systems | |
# that don't preserve whitespace. | |
# Save this as a script called 'convert_leading_spaces_to_nonbreaking' | |
# in your PATH and do "chmod +x" on it. | |
# | |
# In Linux, you can then use it by installing xsel and doing: | |
# |
// nodewar.com library function… | |
// o.lib.targeting.simpleTarget(ship, pos) | |
// | |
// mostly deobfuscated/deminified | |
// | |
function simpleTarget(ship, pos) { | |
var i, r, h, | |
torque = 0, | |
thrust = 0, | |
dir = o.lib.targeting.dir(ship, pos); |
#!/bin/bash | |
export FOO=100 | |
python - <<END | |
import os | |
print "foo:", os.environ['FOO'] | |
END |
""" | |
jQuery templates use constructs like: | |
{{if condition}} print something{{/if}} | |
This, of course, completely screws up Django templates, | |
because Django thinks {{ and }} mean something. | |
Wrap {% verbatim %} and {% endverbatim %} around those | |
blocks of jQuery templates and this will try its best |
SELECT shared_blks_hit + shared_blks_read + shared_blks_dirtied + shared_blks_written + local_blks_hit + local_blks_read + local_blks_dirtied + local_blks_written + temp_blks_read + temp_blks_written as total_blocks | |
,(total_exec_time + total_plan_time)::int as total_time | |
,calls | |
,query | |
FROM pg_stat_statements | |
ORDER BY 1 DESC | |
LIMIT 50; |
extension NSTimer { | |
/** | |
Creates and schedules a one-time `NSTimer` instance. | |
- Parameters: | |
- delay: The delay before execution. | |
- handler: A closure to execute after `delay`. | |
- Returns: The newly-created `NSTimer` instance. | |
*/ |
I am trying to determine if it is possible to build a Swift dynamic library which is itself composed of one of more private modules, without needing to expose to that fact to outside users. My hope was that I could build the private module as a static library, which would be linked into the primary (dynamic) library. The dylib
could then be deployed together with its swiftmodule
and swiftdoc
and be imported, with the private module and its symbols not being exposed at all.
Unfortunately, what I'm currently observing seems to indicate that the private module's swiftmodule
also has to be available for the primary library to be successfully imported.
This can be reproduced as follows. I have the following directory structure:
./Greeter/Logger/Logger.swift
:
public func log(_ message: String) {