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
let (ref cfg, ref appCfg) = if nix { | |
( Path::new ( "~/.Sync.conf" ) , | |
Path::new ( "~/.Mirana.conf" ) | |
) | |
} else { | |
let prefix = getenv("HOME").unwrap_or(~""); | |
( Path::new ( prefix + "~/.Sync.conf" ), | |
Path::new ( prefix + "~/.Mirana.conf" ) | |
) | |
}; |
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
use std::str::*; | |
use std::hashmap::*; | |
trait CloneParser<T> { | |
fn clone_as_parser(&self) -> ~Parser<T>; | |
} | |
impl<T, U: Clone> CloneParser<T> for U { | |
fn clone_as(&self) -> ~Parser<T> { | |
~self.clone() as ~Parser<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
struct Foo(uint); | |
fn main() { | |
enum Bar { Baz(Foo) }; | |
let x = Baz(Foo(4)); | |
fn foo(_bar: uint) -> Foo { Foo(3) } | |
match x { | |
Baz(foo(x)) => println!("{:?}", x) | |
}; |
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
// | |
// btree.rs | |
// Nif Ward | |
// 10/24/13 | |
// | |
// starting implementation of a btree for rust | |
// inspired by github user davidhalperin's gist | |
//What's in a BTree? |
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
// XXX should be standard (and named clone, after Java?) | |
Object.prototype.copy = function () { | |
let o = {} | |
for (let i in this) | |
o[i] = this[i] | |
return o | |
} | |
// Containment testing for arrays and strings that should be coherent with their iterator. | |
Array.prototype.contains = String.prototype.contains = function (e) { |
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
var flatten = x => x.reduce((a, b) => a.concat(b)); | |
function transform(x) { | |
if(typeof x === 'string') | |
return [x]; | |
var {color, italic, translate, using, text} = x; | |
if(color) | |
return [['c', color, ...transform({italic, translate, using, text})]]; | |
if(italic) | |
return [['i', ...transform({translate, using, text})]]; | |
if(translate) |
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
'use strict'; | |
$.Math = {}; | |
global.$M = $.Math; | |
// Vector implementation - general and slow. Shouldn't use, except for matrixes. | |
$M.Vector = function Vector(elements) { | |
if(!(this instanceof $M.Vector)) | |
return new $M.Vector(elements); | |
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
function A() { | |
this.type = 'a' | |
} | |
module.exports = A; | |
var B = require('./b.js'); | |
A.prototype.delete = function deleteA(callback) { | |
var self = this; | |
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
Imports { | |
Import KERNEL32.dll_GlobalGetAtomNameA(ATOM,LPSTR,INT)@0x455080 | |
Import KERNEL32.dll_GlobalDeleteAtom(ATOM)@0x455084 | |
Import KERNEL32.dll_lstrlenA(LPCSTR)@0x455088 | |
Import KERNEL32.dll_lstrcpyA(LPSTR,LPCSTR)@0x45508c | |
Import KERNEL32.dll_GetProfileStringA(LPCSTR,LPCSTR,LPCSTR,LPSTR,UINT)@0x455090 | |
Import KERNEL32.dll_GetModuleHandleA(LPCSTR)@0x455094 | |
Import KERNEL32.dll_LocalAlloc(UINT,SIZE_T)@0x455098 | |
Import KERNEL32.dll_GlobalAddAtomA(LPCSTR)@0x45509c | |
Import KERNEL32.dll_LocalFree(HLOCAL)@0x4550a0 |
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
/// <summary> | |
/// Prompt the user to take a photograph to scan for a barcode. | |
/// </summary> | |
/// <param name="callBack">Method to invoke with the scan results.</param> | |
public void ScanCode(Action<IBarcodeResult> callBack) { | |
WP7BarcodeManager.ScanBarcode(ProcessBarcode); | |
_callBack = callBack; | |
} | |
/// <summary> |