Skip to content

Instantly share code, notes, and snippets.

View cheeyeo's full-sized avatar
💭
Researching on use of transformers in computer vision

Chee Yeo cheeyeo

💭
Researching on use of transformers in computer vision
View GitHub Profile
@cheeyeo
cheeyeo / sse.go
Created July 4, 2014 20:59 — forked from ismasan/sse.go
package main
import (
"fmt"
"log"
"net/http"
"time"
)
// Example SSE server in Golang.
require 'fog'
username = 'testuser'
bucket = 'uniquebucketname1234'
aws_credentials = {
:aws_access_key_id => 'YOUR-ACCESS-KEY-ID',
:aws_secret_access_key => 'YOUR-SECRET-ACCESS-KEY'
}
@cheeyeo
cheeyeo / example.rb
Last active August 29, 2015 14:02
Conversion Ratio
class Quantity
include Comparable
CoercedNumber = Struct.new(:value) do
def +(other) raise TypeError; end
def -(other) raise TypeError; end
def *(other)
other * value
end
def /(other) raise TypeError; end
@cheeyeo
cheeyeo / sse.go
Created June 24, 2014 19:47 — forked from ismasan/sse.go
package main
import (
"fmt"
"log"
"net/http"
"time"
)
// Example SSE server in Golang.
@cheeyeo
cheeyeo / spec.rb
Created June 18, 2014 16:34
RSPEC Shared examples
shared_examples "collections" do
it "is empty when first created" do
expect(described_class.new).to be_empty
end
end
describe Array do
include_examples "collections", Array
end
class AnonymousUser < User
attr_accessible *ACCESSIBLE_ATTRS, :type, :token, as: :registrant
def register(params)
params = params.merge(type: 'User', token: nil)
self.update_attributes(params, as: :registrant)
end
end
'use strict';
module.exports = function(grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// configurable paths
var paths = {
@cheeyeo
cheeyeo / gist:88a05602303a29843712
Last active August 29, 2015 14:01
Autoloading in rails
http://www.zhubert.com/blog/2013/06/02/activemodel-part-1/
http://api.rubyonrails.org/classes/ActiveSupport/Autoload.html
http://guides.rubyonrails.org/plugins.html#generate-a-gemified-plugin
or maybe it needs a railitie:
http://api.rubyonrails.org/classes/Rails/Railtie.html
@cheeyeo
cheeyeo / config.yml
Created May 26, 2014 19:39
YAML loading in ruby 2.1
default: &default
adapter: postgresql
encoding: unicode
pool: 5
username: root
password:
development:
<<: *default
database: db_development
@cheeyeo
cheeyeo / gist:f12611c4247288b593c9
Created May 25, 2014 17:03
Streaming csv in ROR
http://smsohan.com/blog/2013/05/09/genereating-and-streaming-potentially-large-csv-files-using-ruby-on-rails/