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
/**
* Multipromise
*
* A jQuery.Deferred() - like promise implementation
* that supports adding multiple child promises to it.
* done / fail callbacks will trigger multiple times as child promises are resolved / rejected
* Useful for streaming promise-based data flows
*
* Example
*
CREATE VIEW product_stats AS
SELECT organization_id,
SUM(CASE WHEN status = 'active' THEN 1 END) active_count,
SUM(CASE WHEN status = 'inactive' THEN 1 END) inactive_count
FROM products
GROUP BY organization_id
# -*- mode: ruby -*-
# vi: set ft=ruby :
# override these variables in ~/.vagrant.d/Vagrantfile for your local changes
$local_username ||= `whoami`.strip
$local_projects_directory ||= "~/projects/vagrant/"
$vm_memory ||= "4096"
$vm_cpus ||= "4"
$server_root_password = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
@cheeyeo
cheeyeo / scrape.rb
Created January 12, 2014 17:43 — forked from jescalan/scrape.rb
require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'colored'
# this is just a preview of what's to come - a proof of concept.
# it will be converted to a api-type library, gemified, and put in it's own repo
# for now, a cool way to experiment with amazon's data
query = 'ruby'
angular.module('myMdl', []).config(['$httpProvider', function($httpProvider) {
$httpProvider.responseInterceptors.push([
'$q', '$templateCache', 'activeProfile',
function($q, $templateCache, activeProfile) {
// Keep track which HTML templates have already been modified.
var modifiedTemplates = {};
// Tests if there are any keep/omit attributes.
var HAS_FLAGS_EXP = /data-(keep|omit)/;

What is the problem?

  • What issue(s) have been reported?
  • What sort of abnormal behaviour have you noticed?
  • What error(s) are you seeing?

How does this problem affect your customers?

Many problems a team encounters will have a direct impact on how people use your sites. It is very important to understand how your work will affect your customers before you decide on a solution to the problem. If you don't, it will be tempting to write code that "fixes" the immediate issue but does not really improve the system as a whole. Instead of making the system better, you will have introduced technical debt that will be paid back in the form of unexpected problems or reduced flexibility later.

@cheeyeo
cheeyeo / .zshrc
Created January 29, 2014 15:42 — forked from SlexAxton/.zshrc
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
@cheeyeo
cheeyeo / Procfile
Created January 29, 2014 15:46 — forked from ismasan/Procfile
web: bundle exec rails server puma -p $PORT -e $RACK_ENV
critical: env HEROKU_PROCESS=critical bundle exec sidekiq -c 2 -q critical,4
default: env HEROKU_PROCESS=default bundle exec sidekiq -c 4 -q default,2
low: env HEROKU_PROCESS=low bundle exec sidekiq -c 1 -q low,1
# MOTIVATION: As rails apps are growing, people are noticing the drawbacks
# of the ActiveRecord pattern. Several apps I have seen, and several
# developers I have spoken to are looking towards other patterns for object
# persistence. The major drawback with ActiveRecord is that the notion
# of the domain object is conflated with what it means to store/retrieve
# it in any given format (like sql, json, key/value, etc).
#
# This is an attempt to codify the Repository pattern in a way that would
# feel comfortable to beginner and seasoned Ruby developers alike.
#
@cheeyeo
cheeyeo / gist:8848716
Created February 6, 2014 17:25
Run sub command in bash shell - below opens up the gem specified in a Gemfile within sublime

subl $(bundle show ac_platform)