(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| import numpy as np | |
| import cv2 | |
| def overlay_alpha_image_lazy(background_rgb, overlay_rgba, alpha): | |
| # cf https://en.wikipedia.org/wiki/Alpha_compositing#Alpha_blending | |
| # If the destination background is opaque, then | |
| # out_rgb = overlay_rgb * overlay_alpha + background_rgb * (1 - overlay_alpha) | |
| overlay_alpha = overlay_rgba[: , : , 3].astype(np.float) / 255. * alpha | |
| overlay_alpha_3 = np.dstack((overlay_alpha, overlay_alpha, overlay_alpha)) | |
| overlay_rgb = overlay_rgba[: , : , : 3].astype(np.float) |
| find_value = (haystack, needle, cache=new WeakMap()) -> | |
| # console.log "haystack: ", haystack | |
| # console.log "needle: ", needle | |
| try | |
| if haystack? | |
| unless typeof haystack == 'object' and cache.has haystack | |
| cache.set haystack, true | |
| for key, value of haystack |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| --------- | |
| -- Convert Things database to Things Beta database. | |
| -- This script clones all area's, projects, people and tasks with all its relations, properties and correct ordering without any duplicates. | |
| -- * 25 November 2011: Initial version. | |
| -- * 26 November 2011: Removed some linefeeds to make it better readable on the forum. | |
| -- * 27 November 2011: Fixed bug in addTask where activation was set in error. | |
| -- | |
| -- TODO: | |
| -- * Preserve log dates of completed tasks in the logbook. (I really want this, but think it isn't possible according to the current Things AppleScipt Guide?) | |
| -- * Preserve repeating schedules. (I think this isn't possible either?) |