Hero Discussion of the Day: Morphling (September 14, 2011)
Hero Discussion of the Day: Axe (September 15, 2011)
Hero Discussion of the Day: Nature's Prophet (September 16, 2011)
Hero Discussion of the Day: Night Stalker (September 17, 2011)
# UPD from 2018: | |
# This gist was written for pre-1.0 version of Elixir and won't work on post-1.0 versions. | |
# You probably consider using something else! | |
defmodule SecureRandom do | |
@moduledoc """ | |
Ruby-like SecureRandom module. | |
## Examples |
// | |
// Trie.swift | |
// SceneTest | |
// | |
// Created by Greg Titus on 6/7/14. | |
// Copyright (c) 2014 The Omni Group. All rights reserved. | |
// | |
// This is essentially the same data structure as OFTrie in OmniFoundation, except that the OmniFoundation version is mutable and ephemeral, | |
// and this version is immutable and persistent. Every time you add a string to the trie, it replaces all the nodes along the string's path |
// FILED: rdar://17240493 | |
// Type constraint ignored on function type parameter | |
// | |
protocol BoolT {} | |
class TrueT : BoolT {} | |
class FalseT : BoolT {} | |
protocol Nat { | |
typealias IsZero |
#!/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -i -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk | |
import Foundation | |
class JSON { | |
struct Path: Printable { | |
enum Element { | |
case Index(Int) | |
case Key(String) |
# ATTENTION: This is now supported in plug_cowboy as of 2.1.0: | |
# https://hexdocs.pm/plug_cowboy/Plug.Cowboy.Drainer.html | |
defmodule DrainStop do | |
@moduledoc """ | |
DrainStop Attempts to gracefully shutdown an endpoint when a normal shutdown | |
occurs. It first shuts down the acceptor, ensuring that no new requests can be | |
made. It then waits for all pending requests to complete. If the timeout | |
expires before this happens, it stops waiting, allowing the supervision tree | |
to continue its shutdown order. |
import subprocess | |
def looksLikeBeginning(doc,seg,adr): | |
if isinstance(seg.getNameAtAddress(adr), str): | |
label = seg.getNameAtAddress(adr) | |
pos = label.find("_T") | |
if pos != -1: | |
return label[pos:] | |
return None |