Skip to content

Instantly share code, notes, and snippets.

@caike
caike / routes.rb
Created January 31, 2014 16:28
Nice to have Route concern
BananaPodcast::Application.routes.draw do
class APIEndPoint
def self.call(mapper, options)
mapper.namespace :api, path: '/', constraints: { subdomain: 'api' }
end
end
concern :api, APIEndPoint
resources :zombies, concerns: :api
@caike
caike / retrospective.md
Created April 22, 2014 22:16
Retrospective for the Coding Dojo @ RailsConf 2014

Coding Dojo @ RailsConf 2014

These are some of the things people had to say during our retrospective:

Things we did well

  • No one took over the code
  • Good collaboration
  • Good Communication
  • Used MiniTest for the first time
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
@caike
caike / emitter.js
Created September 26, 2014 20:02
EventEmitter in Node
var EventEmitter = require('events').EventEmitter;
var util = require('util');
function Player(name, signature){
this.name = name;
this.signature = signature;
}
util.inherits(Player, EventEmitter);
@caike
caike / Dockerfile
Created September 28, 2014 15:11
dockerfile
# DOCKER-VERSION 1.2.0
FROM centos:centos6
# Enable EPEL for Node.js
RUN rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# Install Node.js and npm
RUN yum install -y npm
# Bundle app source
@caike
caike / Dockerfile
Created September 29, 2014 21:54
Fixed version of the Dockerfile for the tutorial at https://docs.docker.com/examples/nodejs_web_app/
# DOCKER-VERSION 1.2.0
FROM centos:centos6
# Enable EPEL for Node.js
RUN rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# Install Node.js and npm
RUN yum install -y npm
# Creates a new folder on the container
VOLUME /src
@caike
caike / Dockerfile
Last active August 29, 2015 14:07
This Dockerfile pulls application files from a URL, using the `ADD` method
# DOCKER-VERSION 1.2.0
FROM centos:centos6
# Enable EPEL for Node.js
RUN rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# Install Node.js and npm
RUN yum install -y npm
ADD https://raw.githubusercontent.com/caike/ExpressDocker/master/src/app.js /tmp/app.js
ADD https://raw.githubusercontent.com/caike/ExpressDocker/master/src/package.json /tmp/package.json
@caike
caike / angular_size.sh
Last active August 29, 2015 14:09
Calculating AngularJS 1.3.2 size once minified and compressed
wget -O angular.js https://ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js
gzip angular.js
ls -h angular.js.gz # 45KB
@caike
caike / twit-tv-demo.rb
Created May 5, 2015 19:25
Demo code for Twit.tv
class Person
def initialize(name, location)
@name, @location = name, location
end
def greet
"Hello my name is #{@name} and I'm from #{@location}"
end
end