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
# Definition for singly-linked list. | |
# class ListNode: | |
# def __init__(self, x): | |
# self.val = x | |
# self.next = None | |
# https://leetcode.com/problems/linked-list-cycle/description/ | |
class Solution: | |
def hasCycle(self, head: Optional[ListNode]) -> bool: |
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
Kd77m5oUskHYSTiIBNw0pGHczswvQGTi |
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
/// An example that somewhat translates Twitter's use of Thrift within the | |
/// FlockDb database to Thrust, a Rust implementation of Thrift. | |
/// This should illustrate the rough API that Thrust exposes and how code generation | |
/// using the `thrust!` procedural macro works. | |
extern crate thrust; | |
use thrust::{Server, ThriftResult}; | |
use flockdb::thrift::{FlockDb}; |
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 serialize from 'stacks/serialize'; | |
import Team from 'stacks/model/team'; | |
let user = serialize('user') | |
// We want to expose the key `token` under the key `id`, replacing | |
// whatever `id` used to be. | |
.map('token', 'id') | |
// A promise mapping, allowing us to take a single | |
// key and returning a promise. The resolved value | |
// must be of the format: |
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
/Users/daniel/Projects/rust/nanomsg.rs/src/lib.rs:1:1: 1:1 error: internal compiler error: Type parameter out of range when substituting in region 'a (root type='amut Socket<'a>) (space=FnSpace, index=1) | |
/Users/daniel/Projects/rust/nanomsg.rs/src/lib.rs:1 #![crate_type = "lib"] | |
^ | |
note: the compiler unexpectedly panicked. this is a bug. | |
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html | |
note: run with `RUST_BACKTRACE=1` for a backtrace | |
task 'rustc' panicked at 'Box<Any>', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/libsyntax/diagnostic.rs:116 |
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
# Provide an interface for working with an offline cache | |
# that makes it easy to create an offline experience. | |
class Jobber.Cache | |
@extend Jobber.EmitterMixin | |
# An in-memory cache for simplistic case. This should be something on disk to ensure | |
# the persistence quality one needs for an offline experience. | |
# | |
# @property _cache Array<CacheItem> | |
@_cache: [] |
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
extern crate gossip; | |
use gossip::{Server}; | |
fn main() { | |
// Node A | |
spawn(proc() { | |
// Create a new node. | |
let mut server = Server::new(); |
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
#[phase(plugin)] | |
extern crate resource_macros; | |
extern crate resource; | |
use resource::Resource; | |
resource! { | |
table "users" | |
attr username: String (validate presence, email) | |
attr password: String (validate presence) |
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
trait Foo<M> { | |
fn bar<T>(&self, a: M<T>) -> M<T>; | |
} |
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
rustc --debuginfo=2 des.rs | |
error: internal compiler error: Type metadata for unique id '{&{&[]{struct 7edd98819e2e66bc/2157e}}}' is already in the TypeMap! | |
note: the compiler hit an unexpected failure path. this is a bug. | |
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html | |
note: run with `RUST_BACKTRACE=1` for a backtrace | |
task 'rustc' failed at 'Box<Any>', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/libsyntax/diagnostic.rs:162 |
NewerOlder