Skip to content

Instantly share code, notes, and snippets.

Nathan Wilson iancormac84

View GitHub Profile
@iancormac84
iancormac84 / error_response.json
Last active Aug 13, 2019
Gist displaying GraphQL, JSON, and Rust code snippets for help question.
View error_response.json
{
"errors":[
{
"message":"Variable \"$input\" expected value of type \"Owner\" which cannot be used as an input type.",
"locations":[
{
"line":1,
"column":19
}
]
@iancormac84
iancormac84 / Cargo.toml
Created Nov 25, 2018
Gist showing attempt to use Ole Automation to invoke OLE objects
View Cargo.toml
[package]
name = "accessole"
version = "0.1.0"
authors = ["iancormac84 <wilnathan@gmail.com>"]
edition = "2018"
[dependencies]
failure = "*"
oaidl = { git = "https://github.com/ZerothLaw/oaidl-safe", branch = "develop" }
winapi = "0.3.6"
@iancormac84
iancormac84 / winapi-conversion.rs
Last active May 23, 2019
How to work with WINAPI string types.
View winapi-conversion.rs
pub fn to_u16s<S: AsRef<OsStr>>(s: S) -> io::Result<Vec<u16>> {
fn inner(s: &OsStr) -> io::Result<Vec<u16>> {
let mut maybe_result: Vec<u16> = s.encode_wide().collect();
if maybe_result.iter().any(|&u| u == 0) {
return Err(io::Error::new(
io::ErrorKind::InvalidInput,
"strings passed to WinAPI cannot contain NULs",
)
.into());
}
@iancormac84
iancormac84 / alchemy.rs
Last active Apr 19, 2018
Example of Chemical Element Modelling
View alchemy.rs
pub trait UniqueProperties {
const ATOMIC_NUMBER: u32;
const SYMBOL: &'static str;
const PERIOD: u8;
}
pub struct Hydrogen;
impl UniqueProperties for Hydrogen {
const ATOMIC_NUMBER: u32 = 1;
View genesis_public_key
04d5937dd8be48901e267084394019dffdbf0b5c7d8297f6ba0be733f16fbc2a91f1ad97b973f00421be37c4d48085893463552f14f7b2605f05138d2887bc640d
@iancormac84
iancormac84 / paint.rs
Created Sep 26, 2015
Example of creating a window with a PaintDc context and drawing to it using a brush. Probably incorrect.
View paint.rs
// Copyright 2015 The Rust-Windows Project Developers. See the
// COPYRIGHT file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(libc)]
You can’t perform that action at this time.