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 / concept.rb
Created August 1, 2015 21:19
Parse large xml file in Ruby
# Use Nokogiri::XML::SAX::Parser (event-driven parser) and Nokogiri::XML::SAX::Document
require 'nokogiri'
class IDCollector < Nokogiri::XML::SAX::Document
attr :ids
def initialize
@ids = []
@inside_id = false
echo -n $'\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x01\x03\x62\x61\x64\x00\x00\xf9\x00\x01\x03\x62\x61\x64\x00\x00\x10\x00\x01\x00\x00\x00\xc8\x00\x06\x05\x68\x65\x6c\x6c\x6f' | nc -u localhost 53
var API = {
get: function() {
return new Promise(function() {
// ... some code to get remotely
});
}
}
var UserAPI = {
getById: function(id) {
@cheeyeo
cheeyeo / pipe.exs
Created July 21, 2015 22:05
Inspecting using pipe operator in Elixir
[1,2,3] |> Enum.map(&(IO.inspect(&1)))

React.js Minimal Entropy Guide

DO's:

  • Use explicit contracts to pipe data & events between systems
  • Business rules should bubble towards the top, UI and semantics should sink towards the bottom

DONT's:

@cheeyeo
cheeyeo / example.js
Last active August 29, 2015 14:24
REACTJS
// calling setProps is not good practice
// instead render the component outside of the react loop
React.render(
myComponent({ data: someData2 }),
document.getElementById('predictionContent')
);