Skip to content

Instantly share code, notes, and snippets.

@johnnyt
johnnyt / keybase.md
Created July 10, 2016 02:37
Keybase proof

Keybase proof

I hereby claim:

  • I am johnnyt on github.
  • I am johnnyt (https://keybase.io/johnnyt) on keybase.
  • I have a public key ASC_wuMrm5gUcRYGCTjKUwWDiuX1PbqKqkJQkvYEZ3aWcAo

To claim this, I am signing this object:

@johnnyt
johnnyt / nsq_example.rb
Last active October 31, 2019 19:13
Ruby NSQ Avro example
require "avro"
require "nsq"
SCHEMA = <<-JSON
{ "type": "record",
"name": "User",
"fields" : [
{"name": "username", "type": "string"},
{"name": "age", "type": "int"},
{"name": "verified", "type": "boolean", "default": "false"}
@johnnyt
johnnyt / generator.rb
Created June 24, 2015 16:47
URUG 2015-06-23 Trigram Kata - check out: github.com/urug/trigram_kata
module Generator
def self.generate(trigram, prompt, size)
content = prompt.split(' ')
while content.length < size
new_word = trigram.get content[-2..-1].join(' ')
content << new_word
end
content.join(' ')
@johnnyt
johnnyt / maglev_proposal.md
Last active January 2, 2016 12:29
Talk proposal for MountainWest Ruby Conf

MagLev - From Download To Deploy

MagLev is a Ruby implementation built on top of a mature VM which offers native object persistence. Working with these live objects is awesome - but this image-based development is very different than traditional file-based development. MagLev uses both which has broad reaching effects - from design to deployment.

In traditional applications, data and code are separate. Deployments involve pulling new code, updating or migrating the data-store, and restarting or reloading the application which creates a new runtime with this new code.

MagLev's transient objects behave in this same manner, but committed objects are always there. Migrating these live, persistent objects is quite different. Your ‘data’ migrations involve things like instance variables, method definitions and class hierarchies, rather than creating tables or updating column definitions.

In this talk we will walk through how to:

@johnnyt
johnnyt / nginx-install.sh
Last active December 24, 2015 12:09
NGINX try_files Apache
# Install NGINX
sudo apt-get install nginx
# Rename github repository to ads_archive
# Create new github repository named ads
REPO_URL="https://github.com/mediaFORGE/ads.git"
ADS_DIR=/mnt/tmp # ??
ADS_ARCHIVE_DIR=/mnt/ads_archive
@johnnyt
johnnyt / nginx.conf
Created September 20, 2013 18:57
Image resizer in NGINX
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
@johnnyt
johnnyt / jsdoit.css
Created July 17, 2013 15:46
2013-07-12 1st
* {
margin: 0;
padding: 0;
border: 0;
}
body {
background: #dff;
font: 30px sans-serif;
}
Smalltalk current createPackage: 'HTML5' properties: #{}!
Object subclass: #LocalStorage
instanceVariableNames: 'scope'
category: 'HTML5'!
!LocalStorage commentStamp!
LocalStorage is a wrapper around HTML5 Local Storage.
Take a look at: http://diveintohtml5.org/storage.html
Example
@johnnyt
johnnyt / HTML5.js
Created April 3, 2013 21:38
HTML5 package for Amber Smalltalk
smalltalk.addPackage('HTML5', {});
smalltalk.addClass('LocalStorage', smalltalk.Object, ['scope'], 'HTML5');
smalltalk.LocalStorage.comment=unescape('LocalStorage%20is%20a%20wrapper%20around%20HTML5%20Local%20Storage.%0ATake%20a%20look%20at%3A%20http%3A//diveintohtml5.org/storage.html%0A%0AExample%0A%0A%09%7C%20local%20%7C%0A%09local%20%3A%3D%20LocalStorage%20new.%0A%09local%20at%3A%20%27message%27%20put%3A%20%27Hello%20World%21%27.%0A%09Transcript%20show%3A%20%28local%20at%3A%20%27message%27%29%3B%20cr.')
smalltalk.addMethod(
unescape('_keys'),
smalltalk.method({
selector: unescape('keys'),
category: 'accessing',
fn: function (){
var self=this;
@johnnyt
johnnyt / setup.sh
Created January 21, 2013 20:55
Setup Linux Mint
sudo sh -c 'sudo add-apt-repository -y ppa:pitti/postgresql \
&& add-apt-repository -y ppa:webupd8team/sublime-text-2 \
&& apt-get update \
&& apt-get install -y linux-headers-generic linux-firmware-nonfree \
sublime-text chromium-browser \
autoconf automake bison build-essential curl git libtool openssl pkg-config sqlite3 subversion \
libc6-dev libncurses5-dev libsqlite3-dev libreadline6-dev libssl-dev libxml2-dev libxslt1-dev libyaml-dev libzmq-dev zlib1g-dev \
python-setuptools dkms pgadmin3 \
htop nethogs iotop tmux vim-nox zsh psmisc quicksynergy grc \