crystal wasm.cr
php -S localhost:3000
- open your browser
- open dev tool js console
crystal.add(1, 2)
NOTE: This is outdated. Check the comments below for more up-to-date forks of this gist.
Improved YARD CHEATSHEET http://yardoc.org
forked from https://gist.github.com/chetan/1827484 which is from early 2012 and contains outdated information.
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
,elem.offsetTop
,elem.offsetWidth
,elem.offsetHeight
,elem.offsetParent
module Indexable(T) | |
def threadpool_map(workers : Int = 8, chunk_size : Int? = nil, &func : T -> R) forall T, R | |
mutex = Thread::Mutex.new | |
cs = chunk_size || (self.size**0.5).ceil.to_i | |
Array(R).build(self.size) do |result| | |
index = 0 | |
threads = Array.new(workers) { | |
Thread.new do | |
a = b = 0 | |
loop do |
# The command finds the most recent tag that is reachable from a commit. | |
# If the tag points to the commit, then only the tag is shown. | |
# Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object | |
# and the abbreviated object name of the most recent commit. | |
git describe | |
# With --abbrev set to 0, the command can be used to find the closest tagname without any suffix: | |
git describe --abbrev=0 | |
# other examples |
Native HTML controls are a challenge to style. You can style any element in the web platform that uses Shadow DOM with a pseudo element ::pseudo-element
or the /deep/
path selector.
video::webkit-media-controls-timeline {
background-color: lime;
}
video /deep/ input[type=range] {
// XPath CheatSheet | |
// To test XPath in your Chrome Debugger: $x('/html/body') | |
// http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/ | |
// 0. XPath Examples. | |
// More: http://xpath.alephzarro.com/content/cheatsheet.html | |
'//hr[@class="edge" and position()=1]' // every first hr of 'edge' class |