Skip to content

Instantly share code, notes, and snippets.

View joshthecoder's full-sized avatar

Joshua Roesslein joshthecoder

View GitHub Profile
Compiling chat-rs v0.1.0 (/mnt/c/Users/jroes/Development/chat-rs)
error[E0373]: closure may outlive the current function, but it borrows `out`, which is owned by the current function --> src/main.rs:6:34
|
6 | listen("127.0.0.1:8888", |out| |msg| out.send(msg)).unwrap()
| ^^^^^ --- `out` is borrowed here
| |
| may outlive borrowed value `out`
|
note: closure is returned here
--> src/main.rs:6:34
@joshthecoder
joshthecoder / docker-compose.yml
Last active July 15, 2018 06:24
MC Server - Sponge Survival
version: '3'
services:
minecraft:
image: itzg/minecraft-server
ports:
- "25565:25565"
environment:
EULA: 'TRUE'
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to make opened Markdown files always be soft wrapped:
#
# path = require 'path'
#
class Button extends React.Component {
constructor(props) {
super(props);
this.state = {clickCount: 0};
}
_onClick(e) {
e.preventDefault();
this.setState({clickCount: this.state.clickCount + 1});
}
@joshthecoder
joshthecoder / gist:87bb9ab99667dce02bbe
Last active August 29, 2015 14:11
Flux stores and components decoupled w/ immutable JS.
var Actions = Flux.createActions(
INCR_COUNT, DECR_COUNT
);
var CountStore = Flux.createStore(
INCR_COUNT: (_, state) => state.update('count', count => count + 1)
DECR_COUNT: (_, state) => state.update('count', count => count - 1)
);
var App = React.createClass({
Traceback (most recent call last):
File "/Users/jroesslein/Development/Libraries/Python/tweepy/tweepy/tests/test_api.py", line 204, in testupdateprofilebannerimage
self.api.update_profile_banner('examples/banner.png')
File "/Users/jroesslein/Development/Libraries/Python/tweepy/tweepy/tweepy/api.py", line 377, in update_profile_banner
)(self, post_data=post_data, headers=headers)
File "/Users/jroesslein/Development/Libraries/Python/tweepy/tweepy/tweepy/binder.py", line 194, in _call
return method.execute()
File "/Users/jroesslein/Development/Libraries/Python/tweepy/tweepy/tweepy/binder.py", line 151, in execute
resp = conn.getresponse()
File "/Users/jroesslein/Development/Libraries/Python/tweepy/tweepy/.env/lib/python2.7/site-packages/httreplay/stubs/base.py", line 142, in getresponse
@joshthecoder
joshthecoder / echo_server.t
Last active December 18, 2015 20:59
A TCP echo server written in Terra using libuv
uv = terralib.includecstring([[
#include <uv.h>
// Keep uv_write_s alive by tricking clang with a dummy function.
void __ignore(uv_write_t*);
]])
terralib.linklibrary("libuv.dylib")
stdlib = terralib.includec("stdlib.h")
stdio = terralib.includec("stdio.h")
parse_messages:
Parsed 100000 messages in 37 ms
2702703 messages/s
var spawn = require('child_process').spawn;
function Log(level, pid, message) {
this.level = level;
this.pid = pid;
this.message = message;
}
process.stdout.write(['time', 'mem_freed', 'allocated', 'size'].join('\t') + '\n');
@joshthecoder
joshthecoder / gettimeofday.lua
Created June 27, 2012 06:18
gettimeofday() via LuaJIT + FFI
local ffi = require("ffi")
ffi.cdef[[
typedef long time_t;
typedef struct timeval {
time_t tv_sec;
time_t tv_usec;
} timeval;
int gettimeofday(struct timeval* t, void* tzp);