Skip to content

Instantly share code, notes, and snippets.

John Reeves jonnyreeves

Block or report user

Report or block jonnyreeves

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View pb_msg_setter.ts
export function fromObject<T extends jspb.Message, U>(c: new () => T, obj: U): T {
const instance = new c();
Object.keys(obj)
.forEach(key => {
const setterName = makeSetterFuncName(key);
(instance as any)[setterName] = (obj as any)[key];
});
return instance;
}
View wordpress google compute engine
- Setup Google Compute Account
- Create micro-f1 instance
- SSH into instance (Debian/Jessy)
- Install apt-get deps from https://github.com/eugeneware/docker-wordpress-nginx
- install fail2ban (https://www.digitalocean.com/community/tutorials/how-to-protect-an-nginx-server-with-fail2ban-on-ubuntu-14-04)
- create a wordpress rule in jails.local
```
[wordpress]
enabled = true
port = http,https
@jonnyreeves
jonnyreeves / counter.js
Created May 30, 2016
redux-middleware-counter.js
View counter.js
const Counter = props => {
const { count, dispatch } = props;
return (
<div>
<p>Counter value: {props.value}</p>
<button onClick={() => dispatch({ type: 'INC' })}>++</button>
<button onClick={() => dispatch({ type: 'DEC' })}>--</button>
</div>
);
}
@jonnyreeves
jonnyreeves / Dockerfile
Created Feb 10, 2016
Kibana4 Dockerfile
View Dockerfile
FROM java:8-jre
RUN \
useradd --home /home/node -m -U -s /bin/bash node && \
apt-get update && \
apt-get install -y --no-install-recommends git curl && \
rm -rf /var/lib/apt/lists/
USER node
@jonnyreeves
jonnyreeves / cookie_read_test.go
Created Feb 4, 2016
Testing Cookie Writes in Golang
View cookie_read_test.go
View gist:303e92de419336b0e568

This guide runs you through setting up a GMVault backup as a Scheduled Task on Windows complete with email notification on failure.

Prerequesit software

  1. Download and install gmvault for windows.
  2. Download BLAT, unzip and copy to %LOCALAPPDATA%/blat
  3. Download and install stunnel to %LOCALAPPDATA%/stunnel

GMVault

  1. Perform an initial sync for your account gmvault sync --db-dir=D:\backup\gmvault your@email.addy
@jonnyreeves
jonnyreeves / example.js
Last active Jul 2, 2018
Stubbing XHRs in QUnit with SinonJS Fake Server
View example.js
QUnit.module("my-module",
{
setup: function () {
// Configure Sinon's FakeServer instance. `autoRespond` ensures that any incoming requests
// will automatically be replied to, otherwise you *must* invoke `this.server.respond` to
// start processing.
this.server = sinon.fakeServer.create();
this.server.autoRespond = true;
// Tells the FakeServer's XHR request factory that we don't want to respond to every
View Message_Passing.js
// Register a message handler for "some message"
messageBus.addHandler("some_message", function (message, next) {
// do something with the data in an async fashion
$.get(message.url, function () {
if (response.code !== 200) {
// Transition into an error state, terminates processing.
next(new Error("bad http request!"));
}
else {
// Modify the state of the object and pass execution to the next handler
@jonnyreeves
jonnyreeves / gist:3169925
Created Jul 24, 2012
AS3 AutoMapper gist.
View gist:3169925
class PersonModel {
private var _firstName : String;
private var _lastName : String;
public function PersonModel(firstName : String, lastName : String) {
_firstName = firstName;
_lastName = lastName;
}
public function get firstName() : String {
View matches.as
package {
public function matches(source : *, ...values):void {
const len : uint = values.length;
// Walk through the supplied values and look for a match.
for (var i : uint = 0; i < len; i++) {
if (source === values[i]) {
return true;
}
}
You can’t perform that action at this time.