Skip to content

Instantly share code, notes, and snippets.

View daboross's full-sized avatar

Dabo daboross

View GitHub Profile
"use strict";
// Transcrypt'ed from Python, 2017-01-30 13:07:39
function main () {
var __symbols__ = ['__py3.5__', '__esv6__'];
var __all__ = {};
var __world__ = __all__;
// Nested object creator, part of the nesting may already exist and have attributes
var __nest__ = function (headObject, tailNames, value) {
// In some cases this will be a global object, e.g. 'window'
@daboross
daboross / output.txt
Created January 8, 2017 08:41
Strange behavior with _.each
$ node test.js
lodash version: 4.17.4
_.each: false
_.each w/ brackets: true
built-in forEach: true
@daboross
daboross / prototypes.js
Created December 29, 2016 08:21
Screeps.com Creep.prototype.moveTo replacement supporting completely custom CostMatrices
/**
* Utility function turning a direction constant into a dx/dy difference.
*/
const directionToDxDy = function (dir) {
switch (dir) {
case TOP:
return [0, -1];
case TOP_RIGHT:
return [1, -1];
case RIGHT:
spawning...
stderr: forty_two!
stderr: input: "Hi!\n"
stderr: sleeping...
stderr: forty_two! done.
output: [47, 42, 32, 102, 111, 114, 116, 121, 95, 116, 119, 111, 58, 32, 42, 47, 32, 52, 50, 10]
spawning...
stderr: forty_two!
stderr: input: "Hi!\n"
stderr: sleeping...
/* forty_two: */ 42
stderr: forty_two! done.
output: []
#![feature(plugin)]
#![plugin(regex_macros)]
extern crate regex;
fn main() {
let re = regex!(r"(as|call|case|const|declare|downto|else|end|family|for|function|global|if|import|local|override|polyphonic|property|select|step|taskfunc|to|ui_button|ui_file_selector|ui_knob|ui_label|ui_level_meter|ui_menu|ui_slider|ui_switch|ui_table|ui_text_edit|ui_value_edit|ui_waveform|while)");
let text =
r##"if (1 = 0) move_control ($pea55, %mb43r[0] + $ow1vl, %sjlia[0] + $d3m3y) set_knob_defval($pea55, %g5lly[0]) set_knob_unit ($pea55, %nok5l[0]) set_text ($pea55, end if $pea55 := _get_engine_par(%tyzcu[0], -1, $f2x2k, 0) $darki := $hrleo
if (1 = 0) move_control ($pea55, %mb43r[0] + $ow1vl, %sjlia[0] + $d3m3y) set_knob_defval($pea55, %g5lly[0]) set_knob_unit ($pea55, %nok5l[0]) set_text ($pea55, end if $pea55 := _get_engine_par(%tyzcu[0], -1, $f2x2k, 0) $darki := $hrleo
import socket
from cloudbot import hook
@hook.command()
def dns(text):
"""<domain> - resolves the IP of <domain>"""
try:
socket.setdefaulttimeout(5)
ip = None
src/filewatch.rs:47:23: 131:10 warning: label name `'thread_loop` shadows a label name that is already in scope
src/filewatch.rs:47 'thread_loop: loop {
src/filewatch.rs:48 let events = match watch.wait_for_events() {
src/filewatch.rs:49 Ok(v) => v,
src/filewatch.rs:50 Err(e) => {
src/filewatch.rs:51 if e.kind() == io::ErrorKind::Interrupted {
src/filewatch.rs:52 continue 'thread_loop;
...
src/filewatch.rs:47:23: 131:10 note: shadowed label `'thread_loop` declared here
src/filewatch.rs:47 'thread_loop: loop {
error: linking with `cc` failed: exit code: 1
note: "cc" "-Wl,--as-needed" "-m64" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/daboross/Projects/Rust/zaldinar/zaldinar-runtime/target/debug/lib-079bb44de20f8d48" "/home/daboross/Projects/Rust/zaldinar/zaldinar-runtime/target/debug/lib-079bb44de20f8d48.o" "-Wl,--whole-archive" "-lmorestack" "-Wl,--no-whole-archive" "-Wl,--gc-sections" "-pie" "-nodefaultlibs" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libtest-4e7c5e5c.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libterm-4e7c5e5c.rlib" "/home/daboross/Projects/Rust/zaldinar/zaldinar-runtime/target/debug/libzaldinar-342042a5d485c65c.rlib" "/home/daboross/Projects/Rust/zaldinar/zaldinar-runtime/target/debug/deps/libtime-15ec407cfcd2d643.rlib" "/home/daboross/Projects/Rust/zaldinar/zaldinar-runtime/target/debug/deps/libinotify-4cf6b83abc83e97a.rlib" "/home/daboross/Projects/Rust/zaldinar/zaldinar-runtime/target/debug/deps/libgenerated_plugins_crate-0670b7fe49f50e68.rl
[
{
"name": "Angel cake",
"file": "Angel cake slice.jpg",
"location": "United Kingdom",
"info": "Sponge cake, cream"
},
{
"name": "Angel food cake",
"file": "AngelFoodCake.jpg",