Skip to content

Instantly share code, notes, and snippets.

View killerswan's full-sized avatar

Kevin Cantú killerswan

View GitHub Profile
@killerswan
killerswan / gist:337f9f84a2e788a3c2a5
Created July 26, 2014 15:19
Why should an uppercase variable (defined by macro expansion) cause an out-of-bounds ICE? Although this was on rustc 0.11.0-pre (b47f2226a25654c5b781d27a91f2fa5274b3a347 2014-06-28 14:31:37 +0000), rather than current master rustc.
ovid $ git ll -1 --oneline
* 220b83a (HEAD, master) now naming the column [singular]
ovid $
ovid $ git diff
diff --git a/CSVSample.rs b/CSVSample.rs
index 9e57175..4e279c4 100644
--- a/CSVSample.rs
+++ b/CSVSample.rs
@@ -3,7 +3,6 @@
@killerswan
killerswan / gist:87b9482eca5d09c82619
Last active August 29, 2015 14:04
Why is this extra let binding necessary? See line 13 below. If you remove it, there's an error. (And the source code: https://github.com/killerswan/ovid/blob/b197f03f4b670e25c420751ec3358ead2d42059a/CSVProvider.rs#L139)
ovid $ git ll -1 --oneline
* b197f03 (HEAD, master) cleanup
ovid $
ovid $ git diff
diff --git a/CSVProvider.rs b/CSVProvider.rs
index 2b24cd2..2181c0b 100644
--- a/CSVProvider.rs
+++ b/CSVProvider.rs
@@ -205,8 +205,7 @@ fn provide_csv_given_labels(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> Bo
@killerswan
killerswan / gist:b4e6d5840c46942bd3be
Created June 30, 2014 09:28
From ovid 84cec0e, trying to substitute $name instead of hard-coding it...
ovid $ git diff
diff --git a/CSVProvider.rs b/CSVProvider.rs
index ee8c7ba..b75d0ba 100644
--- a/CSVProvider.rs
+++ b/CSVProvider.rs
@@ -158,7 +158,7 @@ fn provide_csv_given_labels(cx: &mut ExtCtxt, sp: Span, tts: &[TokenT
fn define_my_csv(cx0: &mut ExtCtxt) -> Option<Gc<syntax::ast::Item>> {
let item1: Option<Gc<syntax::ast::Item>> = quote_item!(cx0,
- pub struct MyCSV {
@killerswan
killerswan / gist:3552d816fb18c6e0b32a
Last active August 29, 2015 14:02
error: I don't know how to expand a syntax expression into _multiple_ statements: https://github.com/killerswan/ovid/tree/1515763bcb5335f5fc5924d09a8b1c7e3ad2c3f9
$ ./build.sh
CSVProvider.rs:145:23: 158:7 error: mismatched types: expected `@syntax::ast::Pat` but found `@syntax::codemap::Spanned<syntax::ast::Stmt_>` (expected struct syntax::ast::Pat but found struct syntax::codemap::Spanned)
CSVProvider.rs:145 return MacPat::new(quote_stmt!(cx, {
CSVProvider.rs:146 struct MyCSV {
CSVProvider.rs:147 data: Vec<(String)>,
CSVProvider.rs:148 }
CSVProvider.rs:149
CSVProvider.rs:150 impl MyCSV {
...
error: aborting due to previous error
@killerswan
killerswan / overloaded_functions.rs
Created June 11, 2014 17:26
Overloading Rust functions on tuples by abusing traits :D
enum AaBbEnum {
Aa,
Bb,
}
trait AaBb {
fn get_type(&self) -> AaBbEnum;
fn get_aa(self) -> (int, f64) { fail!(); }
fn get_bb(self) -> (f64) { fail!(); }
}
java -jar slave.jar -jnlpUrl https://wombat/computer/build0/slave-agent.jnlp
Exception in thread "main" java.io.IOException: Failed to validate a server certificate. If you are using a self-signed certificate, you can use the -noCertificateCheck option to bypass this check.
at hudson.remoting.Launcher.parseJnlpArguments(Launcher.java:322)
at hudson.remoting.Launcher.run(Launcher.java:218)
at hudson.remoting.Launcher.main(Launcher.java:192)
Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.ssl.Alerts.getSSLException(Unknown Source)
at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source)
at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
@killerswan
killerswan / NuGet-selenium.md
Last active January 2, 2016 04:49
Node.JS <--> Selnium
@killerswan
killerswan / gist:7983652
Created December 16, 2013 07:53
warning at compile and nonsensical error at runtime when using librustc
meow $ make build_testloop
rustc -o ./bin/testloop --bin -Z debug-info -Z extra-debug-info --opt-level=3 src/testloop.rs
warning: no debug symbols in executable (-arch x86_64)
meow $ make run_loop
./bin/testloop ./src/demo.rs --test
<<<< building tests >>>>
error: multiple input filenames provided
@killerswan
killerswan / gist:7959007
Created December 14, 2013 13:15
pattern confusion
fn is_file(path: &str) -> bool {
let p = Path::new(path);
match io::result(|| std::io::fs::stat(&p)) {
Ok(stat) => {
match stat.kind {
TypeFile => { return true; }
_ => { return false; }
}
}
Err(e) => { return false; }
@killerswan
killerswan / testloop-rs.rs
Last active December 31, 2015 08:09
not UTF-8 encoded?
$ ./bin/testloop-rs
""
"error: bin/testloop-rs is not UTF-8 encoded\ntask 'rustc' failed at 'explicit failure', /Users/kevin/code/rust/src/libsyntax/diagnostic.rs:102\ntask '<main>' failed at 'explicit failure', /Users/kevin/code/rust/src/librustc/lib.rs:398\n"
ExitStatus(101)
task '<main>' failed at 'Unhandled condition: io_error: io::IoError{kind: OtherIoError, desc: "no such file or directory", detail: None}', /Users/kevin/code/rust/src/libstd/condition.rs:131