Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

David Chen mvj3

🎯
Focusing
Block or report user

Report or block mvj3

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mvj3
mvj3 / Discussion
Last active Jun 5, 2018
The Google Trends of 4 Web Frameworks Between 2005-2018:\nRuby on Rails, NodeJS, Python Flask, Java Spring.
View Discussion
Web development technologies change quickly in the recent decade. This visualisation displays the popularity change of 4 web frameworks. I scraped the data from Google Trends website. And here I choose the original colour of each web framework logo as the colours of time series.
When we look at this chart, we would easily find all web frameworks are becoming more popular than the past, except Ruby on Rails. Before 2005, Java was the mainstream way to build websites. When Web 2.0 SNS time came, people demanded an easy full-stack way to build the websites quickly. Ruby on Rails became popular due to its Convention over Configuration principle and the dynamic of Ruby programming language. Between 2007 and 2010, people find the shortcoming of Ruby on Rails is hard to maintain when the business and websites grow, and also the poor performance. After 2011, the market demanded more complicated frontend technology to provide more complex user experience, NodeJS came to solve this problem, and NodeJS also improved
@mvj3
mvj3 / local_benchmark.py
Created May 13, 2015
JSON VS eval performance benchmark, see requirement at https://github.com/spotify/luigi/pull/939
View local_benchmark.py
# -*-coding:utf-8-*-
from etl_utils import process_notifier
from collections import Counter, defaultdict
import ujson
null = None
def char_count(func):
result = defaultdict(int)
@mvj3
mvj3 / enc_dec_test.py
Last active Aug 29, 2015 — forked from justinfx/enc_dec_test.py
Speed test of common serializers on python 2.7.9 (pickle, cPickle, ujson, cjson, simplejson, json, yajl, msgpack, Python builtin)
View enc_dec_test.py
"""
Dependencies:
pip install tabulate simplejson python-cjson ujson yajl msgpack-python
"""
from timeit import timeit
from tabulate import tabulate
View benchmark.py
# -*-coding:utf-8-*-
'''cjson, jsonlib, simplejson, and yajl also use C code
demjson did not use C code, but was too painfully slow to benchmark
(took about 20 seconds for these tests)
'''
import json
import sys
import time
@mvj3
mvj3 / overwrite_base.py
Created Jan 6, 2015
Overwrite base class's methods.
View overwrite_base.py
# -*- coding: utf-8 -*-
"""
Overwrite base class's methods.
"""
import unittest
class Base(object):
@mvj3
mvj3 / analysis_hg_day_commit_count.rb
Created Dec 19, 2014
用 Ruby 简单 统计 hg 每日 commit 量。
View analysis_hg_day_commit_count.rb
`hg log --template 'date: {date|isodate}\n' | grep 'date: '`.split("\n").map {|i1| i1[6..15] }.inject({}) {|d1, i1| d1[i1] ||= 0; d1[i1] += 1; d1 }.sort {|a, b| a[0] <=> b[0] }.each {|i| puts i.inspect };0
__END__
["2014-09-24", 4]
["2014-09-25", 8]
["2014-09-26", 6]
["2014-09-28", 10]
["2014-09-29", 14]
["2014-09-30", 3]
["2014-10-08", 14]
@mvj3
mvj3 / lazy_load_reference.py
Created Dec 5, 2014
Lazy reference between tasks, include recursive references.
View lazy_load_reference.py
# Lazy reference between tasks, include recursive references.
# 1. `eval` version
def ref_tasks(*tasks):
def wrap(task1):
def _ref_task(self):
return eval(task1)
return _ref_task
@mvj3
mvj3 / slow.coffee
Last active Aug 29, 2015
Simulate slow cpu computing
View slow.coffee
_.each(Array(10), -> Array(Math.pow(10, 8)).join("=").length)
@mvj3
mvj3 / python_singleton.py
Created Jul 23, 2014
从Singleton实现看Python里的__new__和__init__区别。
View python_singleton.py
from singleton import singleton
@singleton(True)
class hh(object):
cc = 0
def __init__(self):
hh.cc += 1
self.count = hh.cc
You can’t perform that action at this time.