-
rendering pipeline
-
layer tree(your code) vs presentation tree => pass to render tree
-
blending vs compositing
view 疊太深 => draw into your own buffer <=> against animation
| /* | |
| S : \x y z -> x z (y z) | |
| */ | |
| // S :: (z -> (a -> b)) -> (z -> a) -> z -> b | |
| function S(x, y, z) { | |
| return x(z)(y(z)); | |
| } | |
| // example: | |
| // add :: a -> a -> a |
| # 單純用來決定該有哪些 interface 和一些是在我們這邊處理的邏輯 | |
| class PaymentGateway | |
| attr_reader :email | |
| SUBSCRIPTION_AMOUNT = 10.to_money | |
| def initialize(user) | |
| @email = user.email | |
| end |
| #!/usr/bin/ruby | |
| # Create display override file to force Mac OS X to use RGB mode for Display | |
| # see http://embdev.net/topic/284710 | |
| require 'base64' | |
| data=`ioreg -l -d0 -w 0 -r -c AppleDisplay` | |
| edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten | |
| vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten |
| package main | |
| import ( | |
| "fmt" | |
| "io/ioutil" | |
| "os" | |
| "os/exec" | |
| ) | |
| var ( |
createElement.js lets document.createElement use CSS selectors.
This is a pretty useful library for building out DOM elements. The whole thing runs on one regex and a for loop, so it’s plenty fast. The script is 300 bytes when compressed and gzipped. For 524 bytes (advanced), it includes nesting support and can generate entire DOM hierarchies, including text nodes.
document.createElement(); // generates <div />| defmodule Fun do | |
| def arity(fun) do | |
| case :erlang.fun_info(fun, :arity) do | |
| { :arity, arity } -> | |
| arity | |
| end | |
| end | |
| def adapt!(fun, 0) do | |
| fn -> fun.([]) end |
For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.
Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.
You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.
| Ruby 2.1.0 in Production: known bugs and patches | |
| Last week, we upgraded the github.com rails app to ruby 2.1.0 in production. | |
| While testing the new build for rollout, we ran into a number of bugs. Most of | |
| these have been fixed on trunk already, but I've documented them below to help | |
| anyone else who might be testing ruby 2.1 in production. | |
| @naruse I think we should backport these patches to the ruby_2_1 branch and | |
| release 2.1.1 sooner rather than later, as some of the bugs are quite critical. | |
| I'm happy to offer any assistance I can to expedite this process. |
| # Another example for: http://onor.io/2014/03/31/partial-function-application-in-elixir/ | |
| defmodule PartFuncs do | |
| defp addfun(x, y), do: x + y | |
| # return a partially applied function | |
| def add(a), do: &addfun(a, &1) | |
| # could also easily be written as: addfun(a, b) | |
| def add(a, b), do: (&addfun/2).(a, b) |